From 0ed3d1809fe952a4ef31dae5e94c3f61db33ce5e Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Mon, 11 Dec 2023 21:15:07 -0500 Subject: [PATCH 1/8] Add support to the pre-HL25 engine --- src/snd_hook.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/snd_hook.cpp b/src/snd_hook.cpp index 32fb04e..088fcce 100644 --- a/src/snd_hook.cpp +++ b/src/snd_hook.cpp @@ -474,7 +474,7 @@ void S_FillAddress() if (!ctx.branch_succ) { - Sig_NotFound("SND_Spatialize_branch_succ"); + // if not found, we will fallback to the old method at the end } g_pMetaHookAPI->DisasmRanges(ctx.branch_succ, 0x100, [](void* inst, PUCHAR address, size_t instLen, int instCount, int depth, PVOID context) @@ -617,7 +617,7 @@ void S_FillAddress() }, 0, &ctx); Sig_FuncNotFound(cszrawsentences); - Sig_FuncNotFound(rgpszrawsentence); + // if rgpszrawsentence is not found we will fallback to the old way } if (1) @@ -842,14 +842,20 @@ void S_FillAddress() Sig_AddrNotFound(cl_viewentity); gAudEngine.cl_viewentity = *(int**)((ULONG_PTR)addr + 2); + } + if (!gAudEngine.cl_num_entities) + { //idk why but cl_num_entities always be at &cl_viewentity + sizeof(uintptr_t) * 3 no matter in Sven or in HL gAudEngine.cl_num_entities = gAudEngine.cl_viewentity + 3; } - //gAudEngine.cl_parsecount = gAudEngine.cl_viewentity - (0x1789C8 / 4); - //gAudEngine.cl_servercount = gAudEngine.cl_parsecount - 2; - //gAudEngine.cl_waterlevel = gAudEngine.cl_servercount + 0x450 / 4; + if (!gAudEngine.cl_parsecount) + { + gAudEngine.cl_parsecount = gAudEngine.cl_viewentity - (0x1789C8 / 4); + gAudEngine.cl_servercount = gAudEngine.cl_parsecount - 2; + gAudEngine.cl_waterlevel = gAudEngine.cl_servercount + 0x450 / 4; + } addr = (ULONG_PTR)Search_Pattern_From_Size((void*)gEngfuncs.GetClientTime, 0x20, "\xDD\x05"); Sig_AddrNotFound("cl_time"); @@ -857,12 +863,12 @@ void S_FillAddress() gAudEngine.cl_oldtime = (decltype(gAudEngine.cl_oldtime))(gAudEngine.cl_time + 1); #define CL_WATERLEVEL_SIG "\x83\x3D\x2A\x2A\x2A\x2A\x02\xA1\x2A\x2A\x2A\x2A\x2A\x2A\x85\xC0" - addr = (ULONG_PTR)Search_Pattern(CL_WATERLEVEL_SIG); - Sig_AddrNotFound("cl_waterlevel"); - gAudEngine.cl_waterlevel = (decltype(gAudEngine.cl_waterlevel))*(ULONG_PTR*)(addr + 2); - - // gAudEngine.cl_time = (double *)(gAudEngine.cl_waterlevel + 11); - // gAudEngine.cl_oldtime = gAudEngine.cl_time + 1; + if (!gAudEngine.cl_waterlevel) + { + addr = (ULONG_PTR)Search_Pattern(CL_WATERLEVEL_SIG); + Sig_AddrNotFound("cl_waterlevel"); + gAudEngine.cl_waterlevel = (decltype(gAudEngine.cl_waterlevel)) * (ULONG_PTR*)(addr + 2); + } if (!gAudEngine.cszrawsentences) { From cc693341c7e7ada8e705ebb5b895690e0a509f1d Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Mon, 11 Dec 2023 21:21:57 -0500 Subject: [PATCH 2/8] Try to improve actions --- .github/workflows/build.yml | 13 ++++++++----- .github/workflows/release.yml | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55a229c..c2c63ab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,11 +22,14 @@ jobs: submodules: recursive fetch-depth: 0 + - name: Get branch name + run: echo "BranchName=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $env:GITHUB_ENV + - name: Get commit hash run: echo "CommitHash=$(git rev-parse --short=7 HEAD)" >> $env:GITHUB_ENV - name: Get commit count - run: echo "CommitCount=$(git rev-list --count master)" >> $env:GITHUB_ENV + run: echo "CommitCount=$(git rev-list --count ${{env.BranchName}})" >> $env:GITHUB_ENV - name: Get current date run: echo "CurrentDate=$(date +'%Y-%m-%d')" >> $env:GITHUB_ENV @@ -82,8 +85,8 @@ jobs: - name: Download MetaHook run: | - Invoke-WebRequest -Uri https://github.com/hzqst/MetaHookSv/releases/download/v20231124b/MetaHookSv-windows-x86.zip -OutFile MetaHook.zip - if (!(Get-FileHash ./MetaHook.zip).Hash.Equals("4B22EA01E0B025CAEABD7301FEF52FA05A807263B8B761760FA3AAD7E1D2EA23")) { + Invoke-WebRequest -Uri https://github.com/hzqst/MetaHookSv/releases/download/v20231210a/MetaHookSv-windows-x86.zip -OutFile MetaHook.zip + if (!(Get-FileHash ./MetaHook.zip).Hash.Equals("E5F3DB974C0D00241125757A6CE83E1BCF114D156E8E3E27C7622CAE7DDE36A1")) { Exit -1 } Expand-Archive ./MetaHook.zip -DestinationPath MetaHook/ @@ -103,10 +106,10 @@ jobs: uses: papeloto/action-zip@v1 with: files: 'Output/' - dest: 'Release/${{env.CurrentDate}}_MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}.zip' + dest: 'Release/${{env.CurrentDate}}_MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}-${{env.BranchName}}.zip' - name: Make copy for static download URL - run: copy 'Release/${{env.CurrentDate}}_MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}.zip' 'Release/MetaAudio.zip' + run: copy 'Release/${{env.CurrentDate}}_MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}-${{env.BranchName}}.zip' 'Release/MetaAudio.zip' - name: GitHub pre-release uses: 'marvinpinto/action-automatic-releases@latest' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 556b9a1..a6b0c5e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,8 +79,8 @@ jobs: - name: Download MetaHook run: | - Invoke-WebRequest -Uri https://github.com/hzqst/MetaHookSv/releases/download/v20231124b/MetaHookSv-windows-x86.zip -OutFile MetaHook.zip - if (!(Get-FileHash ./MetaHook.zip).Hash.Equals("4B22EA01E0B025CAEABD7301FEF52FA05A807263B8B761760FA3AAD7E1D2EA23")) { + Invoke-WebRequest -Uri https://github.com/hzqst/MetaHookSv/releases/download/v20231210a/MetaHookSv-windows-x86.zip -OutFile MetaHook.zip + if (!(Get-FileHash ./MetaHook.zip).Hash.Equals("E5F3DB974C0D00241125757A6CE83E1BCF114D156E8E3E27C7622CAE7DDE36A1")) { Exit -1 } Expand-Archive ./MetaHook.zip -DestinationPath MetaHook/ From f82cea1b69cd5f0fba4f8ad40472a899ba795277 Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Mon, 11 Dec 2023 21:26:05 -0500 Subject: [PATCH 3/8] Use GITHUB_REF_NAME --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c2c63ab..5cc22af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: fetch-depth: 0 - name: Get branch name - run: echo "BranchName=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $env:GITHUB_ENV + run: echo "BranchName=${GITHUB_REF_NAME}" >> $env:GITHUB_ENV - name: Get commit hash run: echo "CommitHash=$(git rev-parse --short=7 HEAD)" >> $env:GITHUB_ENV From 6812aaa46f1f4bf41024c28458300335ea997daa Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Mon, 11 Dec 2023 21:28:05 -0500 Subject: [PATCH 4/8] Update metahook submodule --- externals/MetaHookSv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/externals/MetaHookSv b/externals/MetaHookSv index a220419..9c58798 160000 --- a/externals/MetaHookSv +++ b/externals/MetaHookSv @@ -1 +1 @@ -Subproject commit a22041904f41a9d2c4ebc1173ae99e0860058101 +Subproject commit 9c587981d2df300eba0dc50767bfbf433f2387c2 From 8b8a429156bf71d7843c166d1ab28f9a3ced3a17 Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Mon, 11 Dec 2023 21:28:51 -0500 Subject: [PATCH 5/8] Try to fix action --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5cc22af..9255a58 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: fetch-depth: 0 - name: Get branch name - run: echo "BranchName=${GITHUB_REF_NAME}" >> $env:GITHUB_ENV + run: echo "BranchName=${{GITHUB_REF_NAME}}" >> $env:GITHUB_ENV - name: Get commit hash run: echo "CommitHash=$(git rev-parse --short=7 HEAD)" >> $env:GITHUB_ENV From 8724b3427c0af47e6bc76d7d08b062067077fa11 Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Mon, 11 Dec 2023 21:29:27 -0500 Subject: [PATCH 6/8] Try again --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9255a58..53fb199 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: fetch-depth: 0 - name: Get branch name - run: echo "BranchName=${{GITHUB_REF_NAME}}" >> $env:GITHUB_ENV + run: echo "BranchName=${{env.GITHUB_REF_NAME}}" >> $env:GITHUB_ENV - name: Get commit hash run: echo "CommitHash=$(git rev-parse --short=7 HEAD)" >> $env:GITHUB_ENV From fc07afb0e928db703a310ee16dd26df449fc3465 Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Mon, 11 Dec 2023 21:32:06 -0500 Subject: [PATCH 7/8] Try again --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53fb199..3b4aab9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: fetch-depth: 0 - name: Get branch name - run: echo "BranchName=${{env.GITHUB_REF_NAME}}" >> $env:GITHUB_ENV + run: echo "BranchName=$env:GITHUB_REF_NAME" >> $env:GITHUB_ENV - name: Get commit hash run: echo "CommitHash=$(git rev-parse --short=7 HEAD)" >> $env:GITHUB_ENV From f5d0b6ead8892d490136c1605bb52b63403796c7 Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Mon, 11 Dec 2023 21:37:32 -0500 Subject: [PATCH 8/8] Add branch name --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b4aab9..c3d08c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,7 +96,7 @@ jobs: - uses: actions/upload-artifact@v3 with: - name: '${{env.CurrentDate}}_MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}' + name: '${{env.CurrentDate}}_MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}-${{env.BranchName}}' path: Output/ - name: Make Release folder @@ -117,5 +117,5 @@ jobs: repo_token: '${{secrets.GITHUB_TOKEN}}' automatic_release_tag: 'latest' prerelease: true - title: '[${{env.CurrentDate}}] MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}' + title: '[${{env.CurrentDate}}] MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}-${{env.BranchName}}' files: "Release/*"