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!
Screwtape
Snes9x White Belt
Posts: 49
Joined: Thu May 26, 2005 12:59 pm

Post by Screwtape »

BearOso wrote:
Screwtape wrote: Doing a little more testing, I have noticed that when the problem occurs, my Xorg.0.log file fills up with "mieqEnequeue: out-of-order valuator event; dropping.". A quick google reveals that this happens sometimes to people running some recent X.org versions - regardless of video-card or Linux distribution.

Thanks for looking into it for me, anyway. :)
I'm glad the problem isn't on my end, because unfortunately I have little recourse to fix it. Nonetheless, I've posted a revision 42 with a fix to the issue I was thinking was the cause, and might somehow be related. I hope you manage to solve the problem on your end. :(
An update!

I switched to nouveau the other day, and tried snes9x-gtk again. This time XVideo works smooth as butter... except that everything is shaded blue - it looks like it's setting the blue component of every pixel to 255 and leaving the rest alone. Ah well. :(
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

Screwtape wrote: An update!

I switched to nouveau the other day, and tried snes9x-gtk again. This time XVideo works smooth as butter... except that everything is shaded blue - it looks like it's setting the blue component of every pixel to 255 and leaving the rest alone. Ah well. :(
I'm actually working on that very issue. The Xv color conversion code is severely broken. You can expect a fix in a day or so.
Screwtape
Snes9x White Belt
Posts: 49
Joined: Thu May 26, 2005 12:59 pm

Post by Screwtape »

BearOso wrote:*edit *edit** Another new version is up that just implements the feature you wanted without being done in a roundabout way. :-)
(if you have problems with this approach, you might want to investigate the "xdg-screensaver" command, in the "xdg-utils" package)
Screwtape
Snes9x White Belt
Posts: 49
Joined: Thu May 26, 2005 12:59 pm

Post by Screwtape »

BearOso wrote:I'm actually working on that very issue. The Xv color conversion code is severely broken. You can expect a fix in a day or so.
Seriously, dude, you're making every other software developer on the planet look bad by comparison. ;)
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Revision 46

Post by BearOso »

The revision 46 I promised is posted. This fixes the Xv driver to use the color information Xv provides.

Screwtape, you might need to use the newly-added inverted ordering option to get correct colors. I'm testing with the radeon driver on PPC, and X claims to want system byte-ordering, but for Xv the graphics card seems to need little-endian.
Screwtape
Snes9x White Belt
Posts: 49
Joined: Thu May 26, 2005 12:59 pm

Re: Revision 46

Post by Screwtape »

BearOso wrote:The revision 46 I promised is posted. This fixes the Xv driver to use the color information Xv provides.

Screwtape, you might need to use the newly-added inverted ordering option to get correct colors. I'm testing with the radeon driver on PPC, and X claims to want system byte-ordering, but for Xv the graphics card seems to need little-endian.
Got it in one - With Xv mode and "invert" turned on, it all works beautifully. Thanks!
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Revision 47

Post by BearOso »

I've put up a new revision with several micro-optimizations to the OpenGL output. Coupled with the last revision removing the 565 format, non-pbo transfers rates should be improved dramatically.

The "full"-source tarball no longer includes the port directories distributed with the main Snes9x sources. Reposting this same source over and over is redundant, and this cut saves valuable space and transfer time. Said tarball is primarily a convenience for users of this port, so I doubt anyone will mind.
deniseweird
Snes9x White Belt
Posts: 41
Joined: Wed Feb 20, 2008 9:38 am

Post by deniseweird »

There are some strange colours when I have the NTSC filter enabled now. I don't remember it being like this a version or two ago. I attached a screenshot:
Image
If you look at the numerals here you should be able to see what I mean. Maybe this is just standard behaviour, but I don't remember it being like this before.
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

deniseweird wrote:There are some strange colours when I have the NTSC filter enabled now. I don't remember it being like this a version or two ago. I attached a screenshot:
Image
If you look at the numerals here you should be able to see what I mean. Maybe this is just standard behaviour, but I don't remember it being like this before.
No, this definitely looks wrong. I had to change the NTSC filter for the different color format, but I might not have gotten it quite right. From what I tested, everything was OK.

Can you tell me whether this is limited to certain video settings or only appears at certain points in the game? If so, can you produce a save state from when the funky colors appear?

*Edit* Never mind. A new revision is posted that should solve this issue.
deniseweird
Snes9x White Belt
Posts: 41
Joined: Wed Feb 20, 2008 9:38 am

Post by deniseweird »

Damn, you were faster again. :D The problem with colours seemed to be pretty frequent and not related to any settings afaik. But it works like it should now anyway.
terran
Snes9x White Belt
Posts: 3
Joined: Sat Jul 19, 2008 7:58 am

Post by terran »

thanks for the screen saver fixes bearoso :)

One more request...do you know if there's been a change in the gtk code which handles the joystick configuration menu? I have a setup that doesn't have a mouse. I used to be able to use the tab-key to switch between button configuration boxes, but now if I hit tab, it ends up mapping the gamepad button to "tab." Not quite sure if there's a better UI flow...possible suggestions could be:
1) don't start grabbing input device output until you trigger with an "enter" key or something.
2) Make "ctrl-tab" or something flip between input-config boxes.
3) Disallow using tab as a key.

3 is not super ideal. 2 has kinda bad usability, but 1 probably takes the most work.

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

Post by BearOso »

terran wrote:thanks for the screen saver fixes bearoso :)

One more request...do you know if there's been a change in the gtk code which handles the joystick configuration menu? I have a setup that doesn't have a mouse. I used to be able to use the tab-key to switch between button configuration boxes, but now if I hit tab, it ends up mapping the gamepad button to "tab." Not quite sure if there's a better UI flow...possible suggestions could be:
1) don't start grabbing input device output until you trigger with an "enter" key or something.
2) Make "ctrl-tab" or something flip between input-config boxes.
3) Disallow using tab as a key.

3 is not super ideal. 2 has kinda bad usability, but 1 probably takes the most work.

tradeoffs, tradeoffs. :-/
Actually, this is a result of the fact that I switched to entries instead of buttons for the joystick assignments. This is because gtk buttons can't be counted on to update when their text changes--they're supposed to be static elements.

What I had in mind that I've intended to do for a while was to make the focus select the next entry when a key combo is entered. This would allow you to use just the keyboard to set the bindings, but you'd have to set them all in one go.

Right now, the escape key clears the selected binding. I've realized that there is little need to actually "unset" the assignment when it's already configured, so I could make escape either tab to the next input box or select the first item that isn't an entry. I'd be more inclined to take the latter approach.

Of your suggestions, I don't believe they're any more convenient. 1 adds extra work for those using a mouse. 2 would be too obscure a key-combo, and is used to switch notebook tabs already in gtk. For 3, I actually use tab myself, so that idea is out. :-)

To conclude, what I'm most likely to do is have the selection continue to the next box after a key combo is entered. Then I'll make the escape key act like the tab key whenever an entry is selected. Does that sound good to you?

*edit* I've posted revision 49. You can try it out for yourself and see if it's OK.
zerojay
Snes9x White Belt
Posts: 8
Joined: Mon Aug 04, 2008 1:02 pm

Post by zerojay »

I'm having some trouble launching ROMs in snes9x-gtk from the command line. If I attempt to do so, the SNES9x window pops up for a splitsecond and disappears without any error.

Attempting to run a debug build through GDB to get a backtrace just outputs "program exited normally".

I'm running this on my PS3 with Yellow Dog Linux 6 installed. Both the precompiled packages for the distro as well as compiling from source exhibits this behavior. I used --with-joystick --without-opengl --without-assembler as my ./configure flags.

SNES9X-GTK works perfectly running the exact same ROM if I start up the GUI first... but I can't use the GUI for this since I'm going to be using a frontend.

(I can post more details such as config.log or anything else needed once I get home from work tonight, if needed. Yes, I am using version 49.)

Any ideas?
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

zerojay wrote:I'm having some trouble launching ROMs in snes9x-gtk from the command line. If I attempt to do so, the SNES9x window pops up for a splitsecond and disappears without any error.

Attempting to run a debug build through GDB to get a backtrace just outputs "program exited normally".

I'm running this on my PS3 with Yellow Dog Linux 6 installed. Both the precompiled packages for the distro as well as compiling from source exhibits this behavior. I used --with-joystick --without-opengl --without-assembler as my ./configure flags.

SNES9X-GTK works perfectly running the exact same ROM if I start up the GUI first... but I can't use the GUI for this since I'm going to be using a frontend.

(I can post more details such as config.log or anything else needed once I get home from work tonight, if needed. Yes, I am using version 49.)

Any ideas?
Two questions:
First, does the ROM filename have spaces in it? The Snes9x core will not pull ROM names with spaces off the command-line correctly, but the GUI knows how to handle them. If this is the case, you can just rename the ROM and associated errata. Using alphanumerics only works best.

Second, are you trying to use any other options? Invalid options will cause the command-line parser to die and print a usage message, and this port doesn't provide most of the original unix options.
zerojay
Snes9x White Belt
Posts: 8
Joined: Mon Aug 04, 2008 1:02 pm

Post by zerojay »

BearOso wrote:
zerojay wrote:I'm having some trouble launching ROMs in snes9x-gtk from the command line. If I attempt to do so, the SNES9x window pops up for a splitsecond and disappears without any error.

Attempting to run a debug build through GDB to get a backtrace just outputs "program exited normally".

I'm running this on my PS3 with Yellow Dog Linux 6 installed. Both the precompiled packages for the distro as well as compiling from source exhibits this behavior. I used --with-joystick --without-opengl --without-assembler as my ./configure flags.

SNES9X-GTK works perfectly running the exact same ROM if I start up the GUI first... but I can't use the GUI for this since I'm going to be using a frontend.

(I can post more details such as config.log or anything else needed once I get home from work tonight, if needed. Yes, I am using version 49.)

Any ideas?
Two questions:
First, does the ROM filename have spaces in it? The Snes9x core will not pull ROM names with spaces off the command-line correctly, but the GUI knows how to handle them. If this is the case, you can just rename the ROM and associated errata. Using alphanumerics only works best.

Second, are you trying to use any other options? Invalid options will cause the command-line parser to die and print a usage message, and this port doesn't provide most of the original unix options.
Yes, pretty sure there are spaces in the ROM names. Nope, no other options being set on the command line. I'll try it out tonight and let you know.

What I don't understand is why plain 1.51 SNES9x can handle ROMs with spaces in them without an issue, but the GTK version can't.

And by the way, thank you so much for your work on this port. It's incredible.
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

zerojay wrote: Yes, pretty sure there are spaces in the ROM names. Nope, no other options being set on the command line. I'll try it out tonight and let you know.

What I don't understand is why plain 1.51 SNES9x can handle ROMs with spaces in them without an issue, but the GTK version can't.

And by the way, thank you so much for your work on this port. It's incredible.
If the plain Snes9x works, then it likely isn't the problem here. Since you mentioned having a debug build, and the program exits normally, you can probably find out where it's dying by breaking on the exit functions. This can be done like:

Code: Select all

$ gdb ./snes9x-gtk
(gdb) break S9xExit
(gdb) break exit
Make breakpoint pending on future shared library load? (y or [n]) y
(gdb) run "/path/to/rom/here.smc"
When the program breaks, get the stack trace like usual.

Code: Select all

(gdb) bt
Of course, you should definitely try the no spaces thing first and see if it IS the problem.
zerojay
Snes9x White Belt
Posts: 8
Joined: Mon Aug 04, 2008 1:02 pm

Post by zerojay »

I've removed the spaces from the zip files (leaving the spaces intact on the roms themselves) and it doesn't work.

I'll try to post a stack trace in a few minutes.

EDIT: Here's using a zip file with underscores replacing spaces, but the rom inside still using spaces.

Code: Select all

JACK tmpdir identified as [/dev/shm]
Starting sound
    --> (ALSA : default)...OK
Using ROM Super Mario Kart (USA).sfc in /home/jay/mount/ROMs/SNES/Super_Mario_Kart_(USA).zip
Map_HiROMMap
[New Thread 4137481392 (LWP 4592)]
[Thread 4137481392 (LWP 4592) exited]
[New Thread 4137481392 (LWP 4593)]
[Switching to Thread 4154573408 (LWP 4586)]

Breakpoint 1, S9xExit () at gtk/gtk_s9x.cpp:713
713         gui_config->save_config_file ();
(gdb) bt
#0  S9xExit () at gtk/gtk_s9x.cpp:713
#1  0x102386b4 in S9xHandlePortCommand (cmd=Cannot access memory at address 0x6
) at gtk/gtk_control.cpp:331
#2  0x100b72d0 in S9xApplyCommand (cmd=
        {type = 251 '?', multi_press = 0 '\0', button_norpt = 0 '\0', {button = {joypad = {idx = 0 '\0', toggle = 0 '\0', turbo = 0 '\0', sticky = 1 '\001', buttons = 0}, mouse = {idx = 0 '\0', left = 0 '\0', right = 0 '\0'}, scope = {fire = 0 '\0', cursor = 0 '\0', turbo = 0 '\0', pause = 0 '\0', aim_offscreen = 0 '\0'}, pointer = {idx = 0 '\0', speed_type = 0 '\0', UD = -1 '?', LR = 0 '\0'}, justifier = {idx = 0 '\0', trigger = 0 '\0', start = 0 '\0', aim_offscreen = 0 '\0'}, multi_idx = 100663296, command = 1536}, axis = {joypad = {idx = 0 '\0', invert = 0 '\0', axis = 3 '\003', threshold = 0 '\0'}, pointer = {idx = 0 '\0', speed_type = 0 '\0', invert = 1 '\001', HV = 1 '\001'}, button = {threshold = 6 '\006', negbutton = 0 '\0', posbutton = 0 '\0'}}, pointer = {aim_mouse0 = 0, aim_mouse1 = 0, aim_scope = 0, aim_justifier0 = 0, aim_justifier1 = 0}, port = "\006\000\000"}}, data1=0, data2=0) at controls.cpp:2045
#3  0x100b6e00 in S9xReportButton (id=553648130, pressed=false) at controls.cpp:1298
#4  0x10238f8c in S9xProcessEvents (block=<value optimized out>) at gtk/gtk_control.cpp:416
#5  0x1022fdac in S9xIdleFunc (data=<value optimized out>) at gtk/gtk_s9x.cpp:483
#6  0x0ec55158 in g_source_is_destroyed () from /lib/libglib-2.0.so.0
#7  0x0ec57914 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#8  0x0ec5b61c in g_main_context_check () from /lib/libglib-2.0.so.0
#9  0x0ec5ba84 in g_main_loop_run () from /lib/libglib-2.0.so.0
#10 0xf7cf6734 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#11 0x102303a8 in main (argc=2, argv=0xffc84764) at gtk/gtk_s9x.cpp:284
(gdb)                                                                    
I'll try it again with the zip and rom within having spaces removed soon.

EDIT: Just tried it with a ROM and ZIP that have all spaces removed. Didn't work. Also tried it with an unzipped ROM without spaces. Also does not work. On a whim, I thought that maybe the fact that my game is on a remote samba share could be causing the problem, but even when the ROM is local, it does not work.

I think we can say that loading ROMs from the command line is broken. :(
User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso »

zerojay wrote:I've removed the spaces from the zip files (leaving the spaces intact on the roms themselves) and it doesn't work.

I'll try to post a stack trace in a few minutes.

EDIT: Here's using a zip file with underscores replacing spaces, but the rom inside still using spaces.

Code: Select all

JACK tmpdir identified as [/dev/shm]
Starting sound
    --> (ALSA : default)...OK
Using ROM Super Mario Kart (USA).sfc in /home/jay/mount/ROMs/SNES/Super_Mario_Kart_(USA).zip
Map_HiROMMap
[New Thread 4137481392 (LWP 4592)]
[Thread 4137481392 (LWP 4592) exited]
[New Thread 4137481392 (LWP 4593)]
[Switching to Thread 4154573408 (LWP 4586)]

Breakpoint 1, S9xExit () at gtk/gtk_s9x.cpp:713
713         gui_config->save_config_file ();
(gdb) bt
#0  S9xExit () at gtk/gtk_s9x.cpp:713
#1  0x102386b4 in S9xHandlePortCommand (cmd=Cannot access memory at address 0x6
) at gtk/gtk_control.cpp:331
#2  0x100b72d0 in S9xApplyCommand (cmd=
        {type = 251 '?', multi_press = 0 '\0', button_norpt = 0 '\0', {button = {joypad = {idx = 0 '\0', toggle = 0 '\0', turbo = 0 '\0', sticky = 1 '\001', buttons = 0}, mouse = {idx = 0 '\0', left = 0 '\0', right = 0 '\0'}, scope = {fire = 0 '\0', cursor = 0 '\0', turbo = 0 '\0', pause = 0 '\0', aim_offscreen = 0 '\0'}, pointer = {idx = 0 '\0', speed_type = 0 '\0', UD = -1 '?', LR = 0 '\0'}, justifier = {idx = 0 '\0', trigger = 0 '\0', start = 0 '\0', aim_offscreen = 0 '\0'}, multi_idx = 100663296, command = 1536}, axis = {joypad = {idx = 0 '\0', invert = 0 '\0', axis = 3 '\003', threshold = 0 '\0'}, pointer = {idx = 0 '\0', speed_type = 0 '\0', invert = 1 '\001', HV = 1 '\001'}, button = {threshold = 6 '\006', negbutton = 0 '\0', posbutton = 0 '\0'}}, pointer = {aim_mouse0 = 0, aim_mouse1 = 0, aim_scope = 0, aim_justifier0 = 0, aim_justifier1 = 0}, port = "\006\000\000"}}, data1=0, data2=0) at controls.cpp:2045
#3  0x100b6e00 in S9xReportButton (id=553648130, pressed=false) at controls.cpp:1298
#4  0x10238f8c in S9xProcessEvents (block=<value optimized out>) at gtk/gtk_control.cpp:416
#5  0x1022fdac in S9xIdleFunc (data=<value optimized out>) at gtk/gtk_s9x.cpp:483
#6  0x0ec55158 in g_source_is_destroyed () from /lib/libglib-2.0.so.0
#7  0x0ec57914 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#8  0x0ec5b61c in g_main_context_check () from /lib/libglib-2.0.so.0
#9  0x0ec5ba84 in g_main_loop_run () from /lib/libglib-2.0.so.0
#10 0xf7cf6734 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#11 0x102303a8 in main (argc=2, argv=0xffc84764) at gtk/gtk_s9x.cpp:284
(gdb)                                                                    
I'll try it again with the zip and rom within having spaces removed soon.

EDIT: Just tried it with a ROM and ZIP that have all spaces removed. Didn't work. Also tried it with an unzipped ROM without spaces. Also does not work. On a whim, I thought that maybe the fact that my game is on a remote samba share could be causing the problem, but even when the ROM is local, it does not work.

I think we can say that loading ROMs from the command line is broken. :(
It seems what's happening here is that the key-binding for exiting the emulator is being pressed somehow. If the binding in Preferences->Shortcuts->Quit Snes9x is set, clear it by clicking it and pressing Shift-Escape. It says in the stack trace that you have it assigned to Joystick #1 Button 2.

I've seen something like this before, where, for instance, the enter key is assigned to exit, so after pressing the key to confirm the command-line, the key-up signal is received and the program immediately exits. If this isn't the case, then I'll have to do some investigation to figure out why in particular this occurs.

*edit*
I've posted revision 50. This institutes a couple of circumventions for the above, without forcing you to clear the shortcut. Let me know if this fixes the problem.
zerojay
Snes9x White Belt
Posts: 8
Joined: Mon Aug 04, 2008 1:02 pm

Post by zerojay »

Clearing the shortcut for exiting the emulator did indeed work. The odd thing here is that I had mapped Exit SNES9x to the R3 button on my PS3 Sixaxis (the button that activates when you press the stick INTO the controller and it clicks). I know I wasn't pushing it down, so it's a little odd, but I would imagine that using that sort of button is a very special/corner case anyways.

Thanks for coming to the rescue and you'll be glad to know that the SNES9x core does indeed handle spaces in filenames just fine. My mistake.

I'll give v50 a shot tomorrow.
orakim
Snes9x White Belt
Posts: 6
Joined: Fri Jul 21, 2006 5:39 pm

Post by orakim »

Could you add BlockInvalidVRAMAccess option?
Some hacked games need it to display correctly.

Following is it's location in Snes9X 1.51 windows version's snes9x.cfg

Code: Select all

[Settings]
BlockInvalidVRAMAccess    = FALSE
Post Reply