Venomalia / DolphinTextureExtraction-tool

Dumps GC and Wii textures, compatible with the Dolphin texture hash.
MIT License
30 stars 4 forks source link

Migrate CriCompression to C# #9

Closed Repiteo closed 1 year ago

Repiteo commented 1 year ago
Venomalia commented 1 year ago

thanks for the work. i didn't bother much with the CPK lib because i didn't care as long as it worked. do not expect it to have a negative impact, but would like to test it first.

Repiteo commented 1 year ago

It does need more thorough testing, yes. The existing implementation didn't work full-stop, so I'll have to test locally using the original CPK repository

I'll upload logs after doing so & make any necessary adjustments. I'd like to say that the transition is 1-1, but this is dealing with pointer shenanigans across languages, so hiccups wouldn't surprise me

Repiteo commented 1 year ago

Okay so, this is already more of a headache than I expected; to a point that I outright don't understand how the old implementation even worked in the first place. Trying even a local clone of the original CPK repo is giving me weird build hangups

As it stands, a comparison test seems beyond me

Repiteo commented 1 year ago

Took a lot of work, but I now have a working replica repository for comparing cpp, which took some digging into repository history. In doing so, I learned that there was ORIGINALLY a C# method for handling things, but it was since changed to cpp for reasons that I'm still not entirely sure of. Comparing the two, the cpp method is significantly more inconsistent!

In any case, I now have a proper system to work with, so I can get to logging as intended 👍

Repiteo commented 1 year ago

Did a 24-pass loop of both implementations, going beyond that got funky on both implementations, with a simple array of 1-6. Logged the results here:

C++

Pass: 0
43-52-49-4C-41-59-4C-41-06-FF-FF-FF-40-5C-6C-72-14-01-00-00-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-80-E4-24-6C-72-1F-00-00-00-54-00-68-00-65-00-20-00-43-00-2B-00-2B-00-20-00-6D-00-6F-00-64-00-75-00-6C-00-65-00-20-00-66-00-61-00-69-00-6C-00-65-00-64-00-20-00-74-00-6F-00-20-00-6C-00-6F-00-61-00-64-00-2E-00-0A-00-00-00-00-00-00-80-E4-24-6C-72-3C-00-00-00-54-00-68-00-65-00-20-00-43-00-2B-00-2B-00-20-00-6D-00-6F-00-64-00-75-00-6C-00-65-00-20-00-66-00-61-00-69-00-6C-00-65-00-64-00-20-00-74-00-6F-00-20-00-6C-00-6F-00-61-00-64-00-20-00-64-00-75-00-72-00-69-00-6E-00-67-00-20-00-76-00-74-00-61-00-62-00-6C-00-65-00-20-00-69-00-6E-00-69-00-74-00-69-00-61-00-6C-00-69-00-7A-00-61-00-74-00-69-00-6F-00-6E-00-2E-00-0A-00-00-00-00-00

Pass: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23
43-52-49-4C-41-59-4C-41-06-FF-FF-FF-40-5C-6C-72-14-01-00-00-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00

Pass: 18
43-52-49-4C-41-59-4C-41-06-FF-FF-FF-20-E3-0A-01-00-00-00-00-01-02-03-04-40-5C-6C-72-14-01-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00

C#

Pass: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23
43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-40-5C-6C-72-14-01-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00

Pass: 11
43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-20-E3-0A-01-00-00-00-00-40-5C-6C-72-14-01-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-20-E3-0A-01-00-00-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-20-E3-0A-01-00-00-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF

Pass: 22
43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-20-E3-0A-01-00-00-00-00-00-00-00-00-40-5C-6C-72-14-01-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-C4-62-4D-01-00-00-00-00-40-5C-6C-72-06-00-00-00-43-52-49-4C-41-59-4C-41-06-FF-FF-FF-04-00-00-00-49-4C-41-59-01-02-03-04-05-06-00-00-00-00-00-00-54-43-6C-72-00-00-00-00-00-00-00-00-00-00-00-00

Anything entering the double digits makes some inconsistencies appear, but generally C#'s output is more uniformly in-line with the "expected" overall value. C++ for some reason always has an "incorrect" initial value, with only subsequent runs having something that's more in-line and reproducable

Between the two, the only discrepancies seem to be bytes 12-19, 39-44; the first 6 bytes of both seemingly swapped. Beyond that, they're identical. I plainly have no clue why the new method was introduced, it seems entirely arbitrary, and with the repo long dead I wouldn't know where to even start

With all that said… The C# method that was pushed here is functionally identical to the old C# method that repo used to have, so those comparison tests were all moot. As such, this commit is suitable for a push as-is