ROM Hack Question How to view ROM info

nitro322

Well-Known Member
OP
Newcomer
Joined
Mar 5, 2014
Messages
59
Trophies
0
XP
453
Country
United States
(This may not be the best forum to ask, but I couldn't find anything more obvious. Please feel free to move if appropriate.)

I have what I think should be a simple question - how to view details about a switch ROM, whether XCI or NSP? Basically, how to view the title id, name, version, required system version, etc. I'd figure hactool could do that pretty easily, but I just get this:

Code:
$ hactool --disablekeywarns -i -t xci Cave\ Story+.xci

XCI:
Magic:                              HEAD
Header Signature:                   374AA94DAFD71256203D65ACFAB44A15B1A98A183D8A136AA5123F176C16952A
                                    3FB3D3AEB3B2F534B2ABA73E1F972EED85FCD73DE424A48B98D7355B415CA032
                                    ADB86616490353358E74052F61517481FE4C36A646140ED7734FE168919A429F
                                    8C0250B3089CB50BAF1BB9A6BACD843FCD6D397130418D5C030F7B1BC5865643
                                    58BE215A80BD032FE57621E4F50E5BD4723DDBE77183AF52C5839B1B392AAD1A
                                    BDCA0F33B67575ED81190DAEF8C166D762D0E67CACD17D97461273A43AEEC9FD
                                    C0A715D9103DC9E1BA2579158191596266D5656A5F9052892D03FA33B363CC99
                                    9F5DE1EBC0910A3527A51D294C6D09A0D5FB3D2AA2C21315629E8EF6B139B5AE
Cartridge Type:                     2GB
Cartridge Size:                     000020797c00
Header IV:                          7B4C55FF475D871368AFC56A76C05BBE
Encrypted Header:                   2B21AA2E41CBC29E8A7D1415646FE07CF2D8C0C07E62BD2F2C8AD97A1D1267C1
                                    F54592F13181B0AC4B68158DB5080B58B0E73B98ABD82A2418171EC257825FD9
                                    4E270DDC96250853CC5818E871FD26DCC3740A9E5A4CA1F153EBC96077CA4521
                                    874B12607E7B870C11A9BC1A40B9FF17
Encrypted Header Data:
    Compatibility Type:             Global
Root Partition:
    Magic:                          HFS0
    Offset:                         00000000f000
    Number of files:                3
    Files:                          rootpt:/update                                           000000000000-000017ff0000
                                    rootpt:/normal                                           000017ff0000-000018022000
                                    rootpt:/secure                                           000018028e00-000020788a00
Update Partition:
    Magic:                          HFS0
    Offset:                         00000000f200
    Number of files:                167
Normal Partition:
    Magic:                          HFS0
    Offset:                         000017fff200
    Number of files:                2
    Files:                          normal:/d33d01630cf1282b3869d0c8c04a278d.nca             000000000000-000000030e00
                                    normal:/2d9121fedb032265233c3082c24e5060.cnmt.nca        000000030e00-000000031e00
Secure Partition:
    Magic:                          HFS0
    Offset:                         000018038000
    Number of files:                4
    Files:                          secure:/97e31c6e7b60b1effcc89f6bc608e9b6.nca             000000000000-00000870c000
                                    secure:/d33d01630cf1282b3869d0c8c04a278d.nca             00000870c000-00000873ce00
                                    secure:/50fe36bd0b0e8a71d905f083a83eb474.nca             00000873ce00-00000875ea00
                                    secure:/2d9121fedb032265233c3082c24e5060.cnmt.nca        00000875ea00-00000875fa00
Done!


I'd guess the information I'm looking for is in that Encrypted Header, but I can't for the life of me figure out how to decrypt and view that info.

I know hactool requires a keystore. I have the keys from my switch dumped and saved to ~/.switch/prod.keys, and I can use hactool to decrypt and unpack ROM files successfully with, eg., the following:

Code:
hactool -x -t xci --securedir="Cave Story+" "Cave Story+.xci"
hactool -x -t nca --romfsdir="Cave Story+/romfs "Cave Story+/97e31c6e7b60b1effcc89f6bc608e9b6.nca.ncz"


So, I know my keys work. There's also a utility called NX_Game_Info that prints out basically the exact info I'm looking for:

Code:
$ mono ~/1/NX.Game.Info_0.7.1_cli/nxgameinfo_cli.exe Cave\ Story+.xci
NX Game Info 0.7.1.0
Copyright ©  2018-2019 Garoxas

Opening file Cave Story+.xci

Cave Story+.xci
├ Title ID: 0100B7D0022EE000
├ Base Title ID: 0100B7D0022EE000
├ Title Name: Cave Story+
├ Display Version: 1.0
├ Version: 0
├ Latest Version:
├ System Update:
├ System Version: 0
├ Application Version:
├ Masterkey: 0 (1.0.0-2.3.0)
├ Title Key:
├ Publisher: Nicalis, Inc
├ Languages: en-US
├ Filename: Cave Story+.xci
├ Filesize: 1.86 GB
├ Type: Base
├ Distribution: Cartridge
├ Structure: Scene
├ Signature: Passed
├ Permission: Safe
└ Error:

1 titles processed


So the data is clearly there. And while NX_Game_Info does nearly everything I want, it requires .NET/mono and I'm trying to run this on a Linux system that doesn't have mono.

Is there any way to have hactool decrypt and print readable header info? or am I barking up the wrong tree here? If the latter, any suggestions on another app similar to NX_Game_Info, but maybe C- or python-based or something similar, that can do the job?
 

masagrator

The patches guy
Developer
Joined
Oct 14, 2018
Messages
6,270
Trophies
3
XP
12,037
Country
Poland
Info is stored in NCA header, not in nsp or xci. For hactool to read it you need to unpack xci/nsp and print info about NCA to get some of info.

But I don't think it prints version and required system version.
 
  • Like
Reactions: BigOnYa

nitro322

Well-Known Member
OP
Newcomer
Joined
Mar 5, 2014
Messages
59
Trophies
0
XP
453
Country
United States
Thanks, masagrator. I actually did try checking out the unpacked NCAs, but I didn't really get much useful info from it, either. I do get Title ID and a couple other semi-interesting attributes, but still not the name or version or almost any other info NX_Game_Info.

I'm less optimistic now about finding an easy answer to this. I figure hactool is capable of decrypting all the relevant information, it just seems to be focused more on unpacking ROMs than displaying info about them.

I actually looked at the NX_Game_Info source to see if I could figure out what it's doing, but my programming knowledge is more on the scripting and automation side of things, so I couldn't make too much sense of it. What's funny (well, to me) is it seems to be using LibHac to do the decryption, which itself seems to basically be a reimplentation of hactool as a .NET library. So again, I have to think it isn't doing anything hactool isn't capable of, but like I said before I guess that just isn't what it's designed for.

If anyone else has any ideas I'm all ears, but not too hopeful at this point.

--------------------- MERGED ---------------------------

Hey, thanks BigOnYa. Looks like they're also using LibHac. Seems to be quite the popular library. :-) Since LibHac is likely doing the heavy lifting, re-implementing wouldn't be very straightforward at all - he'd basically have to rewrite that LibHac library as well. But good to know of another tool out there. Appreciate the suggestion.
 
Last edited by nitro322,
  • Like
Reactions: BigOnYa

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: good night