Help Using Dolphin Debugger to find File Unknown CLZ Decompression Algorithm

  • Hello everyone.

    I'm currently working on a mod for Harvest Moon: A Wonderful Life.

    However, a lot of the game files I'm looking for seem to be compressed into CLZ files.

    What I currently know about these files:

    • They all start with a file header of 43 4C 5A 00 at offset 0x00000000
    • They use big endian encoding
    • They only contain one file (e.g. commonall.arc.clz would be a compressed version of commonall.arc)
    • They then state the size of the decompressed file in hex (e.g. 00 53 54 90 or 5.46MB) twice at offsets 0x00000004 and 0x0000000c
    • Compressed data seemingly starts at offset 0x00000011
    • They seem to be using some unknown form of LZ (Lempel–Ziv) compression

    [Blocked Image:]

    I've tried testing file decompression using comtype_scan2, but have thus far been unsuccessful in finding a suitable match.

    It seems that the game must decompress and read these files on the fly when loading the game, so I was wondering if anyone has any experience in using Dolphin's debug mode.

    Ideally, I'm wanting to find what point the game reads these files, and then analyze that code to create a decompression tool.

    I've tried analyzing the game's main executable (dol file) and found that the loading of certain clz files seems to be linked to a SceneInit function.

    I've also managed to decompile the executable into human-readable (sort of) python format.

    Any help would be greatly appreciated.

  • Heyho, first things first welcome to our community. Please note that it is not allowed to post content that violates our terms of use (Who would have thought...) and especially content that violates copyright laws. I have adapted your post somewhat accordingly, please take this as a warning and use caution next time. (For your own safety as much as ours...)

    As to your problem: Gamecube Hacking is a pretty unusual topic around here, so it might be the case that not many people around here are able to help you. If you could provide the actual file (or some other examples) you are trying to reverse engineer, we might be able to have a look at it, and just figure out what sort of algorithm it is. Since it is a Nintendo Devkits we are talking about, they were using some forms of LZ compression in the past, and chances are that they also used them on the gamecube. The GBA for example uses mostly LZ77 for compression, the Nintendo DS uses mostly LZW (as I recall) and so on. Chances are the gamecube might use something very similar.

    Is this a file common among other game cube images as well, or is it specific to Harvest Moon? If it is a common file, it is possible that someone already figured out what it is, and how it works. If it's not, it's an oddity, but figuring it out should still be feasable :)

    Also: Sidenote: If you did not notice, we are a german community, most of our members will probably speak german, so don't expect everyone to understand you :)


    Let the old ways live and prosper in the hearts of our young

  • Thank you very much. I apologize for the file. Thank you for amending the post.

    As far as I can tell, these files are limited to Harvest Moon: A Wonderful Life (on Gamecube and PS2) and Harvest Moon: Another Wonderful Life (on Gamecube).

    All files can be found on the root file of the disc (e.g. disc:\mainchapter0.arc.clz). They can be extracted by dumping an ISO of the game (e.g. using CleanRip), then can extract the ISO contents using a program such as GC Rebuilder.

    On the PS2 version of the game, it seems that there is both a compressed (mainchapter0.arc.clz) and uncompressed (mainchapter0.arc) version of the same file, although these might have issues due to the PS2 using little endian (as opposed to big endian on the gamecube).

    These files can be found by opening the PS2 ISO of the game, then opening DATA0000.AFS using AFS Explorer.

    Samples of these files (from any version of the game) can be provided upon request.

    I'm unsure whether it would break the Terms of Service to upload/link the files here, but I do have some info about my work researching the files on my WordPress blog for the project.

    I'll do some more digging into variants of the LZ77 and LZW (I believe some other games around that time also used LZSS).

    There are also European and German versions of the game, but I haven't done much work on those versions. Once I've been able to modify files on the English (USA) versions, I should be able to use that same knowledge to create a romhack of the German version (although I will likely need some help with translating).

    Edited 2 times, last by seangibbz: Noted special file found on PS2 version of the game. ().