mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-07-19 00:58:08 +00:00
Initial commit: LegacyForge mod loader for Minecraft Legacy Edition
SKSE-style external mod loader with zero game source modifications. - LegacyForge.Launcher: C# console app that injects runtime DLL into game process - LegacyForgeRuntime: C++ DLL with PDB symbol resolution, MinHook function hooking, and .NET CoreCLR hosting - LegacyForge.Core: C# mod discovery and lifecycle management - LegacyForge.API: Fabric-style mod API with namespaced string IDs, fluent property builders, and event system - ExampleMod: Sample mod demonstrating block/item registration
This commit is contained in:
48
LegacyForgeRuntime/src/GameHooks.cpp
Normal file
48
LegacyForgeRuntime/src/GameHooks.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "GameHooks.h"
|
||||
#include "DotNetHost.h"
|
||||
#include <cstdio>
|
||||
|
||||
namespace GameHooks
|
||||
{
|
||||
RunStaticCtors_fn Original_RunStaticCtors = nullptr;
|
||||
MinecraftTick_fn Original_MinecraftTick = nullptr;
|
||||
MinecraftInit_fn Original_MinecraftInit = nullptr;
|
||||
MinecraftDestroy_fn Original_MinecraftDestroy = nullptr;
|
||||
|
||||
void Hooked_RunStaticCtors()
|
||||
{
|
||||
printf("[LegacyForge] RunStaticCtors hook fired -- calling PreInit\n");
|
||||
DotNetHost::CallPreInit();
|
||||
|
||||
Original_RunStaticCtors();
|
||||
|
||||
printf("[LegacyForge] RunStaticCtors complete -- calling Init\n");
|
||||
DotNetHost::CallInit();
|
||||
}
|
||||
|
||||
void __fastcall Hooked_MinecraftTick(void* thisPtr, bool bFirst, bool bUpdateTextures)
|
||||
{
|
||||
Original_MinecraftTick(thisPtr, bFirst, bUpdateTextures);
|
||||
|
||||
if (bFirst)
|
||||
{
|
||||
DotNetHost::CallTick();
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall Hooked_MinecraftInit(void* thisPtr)
|
||||
{
|
||||
Original_MinecraftInit(thisPtr);
|
||||
|
||||
printf("[LegacyForge] Minecraft::init complete -- calling PostInit\n");
|
||||
DotNetHost::CallPostInit();
|
||||
}
|
||||
|
||||
void __fastcall Hooked_MinecraftDestroy(void* thisPtr)
|
||||
{
|
||||
printf("[LegacyForge] Minecraft::destroy -- calling Shutdown\n");
|
||||
DotNetHost::CallShutdown();
|
||||
|
||||
Original_MinecraftDestroy(thisPtr);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user