Hacking TempGBA: NDSGBA revival

Do GBA games make your nono parts happy?


  • Total voters
    429
Ah ok that's good to hear, I was worried that you weren't paging(is why the only 32mb rom didn't work). I'm going to work on trying other ones, I haven't noticed any issues with it(load times) except the initial loading(it's the same whether or not the rom is zipped or not), anyway that's good to hear that you added support for paging to it. When the gcw comes out, I hope the guy who ported gpsp originally to it, can work with you to up the rom cache to ~33-35mb since it has a ton of memory and also might as well. Also with 1.42 or whatever it is now, the game runs at ~60fps consistently even at 240mhz w/ sound(i don't play with sound on but I tested it) so it's definitely gotten a lot lot better.

I may try out your snse emulator sometime soon too. One question about that one, is it only snes or is it like other snes emulators in the fact that it can support nes games to? I also imagine that it supports zipped roms too?

P.S. the reason why I have zipped ones is that I use advzip -4, then deflopt, then huffmix, for all of my roms(except my nds ones I dumped ) they're lzma2 since the nds doesn't support zipped ones. But anyway yeah, keep up the amazing work, I've used that rewind thing a _ton_... I hate to admit it but I use it to cheat when I press the wrong button, or when I don't press the buttons just right in mario&luigi...
a) Thanks... I guess. [Paging support was not mine, it was Exophase's. It kept working through my changes.]

b) Yeah, large code caches would be great, except that there's just one game that would use so much code cache, and it's Payback.

c) The SNES emulator emulates the SNES. Any follow-ups to this question would be off-topic for the TempGBA thread, so please ask more on the CATSFC thread.
 
Hi,

Did some bulk testing (a few seconds of gameplay of each game) and stumbled upon the 'freezing' mentioned earlier in this thread (for the 1.42 release).
For me, the games that 'freezes', seems to work perfect after a restart of the dsTwo. The reason for the game 'freezing' in the first place seems to stem from the actual switch between them.

Does the previous game 'unload' completly when switching to a new one? Could some lingering memory allocations be the cause of the problem?

Keep up the excellent work Nebulon (and everybody else that have OR will contribute to this project)!

/dACE a.k.a. Nitendo
 
a) Thanks... I guess. [Paging support was not mine, it was Exophase's. It kept working through my changes.]

b) Yeah, large code caches would be great, except that there's just one game that would use so much code cache, and it's Payback.

c) The SNES emulator emulates the SNES. Any follow-ups to this question would be off-topic for the TempGBA thread, so please ask more on the CATSFC thread.
a)Well the paging support _wasn't_ in gpsp 0.9(the last version that was ever built) and even the other ones _never_ got it either. I'll ask in the catsfc thread, but anyway yeah. It _wasn't_ in 0.9 gpsp or gpsp kai(i think) or the other ones either. He said he was working on it but gave up before it was ever implemented(according to people whom I asked).
b) I was talking about the rom cache as in having the rom entirely in memory instead of having to page it into ram, and the larger code cache thing is something I didn't even think about.
 
Hi,

Did some bulk testing (a few seconds of gameplay of each game) and stumbled upon the 'freezing' mentioned earlier in this thread (for the 1.42 release).
For me, the games that 'freezes', seems to work perfect after a restart of the dsTwo. The reason for the game 'freezing' in the first place seems to stem from the actual switch between them.

Does the previous game 'unload' completly when switching to a new one? Could some lingering memory allocations be the cause of the problem?

Keep up the excellent work Nebulon (and everybody else that have OR will contribute to this project)!

/dACE a.k.a. Nitendo
Maybe what you say is true. I'll need to investigate the clearing of some memory when switching ROMs.
 
a)Well the paging support _wasn't_ in gpsp 0.9(the last version that was ever built) and even the other ones _never_ got it either. I'll ask in the catsfc thread, but anyway yeah. It _wasn't_ in 0.9 gpsp or gpsp kai(i think) or the other ones either. He said he was working on it but gave up before it was ever implemented(according to people whom I asked).
b) I was talking about the rom cache as in having the rom entirely in memory instead of having to page it into ram, and the larger code cache thing is something I didn't even think about.
a) Uh... Are you sure? O.o NDSGBA is derived from gpSP Kai, so if it came from anything, it would be gpSP Kai. Or gpSP.

b) Ah, of course having all that RAM in a GCW Zero means that you can load the ROM into RAM completely. That's a given, though :)
 
a) Uh... Are you sure? O.o NDSGBA is derived from gpSP Kai, so if it came from anything, it would be gpSP Kai. Or gpSP.

b) Ah, of course having all that RAM in a GCW Zero means that you can load the ROM into RAM completely. That's a given, though :)
a)It must've been kai, I remember that 32mb gba games didn't work with gpsp/kai. It'd just crash, unless it was a bug with the emulators themselves. Either way it's why koh:com just crashed and that's the _only_ 32mb I know of outside of dual game carts like spyro ice/flame(and that are actually 32mb _after_ trimming) and they'd _never_ work.

b) I never heard of the payback game before, I'll look for some videos on youtube anything that requires that much work has to be interesting(hopefully)

Edit: just looked at payback, holy mother of god, how the hell did they manage that with a GBA?! That's gotta be some insanely optimized code there. I mean I've heard of some 3d in gba games, but that one, it looks like an n64 era or maybe a bit beyond level of quality. Fuck... I want to play it now to just be amazed at how the hell they managed that.

edit 2: the thing is tiiiny. I can't believe that they are able to do all of that in that small of a space unless the thing is really really short.

edit 3: Mario vs Donkeykong _will not_ run at all with tempgba. I just tried the _same_ zipped file with vba-m and it runs/works just fine. I'm going to try to run it w/o it being zipped, it just does nothing And then the emulator goes nuts. I can't click 'debugging' it goes back to the "select a game" and it's just weird.

Edit 4: it runs just fine _if_ I extract it. The file name was mario_vs_donkeykong.gba.zip, when extracting it, it runs just fine. I don't know why it messed up, but since I couldn't access the debugging information I don't have any more info to help you. If you could add a hotkey to dump debugging info the sdcard maybe lr+start+select?
 
Guru meditation
Jump to unmapped address 016d016c at address 080728e6
the game has encountered and error ... I don't know where the data is/how to get it. This may be an issue with the game itself since as I said it didn't want to run before. But if there's anything there I'm willing to try ti. I wasn't using cheats(you said they don't work) I was just trying to rewind for 1s and it then crashed on me.
 
Guru meditation
Jump to unmapped address 016d016c at address 080728e6
the game has encountered and error ... I don't know where the data is/how to get it. This may be an issue with the game itself since as I said it didn't want to run before. But if there's anything there I'm willing to try ti. I wasn't using cheats(you said they don't work) I was just trying to rewind for 1s and it then crashed on me.
016d016c? I don't know at all what that one's trying to run... should be an open read, but it might be the BIOS.
 
016d016c? I don't know at all what that one's trying to run... should be an open read, but it might be the BIOS.
I'm going to try it again, I did have it setup to do the "gameboy player" since apparently the bios that I had gotten was the gb player bios and the colors looked a bit better, and since no other games had given me trouble. I'll try it again w/ the video mode as "gba" and if it still is throwing fits, I'll hunt down a gba stock bios.

Edit happened after a "drawing" for an item with probably a rng running, and then was about to "award" me an item, and since I hadn't yet saved, i don't believe there's even a save slot(yet). Like I said I'll try it again(to get up to that point) and if it's still there I'll go get a normal gba bios(even though nothing else has acted like it was any different)

Edit: the md5sum is the same as the "official" one so maybe I'm just a crazy person. either way I'm going to try it again and try to figure out what's going on here.

Edit again: OK I just played through _another_ level this time exactly the same, no issues at all. I'm going to try to replay through the first level again and see if I can get it to crash, because I'm confused as to how this thing crashed. Be back once more in a second.

edit final: OK replayed the level, got the same thing, went through the _same_ exact steps. Kept everyting the same and nothing happened. I did have some of the cheat files apparently on there(accidently copied when I did the nds ones to just toy around) so maybe them being there but not being enabled/touched did it? but either way I can't reproduce it so it's clearly nothing to worry about. I'll say it's a crazy one off thing.

edit I lied about final: I played through the entire first world, and each of the "bonus" stages and _no_ guru meditation, so I guess it was a one off. I've edited the wiki to reflect this.
 
Does the previous game 'unload' completly when switching to a new one? Could some lingering memory allocations be the cause of the problem?
I tried switching between Wario Land 4, Pokémon Sapphire, Payback, Bomberman Tournament, Mario Tennis and Golden Sun. Tracing the code cache flushes during the last switch, I see this:
[ 174.029013] Flushing read-only code cache: Loading a new ROM
[ 174.033237] Clearing ROM metadata: Loading a new ROM
[ 174.047146] Clearing BIOS metadata: Loading a new ROM
[ 174.051840] Flushing writable code cache: Invalidating native branches
[ 174.066474] Clearing IWRAM metadata: Invalidating native branches
[ 174.072490] Clearing EWRAM metadata: Invalidating native branches
[ 174.077312] Clearing VRAM metadata: Invalidating native branches
[ 174.090154] Clearing EWRAM metadata: Loading a new ROM
[ 174.093909] Clearing IWRAM metadata: Loading a new ROM
[ 174.099114] Clearing VRAM metadata: Loading a new ROM
It does unload everything.
 
edit I lied about final: I played through the entire first world, and each of the "bonus" stages and _no_ guru meditation, so I guess it was a one off. I've edited the wiki to reflect this.
Very well, I'm not going to even look at any bug from now on unless at least 2 users can reproduce it at exactly the same place and can provide save data for it that clearly shows the bug.

Random freezes included.
 
Golden Sun had a crash that was 100% reproducible, and I figured out that it was caused by translation gates. The recent bugs appear and disappear at different places in the game a user happens to be currently playing, after two workarounds, and nobody tests these games similarly. Some try them on all frameskips, but some use only 0 and never say it until I ask, some use 1 and never say it until I ask. And that Lego game guy never posted on GitHub - he or she must not really care that much about the game, or it was a random occurrence that was unrelated to the game, fixed itself, and will randomly appear again.

I'll now require confirmation from two users for any game. Do NOT post that a SPECIFIC game crashes unless you're able to give save data to another user and have him or her reproduce the crash after loading the state and pressing a button, or simply by loading the state and waiting a certain amount of frames.

I am just losing time investigating these games. The only game that freezes for me is Mario Tennis using the new 60/20 FPS automatic frameskip in TempGBA 1.42, after anything from 3 seconds to 45 minutes, never at the same place, and it stops freezing at frameskip 1 (30 FPS). Go figure. It may mean that there's a race condition in the communication link again. Fuck the DSTwo SDK - it's just really bad.
 
To be completely honest, the way you've talked about the sdk, and knowing how _most_ chinese cart makers are, especially considering how complex this thing is, I'm surprised that your stuff even works at all to be honest. The entire thing looks like someone built a jet fighter, and held it together with ducktape, and twine, and if you just happen to do a secret dance of the dark covenant at the right time, under a full moon, the entire thing won't blow up in your face.
 
I'll test Mario Tennis again under a build with sound tracers. I played it so much that I'm at the top of varsity doubles playing as Ace, and it has frozen on me 4 times so far. Reloading and going to the very same place again didn't cause a freeze, so it must be one of those random ones.

What I have right now is this:
Code:
  1384.364: In sound loop
  1384.372: Out of sound loop
  1384.385: In sound loop
  1384.394: Out of sound loop
Going on forever. What this sound loop awaits is for one of the DSTwo's audio buffers to be free, with the code from the previous pages. It is one line of code. If that loop is ever entered and not exited, I then know fully what the problem is with random freezing in all games, and can try a third workaround. Random Guru Meditations would still be a mystery.
 
I have confirmed the source of the freeze. Barely 30 seconds after the start of a run of the game.

The culprit:
Code:
#if defined SERIAL_TRACE || defined SERIAL_TRACE_SOUND
    serial_timestamp_printf("In sound loop");
#endif

    do
        audio_buff = ds2_getAudiobuff();
    while (audio_buff == NULL);

#if defined SERIAL_TRACE || defined SERIAL_TRACE_SOUND
    serial_timestamp_printf("Out of sound loop");
#endif

The freeze:
Code:
    28.410: In sound loop
    28.411: Out of sound loop
    28.422: In sound loop
    28.423: Out of sound loop
    28.435: In sound loop

CATSFC solved this by returning and trying later if there was no audio buffer. Looks like I'll have to do the same.
 
Solved, I think. Please test this compilation of commit 2c4879b: http://filetrip.net/dl?77KSpED5lZ

It shows this on my end:
232.762: Clearing IWRAM metadata: Last tag reached
241.165: Clearing IWRAM metadata: Last tag reached
246.075: Clearing IWRAM metadata: Loading a saved state
246.078: Clearing EWRAM metadata: Loading a saved state
246.084: Clearing VRAM metadata: Loading a saved state
253.858: Clearing IWRAM metadata: Loading a saved state
253.862: Clearing EWRAM metadata: Loading a saved state
253.867: Clearing VRAM metadata: Loading a saved state
270.650: Clearing IWRAM metadata: Last tag reached
272.373: Recovered from the lack of a buffer

It crackled for a split second, and skipped a few images, but it was back on and continued playing after this interruption.

The DSTwo SDK does not take kindly to being asked to send sound back-to-back in some circumstances, it needs an image between two sound packets in that case. This just sucks.
 
I have confirmed the source of the freeze. Barely 30 seconds after the start of a run of the game.

Great work!!

I felt bad for leading you down the wrong path with the game-switching theory, so I spend the night trying to recreate a non random/dead-certain freeze scenario (to be able to resolve it)...

Now...I can finally rest in peace :-)

/Nitendo a.k.a dACE
 
Great work!!

I felt bad for leading you down the wrong path with the game-switching theory, so I spend the night trying to recreate a non random/dead-certain freeze scenario (to be able to resolve it)...

Now...I can finally rest in peace :-)

/Nitendo a.k.a dACE
But seriously, can you test this commit for me? I mean I think it solves it, and I got a message on the console after breaking the loop, but I never know what games may still randomly freeze.

It sucks how this bug affected all games and appeared to be due to switching, but maybe now it's gone, and I'd like as much testing as you have time for.

Thanks in advance. :yaysp:
 
After testing of my own, the bug is not even worked around at automatic 0/2 (60/20 FPS) frameskip.

Even after trying to empty gpSP's buffers of pending audio, Mario Tennis still freezes due to the audio; this time it's an infinite loop of "Recovered from the lack of a buffer".

I've tried it at frameskip 1 while GBATemp was down with its gateway time-out error. It has worked flawlessly. I wanna completely disable frameskip 0 and remove the ability of automatic frameskip to go to 0.
 

Site & Scene News

Popular threads in this forum