Project

General

Profile

Actions

Emulator Issues #8206

closed

Decompressing a GameCube .gcz file yields different hashes than the original image

Added by karasuhebi over 9 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

When you compress a GameCube image and then decompress it again, the resulting decompressed image is different than the original image.

Hashes for James Bond 007: Nightfire, before compression and after decompression (by HdkR):
3971f7e05cf87c6288c740caa299a000
7de7b11341754f519dca2a289ab089da

Actions #1

Updated by karasuhebi over 9 years ago

[21:56:22] GC stuff doesn't roundtrip because our uncompress routine is kinda stupid, but the compression is lossless

Actions #2

Updated by degasus over 9 years ago

  • Status changed from New to Accepted

This should never happen...

Actions #3

Updated by benthomas82 over 9 years ago

Gamecube discs have garbage data in them just like Wii discs. Doesn't the compression routine wipe this data in order to achieve this compression? In which case, this would be expected behavior.

Actions #4

Updated by Sonicadvance1 over 9 years ago

No. Gamecube compression is lossless, we don't scrub Gamecube discs at all.
Scrubbing Gamecube discs is dangerous and we refuse to do it.

Actions #5

Updated by benthomas82 over 9 years ago

I see, I didn't know that. Why is it more dangerous than Wii discs, can you elaborate on the dangerous part? I scrubbed all my GC discs with a separate tool when I ripped them so I could compress them with 7zip, so they always compressed well in Dolphin without me realizing.

I did some investigating of my own for this issue, I reripped four of my games, compressed and decompressed them and examined the differences. On all four, the last 360448 bytes (exactly 352k) was zeroed out where there used to be data. This starts at address 0x57000000 in the image.

If I have some time later, I may try to figure out what build this started in.

Actions #6

Updated by benthomas82 over 9 years ago

I did have time, and managed to track it down to build 4.0-4402.

https://dolphin-emu.org/download/dev/6df67bf38f52151ee5efb64edb4bc60ecce601ef/

Actions #7

Updated by karasuhebi over 9 years ago

Sweet! Thanks for the hard work. :D

Actions #8

Updated by skidau over 9 years ago

What is the file size of the iso/gcm in bytes before compression and after decompression?

Actions #9

Updated by karasuhebi over 9 years ago

I don't have a copy of Nightfire, would it be OK if I give you the sizes for another iso?

Actions #10

Updated by skidau over 9 years ago

Yes, any iso where you have seen this problem.

Actions #11

Updated by karasuhebi over 9 years ago

The Legend of Zelda - The Wind Waker:
Before compression - 1,459,978,240 bytes
After decompression - 1,459,978,240 bytes

Actions #12

Updated by benthomas82 over 9 years ago

Sorry if I wasn't clear on that. The decompressed images are the correct size (1,459,978,240 bytes), but the problem is they are zero-filled (0x00) for the last 352k instead of the data that should be there.

Actions #13

Updated by skidau over 9 years ago

Could you try compressing with the latest dolphin and decompressing the gcz with an old version? And vice versa and let us know the results?

Actions #14

Updated by karasuhebi over 9 years ago

Will do!

Actions #15

Updated by karasuhebi over 9 years ago

Original image:
SHA-1 = eed83fea6eccb3ba4092b998fcdf4cc57f5ba6b4

Compressed by -4199, decompressed by -5168:
SHA-1 = abe18704d79021d41aff17c4d2285d515d6fbb71

Compressed by -5168, decompressed by -4199:
SHA-1 = eed83fea6eccb3ba4092b998fcdf4cc57f5ba6b4

Actions #16

Updated by unknownbrackets over 9 years ago

You can try this, which should have it resolved:

http://dl.dolphin-emu.org/prs/pr-2042-dolphin-latest-x64.7z

-[Unknown]

Actions #17

Updated by benthomas82 over 9 years ago

I quick check shows PR 2042 does indeed fix the issue, I get the same MD5 after decompressing as before.

Actions #18

Updated by skidau over 9 years ago

  • Status changed from Accepted to Fixed
Actions

Also available in: Atom PDF