mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 02:56:36 -04:00
e1a55da286
A pack entry is keyed (texture, palette), so a draw whose CLUT ships no file falls back to the original low-res texture even when the pack plainly has the right IMAGE -- the texture hash identifies it, only the colour is unknown. On an exact-key miss we now borrow any palette variant of the same texture for its shape and take the colour from the live CLUT in the shader. REPL_FS gains the VRAM usampler (on unit 1; unit 0 already holds the replacement image, and sharing it would have the sampler read the pack PNG as if it were VRAM) and reads the first non-zero palette entry as the ink. STP comes from that live entry too, since a different CLUT may set the bit differently and reading it off the stale image would blend the glyph wrongly. Alpha still decides the cutout: that is the SHAPE, and the pack is the authority on it. The gate is a property of the DATA, not a list of texture hashes we happen to know are fonts: recolour only where the pack image has a single ink colour, so there is no colour structure to flatten. image_is_mask computes it once at decode. Multi-colour images decline and fall through unchanged, counted in repl_multicol. Also adds repl_calls / repl_nocontain / repl_notex, because "hit + miss" could not distinguish "the pack has no image for this texture" from "no upload backs this primitive", and those want opposite fixes. That distinction is what showed the fallback does not fire on the WipEout 3 title screen at all -- every draw there already hits its exact key -- so the substitution path is byte-identical where it does not apply, and the blocky title-screen text has some other cause. In gameplay the misses are overwhelmingly repl_notex: textures with no pack entry of any palette, which recolour cannot help. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>