Dolphin, the GameCube and Wii emulator - Forums
What exactly is passed to XXH64 when creating hashes? - Printable Version

+- Dolphin, the GameCube and Wii emulator - Forums (https://forums.dolphin-emu.org)
+-- Forum: Dolphin Emulator Discussion and Support (https://forums.dolphin-emu.org/Forum-dolphin-emulator-discussion-and-support)
+--- Forum: Development Discussion (https://forums.dolphin-emu.org/Forum-development-discussion)
+--- Thread: What exactly is passed to XXH64 when creating hashes? (/Thread-what-exactly-is-passed-to-xxh64-when-creating-hashes)



What exactly is passed to XXH64 when creating hashes? - Invader - 10-08-2016

So, I wrote a script for Wiimm's tools to extract all the textures from Paper Mario: The Thousand Year Door, when JosJuice brought up this:

(10-06-2016, 02:10 AM)JosJuice Wrote: If the image data you get from this is identical to the image data you would get from Dolphin, it's possible to write a program that calculates image hashes in the same way as Dolphin.

So, what I want to know is what xxh64 sees when Dolphin passes the data to it. Also Is it using a seed when hashing? The only thing I could find was this: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/ImageWrite.cpp#L27
From what I understand this states that the data should be 8-bit RGBA. I'm not fluent in C++ so I have no idea if the code reflects that comment. Tbh... not even sure what I'm saying makes sense. Tongue

I tested the go version and the python version of XXHash. The thing is I'm obviously doing something wrong because they're giving me different hashes for the same files!

I attached the python script and the xxhsum.exe (might require go to run, I have no idea). Huh

Here's the .py script I wrote.
Code:
import os
import xxhash

path='' #placeholder for later
in_filename='test.rgba.data' #this should be changed to the input file
with open(in_filename, 'rb') as f:
   xxhash.xxh64(f.read()).hexdigest()

Sorry, if these questions sound really stupid. Never done any real coding in my life until now. Tongue

Any help would be appreciated. Smile


RE: What exactly is passed to XXH64 when creating hashes? - degasus - 10-08-2016

Almost: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/HiresTextures.cpp#L277 and https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/TextureCacheBase.cpp#L747

So it hashes the texture in the native GC format, which is tiled and often encoded in uncommon formats.


RE: What exactly is passed to XXH64 when creating hashes? - Invader - 10-09-2016

(10-08-2016, 08:46 AM)degasus Wrote: Almost: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/HiresTextures.cpp#L277 and https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/TextureCacheBase.cpp#L747

So it hashes the texture in the native GC format, which is tiled and often encoded in uncommon formats.
Hashes match! Thanks a ton!

[Image: 0FL1njJ.png]