Hacking TempGBA: NDSGBA revival

Do GBA games make your nono parts happy?


  • Total voters
    429

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Is it not possible to make it a configurable option, either globally or per game?
The sound frequency is determined at initialisation time and a lot of fixed-point code in source/nds/sound.c doesn't work if the sound is rendered at 65536 Hz.
If it's rendered at 32768 Hz, Golden Sun 2 has sound that overlaps itself, then goes quiet. So it distorts heavily.
If it's rendered at 65536 Hz, desyncs occur in Pokémon... and its ROM hacks. (see above)

Be my guest, and try to examine source/nds/sound.c. I've tried a few things, like making the fixed-point stuff Q15.17 instead of Q16.16, as well as using floats.
 

CompC

Well-Known Member
Member
Joined
May 28, 2009
Messages
372
Trophies
0
Age
30
Website
josh.birnholz.com
XP
553
Country
United States
Would it be possible to map more than one DS button to a GBA button? I like using X and Y and Start and Select for some games, but Start and Select for others. Can I map them both to Start and Select?
 

pokefloote

Well-Known Member
Member
Joined
Mar 20, 2009
Messages
2,669
Trophies
2
XP
1,991
Country
United States
Would it be possible to map more than one DS button to a GBA button? I like using X and Y and Start and Select for some games, but Start and Select for others. Can I map them both to Start and Select?
Wouldn't game-specific button mapping solve this for you? For example only for Pokemon Firered, X = Start, but in every other game it's start = start.
 

pokefloote

Well-Known Member
Member
Joined
Mar 20, 2009
Messages
2,669
Trophies
2
XP
1,991
Country
United States
Would it be possible to map more than one DS button to a GBA button? I like using X and Y and Start and Select for some games, but Start and Select for others. Can I map them both to Start and Select?
Wouldn't game-specific button mapping solve this for you? For example only for Pokemon Firered, X = Start, but in every other game it's start = start.
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Would it be possible to map more than one DS button to a GBA button? I like using X and Y and Start and Select for some games, but Start and Select for others. Can I map them both to Start and Select?
How do you propose I clear game-specific button mappings if I allow you to map two DS keys to the same GBA key?

Currently, you can clear global rapid-fires and game-specific mappings by pressing two keys at once at the prompt. If I allow you to map 2 keys, do I need 3 for clears? Will you want to be able to map 3 DS keys to the same GBA key? If so, do I need 4 for clears?

Ed: Never mind. It sounds like what you want is indeed game-specific mappings. Set your regular mappings, and then after loading a game, go into Tools/Game-specific button mappings.
 

nl255

Well-Known Member
Member
Joined
Apr 9, 2004
Messages
3,000
Trophies
2
XP
2,802
Country
The sound frequency is determined at initialisation time and a lot of fixed-point code in source/nds/sound.c doesn't work if the sound is rendered at 65536 Hz.
If it's rendered at 32768 Hz, Golden Sun 2 has sound that overlaps itself, then goes quiet. So it distorts heavily.
If it's rendered at 65536 Hz, desyncs occur in Pokémon... and its ROM hacks. (see above)

Be my guest, and try to examine source/nds/sound.c. I've tried a few things, like making the fixed-point stuff Q15.17 instead of Q16.16, as well as using floats.

Does that have to happen before reading the configuration file? Because otherwise you could make it configurable globally with a warning that it requires restarting the emulator for the change to take effect. Something like "Pokemon sound hack (requires restart)" in the options menu?
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Does that have to happen before reading the configuration file? Because otherwise you could make it configurable globally with a warning that it requires restarting the emulator for the change to take effect. Something like "Pokemon sound hack (requires restart)" in the options menu?
It does happen before reading the configuration file. It's literally baked into the entire logic of the program; the CPU emulation expects the sound emulation to run a certain way, so the sound runs a certain way - 32768 Hz audio, screw the rest, because the data-types literally cannot handle anything more precise. And it's not documented. And it's in a mess of functions calling macros calling macros calling macros, some of which calls into MIPS assembly.

Changing the sound sampling frequency also already broke saved states; if I allowed the option to change the frequency so that Pokémon sounded alright, saved states made with the option enabled would fail to load in mysterious ways with it disabled (including crashes caused by divisions by zero, sound going muted or glitchy, emulation slowing down or accelerating 2x like I saw in the 2 previous days). I don't want to have to explain hundreds of times that you bake the option's value into your saved states because people don't read READMEs in 2013.

What if I made two branches of the emulator, one exclusively for Pokémon and another exclusively for the other games? States from one would be explicitly incompatible with the other, but .sav files would be interoperable. Basically what I did for April Fools' Day with PokéGBA, except for real. There would be two emulators in the same .zip.
 

CompC

Well-Known Member
Member
Joined
May 28, 2009
Messages
372
Trophies
0
Age
30
Website
josh.birnholz.com
XP
553
Country
United States
Yeah, I didn't realize there were game specific mappings now, this helps a lot!

However sometimes I still instinctively press Start to open the menu, even if I also have it set to X to get to it more easily. Couldn't it be possible to set it to more than one thing? On my PSP with gPSP and in many other emulators I can do this.

Instead of a list of GBA buttons, allowing you to set each one to a DS button, there could be a list of DS buttons, allowing you to set each one to a GBA button. This way you coul map more than one DS button to the same GBA button.

Anyway, it's not as important though now that I know there are game-specific mappings.
 

Boriar

Well-Known Member
Member
Joined
Sep 22, 2008
Messages
316
Trophies
1
Age
52
Location
Spain
XP
695
Country
I don't like to have especific versions for one or another game but if the problem to integrate all haven't got any solutions (at the moment) i think that's the better option for all.
+1 two branches
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
This really sounds like a kludge, but I can understand that the SDK's crappy (by far you're not the first to mention things), so if it's the only solution that currently works... I'm just worried the split might have more and more for you to keep track of.
If I can get the Makefile to make both versions at once and put them in the zip, it will be far less of a hassle. I'd make sure to document the split very well in the new Makefile.
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
I'm trying something else for audio. I'll test for the next hour in Pokémon Emerald to test its synchronisation. If it's synchronised and Golden Sun 2 sounds good, I'll then know that it was related to having imprecise accounting of GBA clock cycles. edit: And then I can stop the forking before it even starts. This will bring about another incompatible saved state change, but at least I can fix this one up after reading a version 1.0e saved state by multiplying a variable by 2.

-> Nebuleon/TempGBA/sound-fix commit 711f657: "Preserve one more digit of the number of clock cycles accumulated in a partial output audio sample. This should resynchronise Pokémon Emerald. At least it doesn't sound like an electric guitar operated by a newbie who sets the distortion knob to 11 anymore."
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
I'm afraid even the so-called PokéGBA branch, with its 32768 Hz sound, has not synchronised the parts of the music in Pokémon games, so it'll stay as TempGBA. But I just found that some code was commented-out or newly added in the latest version of gpSP Kai compared to what's in the current code...

So I'll take some time to look at the changes very carefully. Could be weeks, could be months.
 
  • Like
Reactions: Hyura

Hanafuda

Well-Known Member
Member
Joined
Nov 21, 2005
Messages
4,509
Trophies
2
XP
6,990
Country
United States
Nebuleon !!!

sorry, I forgot all about this from back when you had just gotten the source code from Supercard. I stumbled upon it tonight and damn ... Beta 8 already. Just tried it out on a few staple games, and was blown away!!!! Once again you've made the DSTwo do what we were told it would do all along. I thank you.

But ... ummm... sorry for asking but, Mario Power Tennis is IMHO the only fun Mario Tennis game in existence, and its unplayable. Any chance it'll see improvement?
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
Nebuleon !!!

sorry, I forgot all about this from back when you had just gotten the source code from Supercard. I stumbled upon it tonight and damn ... Beta 8 already. Just tried it out on a few staple games, and was blown away!!!! Once again you've made the DSTwo do what we were told it would do all along. I thank you.

But ... ummm... sorry for asking but, Mario Power Tennis is IMHO the only fun Mario Tennis game in existence, and its unplayable. Any chance it'll see improvement?
First, what do you mean by unplayable?

Second, what blew you away about TempGBA compared to NDSGBA?
 

Hanafuda

Well-Known Member
Member
Joined
Nov 21, 2005
Messages
4,509
Trophies
2
XP
6,990
Country
United States
First, what do you mean by unplayable?

Second, what blew you away about TempGBA compared to NDSGBA?


First -- just slow framerate, stuttering sound. To be fair, I haven't actually gotten as far as playing tennis - the RPG elements of the game take a while before you get to that point. But just in getting through the first screens, it's pretty bad compared to everything else I've tried so far. Maybe it's a game_config issue, but I wouldn't know what to do to fix it. And by the way, I tried Mario Golf (also Camelot) and it seems fine.

Maybe I have a bad dump? I don't think so - I've used the same rom on my EFA Linker cart and it played 100%.

Second - are you kidding? It works now haha. So far I've messed with Mario Kart, Yoshi's Island, Metal Slug, M&L SS, Golden Sun, and a number of other games, and I have to say this may be the best GBA emulation experience I've ever encountered. I'm playing on DSi XL so the screen size is fantastic of course, but the only thing I've got to beat this is playing real carts (or my EFA Linker cart) on my AGS-101 GBA SP. Just excellent. On the other hand, besides the fact that some of those games simply wouldn't work on NDSGBA 1.21, practically all games on that emu had a lag feel to them. Controls just perceptibly out of synch, sound was crap, enjoyment was zilch. I'm LOVING this. My DSi is gonna be on the charger a lot, I think.
 

Deleted member 319809

MAH BOI/GURL
OP
Member
Joined
Dec 22, 2012
Messages
900
Trophies
0
XP
461
Country
Canada
First -- just slow framerate, stuttering sound. To be fair, I haven't actually gotten as far as playing tennis - the RPG elements of the game take a while before you get to that point. But just in getting through the first screens, it's pretty bad compared to everything else I've tried so far. Maybe it's a game_config issue, but I wouldn't know what to do to fix it. And by the way, I tried Mario Golf (also Camelot) and it seems fine.

Maybe I have a bad dump? I don't think so - I've used the same rom on my EFA Linker cart and it played 100%.
Mario Tennis: Power Tour, CRC32 DA192D29?

If so, I just started a game of that, and I got to the room where the girl is sleeping and left the music playing by itself. I noticed something odd:
* at the start of the loop, when there are few instruments, the FPS counter states 19 rendered, 58 emulated;
* when more instruments accumulate, the FPS counter states 5 rendered, 43 emulated.
I fear that there may be more of those sound output problems from CATSFC in TempGBA. But if I disable the sound (which prevents rendering to the DSTwo mix buffer, but not to the GBA's sound registers), the FPS doesn't rise again. Maybe it's related to timers being slow to emulate. I'll need to try more things when I have a debug/performance statistics menu coded.

Second - are you kidding? It works now haha. So far I've messed with Mario Kart, Yoshi's Island, Metal Slug, M&L SS, Golden Sun, and a number of other games, and I have to say this may be the best GBA emulation experience I've ever encountered. I'm playing on DSi XL so the screen size is fantastic of course, but the only thing I've got to beat this is playing real carts (or my EFA Linker cart) on my AGS-101 GBA SP. Just excellent. On the other hand, besides the fact that some of those games simply wouldn't work on NDSGBA 1.21, practically all games on that emu had a lag feel to them. Controls just perceptibly out of synch, sound was crap, enjoyment was zilch. I'm LOVING this. My DSi is gonna be on the charger a lot, I think.
I have to say I don't find much improvement yet with game compatibility, apart from those games I targetted specifically for an audio fix; are you sure you had downloaded game_config.txt when you used NDSGBA 1.21?

I also don't find much improvement in the audio department (!), but that may just be me being used to the SNES's rich sound. You might also be fooled by the twice-louder sound*. We need someone like, say, Rydian in here (ahem :P) to do some sound comparisons between NDSGBA 1.21 and TempGBA, and perhaps a real GBA.

I was just about to ask what you meant with your "controls just perceptibly out of synch" but I just compared NDSGBA 1.21 with TempGBA beta 8 after loading SMA2: Mario World, and I see what you meant. That's really odd, because I did nothing to improve the input synchronisation at all...

And finally, what really makes the emulator much better for me is how fast it loads itself and games, how I can touch the screen to quickly get to a submenu in the Main Menu's grid, and how it can fast-forward with a key. A minor mention for my remapping of all the keys in SMA2: Mario World so I can do everything SNES-style: dash with Y (GBA B), jump with B (GBA A), spin-jump with A (GBA R ?!?!). That counts as enjoyment for me - what about you?
_ _ _ _ _ _ _ _ _
* commit a7b5df0 increased the volume by a factor of two, because I saw that the maximum sample value didn't reach the full volume that 16-bit sound allows without clipping. (+1023 * 2⁴ = +16382, which is half of +32767).
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Veho @ Veho: Her boob is the cause of all this current shit :angry: