From aa9fd498ec895d692f6b0ace6e4e650c3020829a Mon Sep 17 00:00:00 2001 From: MainMemory Date: Fri, 14 Jun 2024 15:08:28 -0500 Subject: [PATCH] Panacea: Steam compatibility fix. --- OpenKh.Research.Panacea/OpenKH.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/OpenKh.Research.Panacea/OpenKH.cpp b/OpenKh.Research.Panacea/OpenKH.cpp index 82253bf27..ee54ccf3e 100644 --- a/OpenKh.Research.Panacea/OpenKH.cpp +++ b/OpenKh.Research.Panacea/OpenKH.cpp @@ -72,7 +72,7 @@ void Hook() Hook(pfn_Axa_AxaResourceMan_SetResourceItem, "\x48\x89\x5C\x24\x00\x55\x56\x57\x48\x81\xEC\x00\x00\x00\x00\x48\x8B\x05\x00\x00\x00\x00\x48\x33\xC4\x48\x89\x84\x24\x00\x00\x00\x00\x49\x8B\xF0\x8B\xFA\x48\x8B", "xxxx?xxxxxx????xxx????xxxxxxx????xxxxxxx"); Hook(pfn_Axa_PackageMan_GetFileInfo, "\x40\x53\x55\x56\x48\x83\xEC\x50\x48\x8B\x05\x00\x00\x00\x00\x48\x33\xC4\x48\x89\x44\x24\x00\x44\x8B\x05", "xxxxxxxxxxx????xxxxxxx?xxx"); Hook(pfn_Axa_CalcHash, "\x40\x53\x56\x57\x48\x81\xEC\x00\x00\x00\x00\x48\x8B\x05\x00\x00\x00\x00\x48\x33\xC4\x48\x89\x84\x24\x00\x00\x00\x00\x8B\xFA\x48\x8B\xD9\x48\x8D\x54\x24", "xxxxxxx????xxx????xxxxxxx????xxxxxxxxx"); - Hook(pfn_Axa_SetReplacePath, "\x4C\x8D\x81\x60\x02\x00\x00\x4C\x8B\xCA\x48\x8D\x15\x00\x00\x00\x00\x48\x8D\x0D", "xxxxxxxxxxxxx????xxx"); + Hook(pfn_Axa_SetReplacePath, "\x4C\x8D\x81\x00\x00\x00\x00\x4C\x8B\xCA\x48\x8D\x15\x00\x00\x00\x00\x48\x8D\x0D", "xxx????xxxxxx????xxx"); Hook(pfn_Axa_FreeAllPackages, "\x48\x89\x6C\x24\x00\x56\x48\x83\xEC\x20\x8B\x05\x00\x00\x00\x00\x33\xED\x8B\xF5", "xxxx?xxxxxxx????xxxx"); Hook(pfn_Axa_CFileMan_GetRemasteredCount, "\x48\x63\x05\x00\x00\x00\x00\x48\x8D\x0D\x00\x00\x00\x00\x48\x8B\x04\xC1\x8B\x80", "xxx????xxx????xxxxxx"); Hook(pfn_Axa_CFileMan_GetRemasteredEntry, "\x48\x63\x05\x00\x00\x00\x00\x4C\x8D\x0D\x00\x00\x00\x00\x4D\x8B\x0C\xC1\x4D\x8B", "xxx????xxx????xxxxxx"); @@ -101,6 +101,8 @@ void Hook() int QuickLaunch = 0; __int64 (*LaunchGame)(int game); +__int64 (*LaunchGameEpic)(int game); +__int64 (*LaunchGameSteam)(int game); void QuickBootHook() { LaunchGame(QuickLaunch); @@ -155,8 +157,13 @@ void OpenKH::Initialize() Hook(framefunc, "\x40\x57\x48\x83\xEC\x40\x48\xC7\x44\x24\x00\x00\x00\x00\x00\x48\x89\x5C\x24\x00\x48\x8B\xD9\x8B\x41\x34", "xxxxxxxxxx?????xxxx?xxxxxx"); else Hook(framefunc, "\x40\x57\x48\x83\xEC\x40\x48\xC7\x44\x24\x00\x00\x00\x00\x00\x48\x89\x5C\x24\x00\x48\x8B\xF9\x83\x79\x34\x00", "xxxxxxxxxx?????xxxx?xxxxxxx"); - Hook(LaunchGame, "\x40\x53\x48\x81\xEC\x00\x00\x00\x00\x48\x8B\x05\x00\x00\x00\x00\x48\x33\xC4\x48\x89\x84\x24\x00\x00\x00\x00\x8B\xD9", "xxxxx????xxx????xxxxxxx????xx"); + Hook(LaunchGameEpic, "\x40\x53\x48\x81\xEC\x00\x00\x00\x00\x48\x8B\x05\x00\x00\x00\x00\x48\x33\xC4\x48\x89\x84\x24\x00\x00\x00\x00\x8B\xD9", "xxxxx????xxx????xxxxxxx????xx"); + Hook(LaunchGameSteam, "\x48\x89\x5C\x24\x00\x57\x48\x83\xEC\x30\x45\x33\xC9\x48\x8D\x05\x00\x00\x00\x00\x33\xD2", "xxxx?xxxxxxxxxxx????xx"); FindAllFuncs(); + if (LaunchGameSteam) + LaunchGame = LaunchGameSteam; + else + LaunchGame = LaunchGameEpic; intptr_t m_pReplaceFunc = (intptr_t)QuickBootHook; unsigned char Patch[] {