Skip to content

Add optional Windows file caching for GTA IMG archives - #5338

Open
Xenius97 wants to merge 3 commits into
multitheftauto:masterfrom
Xenius97:new/disable_buffer
Open

Add optional Windows file caching for GTA IMG archives#5338
Xenius97 wants to merge 3 commits into
multitheftauto:masterfrom
Xenius97:new/disable_buffer

Conversation

@Xenius97

@Xenius97 Xenius97 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an Enable Windows file caching for IMG archives checkbox 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:

  • Enabled: 0xEB (JMP) skips FILE_FLAG_NO_BUFFERING, allowing Windows to cache IMG reads.
  • Disabled: 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

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants