Texture Replacement - Printable Version

+- (
+-- Forum: PPSSPP - Playstation Portable Simulator Suitable for Playing Portably (/forumdisplay.php?fid=1)
+--- Forum: General Discussion and Announcements (/forumdisplay.php?fid=2)
+--- Thread: Texture Replacement (/showthread.php?tid=18963)

Pages: 1 2 3 4 5 6 7 8 9 10 11

Texture Replacement - YukiHerz - 05-06-2016 12:56 AM

Relevant Links:
Initial Pull Request:
Wildcards Explained:

Old Post: So i was casually wanting to play some psp games on the emulator and, as it is normal for me, i went ahead to get the latest build, then i saw:
Merge: b6d7aab 2e1986d Merge pull request #8715 from unknownbrackets/tex-replace Initial texture replacement support
Along with another comment by Henrik on another thread, this leads me to believe we'll see an actual texture replacement option soon?

Oooor i'm just dreaming and nothing is real?

RE: Texture Replacement coming? - LunaMoo - 05-06-2016 01:33 AM

Actually it's not coming ~ it's already implemented in any version following that merge thanks to [Unknown].

Doesn't really have any ui, but it's pretty easy to use, just edit ppsspp.ini and set:
SaveNewTextures = True
to dump textures into \memstick\PSP\TEXTURES\gameID\new\, then put textures you edit into \memstick\PSP\TEXTURES\gameID\ and set:
ReplaceTextures = True
to have them replaced in game.
There's also optional textures.ini file you can create in \memstick\PSP\TEXTURES\gameID\ which can be used to set different filenames or limit the size of texture, but it's completely optional, you can check it's syntax in the original pull request.

It can use texture scaling(when dumping), should be affected by texture cache settings when replacing and that's pretty much it. If you're on git, you might subscribe to this issue if you're interested about future updates to this feature since it might get more stuff someday.

RE: Texture Replacement coming? - vnctdj - 05-06-2016 11:39 AM

I was too lazy to figure how it works, thanks for the explanation LunaMoo ! Wink

RE: Texture Replacement coming? - YukiHerz - 05-06-2016 01:58 PM

[Image: s5dpMGI.png]

Nice, i'll check what i can do later on.

RE: Texture Replacement coming? - [Unknown] - 05-06-2016 11:43 PM

On this note, I wrote a quick little utility to run the texture scaler on images outside PPSSPP. It pulls in all of PPSSPP to do the threading and etc. all the same way.

Basically, this allows you to use a different scaler, or different scaling factor, on different images.

Unfortunately, because I just pulled in all of PPSSPP's code for its scaler, the exe is kinda big. It could be made smaller by cherry picking out what's needed or refactoring some dependencies (unfortunate that the linker didn't do this for me.)

Run without args for basic help.


RE: Texture Replacement coming? - YukiHerz - 05-07-2016 11:54 PM

That command line seems to be only for x64 systems.

On that note, not a big fan of upscalers on actual textures, but it works wonders on hud elements and small fonts.

RE: Texture Replacement coming? - komiks0916 - 05-20-2016 03:48 AM

is there anyway i can also find the .png files in the rom and have it internally replaced? i wish to make the tekken 6 textures changed..

RE: Texture Replacement coming? - YukiHerz - 05-20-2016 05:03 PM

You'd need to figure out in what format and how does the game store its textures on the iso, this only fetches the textures in run-time, it doesn't deal with the game's internals.

RE: Texture Replacement coming? - YukiHerz - 05-29-2016 11:33 PM

Hmm, it seems Monster Hunter games' texture hashes for both areas and monsters change on a per-quest basis, anything that can be done about this?

RE: Texture Replacement coming? - komiks0916 - 05-29-2016 11:46 PM

i'm having a hard time on editing the Tekken 6 Life bars.. every character (40 characters) multiplied by 40 again on one mode (example is practice mode) = all the lifebars on that mode.. i just wish there is a way where the almost similar addresses of .png can be predetermined by the ppsspp texture replacement..

for example, the main menu of tekken has 09a67ee09dc425ed********.png
wherein * are the ones that changes..

how i wish we could just input this 09a67ee09dc425ed********.png instead of the complete address..

RE: Texture Replacement coming? - LunaMoo - 05-30-2016 12:21 AM

Filename without using ini file is not an address, but an address followed by hash, following your example if the hash changes it pretty much means one of the two things:
- textures are different - and you should treat them separately one by one or give up as that's really the only way,
- texture is same, but potentially includes unused/trash data changing the hash.

If you wonder about the second situation check ini file syntax here, especially examples under "[hashranges]" as that's pretty much what allows you to cut just part of the texture of specific size stored at specific address and avoid hashing the trash data.

When it works fine it will actually improve performance since textures will be smaller and there will be less of them;p. There might however be situations like when game stores completely different texture of same size at same address, but using all of it's size where this will cause issues cutting things you don't want:].

RE: Texture Replacement coming? - [Unknown] - 05-30-2016 01:02 AM

Just to note, the filename is made up of three things, which is also how PPSSPP sees textures:

1. The first 8 characters are the address. For example, 09a67ee0. Games may load different things into the same address, or reuse the address in other scenes. They may also load the same texture in a different address.

2. The next 8 characters are a clut and dimension hash. For most textures, this'll be static. In games that use palette swapping, it'll change for each color variation.

3. The final 8 characters are the data hash. This is based on the data the texture points to in memory. Sometimes there are bleeds, as LunaMoo is describing.

To make it clear, the PSP can only use textures of certain specific sizes. For example, 8x1, 8x2, 8x4, 8x8, and so on. It's not possible to create a 8x3 texture, even if you want one. So games use a larger texture, and when drawing, only draw with part of it.

Here's a visual example:
| X   X   |
|X X X X X|
|   X   X | <-- actual height is 3, but 3 is not supported.
|ASDJASDHS| <-- row 4 isn't used, but it's part of the texture.

Because a single texture can be (and usually is) drawn multiple times, we can't always tell that this part is unused (or we could, but everything would get a whole lot slower.) So we're forced to consider it part of the texture.

Another syntax in the ini (WARNING: loaded gun that you can point at your foot) is this:

09a67ee09dc425ed = 09a67ee09dc425ed.png

If you're absolutely sure the texture never ever ever changes, and the address/clut are never ever ever used by a different texture, you can use the above to map the address/cluthash to a single file.

The main reason for that syntax is actually to be able to ignore frequently-changing textures (e.g. sometimes games draw text or video content.) You can use this to ignore:

09a67ee09dc425ed =

This also works for full (24 character) hashes. SaveNewTextures will ignore these and not save them.

I'm planning to add a way to map just the data hash (or maybe clut + data hash) to a file... not sure what to call it in the ini. Would probably put it under a new section, like "[datahashes]"? Hm. Sounds weird, don't like it...


RE: Texture Replacement coming? - komiks0916 - 05-30-2016 03:30 AM

how about this problem? i just saw that the 1st 7 numbers are the ones who are always changing..

# Life Bars Yellow
09a4c39071d9fdb149ebf5ec = YellowLife.png
09a4c31071d9fdb149ebf5ec = YellowLife.png
09a4370071d9fdb149ebf5ec = YellowLife.png
09a4024071d9fdb149ebf5ec = YellowLife.png
09a4618071d9fdb149ebf5ec = YellowLife.png
09a3ba3071d9fdb149ebf5ec = YellowLife.png
09a3710071d9fdb149ebf5ec = YellowLife.png
09a3669071d9fdb149ebf5ec = YellowLife.png
09a4092071d9fdb149ebf5ec = YellowLife.png
09a408a071d9fdb149ebf5ec = YellowLife.png
09a4342071d9fdb149ebf5ec = YellowLife.png
09a3e26071d9fdb149ebf5ec = YellowLife.png
09a3757071d9fdb149ebf5ec = YellowLife.png
09a3aa7071d9fdb149ebf5ec = YellowLife.png
09a3e09071d9fdb149ebf5ec = YellowLife.png
09a36f7071d9fdb149ebf5ec = YellowLife.png
09a3663071d9fdb149ebf5ec = YellowLife.png
09a3f8a071d9fdb149ebf5ec = YellowLife.png
09a29f1071d9fdb149ebf5ec = YellowLife.png
09a1cca071d9fdb149ebf5ec = YellowLife.png
09a38bd071d9fdb149ebf5ec = YellowLife.png
09a3d09071d9fdb149ebf5ec = YellowLife.png
09a428d071d9fdb149ebf5ec = YellowLife.png

RE: Texture Replacement coming? - [Unknown] - 05-30-2016 04:20 AM

Right, that's the last part of my post above. It means the game is reallocating the texture different places.


RE: Texture Replacement coming? - komiks0916 - 05-30-2016 04:29 AM

(05-30-2016 04:20 AM)[Unknown] Wrote:  Right, that's the last part of my post above. It means the game is reallocating the texture different places.


does it mean i have to really find all the lifebars? :o