mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-06-05 12:34:33 +00:00
Add main menu overlay, creative inventory injection, mod discovery, logging, and Wine/Proton support
- Replace dbghelp with raw_pdb library for cross-platform PDB symbol resolution - Add main menu branding overlay via C4JRender::Present hook - Add creative inventory item injection from mods - Add file-based logging (LogUtil) alongside console output - Fix mod discovery with custom AssemblyLoadContext for proper type identity - Add file dialog for game path selection in launcher - Add CreativeTab enum and block/item creative tab assignment - Unify build output to single ModLoader/build directory
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "HookManager.h"
|
||||
#include "GameHooks.h"
|
||||
#include "SymbolResolver.h"
|
||||
#include "CreativeInventory.h"
|
||||
#include "MainMenuOverlay.h"
|
||||
#include <MinHook.h>
|
||||
#include <cstdio>
|
||||
|
||||
@@ -51,7 +53,7 @@ bool HookManager::Install(const SymbolResolver& symbols)
|
||||
printf("[LegacyForge] Hooked Minecraft::init\n");
|
||||
}
|
||||
|
||||
// Hook CConsoleMinecraftApp::ExitGame (optional -- for graceful shutdown)
|
||||
// Hook CConsoleMinecraftApp::ExitGame
|
||||
if (symbols.pExitGame)
|
||||
{
|
||||
if (MH_CreateHook(symbols.pExitGame,
|
||||
@@ -66,6 +68,55 @@ bool HookManager::Install(const SymbolResolver& symbols)
|
||||
}
|
||||
}
|
||||
|
||||
// Hook IUIScene_CreativeMenu::staticCtor
|
||||
if (symbols.pCreativeStaticCtor)
|
||||
{
|
||||
CreativeInventory::ResolveSymbols(const_cast<SymbolResolver&>(symbols));
|
||||
|
||||
if (MH_CreateHook(symbols.pCreativeStaticCtor,
|
||||
reinterpret_cast<void*>(&GameHooks::Hooked_CreativeStaticCtor),
|
||||
reinterpret_cast<void**>(&GameHooks::Original_CreativeStaticCtor)) != MH_OK)
|
||||
{
|
||||
printf("[LegacyForge] Warning: Failed to hook CreativeStaticCtor\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("[LegacyForge] Hooked CreativeStaticCtor\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Hook UIScene_MainMenu::customDraw (sets main-menu detection flag)
|
||||
if (symbols.pMainMenuCustomDraw)
|
||||
{
|
||||
if (MH_CreateHook(symbols.pMainMenuCustomDraw,
|
||||
reinterpret_cast<void*>(&GameHooks::Hooked_MainMenuCustomDraw),
|
||||
reinterpret_cast<void**>(&GameHooks::Original_MainMenuCustomDraw)) != MH_OK)
|
||||
{
|
||||
printf("[LegacyForge] Warning: Failed to hook MainMenuCustomDraw\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("[LegacyForge] Hooked MainMenuCustomDraw\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Hook C4JRender::Present (draws branding overlay just before frame present)
|
||||
if (symbols.pPresent)
|
||||
{
|
||||
MainMenuOverlay::ResolveSymbols(const_cast<SymbolResolver&>(symbols));
|
||||
|
||||
if (MH_CreateHook(symbols.pPresent,
|
||||
reinterpret_cast<void*>(&GameHooks::Hooked_Present),
|
||||
reinterpret_cast<void**>(&GameHooks::Original_Present)) != MH_OK)
|
||||
{
|
||||
printf("[LegacyForge] Warning: Failed to hook C4JRender::Present\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("[LegacyForge] Hooked C4JRender::Present\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (MH_EnableHook(MH_ALL_HOOKS) != MH_OK)
|
||||
{
|
||||
printf("[LegacyForge] MH_EnableHook(MH_ALL_HOOKS) failed\n");
|
||||
|
||||
Reference in New Issue
Block a user