@@ -498,12 +498,7 @@ static void Init_CustomResolution()
498498 spdlog::warn (" MGS 2 | MGS 3: Custom Resolution: Splashscreens: Incompatible game version. Skipping." );
499499 else
500500 {
501- uint8_t * MGS2_MGS3_SplashscreenResult = Memory::PatternScanSilent (baseModule, " FF 15 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 4C 8D 44 24 ?? 48 8D 54 24 ?? 48 8B 08 48 8B 01 FF 50 ?? 48 8B 58" );
502- if (!MGS2_MGS3_SplashscreenResult)
503- {
504- spdlog::error (" MGS 2 | MGS 3: Custom Resolution: Splashscreens: Pattern scan failed." );
505- }
506- else
501+ if (uint8_t * MGS2_MGS3_SplashscreenResult = Memory::PatternScan (baseModule, " FF 15 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 4C 8D 44 24 ?? 48 8D 54 24 ?? 48 8B 08 48 8B 01 FF 50 ?? 48 8B 58" , " MGS 2 | MGS 3: Custom Resolution: Splashscreens" ))
507502 {
508503 static SafetyHookMid MGS2_MGS3_SplashScreenMidHook{};
509504 MGS2_MGS3_SplashScreenMidHook = safetyhook::create_mid (MGS2_MGS3_SplashscreenResult,
@@ -518,15 +513,10 @@ static void Init_CustomResolution()
518513 ctx.rdx = reinterpret_cast <uintptr_t >(fileName.c_str ());
519514 }
520515 });
521- spdlog::info ( " MGS 2 | MGS 3: Custom Resolution: Splashscreens patched at {:s}+{:x} " , sExeName . c_str (), ( uintptr_t )MGS2_MGS3_SplashscreenResult - ( uintptr_t )baseModule);
516+ LOG_HOOK (MGS2_MGS3_SplashScreenMidHook, " MGS 2 | MGS 3: Custom Resolution" )
522517 }
523518
524- uint8_t * MGS2_MGS3_LoadingScreenEngScanResult = Memory::PatternScanSilent (baseModule, " 48 8D 8C 24 ?? ?? ?? ?? FF 15 ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ?? 48 8D 8C 24 ?? ?? ?? ?? FF 15 ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ?? 48 8D 8C 24 ?? ?? ?? ?? FF 15 ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ?? 48 8D 8C 24" ); // /loading.ctxr
525- if (!MGS2_MGS3_LoadingScreenEngScanResult)
526- {
527- spdlog::error (" MGS 2 | MGS 3: Custom Resolution: Loading Screen (ENG) {}: Pattern scan failed." );
528- }
529- else
519+ if (uint8_t * MGS2_MGS3_LoadingScreenEngScanResult = Memory::PatternScan (baseModule, " 48 8D 8C 24 ?? ?? ?? ?? FF 15 ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ?? 48 8D 8C 24 ?? ?? ?? ?? FF 15 ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ?? 48 8D 8C 24 ?? ?? ?? ?? FF 15 ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ?? 48 8D 8C 24" , " MGS 2 | MGS 3: Custom Resolution: Loading Screen (ENG)" ))
530520 {
531521 static SafetyHookMid MGS2_MGS3_LoadingScreenEngMidHook{};
532522 MGS2_MGS3_LoadingScreenEngMidHook = safetyhook::create_mid (MGS2_MGS3_LoadingScreenEngScanResult,
@@ -536,15 +526,10 @@ static void Init_CustomResolution()
536526 iOutputResY >= 1440 ? reinterpret_cast <uintptr_t >(&" $/misc/loading/****/loading_wqhd.ctxr" ) :
537527 /* iOutputResY >= 1080*/ reinterpret_cast <uintptr_t >(&" $/misc/loading/****/loading_fhd.ctxr" );
538528 });
539- spdlog::info ( " MGS 2 | MGS 3: Custom Resolution: Loading Screen (ENG) patched at {:s}+{:x} " , sExeName . c_str (), ( uintptr_t )MGS2_MGS3_LoadingScreenEngScanResult - ( uintptr_t )baseModule);
529+ LOG_HOOK (MGS2_MGS3_LoadingScreenEngMidHook, " MGS 2 | MGS 3: Custom Resolution: Loading Screen (ENG)" )
540530 }
541531
542- uint8_t * MGS2_MGS3_LoadingScreenJPScanResult = Memory::PatternScanSilent (baseModule, " 48 8D 4C 24 ?? FF 15 ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ?? 48 8D 4C 24" ); // /loading_jp.ctxr
543- if (!MGS2_MGS3_LoadingScreenJPScanResult)
544- {
545- spdlog::error (" MGS 2 | MGS 3: Custom Resolution: Loading Screen (JPN) {}: Pattern scan failed." );
546- }
547- else
532+ if (uint8_t * MGS2_MGS3_LoadingScreenJPScanResult = Memory::PatternScan (baseModule, " 48 8D 4C 24 ?? FF 15 ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ?? 48 8D 4C 24" , " MGS 2 | MGS 3: Custom Resolution: Loading Screen (JP)" )) // /loading_jp.ctxr
548533 {
549534 static SafetyHookMid MGS2_MGS3_LoadingScreenJPMidHook{};
550535 MGS2_MGS3_LoadingScreenJPMidHook = safetyhook::create_mid (MGS2_MGS3_LoadingScreenJPScanResult,
@@ -554,7 +539,7 @@ static void Init_CustomResolution()
554539 iOutputResY >= 1440 ? reinterpret_cast <uintptr_t >(&" $/misc/loading/****/loading_jp_wqhd.ctxr" ) :
555540 /* iOutputResY >= 1080*/ reinterpret_cast <uintptr_t >(&" $/misc/loading/****/loading_jp_fhd.ctxr" );
556541 });
557- spdlog::info ( " MGS 2 | MGS 3: Custom Resolution: Loading Screen (JP) patched at {:s}+{:x} " , sExeName . c_str (), ( uintptr_t )MGS2_MGS3_LoadingScreenJPScanResult - ( uintptr_t )baseModule);
542+ LOG_HOOK (MGS2_MGS3_LoadingScreenJPMidHook, " MGS 2 | MGS 3: Custom Resolution: Loading Screen (JP)" )
558543 }
559544 }
560545
@@ -587,7 +572,7 @@ static void Init_CustomResolution()
587572
588573 // MG 1/2 | MGS 2 | MGS 3: CreateWindowExA
589574 CreateWindowExA_hook = safetyhook::create_inline (CreateWindowExA, reinterpret_cast <void *>(CreateWindowExA_hooked));
590- spdlog::info ( " MG/MG2 | MGS 2 | MGS 3: CreateWindowExA: Hooked function. " );
575+ LOG_HOOK (CreateWindowExA_hook, " MG/MG2 | MGS 2 | MGS 3: CreateWindowExA" )
591576
592577 // MG 1/2 | MGS 2 | MGS 3: SetWindowPos
593578 if (uint8_t * MGS2_MGS3_SetWindowPosScanResult = Memory::PatternScan (baseModule, " 33 ?? 48 ?? ?? ?? FF ?? ?? ?? ?? ?? 8B ?? ?? BA 02 00 00 00" , " SetWindowPos" ))
@@ -703,33 +688,24 @@ static void Init_ScaleEffects()
703688 if ((eGameType & (MGS2 |MGS3 )) && bOutputResolution)
704689 {
705690 // MGS 2 | MGS 3: Fix scaling for added volume menu in v1.4.0 patch
706- uint8_t * MGS2_MGS3_VolumeMenuScanResult = Memory::PatternScanSilent (baseModule, " F3 0F ?? ?? 48 ?? ?? ?? 89 ?? ?? ?? 00 00 F3 0F ?? ?? 89 ?? ?? ?? 00 00" );
707- if (MGS2_MGS3_VolumeMenuScanResult)
691+ if (uint8_t * MGS2_MGS3_VolumeMenuScanResult = Memory::PatternScan (baseModule, " F3 0F ?? ?? 48 ?? ?? ?? 89 ?? ?? ?? 00 00 F3 0F ?? ?? 89 ?? ?? ?? 00 00" , " MGS 2 | MGS 3: Volume Menu" ))
708692 {
709- spdlog::info (" MGS 2 | MGS 3: Volume Menu: Address is {:s}+{:x}" , sExeName .c_str (), (uintptr_t )MGS2_MGS3_VolumeMenuScanResult - (uintptr_t )baseModule);
710-
711693 static SafetyHookMid MGS2_MGS3_VolumeMenuMidHook{};
712694 MGS2_MGS3_VolumeMenuMidHook = safetyhook::create_mid (MGS2_MGS3_VolumeMenuScanResult,
713695 [](SafetyHookContext& ctx)
714696 {
715697 ctx.xmm2 .f32 [0 ] = (float )1280 ;
716698 ctx.xmm3 .f32 [0 ] = (float )720 ;
717699 });
718- }
719- else if (!MGS2_MGS3_VolumeMenuScanResult)
720- {
721- spdlog::error (" MGS 2 | MGS 3: Volume Menu: Pattern scan failed." );
700+ LOG_HOOK (MGS2_MGS3_VolumeMenuMidHook, " MGS 2 | MGS 3: Volume Menu" )
722701 }
723702 }
724703
725704 if (eGameType & MGS2 && bOutputResolution)
726705 {
727706 // MGS 2: Scale Effects
728- uint8_t * MGS2_ScaleEffectsScanResult = Memory::PatternScanSilent (baseModule, " 48 8B ?? ?? 66 ?? ?? ?? 0F ?? ?? F3 0F ?? ?? F3 0F ?? ?? F3 0F ?? ?? ?? ?? ?? ??" );
729- if (MGS2_ScaleEffectsScanResult)
707+ if (uint8_t * MGS2_ScaleEffectsScanResult = Memory::PatternScan (baseModule, " 48 8B ?? ?? 66 ?? ?? ?? 0F ?? ?? F3 0F ?? ?? F3 0F ?? ?? F3 0F ?? ?? ?? ?? ?? ??" , " MGS 2: Scale Effects" ))
730708 {
731- spdlog::info (" MGS 2: Scale Effects: Address is {:s}+{:x}" , sExeName .c_str (), (uintptr_t )MGS2_ScaleEffectsScanResult - (uintptr_t )baseModule);
732-
733709 float fMGS2_DefaultEffectScaleX = *reinterpret_cast <float *>(Memory::GetAbsolute ((uintptr_t )MGS2_ScaleEffectsScanResult - 0x4 ));
734710 float fMGS2_DefaultEffectScaleY = *reinterpret_cast <float *>(Memory::GetAbsolute ((uintptr_t )MGS2_ScaleEffectsScanResult + 0x28 ));
735711 spdlog::info (" MGS 2: Scale Effects: Default X is {}, Y is {}" , fMGS2_DefaultEffectScaleX , fMGS2_DefaultEffectScaleY );
@@ -773,10 +749,6 @@ static void Init_ScaleEffects()
773749 ctx.xmm1 .f32 [0 ] = fMGS2_EffectScaleY ;
774750 });
775751 }
776- else if (!MGS2_ScaleEffectsScanResult)
777- {
778- spdlog::error (" MGS 2: Scale Effects: Pattern scan failed." );
779- }
780752 }
781753
782754}
@@ -1403,10 +1375,10 @@ static void InitializeSubsystems()
14031375 INITIALIZE (g_Logging.LogSysInfo ()); // 0
14041376 INITIALIZE (ASILoaderCompatibility::Check ()); // 1
14051377 INITIALIZE (DetectGame ()); // 2
1406- INITIALIZE (g_GameVars. Initialize ()); // 3
1407- INITIALIZE (g_D3D11Hooks .Initialize ()); // 4 Caches the D3DDevice, DXGIFactory, and D3DContext from D3DCreateDevice/DXGICreateFactory
1408- INITIALIZE (g_SteamAPI. Setup ()); // 5 Hook early so we don't miss any Steam API calls.
1409- INITIALIZE (Init_ReadConfig ()); // 6
1378+ INITIALIZE (Init_ReadConfig ()); // 3
1379+ INITIALIZE (g_GameVars .Initialize ()); // 4
1380+ INITIALIZE (g_D3D11Hooks. Initialize ()); // 5 Caches the D3DDevice, DXGIFactory, and D3DContext from D3DCreateDevice/DXGICreateFactory
1381+ INITIALIZE (g_SteamAPI. Setup ()); // 6 Hook early so we don't miss any Steam API calls.
14101382 INITIALIZE (ReshadeCompatibility::Check ()); // 7 Dependent on ReadConfig, must also be before LauncherConfigOverride to warn the user before a crash.
14111383 INITIALIZE (Init_CalculateScreenSize ()); // 8
14121384 INITIALIZE (Init_LauncherConfigOverride ()); // 9
0 commit comments