Fix T2D sprite detection and updated T2D sprite loading#8
Open
FabulatorK wants to merge 6 commits into
Open
Conversation
…ng boolean flag Updated .gitignore to overlook files enable convenient local build and auto-copy compiled .dll
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
Dump fix: Previously, T2D sprites were only dumped when they happened to pass through the managed sprite setter at runtime — meaning if you never triggered a specific animation, those sprites simply never got dumped. Now
DumpAllT2DSprites()sweeps through all loaded Sprite objects in memory and catches every BC7/DXT5 atlas sprite, no gameplay required.Detection upgrade: The old
HashSet<int>tracking was a "seen it once, done forever" deal. Swapped it for aDictionary<int, string>that actually notices when a renderer's sprite changes — so animation-driven swaps that sneak past the Harmony patches get caught on the next 30-frame check.Load fix (the big one): Turns out applying a replacement in
Updateis basically pointless when the animation system overwrites it one step later in the same frame. AddedLateUpdateenforcement that re-applies cached T2D replacements after animations run — so the replacement is what actually gets rendered. Only iterates known T2D renderers (not everything in the scene), and an_enforcingflag bypasses the Harmony postfixes during enforcement to keep things snappy.Test plan
Enable
DumpSprites, load a scene with T2D atlas sprites (e.g. Hornet), verifySprites/T2D/Hornet/now contains the full set of sprites from both atlas texturesPlace edited replacement PNGs in the load path under
Sprites/T2D/Hornet/, confirm they display correctly in-game — including during animationsVerify hot-reload still works: edit a replacement PNG while the game is running, confirm it updates live
Check for performance: no noticeable frame drops from the per-frame
LateUpdateenforcement