From 776cf50bd0213f9d35b352540bf9db9c636584eb Mon Sep 17 00:00:00 2001 From: Matt Bilker Date: Mon, 23 Mar 2020 07:31:58 +0000 Subject: [PATCH] mu3hook/dllmain.c: fix hook initialization order to fix path hook - If the Unity `LoadLibraryW` hook is done too early, then it somehow interferes with the other DLL and hook table IAT hooks. Workaround this by moving the Unity `LoadLibraryW` hook initialization after all other hooks are done. - Also, correct the platform ID to the ALLS HX --- mu3hook/dllmain.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mu3hook/dllmain.c b/mu3hook/dllmain.c index bf24bfd..7161261 100644 --- a/mu3hook/dllmain.c +++ b/mu3hook/dllmain.c @@ -35,14 +35,13 @@ static DWORD CALLBACK mu3_pre_startup(void) gfx_hook_init(&mu3_hook_cfg.gfx); serial_hook_init(); - unity_hook_init(); /* Initialize emulation hooks */ hr = platform_hook_init( &mu3_hook_cfg.platform, "SDDT", - "AAV2", + "ACA1", mu3_hook_mod); if (FAILED(hr)) { @@ -67,6 +66,13 @@ static DWORD CALLBACK mu3_pre_startup(void) return hr; } + /* Initialize Unity native plugin DLL hooks + + There seems to be an issue with other DLL hooks if `LoadLibraryW` is + hooked earlier in the `mu3hook` initialization. */ + + unity_hook_init(); + /* Initialize debug helpers */ spike_hook_init(L".\\segatools.ini");