Homebrew Discussion SM3DAS: Research and Development

Psi-hate

GBATemp's Official Psi-Hater
OP
Member
Joined
Dec 14, 2014
Messages
1,745
Trophies
1
XP
2,671
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,745
Trophies
1
XP
2,671
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,745
Trophies
1
XP
2,671
Country
United States
aads.PNG
Weird. Hashes are wack.
 

godreborn

Well-Known Member
Member
Joined
Oct 10, 2009
Messages
20,527
Trophies
1
XP
12,662
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
74
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,301
Trophies
0
XP
1,468
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

Well-Known Member
Member
Joined
Oct 10, 2009
Messages
20,527
Trophies
1
XP
12,662
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,301
Trophies
0
XP
1,468
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
12,762
Trophies
2
Website
defaultdnb.github.io
XP
15,015
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

Well-Known Member
Member
Joined
Oct 10, 2009
Messages
20,527
Trophies
1
XP
12,662
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
61
Trophies
0
XP
596
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
General chit-chat
Help Users
  • No one is chatting at the moment.
  • gudenau @ gudenau:
    It's a Linux bug.
    Gift
  • gudenau @ gudenau:
    Well a bug with their Linux drivers or something.
    Gift
  • gudenau @ gudenau:
    It captures 2x the amount of packets on Windows 10 in a freaking VM where USB access is slower/more latent.
    Gift
  • The Real Jdbye @ The Real Jdbye:
    what is this piece of hardware @gudenau
    Gift
  • gudenau @ gudenau:
    Beagle 480
    Gift
  • T-hug @ T-hug:
    Dune 2021 1080p HDRip X264 AC3-EVO
    Gift
  • kenenthk @ kenenthk:
    Dune? Reminds me of seeing my ex naked
    Gift
  • mr_switch @ mr_switch:
    Oh yeah Dune movie is out, watching it later
    Gift
  • mr_switch @ mr_switch:
    Here is hoping 2022 is a good year for DC cinematic universe
    Gift
  • gudenau @ gudenau:
    Honestly don't really know what Dune is.
    Gift
  • gudenau @ gudenau:
    Anyone here know much about Jetbrains InteliJ Idea?
    Gift
  • Sonic Angel Knight @ Sonic Angel Knight:
    Oh, T-hug was here :blink:
    Gift
  • Sonic Angel Knight @ Sonic Angel Knight:
    Hey, where the admins at? Come in the chat. I got a idea. How bout a Sound notification or something when someone tags you in chat? :ninja:
    Gift
  • DinohScene @ DinohScene:
    Post it in the v8 feedback thread
    Gift
  • Gift
  • OzKenny1983 @ OzKenny1983:
    Post what sorry? I'm guessing we were talking about this ages ago, but I haven't been on GBATemp in almost a year so my memory is failing me :-/
    Gift
  • DinohScene @ DinohScene:
    feedback and or bugs that may have popped up since the migration to XenForo 2!
    Gift
  • OzKenny1983 @ OzKenny1983:
    Umm...I think you might have the wrong person, since that may as well have been written in Chinese. I have nothing to do with the management of this site, nor have I ever been involved. I'm just a member, and hardly even qualify as that...like I said my last post was almost a year ago lol
    Gift
  • DinohScene @ DinohScene:
    Lol no, Sonic Angel Knight had an idea, best would be to post it in that thread haha
    Gift
  • OzKenny1983 @ OzKenny1983:
    Sorry, don't know Sonic Angel Knight either...
    Gift
  • The Real Jdbye @ The Real Jdbye:
    this new xenforo version keeps logging me out, whyh
    Gift
  • godreborn @ godreborn:
    not sure. I haven't had that issue. the only computer related issue I've been having is with my isp and the smtp server getting authentication errors randomly. I'm going to have to call them again. this started happening again after changing my password.
    Gift
  • godreborn @ godreborn:
    you may have to check the box that says "stay signed in." psx place used to have a problem like this for random people, including myself. that will prevent being logged out or it did anyway.
    Gift
  • The Real Jdbye @ The Real Jdbye:
    it's happened 3 times already and of course i ticked the box
    Gift
  • linuxares @ linuxares:
    Yeah happened to me as well
    Gift
    linuxares @ linuxares: Yeah happened to me as well