Homebrew Discussion SM3DAS: Research and Development

Psi-hate

GBATemp's Official Psi-Hater
OP
Member
Joined
Dec 14, 2014
Messages
1,749
Trophies
1
XP
3,399
Country
United States
I thought it'd be a good idea to make a centralized R&D thread for those who are tinkering with the collection for whatever purposes. Currently, there's a lot of interest in swapping the collection's games with different ones. In this post, as more is discovered, I'll update it with information.

Any suggestions for currently found info, along with things to help people get started into researching this, would be appreciated.

Here's the post from @WatchMeNow explaining important information in regards to the process. I'll personally be looking into figuring out the solution to it.

To extract the romfs from the game, use nxdumptool.

Made an account just to post this but:

Just replacing the ROM file will crash the emulator without changing corresponding config files related to the ROM.

In order to replace the ROM you need to have your replacement file located at:
Code:
\atmosphere\contents\010049900F546002\romfs\MarioSunshine\Super_Mario_Sunshine_Stardust-trimmed.gcm

The file that loads the ROM is:
Code:
\atmosphere\contents\010049900F546002\romfs\rom.json

That contains the text:
Code:
{   "UID": "MarioSunshine",   "DolHash": "4e10808fdbd8a8beefab38163bb43a5002f60d63",   "ROM": [     "rom:/MarioSunshine/Super_Mario_Sunshine_Stardust-trimmed.gcm"   ] }

The UID is how the emulator searches the /data/ folder to replace textures and gecko codes, so in theory we could replace that with something like "NewGame" and then match that to "rom:/NewGame/NewGame.gcm" in the replacement "rom.json" file we would load with LayeredFS.

We would then also need to find out how to generate new hashes associated with a newly inserted ROM (NewGame.gcm) in the files:


Code:
\atmosphere\contents\010049900F546002\romfs\NewGame\NewGame.gcm
Code:
\atmosphere\contents\010049900F546002\romfs\NewGame\NewGame.hash

Code:
{
    "hash": {
        "exe": "corresponding exe hash with NewGame",
        "media": "corresponding media hash with NewGame",
        "full": "corresponding full hash with NewGame"
    }
}


as well as

Code:
\atmosphere\contents\010049900F546002\romfs\data\database\hagi\NewGame.json

Code:
{     "Info": {         "GCM": {             "Name": "New Game",             "CountryCode": "US",             "GameID": "GAME",             "DVD": 0,             "ROMVersion": 0,             "GCMID": "GAME.0.0"         },         "Hashes": {             "exe": "appropriate hash here",             "media": "appropriate hash here",             "full": "appropriate hash here"         },         "UID": "NewGame",         "ShortName": "NewGame"     },     "Mxic": {         "Hashes": ["appropriate hash here", "appropriate hash here"]     } }

and finally the "boot" code needs the GameID ("FourCC") and VideoMode changed in this file

Code:
\atmosphere\contents\010049900F546002\romfs\data\database\config\NewGame.config

Code:
        },
        "Boot" :
        {
            "Country" : "US",
            "DVDRoot" :
            {
                "FourCC" : "GAME"
            },
            "VideoMode" : "NTSC",
            "Retail" : true,
            "UseDolHash" : true,
            "LoadBios" : false
        },

Hope this thread will help others and facilitate a good place to research. Of course, don't link to any illegal content like keys, extracted files, etc. Thanks!
 
Last edited by Psi-hate,

Psi-hate

GBATemp's Official Psi-Hater
OP
Member
Joined
Dec 14, 2014
Messages
1,749
Trophies
1
XP
3,399
Country
United States
Nice! Good thinking about making a new thread exclusive to R&D.
Will keep a close eye on this thread for sure :)
Thanks!
Right now I'm actually having some trouble extracting the romfs of the game, as for whatever reason, my attempts with hactool fails to finish with an error like:
Saving romfs\control.nacp...
Failed to write file!"

I'm using keys I've dumped myself, so it's weird. Currently trying to debug it. I'm also using an administrative command prompt session, so it shouldn't be permission issues.

Here's the batch script I'm using right now for reference:

@Echo off
echo Command line argument 1: "%1"
echo Command line argument 2: "%2"
hactool --disablekeywarns -t pfs0 --pfs0dir=temp --keyset=%1 %2
for %%f in (temp\*.nca) do (
hactool --disablekeywarns --keyset=prod.keys --romfsdir=romfs %%f
)
rmdir temp /s /q

Argument 1 being the keys, Argument 2 being the NSP.
 
Last edited by Psi-hate,

Psi-hate

GBATemp's Official Psi-Hater
OP
Member
Joined
Dec 14, 2014
Messages
1,749
Trophies
1
XP
3,399
Country
United States
aads.PNG
Weird. Hashes are wack.
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
https://pastebin.com/32iUR7BU I used a program to create hashes for every file in my Sunshine romfs dump and nothing matches the ones its asking for, probably not necessary but i wanted to be thorough

I haven't looked at this, but ps3 pkg files use a hash (sha-1), which is the bottom two lines of the pkg. the hash is everything but those two lines if that helps. it may not be the complete file.
 
  • Like
Reactions: Psi-hate

Dakota_Pixel

Member
Newcomer
Joined
Feb 22, 2018
Messages
10
Trophies
0
XP
94
Country
United States
Is it possible to see what happens when you set "UseDolHash" : false, but on the sunshine .gcm provided by nintendo?
That seems to work. I also got the game to render at a lower resolution using the same file that UseDolHash is in by setting handheld upscale to 1 instead of 2.
 

Tomobobo

Champion.
Member
Joined
Nov 26, 2005
Messages
1,310
Trophies
1
XP
2,140
Country
United States
That seems to work. I also got the game to render at a lower resolution using the same file that UseDolHash is in by setting handheld upscale to 1 instead of 2.

Sweet, I wonder if the hash search is even worth it then. I'm gonna try to tinker but I haven't messed with the rom/exefs stuff in a long time.
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
the boot.dol may be a common file for the emulator meaning it's probably the main executable like the EBOOT.BIN on the ps3, 4, and vita or the default.xex on the 360 for that particular game. it's the first file that's loaded, so other files could be named anything. I'm assuming the cube like the wii uses it inside the gcm. try to look for some identifying marker or even possibly a hex length that's normal (if they're all the same). look in a homebrew boot.dol and see if there's some identifying mark to show the beginning and possibly end of the file, then look for something like that in the gcm. hash the file, which I'm assuming is the boot.dol. most of the time files are padded with 0s, sometimes Fs to equal 16 bytes or a full line once the end of the file has been reached. if it's a hex length thing, there could be dozens of lines with just that to fill up the size.
 

Tomobobo

Champion.
Member
Joined
Nov 26, 2005
Messages
1,310
Trophies
1
XP
2,140
Country
United States
The sunshine .gcm provided does work on dolphin but at 25 fps for me and the videos play audio but only the subtitles, and some of the sound is weird like the name of the button is cut out. Also in the subtitles and the map screen there are references to keyboard inputs.
upload_2020-9-15_23-50-50.png

upload_2020-9-15_23-51-26.png


And I think the hash will be of the .dol executable within the .gcm, not of the iso itself.
 
Last edited by Tomobobo,
  • Like
Reactions: KiiWii

KiiWii

Editorial Team
Editorial Team
Joined
Nov 17, 2008
Messages
16,574
Trophies
3
Website
defaultdnb.github.io
XP
26,881
Country
United Kingdom
Maybe set ‘use dol hash’ to false, or comment out/remove hash related categories altogether.... see if ninty actually made them a prerequisite :ph34r:

edit:

looking forward to a compatibility list soon :)
 
  • Like
Reactions: peteruk

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,471
Trophies
3
XP
29,116
Country
United States
you also need to determine if it's using compression. I don't know about nintendo, but sony likes to use zlib. in fact, both the ps3 and the vita (probably ps4 as well) use it. adrenaline, for example, is compressed using that format. it's 78 DA in hex, and you can decompress adrenaline with simply zip.
 

rafaelia

Well-Known Member
Newcomer
Joined
Feb 17, 2010
Messages
69
Trophies
1
XP
984
Country
I'm thinking gcm is a stripped build with assets linked to and loaded externally, or all the assets are in the gcm and the switch emu is loading them in on the fly
 
  • Like
Reactions: Tomobobo

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Sonic Angel Knight @ Sonic Angel Knight: :ninja: