Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ZSO format. #1170

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

JoseAaronLopezGarcia
Copy link

@JoseAaronLopezGarcia JoseAaronLopezGarcia commented Dec 16, 2023

After testing out the different formats that could potentially support GameCube ISO images, I've found that ZSO is the best performing of all. While it's not the best compressed formats, the difference in size is not as big as the difference in performance.

To improve compression ratio, the reader has been adapted to support up to 8K blocks and LZ4-HC (High Compression).
Out of the 20+ games I've tested, most compressed with a ratio between 80% and 90%, saving up to 300MB in larger images.

It is important to note that for the best size I've used ISO imaged shrunken using the Nkit format, while attempting to compress full ISOs results in extremely bad compression ratios due to the high amount of random garbage data in them.

One las interesting thing I've noticed is that the same format with (apparently) the same parameters might result in different sizes depending on the program used. I've tried both maxcso and the python ziso script and found that the python script is a bit better (though the difference is a few megabytes).

Compatibility itself is pretty high, with most games performing about the same as their ISO counterpart, but I did notice stuttering in many games with the BIOS intro, though in-game the only stuttering I've seen is with the FMVs in Mario Kart.

The ZSO format is fully supported by the PSP and the PS2 (in both hardware and emulator), and it makes the most sense for a compressed format to be used for GameCube images on real hardware.

One last thing I want to point out is that I've noticed (and fixed) a bug in the code that detects region in CISO files.

nintendont.zip

@GerbilSoft
Copy link
Contributor

GerbilSoft commented Dec 16, 2023

With regards to the random data: What's needed is a "scrubbed" disc image that gets rid of all of the random data. Dolphin Emulator's "Convert" function can do this by converting an existing disc image to ISO format, with "Remove Junk Data (Irreversible)" checked. You would then convert it to ZISO format.

My own rom-properties tool will support GCN images compressed in ZISO format in the next release.

I haven't done Nintendont stuff in quite a while, but I'll take a look at this tomorrow. I have some FatFS updates queued up locally that I haven't yet sent in a PR for.

@60fpshacksrock
Copy link

60fpshacksrock commented Aug 17, 2024

@JoseAaronLopezGarcia

I know this is sort of old, but I thought you might want to know that, even though it is for Dreamshell, the iso make pack 2.4 has a zso compressor. It leaves the .iso part on, so disc images end with .iso.cso

It says cso, but a quick look in HxD shows it to be zso. Why am I telling you all of this? It turns out that this lzo compressor makes the disc images a bit smaller (2MB less with my extracted, rebuilt, and trimmed Hydro Thunder ripped from Midway Arcade Treasures 3. And if the Dreamcast can handle it well, the Wii should have no problem.

Though I should let you know that the first (zso) build you uploaded on github does not detect the disc images even when the extension is renamed to zso.

If you want the compressor let me know. It was seemingly made by the Russian guy that creates Dreamshell.

/

@GerbilSoft

Speaking of junk data, I would guess, though it must have been very difficult, that someone must have figured out the junk data algorithm for GC and Wii with the RVZ format. Other than that, I am unsure as to how it would even be possible to compress such data and be able to re-convert back to a fully intact iso. Dolphin's source code may give insight as to how such an achievement was even possible.

@JoseAaronLopezGarcia
Copy link
Author

@JoseAaronLopezGarcia

I know this is sort of old, but I thought you might want to know that, even though it is for Dreamshell, the iso make pack 2.4 has a zso compressor. It leaves the .iso part on, so disc images end with .iso.cso

It says cso, but a quick look in HxD shows it to be zso. Why am I telling you all of this? It turns out that this lzo compressor makes the disc images a bit smaller (2MB less with my extracted, rebuilt, and trimmed Hydro Thunder ripped from Midway Arcade Treasures 3. And if the Dreamcast can handle it well, the Wii should have no problem.

Though I should let you know that the first (zso) build you uploaded on github does not detect the disc images even when the extension is renamed to zso.

If you want the compressor let me know. It was seemingly made by the Russian guy that creates Dreamshell.

/

@GerbilSoft

Speaking of junk data, I would guess, though it must have been very difficult, that someone must have figured out the junk data algorithm for GC and Wii with the RVZ format. Other than that, I am unsure as to how it would even be possible to compress such data and be able to re-convert back to a fully intact iso. Dolphin's source code may give insight as to how such an achievement was even possible.

ZSO uses LZ4, JSO uses LZO, we should avoid mixing up formats as to not make things more confusing (we already have PSP CSO and GC CSO being totally different formats yet having the same signatures).

I did try LZO (JSO format) with Nintendont and while the results were decent, there was stuttering on some game's cinematics, while with LZ4 (ZSO format) I've seen no stuttering.

As for garbage data, any trimmer software should do fine (I used nkit, which produced great results when mixed with ZSO).

@60fpshacksrock
Copy link

60fpshacksrock commented Sep 11, 2024

I know trimming makes it smaller, but I would prefer just to remove junk data to keep the TOC intact.

@JoseAaronLopezGarcia
Copy link
Author

I know trimming makes it smaller, but I would prefer just to remove junk data to keep the TOC intact.

Just zero out the junk data, it will compress nicely even with LZ4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants