Dwedit's Board

Enjoy the board

You are not logged in.

Announcement

User passwords may have been corrupted, if you can't log in, use the "Forgot Password" feature. If you still can't log in, contact me and I can try to manually reset your password.

#1 2015-03-03 1:27:30 pm

apoptygma
Member
Registered: 2015-02-26
Posts: 21

Games select list showing duplicate entry

I've noticed a handful of roms which exhibit this behaviour, I've approx 30 titles, each with it's own goomba instance,  about 4 behave like this. What happens is I launch the uniquely titled goomba, for example "Talespin (USA).gba" which is simply goomba copied with the rom and a rom select menu/list appears with tailspin listed twice. The top entry gives a live preview and the second a black screen. Launching the second entry simply blacks the screen (l+r menu still works). I've tried both using a frontend and manually copying the rom and goomba together and I've also tried different versions of the goomba emulator. Another game which did this was adams family, whereas some games like donkey kong are fine and auto-launch without showing this second null menu item.

Offline

#2 2015-03-03 1:56:31 pm

apoptygma
Member
Registered: 2015-02-26
Posts: 21

Re: Games select list showing duplicate entry

I'm doing some testing at the moment with visualboy advance as I don't have access to my GBA SP & EZ flash IV and the issue doesn't seem to exist inside a windows emulator which is even stranger. I should also mention I wasn't using the EZ patcher/client as the games were saving fine without it.

Last edited by apoptygma (2015-03-03 1:57:11 pm)

Offline

#3 2015-03-03 2:44:12 pm

Dwedit
Administrator
From: Chicago
Registered: 2004-12-12
Posts: 1,023
Website

Re: Games select list showing duplicate entry

It detects ROMs by looking for the bytes CE ED 66 66 at address 0x148 of the ROM file.  If there was old uninitialized data still sitting in RAM with those values, it would see that as another ROM.  Putting 512 bytes of zeroes or FFs at the end of a file would suppress it too, but maybe I need to double-check the detector.


"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

#4 2015-03-03 4:02:45 pm

apoptygma
Member
Registered: 2015-02-26
Posts: 21

Re: Games select list showing duplicate entry

Try as I may I cannot replicate this on an emulator (I have tried both visualboy and no$gba) those both go straight into the game with the same rom as the one which the EZ flash/GBA SP will present the menu described.
Using the frontend to create a new test rom , doesn't let me add the same rom twice and doing "copy goomba.gba + talespin.gb + talespin.gb test.gba" produces an unreadable rom (emulator doesn't load the rom) so I wasn't able to intentionally add the same rom twice to observe the behavior there.

Is the detector in the boot.s file? I had a look through and didn't see any checks at the 0x148 address there. Do you typically do most of your testing in emulators, this could realistically be an issue with either the actual GBA hardware or the EZ flash cartridge mangling something, I don't really have the means to isolate one or the other.

I'll do some more testing on the hardware and see if I can isolate a cause, I don't think old data in ram is the issue as I've done all my testing on cold boots of the hardware. What I can try and do as well is provide you with two copies of the same title, one which exhibits the behavior and one that does not (using the same rom) I'd obviously have to do that through other channels however.

edit- found the test in main.c there line 248, will try and work backwards and see if i can provide any more helpful info. In a pinch I could just change line 253 to roms=1; and recompile but it's probably more helpful to resolve the issue. I couldn't find anyone else posting about this problem so I'm leaning toward the EZ flash IV introducing some issues, As I said though I've not used their patcher (I assume goomba has no issues with 64k saves in the current builds?)

Last edited by apoptygma (2015-03-03 4:17:43 pm)

Offline

#5 2015-03-03 4:19:15 pm

Dwedit
Administrator
From: Chicago
Registered: 2004-12-12
Posts: 1,023
Website

Re: Games select list showing duplicate entry

The EZ flash cartridge simply stops loading stuff into RAM once it has loaded the whole GBA file, so you get uninitialized data past the end of that.  Goomba Color is looking through that memory anyway, because it has no way of knowing how big the GBA ROM file is.


"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

#6 2015-03-03 4:28:37 pm

apoptygma
Member
Registered: 2015-02-26
Posts: 21

Re: Games select list showing duplicate entry

You think the detection might be getting a false positive from the uninitialized data? Also, going out on a limb here but would the EZ flash's own loader still be in memory and be matching a pattern there somehow?

Offline

#7 2015-03-03 5:15:45 pm

apoptygma
Member
Registered: 2015-02-26
Posts: 21

Re: Games select list showing duplicate entry

I had a look at one of these examples (goomba 3_31_2008 with Talespin, md5 26C65DA146FAA09505C554447792E493)  and I'm seeing the CE ED 66 66 at 3 offsets,

00001580
0000E710
0001C440

The same goomba.gba file without the appended rom (ending at and ends at 00012870) lists this value once at

000009E0

and the individual rom without any modification lists the value once at

00000100

so it looks like something went wrong during the build (I believe I used the front end at the time)

I've since tried to re-build the same file with the frontend using the same two files and come up with another combo which has the value in two locations (correct)

000009E0
00012980

looks like something went wrong with the front end (1.8 by newbie) causing a null entry to be written, for some bizarre reason these same 'broken' built roms load fine in a windows emulator (as in, don't show the menu) but on the actual hardware you get a false entry which either hangs the system or goes to a black screen.
of interest is that visualboy throws an error "Unsupported BIOS function 0d called from 08116cc." but continues to load the rom (without the goomba rom select prompt, l+r still work)
I've a vague memory that 'goomba front' showed a blank entry on the right-side list in addition to the single rom I was adding at the time but have not been able to replicate the error

Offline

#8 2015-03-03 6:55:11 pm

Dwedit
Administrator
From: Chicago
Registered: 2004-12-12
Posts: 1,023
Website

Re: Games select list showing duplicate entry

Bios Function 0D is just calling GetBiosChecksum to see whether it's running on a GBA or a DS.  Or if you have no BIOS file loaded, it says you're running it on "crap", or if you have the really old (buggy) leaked BIOS taken from a prototype GBA, "prot".

When I say RAM, I'm referring to the 32MB of RAM in the cartridge, not in the system.  The loader might not be there, but pieces of loaded games might be.

It only looks for CE ED 66 66 (first 4 bytes of the Nintendo logo image) in one place, which is at address 0x104 of a ROM file, so stray occurrences won't affect anything.  It uses size information inside the ROM file to tell how big the ROM is, and where the next ROM begins, so it will only be looking for those bytes after the end of the first ROM.  Maybe I could put in a check for the next 4 bytes as well, so it would look for CE ED 66 66 CC 0D 00 0B.  But chances are good that if there were stray bytes from one thing, they'd still be there for more.


"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

#9 2015-03-03 7:45:42 pm

apoptygma
Member
Registered: 2015-02-26
Posts: 21

Re: Games select list showing duplicate entry

Oh, damn I thought I'd solved it there.
Let me try and understand this again, Goobma only begins scanning the memory at the end of it's own code (00012870) and looks for CE ED 66 66 at 0x104, checks the rom length from the header then starts another scan from the new 'end' of the file (12870+rom1's length). So another explanation may be that the length data in the rom was corrupt?

Still haven't got to testing on the hardware again, I completely understand what you mean about searching for the next 4 bytes being redundant. You'd still get the same issue (if it is even a fault it is, which I don't think it is at this point)

I can see what you mean about the SRAM on the cartridge not being cleared, will make sure I load a (large) GBA rom to clear it between tests too.

Last edited by apoptygma (2015-03-03 7:59:31 pm)

Offline

#10 2015-03-04 1:07:25 am

apoptygma
Member
Registered: 2015-02-26
Posts: 21

Re: Games select list showing duplicate entry

Done some more testing now, re-created all the roms with a batch file which was simply

for %%F in (*.gb) do copy /b /y goomba.gba + "%%F" "%%~nF.gba"

about 1/2 of the titles exhibit this behavior on real hardware but work fine on emulators (on windows)

Have tried loading a 16mb GBA rom before to ensure the RAM is clear, have hex edited each which does this and checked for extra instances of the header string and found none (just the two which should exist at 000009E0 and 00012980

I'm out of ideas now, definitly something super weird going on here. I don't know if you have a flash cart yourself for testing and have come across this or if you only test on emulators but something isn't working as it should.

Offline

#11 2015-03-04 5:55:54 am

Dwedit
Administrator
From: Chicago
Registered: 2004-12-12
Posts: 1,023
Website

Re: Games select list showing duplicate entry

No no, not the SRAM, The huge RAM that the EZ4 uses to store GBA cartridge roms before it executes them.  It will have remnants of whatever was last loaded.  So if you had Goomba Color loaded with two roms, one 128K in size, then anything else, it would probably think the second rom was still there.  Putting 264 bytes of zeroes at the end of a Goomba build will force it to not have anything past the end.


"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

#12 2015-03-04 3:57:52 pm

apoptygma
Member
Registered: 2015-02-26
Posts: 21

Re: Games select list showing duplicate entry

Sorry, yes thats the memory i meant. I thought it was referred to as SRAM. That should be cleared on power loss though. I believe only the NOR is persistent and I've not used that in testing. I'll have to have another look at the code but Ichad a theory it was something to do with the case that's in there if no roms are found, possible length errors in the rom header and the loop running once more than it should, increasing the count to 2 for i (i think i was your variable for rom count  from memory). I probably need to be trying to determine what the common factor is with all the roms that have this problem too.

Offline

#13 2015-03-04 6:09:34 pm

apoptygma
Member
Registered: 2015-02-26
Posts: 21

Re: Games select list showing duplicate entry

Just letting you (and any others with this issue) know the 264 bytes trick works, what i've done is built an empty 264 byte file and incorporated it into the batch script as a workaround. I could have removed the check and just set the rom count to 1 but either way, it works :)

Offline

#14 2015-03-11 8:35:49 pm

kuwanger
Guest

Re: Games select list showing duplicate entry

Yea, I found about this bug ages ago: ezflash.sosuke.com/viewtopic.php?p=64326#p64326  .  It's an EZ4 quirk.

#15 2015-03-11 8:59:58 pm

Dwedit
Administrator
From: Chicago
Registered: 2004-12-12
Posts: 1,023
Website

Re: Games select list showing duplicate entry

Thanks, kuwanger.


"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

#16 2015-03-15 2:28:35 am

apoptygma
Member
Registered: 2015-02-26
Posts: 21

Re: Games select list showing duplicate entry

Well, there you go. Very happy with the emu since btw. Thanks again dwedit for you excellent work on this project.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] CCBot

Board footer

Powered by FluxBB
Modified by Visman