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

XCI Game Revision #37

Closed
garoxas opened this issue Aug 11, 2018 · 3 comments
Closed

XCI Game Revision #37

garoxas opened this issue Aug 11, 2018 · 3 comments

Comments

@garoxas
Copy link
Contributor

garoxas commented Aug 11, 2018

This is a simple write-up on how to get the proper game revision info from an XCI (Note that game revision in this case is not the scene revision, but the actual game version)
There might be a simpler way, but this is what I have for now

I'm using Super Mario Odyssey (rev001) as example

First extract Secure Partition using hactool

hactool -t xci -k keys.txt --securedir=secure "Super Mario Odyssey (rev001).xci"

...
Secure Partition:
    Magic:                          HFS0
    Offset:                         000017118000
    Number of files:                12
    Files:                          secure:/2f0a2dbaa9bb3f9b6812cac649e899be.nca             000000000000-00014a290000
                                    secure:/41a1b3d10de2145e9c5a8b88c826ffc2.nca             00014a290000-00014a3a1a00
                                    secure:/ff2c421da0d97497d55433e9a230f066.nca             00014a3a1a00-00014e6dda00
                                    secure:/8a249b9ce39cc17a47ebc187066c3075.nca             00014e6dda00-00014e711600
                                    secure:/5cd45d37db132f12bcb8f4519f4f8165.cnmt.nca        00014e711600-00014e712400
                                    secure:/e2da8ec4b358da9663999851cdc366a4.nca             00014e712400-000154d5fc00
                                    secure:/52e0c0ab74b00ee5a9db3955d62edb49.nca             000154d5fc00-000154e71600
                                    secure:/fbfb96c303bc691b9a76c33b51c58bf0.nca             000154e71600-000155269e00
                                    secure:/eeb2308f2b80d57618b3342d5541a75e.nca             000155269e00-00015529be00
                                    secure:/a6a4a038d573eb9dc15b703ed8931eb7.cnmt.nca        00015529be00-00015529d200
                                    secure:/01000000000108000000000000000003.tik             00015529d200-00015529d4c0
                                    secure:/01000000000108000000000000000003.cert            00015529d600-00015529dd00

There you'll find 2 .cnmt.nca files, each for the base game and the patch. To figure out which one is which, we need to extract both NCA

hactool -k keys.txt --section0dir=5cd45d37 secure\5cd45d37db132f12bcb8f4519f4f8165.cnmt.nca
...
Saving Application_0100000000010000.cnmt to 5cd45d37\Application_0100000000010000.cnmt...

Done!
hactool -k keys.txt --section0dir=a6a4a038 secure\a6a4a038d573eb9dc15b703ed8931eb7.cnmt.nca
...
Saving Patch_0100000000010800.cnmt to a6a4a038\Patch_0100000000010800.cnmt...

Done!

If it's not already obvious, the patch is in the Patch_0100000000010800.cnmt, so we proceed with this file (if there are multiple patches, that means we have to look each one of them)

Using Hex Editor, open the cnmt file and look at offset 0x0E. Here we got value 0x18, now add 0x20 + 0x18 + 0x38 = 0x70 and you'll get the offset for the filename of the NCA we need
Details on the cnmt format here https://switchbrew.org/index.php?title=NCA

sbm

Now open the NCA once again using hactool and you'll get the control.nacp file

hactool -k keys.txt --romfsdir=info secure\52e0c0ab74b00ee5a9db3955d62edb49.nca

...
Saving info\control.nacp...

And finally, open control.nacp file using Hex Editor and go to offset 0x3060. There you'll find the version information
Details on control.nacp http://switchbrew.org/index.php?title=Control.nacp

sbm

@garoxas
Copy link
Contributor Author

garoxas commented Aug 11, 2018

I'm too lazy to fix this so I figure I just put what I found here 😁
I could do the dirty implementation (it's simple using the current code, but there are too many unnecessary loops) but I just don't feel to do it now. Maybe later if I could make the finding above simpler to be implemented

@gibaBR
Copy link
Owner

gibaBR commented Aug 11, 2018

Just take your time. :)

garoxas added a commit to garoxas/Switch-Backup-Manager that referenced this issue Aug 16, 2018
@garoxas
Copy link
Contributor Author

garoxas commented Aug 16, 2018

#40

@garoxas garoxas closed this as completed Aug 16, 2018
gibaBR added a commit that referenced this issue Aug 16, 2018
get correct XCI Game Revision, fix #37
gibaBR added a commit that referenced this issue Aug 20, 2018
* get correct XCI Game Revision, fix #37 by @garoxas / @Garou;
* Fixed filter for content type (dlc, base game, update) not working. Also, this filter is now saved on program preferences (will persist between sessions);
* Separate renaming paterns for XCI and NSP files;
* User can now limit filename size for NSP files.
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

No branches or pull requests

2 participants