Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with manual image hashing for texture replacement
02-11-2018, 07:47 PM
Post: #1
Help with manual image hashing for texture replacement
I need help with manual HD texture replacement for Zero no Kiseki (NPJH50311) and other games based on Falcom YamaNeko.

I already got the clut and texture extracted using a script I wrote: gist dot github dot com slash uyjulian slash 1e22b0d4c38ffe1e9cb1f90f1aec7df3

A sample file is located at transfer dot sh slash 3Qbu2 slash img underscore sample dot zip

The specific file I'm trying to hash is extra00.itp, and the hash PPSSPP generates is 00000000bf5ac1b01e7ce339, while the hash I generate is 0x9E5CC90D for method 1 in the script, 0x7A06CD22 for #2, and 0x77501699 for #3.

I ran xxhash32 agains the image data, but it doesn't match the hash that PPSSPP generates. I tried the separate row and sum method located at Core/TextureReplacer.cpp but that still doesn't work.

Is there a way to extract image data BEFORE it gets hashed in PPSSPP so I can compare with my script? Is there something that I'm doing wrong?

This is my textures.ini:
Code:
[options]
hash = xxh32
ignoreAddress = true
version = 1
Find all posts by this user
Quote this message in a reply
02-11-2018, 10:07 PM
Post: #2
RE: Help with manual image hashing for texture replacement
Things to make sure you're doing:

1. You must match the width and height of the texture the game specifies, which are always powers of two. So if the image is 500x500, the hash will be on 512 rows and 512 pixels wide.

2. You need to use the row based hashing with the correct seed.

3. You must hash in the format the game specifies, for example 565, 8-bit CLUT, etc.

To get the data before hashing, remove ignoreAddress from the ini file, and then look at the memory at the address exported. You can export if from the memory viewer.

-[Unknown]
Find all posts by this user
Quote this message in a reply
02-15-2018, 09:57 PM
Post: #3
RE: Help with manual image hashing for texture replacement
Okay, so I can successfully hash the image data. However, how would I hash CLUT data if ignoreAddress is on, I have the ABGR8888 CLUT data, and I know the number of entries/length of the CLUT table? It seems like the XXHASH used for the CLUT has a different seed: 0xC0108888, but I can't get the hash to match the middle 4 bytes, no matter what I do.
Find all posts by this user
Quote this message in a reply
02-16-2018, 08:25 AM
Post: #4
RE: Help with manual image hashing for texture replacement
That's probably because it's not just clut hash, for details check the source. ~ notice the "| dim " part? Those should be texture dimensions I believe, but better check yourself.

http://forums.ppsspp.org/showthread.php?tid=6594 - Custom PPSSPP Shaders!
http://forums.ppsspp.org/showthread.php?tid=3590&pid=117172#pid117172 - simple CE scripts to help creating CWCheats,
https://github.com/LunaMoo/PPSSPP_workarounds - CWCheat workarounds.
Find all posts by this user
Quote this message in a reply
02-19-2018, 04:11 PM
Post: #5
RE: Help with manual image hashing for texture replacement
Okay, I still can't get the hash to match my clut.

The image size of 512x512 & 0xf0f == 0 (GPU/GPUState.h#L291) so, if ignoreaddress is also true, than "cachekey" will be zero.

The texture format should be GE_TFMT_CLUT32 since the image is using 32-bit ABGR. Which means I need to xor 7 somewhere.
(GPU/Common/TextureCacheCommon.cpp#L323)

The seed should be 0xC0108888. (GPU/GLES/TextureCacheGLES.cpp#L246). clutExtendedBytes should be the number of colours in the clut * 4.


...Honestly, I might just put fwrites everywhere to dump the clut directly from PPSSPP and see where I'm going wrong. I'm getting 0x7A5A37BA for the clut hash but ppsspp is giving me 0xbf5ac1b0.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: