Add optional Windows file caching for GTA IMG archives - #5338
Open
Xenius97 wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an
Enable Windows file caching for IMG archivescheckbox in Advanced settings, disabled by default. The preference is saved and changes require restarting MTA.Following SilentPatch's approach, the patch changes the opcode at
0x406BC6:0xEB(JMP) skipsFILE_FLAG_NO_BUFFERING, allowing Windows to cache IMG reads.0x77(JA) restores GTA's original behavior: unbuffered reads for reported sector sizes ≤2048 bytes; caching permitted for larger sectors.Unchecked means original GTA behavior, not
always disable caching.Motivation
Inspired by SilentPatch's approach to GTA SA's unbuffered archive reads. Allowing Windows to cache frequently accessed game data may reduce disk I/O and improve streaming performance in certain situations on modern hardware, including SSD-based systems.
Test plan
Start MTA and travel around the map with the option disabled, then enable it and restart. Compare loading stutter and streaming performance. Confirm the setting persists after restarting.
Checklist