ROM Hack [Release] Metroid Samus Returns Save Editor

JoostinOnline

Certified Crash Test Dummy
Member
Joined
Apr 2, 2011
Messages
11,005
Trophies
1
Location
The Twilight Zone
Website
www.hacksden.com
XP
4,339
Country
United States
@JoostinOnline do you by any chance know how the features work? As in, if you scan the amiibo for concept art and sound test does it get unlocked instantly or do you need to finish the game + to scanning?
You need to scan them after beating the game at least once before the gallery/OST are unlocked. You can scan them before, but you'll only get the extra energy/missile tanks. They also don't automatically unlock after beating the game just because you scanned them before.

Just to put into perspective how much Nintendo is milking this, the four amiibo cost a total of $56US (plus $20US if you need a scanner dongle) plus tax. And that's IF the new amiibo weren't sold at inflated prices by scalpers. The two-packs are currently trending at $48 on eBay (or $28 individually). I only paid $38USD for the actual game.

Would dumped binaries of the amiibo help? You can find those by searching "3ds metroid amiibo bin" on Google. It's the NFC-Bank site.
 
  • Like
Reactions: Raylight

BtEtta

Well-Known Member
Member
Joined
Apr 9, 2016
Messages
147
Trophies
0
XP
718
Country
I have the Amiibos, and a 'before' save. On the principle of making the fewest changes needed for a comparison I'm in the ideal place.

But first off, for inserting data, we need to know how the file format works, and the following applies to all three files in a save.
————————————————————————————————————————————————————
The data is all read sequentially, each bit of data read will tell you how much you need to read next, but (with one exception) you're never explicitly told how many bytes. Therefore to properly parse the file you need to first read it in its entirety.

The first 4 bytes specify (int32) the number of blocks within a the file. Repeat the following steps for each block.[1]
  1. Read the first 4 bytes of the block (int32) — this will tell you how many chunks of data are in this block. Repeat the following steps for each chunk.
    1. Read the first 4 bytes of the chunk — this is the ID of the chunk i.e. what data it represents.
    2. Read the next byte — this tells you what type of data the chunk contains.
    3. Read the next x bytes — This is the data. Length varies depending on data type.
  2. If you have read all the chunks specified the block has ended, there is no ending marker and the next block starts immediately with its chunk count as in step 1.
  3. If you have read all the block specified the file has ended. Any data beyond this point appears to be ignorable garbage.
Data Types (that I've identified so far):
0x62[1 byte] - int8
0x63[x bytes] - array (int8?) — Read the first 4 bytes of data [int32] first, this will tell you the length in bytes of the remaining data for this chunk. This is the only time the file specifically says read x bytes.
0x66[4 bytes] - float
0x69[4 bytes] - int32
0x73[x bytes] - string — Just a standard null terminated string, read until you encounter 0x00
0x75[4 bytes] - Varies as to what it seems to represent, but always 4 bytes long
0x76[12 bytes] - I've got no idea what this is, but the only example I've seen was 12 bytes long so that's all I've got to go on so far.

The first chunk within a block will always be in the following form:
Code:
C5 9C 2C EE 75 xx xx xx xx
That is:
Chunk ID: C5 9C 2C EE
Data Type: 75
Block ID: xx xx xx xx

Chunk IDs should be unique to a block, but the same chunk ID can appear in two different blocks. (Most notably the ID 'C5 9C 2C EE' seen above, which specifies that this chunk contains the block ID)
Block IDs should be unique within a file.
————————————————————————————————————————————————————
So now we should have the information we need to insert data successfully.
First work out how many new chunks you're adding.
Increment the chunk count for this block to represent the new count.
Insert the new chunks.

I'm doing more work right now on exactly what's what within pkprfl.bmssv (which seem to be where all this stuff is stored) does what. But I thought I'd post this for now and edit more later.


[1] There may be data beyond the end of the last block. Best as I can tell the game writes blindly to the file, and doesn't truncate it if the new data written is shorter that what already existed. This data can be ignored.
 
Last edited by BtEtta,
  • Like
Reactions: [Truth]

rog9001

Well-Known Member
OP
Member
Joined
Aug 13, 2016
Messages
119
Trophies
0
XP
469
Country
Japan
hmmm could someone upload to something other that mega? I can't dl from mega. Isp blocking it

Finally figured out how GitHub works so I am moving it over and also added a new "version Y" ;)

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

Version Y has been released

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

lol. [Truth] didn't get notified of your message but I added it into my editor as well.
 

Byokugen

Unit_01
Member
Joined
May 16, 2016
Messages
1,541
Trophies
0
Age
36
Location
Just a bit to the right, or was left...
XP
1,085
Country
Serbia, Republic of
Finally figured out how GitHub works so I am moving it over and also added a new "version Y" ;)

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

Version Y has been released

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

lol. [Truth] didn't get notified of your message but I added it into my editor as well.
Yaay will check it
 

ShadowOne333

QVID PRO QVO
Editorial Team
Joined
Jan 17, 2013
Messages
12,174
Trophies
2
XP
33,407
Country
Mexico
I downloaded the latest Y version of the editor.
I modified all of the 3 saves Play time to all of them having something near 3:15-3:30 hours of play time, and for save slot 2 & 3 I changed the difficulty setting from Fusion to Hard (Slot 2) and Fusion to Normal (Slot 3). I didn't modify anything else.

However, when injecting the save back into the game, with JKSM I get a black screen on boot. :/

Edit #1:
Okay modifying the Play time only for the first slot doesn't crash the game, will go with the changes one by one to know which one is preventing the game from booting

Edit #2:
Okay I seem to have narrowed it down.
Seems like the cause of the crashes on boot is due to any modification made to the Amiibo stuff file.
I changed a lot of things in the common file and the game still booted up normally, even with the Play time changed.

It was only when I modified the Difficulty in the Amiibo file that the game refused to boot.
It might be worth giving that one a check.
 
Last edited by ShadowOne333,

rog9001

Well-Known Member
OP
Member
Joined
Aug 13, 2016
Messages
119
Trophies
0
XP
469
Country
Japan
I downloaded the latest Y version of the editor.
I modified all of the 3 saves Play time to all of them having something near 3:15-3:30 hours of play time, and for save slot 2 & 3 I changed the difficulty setting from Fusion to Hard (Slot 2) and Fusion to Normal (Slot 3). I didn't modify anything else.

However, when injecting the save back into the game, with JKSM I get a black screen on boot. :/

Edit #1:
Okay modifying the Play time only for the first slot doesn't crash the game, will go with the changes one by one to know which one is preventing the game from booting

hmmm... ok. When you find out which save doesn't let you load the game, post it here and I will have a look at it.
 

ShadowOne333

QVID PRO QVO
Editorial Team
Joined
Jan 17, 2013
Messages
12,174
Trophies
2
XP
33,407
Country
Mexico
hmmm... ok. When you find out which save doesn't let you load the game, post it here and I will have a look at it.
Just found out the issue, read my previous post again, it seems to be the Amiibo file which crashes the game.

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

Here's the save.

For testing purposes, profile0 is the original save file.
You can take the pkprfl.bmssv file from that one and copy it over to the other profile1 and profile2, and the game boots.
Changing the Difficulty through the editor in any file seems to cause the crashes.
 

Attachments

  • 2017-09-24_10-52.rar
    32.9 KB · Views: 180
Last edited by ShadowOne333,

BtEtta

Well-Known Member
Member
Joined
Apr 9, 2016
Messages
147
Trophies
0
XP
718
Country
So I wrote my post yesterday about what I'd discovered regarding complete parsing of the save files. And I've been meaning to learn how to read binary data in JavaScript for a while so I ended up writing a parser to make looking at the save file a LOT easier (also to check that my assumptions properly held, and aside from the discovery of one more data type, they did.)

Metroid: Samus Returns - Save File Viewer — working in Firefox / Chrome (and related browsers such as Opera)

This should be useful for testing if you're writing code to inject data (early powerups?) as per the previous post and want to make sure the file should still be parsed correctly.
I may yet end up mutating it into a save editor (I've also been meaning to learn how to write binary data in JavaScript) but for now it just parses the file and displays what it finds.

Everything is done locally, nothing gets sent to a server, and you can save the page and use it locally too if you wish. I've heavily (probably overly) commented the source, so even if you're unfamiliar with JavaScript you should hopefully be able to follow the logic.
One feature included is that certain known ID values are specifically named. Let me know what other ones you know e.g. the ones in pkprfl.bmssv for the three reserve tanks and the galleries/sound test (also if early powerups prove safe and we start learning the IDs for them).
 

Ev1l0rd

(⌐◥▶◀◤) girl - noirscape
Member
Joined
Oct 26, 2015
Messages
2,004
Trophies
1
Location
Site 19
Website
catgirlsin.space
XP
3,441
Country
Netherlands
Without being an ass about it, may I ask why the tool is closed source?

It makes me kinda hesistant to use it, considering the risk closed source software has had in the homebrew community in the past, and the even greater risks when it comes to PC software.

Not going all GNU-evangelist on you, just being curious as to why.
 

rog9001

Well-Known Member
OP
Member
Joined
Aug 13, 2016
Messages
119
Trophies
0
XP
469
Country
Japan
Without being an ass about it, may I ask why the tool is closed source?

It makes me kinda hesistant to use it, considering the risk closed source software has had in the homebrew community in the past, and the even greater risks when it comes to PC software.

Not going all GNU-evangelist on you, just being curious as to why.

Sorry, but because of reasons I don't make anything open source, not anymore. You do see me use it in the video and also I don't make stuff like viruses or any other crud.
 
Last edited by rog9001,

Ev1l0rd

(⌐◥▶◀◤) girl - noirscape
Member
Joined
Oct 26, 2015
Messages
2,004
Trophies
1
Location
Site 19
Website
catgirlsin.space
XP
3,441
Country
Netherlands
Sorry, but because of reasons I don't make anything open source, not anymore. You do see me use it in the video and also I don't make stuff like viruses or any other crud.
@Ev1l0rd Now that I think about it, if you are hesitant to use it then why not setup a VM (Virtual Machine) and just use it in there.
I have nothing against the fact it's closed source that much (like I said, I'm not the type of GNU-Evangelist like Margen).

It's more that I am a bit wary when it comes to closed source software. I'll probably wind up running it in a VM anyway considering I don't have Windows on my main PC.

I was just curious as to why, as closed source software is an uncommon practice in the homebrew scene and has been associated with potentially dangerous tools (UnbanMii springs to mind) or not very excellent individuals (Erman...).
Of course not saying that you are not a good person (I don't know you beyond this), but I just tend to be a bit more careful before I run closed source software.
 
  • Like
Reactions: DarthDub

BtEtta

Well-Known Member
Member
Joined
Apr 9, 2016
Messages
147
Trophies
0
XP
718
Country
I can't speak for the author. But a lot of code I write is often things intended to be used by me alone. Getting the job done is the only requirement.

If I want someone else to see the code it often takes a lot of work to bring it up to scratch. Comments in particular, but there's lots of little things I think about more carefully if I'm expecting other people to read my code. Maybe I've copy-pasted some code because that was quicker than changing it to a function and handling parameter passing. Or maybe the output is designed to feed into specific batch scripts that I'd already written for a more manual process, I know I should integrate the batch script functionality into the code, but what I've got works, and it's fast enough.

Releasing open source code is, for some people, not just a matter of releasing their code.
 
  • Like
Reactions: Ev1l0rd

aznight

Member
Newcomer
Joined
Oct 15, 2017
Messages
6
Trophies
0
Age
35
XP
41
Country
United States
hi i tried all version and its letting me save the changes to the amiibo settings but not actual health or bomb settings. the save option is grey
 

BvanBart

Gaming addict #2 and some
Member
Joined
Apr 16, 2007
Messages
1,315
Trophies
1
Age
36
Location
Bikini Bottom
XP
1,466
Country
Netherlands
I'm not interested in cheating, I just want to be able to play the full game. Even if requiring you to buy more stuff to unlock the rest of the game wasn't terrible, scalpers will end up buying all the amiibo and selling them at inflated prices. They always do.

You never heard of PowerAmiibo? They are very cheap and easy to flash :)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SugoiEndeavor @ SugoiEndeavor: What's up bakaz