GTK/X11 Port (aka Linux/UNIX GUI)

This is for people involved in the developement of Snes9x, or SNES emulators in general.
BUG REPORTS BELONG IN TECH SUPPORT/BUG TRACKING!
Deathlike2
Snes9x Brown Belt
Posts: 1158
Joined: Mon Jan 10, 2005 6:34 am

Post by Deathlike2 »

indarios wrote:
BearOso wrote: Oops. I forgot to update the links here to point to the new version. Version 3 still reports version 2, so that's what you've probably got. Try downloading again to get the latest.

As Deathlike2 says, OpenGL might be slow because of your graphics chipset. Texture upload speed is the primary performance factor, but there still might be alternatives I can try to optimize it. Have you been able to get better OpenGL performance out of ZSnes or other emulators with OpenGL support?

Also, make sure you're not using filters with OpenGL on that i915. They're currently implemented in software, and the texture upload size will make weak cards choke.
This seems to be the problem, my graphics card isn't up to the task. I tried out version 5 and while using OpenGL i get 55-60 FPS (now with my filter off) but is around 20% more CPU intensive then when OpenGL i off and it is much worse with filters on.

I check out Zsnes but i never found anything for OpenGL only saw an option for GFX.
For ZSNES, you would have to compile with OpenGL support. Most distributed/packaged binaries do not include OpenGL support.
indarios
Snes9x White Belt
Posts: 4
Joined: Mon Nov 26, 2007 7:50 am

Post by indarios »

Deathlike2 wrote: For ZSNES, you would have to compile with OpenGL support. Most distributed/packaged binaries do not include OpenGL support.
Thats what happened, Im trying out fedora 8 (not really caring for binary distros too much, well this one anyway) and its been giving me nothing but problems.. no official zsnes RPM and keep having problems compiling. I might try it now though since i probably have the correct librarys now.

Oh i noticed another bug, I was trying to play super bomber man 3 with 2 joysticks (Super Smart Joy 2) and both joysticks were inputed into player 2, the game detects 2 players just fine though. Also when trying to configure the controllers both controllers set each others buttons.
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

indarios wrote: Oh i noticed another bug, I was trying to play super bomber man 3 with 2 joysticks (Super Smart Joy 2) and both joysticks were inputed into player 2, the game detects 2 players just fine though. Also when trying to configure the controllers both controllers set each others buttons.
What does the preferences screen say you're inputting for each joystick? Is it correctly reading Joystick 0 and Joystick 1 or are they both reporting the same number? Also, could you be more specific what you mean by setting each others' buttons?
indarios
Snes9x White Belt
Posts: 4
Joined: Mon Nov 26, 2007 7:50 am

Post by indarios »

BearOso wrote: What does the preferences screen say you're inputting for each joystick? Is it correctly reading Joystick 0 and Joystick 1 or are they both reporting the same number? Also, could you be more specific what you mean by setting each others' buttons?
I select controller #1 on the options and set all of the buttons using my remote and thats my first one decided by my system /dev/input/js0. Then when i got to controller #2 and configure it with my second remote (/dev/input/js1) it seems to work fine but when i go into a game both remote js0 and js1 will control player 2 simultaneously. Upon further review i notice that i can set the buttons on any of the controllers in the options with either the first or 2nd controller, and im guessing this is true if i had any more.. so it seems like its not linking js0 with the first controller and etc.. if this makes sense. Also i know the two controllers work since i can correctly set them up both in snes9x in the console and zsnes.

Ill add a few links to screenshots to what the 2 controllers look like in the options.. i know the button mapping are the same between the two since they are identical joysticks.

Image

Image

Edit: one other thing i noticed that bugs me is having to resize the window every time i start it up.. this probably only annoys me though : D.
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

indarios wrote:
BearOso wrote: What does the preferences screen say you're inputting for each joystick? Is it correctly reading Joystick 0 and Joystick 1 or are they both reporting the same number? Also, could you be more specific what you mean by setting each others' buttons?
I select controller #1 on the options and set all of the buttons using my remote and thats my first one decided by my system /dev/input/js0. Then when i got to controller #2 and configure it with my second remote (/dev/input/js1) it seems to work fine but when i go into a game both remote js0 and js1 will control player 2 simultaneously. Upon further review i notice that i can set the buttons on any of the controllers in the options with either the first or 2nd controller, and im guessing this is true if i had any more.. so it seems like its not linking js0 with the first controller and etc.. if this makes sense. Also i know the two controllers work since i can correctly set them up both in snes9x in the console and zsnes.

Ill add a few links to screenshots to what the 2 controllers look like in the options.. i know the button mapping are the same between the two since they are identical joysticks.

Image

Image

Edit: one other thing i noticed that bugs me is having to resize the window every time i start it up.. this probably only annoys me though : D.
Ok, I think I figured the problem out. I'll have a fix posted soon.
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

BearOso wrote:
indarios wrote: I select controller #1 on the options and set all of the buttons using my remote and thats my first one decided by my system /dev/input/js0. Then when i got to controller #2 and configure it with my second remote (/dev/input/js1) it seems to work fine but when i go into a game both remote js0 and js1 will control player 2 simultaneously. Upon further review i notice that i can set the buttons on any of the controllers in the options with either the first or 2nd controller, and im guessing this is true if i had any more.. so it seems like its not linking js0 with the first controller and etc.. if this makes sense. Also i know the two controllers work since i can correctly set them up both in snes9x in the console and zsnes.

Ill add a few links to screenshots to what the 2 controllers look like in the options.. i know the button mapping are the same between the two since they are identical joysticks.

Edit: one other thing i noticed that bugs me is having to resize the window every time i start it up.. this probably only annoys me though : D.
Ok, I think I figured the problem out. I'll have a fix posted soon.
Version 6 is posted and should fix this problem. Previously I was using linux native and then libjsw joystick code, both of which had event queues for individual joysticks. SDL slaps them all together, and I forgot to multiplex the events out to each one.

*edit* BTW, I changed the joystick numbering. Don't forget to reassign your buttons.
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

I've uploaded Version 7. Changes are in the first post.
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

Another small version bump. Changes in the first post again.
jippen
Snes9x White Belt
Posts: 2
Joined: Fri Nov 23, 2007 6:28 am

Post by jippen »

BearOso wrote:I've posted a new version. This fixes jippen's issues.

Features I'm working on are threaded graphics for the next version, and NetPlay sometime later.
I just got back to this after doing my best to survive the end of the college semester. I'd just like to say thanks a bunch for that. Works great!
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

Version 9 is now available. Now implemented are the basic movie features that the original unix port had. PBO support may help OpenGL speed for some video card drivers, but there's still a couple optimizations left to make using it.
orakim
Snes9x White Belt
Posts: 6
Joined: Fri Jul 21, 2006 5:39 pm

Post by orakim »

Thx for develop the GUI. It's Great!
Could you add "Custom Save Folder" at "Files" > "Game Data" ?
I save sram neither "Rom Folder" nor "Snes9X configuration Folder".
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

orakim wrote: Could you add "Custom Save Folder" at "Files" > "Game Data" ?
Thanks for the feedback. I've posted version 10 which includes this feature.
jetfire4
Snes9x White Belt
Posts: 6
Joined: Sat Jan 05, 2008 2:20 am

steps I had to take 2 get snsgtk installed on fedora 7 4 ps3

Post by jetfire4 »

I did a straightforward installation of fedora 7 of ps3, updates installed too. This is what I had to do to get snes9x-gtk configured with the dependencies. First, to take care of the PKG_CONFIG error it wasn't seeing my glibc and libglade, ect. I typed "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig. Took care of that

2nd, there is only one beta of portaudio 1.9 that will work with fedora 7's glibc 2.6, which is portaudio-19-1.fc8 otherwise if you use 19-2 19-3 or 19-4 youll have to go up to fedora 8 because those only work with glibc 2.7. Here's the link to download it http://koji.fedoraproject.org/koji/rpminfo?rpmID=100661 The portaudio 1.9 linked from this snes page didn't install it for me when i ran all the configure make install commands.

Plus, its nice to have kernel 2.6.23.8-34 which has the /dev/dsp sound file so you don't have to do any special configurations. I've seen alot of questions about this around other forums but not many straightforward answers. This is on a basic fedora 7 ps3 installation, not exactly sure if this is the right forum to post on, but hope this helps.
The Jedi
Snes9x White Belt
Posts: 2
Joined: Sat Jan 05, 2008 1:09 pm
Location: Bordeaux, France

Post by The Jedi »

Hello !

Thanks a lot for your GTK2 port, it's really nice.
I wonder why you did not use SDL as unique depedency : video, audio and joystick ?
It's solely a point of view for someone who wants to install Snes9x with as less dependencies as possible. I don't know your point of view of developer and I respect it.

Good luck :) nice to see more and more port of emulators on MacOS X/Linux/gaming devices.
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

The Jedi wrote: I wonder why you did not use SDL as unique depedency : video, audio and joystick ?
The reasons I didn't use SDL for video and audio are as follows:

Video: SDL takes complete control of the window creation and event handling. Therefore, I'd have to convert between SDL's interpretation of window events and keystrokes and GTK's from the GUI (note that joystick events, however, aren't trapped by individual X windows). Plus, there'd be separate windows for the GUI and game.

Sound: SDL uses millisecond-based timing internally. If the sound buffer runs out halfway through SDL's millisecond based buffer fills (as it happens, a 60hz frame is 16 2/3 milliseconds, not an even number), we get an underrun and ugly sound output.

Initially, I wasn't using SDL at all. I was using libjsw for joystick, only to discover that it wasn't really as cross-platform as it advertises. I pondered writing my own portable joystick library, but figured at the least, SDL couldn't screw up joystick support, and most operating systems would probably have it installed by default.

Coincidentally, I'd written and had been using a personal port of Snes9x to SDL before I did this one.
The Jedi
Snes9x White Belt
Posts: 2
Joined: Sat Jan 05, 2008 1:09 pm
Location: Bordeaux, France

Post by The Jedi »

OK fine I understand better ;) Thanks for the explaination.
Enji
Snes9x White Belt
Posts: 5
Joined: Sun Jan 06, 2008 2:15 pm

Post by Enji »

Hey there, I seem to have a problem with enabling OpenGL. I downloaded the patched source from the original post and compiled it as per instructions making sure to have --with-gtk and --with-opengl but whenever I try to activate OpenGL in the gui it crashes when I save it.

upon running from terminal I get this:

JACK tmpdir indentified as [/dev/shm]
Segmentation fault

doesn't matter if I run in normal user or root (not that it should anyway)

running Fedora 8 with a GeForce 4 MX 440 card with the nvidia proprietary video drivers installed.

other information (if it matters)

AMD Athalon XP 2600+
512 MB DDRAM
Logitech USB Dual Action gamepad

Kernel 2.6.23.9-85.fc8
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

Enji wrote:Hey there, I seem to have a problem with enabling OpenGL. I downloaded the patched source from the original post and compiled it as per instructions making sure to have --with-gtk and --with-opengl but whenever I try to activate OpenGL in the gui it crashes when I save it.

upon running from terminal I get this:

JACK tmpdir indentified as [/dev/shm]
Segmentation fault

doesn't matter if I run in normal user or root (not that it should anyway)

running Fedora 8 with a GeForce 4 MX 440 card with the nvidia proprietary video drivers installed.

other information (if it matters)

AMD Athalon XP 2600+
512 MB DDRAM
Logitech USB Dual Action gamepad

Kernel 2.6.23.9-85.fc8
I'll look into this.

Can you see if it crashes on startup if you edit $HOME/.snes9x/snes9x.xml and change the "use_opengl" option to 1

*edit*
I've posted a version 10c that has better support for pixel buffers on older cards and fixed a bug if they aren't supported. If this doesn't fix your problem, or you didn't have them enabled, it would be helpful to have a backtrace of your crash. To do this I need you to do the following:

1. Build snes9x with the --with-debug flag to configure in addition to your other flags.
2. Run gdb on the snes9x-gtk binary, i.e.

Code: Select all

$ gdb snes9x-gtk
(gdb) run
3. When the application crashes, get a backtrace, i.e.

Code: Select all

(gdb) bt
4. Post the printed info here.

I apologize in advance if you're a developer and already know how to generate a backtrace. :wink:
Enji
Snes9x White Belt
Posts: 5
Joined: Sun Jan 06, 2008 2:15 pm

Post by Enji »

Nope I didn't. I'm merely an average joe trying to give windows the boot.

Anyways it doesn't crash in 10c but instead freezes. I did a backtrace and this is what it gave me:

#0 0x03f7cf10 in ?? ()
#1 0x00192cf7 in gdk_gl_get_proc_address ()
from /usr/lib/libgdkglext-x11-1.0.so.0
#2 0x082c9eff in S9xOpenGLDisplayDriver::swap_control (this=0x9bbab90,
enable=1) at gtk/gtk_display_driver_opengl.cpp:721
#3 0x082ca562 in S9xOpenGLDisplayDriver::init (this=0x9bbab90)
at gtk/gtk_display_driver_opengl.cpp:702
#4 0x082524ea in S9xInitDriver () at gtk/gtk_display.cpp:813
#5 0x082545e0 in Snes9xPreferences::get_settings_from_dialog (this=0x9b04f00)
at gtk/gtk_preferences.cpp:912
#6 0x08254980 in Snes9xPreferences::show (this=0x9b04f00)
at gtk/gtk_preferences.cpp:1006
#7 0x08254cfb in snes9x_preferences_open (widget=0x98bb708, data=0x9848a48)
at gtk/gtk_preferences.cpp:244
#8 0x057f9409 in g_cclosure_marshal_VOID__VOID ()
from /lib/libgobject-2.0.so.0
#9 0x057ebf83 in g_closure_invoke () from /lib/libgobject-2.0.so.0
#10 0x057fc48d in ?? () from /lib/libgobject-2.0.so.0
#11 0x057fd997 in g_signal_emit_valist () from /lib/libgobject-2.0.so.0
#12 0x057fdb59 in g_signal_emit () from /lib/libgobject-2.0.so.0
#13 0x0721dcd9 in gtk_widget_activate () from /usr/lib/libgtk-x11-2.0.so.0
#14 0x070ab74a in gtk_menu_shell_activate_item ()
from /usr/lib/libgtk-x11-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#15 0x070aa229 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#16 0x098b0500 in ?? ()
#17 0x098bb708 in ?? ()
#18 0x00000001 in ?? ()
#19 0x05808891 in g_type_check_instance_cast () from /lib/libgobject-2.0.so.0
#20 0x0709d6b8 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#21 0x098b0500 in ?? ()
#22 0x0983d328 in ?? ()
#23 0xbf90f6f8 in ?? ()
#24 0x05822674 in ?? () from /lib/libgobject-2.0.so.0
#25 0xbf90f990 in ?? ()
#26 0x0984bec0 in ?? ()
#27 0xbf90f6f8 in ?? ()
#28 0x057e92f1 in g_value_get_boxed () from /lib/libgobject-2.0.so.0
#29 0x07092030 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#30 0x098b0500 in ?? ()
#31 0x0983d328 in ?? ()
#32 0x098403c8 in ?? ()
#33 0x05822674 in ?? () from /lib/libgobject-2.0.so.0
#34 0x0709d530 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#35 0x0984bec0 in ?? ()
#36 0x098b0500 in ?? ()
#37 0x098403c8 in ?? ()
---Type <return> to continue, or q <return> to quit---
#38 0xbf90f97c in ?? ()
#39 0x0984cab0 in ?? ()
#40 0xbf90f768 in ?? ()
#41 0x00000001 in ?? ()
#42 0x05822674 in ?? () from /lib/libgobject-2.0.so.0
#43 0xbf90f97c in ?? ()
#44 0xbf90f768 in ?? ()
#45 0x057ea779 in ?? () from /lib/libgobject-2.0.so.0
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

*edit* I tried to enable opengl in the xml file like you suggested initially and it crashes on start up.
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

Enji wrote: #0 0x03f7cf10 in ?? ()
#1 0x00192cf7 in gdk_gl_get_proc_address ()
from /usr/lib/libgdkglext-x11-1.0.so.0
#2 0x082c9eff in S9xOpenGLDisplayDriver::swap_control (this=0x9bbab90,
enable=1) at gtk/gtk_display_driver_opengl.cpp:721
Ok, from this, it seems there's a bug in gdk_gl_get_proc_address from the unfortunately unmaintained gtkglext. I've added a hacked-up version 10d, which should get things going for you. If this works OK, try out the pixel-buffer objects option to see if it causes the same crashes.
Post Reply