Gambatte 0.5.0-wip2 released

Announce new emulators, discuss which games run best under each emulator, and much much more.

Moderator: General Mods

Post Reply
sinamas
Gambatte Developer
Gambatte Developer
Posts: 157
Joined: Fri Oct 21, 2005 4:03 pm
Location: Norway

Post by sinamas »

Thristian wrote:How well-supported is the SDL front-end? Is it going to be developed further, or is it just a proof-of-concept for other people to work on who don't want to pick apart the Qt interface?
fwiw I've commited some changes to it since the release.
Thristian wrote:I built the SDL version of Gambatte on OS X, and had some issues - ideally anything that links against SDL would put
Code:
$(sdl-config --cflags)
into the compiler/pre-processor's command-line and
Code:
$(sdl-config --libs)
into the linker's command-line.
fixed in svn.
adventure_of_link wrote:sinamas: WERE there any special chips for the GB (save for the realtime clock, and even then pokemon gold/silver/crystal can still be played without the emulation)
Not to the extent of chips like SuperFx for the SNES, no.
creathceann wrote:Fast-forward fast-forwards only within the limits of the screen refresh, so if you have vsync enabled in a fullscreen 60 Hz mode then it'll do nothing. (Apart from muting the sound of course.)
With the DirectDraw engine?

Code: Select all

  369 int DirectDrawBlitter::sync(const bool turbo) {
...
  378   if (!turbo) {
  379           if (vblank && hz60) {
  380                   if (!(exclusive && flipping))
  381                           lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0);
  382           } else
  383                   BlitterWidget::sync(turbo);
  384   }
  385 
  386   const bool dontwait = exclusive && flipping && !(vblank && hz60 && !turbo);
Maybe some drivers sync on normal blits, or don't respect DDFLIP_DONOTWAIT/DDBLT_DONOTWAIT. It worked on the Intel laptop I worked on when I wrote that at least. I guess I might as well use DONOTWAT in all cases where fast-forward is active. It shouldn't make any difference besides skipped frames, which will make fast-forward faster and as such could be considered good anyway.
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

It's a bit strange. Here's a picture of my video modes: link

While using the first 640x480 in 60 Hz (which is the only frequency option) and Page flipping, the following applies:
- menu not visible: fast forward has no visible effect
- menu visible: fast forward goes as fast as possible

While using the second 640x480 in 120 Hz (70 Hz to 120 Hz possible) and Page flipping:
- menu not visible: fast forward speeds up the game to 200%
- menu visible: fast forward goes as fast as possible

Disabling Page flipping has fast forward always working.

I get screen tearing in the 120 Hz mode since the vsync doesn't apply, so it seems that if I want fast forward and no screen tearing I'll have to use the 60 Hz mode.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
byuu

Post by byuu »

Ah, I see.

Page flipping isn't possible with menus visible, because the menus rely on GDI. GDI is not aware of the video card flipping the video pointer. If the video pointer is flipped anyway, it will cause the menu to flicker.

If you want menus visible plus smooth video, you'll have to settle for vblank. Direct3D has an option to allow this, but in reality, the backend is just simulating page flipping through vsync for you. I'm not entirely sure what DirectDraw does at the moment, but based on what you've posted, it looks like it's completely bypassing page flipping when the menus are enabled and blitting right away.

As for the effects when the menu is not visible ... not sure.
DataPath
Lurker
Posts: 128
Joined: Wed Jul 28, 2004 1:35 am
Contact:

Post by DataPath »

I'm not very familiar with the GDI API, but can you have it render/draw to a buffer or surface that you could composite yourself over the emulation to produce the same result without having to mess with the other stuff?
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

hey sinamas, is "Zelda: Oracle of Seasons/Ages" fully playable without it freezing up?

i've tried "kigb, bgb, visualboyadvance, visualboyadvance (nitsuja) and no$gmb"

all resulted in a freeze around the 6th/7th dungeon... and you would think the rom i got is bad. how do i check if the roms i got are good or bad dumps?
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

Maybe it's possible to extend the "sync to vertical blank in 60 Hz modes" to 120 Hz as well, by ignoring every 2nd retrace.

Thanks for the explanation byuu.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
sinamas
Gambatte Developer
Gambatte Developer
Posts: 157
Joined: Fri Oct 21, 2005 4:03 pm
Location: Norway

Post by sinamas »

creaothceann:
It looks like your video driver disregards DDFLIP_DONOTWAIT to a certain extent. I could probably work around it somehow, but it wouldn't be very pretty. Page Flipping is only active when DirectDraw has the entire screen to itself. I'm actually pretty much reiniting DirectDraw whenever that changes.

Supporting sync to vblank in 120 Hz modes looks like it could be hard to do without hacks, when page flipping isn't active. For the case where page flipping _is_ active, it should be quite possible. It's done in the OpenGL engine, but I think driver support for OpenGL sync to vblank is a bit worse than for DirectDraw in general.

I'll fix the messed up video mode listing.

franpa:
I played pretty far in those games some time back, but I didn't count dungeons. There exists a GoodGB util here http://www.retrogames.com/cowering.html , but I haven't tried it. I think bgb warns you if the checksum in the header fails at least. Of course, that could have been edited. If the ROM is good, it looks like you might have found a previously unknown bug in many emulators.

edit: wrong url
Last edited by sinamas on Wed Aug 29, 2007 10:26 am, edited 2 times in total.
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

nvidia drivers ignore the DDBLT_WAIT flag.

is that related lol?


and i think you meant this link. http://www.retrogames.com/cowering.html
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

sinamas wrote:Supporting sync to vblank in 120 Hz modes looks like it could be hard to do without hacks, when page flipping isn't active.
Mmmh. :?
sinamas wrote:DDFLIP_DONOTWAIT
Is that how you've implemented fast forwarding?

No need to fix the video mode list just for me. Maybe others with a more jumbled list might need it...

I should've mentioned that I'm using a NVidia GeForce2 MX/MX 400. (If that card is too old to support then just drop it.)
The option for vsync was set to "always on" (not "automatic" or "always off"), but setting it to "automatic" didn't change anything in the aforementioned behaviour.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
ReRuss
Trooper
Posts: 443
Joined: Sun Aug 15, 2004 9:49 pm
Location: Somewhere
Contact:

Post by ReRuss »

it's good to hear good things on a new emu , once it gets joypad support , I'll try it out for sure
[img]http://i5.photobucket.com/albums/y180/ReRuss/UBAR.gif[/img]
360 and PS3 - ReRuss
sinamas
Gambatte Developer
Gambatte Developer
Posts: 157
Joined: Fri Oct 21, 2005 4:03 pm
Location: Norway

Post by sinamas »

creaothceann wrote:
sinamas wrote:Supporting sync to vblank in 120 Hz modes looks like it could be hard to do without hacks, when page flipping isn't active.
Mmmh. :?
On second thought I think I have decent way of doing it after all.
creaothceann wrote:
sinamas wrote:DDFLIP_DONOTWAIT
Is that how you've implemented fast forwarding?
When page flipping is active, DDFLIP_DONOTWAIT is used unless sync to vblank is enabled and fast-forward is inactive.
creaothceann wrote:No need to fix the video mode list just for me. Maybe others with a more jumbled list might need it...
Already fixed in svn. It was definitely needed.
creaothceann wrote:I should've mentioned that I'm using a NVidia GeForce2 MX/MX 400. (If that card is too old to support then just drop it.)
It's not too old to support. Ideally every card supporting DirectDraw7 should work. I'll see if I can get some more testing of this done on more hardware combinations. The reason some of these options are disabled by default is that I haven't been able to test them on a great diversity of hardware combinations.


EDIT:
New release out.

Release notes:
http://sourceforge.net/project/shownote ... _id=535717
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Sorry this took so long, I should've done this when you first released, but better late than never.

My patch against revision 47: http://nsrt.edgeemu.com/gambatte-nach.patch
Added two casts to compile on x86-64.
Replaced ROM loading via fstream with a custom wrapper to get zip support.
Updated load menu.

Keep up the good work.

Edit:
I'm getting a segmentation fault when I beat Quint in Megaman II.
Enter this password:
X-XX
--X-
XXX-
X-X-
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

sinamas wrote:EDIT:
New release out.
:)
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
sinamas
Gambatte Developer
Gambatte Developer
Posts: 157
Joined: Fri Oct 21, 2005 4:03 pm
Location: Norway

Post by sinamas »

Thanks Nach, appreciated. I'm going to bed now, but I'll take a closer look at it tomorrow.

I wasn't able to reproduce the segfault on 32-bit linux (good thing the boss is easy).
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Okay I build a 32 bit build to double check, only happens in 64 bit.
Here's a backtrace:

Code: Select all

#0  LCD::bg_drawPixels<unsigned int> (this=0x6a8ec0, buffer_line=0x2aaaabeba800, xpos=8, end=160, scx=96, tilemap=0x6bbc90 "", tiledata=0x6bb3d0 "")
    at src/video.cpp:1346
#1  0x0000000000439a1e in LCD::dmg_draw<unsigned int> (this=0x6a8ec0, xpos=0, ypos=48, endX=160) at src/video.cpp:1026
#2  0x0000000000433e59 in LCD::do_update (this=0x6a8ec0, cycles=456) at src/video.cpp:886
#3  0x0000000000434578 in LCD::update (this=0x6a8ec0, cycleCounter=243221140) at src/video.cpp:914
#4  0x0000000000434f28 in LCD::getIfReg (this=0x6a8ec0, cycleCounter=0) at src/video.cpp:826
#5  0x000000000043188a in Memory::event (this=0x6a8ec0, cycleCounter=243221140) at src/memory.cpp:475
#6  0x0000000000428974 in CPU::process (this=0x6a8ec0, cycles=<value optimized out>) at src/cpu.cpp:2738
#7  0x000000000042eaa5 in CPU::runFor (this=0x2aaaabeba820, cycles=0) at src/cpu.cpp:46
#8  0x000000000040e5ac in GambatteQt::timerEvent ()
#9  0x00002ab86947e40c in QObject::event () from /usr/lib/libQtCore.so.4
#10 0x00002ab868a6f867 in QWidget::event () from /usr/lib/libQtGui.so.4
#11 0x00002ab868dafd42 in QMainWindow::event () from /usr/lib/libQtGui.so.4
#12 0x00002ab868a22239 in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#13 0x00002ab868a23f6e in QApplication::notify () from /usr/lib/libQtGui.so.4
#14 0x00002ab86946cb8a in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#15 0x00002ab86946fdc3 in ?? () from /usr/lib/libQtCore.so.4
#16 0x00002ab869497883 in ?? () from /usr/lib/libQtCore.so.4
#17 0x00002ab86949476f in ?? () from /usr/lib/libQtCore.so.4
#18 0x00002ab86ca98d93 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#19 0x00002ab86ca9c08d in ?? () from /usr/lib/libglib-2.0.so.0
#20 0x00002ab86ca9c5be in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#21 0x00002ab8694940ae in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#22 0x00002ab868ab224b in ?? () from /usr/lib/libQtGui.so.4
#23 0x00002ab869469e51 in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#24 0x00002ab869469fa6 in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#25 0x00002ab86946d340 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#26 0x00002ab868a21e10 in QApplication::exec () from /usr/lib/libQtGui.so.4
#27 0x0000000000411376 in main ()
Edit:
Also decided to get some valgrind data, these jump out as being important:

Code: Select all

==27758== Conditional jump or move depends on uninitialised value(s)
==27758==    at 0x43FE28: Wy::WyReader1::doEvent() (wy.cpp:34)
==27758==    by 0x43FF68: Wy::reset() (wy.cpp:92)
==27758==    by 0x43720A: LCD::LCD(unsigned char const*, unsigned char const*) (video.cpp:107)
==27758==    by 0x42FD7F: Memory::Memory(Interrupter const&) (memory.cpp:102)
==27758==    by 0x428888: CPU::CPU() (cpu.cpp:22)
==27758==    by 0x428655: Gambatte::Gambatte() (gambatte.cpp:23)
==27758==    by 0x4103C9: GambatteQt::GambatteQt(int, char const* const*) (in /home/nach/SVN/gambatte/gambatte_qt/bin/gambatte_qt)
==27758==    by 0x411362: main (in /home/nach/SVN/gambatte/gambatte_qt/bin/gambatte_qt)
==27758==
==27758== Conditional jump or move depends on uninitialised value(s)
==27758==    at 0x43F1A8: SpriteMapper::mapSprites() (sprite_mapper.cpp:51)
==27758==    by 0x43F3D8: SpriteMapper::reset() (sprite_mapper.cpp:115)
==27758==    by 0x436CB0: LCD::resetVideoState(unsigned, unsigned) (video.cpp:214)
==27758==    by 0x437474: LCD::LCD(unsigned char const*, unsigned char const*) (video.cpp:125)
==27758==    by 0x42FD7F: Memory::Memory(Interrupter const&) (memory.cpp:102)
==27758==    by 0x428888: CPU::CPU() (cpu.cpp:22)
==27758==    by 0x428655: Gambatte::Gambatte() (gambatte.cpp:23)
==27758==    by 0x4103C9: GambatteQt::GambatteQt(int, char const* const*) (in /home/nach/SVN/gambatte/gambatte_qt/bin/gambatte_qt)
==27758==    by 0x411362: main (in /home/nach/SVN/gambatte/gambatte_qt/bin/gambatte_qt)
I also get ~35 other errors which show your GUI and sound initialization is being built off of unset parameters.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
sinamas
Gambatte Developer
Gambatte Developer
Posts: 157
Joined: Fri Oct 21, 2005 4:03 pm
Location: Norway

Post by sinamas »

64-bit compile errors and probably the segfault are fixed in svn.

diff: http://folk.ntnu.no/aamas/gambatte/r47_48.patch

I'll look into the valgrind errors. Some of them are clearly harmless, but could be worth getting rid of to prevent real problems from drowning in noise.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

I just SVN'd up and rebuilt, still segfaulting in that spot.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
sinamas
Gambatte Developer
Gambatte Developer
Posts: 157
Joined: Fri Oct 21, 2005 4:03 pm
Location: Norway

Post by sinamas »

Hmm, how about this then?

diff: http://folk.ntnu.no/aamas/gambatte/r48_49.patch

Edit: probably not. I found something esle that could be the culprit.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Very good, I just beat the game, watching the ending now, seems revision 49 is good.

(BTW, you don't have to post diffs, I'm using SVN directly)

I also updated my patch against r49.
http://nsrt.edgeemu.com/gambatte-nach.patch

I also tweaked my fstream/zip wrapper if you want to use it more than I made Gambatte use it currently.


Edit:
That reminds me. What are you using to edit your files?
The å that you have in your name is automatically being converted to � when I save the file.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
sinamas
Gambatte Developer
Gambatte Developer
Posts: 157
Joined: Fri Oct 21, 2005 4:03 pm
Location: Norway

Post by sinamas »

Nach wrote:Very good, I just beat the game, watching the ending now, seems revision 49 is good.
Great. The other thing I suspected looked a bit sinister at first, but it turned out to be harmless.
Nach wrote:I also updated my patch against r49.
http://nsrt.edgeemu.com/gambatte-nach.patch
Commited to svn after some changes. Thanks again.
Nach wrote:That reminds me. What are you using to edit your files?
The å that you have in your name is automatically being converted to � when I save the file.
That å needs to die. I'm largely using kdevelop/kwrite. Some times vim. I think it saves to iso 8859-1 atm. Maybe I should switch to utf8.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

I'm using KATE/KWrite myself, so I'm not sure what the problem is, but yes, I have my system set to default to UTF-8.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
sinamas
Gambatte Developer
Gambatte Developer
Posts: 157
Joined: Fri Oct 21, 2005 4:03 pm
Location: Norway

Post by sinamas »

Hmm, for some reason gambatte_qt seems to have increased in size by ~50K since 0.1.1, not sure what's up with that. gambatte_sdl increased in size by a reasonable ~10K.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

I'm not sure about the size increase like that...
Tried stripping the files?

BTW, how do you build on Windows?
I also didn't check your posted archives, but what are you doing about the Windows builds? Statically linked? Include Qt DLLs?
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
sinamas
Gambatte Developer
Gambatte Developer
Posts: 157
Joined: Fri Oct 21, 2005 4:03 pm
Location: Norway

Post by sinamas »

The release version was built with -fno-rtti -fno-exceptions. That explains it.

It's statically linked to Qt on windows, yes. I disabled the unneeded Qt features I could find flags for and used -Os when building Qt. Not sure if it helped much. The Windows binary is compressed with upx. Before that it's almost 5 MB.

Edit:
The gambatte_qt 0.1.1 .deb I uploaded was partly broken. It was built without some important Qt defines. I've uploaded a new one.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Re: Gambatte 0.1.1 released

Post by pagefault »

sinamas wrote:*shameless plug*

Gambatte is an accuracy-focused, open-source, cross-platform Game Boy / Game Boy Color emulator written in C++. It is based on hundreds of corner case hardware tests, as well as previous documentation and reverse engineering efforts.

http://sourceforge.net/projects/gambatte
This is very good. Congrats on your emu.
Watering ur plants.
Post Reply