• HomeBoards
  • RulesRules
  • HelpHelp
  • WikiWiki
  • Donate

Author Topic: gnuboy for OpenDingux  (Read 12272 times)

pcercuei (OP)

  • Posts: 1720
    • My devblog
gnuboy for OpenDingux
« on: September 28, 2011, 08:17:01 pm »
Hi.

Looks like OD is lacking a GBC emu, so here is one.
It does not have all the features of Oh-Boy or Gnuboy4D but it does its job.

Please note:
- it does not have auto-frameskip. This has been disabled on purpose to get a perfect sound output, and was kinda useless anyway (all the games do reach 60fps without overclock).
- there is no fast-save/fast-load, but the emulator saves the SRAM (and the saves are compatible with gnuboy4d).
- Press L to quit the emulator.

Download here.

If you don't like it, please spam clach04's mailbox and ask for a port of Oh-Boy :D

Hagane023

  • Posts: 179
Re: gnuboy for OpenDingux
« Reply #1 on: October 03, 2011, 05:07:43 pm »
I've got a problem with metal gear and a few other gbc roms. They play first time round but after that the roms /gmenu freeze on the launcher. Any ideas? Gnuboy4d works but sound is strange and couldn't be changed in the menu(vol). Also had issues with changing overclock in emulators_ would work only from settings on gmenu.

ace9094

  • Posts: 766
Re: gnuboy for OpenDingux
« Reply #2 on: October 04, 2011, 04:48:37 pm »
Looking forward to trying all these new ports :)

Thank you
Dingoo A320, GCW0, RS-97 x2, Revo-K101, RS-90, PSP, GameGadget, New 3DS 128GB, PS Vita 200GB, RS-45, Gamebox Advance and a few other obscure devices

hi-ban

  • Posts: 889
Re: gnuboy for OpenDingux
« Reply #3 on: October 26, 2011, 10:40:27 am »
Is the source code available to download?
i want to take a look at it, as well as the makefile, because i want to port OhBoy to Opendingux.

Thanks in advance!

pcercuei (OP)

  • Posts: 1720
    • My devblog
Re: gnuboy for OpenDingux
« Reply #4 on: October 26, 2011, 12:36:36 pm »

Skyline969

  • Posts: 279
Re: gnuboy for OpenDingux
« Reply #5 on: December 31, 2011, 05:49:46 am »
This one seems to immediately crash to gmenu2x for me. I'm running the developer preview 2 of OpenDingux, and all other emulators but this one work. I copied the files and added a link to launch the .dge file, but when I do it immediately crashes. I've tried re-downloading, that didn't seem to help. Should I be launching the .rc? Doesn't seem logical to do that....

EDIT: Aha, so I need to enable the selector browser, then set the directory for the selector to enter. That should be documented somewhere.
« Last Edit: December 31, 2011, 06:15:17 am by Skyline969 »

bloodyred

  • Posts: 7
Re: gnuboy for OpenDingux
« Reply #6 on: January 01, 2012, 05:05:50 pm »
The emulator works really well and I've been playing the legend of zelda link's awakening since I haven't played it in over 10 years.

Not having state save really bums o well I wish I could figure out how to port stuff and i would work on my own emulators.


EDIT: Aha, so I need to enable the selector browser, then set the directory for the selector to enter. That should be documented somewhere.

Thanks for the tip
I haven't used my dingoo in like a year so I forgot you had to do that

How to add gnuboy to the emulator section
1. Go to the emulators section
2. Click Select and pick Add link in emulators
3. Navigate to where you put gnuboy and push A to place it in emulators section

How to start gnuboy
1. Push select when highlighting gnuboy and pick Edit gnuboy
2. Scroll down to Selector Browser and make sure it says ON
3. Scroll up to Selector Directory and Navigate to your roms folder and push start
4. Push start one more time and now when you run gnuboy you'll be able to pick your roms

Thanks for the great emulator


« Last Edit: January 03, 2012, 05:06:09 am by bloodyred »

clach04

  • Posts: 257
Re: gnuboy for OpenDingux
« Reply #7 on: March 24, 2012, 12:33:15 am »
http://crapouillou.net/~paul/gnuboy-src.tar.gz

I've generated diffs and attached to a new issue http://code.google.com/p/gnuboy/issues/detail?id=5

I'm not sure what the new mixer code does (sound.c), can you explain it a little please?

Thanks!

pcercuei (OP)

  • Posts: 1720
    • My devblog
Re: gnuboy for OpenDingux
« Reply #8 on: March 27, 2012, 11:08:38 pm »
I'm not sure what the new mixer code does (sound.c), can you explain it a little please?

As you can see in sys/sdl/sdl.c, the use of the pcm_submit() function is just to synchronize emulation on the sound output, to force the emulator to respect the 60fps limit. The current implementation puts the main thread to sleep for 4ms if the audio hasn't been pushed yet. The problem here is that there is absolutely no way to tell how many time the main thread will actually sleep. It is only guaranteed to be 4ms minimum, but there's no maximum.

On the current SDL version of gnuboy, if the SDL_Sleep(4) snoozes the main thread for too much time, gnuboy won't have enough time to re-fill completely the sound buffer before the audio_callback function pops again. As a result, the sound buffer will still contain some data from the previous audio frame, and the sound will be distorted.

My patch contains two changes to fix that:
  • First, the pcm_submit() function is synchronized with the audio_callback() one using a mutex. As soon as the audio data is pushed and the mutex is unlocked, the main thread is marked as "ready" again, and will be executed probably as soon as SDL is done with audio_callback(). This reduces a lot the latency as it doesn't sleep.
  • The second change is to finish to fill the sound buffer if needed, on the audio_callback() function. This guarantees that even if the sound buffer is not completely filled when audio_callback() shows, the sound sample sent to the hardware won't contain any outdated data. As a result, the sound received by the hardware is the exact copy of the sound sent by the gameboy.

The implementation is a bit crappy, I apologize for that. First, sound_mix() and sound_mix2() should be merged. Then, SDL does provide a couple of functions to handle semaphores (SDL_SemWait / SDL_SemPost) which would be better to use in order to keep gnuboy portable to all SDL-enabled platforms.

 

Post a new topic