Hacking TempGBA: NDSGBA revival

Do GBA games make your nono parts happy?


  • Total voters
    429

LolGuyX

Well-Known Member
Newcomer
Joined
Oct 6, 2012
Messages
63
Trophies
0
XP
154
Country
Netherlands
Okay i've done some more testing.
Golden sun 2 still has some cracking in the sound during battles, its more noticeable in the felix battle theme. Still playable though.

And i got a crash with frameskip 0 and sound off, rewinding off, cheats off and cpu at lvl 5. in Golden sun 2 during battle.
So i think sound off is not fixing this crashing issue...
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Okay i've done some more testing.
Golden sun 2 still has some cracking in the sound during battles, its more noticeable in the felix battle theme. Still playable though.

And i got a crash with frameskip 0 and sound off, rewinding off, cheats off and cpu at lvl 5. in Golden sun 2 during battle.
So i think sound off is not fixing this crashing issue...
Was it a crash with guru meditation or one without?

Also, can you reproduce the crash easily? If so, I'd like a saved state in an issue on GitHub.

EDIT: Forgot to read "frameskip 0" in your message. So never mind that, you were probably just confirming the bug for another game. I can continue using Pokémon Leaf Green for testing, since I know it crashes in a battle at frameskip 0.

I think the DSTwo-DS link is too congested, similar to what happened in CATSFC. So I need to either:
* Introduce a delay between sending the previous frame and the next one. If I do this, all sound will crackle at frameskip 0, but games might crash less.
* Make 0 frameskip silently equal to 1. If I do this, sound will not crackle and games will not crash, but you will get 30 FPS.
* Drop 0 frameskip entirely. If I do this, either frameskip 1 will be interpreted as 2 in existing settings files (2 as 3, 3 as 4, ...) OR you will have to reset the setting for all games.
For reference, the DSTwo-DS link can handle sending 42 frames per second plus 44100 Hz audio.
 

Prof. 9

Well-Known Member
Member
Joined
Jun 17, 2008
Messages
324
Trophies
1
Location
The Netherlands
Website
twitter.com
XP
853
Country
Netherlands
I think the DSTwo-DS link is too congested, similar to what happened in CATSFC. So I need to either:
* Introduce a delay between sending the previous frame and the next one. If I do this, all sound will crackle at frameskip 0, but games might crash less.
* Make 0 frameskip silently equal to 1. If I do this, sound will not crackle and games will not crash, but you will get 30 FPS.
* Drop 0 frameskip entirely. If I do this, either frameskip 1 will be interpreted as 2 in existing settings files (2 as 3, 3 as 4, ...) OR you will have to reset the setting for all games.
For reference, the DSTwo-DS link can handle sending 42 frames per second plus 44100 Hz audio.
Since the crash only occurs after an extended time of playing and can apparently be averted by quickly switching to frameskip 1, couldn't you just introduce a delay every so often to clear the link? Or play audio at a lower quality, or compress the frames... or will that not work?

Most games will probably be smooth enough at 30 fps, but then there are games like Mario, Boktai, etc. that heavily rely on sprite flickering for semi-transparency. Could something be done about that, perhaps by ROM hacking to indicate OAMs that should flicker and doing that manually DS-side? (I actually tried to hack Boktai into using the GBA's built-in alpha transparency the other day, but it already uses alpha transparency with some of the backgrounds, so I couldn't get it to work.)
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Since the crash only occurs after an extended time of playing and can apparently be averted by quickly switching to frameskip 1, couldn't you just introduce a delay every so often to clear the link? Or play audio at a lower quality, or compress the frames... or will that not work?

Most games will probably be smooth enough at 30 fps, but then there are games like Mario, Boktai, etc. that heavily rely on sprite flickering for semi-transparency. Could something be done about that, perhaps by ROM hacking to indicate OAMs that should flicker and doing that manually DS-side? (I actually tried to hack Boktai into using the GBA's built-in alpha transparency the other day, but it already uses alpha transparency with some of the backgrounds, so I couldn't get it to work.)
When testing with Pokémon Leaf Green as stated in issue 3 on GitHub, I can experience a crash mere seconds after entering a battle, or 20 seconds, or finish a battle completely fine and crash on the next.

Settings in use are:
/Video & audio/Frame skipping = [0] Show all frames
/Options/CPU frequency = [0] 240 MHz
/Video & audio/Sound = On
/Video & audio/Fast-forward = Off

The crash moment should be treated as unpredictable, so I can't set a timer or anything to try to avert it programmatically.

It's also not possible to flash individual sprites in OAM on the DS, as entire frames are sent pre-rendered from the DSTwo to the DS; they are not sent as sprites or anything that can be manipulated individually. That flashing stuff is why I refuse to set the automatic frameskipper to 1 instead of 2, btw.
 

Prof. 9

Well-Known Member
Member
Joined
Jun 17, 2008
Messages
324
Trophies
1
Location
The Netherlands
Website
twitter.com
XP
853
Country
Netherlands
It's also not possible to flash individual sprites in OAM on the DS, as entire frames are sent pre-rendered from the DSTwo to the DS; they are not sent as sprites or anything that can be manipulated individually. That flashing stuff is why I refuse to set the automatic frameskipper to 1 instead of 2, btw.
In that case, couldn't the DSTWO do manual alpha blending? I wouldn't mind making some ROM hacks where an some unused bit is set in the OAM data that indicates sprite flicker, or something.

Also, I'm not emulation expert, but since the DS and GBA are so similar, wouldn't it be simpler to just send tilesets, tilemaps, OAMs and palettes instead of an entire bitmap, and just copy it into the DS' VRAM?
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
In that case, couldn't the DSTWO do manual alpha blending? I wouldn't mind making some ROM hacks where an some unused bit is set in the OAM data that indicates sprite flicker, or something.

Also, I'm not emulation expert, but since the DS and GBA are so similar, wouldn't it be simpler to just send tilesets, tilemaps, OAMs and palettes instead of an entire bitmap, and just copy it into the DS' VRAM?
It would be great if the DS could just recognise all the SNES graphics too, so CATSFC could be done on the DS itself. (but then SNemulDS could do the job)

The DSTwo SDK doesn't allow me to upload individual objects, only entire frames. The premise is that the rendering is done on the DSTwo's far more powerful processor, and the output is sent to the DS which acts as a dumb terminal. The entire SDK is coded around that assumption. However, the link to the DS doesn't allow me to do everything.

If you want an emulator that does 60 FPS and native drawn graphics for the (few, compared to TempGBA) games it supports, try out ichfly's gbaemu4ds.

And no, I am definitely not about to implement a hack that draws half-alpha'd OAM sprites if you tell it that the sprite should be flickering with some kind of unused bit. It would be incompatible with all other emulators (I like to be able to use clean ROMs whenever possible), and I can't even understand a single line of gpSP's video.c.
 

LolGuyX

Well-Known Member
Newcomer
Joined
Oct 6, 2012
Messages
63
Trophies
0
XP
154
Country
Netherlands
Was it a crash with guru meditation or one without?

Also, can you reproduce the crash easily? If so, I'd like a saved state in an issue on GitHub.

EDIT: Forgot to read "frameskip 0" in your message. So never mind that, you were probably just confirming the bug for another game. I can continue using Pokémon Leaf Green for testing, since I know it crashes in a battle at frameskip 0.

I think the DSTwo-DS link is too congested, similar to what happened in CATSFC. So I need to either:
* Introduce a delay between sending the previous frame and the next one. If I do this, all sound will crackle at frameskip 0, but games might crash less.
* Make 0 frameskip silently equal to 1. If I do this, sound will not crackle and games will not crash, but you will get 30 FPS.
* Drop 0 frameskip entirely. If I do this, either frameskip 1 will be interpreted as 2 in existing settings files (2 as 3, 3 as 4, ...) OR you will have to reset the setting for all games.
For reference, the DSTwo-DS link can handle sending 42 frames per second plus 44100 Hz audio.

It was one without guru meditation,
It crashed the same way as pokemon leaf green did, but with sound off this time. So yeah, I just confirmed the bug for another game.

The crash only occurs when lagg kicks in, in pokemon leaf green while saving or a pokemon evolving, In golden sun during battle. Cant you program something that quickly changes the frameskip to 1, when lagg occurs?
Something like frameskip auto with the Default on 0 instead of 2.
So that we do have 2 automatic frameskippers, one on 0 default, and one on 2.

I find it strage that the crash did also happen with sound off..


I also found another crash in Golden Sun 2, it cannot be reproduced easly and this one was with Guru meditation. Here is the report:

Guru Meditation
Jump to unmapped address E1A00800
at adress 03000FD0
The game has encountered an unrecoverable error. Please restart the emulator to load another game.

I was at cpu level 5, frameskip on auto, sound on.
During battle.
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
It was one without guru meditation,
It crashed the same way as pokemon leaf green did, but with sound off this time. So yeah, I just confirmed the bug for another game.

The crash only occurs when lagg kicks in, in pokemon leaf green while saving or a pokemon evolving, In golden sun during battle. Cant you program something that quickly changes the frameskip to 1, when lagg occurs?
Something like frameskip auto with the Default on 0 instead of 2.
So that we do have 2 automatic frameskippers, one on 0 default, and one on 2.

I find it strage that the crash did also happen with sound off..
The very same bug happens with sound off, because with the sound off, the emulator is still emitting silence for synchronisation. It doesn't surprise me.

Making a separate automatic frameskipper targetting 0 frameskip is a good idea, thanks for that ^_^

I also found another crash in Golden Sun 2, it cannot be reproduced easly and this one was with Guru meditation. Here is the report:

Guru Meditation
Jump to unmapped address E1A00800
at adress 03000FD0
The game has encountered an unrecoverable error. Please restart the emulator to load another game.

I was at cpu level 5, frameskip on auto, sound on.
During battle.
Now that's plain weird, it's making a jump to an address that's 3 gigabytes above the end of the GBA memory. :huh: It's also looking like it wants to jump to an address that's really a common ARM instruction. (MOV R0, R0, LSL #16)

To be useful, a saved state would have to have been written 1 millisecond before the crash occurred. The crash occurred in modifiable code (03xxxxxx = Internal Working RAM), so I don't know what code it is.
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Cant you program something that quickly changes the frameskip to 1, when lagg occurs?
Something like frameskip auto with the Default on 0 instead of 2.
So that we do have 2 automatic frameskippers, one on 0 default, and one on 2.
Here's a build for your testing: http://filetrip.net/dl?D3zBFTFj12

It says "beta 10" in its version dialog, because I compiled it from a different branch. It incorporates:
* commit a3e250b: Rewrite the sound function to not be an infinite loop anymore, and to properly check for buffers being full or queueing to send audio to the DSTwo. This fixes Pokémon LeafGreen crashing with manual frameskip 0, as well as sound offsetting itself 20 times per second with any manual frameskip. (DSTwo-specific)
* commit 0c21a9e: (DSTwo-specific) Skip up to 1 frame if audio is about to lag with manual frame skip 0.

I thought the first one fixed the crasher but it didn't.
 

2ndApex

Well-Known Member
Member
Joined
Jul 12, 2012
Messages
677
Trophies
0
XP
419
Country
United States
Here's a build for your testing: http://filetrip.net/dl?D3zBFTFj12

It says "beta 10" in its version dialog, because I compiled it from a different branch. It incorporates:
* commit a3e250b: Rewrite the sound function to not be an infinite loop anymore, and to properly check for buffers being full or queueing to send audio to the DSTwo. This fixes Pokémon LeafGreen crashing with manual frameskip 0, as well as sound offsetting itself 20 times per second with any manual frameskip. (DSTwo-specific)
* commit 0c21a9e: (DSTwo-specific) Skip up to 1 frame if audio is about to lag with manual frame skip 0.

I thought the first one fixed the crasher but it didn't.


Does still still have the improvements from beta 11?
 

Prof. 9

Well-Known Member
Member
Joined
Jun 17, 2008
Messages
324
Trophies
1
Location
The Netherlands
Website
twitter.com
XP
853
Country
Netherlands
Tried this on Boktai 1 (U) with solar sensor patch applied, on frameskip 0 and CPU frequency 5. After the intro finished, the framerate dropped to 45-50 and the emulator completely froze before the game screen even appeared (isn't a Guru Meditation screen supposed to appear?). When I tried again, it didn't happen, though.

However, in other games I tried there is no audio crackle which was originally present in beta 10.

I'm leaving it running in the first screen now (where it has consistent ~45 fps, ~50/60 emulated) and see if it crashes.

EDIT: Happened again on frameskip 0, again just after the intro finished.
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Tried this on Boktai 1 (U) with solar sensor patch applied, on frameskip 0 and CPU frequency 5. After the intro finished, the framerate dropped to 45-50 and the emulator completely froze before the game screen even appeared (isn't a Guru Meditation screen supposed to appear?). When I tried again, it didn't happen, though.

However, in other games I tried there is no audio crackle which was originally present in beta 10.
Now that you've tested it with frameskip 0, does it do the same thing at frameskip 1?

I have no Guru Meditation screen for that kind of crash, because:
* it manifests as a freeze of the DSTwo-DS communication link;
* it's not an interrupt or exception that the DSTwo's MIPS processor can get;
* even if it was an exception that it could get, it couldn't send the screen because the communication link is frozen.
 

Prof. 9

Well-Known Member
Member
Joined
Jun 17, 2008
Messages
324
Trophies
1
Location
The Netherlands
Website
twitter.com
XP
853
Country
Netherlands
Doesn't seem to be happening at frameskip 1, but I do have it set in CPU 5. Should I lower it to 0 to increase the chance? The game is also running at full speed (60/60 emulated) on frameskip 1 where it wasn't on frameskip 0.
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Doesn't seem to be happening at frameskip 1, but I do have it set in CPU 5. Should I lower it to 0 to increase the chance? The game is also running at full speed (60/60 emulated) on frameskip 1 where it wasn't on frameskip 0.
Yes, please test lower frequencies at frameskip 1 to see if it has to do with the odds of a crash occurring.
 

Prof. 9

Well-Known Member
Member
Joined
Jun 17, 2008
Messages
324
Trophies
1
Location
The Netherlands
Website
twitter.com
XP
853
Country
Netherlands
Just tested the Boktai 1 intro 50 times. 20 times at frameskip 1 and CPU 240 MHz, 20 times at frameskip 0 and CPU 396 MHz, and 10 times at frameskip 0 and CPU 240 MHz. Oddly enough, it never crashed... maybe I was just (un)lucky earlier?

I'll leave the game running overnight at frameskip 1 and CPU 240 MHz to see if anything happens. Currently in the first map of Boktai where I get 26-29 rendered, 55-59 emulated. It has a scrolling alpha background so the screen won't be static. I can also test in another game if you want,.
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Just tested the Boktai 1 intro 50 times. 20 times at frameskip 1 and CPU 240 MHz, 20 times at frameskip 0 and CPU 396 MHz, and 10 times at frameskip 0 and CPU 240 MHz. Oddly enough, it never crashed... maybe I was just (un)lucky earlier?

I'll leave the game running overnight at frameskip 1 and CPU 240 MHz to see if anything happens. Currently in the first map of Boktai where I get 26-29 rendered, 55-59 emulated. It has a scrolling alpha background so the screen won't be static. I can also test in another game if you want,.
Thanks a lot for your testing. I'll take the results from your overnight test tomorrow, but I don't think I'll need any more games. Unfortunately you seem to have encountered the reason why I called the bug unpredictable - not crashing when you wanted it to -, and if the overnight test proves frameskip 1 doesn't crash, I'll disable frameskip 0.
 

Prof. 9

Well-Known Member
Member
Joined
Jun 17, 2008
Messages
324
Trophies
1
Location
The Netherlands
Website
twitter.com
XP
853
Country
Netherlands
Thanks a lot for your testing. I'll take the results from your overnight test tomorrow, but I don't think I'll need any more games. Unfortunately you seem to have encountered the reason why I called the bug unpredictable - not crashing when you wanted it to -, and if the overnight test proves frameskip 1 doesn't crash, I'll disable frameskip 0.
Why remove it entirely? If a crash would only occur on average, say, once every 30 minutes, then it's not that much of a problem. And perhaps on some games it won't crash at all. You could show a warning when the frameskip is set to 0 or add an option for pre-beta 11 audio crackling. Something like automatically doing a save state every 5 minutes would also combat it.

I guess I'll also try an overnight test on frameskip 0 and at different CPU speeds.
 

LolGuyX

Well-Known Member
Newcomer
Joined
Oct 6, 2012
Messages
63
Trophies
0
XP
154
Country
Netherlands
Here's a build for your testing: http://filetrip.net/dl?D3zBFTFj12

It says "beta 10" in its version dialog, because I compiled it from a different branch. It incorporates:
* commit a3e250b: Rewrite the sound function to not be an infinite loop anymore, and to properly check for buffers being full or queueing to send audio to the DSTwo. This fixes Pokémon LeafGreen crashing with manual frameskip 0, as well as sound offsetting itself 20 times per second with any manual frameskip. (DSTwo-specific)
* commit 0c21a9e: (DSTwo-specific) Skip up to 1 frame if audio is about to lag with manual frame skip 0.

I thought the first one fixed the crasher but it didn't.


Okay i've tested alot. (all on level 5 cpu)

In pokemon leaf green, everything seems to be fixed, I wasn't able to let it crash with frameskip at 0.
I've done the final battle in golden sun (I think the most intensive battle) 10 times, and it crashed only once at frameskip 0 instead of almost every battle.
Golden sun 2 didn't crash with me too.
So in 2 hours of testing, I only got 1 crash and I think thats pretty damn good :).


There are some problems with this new feature though. *EDIT: Maybe these problems are because of the Beta 10 build?*

*Golden sun battles became real laggy at frameskip 0. in beta 11 everything was kinda fluent but it did crash the emulator after a while. In this test release the game has alot of random freezes on frameskip 0 during the battles (those freezes do not last longer than 1 seccond) but it does not crash the emulator.

*in pokemon leaf green the ''workaround'' seems to be too sensitive sometimes, when you encounter a pokemon it sometimes skips a few frames but I've never had any crashes in a pokemon encounter with beta 11.

*I noticed a speed regression in this test release, the audio in golden sun battles is less good, even with frameskip auto/2. the game is lagging more in the overworld/map. and the audio in general has more crackles in it.

It looks like the crasher is gone, but the overal speed and sound quality have become less in this test setup.
 

LolGuyX

Well-Known Member
Newcomer
Joined
Oct 6, 2012
Messages
63
Trophies
0
XP
154
Country
Netherlands
Thanks a lot for your testing. I'll take the results from your overnight test tomorrow, but I don't think I'll need any more games. Unfortunately you seem to have encountered the reason why I called the bug unpredictable - not crashing when you wanted it to -, and if the overnight test proves frameskip 1 doesn't crash, I'll disable frameskip 0.

In all my testing frameskip 0 did only crash the game at laggy times.
Some games do not lagg at all (like mario advance 2) those can easly be played with frameskip 0.

Why remove it entirely? If a crash would only occur on average, say, once every 30 minutes, then it's not that much of a problem. And perhaps on some games it won't crash at all. You could show a warning when the frameskip is set to 0 or add an option for pre-beta 11 audio crackling. Something like automatically doing a save state every 5 minutes would also combat it.

I guess I'll also try an overnight test on frameskip 0 and at different CPU speeds.

I agree, a savestate is done really fast and isnt much of a bother. if the crash occurs once every 30 minutes im fine with it.
the option for pre beta 11 audio crackling would be nice too.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Quincy @ Quincy:
    Usually when such a big title leaks the Temp will be the first to report about it (going off of historical reports here, Pokemon SV being the latest one I can recall seeing pop up here)
  • K3Nv2 @ K3Nv2:
    I still like how a freaking mp3 file hacks webos all that security defeated by text yet again
  • BigOnYa @ BigOnYa:
    They have simulators for everything nowdays, cray cray. How about a sim that shows you playing the Switch.
  • K3Nv2 @ K3Nv2:
    That's called yuzu
    +1
  • BigOnYa @ BigOnYa:
    I want a 120hz 4k tv but crazy how more expensive the 120hz over the 60hz are. Or even more crazy is the price of 8k's.
  • K3Nv2 @ K3Nv2:
    No real point since movies are 30fps
  • BigOnYa @ BigOnYa:
    Not a big movie buff, more of a gamer tbh. And Series X is 120hz 8k ready, but yea only 120hz 4k games out right now, but thinking of in the future.
  • K3Nv2 @ K3Nv2:
    Mostly why you never see TV manufacturers going post 60hz
  • BigOnYa @ BigOnYa:
    I only watch tv when i goto bed, it puts me to sleep, and I have a nas drive filled w my fav shows so i can watch them in order, commercial free. I usually watch Married w Children, or South Park
  • K3Nv2 @ K3Nv2:
    Stremio ruined my need for nas
  • BigOnYa @ BigOnYa:
    I stream from Nas to firestick, one on every tv, and use Kodi. I'm happy w it, plays everything. (I pirate/torrent shows/movies on pc, and put on nas)
  • K3Nv2 @ K3Nv2:
    Kodi repost are still pretty popular
  • BigOnYa @ BigOnYa:
    What the hell is Kodi reposts? what do you mean, or "Wut?" -xdqwerty
  • K3Nv2 @ K3Nv2:
    Google them basically web crawlers to movie sites
  • BigOnYa @ BigOnYa:
    oh you mean the 3rd party apps on Kodi, yea i know what you mean, yea there are still a few cool ones, in fact watched the new planet of the apes movie other night w wifey thru one, was good pic surprisingly, not a cam
  • BigOnYa @ BigOnYa:
    Damn, only $2.06 and free shipping. Gotta cost more for them to ship than $2.06
    +1
  • BigOnYa @ BigOnYa:
    I got my Dad a firestick for Xmas and showed him those 3rd party sites on Kodi, he loves it, all he watches anymore. He said he has got 3 letters from AT&T already about pirating, but he says f them, let them shut my internet off (He wants out of his AT&T contract anyways)
  • K3Nv2 @ K3Nv2:
    That's where stremio comes to play never got a letter about it
  • BigOnYa @ BigOnYa:
    I just use a VPN, even give him my login and password so can use it also, and he refuses, he's funny.
  • BigOnYa @ BigOnYa:
    I had to find and get him an old style flip phone even without text, cause thats what he wanted. No text, no internet, only phone calls. Old, old school.
  • Psionic Roshambo @ Psionic Roshambo:
    @BigOnYa, Lol I bought a new USB card reader thing on AliExpress last month for I think like 87 cents. Free shipping from China... It arrived it works and honestly I don't understand how it was so cheap.
    +1
    Psionic Roshambo @ Psionic Roshambo: @BigOnYa, Lol I bought a new USB card reader thing on AliExpress last month for I think like 87... +1