📄 x11.cpp
字号:
Settings.SoundSync); break; } case KeyboardSetup::TOGGLE_MODE7INTERP: { if(event.type != KeyPress) break; Settings.Mode7Interpolate ^= TRUE; S9xDisplayStateChange ("Mode 7 Interpolation", Settings.Mode7Interpolate); break; } case KeyboardSetup::TURBO_ENABLE: { Settings.TurboMode = event.type == KeyPress; break; } case KeyboardSetup::SUPERSCOPE_TURBO: { if(event.type != KeyPress) break; GUI.superscope_turbo = !GUI.superscope_turbo; break; } case KeyboardSetup::SUPERSCOPE_PAUSE_ENABLE: { GUI.superscope_pause = event.type == KeyPress; break; } case KeyboardSetup::EXIT: { if(event.type != KeyPress) break;#ifdef USE_DGA_EXTENSION if (XF86.is_full_screen) { S9xSwitchToFullScreen (FALSE); break; }#endif S9xExit (); break; } case KeyboardSetup::WRITE_MOVIE_ASK: { if(event.type != KeyPress) break; wchar_t name[MOVIE_MAX_METADATA] = {0}; if(S9xMovieActive()) S9xMovieStop(FALSE); S9xMovieCreate(S9xChooseMovieFilename(FALSE), 0x1F, //MOVIE_OPT_FROM_SNAPSHOT MOVIE_OPT_FROM_RESET , name,0); break; } case KeyboardSetup::LOAD_MOVIE_ASK: { if(event.type != KeyPress) break; if(S9xMovieActive()) S9xMovieStop(FALSE); S9xMovieOpen(S9xChooseMovieFilename(TRUE), FALSE); break; } case KeyboardSetup::STOP_MOVIE: { if(event.type != KeyPress) break; if(S9xMovieActive()) S9xMovieStop(FALSE); break; } /* Do not put a "default" case here, or you'll * miss the compiler warning about unhandled * enumeration values */ } break; } case FocusIn: //XAutoRepeatOff (GUI.display); XFlush (GUI.display); //Settings.Paused &= ~2; break; case FocusOut: XAutoRepeatOn (GUI.display); XFlush (GUI.display); //Settings.Paused |= 2; break; case ConfigureNotify: if (event.xany.window == GUI.window && (GUI.window_width != event.xconfigure.width || GUI.window_height != event.xconfigure.height)) { GUI.window_width = event.xconfigure.width; GUI.window_height = event.xconfigure.height; IPPU.RenderThisFrame = TRUE; IPPU.FrameSkip = Settings.SkipFrames; SetupImage (); }#ifdef USE_DGA_EXTENSION if (XF86.start_full_screen) { XF86.start_full_screen = FALSE; S9xSwitchToFullScreen (TRUE); }#endif break;#if 0 case ButtonPress: GUI.mouse_buttons = (event.xbutton.state | (1 << event.xbutton.button)) & 0x1f; break; case ButtonRelease: GUI.mouse_buttons = (event.xbutton.state & ~(1 << event.xbutton.button)) & 0x1f; break;#endif } }}void S9xPutImage (int snes_width, int snes_height){#ifdef USE_GLIDE if (Settings.GlideEnable) S9xGlidePutImage (snes_width, snes_height); else#elif USE_OPENGL if (Settings.OpenGLEnable) S9xOpenGLPutImage (snes_width, snes_height); else#elif USE_AIDO if (Settings.AIDOShmId) S9xAIDOPutImage (snes_width, snes_height); else#endif { bool8 done = FALSE; int width, height, cheight; width = snes_width; height = snes_height; cheight = (height>SNES_HEIGHT_EXTENDED)?SNES_HEIGHT_EXTENDED*2:SNES_HEIGHT_EXTENDED; if (GUI.interpolate && Settings.SixteenBit) { if (snes_width == 512 && snes_height > 240 && GUI.interpolate != 5) { GUI.output_screen = GFX.Screen; GUI.output_pitch = GFX.Pitch;#ifdef USE_DGA_EXTENSION if (XF86.is_full_screen) { if (XF86.scale) GUI.image_date = (uint8 *) XF86.vram; else { GUI.box.x = (XF86.window_width - width) / 2; GUI.box.y = (XF86.window_height - cheight) / 2; GUI.image_date = (uint8 *) XF86.vram + GUI.box.x * GUI.bytes_per_pixel + GUI.box.y * GUI.bytes_per_line; } }#endif if (!GUI.image_needs_scaling) { for (int y = 0; y < snes_height; y++) { memmove (GUI.image_date + y * GUI.bytes_per_line, GFX.Screen + GFX.Pitch * y, snes_width * GUI.bytes_per_pixel); } done = TRUE; } } else { if (GUI.interpolate != 5) { width = 512; if (snes_height < 240) height = snes_height << 1; else height = snes_height; cheight = SNES_HEIGHT_EXTENDED << 1; } else { width = GUI.window_width; cheight = height = GUI.window_height; } if (GUI.image_needs_scaling || GUI.interpolate == 5) { GUI.box.x = 0; GUI.box.y = 0; } else { GUI.box.x = (GUI.window_width - width) / 2; GUI.box.y = (GUI.window_height - cheight) / 2; } // Kreed's bi-linear image filter scales as well if ((GUI.image_needs_scaling && GUI.interpolate != 5) || (GUI.depth != 15 && GUI.depth != 16)) { GUI.output_screen = GUI.interpolated_screen; GUI.output_pitch = 512 * 2; } else {#ifdef USE_DGA_EXTENSION if (XF86.is_full_screen) { if (XF86.scale) GUI.image_date = (uint8 *) XF86.vram; else { GUI.box.x = (XF86.window_width - width) / 2; GUI.box.y = (XF86.window_height - cheight) / 2; GUI.image_date = (uint8 *) XF86.vram + GUI.box.x * GUI.bytes_per_pixel + GUI.box.y * GUI.bytes_per_line; } GUI.output_screen = GUI.image_date; GUI.output_pitch = GUI.bytes_per_line; done = TRUE; } else#endif { GUI.output_screen = (uint8 *) GUI.image->data; GUI.output_pitch = GUI.image->bytes_per_line; } } if (snes_width != GUI.last_snes_width || snes_height != GUI.last_snes_height) { memset (GUI.delta_screen, 255, GFX.Pitch * snes_height); } TVMode (snes_width, snes_height); } } else { GUI.output_screen = GFX.Screen; GUI.output_pitch = GFX.Pitch; width = snes_width; height = snes_height; cheight = (height>SNES_HEIGHT_EXTENDED)?SNES_HEIGHT_EXTENDED<<1:SNES_HEIGHT_EXTENDED; if (GUI.image_needs_scaling) { GUI.box.x = 0; GUI.box.y = 0; } else { GUI.box.x = (GUI.window_width - width) / 2; GUI.box.y = (GUI.window_height - cheight) / 2; } } if ((Settings.SixteenBit && GUI.depth != 15 && GUI.depth != 16) || (!Settings.SixteenBit && (!GUI.pseudo || GUI.depth != 8)) || (GUI.image_needs_scaling && !(Settings.SixteenBit && GUI.interpolate == 5))) { done = TRUE; switch (GUI.depth) { case 8: if (Settings.SixteenBit) Convert16To8 (width, height); else Scale8 (width, height); break; case 15: case 16: if (!Settings.SixteenBit) Convert8To16 (width, height); else Scale16 (width, height); break; case 32: case 24: if (Settings.SixteenBit) { if (GUI.image->bits_per_pixel == 32) Convert16To24 (width, height); else Convert16To24Packed (width, height); } else { if (GUI.image->bits_per_pixel == 32) Convert8To24 (width, height); else Convert8To24Packed (width, height); } break; } } if (GUI.image_needs_scaling) { GUI.box.width = GUI.window_width; GUI.box.height = GUI.window_height; } else { GUI.box.width = width; GUI.box.height = height; }#ifdef USE_DGA_EXTENSION if (XF86.is_full_screen && !done) { if (XF86.scale) GUI.image_date = (uint8 *) XF86.vram; else GUI.image_date = (uint8 *) XF86.vram + ((XF86.window_width - width) / 2) * GUI.bytes_per_pixel + ((XF86.window_height - cheight) / 2) * GUI.bytes_per_line; for (int y = 0; y < snes_height; y++) { memmove (GUI.image_date + y * GUI.bytes_per_line, GFX.Screen + GFX.Pitch * y, snes_width * GUI.bytes_per_pixel); } }#endif#ifdef USE_DGA_EXTENSION if (!XF86.is_full_screen) {#endif#ifdef MITSHM if(GUI.use_shared_memory) { XShmPutImage (GUI.display, GUI.window, GUI.gc, GUI.image, 0, 0, GUI.box.x, GUI.box.y, GUI.box.width, GUI.box.height, False); XSync (GUI.display, False); } else#endif XPutImage (GUI.display, GUI.window, GUI.gc, GUI.image, 0, 0, GUI.box.x, GUI.box.y, GUI.box.width, GUI.box.height);#ifdef USE_DGA_EXTENSION }#endif GUI.last_snes_width = snes_width; GUI.last_snes_height = snes_height; if (GUI.box.x != GUI.old_box.x || GUI.box.y != GUI.old_box.y || GUI.box.width != GUI.old_box.width || GUI.box.height != GUI.old_box.height) { // If the rendered image has changed size/position clear any areas of the // screen that should now be border Region old_box = XCreateRegion (); Region new_box = XCreateRegion (); XUnionRectWithRegion (&GUI.old_box, old_box, old_box); XUnionRectWithRegion (&GUI.box, new_box, new_box); XSubtractRegion (old_box, new_box, old_box); if (!XEmptyRegion (old_box)) { Window window = GUI.window; XRectangle clip; XClipBox (old_box, &clip); XSetRegion (GUI.display, GUI.gc, old_box); XSetForeground (GUI.display, GUI.gc, GUI.depth == 8 ? 0 : BlackPixelOfScreen (GUI.screen));#ifdef USE_DGA_EXTENSION if (XF86.full_screen_available) window = XF86.fs_window;#endif XFillRectangle (GUI.display, window, GUI.gc, clip.x, clip.y, clip.width, clip.height); XSetClipMask (GUI.display, GUI.gc, None); } XDestroyRegion (new_box); XDestroyRegion (old_box); GUI.old_box = GUI.box; } Window root, child; int root_x, root_y; int x, y; unsigned int mask; // Use QueryPointer to sync X server and as a side effect also gets // current pointer position for SNES mouse emulation. XQueryPointer (GUI.display, GUI.window, &root, &child, &root_x, &root_y, &x, &y, &mask); if (IPPU.Controller == SNES_SUPERSCOPE) { if (!GUI.superscope) { XDefineCursor (GUI.display, GUI.window, GUI.cross_hair_cursor);#ifdef USE_DGA_EXTENSION
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -