From 7b4525c7c4071419a2ce486af5a9c92d8b620f51 Mon Sep 17 00:00:00 2001 From: TroncoNinja <156263997+TroncoNinja@users.noreply.github.com> Date: Mon, 8 Jul 2024 21:58:27 +0200 Subject: [PATCH 1/5] Update DS2_ReplaceServerAddressHook.cpp fix for wine check in ds2, if you are running in wine(proton) ignore check for memory safety features that aren't supported --- .../DS2_ReplaceServerAddressHook.cpp | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/Source/Injector/Hooks/DarkSouls2/DS2_ReplaceServerAddressHook.cpp b/Source/Injector/Hooks/DarkSouls2/DS2_ReplaceServerAddressHook.cpp index bea5cb76..95e5f40d 100644 --- a/Source/Injector/Hooks/DarkSouls2/DS2_ReplaceServerAddressHook.cpp +++ b/Source/Injector/Hooks/DarkSouls2/DS2_ReplaceServerAddressHook.cpp @@ -30,6 +30,8 @@ bool DS2_ReplaceServerAddressHook::PatchHostname(Injector& injector) std::wstring WideHostname = WidenString(Config.ServerHostname); size_t CopyLength = (WideHostname.size() + 1) * 2; + char* winePrefix = std::getenv("WINEPREFIX"); + while (true) { std::vector address_matches = injector.SearchString({ @@ -46,9 +48,13 @@ bool DS2_ReplaceServerAddressHook::PatchHostname(Injector& injector) { continue; } - if (((info.Protect & PAGE_READWRITE) == 0 && (info.Protect & PAGE_EXECUTE_READWRITE) == 0)) - { - continue; + //if i'm not running in wine do the check + if (winePrefix == nullptr) { + Log("you are using windows"); + if (((info.Protect & PAGE_READWRITE) == 0 && (info.Protect & PAGE_EXECUTE_READWRITE) == 0)) + { + continue; + } } wchar_t* ptr = (wchar_t*)key; @@ -77,6 +83,8 @@ bool DS2_ReplaceServerAddressHook::PatchHostname(Injector& injector) bool DS2_ReplaceServerAddressHook::PatchKey(Injector& injector) { + char* winePrefix = std::getenv("WINEPREFIX"); + while (true) { const RuntimeConfig& Config = Injector::Instance().GetConfig(); @@ -99,10 +107,22 @@ bool DS2_ReplaceServerAddressHook::PatchKey(Injector& injector) { // If the memory is not writable yet, modify its protection (steam drm fucks with the protection during boot). MEMORY_BASIC_INFORMATION info; - if (VirtualQuery((void*)key, &info, sizeof(info)) == 0 || - ((info.Protect & PAGE_READWRITE) == 0 && (info.Protect & PAGE_EXECUTE_READWRITE) == 0)) + // If the programm is running on wine + if(winePrefix != nullptr) { - continue; + Log("you are using wine"); + if (VirtualQuery((void*)key, &info, sizeof(info)) == 0) //wine doesn't emulate memory seafe features of windows {il TroncoNinja e' stato qui} + { + continue; + } + } + else + { + if (VirtualQuery((void*)key, &info, sizeof(info)) == 0 || + ((info.Protect & PAGE_READWRITE) == 0 && (info.Protect & PAGE_EXECUTE_READWRITE) == 0)) + { + continue; + } } memcpy((char*)key, Config.ServerPublicKey.c_str(), CopyLength); From b46eece5e48f0966f2594120812fb114e2a76b35 Mon Sep 17 00:00:00 2001 From: TroncoNinja <156263997+TroncoNinja@users.noreply.github.com> Date: Tue, 9 Jul 2024 20:40:49 +0200 Subject: [PATCH 2/5] Update release.yml --- .github/workflows/release.yml | 52 +---------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d5a67ab8..92702b53 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -116,60 +116,10 @@ jobs: with: path: ./linux.zip name: linux - - build-docker: - name: Build Docker - runs-on: ubuntu-20.04 - - steps: - - name: Checkout respository - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Generate Solution - shell: bash - working-directory: ${{github.workspace}}/Tools - run: ${{github.workspace}}/Tools/generate_make_release.sh - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Build and push master-server docker - uses: docker/build-push-action@v2 - with: - context: ./Source/MasterServer/ - file: ./Source/MasterServer/Dockerfile - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/ds3os-master:latest - - - name: Build and push server docker - uses: docker/build-push-action@v2 - with: - context: . - file: ./DarkSouls3.Dockerfile - push: true - no-cache: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/ds3os:latest - - - name: Build and push server docker - uses: docker/build-push-action@v2 - with: - context: . - file: ./DarkSouls2.Dockerfile - push: true - no-cache: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/ds2os:latest make-release: name: Make Release - needs: [ build-windows, build-linux, build-docker ] + needs: [ build-windows, build-linux] runs-on: ubuntu-20.04 steps: From 90d54e847a0ac06c8387ffd7bca71e19455c501d Mon Sep 17 00:00:00 2001 From: TroncoNinja <156263997+TroncoNinja@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:59:49 +0200 Subject: [PATCH 3/5] Fixed code style issues, general polishing --- .../DS2_ReplaceServerAddressHook.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/Injector/Hooks/DarkSouls2/DS2_ReplaceServerAddressHook.cpp b/Source/Injector/Hooks/DarkSouls2/DS2_ReplaceServerAddressHook.cpp index 95e5f40d..c09efb12 100644 --- a/Source/Injector/Hooks/DarkSouls2/DS2_ReplaceServerAddressHook.cpp +++ b/Source/Injector/Hooks/DarkSouls2/DS2_ReplaceServerAddressHook.cpp @@ -30,7 +30,7 @@ bool DS2_ReplaceServerAddressHook::PatchHostname(Injector& injector) std::wstring WideHostname = WidenString(Config.ServerHostname); size_t CopyLength = (WideHostname.size() + 1) * 2; - char* winePrefix = std::getenv("WINEPREFIX"); + char* WinePrefix = std::getenv("WINEPREFIX"); while (true) { @@ -48,9 +48,9 @@ bool DS2_ReplaceServerAddressHook::PatchHostname(Injector& injector) { continue; } - //if i'm not running in wine do the check - if (winePrefix == nullptr) { - Log("you are using windows"); + + if (WinePrefix == nullptr) + { if (((info.Protect & PAGE_READWRITE) == 0 && (info.Protect & PAGE_EXECUTE_READWRITE) == 0)) { continue; @@ -83,7 +83,7 @@ bool DS2_ReplaceServerAddressHook::PatchHostname(Injector& injector) bool DS2_ReplaceServerAddressHook::PatchKey(Injector& injector) { - char* winePrefix = std::getenv("WINEPREFIX"); + char* WinePrefix = std::getenv("WINEPREFIX"); while (true) { @@ -107,11 +107,11 @@ bool DS2_ReplaceServerAddressHook::PatchKey(Injector& injector) { // If the memory is not writable yet, modify its protection (steam drm fucks with the protection during boot). MEMORY_BASIC_INFORMATION info; - // If the programm is running on wine - if(winePrefix != nullptr) + + if (WinePrefix != nullptr) { - Log("you are using wine"); - if (VirtualQuery((void*)key, &info, sizeof(info)) == 0) //wine doesn't emulate memory seafe features of windows {il TroncoNinja e' stato qui} + // Do the check because Wine doesn't emulate memory seafe features of Windows + if (VirtualQuery((void*)key, &info, sizeof(info)) == 0) { continue; } From 9d9a86e73e4c97c15179cff93d45abfc1ed42f37 Mon Sep 17 00:00:00 2001 From: TroncoNinja <156263997+TroncoNinja@users.noreply.github.com> Date: Wed, 10 Jul 2024 12:07:35 +0200 Subject: [PATCH 4/5] Update release.yml --- .github/workflows/release.yml | 54 +++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92702b53..a1558f2c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -116,10 +116,60 @@ jobs: with: path: ./linux.zip name: linux - + + build-docker: + name: Build Docker + runs-on: ubuntu-20.04 + + steps: + - name: Checkout respository + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Generate Solution + shell: bash + working-directory: ${{github.workspace}}/Tools + run: ${{github.workspace}}/Tools/generate_make_release.sh + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build and push master-server docker + uses: docker/build-push-action@v2 + with: + context: ./Source/MasterServer/ + file: ./Source/MasterServer/Dockerfile + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/ds3os-master:latest + + - name: Build and push server docker + uses: docker/build-push-action@v2 + with: + context: . + file: ./DarkSouls3.Dockerfile + push: true + no-cache: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/ds3os:latest + + - name: Build and push server docker + uses: docker/build-push-action@v2 + with: + context: . + file: ./DarkSouls2.Dockerfile + push: true + no-cache: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/ds2os:latest + make-release: name: Make Release - needs: [ build-windows, build-linux] + needs: [ build-windows, build-linux, build-docker] runs-on: ubuntu-20.04 steps: From f2a8f94b6473d9ab4d00325ddea175f0b4750899 Mon Sep 17 00:00:00 2001 From: TroncoNinja <156263997+TroncoNinja@users.noreply.github.com> Date: Wed, 10 Jul 2024 12:14:35 +0200 Subject: [PATCH 5/5] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a1558f2c..a1cbc581 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -169,7 +169,7 @@ jobs: make-release: name: Make Release - needs: [ build-windows, build-linux, build-docker] + needs: [ build-windows, build-linux, build-docker ] runs-on: ubuntu-20.04 steps: