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:
Jacobwasbeast
2026-03-06 18:58:24 -06:00
parent 65ef99fc11
commit 34177e1507
37 changed files with 1296 additions and 165 deletions

View File

@@ -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");