summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'games-emulation/snes9x/files/snes9x-1.51-x11.patch')
-rw-r--r--games-emulation/snes9x/files/snes9x-1.51-x11.patch176
1 files changed, 176 insertions, 0 deletions
diff --git a/games-emulation/snes9x/files/snes9x-1.51-x11.patch b/games-emulation/snes9x/files/snes9x-1.51-x11.patch
new file mode 100644
index 000000000000..5dae40cf4594
--- /dev/null
+++ b/games-emulation/snes9x/files/snes9x-1.51-x11.patch
@@ -0,0 +1,176 @@
+diff -Naur snes9x-1.51-src/unix/unix.cpp snes9x-1.51-src/unix/unix.cpp
+--- snes9x-1.51-src/unix/unix.cpp 2007-05-11 01:51:58.000000000 -0700
++++ snes9x-1.51-src/unix/unix.cpp 2007-05-11 01:52:09.000000000 -0700
+@@ -574,8 +574,6 @@
+ S9xInitInputDevices ();
+
+ S9xInitDisplay (argc, argv);
+- if (!S9xGraphicsInit ())
+- OutOfMemory ();
+ S9xSetupDefaultKeymap();
+
+ S9xTextMode ();
+@@ -748,6 +746,7 @@
+ (*CleanUp7110)();
+
+ S9xSetSoundMute (TRUE);
++ S9xUnmapAllControls ();
+ S9xDeinitDisplay ();
+ Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR));
+ S9xSaveCheatFile (S9xGetFilename (".cht", PATCH_DIR));
+diff -Naur snes9x-1.51-src/unix/x11.cpp snes9x-1.51-src/unix/x11.cpp
+--- snes9x-1.51-src/unix/x11.cpp 2007-05-11 02:10:22.000000000 -0700
++++ snes9x-1.51-src/unix/x11.cpp 2007-05-11 02:10:31.000000000 -0700
+@@ -275,6 +275,7 @@
+ void Convert16To24 (int width, int height);
+ void Convert16To24Packed (int width, int height);
+ void SetupImage ();
++void TakedownImage ();
+ int ErrorHandler (Display *, XErrorEvent *);
+ void TVMode (int width, int height);
+
+@@ -314,36 +315,7 @@
+ #endif
+
+ S9xTextMode ();
+- uint32 i;
+-
+- for (i = 0; i < sizeof (GUI.to_free) / sizeof (GUI.to_free [0]); i++)
+- if (GUI.to_free [i])
+- {
+- free (GUI.to_free [i]);
+- GUI.to_free [i] = NULL;
+- }
+-
+- if (GUI.image)
+- {
+-#ifdef MITSHM
+- if (GUI.use_shared_memory)
+- {
+- XShmDetach (GUI.display, &GUI.sm_info);
+- GUI.image->data = NULL;
+- XDestroyImage (GUI.image);
+- if (GUI.sm_info.shmaddr)
+- shmdt (GUI.sm_info.shmaddr);
+- if (GUI.sm_info.shmid >= 0)
+- shmctl (GUI.sm_info.shmid, IPC_RMID, 0);
+- GUI.image = NULL;
+- }
+- else
+-#endif
+- {
+- XDestroyImage (GUI.image);
+- GUI.image = NULL;
+- }
+- }
++ TakedownImage ();
+ XSync (GUI.display, False);
+ XCloseDisplay (GUI.display);
+ }
+@@ -715,36 +687,7 @@
+ ;
+ }
+
+- uint32 i;
+-
+- for (i = 0; i < sizeof (GUI.to_free) / sizeof (GUI.to_free [0]); i++)
+- if (GUI.to_free [i])
+- {
+- free (GUI.to_free [i]);
+- GUI.to_free [i] = NULL;
+- }
+-
+- if (GUI.image)
+- {
+-#ifdef MITSHM
+- if (GUI.use_shared_memory)
+- {
+- XShmDetach (GUI.display, &GUI.sm_info);
+- GUI.image->data = NULL;
+- XDestroyImage (GUI.image);
+- if (GUI.sm_info.shmaddr)
+- shmdt (GUI.sm_info.shmaddr);
+- if (GUI.sm_info.shmid >= 0)
+- shmctl (GUI.sm_info.shmid, IPC_RMID, 0);
+- GUI.image = NULL;
+- }
+- else
+-#endif
+- {
+- XDestroyImage (GUI.image);
+- GUI.image = NULL;
+- }
+- }
++ TakedownImage ();
+
+ #ifdef MITSHM
+ GUI.use_shared_memory = 1;
+@@ -884,8 +827,47 @@
+ }
+ GUI.image_date = (uint8 *) GUI.image->data;
+ GUI.bytes_per_line = GUI.image->bytes_per_line;
++
++ S9xGraphicsInit ();
++}
++
++void TakedownImage ()
++{
++ uint32 i;
++
++ for (i = 0; i < sizeof (GUI.to_free) / sizeof (GUI.to_free [0]); i++)
++ if (GUI.to_free [i])
++ {
++ free (GUI.to_free [i]);
++ GUI.to_free [i] = NULL;
++ }
++
++ if (GUI.image)
++ {
++#ifdef MITSHM
++ if (GUI.use_shared_memory)
++ {
++ XShmDetach (GUI.display, &GUI.sm_info);
++ GUI.image->data = NULL;
++ XDestroyImage (GUI.image);
++ if (GUI.sm_info.shmaddr)
++ shmdt (GUI.sm_info.shmaddr);
++ if (GUI.sm_info.shmid >= 0)
++ shmctl (GUI.sm_info.shmid, IPC_RMID, 0);
++ GUI.image = NULL;
++ }
++ else
++#endif
++ {
++ XDestroyImage (GUI.image);
++ GUI.image = NULL;
++ }
++ }
++
++ S9xGraphicsDeinit ();
+ }
+
++
+ int ErrorHandler (Display *, XErrorEvent *)
+ {
+ #ifdef MITSHM
+@@ -1002,6 +984,8 @@
+ IPPU.RenderThisFrame = TRUE;
+ IPPU.FrameSkip = Settings.SkipFrames;
+ SetupImage ();
++ extern void S9xReRefresh();
++ S9xReRefresh ();
+ }
+ #ifdef USE_DGA_EXTENSION
+ if (XF86.start_full_screen)
+diff -Naur snes9x-1.51-src/unix/xf86.cpp snes9x-1.51-src/unix/xf86.cpp
+--- snes9x-1.51-src/unix/xf86.cpp 2007-05-11 01:51:58.000000000 -0700
++++ snes9x-1.51-src/unix/xf86.cpp 2007-05-11 01:52:09.000000000 -0700
+@@ -404,6 +404,8 @@
+ break;
+ }
+ ourvideo.scrnBegin = ourvideo.vidMemBegin + (320 - IMAGE_WIDTH) * ourvideo.screendepth / 2 + ourvideo.width * ourvideo.screendepth * 8;
++
++ S9xGraphicsInit ();
+ }
+
+ void S9xGraphicsMode ()