alucryd / oxyromon

Rusty ROM OrgaNizer
Other
120 stars 13 forks source link

CIA support using ctrtool #101

Closed leo60228 closed 11 months ago

leo60228 commented 11 months ago

No-Intro's DAT for digital 3DS games uses the raw files served by Nintendo's CDN. However, the vast majority of 3DS-related software only supports CIA. Luckily, they can be easily converted.

Note that CIA files include a console-specific ticket, which of course is not in the No-Intro DATs. However, dumping software will usually generate a fake ticket by default.

Some complexity is added by the fact that the CDN serves TMD files concatenated with certificates, while CIA stores them separately. This is fairly easy to handle, though.

This PR is a draft while I test the code on more games.

leo60228 commented 11 months ago

I've tested this for all games and updates I have. One issue is that a CIA can only include a single version of a game, while No-Intro frequently includes multiple versions as part of the same game in the DAT. Should I do something like append the version number to the filename in these cases, or just ignore it and have people use the CDN format if they care about having all versions?

alucryd commented 11 months ago

Thanks for the PR. Looks good to me, I would just rename cia.rs to ctrtool.rs, and it would be awesome if you could add a few unit tests. Not sure if finding a free CIA file is possible, I usually pick a free homebrew software and craft a fake DAT to go with it.

leo60228 commented 11 months ago

Sorry for taking so long to address the review!

alucryd commented 11 months ago

Thanks a lot!

alucryd commented 11 months ago

@leo60228 Looks like the tests don't pass here. I built the latest release of ctrtool (https://github.com/3DSGuy/Project_CTR) on Arch Linux, but the parsed version is None for me. Also my built ctrtool has no -i flag (although the default action is to print information anyway), are you maybe using a fork of that ctrtool?

leo60228 commented 11 months ago

I used NixOS's ctrtool package. It looks like that's an old version and the output format changed. I'll try to update Nixpkgs and send a PR here to work with the latest ctrtool.

leo60228 commented 11 months ago

I submitted a PR to Nixpkgs, but while testing I found that ctrtool 1.2.0 doesn't seem to work for CIA files at all. I've filed https://github.com/3DSGuy/Project_CTR/issues/145.

leo60228 commented 11 months ago

Incidentally, it seems like ctrtool 0.7 as packaged in Nixpkgs is the last version to work correctly for CIAs (at least the ones I've dumped).

leo60228 commented 11 months ago

I opened #103.