mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-06-11 15:31:55 +00:00
Replace file overwrite with CreateFileW hook for mod texture loading
Instead of backing up and overwriting vanilla terrain.png/items.png, hook CreateFileW to redirect file opens to merged atlases in mods/ModLoader/generated/. The hook is active only during init and removed once textures are loaded into GPU memory. Vanilla game files are never modified.
This commit is contained in:
@@ -157,12 +157,15 @@ namespace GameHooks
|
||||
ModAtlas::BuildAtlases(base + "mods", gameResPath);
|
||||
atlas_done:
|
||||
|
||||
// Overwrite the game's atlas PNGs with our merged versions BEFORE init
|
||||
// loads them. The originals are backed up and restored after init.
|
||||
ModAtlas::InstallAtlasFiles(gameResPath);
|
||||
// Redirect terrain.png/items.png file opens to our merged atlases
|
||||
// so the game loads mod textures without modifying vanilla files.
|
||||
ModAtlas::InstallCreateFileHook(gameResPath);
|
||||
|
||||
Original_MinecraftInit(thisPtr);
|
||||
|
||||
// Textures are loaded into GPU memory now; remove the redirect.
|
||||
ModAtlas::RemoveCreateFileHook();
|
||||
|
||||
// After init, vanilla icons have their source-image pointer (field_0x48)
|
||||
// fully populated. Copy it to our mod icons so getSourceHeight() works.
|
||||
ModAtlas::FixupModIcons();
|
||||
|
||||
Reference in New Issue
Block a user