Skip to content

Fix T2D sprite detection and updated T2D sprite loading#8

Open
FabulatorK wants to merge 6 commits into
Ashiepaws:masterfrom
FabulatorK:fix/t2d-missing-sprite
Open

Fix T2D sprite detection and updated T2D sprite loading#8
FabulatorK wants to merge 6 commits into
Ashiepaws:masterfrom
FabulatorK:fix/t2d-missing-sprite

Conversation

@FabulatorK
Copy link
Copy Markdown
Contributor

@FabulatorK FabulatorK commented Mar 5, 2026

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 a Dictionary<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 Update is basically pointless when the animation system overwrites it one step later in the same frame. Added LateUpdate enforcement 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 _enforcing flag bypasses the Harmony postfixes during enforcement to keep things snappy.

Test plan

  • Enable DumpSprites, load a scene with T2D atlas sprites (e.g. Hornet), verify Sprites/T2D/Hornet/ now contains the full set of sprites from both atlas textures

  • Place edited replacement PNGs in the load path under Sprites/T2D/Hornet/, confirm they display correctly in-game — including during animations

  • Verify 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 LateUpdate enforcement

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant