profi200 / open_agb_firm

open_agb_firm is a bare metal app for running GBA homebrew/games using the 3DS builtin GBA hardware.
GNU General Public License v3.0
860 stars 42 forks source link

Games with no save type lead to a white screen #48

Closed thomas1013 closed 2 years ago

thomas1013 commented 2 years ago

With the last release, when I launch a game with no save type (ie: Finding Nemo, Britney's Dance Beat...), it leads to a white screen and I can't play. I have to either disable gba_db.bin or mess with bool saveOverride true and then select another random save type which is not 15.

profi200 commented 2 years ago

I will look into it later. Which no-intro release numbers are these?

thomas1013 commented 2 years ago

The no-intro release numbers for Finding Nemo & Britney's Dance Beat are respectively 2664 & 0460.

But actually, this issue happens with every game which has the save type defined as 'None (15)' in the gba_db.bin file. When I select another save type with bool saveOverride true it works. Maybe the easiest way to solve this is to remove these games entries in the bin file and let the autodetect do its trick (it detects them as 'SRAM 256k (14)')?

I also tried to select the 'None (15)' save type on other games which have a save type to see if it would crash too, and it did for most games.

profi200 commented 2 years ago

The entry for 0460 is identical between my db and the one from the current release. So it's either buggy binary search (doubt it) or the entries in the db are not ordered correctly.

@HTV04 ^

HTV04 commented 2 years ago

If it was an issue with the way the DB entries are ordered, then the saveOverride method would have worked, but thomas1013 noted that setting the save type to "None" causes the games they tested to hang.

@thomas1013: Are there any other games you tested that hang at a white screen? The games I tested that don't have a save type work fine for me, so these games may be looking for an SRAM even though they don't need it.

mikedee397 commented 2 years ago

I noticed some games boot to a white screen. Depending on name and possibly location of the file, it will either boot correctly or go to a white screen.

Example of game that goes to white screen: /gba/1 USA - P-S/Sega Arcade Gallery (USA).gba

Same file boots correctly from here: /roms/gba/1000-2000/1877 - Sega Arcade Gallery (U).gba

The files are identical with binary compare. Not sure if there is something else in the folder that could trigger this issue.

HTV04 commented 2 years ago

What happens if you remove the spaces in the first folder name? Looks like this might be causing an issue.

mikedee397 commented 2 years ago

Removing the spaces doesn't seem to help, still goes to white screen. I also tried just moving the file to the root folder and it also went to a white screen.

HTV04 commented 2 years ago

If you move the file stored in the other folder to the root of your SD, does it also hang at a white screen?

mikedee397 commented 2 years ago

I just realized what's going on here. It boots because there is a 64kb .sav file in the working folder. It must have been created by an older build of open_agb_firm. When that file is present, the game works. When the file isn't there, the game goes to a white screen.

HTV04 commented 2 years ago

Interesting. And it works when the save type is set to none?

profi200 commented 2 years ago

That doesn't sound right. I smell SD card fs corruption. Or a weird bug with the database. When the save type is truly set to none it doesn't matter if a save file exists.

mikedee397 commented 2 years ago

I have tried 3 SD cards now and get the same result. I also have the older open_agb_firm from Dec. 2020 on the same SD card now, when I boot that firm then the game will start correctly. I really think my SD cards are fine. I've also tested on multiple 3DS systems.

Now that I've tested more games it seems to happen with every game that has no save type. I've tried Iridion, Pac-Man Collection and Rampage Puzzle Attack too.

I now edited the ini to bool saveOverride = true and can play these games by selecting a different save type.

thomas1013 commented 2 years ago

If it was an issue with the way the DB entries are ordered, then the saveOverride method would have worked, but thomas1013 noted that setting the save type to "None" causes the games they tested to hang.

@thomas1013: Are there any other games you tested that hang at a white screen? The games I tested that don't have a save type work fine for me, so these games may be looking for an SRAM even though they don't need it.

To answer to your question @HTV04, yes, I tried with several games with no save type : Finding Nemo, Britney's Dance Beat, Monsters Inc., Barbie and the Magic of Pegasus and The Incredibles (yes I love shitty license games haha). They all hung to a white screen.

For games with a save type + bool saveOverride true + setting the save type as 'None' for testing purposes, these are the games which all hung to a white screen: Wario Land 4, Super Mario Advance 2, Shrek 2, The Sims Bustin Out, Pokémon Emerald & Mother 3. F-Zero GP Legend, Kurukuru Kururin, Kururin Paradise, Lizzie McGuire 3 & Pokémon Pinball worked without issues. Super Mario Advance 4 (Wii-U version) launched but displayed a 'Save corrupted' error. Mary-Kate & Ashley - Girls Night Out displayed the BIOS intro but then crashed.

I confirm @mikedee397's last reply.

profi200 commented 2 years ago

Comparing to games that do require save hardware to work correctly isn't very useful when setting their save type to none. That said i'm going to run a few tests and see what is happening.

profi200 commented 2 years ago

Test ROM: "de0e0152d55666b29cd2d414761852b7ae7645189a0db7c5e920ecb331c9eb82 1853 - SEGA Arcade Gallery (USA).gba"

2 GB SD card on an o3DS.

Debug build: With the 2 file paths given in https://github.com/profi200/open_agb_firm/issues/48#issuecomment-987214653 both copies of the game boot fine. The initial copyright screen takes a bit until it vanishes.

Release build: Both hang on white screen.

I'm not sure what's the cause but i think it's link time optimization (LTO) related. Not sure why or how it causes issues here.

Edit: Could not pinpoint the issue yet. I tried building ARM11 code as debug and ARM9 as release which still showed the issue so it's probably ARM9 related. I at least got the correct hash on database lookup and save type is also none.