From 55fbcc3b67cb698ad4eeab85642b0ad27b00cfa5 Mon Sep 17 00:00:00 2001 From: Michal <88426022+SlynxCZ@users.noreply.github.com> Date: Fri, 1 Aug 2025 21:34:08 +0200 Subject: [PATCH 01/13] Add docker files --- Dockerfile | 16 ++++++++++++++++ docker-compose.yml | 6 ++++++ docker-entrypoint.sh | 6 ++++++ 3 files changed, 28 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5b23335 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM registry.gitlab.steamos.cloud/steamrt/sniper/sdk + +WORKDIR /app + +RUN apt update && apt install -y clang-16 +RUN ln -sf /usr/bin/clang-16 /usr/bin/clang && ln -sf /usr/bin/clang++-16 /usr/bin/clang++ +RUN git clone https://github.com/alliedmodders/ambuild +RUN cd ambuild && python setup.py install && cd .. +RUN git clone https://github.com/alliedmodders/metamod-source +RUN git config --global --add safe.directory /app + +COPY ./docker-entrypoint.sh ./ +ENV HL2SDKCS2=/app/source/vendor/hl2sdk-cs2 +ENV MMSOURCE112=/app/source/vendor/metamod-source +WORKDIR /app/source +CMD [ "/bin/bash", "./docker-entrypoint.sh" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..09e207d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +services: + builder: + image: ambuilder + build: . + volumes: + - '.:/app/source' \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..ccdc180 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +mkdir dockerbuild +cd dockerbuild +pwd +python ../configure.py --enable-optimize --sdks cs2 --hl2sdk-manifests ./hl2sdk-manifests +ambuild \ No newline at end of file From 472a641d0efdabfd960e5523b10a58769aa6244c Mon Sep 17 00:00:00 2001 From: Michal <88426022+SlynxCZ@users.noreply.github.com> Date: Fri, 1 Aug 2025 21:34:42 +0200 Subject: [PATCH 02/13] Update multiaddonmanager.cpp --- src/multiaddonmanager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/multiaddonmanager.cpp b/src/multiaddonmanager.cpp index cc3df11..defd87a 100644 --- a/src/multiaddonmanager.cpp +++ b/src/multiaddonmanager.cpp @@ -140,19 +140,19 @@ SH_DECL_HOOK2(IGameEventManager2, LoadEventsFromFile, SH_NOATTRIB, 0, int, const constexpr const byte g_HostStateRequest_Sig[] = "\x48\x89\x74\x24\x2A\x57\x48\x83\xEC\x2A\x33\xF6\x48\x8B\xFA\x48\x39\x35"; constexpr const byte g_ReplyConnection_Sig[] = "\x48\x8B\xC4\x55\x41\x54\x41\x55\x41\x57"; #else -constexpr const byte g_HostStateRequest_Sig[] = "\x55\x48\x89\xE5\x41\x56\x41\x55\x41\x54\x49\x89\xF4\x53\x48\x83\x7F"; -constexpr const byte g_ReplyConnection_Sig[] = "\x55\xB9\x00\x01\x00\x00"; +constexpr const byte g_HostStateRequest_Sig[] = "\x55\x48\x89\xE5\x41\x57\x41\x56\x41\x55\x41\x54\x49\x89\xFC\x53\x48\x89\xF3\x48\x83\xEC\x18\x48\x83\x7F\x30\x00\x74\x70"; +constexpr const byte g_ReplyConnection_Sig[] = "\x55\x48\x8D\x05\xE8\xC2\xC1\xFF\x66\x0F\xEF\xC0\x48\x89\xE5\x41\x57\x41\x56\x41\x55\x41\x54\x49\x89\xFC\x53\x48\x89\xF3\x48\x81\xEC\xB8\x01\x00\x00"; #endif // Offsets -constexpr int g_iServerAddonsOffset = 328; +constexpr int g_iServerAddonsOffset = 336; #ifdef PLATFORM_WINDOWS constexpr int g_iSendNetMessageOffset = 15; constexpr int g_iClientListOffset = 624; #else -constexpr int g_iSendNetMessageOffset = 16; +constexpr int g_iSendNetMessageOffset = 13; constexpr int g_iClientListOffset = 640; #endif From f996093040968c0af4d99b9bc9f080cda1034b1b Mon Sep 17 00:00:00 2001 From: SlynxCZ Date: Fri, 1 Aug 2025 21:23:40 +0000 Subject: [PATCH 03/13] Add submodules --- .gitmodules | 7 +++++++ vendor/hl2sdk-cs2 | 1 + vendor/metamod-source | 1 + 3 files changed, 9 insertions(+) create mode 160000 vendor/hl2sdk-cs2 create mode 160000 vendor/metamod-source diff --git a/.gitmodules b/.gitmodules index 9abf89d..1d0d620 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,10 @@ [submodule "hl2sdk-manifests"] path = hl2sdk-manifests url = https://github.com/alliedmodders/hl2sdk-manifests +[submodule "vendor/hl2sdk-cs2"] + path = vendor/hl2sdk-cs2 + url = https://github.com/alliedmodders/hl2sdk + branch = cs2 +[submodule "vendor/metamod-source"] + path = vendor/metamod-source + url = https://github.com/alliedmodders/metamod-source diff --git a/vendor/hl2sdk-cs2 b/vendor/hl2sdk-cs2 new file mode 160000 index 0000000..35d0a31 --- /dev/null +++ b/vendor/hl2sdk-cs2 @@ -0,0 +1 @@ +Subproject commit 35d0a31085162979e9da905261ff3fc85fea9e69 diff --git a/vendor/metamod-source b/vendor/metamod-source new file mode 160000 index 0000000..5a282eb --- /dev/null +++ b/vendor/metamod-source @@ -0,0 +1 @@ +Subproject commit 5a282eb8fca984beaae49c9b68d6e944e5b9c6b3 From a5577712561b66912e658b8e9617cf536674aba9 Mon Sep 17 00:00:00 2001 From: Michal <88426022+SlynxCZ@users.noreply.github.com> Date: Fri, 1 Aug 2025 23:41:47 +0200 Subject: [PATCH 04/13] Update build.yml --- .github/workflows/build.yml | 118 +++++++++++------------------------- 1 file changed, 37 insertions(+), 81 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4221fc7..0b6a5ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: CI +name: Continuous Integration on: push: @@ -7,72 +7,35 @@ on: branches: - main paths-ignore: - - LICENSE - - README.md + - LICENSE + - README.md pull_request: paths-ignore: - - LICENSE - - README.md + - LICENSE + - README.md jobs: build: - name: Build - runs-on: ${{ matrix.os }} - container: ${{ matrix.container }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest] - include: - - os: windows-latest - - os: ubuntu-latest - container: registry.gitlab.steamos.cloud/steamrt/sniper/sdk - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - path: MultiAddonManager - submodules: recursive - fetch-depth: 0 - - - name: Checkout Metamod - uses: actions/checkout@v4 - with: - repository: alliedmodders/metamod-source - ref: master - path: mmsource-2.0 - submodules: recursive - - - name: Checkout HL2SDK - uses: actions/checkout@v4 - with: - repository: alliedmodders/hl2sdk - ref: cs2 - path: hl2sdk-cs2 + name: Build via Docker Compose + runs-on: ubuntu-latest - - name: Checkout AMBuild - uses: actions/checkout@v4 - with: - repository: alliedmodders/ambuild - path: ambuild + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive - - name: Install AMBuild - run: | - cd ambuild && python setup.py install && cd .. + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Build - working-directory: MultiAddonManager - shell: bash - run: | - mkdir build && cd build - python ../configure.py --enable-optimize --symbol-files --sdks cs2 - ambuild + - name: Build plugin inside container + run: docker compose up --build --abort-on-container-exit - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ runner.os }} - path: MultiAddonManager/build/package + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: linux-package + path: dockerbuild/package release: name: Release @@ -81,28 +44,21 @@ jobs: runs-on: ubuntu-latest steps: - - name: Download artifacts - uses: actions/download-artifact@v4 + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: linux-package + path: ./Linux - - name: Package - run: | - version=`echo $GITHUB_REF | sed "s/refs\/tags\///"` - ls -Rall - if [ -d "./Linux/" ]; then - cd ./Linux/ - tar -czf ../${{ github.event.repository.name }}-${version}-linux.tar.gz * - cd - - fi - if [ -d "./Windows/" ]; then - cd ./Windows/ - zip -r ../${{ github.event.repository.name }}-${version}-windows.zip * - cd - - fi + - name: Package Linux .so + run: | + version="${GITHUB_REF#refs/tags/}" + tar -czf MultiAddonManager-${version}-linux.tar.gz -C Linux . - - name: Release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ github.event.repository.name }}-* - tag: ${{ github.ref }} - file_glob: true + - name: Upload release archive + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: MultiAddonManager-*-linux.tar.gz + tag: ${{ github.ref }} + file_glob: true \ No newline at end of file From 0f624a9738974e6926f6a8ffa55f9bc9efd867f5 Mon Sep 17 00:00:00 2001 From: Michal <88426022+SlynxCZ@users.noreply.github.com> Date: Fri, 1 Aug 2025 23:45:49 +0200 Subject: [PATCH 05/13] Update build.yml --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b6a5ca..b9e843e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,12 @@ on: paths-ignore: - LICENSE - README.md + workflow_dispatch: + push: + tags: + - '*' + branches: + - main jobs: build: From ba9a76c1e910426ed4df92a459289ce17b7363ba Mon Sep 17 00:00:00 2001 From: Michal <88426022+SlynxCZ@users.noreply.github.com> Date: Fri, 1 Aug 2025 23:49:59 +0200 Subject: [PATCH 06/13] Delete .github/workflows/build.yml --- .github/workflows/build.yml | 70 ------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index b9e843e..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Continuous Integration - -on: - push: - tags: - - '*' - branches: - - main - paths-ignore: - - LICENSE - - README.md - pull_request: - paths-ignore: - - LICENSE - - README.md - workflow_dispatch: - push: - tags: - - '*' - branches: - - main - -jobs: - build: - name: Build via Docker Compose - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build plugin inside container - run: docker compose up --build --abort-on-container-exit - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: linux-package - path: dockerbuild/package - - release: - name: Release - if: startsWith(github.ref, 'refs/tags/') - needs: build - runs-on: ubuntu-latest - - steps: - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: linux-package - path: ./Linux - - - name: Package Linux .so - run: | - version="${GITHUB_REF#refs/tags/}" - tar -czf MultiAddonManager-${version}-linux.tar.gz -C Linux . - - - name: Upload release archive - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: MultiAddonManager-*-linux.tar.gz - tag: ${{ github.ref }} - file_glob: true \ No newline at end of file From 08e3b0337f83d8356a020aa630849d0b9c9463ce Mon Sep 17 00:00:00 2001 From: Michal <88426022+SlynxCZ@users.noreply.github.com> Date: Fri, 1 Aug 2025 23:50:30 +0200 Subject: [PATCH 07/13] Create main.yml --- .github/workflows/main.yml | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..5dc13a3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,70 @@ +name: Continuous Integration + +on: + push: + tags: + - '*' + branches: + - main + paths-ignore: + - LICENSE + - README.md + pull_request: + paths-ignore: + - LICENSE + - README.md + workflow_dispatch: + push: + tags: + - '*' + branches: + - main + +jobs: + build: + name: Build via Docker Compose + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build plugin inside container + run: docker compose up --build --abort-on-container-exit + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: linux-package + path: dockerbuild/package + + release: + name: Release + if: startsWith(github.ref, 'refs/tags/') + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: linux-package + path: ./Linux + + - name: Package Linux .so + run: | + version="${GITHUB_REF#refs/tags/}" + tar -czf MultiAddonManager-${version}-linux.tar.gz -C Linux . + + - name: Upload release archive + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: MultiAddonManager-*-linux.tar.gz + tag: ${{ github.ref }} + file_glob: true From 3632cca05495b2d4e01ee6add9a4c51f8e00fec5 Mon Sep 17 00:00:00 2001 From: Michal <88426022+SlynxCZ@users.noreply.github.com> Date: Fri, 1 Aug 2025 23:51:41 +0200 Subject: [PATCH 08/13] Update main.yml --- .github/workflows/main.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5dc13a3..be9c672 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,11 +14,6 @@ on: - LICENSE - README.md workflow_dispatch: - push: - tags: - - '*' - branches: - - main jobs: build: From e27fdb2e9586e7d9dc82dd4a21ae7266001228e0 Mon Sep 17 00:00:00 2001 From: Michal <88426022+SlynxCZ@users.noreply.github.com> Date: Sat, 2 Aug 2025 00:00:55 +0200 Subject: [PATCH 09/13] Update Dockerfile --- Dockerfile | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5b23335..c3a328f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,20 @@ -FROM registry.gitlab.steamos.cloud/steamrt/sniper/sdk - -WORKDIR /app - -RUN apt update && apt install -y clang-16 -RUN ln -sf /usr/bin/clang-16 /usr/bin/clang && ln -sf /usr/bin/clang++-16 /usr/bin/clang++ -RUN git clone https://github.com/alliedmodders/ambuild -RUN cd ambuild && python setup.py install && cd .. -RUN git clone https://github.com/alliedmodders/metamod-source -RUN git config --global --add safe.directory /app - -COPY ./docker-entrypoint.sh ./ -ENV HL2SDKCS2=/app/source/vendor/hl2sdk-cs2 -ENV MMSOURCE112=/app/source/vendor/metamod-source -WORKDIR /app/source -CMD [ "/bin/bash", "./docker-entrypoint.sh" ] \ No newline at end of file +FROM registry.gitlab.steamos.cloud/steamrt/sniper/sdk + +WORKDIR /app + +RUN apt update && apt install -y wget gnupg lsb-release curl +RUN curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - +RUN echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-14 main" > /etc/apt/sources.list.d/llvm.list +RUN apt update && apt install -y clang-14 clang++-14 +RUN ln -sf /usr/bin/clang-14 /usr/bin/clang && ln -sf /usr/bin/clang++-14 /usr/bin/clang++ + +RUN git clone https://github.com/alliedmodders/ambuild +RUN cd ambuild && python setup.py install && cd .. +RUN git clone https://github.com/alliedmodders/metamod-source +RUN git config --global --add safe.directory /app + +COPY ./docker-entrypoint.sh ./ +ENV HL2SDKCS2=/app/source/vendor/hl2sdk-cs2 +ENV MMSOURCE112=/app/source/vendor/metamod-source +WORKDIR /app/source +CMD ["/bin/bash", "./docker-entrypoint.sh"] \ No newline at end of file From ad3f394b23c6f47673603165ade5acadcf367a51 Mon Sep 17 00:00:00 2001 From: Michal <88426022+SlynxCZ@users.noreply.github.com> Date: Sat, 2 Aug 2025 00:09:57 +0200 Subject: [PATCH 10/13] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c3a328f..ffcdca3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,8 @@ WORKDIR /app RUN apt update && apt install -y wget gnupg lsb-release curl RUN curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - RUN echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-14 main" > /etc/apt/sources.list.d/llvm.list -RUN apt update && apt install -y clang-14 clang++-14 -RUN ln -sf /usr/bin/clang-14 /usr/bin/clang && ln -sf /usr/bin/clang++-14 /usr/bin/clang++ +RUN apt update && apt install -y clang-14 +RUN ln -sf /usr/bin/clang-14 /usr/bin/clang && ln -sf /usr/bin/clang-14 /usr/bin/clang++ RUN git clone https://github.com/alliedmodders/ambuild RUN cd ambuild && python setup.py install && cd .. From 25d7e40d57cd7ace3b582be7124cd78525eb9dcc Mon Sep 17 00:00:00 2001 From: Michal <88426022+SlynxCZ@users.noreply.github.com> Date: Sat, 2 Aug 2025 00:20:18 +0200 Subject: [PATCH 11/13] Update Dockerfile --- Dockerfile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index ffcdca3..420749a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,8 @@ FROM registry.gitlab.steamos.cloud/steamrt/sniper/sdk WORKDIR /app -RUN apt update && apt install -y wget gnupg lsb-release curl -RUN curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - -RUN echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-14 main" > /etc/apt/sources.list.d/llvm.list -RUN apt update && apt install -y clang-14 -RUN ln -sf /usr/bin/clang-14 /usr/bin/clang && ln -sf /usr/bin/clang-14 /usr/bin/clang++ - +RUN apt update && apt install -y gcc-10 g++-10 +RUN ln -sf /usr/bin/gcc-10 /usr/bin/cc && ln -sf /usr/bin/g++-10 /usr/bin/c++ RUN git clone https://github.com/alliedmodders/ambuild RUN cd ambuild && python setup.py install && cd .. RUN git clone https://github.com/alliedmodders/metamod-source From 7a91ee4c6195f4e56d52c6851dfc516e80c8f70b Mon Sep 17 00:00:00 2001 From: Michal <88426022+SlynxCZ@users.noreply.github.com> Date: Sat, 2 Aug 2025 00:26:31 +0200 Subject: [PATCH 12/13] Update Dockerfile --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 420749a..df48a42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ FROM registry.gitlab.steamos.cloud/steamrt/sniper/sdk WORKDIR /app -RUN apt update && apt install -y gcc-10 g++-10 -RUN ln -sf /usr/bin/gcc-10 /usr/bin/cc && ln -sf /usr/bin/g++-10 /usr/bin/c++ +RUN apt update && apt install -y clang-16 +RUN ln -sf /usr/bin/clang-16 /usr/bin/clang && ln -sf /usr/bin/clang++-16 /usr/bin/clang++ RUN git clone https://github.com/alliedmodders/ambuild RUN cd ambuild && python setup.py install && cd .. RUN git clone https://github.com/alliedmodders/metamod-source @@ -13,4 +13,4 @@ COPY ./docker-entrypoint.sh ./ ENV HL2SDKCS2=/app/source/vendor/hl2sdk-cs2 ENV MMSOURCE112=/app/source/vendor/metamod-source WORKDIR /app/source -CMD ["/bin/bash", "./docker-entrypoint.sh"] \ No newline at end of file +CMD ["/bin/bash", "./docker-entrypoint.sh"] From 3f9460f0ba4bb366955b63eac47e41b57ff5a561 Mon Sep 17 00:00:00 2001 From: SlynxCZ Date: Sat, 2 Aug 2025 22:51:17 +0200 Subject: [PATCH 13/13] Remove useless metamod cloning --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index df48a42..4097e29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,6 @@ RUN apt update && apt install -y clang-16 RUN ln -sf /usr/bin/clang-16 /usr/bin/clang && ln -sf /usr/bin/clang++-16 /usr/bin/clang++ RUN git clone https://github.com/alliedmodders/ambuild RUN cd ambuild && python setup.py install && cd .. -RUN git clone https://github.com/alliedmodders/metamod-source RUN git config --global --add safe.directory /app COPY ./docker-entrypoint.sh ./