Momaster12 Posted September 27, 2020 Share Posted September 27, 2020 (edited) So I just beat the elite four in Pokemon Emerald on my 3DS from a CIA I built/injected myself. After the credits rolled I got the error "The save file has been erased due to corruption or damage." So, I dumped the save started troubleshooting. PKHeX gave me an error implying the save was corrupted. So I did some research and found that one of the biggest problems I had was the save was 64Kb which I guess causes problems later. I read somewhere that I could pad the save file with 00's in HxD and that should fix it. While this does let me see my Pokemon in PKHeX, that is the full extent of what I can do with the now 128Kb save. Almost everything in the SAV tab gives me an unhandled exception error. I also read that I can try using an emulator to convert the save. So I booted up the version of the rom that saves in 64Kb and tried importing my save (battery file), but that still gave me the corruption message and all I could see is new game. And loading a rom that saves in 128Kb with the 128Kb save gives me the same result. At this point, I have no idea what else to do to recover. While it's nice that I still have access to the Pokemon themselves, I would like to continue playing with this save. I do have an even earlier backup that I exported from PKSM that does work (I was using a different CIA at the time) but it's so far back that I might as well restart. Maybe, though, that might help recover? Thank you in advance for the help! Edited September 27, 2020 by Momaster12 Link to comment Share on other sites More sharing options...
Delta Blast Burn Posted September 27, 2020 Share Posted September 27, 2020 You can try posting the save here. Maybe some kind soul is able to see what went wrong with the save and attempt to fix it. @theSLAYER Are you willing to check this out if op posts their save. 1 Link to comment Share on other sites More sharing options...
Momaster12 Posted September 27, 2020 Author Share Posted September 27, 2020 (edited) Sure thing. These are the saves I have at my disposal right now. The latest 2 are the 64KB I extracted and the 128KB that came from the 64KB one, just with padded 00s. The other 128KB one is the other save I got from PKSM before changing CIAs but it's nearly 35 hours behind the latest Edit: I actually found another save that's 20 hours in, 64KB, from my latest CIA, and works fine. Still, though, it's 17 hours behind, which I really don't have the patience to make up 64KB_Dump.sav 128KB_4Hr.sav 128KB_Padded.sav 64KB_20Hr.sav Edited September 27, 2020 by Momaster12 Link to comment Share on other sites More sharing options...
BlackShark Posted September 28, 2020 Share Posted September 28, 2020 Fixed it emerald.sav Your Hall of Fame is still corrupted though. Simply because the data was never written anywhere. I have no idea if this has any impacts on the game besides not being able to see which Pokemon participated. It could probably be fixed by getting the data from another save file. The corruption occured because 64KB save files end at offset 0xFFFF but Hall of Fame data would be written to 0x1C000. You really should stop using that CIA and look for a way to properly inject the GBA so that it creates full 128KB save files. 1 Link to comment Share on other sites More sharing options...
Momaster12 Posted September 28, 2020 Author Share Posted September 28, 2020 Wow, I really cannot thank you enough! I really appreciate your help! And yeah, I really don't remember why I switched to a more broken CIA so I'll be fixing that next. Just out of curiosity, how did you go about fixing the problem? And seeing as the Hall of Fame data is corrupted, is it safe to do another run of the E4? Link to comment Share on other sites More sharing options...
BlackShark Posted September 28, 2020 Share Posted September 28, 2020 I have no idea what will happen after another E4 run. It could fix the Hall of Fame. Maybe keep a backup and try it. I noticed that the block ID of block A and B were wrong and block A contained data that doesn't belong there. Normally block A would store your Pokemon from box 5 but that wasn't Pokemon data. It looked like partial HoF data, but moving it to the proper offset wouldn't restore HoF though. So I just removed the faulty data and restored the block ID and the save loaded again. 1 1 Link to comment Share on other sites More sharing options...
Guest Posted September 28, 2020 Share Posted September 28, 2020 to be honest if i may say something. if your gonna play the gba pokemon games on 3ds, i get a emulator instead of making the cia files. it could help avoid any save corruptions that would happen later on Link to comment Share on other sites More sharing options...
ABadHaiku Posted November 7, 2020 Share Posted November 7, 2020 (edited) On 9/27/2020 at 8:41 PM, BlackShark said: I noticed that the block ID of block A and B were wrong and block A contained data that doesn't belong there. Normally block A would store your Pokemon from box 5 but that wasn't Pokemon data. It looked like partial HoF data, but moving it to the proper offset wouldn't restore HoF though. So I just removed the faulty data and restored the block ID and the save loaded again. You are my hero! I just encountered this exact problem on my 3ds Emerald ROM; thank you so much for explaining what to do for people looking up solutions to this issue from the future. Could you please explain exactly what you did? EDIT from 24 hours later: Below is essentially a livetweet thread of me trying to figure this issue out myself instead of being patient and waiting for a response. I'm leaving it here cause I thought it was funny. Spoiler EDIT: From the research I've done, I think when you say "Block A/B" you mean "PC Buffer A/B", which would be sections 5 and 6 of the save data. Bulbapedia is kind of iffy on what offset everything starts at, though. EDIT 2: Ok, looks like GBA save blocks are shuffled, meaning the exact offsets aren't actually a thing you can put down. Makes sense, but I wish I knew how to identify the block I want to edit. EDIT the third: Ok, I see the 25 20 01 08 48 on both. I know the "48" is the save index for @Momaster12's save, as seen at hex 0x0FFC. On the bugged sav, that 48 was a 00, so you added that to the footer on the revised file. So if that's the footer for block A, then the 25 20 would be the number of bytes to check, the 01 08 would be the checksum for the section and the 0A 00 that you replaced at the beginning would be the section ID! I think I'm starting to figure this out! [edit from the future: no haiku, that's not the checksum. The checksum is the 2 bytes after the ID.] EDIT 4: Ok, so 25 20 01 08 is present in 16 locations in my save. I'm guessing I can figure out which block is causing the error by going through each one and seeing if the section ID is reasonable on each. EDIT 5: Alright, here's what I've figured out. The structure of each section's footer goes like this: ID ## ## ## 25 20 01 08 SAVEINDEX with the save index being how many times your file has been saved. I'll clean all of these edits up once I've actually figured out what I'm doing. EDIT 6: Turns out it's harder than you'd think to get a working 128kb save file CIA up and running, but I think I've figured out the save file part. Stand by. EDIT 7: Good news: I got the broken save to load, and all of my pokemon and items are there. Bad news is, I'm locked in May's room with my doppleganger blocking the only exit. My mom just told me to check my desk, and my doppleganger says my bags are packed. I'm scared. EDIT 8: Oh. My god. The hall of fame info overwrote the GAME FLAGS section. The game straight-up deleted my RAW PROGRESS. RIP. @Momaster12 I'm stealing your badges and berry trees, suck it. Once I verify that this works, I'll post a guide to fixing one's Gen 3 save if it got corrupted by being 64kb. Final Edit: Yep, it works. Livetweets are over, actual instructions going out today. Edited February 10 by ABadHaiku Spoilered live commentary. Link to comment Share on other sites More sharing options...
ABadHaiku Posted November 8, 2020 Share Posted November 8, 2020 (edited) If you've ever tried to make Emerald run on a 3DS in the native GBA VC, you know that it doesn't want to save initially. If you're using Ultimate GBA VC Injector, which was the only option for the longest time, you have to do some funky hex editing to your rom to get it to save properly. Plus, you have to SRAM patch your game to get it to work. So much nonsense. WRONG. DON'T FOLLOW THIS GUIDE. (the one that tells you to do the nonsense) So here's the issue: First off, but unrelated to the current situation: you don't need to SRAM-patch 3DS CIAs. The GBA hardware on the 3DS supports every save type, as long as the save file is large enough for the game in question. Now, here's the thing: Pokemon Emerald uses a 128kb-large Flash save file. The CIA we made using Ultimate VC Injector, despite the fact that we specified FLASH-type memory with RTC, only makes a 64kb-large save file. Whoops. Fun fact: did you know that Pokemon games actually store two save files? They keep track of the latest save, and the save before that in case of save corruption. Problem is that both of those take up, in total, more than 64kb of space. You should start to see the problem here. The funky hex editing from the guide above is, to simplify, making the game forget where to write the backup save file. That way, you never run over the 64kb of space you have! Easy fix! The only thing you're left with is a perfectly-functional save file and an annoying message of the game complaining that your game is secretly screwed. FR/LG doesn't need all 128kb of space, so it never becomes an issue there. Once the backup save is deleted, it happily fits itself within the 64kb of allotted space. Emerald, however, is a bit of a beefier boi. Through the normal game, nothing seems wrong. However, once you become the Champion of the Hoenn region, guess where the hall of fame data has to go. That's right, the latter 64kb of save. (Also mystery gift and battle records, but those only become accessible in the postgame, so you're going to encounter the HoF roadblock first.) Since the game only has access half the save data it thinks it has, when it tries to write the hall of fame data to the other half of the file, it actually wraps around and overwrites some of the main save data. The game's data storage keeper-tracker-of system gets replaced with the name of your Pikachu, and it can no longer see your 200 hour grinding spree as a valid save file. And since we stopped the game from keeping a backup earlier, your character just ceases to exist. So let's fix that, shall we? (sidenote: I totally get why some recipes have those three-page essays in front of them now. stories are fun.) You will need: A hex editor. I use Hex Workshop, which is currently free and, as far as I can tell, virus-free. If you're using Hex Workshop, you can download this character filter for it, which lets you read the hexadecimal garble as plaintext on the right side. Also, give the guy some love. To install it, put the .map file in your C:\Program Files\BreakPoint Software\Hex Workshop\CharMaps folder. If you're using another hex editor, you can see what hex values correspond to each letter here. Just CTRL+F for "Finding Pokemon". A clean Pokemon Emerald ROM that hasn't been hex-edited with the guide at the top. I trust that you have a legitimate copy of the game that you used a ROM-ripper on, and didn't pirate it you cheaty cheater mccheaterson. PKHex, a save file editing program. Since part of your data definitely got deleted, be it your Bag, your Party, or a PC Box, you'll probably need to use this to get it/them back. New Super Ultimate Injector for 3DS. Basically, better UGBAVCI. Unfortunately, it only comes in not-English, so I'll give the instructions for generating a CIA with it as well. (And please give the creator some love; the non-English programming community doesn't get nearly enough respect, and this is an awesome tool for the community.) (And yes, it is also virus-free.) Steps to Make a 128kb CIA: Open New Super Ultimate Injector for 3DS. It's in Spanish, I know. Just bear with me here. (EDIT: Turns out you can go to "Herramientas" > "Opciones" and change the language there. Set "Idioma" to "English" and click "Guardar" in the bottom right, then click "Yes" in the popup to restart the program in English.) At the upper-left corner, click "Archivo", then select "Nuevo" > "CIA de Game Boy Advance". (AKA File > New > Game Boy Advance CIA) A new tab will open in the program. Right-click the name of the new tab, then select "Cargar ROM...". (AKA "Load ROM...") Navigate to the .gba file you definitely got through legitimate means, and click "Open". (AKA "Open") Since this ROM wasn't hex-edited, pretty much all of the data should autofill. All you need to do is set the icon and 3D banner images for the home screen. "Descargar" means "download", "desde" means "from". You should be able to figure out what the rest means. Also, you can click the "Virtual Console" nameplate thing to change the text displayed there. Once you have it customized to your liking, right-click the tab again, click "Guardar" to save the project, then click "Exportar CIA..." to get your CIA file. (AKA "Save" and "Export CIA".) After we finish with the save-editing stuff, put the CIA on your micro SD card and use FBI to install it. Steps to Fix the Save: Follow this guide to dump your Emerald save using GodMode9, and open it in the hex editor of your choice. If you're using Hex Workshop, click the dropdown near the top that says "Legacy ASCII" and select "Pokemon FireRed". Scroll to the end of the file, click the blank value at the very very end, and add 65,536 bytes with the value "00". In Hex Workshop, you can right click and select "Insert". This is to make the file 128kb long. Go to offset 0x0FFC (search bar at the top middle in Hex Workshop) and copy that byte and the byte after it. (Each byte is two numbers, e.g. 00 or B2.) This is your save index, AKA the number of times you've saved the game, which is how the game distinguishes between "main" and "backup" saves. Paste those two bytes you just copied into offsets 0xBFFC and 0xCFFC. Go to offset 0xC000, and replace the data from there to 0xC0B4 with 00. Basically just the whole block until you hit the next wall of 00s. Don't use "delete" on the data, since that will straight-up delete the bytes from existence instead of zeroing them out. If you're in Hex Workshop, you can highlight all of them, right-click, select "Fill", and fill it with "0". Otherwise, you just have to type the zeroes by hand. If you're using the character filter I mentioned before, you should be seeing some familiar names here. This is the hall of fame data, just in the wrong place in the file. Go to offset 0xBFF4 and remember the number it holds. Add 1 to that number and put it in offset 0xCFF4. Then replace the next two bytes with 00. For the addition: 01 would become 02, 09 would become 0A, 0A would become 0B, and specifically 0D would become 00. Now, the number you just wrote down is the ID of the section that got overwritten. GBA save data is stored in chunks, and depending on which chunk got overwritten, you'll have to do different things to recover it. NOTE: All but 02 are just theories right now. I'm currently working on testing each individual case. If the overwritten section was 01: Your team, bag, and Pokedex data has been deleted. Use PKHex to recover them, and you should probably be good? I'm working on testing this case right now. I'd recommend against loading the save file with no Pokemon. NOTE: No one's 100% sure how the Pokedex part works. It's apparently stored in multiple places, so there's a chance the save won't load if everything doesn't match. I'm working on this one right now. 02: This section stores the game flags, including gym badges, event triggers, and berry trees. This is probably the easiest part of the core data to resolve, since everyone's at the same point in the story here. Highlight everything from offset 0xBFFD to 0xCFF7 inclusive (meaning including those offsets, not just the stuff in-between) and paste the following over it. (NOTE: Make sure not to insert.) Spoiler 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C7CC07EC59CCBEBAB9C1E0DFFFFF82A0FB6F8C855F20E5253DA7D3FBBF03000043D1BDDD6F8EEFEF7ECAFF0300003FE0F8030000E08901817A4021CE2720C800500100000000000000000000005000A07DB9FE77BFEF6F3F1D7EFCF8FFFD6FF9FDCEACD9FFEFFEE1A5DF36EC0F00FDFEEF08FB83BBF9E70476977F407FD187FF7F7C1F96F27C0B43010000000000000000000000FF00FCFFFFFFFF30380287C70FDE1D3C5C800F8107ACD34988E01F7E78870F1FF842E0FF0FC3307800C1FFF0FF81C31082870AC177811F0E1CB0940BA01D1A3CE10083000E1C0E83C1FEDFFF387FF83FBC0985FF0141FE42F0FFFFEFD19B890FBFFF000000000C00000000000000D7FFFFFF000027FCFF0C90CC090080101400000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000006900640000006A000000000000000000000000000000000000000000000000000000000000000200587A94D900000500C60200003100000000000000000006000000000000000000000000000100000000000000000000000000000000000000FC188025250000000200000000000080540104000000FE0CD571000000000080040001000000020000000000000005000200000008000000000003000600000003000000000002000000000000000000000001000000000000000000000002000000010001000000010000000000000000000000000002000000000000000000000000000300000005000700000000000000000000000000030004000200010001000000070000000000010000000000010000000600000000000000020003000200000001000000000001000000050000000000000002000200000000000000000000000000020000000000000000000000020002000000000000000200010000000000FB18010000000000020002000200010003000300010002000000030000000A000300010000000000000001000100000002000000000000000000000000000000000000000000000000008B000000000000000000000000000000000000000000FA000A00FA000000FA000000000000000000000000000000000000009406ABCAF9018ECAD306ABCAD306ABCAD106ABCA0FD5ABCAD706ABCA7405ABCA8C04ABCA9B07ABCAD206ABCAF806ABCACC06ABCAD306ABCAD806ABCA8E06ABCAD206ABCAD206ABCAC006ABCAC806ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD206ABCAD306ABCAD306ABCAD306ABCAD606ABCAD306ABCAD306ABCAD306ABCAD306ABCAE006ABCADB06ABCAC106ABCAD206ABCAD206ABCA4006ABCAD706ABCAD206ABCAD306ABCAD206ABCAD106ABCAD206ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCAD306ABCA00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000585D002020000000585D002020000000585D00202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120321000007000012032100000700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008026400000500001685D002020000001685D002020000001685D00202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000802640000050000080264000005000000000000000000000000000000000000000000000000000024858016010000001885D002020000001885D0020200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002002021 After you've done this, you'll want to open up this save file in in PKHex and change them back to however they were. For example, if you haven't caught Rayquaza yet, you can edit the flag for that in PKHex. You can get your hard-earned berries back that way too. 03/04: I can't find any info on these sections, so if someone could help that would be awesome. 05-0C: You lost a PC box. Use PKHex to recover your missing Pokemon. 0D: You lost a PC box too, but you also lost your box names and wallpapers, so there's one more step before using PKHex here. Highlight everything from offset 0xBFFD to 0xCFFA inclusive and replace it with the following: Spoiler 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000BCC9D2A2FF00000000BCC9D2A3FF00000000BCC9D2A4FF00000000BCC9D2A5FF00000000BCC9D2A6FF00000000BCC9D2A7FF00000000BCC9D2A8FF00000000BCC9D2A9FF00000000BCC9D2AAFF00000000BCC9D2A2A1FF000000BCC9D2A2A2FF000000BCC9D2A2A3FF000000BCC9D2A2A4FF000000BCC9D2A2A5FF000000000102030001020300010203000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000D0031F125200108 00: This is, or was, your trainer data. There's a lot of stuff in the game's code that ensures that we can't just paste in someone else's, so we need to make a new save file and copy all of our old data to this new one. NOTE: All of my attempts ended up in the G L I T C H Z O N E, so you'll probably have to do research yourself to get this to work. Steps: Load up the 128kb VC game we just created and create a new file. Play until you can save, save once, then close the game. Export the save file using GM9 and load it up in a hex editor alongside your broken save file. You'll need to identify the save data blocks in the old save by their footers, and copy them over to the new one accordingly. See the "File Structure Info" section for more details. After you're done patching your save file, follow the steps in the second half of the save-dumping guide to inject your save back into the CIA, and you're good to go! File Structure Info: GBA saves are divided into 13 sections, 00 to 0D, each one with its own section ID. The sections are stored in the file in order, but the file doesn't necessarily have to start with section 00 and end with section 0D. For instance, it could start with section 04, then halfway through the file reach the end of section 0D, and then the rest of the file would be sections 00 to 03. Basically, it's a loop, but thankfully the sections are still in order. Each Section is identified by a footer, not a header. The footer format is ID ## ## ## 25 20 01 08 SAVEINDEX. After the save index, there is a 00 00 00 separating sequential sections. This does not apply to the second save file when there isn't a second save file. The three 00 bytes are FF when there's only one save present in the file. In order for your save file to validate, the save index needs to be the same across the board. That means if we copy-paste a block of sections, we have to go back over it and make sure all of the save indices are the same. keywords for time travelers: pokemon ruby and sapphire, pokemon generation 3, save corruption, elite four, save corrupted after beating elite four, save corrupted after beating champion, pokemon emerald, gen 3 save, 3ds, virtual console, save deleted after beating game Edited February 10 by ABadHaiku Added english instructions and instructions for people to reinject the save afterwards, as well as a warning not to delete the old CIA before dumping the save. Also reorganized and added more details, and fixed a typo giving the wrong addresses. Link to comment Share on other sites More sharing options...
theSLAYER Posted November 8, 2020 Share Posted November 8, 2020 41 minutes ago, ABadHaiku said: @theSLAYER Do you have any information you can add to help future internet time travelers? Sadly no, because I'm not interested in GBA Pokemon injected into VC. Link to comment Share on other sites More sharing options...
ABadHaiku Posted November 8, 2020 Share Posted November 8, 2020 Just now, theSLAYER said: Sadly no, because I'm not interested in GBA Pokemon injected into VC. I just meant about the save file format and how/where info is stored, since you're a PKHex dood. Main thing I need to know is the locations where the Pokedex data is stored in the save, since if all parts of it don't match the save won't load. Link to comment Share on other sites More sharing options...
theSLAYER Posted November 8, 2020 Share Posted November 8, 2020 I'm unsure how the VC injected GBA Pokemon saves would be different from proper GBA saves, but I would think there's some offset differences, hence why people have issues with it. If we're just talking about Gen 3 saves in general, I think the relevant offsets have already been documented:https://bulbapedia.bulbagarden.net/wiki/Save_data_structure_in_Generation_III#Data Link to comment Share on other sites More sharing options...
ABadHaiku Posted November 8, 2020 Share Posted November 8, 2020 (edited) 8 minutes ago, theSLAYER said: I'm unsure how the VC injected GBA Pokemon saves would be different from proper GBA saves, but I would think there's some offset differences, hence why people have issues with it. If we're just talking about Gen 3 saves in general, I think the relevant offsets have already been documented:https://bulbapedia.bulbagarden.net/wiki/Save_data_structure_in_Generation_III#Data Nope, no offset differences at all. They're exactly the same as regular GBA saves. Only problem is that not every offset is documented in that page (which I've been staring at for 8 hours straight), especially including the Pokedex-related offsets, which need to match for two of these cases or else everything breaks. Also, there's almost no information whatsoever on section 2/3/4, but that data can be edited in PKHex, so I know someone here has to have that info. Edited November 8, 2020 by ABadHaiku Link to comment Share on other sites More sharing options...
ABadHaiku Posted February 10 Share Posted February 10 (edited) yo shoutouts to myself from 3 years ago for helping me repair my firered save too LOL EDIT: Also, apparently I was stupid and didn't see the English option on NSUI. I wonder why it defaults to Spanish? Edited February 10 by ABadHaiku 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now