Post subject: [Request] Fix windows version for wine
Joined: 12/17/2004
Posts: 99
Location: Karlsruhe, Germany
Hi, as the windows version is nowadays so much better than the linux version (especially in regard to searching for memory values), I have tried to run it with wine and the feature I needed (cheat search) does not work. The bug for this things lies in both programs (as often the case): - Wine is a bit too trustful and exposes internal data structures to the programs and it does not rescue things from the stack as soon as the message dispatcher arrives back. - SNES9x on the other hand does change data structures it should not change and relies on data still being on the stack when the function returns ... Question now for nitsuja: Could you incorporate the following changes into a v10?
--- wsnes9x.cpp.old     2006-04-23 20:17:33.000000000 +0200
+++ wsnes9x.cpp 2006-04-23 20:20:36.000000000 +0200
@@ -6608,7 +6608,7 @@
                                                                nmlvdi->item.pszText=curr->rmbits;
                                                                nmlvdi->item.cchTextMax=11;
                                                        }
-                                                       nmlvdi->item.mask=LVIF_TEXT;
+                                                       // nmlvdi->item.mask=LVIF_TEXT; // This isbad as wine relies on this to not change.
                                                }
                                                break;
                                        case NM_DBLCLK:
@@ -9822,7 +9822,7 @@
                                NMHDR * nmh=(NMHDR*)lParam;
                                if(nmh->hwndFrom == GetDlgItem(hDlg, IDC_ADDYS) && nmh->code == LVN_GETDISPINFO)
                                {
-                                       TCHAR buf[12];
+                                       TCHAR* buf=new char[12]; // Or do anything else to have itactually not on the stack ...
                                        int i, j;
                                        NMLVDISPINFO * nmlvdi=(NMLVDISPINFO*)lParam;
                                        j=nmlvdi->item.iItem;
@@ -9945,7 +9945,7 @@
                                                nmlvdi->item.pszText=buf;
                                                nmlvdi->item.cchTextMax=4;
                                        }
-                                       nmlvdi->item.mask=LVIF_TEXT;
+                                       // nmlvdi->item.mask=LVIF_TEXT; // This is bad as wine relies on this not being changed

                                }
                                else if(nmh->hwndFrom == GetDlgItem(hDlg, IDC_ADDYS) && (nmh->code== LVN_ITEMACTIVATE||nmh->code == NM_CLICK))
This will also fix the other Fabian's problems with the memory watcher and will additionally also fix the open dialog under wine. cu Fabian PS: The first issue was reported to the wine team.
Player (70)
Joined: 8/24/2004
Posts: 2562
Location: Sweden
I second this. It would be awesome to see snes9x under wine. Right now I can't even load roms in it. Anyone had any better luck?
Active player (410)
Joined: 3/16/2004
Posts: 2623
Location: America, Québec
You could apply your changes and post it. Yes, no?
Player (70)
Joined: 8/24/2004
Posts: 2562
Location: Sweden
Well... I can't. I'm not a programmer. :D
Tub
Joined: 6/25/2005
Posts: 1377
Highness wrote:
Right now I can't even load roms in it. Anyone had any better luck?
yes, by passing the rom via command line. rom loading and the cheat thingy seem to be the only things I have trouble with. Set output scaling to "opengl" for a speed increase. Disable sound hardware acceleration in winecfg if your sound fails or stutters. I use a simple bash-script to start snes9x, adjust the paths as needed.
#!/bin/bash

ROM=$(ls -1 ~/wine_c_drive/snes9x/roms/*$1* | grep .smc | sed 's!.*/snes9x/roms/!!')
ROMC=$(ls -1 ~/wine_c_drive/snes9x/roms/*$1* | grep .smc | sed 's!.*/snes9x/roms/!!' | wc -l)

if [ "x$ROMC" == "x1" ] ; then
  echo "Using Rom: $ROM .."
  cd ~/wine_c_drive/snes9x/roms/
  wine "C:\\snes9x\\snes9x.exe" "C:\\snes9x\\roms\\$ROM"
  exit
fi

echo "not sure what ROM to use. Matching ROMs:"
echo "$ROM"
exit
run via: ./snes9x.sh Metroi*Redes*1.0 or something. well, either that, or configure your file manager to open .smc-files with snes9x.
m00
Former player
Joined: 3/23/2006
Posts: 211
what a hassle. Why do changes to the Windows version not affect the X11 port? Sounds like the snes9x project could do with some refactoring. The wine version works for me, but with no game-pad (the game-pad works in the Linux version). And why are the keyboard shortcuts different on the Windows and Linux versions?
do not forget to *ENJOY THE SAUCE*
Post subject: Re: [Request] Fix windows version for wine
Emulator Coder, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
Fabianx wrote:
Question now for nitsuja: Could you incorporate the following changes into a v10?
I don't know if it actually worked, but I put the modified executable here. I made buf static instead of allocating it with new, since you said you just wanted it off the stack, and the new would leak without a delete.
Former player
Joined: 6/15/2005
Posts: 1711
I want to thank Fabianx and nitsuja alot for this. This solved my problem and I'm very grateful. Thanks guys!
Zoey Ridin' High <Fabian_> I prett much never drunk
Joined: 2/12/2006
Posts: 432
It's very slow for me. edit: Nevermind; I had zsnes running in the background. It's still slow, though, but that's probably due to my lack of proper graphics drivers. Also, it won't let me use my controller. Hmm...
Joined: 2/12/2006
Posts: 432
I'm still having a few problems, namely that, first, there's a chance that it will freeze when loading a rom image and second, that it will randomly freeze and start looping the last second of sound for a few minutes. This renders it somewhat broken for me.
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Huffers wrote:
Why do changes to the Windows version not affect the X11 port?
Because the UI code for different operating systems is very separated in in snes9x. Basically, each operating system has their own UI engine. Also, as far as I know, our snes9x developer-seems-to-be here, Nitsuja, is working on his own branch of snes9x, and does not contribute his changes back to the snes9x CVS. Which I can understand, considering that the changes often seem to break compilation for all other platforms...