diff options
Diffstat (limited to 'games-emulation/snes9x/files/snes9x-1.51-opengl.patch')
-rw-r--r-- | games-emulation/snes9x/files/snes9x-1.51-opengl.patch | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/games-emulation/snes9x/files/snes9x-1.51-opengl.patch b/games-emulation/snes9x/files/snes9x-1.51-opengl.patch new file mode 100644 index 000000000000..d451f34a544e --- /dev/null +++ b/games-emulation/snes9x/files/snes9x-1.51-opengl.patch @@ -0,0 +1,103 @@ +--- snes9x-1.51-src/gfx.h ++++ snes9x-1.51-src/gfx.h +@@ -331,7 +331,7 @@ + + inline uint16 COLOR_SUB(uint16 C1, uint16 C2) + { +- uint16 mC1, mC2, v = 0; ++ uint16 mC1, mC2, v = ALPHA_BITS_MASK; + + mC1 = C1 & FIRST_COLOR_MASK; + mC2 = C2 & FIRST_COLOR_MASK; +--- snes9x-1.51-src/unix/opengl.cpp ++++ snes9x-1.51-src/unix/opengl.cpp +@@ -233,14 +233,14 @@ + + // Strip dots from the version string + char *ptr; +- while (ptr = strchr (ver, '.')) ++ while ( (ptr = strchr (ver, '.')) != 0) + memmove (ptr, ptr + 1, strlen (ptr + 1) + 1); + +- // Pad the string with zeros to 4 digits +- while (strlen (ver) < 4) +- strcat (ver, "0"); +- + OpenGL.version = atoi (ver); ++ ++ // Pad the number with zeros to 4 digits ++ while (OpenGL.version < 1000) ++ OpenGL.version *= 10; + } + else + OpenGL.version = 1100; +@@ -400,7 +400,7 @@ + int i = 0; + for (uint32 y = 0; y < pheight; y++) + { +- uint16 *ptr = (uint16 *) (GFX.Screen + (y + startl) * GFX.Pitch) + startx; ++ uint16 *ptr = (uint16 *) (GFX.Screen + (y + startl) * GFX.Pitch/2) + startx; + for (uint32 x = 0; x < pwidth; x++) + { + int color = *ptr++; +@@ -418,7 +418,7 @@ + for (uint32 y = 0; y < pheight; y++) + { + memmove (basetexbuffer + sizeof (uint16) * texture_size * y, +- (GFX.Screen + (y + startl) * GFX.Pitch) + startx, ++ (GFX.Screen + (y + startl) * GFX.Pitch/2) + startx, + sizeof (uint16) * texture_size); + } + data = basetexbuffer; +--- snes9x-1.51-src/unix/x11.cpp ++++ snes9x-1.51-src/unix/x11.cpp +@@ -572,15 +572,29 @@ + } + delete[] color_diff; + ++ GUI.cmap = XCreateColormap (GUI.display, RootWindowOfScreen (GUI.screen), ++ GUI.visual, GUI.pseudo ? AllocAll : AllocNone); ++ if (GUI.pseudo) ++ { ++ for (i = 0; i < 256; i++) ++ { ++ GUI.colors[i].red = GUI.colors[i].green = GUI.colors[i].blue = 0; ++ GUI.colors[i].pixel = i; ++ GUI.colors[i].flags = DoRed | DoGreen | DoBlue; ++ } ++ XStoreColors (GUI.display, GUI.cmap, GUI.colors, 256); ++ } ++ + XSetWindowAttributes attrib; + + attrib.background_pixel = BlackPixelOfScreen (GUI.screen); ++ attrib.colormap = GUI.cmap; + GUI.window = XCreateWindow (GUI.display, RootWindowOfScreen (GUI.screen), + (WidthOfScreen(GUI.screen) - GUI.window_width) / 2, + (HeightOfScreen(GUI.screen) - GUI.window_height) / 2, + GUI.window_width, GUI.window_height, 0, + GUI.depth, InputOutput, GUI.visual, +- CWBackPixel, &attrib); ++ CWBackPixel | CWColormap, &attrib); + + #ifdef USE_DGA_EXTENSION + CreateFullScreenWindow (); +@@ -625,18 +639,6 @@ + ButtonPressMask | ButtonReleaseMask); + #endif + +- if (GUI.pseudo) +- { +- GUI.cmap = XCreateColormap (GUI.display, GUI.window, GUI.visual, True); +- XSetWindowColormap (GUI.display, GUI.window, GUI.cmap); +- for (i = 0; i < 256; i++) +- { +- GUI.colors[i].red = GUI.colors[i].green = GUI.colors[i].blue = 0; +- GUI.colors[i].pixel = i; +- GUI.colors[i].flags = DoRed | DoGreen | DoBlue; +- } +- XStoreColors (GUI.display, GUI.cmap, GUI.colors, 256); +- } + XMapRaised (GUI.display, GUI.window); + XClearWindow (GUI.display, GUI.window); + SetupImage (); |