GS: add texture replacement wildcard aliases#14584
Conversation
|
Please use the provided PR template. |
There was a problem hiding this comment.
Thank you for submitting a contribution to PCSX2
As this is your first pull request, please be aware of the contributing guidelines.
Additionally, as per recent changes in GitHub Actions, your pull request will need to be approved by a maintainer before GitHub Actions can run against it. You can find more information about this change here.
Please be patient until this happens. In the meantime if you'd like to confirm the builds are passing, you have the option of opening a PR on your own fork, just make sure your fork's master branch is up to date!
|
Thanks, updated the PR body to follow the provided template and added the AI usage disclosure from the contributing guidelines. |
|
@Kupo91 @TheKrzysiek @Pandavenom @superostrich at long last #6826 is delivered |
|
What are we thinking? |
|
What or who are we waiting for? :) |
| }; | ||
| static_assert(sizeof(TextureName) == 32, "ReplacementTextureName is expected size"); | ||
|
|
||
| struct TextureAliasName // 24 bytes |
There was a problem hiding this comment.
Why did you name this "TextureAliasName"?
There was a problem hiding this comment.
It’s basically the wildcard version of TextureName. It keeps all the parts used for matching, except TEX0Hash, since $ is replacing that part.
I called it an “alias” because one replacement file can cover multiple full texture names, but thinking about it, WildcardTextureName is probably clearer and matches the existing TextureName wording better.
Description of Changes
Adds wildcard alias support for hardware texture replacements.
The new alias format allows a replacement filename to omit the source texture hash and match by CLUT hash plus texture state bits instead:
For example:
can match exact filenames such as:
Exact replacement filenames are still checked first. Wildcard aliases are fallback-only.
This also updates dump suppression so alias-covered exact variants are not dumped repeatedly, and recursively scans existing files under the dumps folder so valid dumps moved into subfolders are not redumped into the root dump folder.
Rationale behind Changes
Some games can dump multiple visually identical texture replacement candidates where only the first texture hash changes. This makes replacement packs harder to maintain because creators may need to duplicate the same replacement image under many exact filenames.
The alias format lets pack authors keep one replacement image for these cases while preserving the existing exact filename system.
Suggested Testing Steps
Build PCSX2.
Enable texture replacement loading.
Add a wildcard replacement alias, for example:
Remove or move the exact replacement filenames covered by that alias.
Boot a game that previously produced multiple exact filenames sharing the same CLUT hash and texture state bits.
Confirm the wildcard alias loads in place of the exact filenames.
Enable texture dumping.
Confirm alias-covered exact variants are not dumped repeatedly.
Move a valid dump into a subfolder under dumps and confirm it is not redumped into the root dumps folder.
Manual testing performed:
Did you use AI to help find, test, or implement this issue or feature?
Yes. I used ChatGPT for implementation planning assistance, local scripting/build troubleshooting, and drafting PR text. I manually reviewed the changes, built the project locally, tested the feature in-game, and can explain the implementation and testing.