ROM Hack Pokémon Emerald Real 512Kb Flash Memory Patch

Pikachu025

Well-Known Member
OP
Member
Joined
May 3, 2006
Messages
972
Trophies
0
Age
33
Location
Austria
XP
396
Country
Australia
I was unsatisfied with the somewhat hacky state of the Pokémon games running in AGB_FIRM on the 3DS, so I modified Pokémon Emerald to save to a 512Kb Flash Memory, which AGB_FIRM supports correctly, and I figured some other people would enjoy it too.

This was somewhat involved, but the gist of it is that my patch makes the game not save a backup save file, and redirects the saves to the Hall of Fame and Battle Frontier Battle Recording to fit in the remaining space of the flash memory.

You can download the patch here:
Version 1.1 with Save Converter 2.0: https://filetrip.net/dl?c0A9uKM8rS
Version 1.1: https://filetrip.net/dl?oI4BtX1Bdu
Version 1.0: https://filetrip.net/dl?wMMydqqNLW

Instructions, checksums, and technical details can be found in the included readme. I also included a tool to convert saves from the traditional 1Mb save to the smaller 512Kb save and vice-versa.

This patch is only for the English version of Pokémon Emerald. The same method can probably be applied to other games and language versions too, though, so if there's interest and I can find the time I may make other patches too.

If you run into any issues, please report them with exact details. I've played around with this for a while and it seems to work fine, but it's always possible I missed something somewhere. Keep save backups just in case, too.
 
Last edited by Pikachu025,

Pikachu025

Well-Known Member
OP
Member
Joined
May 3, 2006
Messages
972
Trophies
0
Age
33
Location
Austria
XP
396
Country
Australia
That's the idea, yeah. I didn't have the time yet to play through the whole game on my 3DS yet, but it saves correctly after the Elite 4 in no$gba when the save type is set to 64KB, so I'm pretty confident.
 
  • Like
Reactions: Girtana1

noctis90210

Well-Known Member
Member
Joined
Dec 24, 2013
Messages
969
Trophies
0
Age
37
XP
1,635
Country
@Pikachu025
thanks for this workaround...
just want to clarify some things:

it will work if:
unpatched save only compatible on unpached rom?
patched save only compatible on patched rom?

it will not work if:
unpatched save injected to patched rom?
patched save injected to unpatched rom?

just correct me if one of my statement is wrong...
 

Pikachu025

Well-Known Member
OP
Member
Joined
May 3, 2006
Messages
972
Trophies
0
Age
33
Location
Austria
XP
396
Country
Australia
It's intended as a command-line tool, but drag&drop should work too.

It means that you lose some information converting that way. You lose the backup save, and if you have over 32 Hall of Fame entries you only keep the newest 32.
 
  • Like
Reactions: noctis90210

noctis90210

Well-Known Member
Member
Joined
Dec 24, 2013
Messages
969
Trophies
0
Age
37
XP
1,635
Country
It's intended as a command-line tool, but drag&drop should work too.

It means that you lose some information converting that way. You lose the backup save, and if you have over 32 Hall of Fame entries you only keep the newest 32.
but the vital parts of the game wont be affected right?
i hope you could also make patches for Ruby/sapphire/firered/leafgreen/and mystery dungeon red...

and oh im just curious whats the difference between 1.0 and 1.1?
 

Pikachu025

Well-Known Member
OP
Member
Joined
May 3, 2006
Messages
972
Trophies
0
Age
33
Location
Austria
XP
396
Country
Australia
Yeah, you're not losing anything important, that's the point!

The only difference is the types of (emulated) flash hardware supported. If you're using this for 3DS injection don't worry about it, it's only really of interest if you want to use the patch on an old GBA flashcard.
 
  • Like
Reactions: noctis90210

noctis90210

Well-Known Member
Member
Joined
Dec 24, 2013
Messages
969
Trophies
0
Age
37
XP
1,635
Country
Yeah, you're not losing anything important, that's the point!

The only difference is the types of (emulated) flash hardware supported. If you're using this for 3DS injection don't worry about it, it's only really of interest if you want to use the patch on an old GBA flashcard.
thanks a lot sir... hope to see your future releases soon :-)
 

Cralex

Well-Known Member
Member
Joined
Jul 29, 2016
Messages
206
Trophies
0
Age
37
XP
1,296
Country
United States
So, if I'm understanding the current way that things are done, the current hacks just drop the backup save and disable the corruption message, right? Would such a simpler hack, such as the one installed on my 3ds right now, produce a corrupted save if you do the wrong thing?
 

Pikachu025

Well-Known Member
OP
Member
Joined
May 3, 2006
Messages
972
Trophies
0
Age
33
Location
Austria
XP
396
Country
Australia
So, if I'm understanding the current way that things are done, the current hacks just drop the backup save and disable the corruption message, right? Would such a simpler hack, such as the one installed on my 3ds right now, produce a corrupted save if you do the wrong thing?

If by 'current hack' you mean this one, it does the following, if I'm reading those changes correctly:
- dummies out the 'save file corrupted, previous save will be loaded' message window
- dummies out the flash chip identification (by always just taking the first known one)
- dummies out some check in the berry fix program sent to RS, for some reason?

And that's it. Most crucially, the game still thinks that it has a full 1M flash to write to and will attempt to do so, but due to the way 1M Flash works on GBA (it's two banks of 512K flash that need to be switched between) the write succeeds and overwrites data from the other bank. Effectively, the two banks end up shadowing each other and the last write wins at any given time. This would be mostly harmless if we only had the two save files in there, but we also have some extra data, the Hall of Fame and the Battle Frontier Battle Recording, so a poor combination of what the game thinks as current save slot and writes to that extra data will just corrupt the save.

More illustratively, a real save looks like this:

CFu4Xhs.png


If the two banks shadow each other, we have the following setup, where only one of the two horizontal sectors can ever exist at the same time.

o788uXg.png


Before beating the Elite 4, this ends up working okay; a new save ends up corrupting the one in the other slot, but one complete save always exists:

yMKUsCG.png


But after the Elite 4, one of the two possible setups breaks both slots, since the game first writes the regular save and then writes the Hall of Fame afterwards:

zp86VKq.png


A similar thing can occur for the Battle Recording, but that's not as critical since recording a battle doesn't reset the game, so you always have the chance to just save again. It's not safe either though.

My patch removes the second save slot, the second Hall of Fame sector, and the unused Trainer Hill eCard sector, and rearranges the remaining sectors so they don't shadow eachother, so all combinations of saving just work fine.
 

Cralex

Well-Known Member
Member
Joined
Jul 29, 2016
Messages
206
Trophies
0
Age
37
XP
1,296
Country
United States
@Pikachu025 Yes, that's what I was asking about, although what I've been seeing in the GBA injector thread generally amounts to something like "change these values in a hex editor and it'll magically just work."

Thanks for such a detailed explanation and such a thorough fix. Thankfully, I never got around to playing much of Emerald on my 3DS.

Also, wow. Makes me wonder what it was like for the developers to try cramming in more features without running out of save space.
 
Last edited by Cralex,

Wanderer0891

Well-Known Member
Member
Joined
Dec 18, 2008
Messages
108
Trophies
0
XP
282
Country
United States
@Pikachu025

Out of curiosity would it be possible to make a similar patch for Super Mario Advance 4 as its another game with a 128Kb Flash Memory that doesn't work quite right on AGB_FIRM.
 

MajinCubyan

The Funky Super Saiyan
Member
Joined
Nov 24, 2014
Messages
783
Trophies
2
Age
35
Location
Orre
XP
2,124
Country
United States
Just seen this on romhacking.net and it totally slipped under my radar. Fantastic job, now I can finally play this game, cause I want to play it on my 3ds. o3o

Quick question; Is this patch compatible with romhacks, such has the Complete Hoenn/National Dex hacks?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/@legolambs