diff --git a/.github/workflows/build.yml b/.github/workflows/ci.yml similarity index 62% rename from .github/workflows/build.yml rename to .github/workflows/ci.yml index 9734978..8e38a0d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/ci.yml @@ -4,31 +4,26 @@ on: [push, pull_request] jobs: build: - name: ${{ matrix.name }} Build + name: Build runs-on: ${{ matrix.os }} container: ${{ matrix.container }} strategy: fail-fast: false matrix: + os: [windows-2022, ubuntu-latest] include: - - os: windows-latest - name: Windows + - os: windows-2022 - os: ubuntu-latest - name: SteamRT3 - container: ghcr.io/source2ze/build-containers:steamrt3 - - os: ubuntu-latest - name: SteamRT4 - container: ghcr.io/source2ze/build-containers:steamrt4 + container: registry.gitlab.steamos.cloud/steamrt/sniper/sdk steps: - name: Checkout - uses: actions/checkout@v7 + uses: actions/checkout@v4 with: path: MovementUnlocker submodules: recursive - fetch-depth: 0 - name: Checkout Metamod - uses: actions/checkout@v7 + uses: actions/checkout@v4 with: repository: alliedmodders/metamod-source ref: master @@ -36,35 +31,34 @@ jobs: submodules: recursive - name: Checkout HL2SDK - uses: actions/checkout@v7 + uses: actions/checkout@v4 with: repository: alliedmodders/hl2sdk ref: cs2 path: hl2sdk-cs2 - name: Checkout AMBuild - if: matrix.os == 'windows-latest' - uses: actions/checkout@v7 + uses: actions/checkout@v4 with: repository: alliedmodders/ambuild path: ambuild - name: Install AMBuild - if: matrix.os == 'windows-latest' - run: pip install setuptools && cd ambuild && python setup.py install && cd .. + run: | + cd ambuild && python setup.py install && cd .. - name: Build working-directory: MovementUnlocker shell: bash run: | mkdir build && cd build - python ../configure.py --enable-optimize --sdks cs2 + python ../configure.py --enable-optimize --symbol-files --sdks cs2 ambuild - name: Upload artifact - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@v4 with: - name: ${{ matrix.name }} + name: ${{ runner.os }} path: MovementUnlocker/build/package release: @@ -75,20 +69,15 @@ jobs: steps: - name: Download artifacts - uses: actions/download-artifact@v8 + uses: actions/download-artifact@v4 - name: Package run: | version=`echo $GITHUB_REF | sed "s/refs\/tags\///"` ls -Rall - if [ -d "./SteamRT3/" ]; then - cd ./SteamRT3/ - tar -czf ../${{ github.event.repository.name }}-${version}-steamrt3.tar.gz * - cd - - fi - if [ -d "./SteamRT4/" ]; then - cd ./SteamRT4/ - tar -czf ../${{ github.event.repository.name }}-${version}-steamrt4.tar.gz * + if [ -d "./Linux/" ]; then + cd ./Linux/ + tar -czf ../${{ github.event.repository.name }}-${version}-linux.tar.gz * cd - fi if [ -d "./Windows/" ]; then diff --git a/AMBuildScript b/AMBuildScript index cc5c402..77353ac 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -278,7 +278,7 @@ class MMSPluginConfig(object): cxx.cxxincludes += [ os.path.join(context.currentSourcePath), os.path.join(mms_core_path), - os.path.join(self.mms_root, 'third_party', 'khook', 'include'), + os.path.join(mms_core_path, 'sourcehook'), ] defines = [] diff --git a/MovementUnlocker.cpp b/MovementUnlocker.cpp index 2781173..666d1a9 100644 --- a/MovementUnlocker.cpp +++ b/MovementUnlocker.cpp @@ -19,7 +19,7 @@ #include #include "MovementUnlocker.h" -#include "khook/memory.hpp" +#include #ifdef _WIN32 #include #elif __linux__ @@ -29,13 +29,13 @@ MovementUnlocker g_MovementUnlocker; #ifdef _WIN32 -const unsigned char *pPatchSignature = (unsigned char *)"\x0F\x86\xAF\x2A\x2A\x2A\x0F\x57\xC0\x0F\x2E\xC2"; -const char *pPatchPattern = "xxx???xxxxxx"; -int PatchLen = 6; -#elif __linux__ -const unsigned char * pPatchSignature = (unsigned char *)"\x76\x2A\xF3\x0F\x51\xC0\xF3\x0F\x7E\xDB\x49\x8B\x06"; -const char* pPatchPattern = "x?xxxxxxxxxxx"; +const unsigned char *pPatchSignature = (unsigned char *)"\x76\x2A\xF2\x0F\x10\x4E\x2A\x41\x0F\x28\xD2\x0F\x28\xC1"; +const char *pPatchPattern = "x?xxxx?xxxxxxx"; int PatchLen = 1; +#elif __linux__ +const unsigned char * pPatchSignature = (unsigned char *)"\x0F\x87\x2A\x2A\x2A\x2A\x49\x8B\x7C\x24\x2A\x48\x85\xFF"; +const char* pPatchPattern = "xx????xxxx?xxx"; +int PatchLen = 6; #endif // From https://git.botox.bz/CSSZombieEscape/sm-ext-PhysHooks @@ -110,19 +110,16 @@ bool MovementUnlocker::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxl return false; } - KHook::Memory::SetAccess((void*)pPatchAddress, PatchLen, KHook::Memory::READ | KHook::Memory::WRITE | KHook::Memory::EXECUTE); + SourceHook::SetMemAccess((void*)pPatchAddress, PatchLen, SH_MEM_READ | SH_MEM_WRITE | SH_MEM_EXEC); #ifdef _WIN32 - const char* patchBytes[] = {"\xE9", "\xB0", "\x00", "\x00", "\x00", "\x90"}; - - for (int i = 0; i < PatchLen; i++) - *(unsigned char*)(pPatchAddress + i) = ((unsigned char*)patchBytes[i])[0]; + *(unsigned char*)(pPatchAddress) = ((unsigned char*)"\xEB")[0]; #elif __linux__ for (int i = 0; i < PatchLen; i++) - *(unsigned char*)(pPatchAddress + i) = ((unsigned char*)"\xEB")[0]; + *(unsigned char*)(pPatchAddress + i) = ((unsigned char*)"\x90")[0]; #endif - KHook::Memory::SetAccess((void*)pPatchAddress, PatchLen, KHook::Memory::READ | KHook::Memory::EXECUTE); + SourceHook::SetMemAccess((void*)pPatchAddress, PatchLen, SH_MEM_READ | SH_MEM_EXEC); META_CONPRINTF( "[Movement Unlocker] Successfully patched Movement Unlocker!\n" ); return true; @@ -154,7 +151,7 @@ const char *MovementUnlocker::GetLicense() const char *MovementUnlocker::GetVersion() { - return "2.0.1"; + return "1.5"; } const char *MovementUnlocker::GetDate() diff --git a/hl2sdk-manifests b/hl2sdk-manifests index 20b3a01..a57b309 160000 --- a/hl2sdk-manifests +++ b/hl2sdk-manifests @@ -1 +1 @@ -Subproject commit 20b3a014264b38908c4a5d4eb263ba2c488f3dc1 +Subproject commit a57b3095a6fc31a98b13e2d73ebb668dac4f1300