-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Texture buffer size increase from 16MiB #15
Comments
Changing that size seems to work, at least with a modded konami_720.ctxr file I made, vanilla game would crash at intro logos but patching that size to 4x 16MiB let it work (still would like to test with a proper ctxr file larger than 16MB though, if anyone has one...) For that it needs 8 different spots patched tho, luckily all use the same pattern, but I'm not sure if the pattern scan code here would allow fetching multiple results? Maybe would need to add something like https://github.com/ThirteenAG/Hooking.Patterns in. |
This lets you convert CTXR's to PNG and vice versa, can use it to generate any size you need while testing. :> |
@emoose |
@liqMix hm, does that crash for you when you load it in? Seemed to work fine in vanilla for me, maybe my game didn't load that camo or something. Was able to get a patch working for all those malloc spots, if you want to try it here's a build which patches the buffer from 16MiB to 128MiB: MGSHDFix_0.8_MGS3TextureBufferTest.zip With that my modded ~30MB konami_720.ctxr loads in without crashing, strangely couldn't find those mallocs inside MGS2, so this is MGS3 only atm. E: code for that at 5f67637, added INI stuff there too, maybe will wait to see if this does help with larger textures first before PRing. |
@emoose Wow! Thank you. That absolutely worked. With this I was able to load in these 4x textures with all their mipmaps. There's several that are around ~85mb and many more above 16mb and I was able to load them without crashing. |
Game apparently has a hardcoded texture size limit of 16MiB, mods like https://www.nexusmods.com/metalgearsolidmastercollection/mods/29 have mentioned running into this limit already.
In MGS3 it seems there's a CTextureBuffer class which then gets some buffer part of it malloc'd to 16777216 bytes, possible this is the cause of the texture size limit. At 0x140046BE0 is a GetInstance function that returns the instance of that class, and xrefs to that function then seem to handle mallocing that buffer themselves, eg:
Seems there's around ~6 spots in MGS3 with identical code to above (though I think the buffer is only allocated once per session)
I'm not really sure what files need to be changed for it to crash with >16MB textures though, if anyone has a modded file that does cause crashing an upload would be appreciated to test with!
The text was updated successfully, but these errors were encountered: