feat(gta-core-five): add replace_ptxclipregions_file manifest statement to override particle clip-region data#4060
Open
eryxiz wants to merge 1 commit into
Open
Conversation
…nt to override particle clip-region data
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.
Goal of this PR
Let a resource replace
ptxclipregions.dat, the particle-texture UV clip-regiontable, through a new
replace_ptxclipregions_filemanifest statement.Custom particle assets can already be streamed, but if a particle uses a custom
texture atlas whose frame layout differs from the base game there is currently no
way to tell the engine how that atlas is split into frames, so such particles fall
back to the full-texture default
(0,1,0,1)and render incorrectly. This givescreators a way to supply the matching clip-region data.
ptxclipregions_patch.mp4
How is this PR achieving the goal
Adds a
replace_ptxclipregions_file 'file.dat'manifest statement, parsed incitizen-resources-gta.The game parses
ptxclipregions.datonce at ptfx init and keeps the pointersrage::ptxClipRegions::GetDatareturns alive for the process lifetime, sorebuilding its table in place would dangle them. Instead, this hooks
GetData(the single accessor every particle draw goes through) and serves the
resource-provided overrides from its own store, leaving the game's table
untouched; lookups that miss fall through to the original.
The store is populated when the resource mounts and cleared on disconnect. Reads
use a
shared_mutexwith anatomicfast-path, and the backing pool isappend-only so the pointers handed back stay valid.
Resource usage:
The file must be declared in
files{}so the client downloads it and the VFS canread it.
This PR applies to the following area(s)
FiveM
Successfully tested on
Game builds: 2372, 2545, 2612, 2699, 2802, 2944, 3095, 3258, 3323, 3407, 3570
Platforms: Windows
Checklist