GBARunner2 icon indicating copy to clipboard operation
GBARunner2 copied to clipboard

I can't save game in Golden Sun: The Lost Age (Spanish)

Open GoldTr opened this issue 5 years ago • 22 comments

When I save the game, the game crashes.

GoldTr avatar May 02 '20 09:05 GoldTr

Yes, this is a known issue. If you look at the compatibility list you'll find a version you might be able to use: https://wiki.gbatemp.net/wiki/GBARunner2

zenseii avatar May 02 '20 11:05 zenseii

Yes, this is a known issue. If you look at the compatibility list you'll find a version you might be able to use: https://wiki.gbatemp.net/wiki/GBARunner2

Downloaded as prompted:a903967 (03-06-2019).zip It is still invalid, I think this guide can be modified to not save

Dsseed avatar May 22 '20 01:05 Dsseed

Interesting. I'll have to check myself. Did you sram patch your rom with gbata?

zenseii avatar May 22 '20 03:05 zenseii

Interesting. I'll have to check myself. Did you sram patch your rom with gbata?

Of course, I have tried N methods for this game, and all ended in failure.

Dsseed avatar May 27 '20 03:05 Dsseed

I actually CAN save in GS:TLA using version 03-06-2019 and a sram-patched FR rom.

I used ezgba for sram patching, and I'm running on an old first version DS with twilight menu.

However, with this version, there are some lags in battle animations and some sound effects are missing. Nothing game breaking, but that'd still be nice if the save bug could be fixed on the latest versions.

jbellionjourdan avatar Jul 25 '21 08:07 jbellionjourdan

I actually CAN save in GS:TLA using version 03-06-2019 and a sram-patched FR rom.

I used ezgba for sram patching, and I'm running on an old first version DS with twilight menu.

However, with this version, there are some lags in battle animations and some sound effects are missing. Nothing game breaking, but that'd still be nice if the save bug could be fixed on the latest versions.

That's great! Have you tried this same patched rom with any more recent builds found here on github? What flash card are you using?

zenseii avatar Jul 25 '21 09:07 zenseii

I actually CAN save in GS:TLA using version 03-06-2019 and a sram-patched FR rom. I used ezgba for sram patching, and I'm running on an old first version DS with twilight menu. However, with this version, there are some lags in battle animations and some sound effects are missing. Nothing game breaking, but that'd still be nice if the save bug could be fixed on the latest versions.

That's great! Have you tried this same patched rom with any more recent builds found here on github? What flash card are you using?

Tried with the latest build with that same rom. Lags and SFX issues are gone with these builds, but I still can't save.

I'm using an R4i-sdhc card, with a custom menu (not sure which one) because gbarunner doesn't start on the R4i default firmware.

jbellionjourdan avatar Jul 25 '21 10:07 jbellionjourdan

I see. Thanks for taking the time to test and report. If you don't mind it would be of help if you could see at what version this saving stopped working. For example if you could see if the version released right after this is not able to save with the game then that would pin point it to a change between these two builds. Also you might need to check the successive build in the sd save branch if that is indeed the branch that the 2019/06/03 is from. I don't remember if it is.

Also if you could provide the checksum of your French GS:TLA before applying the patch then that would help too.

zenseii avatar Jul 25 '21 11:07 zenseii

Could try and do that yeah. Might even be able to submit a PR if the change is minor. Haven't looked into C code for a long time but I could try.

jbellionjourdan avatar Jul 25 '21 12:07 jbellionjourdan

I could determine, making local builds, that the breaking change seems to happen between commits be606cd0 and 6fd8f460.

In the first one save works, in the second it doesn't.

I'll try digging further into the diff, but as i said i'm really not familiar with C++ and the NDS devkit.

jbellionjourdan avatar Jul 25 '21 16:07 jbellionjourdan

Well, i have a serious lead but i can't dig it because for some unknown reason, i can't make a local build of the latest master version.

I end up with a black screen with only the blue ribbon instead of the file browser... :/

EDIT: Managed to make a build, now i need to find a way to print some logs anywhere to debug the code. Some help would be appreciated :)

jbellionjourdan avatar Jul 25 '21 17:07 jbellionjourdan

@jbellionjourdan That's great! Unfortunately I'm not able to help you with that, and unless Gericom is available you might need to ask from others who have experience working with gbarunner2 either on the ds(i) hacking discord or those who have sent PR already. @unresolvedsymbol has made his own fork of gbarunner2 and might be able to help you out too: https://github.com/unresolvedsymbol/GBARunner2-DSL-Enhanced

A link to the discord server can be found on twilightmenu++'s github page .

zenseii avatar Jul 25 '21 17:07 zenseii

Well, this was in the end a false lead.

It at least allowed me to identify a way to improve my sram-patched rom in order to make it work with the latest build, by making the file compatible with GBARunner's save type detection.

So... Personally i fixed my issue and will be able to enjoy a nice GS:TLA playthrough. But i won't be able to contribute to the project :/

jbellionjourdan avatar Jul 25 '21 19:07 jbellionjourdan

@jbellionjourdan Well at least you found a solution to make it work on the latest build. It would be nice if you could share the steps you did in order for the rom to work so that others can play this on the latest build. This might even work as a solution for the other couple of roms that currently have issues saving.

zenseii avatar Jul 25 '21 20:07 zenseii

What i did is :

  1. Patch rom using ezgba
  2. Open patched file with a text editor to display its content as hexadecimal (i used sublime text)
  3. My editor formats the hex data with a space every 4 characters. These spaces will be annoying for next step, strip them away with a search-and-replace (can be long, the editor doesn't like search-and-replace on a file several Mo large)
  4. Search string 464c4153485f563132330000. This string is the hex representation of FLASH_V123 which is the original save type of an unpatched GS:TLA rom.
  5. Replace it with 5352414d5f465f5631303000 which is the hex representation of SRAM_F_V100 (which is our new save type, since we patched the rom to make it save that way).
  6. Save file, enjoy.

This allows the latest GBARunner2 builds to detect that we patched the rom to use SRAM save type.

jbellionjourdan avatar Jul 25 '21 20:07 jbellionjourdan

Well, after some hours of gameplay it suddenly stooped working.

I can't get why, even after restoring a .sav file at an earlier point where it worked before.

Looks like the behavior is completely random, so forget this solution.

jbellionjourdan avatar Jul 26 '21 17:07 jbellionjourdan

In the end I managed to make the above patch work, but it required patching gbarunner executable too.

jbellionjourdan avatar Jul 28 '21 16:07 jbellionjourdan

@jbellionjourdan Could you please explain how you accomplished this? I could add it to the compatibility list for others to follow at least.

zenseii avatar Jul 28 '21 20:07 zenseii

In the arm9/source/save/Save.vram.cpp file where the different save types are defined, the save type SRAM_F_V100 that we patched into our rom is defined to expect 32kB save files.

Whereas, GS:TLA creates 64kB save files (because its original save type is FLASH_V123). So, even if we patched it to behave like an SRAM-saving game, it still generates 64kB files.

So, I changed the SRAM save type definition from 32kB to 64kB, which allowed me to build an executable that works for my patched GS:TLA rom.

This is not a solution everyone could use, since it requires being able to build your own patched executable (which would probably be different for each and every target game...). This means installing the nds sdk and understanding how to build a cpp app.

jbellionjourdan avatar Jul 29 '21 08:07 jbellionjourdan

I see and I agree that this would not be expected of the common user to do. At least you have tracked down what the porblem with saving for this game is and hopefully we'll see a fix implemented someday. Thank you for looking this much into it! I figure the specific build you made only works for the French rom right now or is it region aspecific?

zenseii avatar Jul 29 '21 08:07 zenseii

Well, I didn't exactly track down the real problem to make the save work with an unpatched rom...

Just a workaround to make a doubly-patched rom (sram patch, then manual patch detailed above) work.

The fix probably isn't region-specific, although I haven't tested it with any other region rom.

I'll see if I can make my patched executable available for download on my fork of the repo.

jbellionjourdan avatar Jul 29 '21 09:07 jbellionjourdan