Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
update v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rejchev committed Aug 18, 2023
1 parent 1c1e68a commit 42ab908
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 31 deletions.
54 changes: 43 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,47 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
sourcemod-version: [1.11-dev]
os:
- ubuntu-latest
- windows-latest
- ubuntu-20.04

sourcemod-version:
- 1.11-dev

include:
- os: ubuntu-latest
target-archs: x86,x86_64
target-archs: x86
compiler_cc: clang
compiler_cxx: clang++

- os: windows-latest
target-archs: x86,x86_64
target-archs: x86
compiler_cc: msvc

- os: ubuntu-20.04
target-archs: x86
compiler_cc: clang-8
compiler_cxx: clang++-8

steps:
- name: Install Linux packages
- name: Install ${{ matrix.os }} packages
if: runner.os == 'Linux'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
gcc-multilib g++-multilib libstdc++6 lib32stdc++6 \
libc6-dev libc6-dev-i386 linux-libc-dev \
linux-libc-dev:i386 lib32z1-dev ${{ matrix.compiler_cc }}
- name: Select compiler
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -yq --no-install-recommends g++-multilib
echo "CC=${{ matrix.compiler_cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.compiler_cxx }}" >> $GITHUB_ENV
${{ matrix.compiler_cc }} --version
${{ matrix.compiler_cxx }} --version
- name: Setup Python 3.8
uses: actions/setup-python@v4
Expand Down Expand Up @@ -67,10 +93,10 @@ jobs:
python ../configure.py --enable-optimize --targets=${{ matrix.target-archs }}
ambuild
- name: Upload artifact
- name: Upload artifact ${{ matrix.os }}
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}
name: ${{ matrix.os }}
path: extension/build/package


Expand All @@ -79,6 +105,13 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- ubuntu-20.04

steps:
- name: Download artifacts
Expand All @@ -87,8 +120,7 @@ jobs:
- name: Package
run: |
version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`
7z a clown-core-${version}.${{ github.run_number }}-linux.zip ./Linux/*
7z a clown-core-${version}.${{ github.run_number }}-windows.zip ./Windows/*
7z a clown-core-${version}.${{ github.run_number }}-${{ matrix.os }}.zip ./${{ matrix.os }}/*
- name: Release
uses: svenstaro/upload-release-action@v2
Expand Down
5 changes: 3 additions & 2 deletions AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,13 @@ class ExtensionConfig(object):
cxx.cflags += ['/Oy-']

def configure_linux(self, cxx):
cxx.defines += ['_LINUX', 'POSIX']
cxx.defines += ['_LINUX', 'POSIX', '_FILE_OFFSET_BITS=64']
cxx.linkflags += ['-Wl,--exclude-libs,ALL', '-lm']
if cxx.family == 'gcc':
cxx.linkflags += ['-static-libgcc']
elif cxx.family == 'clang':
cxx.linkflags += ['-lgcc_eh']
cxx.linkflags += ['-lgcc_eh']
cxx.linkflags += ['-static-libstdc++']

def configure_mac(self, cxx):
cxx.defines += ['OSX', '_OSX', 'POSIX']
Expand Down
2 changes: 1 addition & 1 deletion extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bool ClownCore::SDK_OnLoad(char *error, size_t maxlength, bool late)
smutils->LogError(myself, "Failed on create forward %s", "clown_OnDataSent");

if((onDataReceived = forwards->CreateForward(
"clown_OnDataReceived", ET_Ignore, 2, nullptr, Param_String, Param_String
"clown_OnDataReceived", ET_Hook, 2, nullptr, Param_String, Param_String
)) == nullptr)
smutils->LogError(myself, "Failed on create forward %s", "clown_OnDataReceived");

Expand Down
8 changes: 6 additions & 2 deletions forwards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ DataAction OnSendData(const char* path, char* data, const size_t& maxLen)
return action;
}

void OnDataReceived(const char* path, const char* data)
DataAction OnDataReceived(const char* path, const char* data)
{
DataAction action = kContinue;

onDataReceived->PushString(path);
onDataReceived->PushString(data);
onDataReceived->Execute(nullptr);
onDataReceived->Execute((cell_t*)&action);

return action;
}

2 changes: 1 addition & 1 deletion forwards.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum DataAction
};

extern DataAction OnSendData(const char* path, char* data, const size_t& maxLen);
extern void OnDataReceived(const char* path, const char* data);
extern DataAction OnDataReceived(const char* path, const char* data);

extern SourceMod::IForward *onSendData;
extern SourceMod::IForward *onDataReceived;
Expand Down
4 changes: 1 addition & 3 deletions natives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ cell_t SendSignal(IPluginContext *pContext, const cell_t *params)
char* data;
pContext->LocalToString(params[2], &data);

OnDataReceived(path, data);

return 1;
return OnDataReceived(path, data);
}

const sp_nativeinfo_t natives[] = {
Expand Down
23 changes: 15 additions & 8 deletions pawn/scripting/include/clown-core.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,35 @@ enum DataAction
kContinue = 0,
kReceive,
kReject,
kReject_Immedently
kRejectImmedently
};

forward DataAction clown_OnDataSent(const char[] path, char[] data, int maxLen);

forward void clown_OnDataReceived(const char[] path, const char[] data);
// Final data send state
forward DataAction clown_OnDataReceived(const char[] path, const char[] data);

methodmap ClownCore
{
// @desc
// @desc Sending data to the environment (clown_OnDataReceived after call result 'll ignore)
//
// @param path Some virtual path
// @param data Json data
// @param data Some data buffer
// @param maxLen Some data buffer max length
//
// @return kContinue - data with out changes
// kReceive - data with changes (obv in json format)
// kReceive - data with changes
// kReject - call rejected (with out data change)
// kReject_Immendently - call rejected (with out data change and post call)
// kRejectImmendently - call rejected (with out data change and clown_OnDataReceived call)
public static native DataAction SendData(const char[] path, char[] data, int maxLen);

// ...
public static native void SendSignal(const char[] path, const char[] data = NULL_STRING);
// @desc Sending signal to the environment (clown_OnDataReceived call)
//
// @param path Some virtual path
// @param data Some data
//
// @return custom things
public static native DataAction SendSignal(const char[] path, const char[] data = NULL_STRING);
};

/**
Expand Down
6 changes: 3 additions & 3 deletions smsdk_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
*/

/* Basic information exposed publicly */
#define SMEXT_CONF_NAME "ClownCore"
#define SMEXT_CONF_NAME "Clown-Core"
#define SMEXT_CONF_DESCRIPTION "---"
#define SMEXT_CONF_VERSION "0.1.0.0"
#define SMEXT_CONF_VERSION "1.0.0"
#define SMEXT_CONF_AUTHOR "rej.chev"
#define SMEXT_CONF_URL "..."
#define SMEXT_CONF_LOGTAG "CloC"
#define SMEXT_CONF_LOGTAG "Clown"
#define SMEXT_CONF_LICENSE "GPL"
#define SMEXT_CONF_DATESTRING __DATE__
#define SMEXT_CONF_CONFIG "configs/clown-core/settings.json"
Expand Down

0 comments on commit 42ab908

Please sign in to comment.