Hacking TempGBA: NDSGBA revival

Do GBA games make your nono parts happy?


  • Total voters
    429
As I've found out by digging into the code, rewinding is indeed a special case of saved-state creation.

One can set the "backward time period" in NDSGBA 1.21 to be anything from 0.2 to 10 seconds. After one period passes, a full saved state (506 KB) is written to a ring buffer in memory, with a maximum of 14* states preserved. That means 2.8 seconds of rewinding if you set it to 0.2 seconds, and 140 seconds (2 minutes 20 seconds) if you set it to 10 seconds. It's not as smooth and as lengthy as nesDS, which does it frame-by-frame for many seconds.

_ _ _ _ _ _ _ _ _
* #define SAVESTATE_FAST_NUM (14), in memory.c. 32 MiB of RAM on the DSTwo, 2 MiB is taken by NDSGBA itself, 16 MiB by the GBA ROM buffer, some more as the GBA RAM and video RAM, means that there are about 12 MiB left. 14 states could be increased a little, but not too much, lest the emulator run out of memory and crash.
 
  • Know which cheat formats it supports in particular?

  • Will patching of 32MB games work?

  • Having rewind on won't cut off other features like cheat patching, will it?

  • Will you just give an option of pre-set steps for rewind (like 0.2, 1, 3, 5, 7, 10), or will it be user-defined? I'd probably use 5 myself.

Unlike the SNES emulator, I actually have personal interest in this one on the DSTwo if it can get better than the PSP one (equal performance and less broken features). ^^;
 
a) Know which cheat formats it supports in particular?
b) Will patching of 32MB games work?
c) Having rewind on won't cut off other features like cheat patching, will it?
d) Will you just give an option of pre-set steps for rewind (like 0.2, 1, 3, 5, 7, 10), or will it be user-defined? I'd probably use 5 myself.
Unlike the SNES emulator, I actually have personal interest in this one on the DSTwo if it can get better than the PSP one (equal performance and less broken features). ^^;
a) Nope. But I copy-pasted the cheat support as it exists in NDSGBA 1.21, so anything that worked should work, like the format you described using GBK/SJIS and the PAR_V1 and PAR_V3 formats... once I get past the crashes that occur when you touch the Cheats menu in the current code.
b) Don't know, but it should, because apply_cheats() is called after every frame. I'll ask you to test that when I have a build that doesn't crash when touching Cheats.
c) Don't know, but it might mess with both at once if you rewind to before enabling or disabling a cheat. gpSP has trouble remembering the original value of a byte modified by a cheat.
d) I'm thinking I would ditch rewinding in favor of the saved state quick-load and quick-save hotkeys. But if there's enough support for rewinding, I'd hook the values as in NDSGBA 1.21, which are 0.2, 0.5, 1, 2, 5, 10, I think.
 
A - IIRC NDSGBA uses the second, "RAW" format. This means basic cheats are easier to search and apply, but for application of AR codes the decryptor programs need to be used, so if so I or somebody else will make a basic cheat tutorial thread if needed.

B - Yeah, I'll toss some problem games into it.

C - Lots of older emulators seem to not remember the previous value of a code (ZSNES notoriously). XD

D - Alright.
 
After having tested TempGBA for a lot of the day with Golden Sun, I found out that at least one of its game_config.txt entries is making it crash! That should also happen with NDSGBA 1.21 by dropping game_config.txt into its system directory, /NDSGBA; the difference is that TempGBA already includes this file.

I got to the part, rather early on in the game, where Isaac asks Garet to dump his chest of valuables. I talked to Garet, then when the [Yes] [No] face choice appeared, I said nothing. I experience a crash within 3 seconds consistently if I do that.

Without game_config.txt, it does not crash. With it, it does. So at least one of the 3 translation_gate_target entries is wrong.

Anyway, today in the TempGBA repository, despite this massive waste of time with Golden Sun crash investigation:
* Cheats are still crashing as I enter the menu.
* Hooked frame skipping again, both automatic and manual. Manual frameskipping sounds like the game is running underwater, with lots of bubbling/gargling noises. Auto frameskipping is better, but in Golden Sun - The Lost Ages it sounds like permanent underwater mode.
* The real-time clock works at least well enough for Pokémon Emerald not to complain that its battery has run dry. It works well enough to advance properly while the game is loaded. Unfortunately, I can't tell if the clock synchronises properly with the DS as you load a GBA game and the DS has been off.

I can't remember if I paid enough attention to Pokémon Emerald when I set the time for this game-save. It's 01:27 on my DSi as I write this, but it's 04:13 on the 'GBA'. Perhaps someone who pays more attention than me can test that when the first release is out.
 
  • Like
Reactions: Rydian
I think rewind is way more of a "save my bacon from that pit I just jumped in" function than quick states, which would require you to save before each stupid move.
I loved it in those moments when you forgot to save for a while and die unexpectedly, so you don't have to replay the same part for another hour.
 
So I better hook rewinding, then, and set it to be enabled by default. Because you won't want to have to enable it for a game just so it's able to save your behind later. The trade-off between usefulness and "performance hit" means that a default value of 10 seconds would be good. In NDSGBA 1.21 it's hard-coded to the button combination L+Y, so that's what it'll be after I copy-paste it, but later on I'll need to hook it into the hotkey system.
 
Rewinding is hooked.

I also added sound while fast-forwarding. At first, it tried to synchronise on the sound while it was fast-forwarding, so it was negating any speed gained, just waiting for the sound to finish. I made it quit synchronising on the sound, so there is sound while fast-forwarding. It may sound a bit bubbly, but it's there.

Also, in Pokémon Emerald it's 01:45 while I write this, and 23:02 on my DSi. Yesterday it was 04:13 in Pokémon Emerald while it was 01:27 on my DSi. The GBA appears to have been fast by 2 hours 46 yesterday, and 2 hours 43 today. It desynced from the DS by 3 minutes, probably because I used fast-forward to get to Littleroot Town to see my clock. It looks like it syncs up with the DS while it's off, if you don't do crazy stuff like fast-forwarding.
 
I know I'm pondering really far ahead here since TempGBA isn't even released yet but how do the DSTWO's clockspeeds compare to the PSP's? If gPSP Kai can be ported over at mostly full speed what else could we port over to the DSTWO? The recent CATSFC updates, CPS2 emulation, Neo Geo emulation, and PSX emulation (though running through an ugly unfinished Dingux port) have shown a lot more potential in the DSTWO than it did disappointing everyone running NDSSFC for the first time. I know the PSP has been the top choice for portable emulation and homebrew for the longest time, and it'll probably be that way until the 3DS/Vita gets more development, but it'd be awesome to see the DS rise to at least a close second several years into the next generation. And I say at least because the DS already does some things better with the DPad/Button quality and second touch screen, I recently got a PSP 2000 and the emulation has been great but I still prefer the former for any games that run the same speed on both devices.

Uh...before I start talking in circles here I'm just gonna say what I'm trying to get at.

tl;dr: I love you all and all of your work write more SDK tutorials and keep on porting more homebrew I think the DSTWO can get on the level of the PSP :gba:
 
What's the fast forward performance like?
It changes dramatically depending on the game and clock speed... but I'd say:

"CPU [x] y MHz, Game: Fast-forward is close to z seconds per second." With game_config.txt.

* [5] 396 MHz, Pokémon Emerald: 4.0.
* [0] 240 MHz, Pokémon Emerald: 3.0.
* [5] 396 MHz, Legend of Zelda GBA: 3.5.
* [0] 240 MHz, Legend of Zelda GBA: 2.2.
* [5] 396 MHz, Donkey Kong Country: 2.9.
* [0] 240 MHz, Donkey Kong Country: 2.6.
* [5] 396 MHz, Super Mario World Advance 2 (Mario World): 2.7.
* [0] 240 MHz, Super Mario World Advance 2 (Mario World): 1.9.

All tests carried out during gameplay, i.e. in all games, not at the intro; and in Mario World and Donkey Kong, not in the overworld either.

I also encountered a bug during my testing for this question: if I enable fast-forward for a game, then load another, fast-forwarding is disabled, but frameskip stays manual 9, so the next loaded game has low FPS. I need to fix that. There may be other shenanigans with ROM loading, and I need to properly reset everything.
 
Today in the TempGBA repository:
* Hooked rewinding to its original hardcoded hotkey, L+Y.
* Fast-forward is now fast, as you would expect. Previously in TempGBA (but not in NDSGBA), fast-forwarding still drew all the frames, it just didn't sync them with the frame time or sound time. Now it forces frameskip to be 9 as well, like NDSGBA.
* Enabled sound while fast-forwarding, unless you fast-forward and mute. Previously in TempGBA (and in gpSP and NDSGBA, all versions), fast-forward was without sound.
* Fixed up a bug that caused new ROMs to be loaded with manual 9 frameskip if the previous ROM was using fast-forward, with the menu saying fast-forward is disabled and frameskip is automatic for the new ROM.
 
Today in the TempGBA repository:
These posts are like a modern Roosevelt's fireside chats. XD

Is rewind noticeably faster with sound off, or is it just a slight gain and not a bother? Yes, I know I could likely grab the tools and compile it myself to test, but I'm lazy, don't have any of the DSTwo stuff installed (just the basic libnds/devkitpro stuff)... and you're still doing such major changes that I assume bug reports wouldn't be too useful just yet.
 
  • Like
Reactions: ferret7463

Site & Scene News

Popular threads in this forum