From da0adbafc64a1bf759fefb03f01ddef54c7bf44a Mon Sep 17 00:00:00 2001 From: ThirteenAG Date: Thu, 31 Oct 2024 15:01:52 +0800 Subject: [PATCH] rdr: full intro skip --- .github/docs/rdr.md | 8 +++ .github/workflows/all.yml | 8 +++ .github/workflows/tag.yml | 2 + .../dinput8.x64ual | 1 + .../plugins/RedDeadRedemption.FusionMod.ini | 2 + premake5.lua | 6 ++ .../RedDeadRedemption.FusionMod/dllmain.cpp | 55 +++++++++++++++++++ 7 files changed, 82 insertions(+) create mode 100644 .github/docs/rdr.md create mode 100644 data/RedDeadRedemption.FusionMod/dinput8.x64ual create mode 100644 data/RedDeadRedemption.FusionMod/plugins/RedDeadRedemption.FusionMod.ini create mode 100644 source/RedDeadRedemption.FusionMod/dllmain.cpp diff --git a/.github/docs/rdr.md b/.github/docs/rdr.md new file mode 100644 index 000000000..05a0474e6 --- /dev/null +++ b/.github/docs/rdr.md @@ -0,0 +1,8 @@ +![rdr](https://thirteenag.github.io/screens/rdr/main2.jpg) + +![](https://habrastorage.org/webt/ow/yy/mg/owyymgpibfqzfbwyf_iqoiqrede.png) Added an option to skip intro and legal screens + + Installation: + Download and extract the archive to the game directory, where the exe is located. + +[Website](https://thirteenag.github.io/wfp#rdr) | [Source](https://github.com/ThirteenAG/WidescreenFixesPack/blob/master/source/RedDeadRedemption.FusionMod/dllmain.cpp) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 83536905e..cf80048b8 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -710,6 +710,14 @@ jobs: tag: sonicheroes artifacts: data/Archives/SonicHeroes.WidescreenFix.zip + - name: Red Dead Redemption Fusion Mod + uses: ./.github/workflows/release_tag + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag_list: ${{ format('{0},{1}', github.event.inputs.tag_list, inputs.tag_list) }} + tag: rdr + artifacts: data/Archives/RedDeadRedemption.FusionMod.zip + - name: Resident Evil 0 Fusion Fix uses: ./.github/workflows/release_tag with: diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 9c82aaf5e..143300cf5 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -57,6 +57,7 @@ on: - psiops - psychonauts - punisher + - rdr - re0 - re1 - re2re3gc @@ -150,6 +151,7 @@ env: psiops: "/t:Win32\\PsiOpsTheMindgateConspiracy_WidescreenFix" psychonauts: "/t:Win32\\Psychonauts_WidescreenFix" punisher: "/t:Win32\\ThePunisher_WidescreenFix" + rdr: "/t:Win64\\RedDeadRedemption_FusionMod" re0: "/t:Win32\\ResidentEvil\\ResidentEvil0_FusionFix" re1: "/t:Win32\\ResidentEvil\\ResidentEvil_FusionFix" re2re3gc: "/t:Dolphin\\ResidentEvil2_RE3_Dolphin_FusionMod" diff --git a/data/RedDeadRedemption.FusionMod/dinput8.x64ual b/data/RedDeadRedemption.FusionMod/dinput8.x64ual new file mode 100644 index 000000000..a36540af3 --- /dev/null +++ b/data/RedDeadRedemption.FusionMod/dinput8.x64ual @@ -0,0 +1 @@ +loadfromscriptsonly \ No newline at end of file diff --git a/data/RedDeadRedemption.FusionMod/plugins/RedDeadRedemption.FusionMod.ini b/data/RedDeadRedemption.FusionMod/plugins/RedDeadRedemption.FusionMod.ini new file mode 100644 index 000000000..2e03495e0 --- /dev/null +++ b/data/RedDeadRedemption.FusionMod/plugins/RedDeadRedemption.FusionMod.ini @@ -0,0 +1,2 @@ +[MAIN] +SkipIntro = 1 diff --git a/premake5.lua b/premake5.lua index 802b39865..bf700153c 100644 --- a/premake5.lua +++ b/premake5.lua @@ -300,6 +300,12 @@ project "SpyroReignitedTrilogy.WidescreenFix" platforms { "Win64" } architecture "x64" setpaths("Z:/WFP/Games/Spyro Reignited Trilogy/", "Falcon/Binaries/Win64/Spyro-Win64-Shipping.exe", "Falcon/Binaries/Win64/scripts/") + +project "RedDeadRedemption.FusionMod" + add_kananlib() + platforms { "Win64" } + architecture "x64" + setpaths("Z:/WFP/Games/Red Dead Redemption/", "RDR.exe", "plugins/") group "" group "Win32" diff --git a/source/RedDeadRedemption.FusionMod/dllmain.cpp b/source/RedDeadRedemption.FusionMod/dllmain.cpp new file mode 100644 index 000000000..9064bf5ff --- /dev/null +++ b/source/RedDeadRedemption.FusionMod/dllmain.cpp @@ -0,0 +1,55 @@ +#include "stdafx.h" +#include + +namespace rdrFlashIntroHandler +{ + struct FlashIntroHandler + { + char unk[17]; + char bLegalsCompleted; + }; + + SafetyHookInline FlashIntroHandlerHook{}; + void __fastcall Update(FlashIntroHandler* smp_Instance) + { + smp_Instance->bLegalsCompleted = 1; + } +} + +void Init() +{ + CIniReader iniReader(""); + bool bSkipIntro = iniReader.ReadInteger("MAIN", "SkipIntro", 1) != 0; + + if (bSkipIntro) + { + auto LegalsCompletedRef = utility::find_function_from_string_ref(GetModuleHandleW(NULL), "LegalsCompleted"); + if (LegalsCompletedRef) + { + auto func_start = utility::find_function_start_with_call(LegalsCompletedRef.value()); + if (func_start) + rdrFlashIntroHandler::FlashIntroHandlerHook = safetyhook::create_inline(func_start.value(), rdrFlashIntroHandler::Update); + } + } +} + +CEXP void InitializeASI() +{ + std::call_once(CallbackHandler::flag, []() + { + CallbackHandler::RegisterCallbackAtGetSystemTimeAsFileTime(Init); + }); +} + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved) +{ + if (reason == DLL_PROCESS_ATTACH) + { + if (!IsUALPresent()) { InitializeASI(); } + } + else if (reason == DLL_PROCESS_DETACH) + { + + } + return TRUE; +}