ROM Hack Trimming CARD2 games more efficiently?

Nurio

That Kirby fan
OP
Member
Joined
Mar 31, 2009
Messages
850
Trophies
0
Age
33
Location
The Netherlands
XP
450
Country
Netherlands
It should theoretically be possible to trim CARD2 games more efficiently, right?
The way I do it now is play the game for a while on an untrimmed CARD2 game. I then export/backup the save from the ROM, trim the ROM, and then import/inject the save back into the ROM.
This will create a trimmed CARD2 ROM with a working save.

However, when I inspect the ROM, I notice that it actually has a lot of 'empty data'. Take the European Pokémon Alpha Sapphire for example:
From 0x4000 to 0x70AD5FFF is the game itself
From 0x70AD6000 to 0x712BAFFF is the manual
From 0x712BB000 to 0x7316FFFF is the update data.
Now, everything so far is very snug together, as it should be. This creates the smallest possible ROM. However, when you import/inject your save into the ROM, it gets injected at 0x77280000, because that is the offset that is set for the game.
This means that there is a whole lot of nothing between 0x73170000 and 0x7727FFFF. That is 65 MB of empty data. If I had gotten rid of the update data and the manual as well, that would've been 104 MB of empty data. That is a lot!

So of course my question is... This can be done much more efficiently, right? There should be a way to change that offset for the save to be as snug to the ROM data as possible.
And perhaps it's also possible to trim a CARD2 ROM without the contrived method of first playing it, then exporting the save, trimming the ROM, then injecting the save again?
 

Nurio

That Kirby fan
OP
Member
Joined
Mar 31, 2009
Messages
850
Trophies
0
Age
33
Location
The Netherlands
XP
450
Country
Netherlands
what is a card2 game?
It's a game that has its save embedded into the ROM file, to emulate NAND-based saving. Because of this, when you trim a CARD2 game you normally trim away the part where the game is supposed to save.
That is why you need this roundabout way to trim a CARD2 game. However, as I explained above, I theorize this can be done much more efficiently.
 

Nurio

That Kirby fan
OP
Member
Joined
Mar 31, 2009
Messages
850
Trophies
0
Age
33
Location
The Netherlands
XP
450
Country
Netherlands
You'll probably have to decrypt the game, and rebuilt it using a RSF that specifies a new address for the save so that you can trim it down to a smaller size. I don't see any "easy" way out of doing this. :P
Alright, that's a shame...

Does anyone know how to determine the size of the savegame? Is that written anywhere in the ROM, how big the save potentially will be? I noticed that the Pokémon AS save ranged from 1 to 16 MB, and I feel it could become even bigger...
 

Apache Thunder

I have cameras in your head!
Member
Joined
Oct 7, 2007
Messages
4,402
Trophies
3
Age
36
Location
Levelland, Texas
Website
www.mariopc.co.nr
XP
6,744
Country
United States
The save for Pokemon main series games is about 1mb in size (1,024 KB I think?). I would think most CARD2 games use this size for saves. But I've only ever owned Pokemon games with this save type. :P

The decrypted save exported from SaveDataFiler is actually only half that though. I think the second half of the 1mb size is probably used for a backup copy as Pokemon games usually have space for a backup copy of the save file.
 

Nurio

That Kirby fan
OP
Member
Joined
Mar 31, 2009
Messages
850
Trophies
0
Age
33
Location
The Netherlands
XP
450
Country
Netherlands
The save for Pokemon main series games is about 1mb in size (1,024 KB I think?). I would think most CARD2 games use this size for saves. But I've only ever owned Pokemon games with this save type. :P

The decrypted save exported from SaveDataFiler is actually only half that though. I think the second half of the 1mb size is probably used for a backup copy as Pokemon games usually have space for a backup copy of the save file.
Th-Then how did I get a 16MB file?
Anyway, Pokémon was just an example I used. I wanted to know if there was a definite way of knowing how big a save file is going to be...
 

piratesephiroth

I wish I could read
Member
Joined
Sep 5, 2013
Messages
3,453
Trophies
2
Age
103
XP
3,228
Country
Brazil
Well I tried to do this a while ago, converting Card1 games (which use a maximum of 512KB of save data) to Card2 and trimming them. It depends on the game and I have no idea how it works.

Some games work well with like 1MB of empty space, while others require like nearly 100MB.

Now I wouldn't trim native Card2 games unless I knew how big the save data could get.
I think the exheader setting might specify the minimum size for the save data, not the maximum.
 

Nurio

That Kirby fan
OP
Member
Joined
Mar 31, 2009
Messages
850
Trophies
0
Age
33
Location
The Netherlands
XP
450
Country
Netherlands
Well I tried to do this a while ago, converting Card1 games (which use a maximum of 512KB of save data) to Card2 and trimming them. It depends on the game and I have no idea how it works.

Some games work well with like 1MB of empty space, while others require like nearly 100MB.

Now I wouldn't trim native Card2 games unless I knew how big the save data could get.
I think the exheader setting might specify the minimum size for the save data, not the maximum.
Dang. Well, thank you. I guess I just have to suck it up and accept the fact that CARD2 games are better left untrimmed and waste the space on that.

Then on a somewhat related note... Do you know if it's safe to delete the update data from the ROM? And if so, how do you do that? (I personally want to leave the Manual on there.)

Also, I use 3dsexplorer for trimming... But I notice now I have two different versions of 3dsexplorer, even though they're both version 1.5.3... Any idea what is up with that?
Opening the same ROM in the two versions gives this:

k8mcHQ7.png


BDVj0W4.png


Notice the strange differences.
- The ROM parts are called NCSD, NCCH, NCCH, NCCH in one and CCI, CXI, CFA, CFA in the other.
- One doesn't show a Logo.bin and WriteableRegion.bin while the other does
- One doesn't show 'CCI Info' while the other does
- It doesn't show here, but one speaks about Trimming and Super Trimming while the other speaks about Trim CCI and Remove Update Data

What the heck happened here that I have two different versions with the same version number!?
 

piratesephiroth

I wish I could read
Member
Joined
Sep 5, 2013
Messages
3,453
Trophies
2
Age
103
XP
3,228
Country
Brazil
You can safely delete the update partition, yes.
But it's only like 30MB big... won't really make a difference.

The 'Super trim' function of 3DSExplorer does that.

Also I think this 3DSExplorer I'm attaching here is the latest one.
 

Attachments

  • 3DSExplorer1531.rar
    141.3 KB · Views: 216

Nurio

That Kirby fan
OP
Member
Joined
Mar 31, 2009
Messages
850
Trophies
0
Age
33
Location
The Netherlands
XP
450
Country
Netherlands
You can safely delete the update partition, yes.
But it's only like 30MB big... won't really make a difference.

The 'Super trim' function of 3DSExplorer does that.

Also I think this 3DSExplorer I'm attaching here is the latest one.
Well, 30 MB over 20 ROMs is still 600 MB.

---

The first screenshot I showed is from the latest build downloaded from 3DBrew, so I am going to assume that is the latest version?
However, the second screenshot is from some version of which I don't know exactly when or where I got that... It's quite a mystery...

This leaves me still with two questions:
1. Why do I have two versions that claim to be the exact same version?
2. Why does the ambiguous version seem more complete than the latest version? (It shows more data)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Veho @ Veho: Mkay.