Lemonboy (Super/color Gameboy Emu)


Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,527
Location
Detroit, Michigan
Website
Visit site
Binary: http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,71,134
Source: http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,46,133

Features a number of new scalers such as Notaz's gpsp interpolation scaler, scale2x filter modes.
Supports internal overlocking at wiz speeds.
Sound is still a bit rough (if anyone wants to take a look, feel free as im stumped)
 
atomicthumbs said:
This looks good. You're gonna release it for the Pandora too, right? :p

It will be on pandora one way or another. I think juanvvc mentioned it, if not I could.
 
Last edited by a moderator:
Mmmh, I tried this on two WIZ: An 1.0.0 and an 1.1.0 one.
It runs too slow on both ones. Definately slower than the real GB should. I guess that's the reason the sound sounds a bit strange - it's also too slow :)

Clockspeed doesn't change anything, it runs as slow on 200MHz than it does at 500MHz.

Are you sure clockspeed is working? Or does the emulator itself have some timing bug making it run slower? (which would explain the slightly distorted sound)?
 
Yeah I noticed the slowness too. I think the sound is frameskipping due to the poor performance. It is a bit odd since many higher end systems are emulated much better on the Wiz like Megadrive and SNES. I would think that Gameboy should run with underclock at full speed and perfect sound due to the simplistic GB hardware. I guess the problem may be that it was ported from a fairly unoptimised emu designed to run on much more powerful PCs. GB emulation on the GP2X was never very good either.

Rlyeh's GB emu on the 133 MHz GP32 ran perfectly with great accurate sound. It is too bad he never releases the source code to his emus and he has stopped developing. That would be a much better codebase to start from I think.

Are there any other GB emus that could be ported that were made with low powered devices like handhelds in mind? Maybe something from the PSP or DS?
 
I ported gnuboy about a year ago, and also had the sound issue. Not being the least bit interested in emulators, I abandoned it as soon as I ran into the first problem (this one) but it was certainly not due to it running too slowly - when I removed the frame limit code it ran any game I tried on it several times faster than the original machine.
 
Orkie said:
I ported gnuboy about a year ago, and also had the sound issue. Not being the least bit interested in emulators, I abandoned it as soon as I ran into the first problem (this one) but it was certainly not due to it running too slowly - when I removed the frame limit code it ran any game I tried on it several times faster than the original machine.

So maybe this constant is wrong: static int framelen = 16666;

Edit: Ok the constant is right 1000/60, but if you look at the frame count it hovers around 50 fps. Im taking a look at the timer function in wiz_lib to verify they are correct and on the same scale.
 
Last edited by a moderator:
Pickle said:
So maybe this constant is wrong: static int framelen = 16666;

Try to remove the call to sys_sleep(delay) in emu.c, just to check. It is the only code that limits the frame time, I think. If it runs as hell (it does in Gp2x), then we have to review the framelimit code :)

Anyway, I definitely changed the framelen variable in this very version. The Gp2x is using framelen=16748. It should be a value close to 1,000,000/60.

I've considered to port GEST but it involves tons of work. Gnuboy runs reasonably ok, it is pretty easy to port and its performance is not the best but more than enough for little devices. In runs 95% of games at fullspeed in Gp2x at 200MHz, so it should run all games nearly perfect in Wiz at any speed. Unfortunately, the code of Gnuboy is hard to read, at least for me.
 
Last edited by a moderator:
Mine was running slow too but for me changing the clockspeed fixed it. I only tested this on Oracle of Ages though, so I don't know if any other games run poorly. The sound is still a little off but it's far from bad.
 
juanvvc said:
Pickle said:
So maybe this constant is wrong: static int framelen = 16666;

Try to remove the call to sys_sleep(delay) in emu.c, just to check. It is the only code that limits the frame time, I think. If it runs as hell (it does in Gp2x), then we have to review the framelimit code :)

Anyway, I definitely changed the framelen variable in this very version. The Gp2x is using framelen=16748. It should be a value close to 1,000,000/60.

I've considered to port GEST but it involves tons of work. Gnuboy runs reasonably ok, it is pretty easy to port and its performance is not the best but more than enough for little devices. In runs 95% of games at fullspeed in Gp2x at 200MHz, so it should run all games nearly perfect in Wiz at any speed. Unfortunately, the code of Gnuboy is hard to read, at least for me.

Taking out that line does remove any limit and runs as fast as the wiz clockspeed is. I think the wiz_lib timer method isnt correct. The timer read is using the function clock() which is the ticks since the game started. I think this is the reason for getting 50 fps rather than 60 fps.

Update: I take that back clock() should work fine, basically its the number of usec the program has run. I dont see why the fps is around 50 fps
 
Last edited by a moderator:
I have an alternative: VisualBoyAdvance. But it has some negatives, no frontend and much slower. Im going to tinker with it and see how it goes.

Update:

You can get it at pickle.gp2x.de/vba.zip
Ive included a gmenu file you can put in one of the gmenu sections. You should or course change any paths. This will act as ok frontend.
Press A+X+MENU+SELECT (or gameboy buttons A+B+SELECT+START if you remap buttons)
Look at the cfg file to change settings. A frameskip of 2 seems pretty good, if you could got to 1 with overclock
 
VisualBoyAdvance is extremely difficult to read (and then, enhance) and it is focused on GBA more than GB. On the other hand, it uses the SDL. GEST was a simplification of VisualBoyAdvance that should run better and it is way more understable, but it has only support for DirectX. I really think that Gnuboy is the way to go, but an "emulator fight" is really exciting and welcomed, and it can improve emulation in all senses.

In fact, I ripped the SGB support from VisualBoyAdvance as tou can see in supergb.c and CREDITS :D

BTW, maybe you can change the call to spend_cycles in the function wiz_timer_delay of wiz_lib for "do nothing". That is:

Code:
void wiz_timer_delay(clock_t ticks)
{
	clock_t ini=wiz_timer_read();
	while (wiz_timer_read()-ini<ticks);;
}

Or maybe reduce the time of spend_cycles to, I don't know, 256.
 
juanvvc said:
VisualBoyAdvance is extremely difficult to read (and then, enhance) and it is focused on GBA more than GB. On the other hand, it uses the SDL. GEST was a simplification of VisualBoyAdvance that should run better and it is way more understable, but it has only support for DirectX. I really think that Gnuboy is the way to go, but an "emulator fight" is really exciting and welcomed, and it can improve emulation in all senses.

In fact, I ripped the SGB support from VisualBoyAdvance as tou can see in supergb.c and CREDITS :D

BTW, maybe you can change the call to spend_cycles in the function wiz_timer_delay of wiz_lib for "do nothing". That is:

Code:
 void wiz_timer_delay(clock_t ticks)
 {
 	clock_t ini=wiz_timer_read();
 	while (wiz_timer_read()-ini<ticks);;
 }

Or maybe reduce the time of spend_cycles to, I don't know, 256.

I tried both of those ideas yesterday in the attempt to find out why the delay was off. I tried usleep in there too, but that made it worse.

Ive also found another gb emu called gngb its fast, the frame limiter if good, sound is shakey. This is C based using SDL. It actually has a built in menu, but it only changes some settings not select a rom.
 
Last edited by a moderator:
Pickle said:
Ive also found another gb emu called gngb its fast, the frame limiter if good, sound is shakey. This is C based using SDL. It actually has a built in menu, but it only changes some settings not select a rom.

It really looks nice. I considered gngb, but I can't remember why I finally chose Gnuboy. Anyway, keep in mind that if you like the menu in lemonboy, it should be easy to addapt to any other emulator. Including gngb, of course :)

On the other hand, I'm kind of specialized on menus for emulators :D It can't be difficult at all to adapt Fbacapex or the launcher of Stppc2x to Gngb. I'll vote for the Stppc2x launcher.
 
Last edited by a moderator:
juanvvc said:
Pickle said:
Ive also found another gb emu called gngb its fast, the frame limiter if good, sound is shakey. This is C based using SDL. It actually has a built in menu, but it only changes some settings not select a rom.

It really looks nice. I considered gngb, but I can't remember why I finally chose Gnuboy. Anyway, keep in mind that if you like the menu in lemonboy, it should be easy to addapt to any other emulator. Including gngb, of course :)

On the other hand, I'm kind of specialized on menus for emulators :D It can't be difficult at all to adapt Fbacapex or the launcher of Stppc2x to Gngb. I'll vote for the Stppc2x launcher.

Yeah messing with it now, the only issue I have is sound. The speed is right but the quality is bad.
It would be nice to add some gui's to these :)
 
Last edited by a moderator:
Rivroner, a user in gp32spain, comments that maybe the FPS limit of lemonboy is related to the same problem that Mame4all had with the new firmware. I don't know the details of that problem, but it seems that Mame4all was limited to 57FPS, and since lemon and mame share code... Did you test the notaz' util to configure the LCD timing and/or removing the vsync option?
 
juanvvc said:
Rivroner, a user in gp32spain, comments that maybe the FPS limit of lemonboy is related to the same problem that Mame4all had with the new firmware. I don't know the details of that problem, but it seems that Mame4all was limited to 57FPS, and since lemon and mame share code... Did you test the notaz' util to configure the LCD timing and/or removing the vsync option?

There no vsync, I at least commented out the line gp2x was using. I actually did mess with the lcd timer app last night, but not expecting it to fix the issue.
I think it has to come down to that clock() funtion, its all depending on that. Maybe it isnt as accurate as the gp2x hw counter that was used?
 
Last edited by a moderator:
Pickle said:
I think it has to come down to that clock() funtion, its all depending on that. Maybe it isnt as accurate as the gp2x hw counter that was used?

I agree with you. So, either we get direct access to that counter in the Wiz (I'm sure that it is somewhere in the memory, but we still have to figure out where), or we use sound to synchronize the emulation. The original Gnuboy used sound to sync in SDL, but the Gp2x and the wiz_lib use a separated thread that cannot be used for synchronization... or, at least, not directly.
 
Last edited by a moderator:
Back
Top