mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-06-05 04:24:31 +00:00
Use exact decorated symbol names verified against Minecraft.Client.pdb
Verified all hook targets exist in the compiled game's PDB: - ?MinecraftWorld_RunStaticCtors@@YAXXZ - ?tick@Minecraft@@QEAAX_N0@Z - ?init@Minecraft@@QEAAXXZ - ?ExitGame@CConsoleMinecraftApp@@UEAAXXZ (replaces destroy which is inlined) Minecraft::destroy/run_end/stop are not public symbols (likely inlined), so the shutdown hook now targets CConsoleMinecraftApp::ExitGame instead.
This commit is contained in:
@@ -22,6 +22,7 @@ bool HookManager::Install(const SymbolResolver& symbols)
|
||||
printf("[LegacyForge] Failed to hook RunStaticCtors\n");
|
||||
return false;
|
||||
}
|
||||
printf("[LegacyForge] Hooked RunStaticCtors\n");
|
||||
}
|
||||
|
||||
// Hook Minecraft::tick
|
||||
@@ -34,6 +35,7 @@ bool HookManager::Install(const SymbolResolver& symbols)
|
||||
printf("[LegacyForge] Failed to hook Minecraft::tick\n");
|
||||
return false;
|
||||
}
|
||||
printf("[LegacyForge] Hooked Minecraft::tick\n");
|
||||
}
|
||||
|
||||
// Hook Minecraft::init
|
||||
@@ -46,17 +48,21 @@ bool HookManager::Install(const SymbolResolver& symbols)
|
||||
printf("[LegacyForge] Failed to hook Minecraft::init\n");
|
||||
return false;
|
||||
}
|
||||
printf("[LegacyForge] Hooked Minecraft::init\n");
|
||||
}
|
||||
|
||||
// Hook Minecraft::destroy
|
||||
if (symbols.pMinecraftDestroy)
|
||||
// Hook CConsoleMinecraftApp::ExitGame (optional -- for graceful shutdown)
|
||||
if (symbols.pExitGame)
|
||||
{
|
||||
if (MH_CreateHook(symbols.pMinecraftDestroy,
|
||||
reinterpret_cast<void*>(&GameHooks::Hooked_MinecraftDestroy),
|
||||
reinterpret_cast<void**>(&GameHooks::Original_MinecraftDestroy)) != MH_OK)
|
||||
if (MH_CreateHook(symbols.pExitGame,
|
||||
reinterpret_cast<void*>(&GameHooks::Hooked_ExitGame),
|
||||
reinterpret_cast<void**>(&GameHooks::Original_ExitGame)) != MH_OK)
|
||||
{
|
||||
printf("[LegacyForge] Failed to hook Minecraft::destroy\n");
|
||||
return false;
|
||||
printf("[LegacyForge] Warning: Failed to hook ExitGame (shutdown hook unavailable)\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("[LegacyForge] Hooked ExitGame\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user