uploading i18n template
[drnoksnes] / platform / sdlv.cpp
index 535a899..180b795 100644 (file)
@@ -11,7 +11,6 @@
 #include "gfx.h"
 #include "ppu.h"
 #include "sdlv.h"
-#include "scaler.h"
 
 #define DIE(format, ...) do { \
                fprintf(stderr, "Died at %s:%d: ", __FILE__, __LINE__ ); \
@@ -27,7 +26,7 @@ static SDL_Rect windowSize, screenSize;
 static bool gotWindowSize, gotScreenSize;
 
 /** The current scaler object */
-static Scaler* scaler;
+Scaler* scaler;
 
 static void calculateScreenSize()
 {
@@ -113,6 +112,9 @@ static void setupVideoSurface()
        GUI.Width = gameWidth;
        GUI.Height = gameHeight;
 #endif
+#if CONF_EXIT_BUTTON
+       ExitBtnReset();
+#endif
 
        // Safeguard
        if (gameHeight > GUI.Height || gameWidth > GUI.Width)
@@ -160,14 +162,15 @@ static void drawOnscreenControls()
 {
        if (Config.touchscreenInput) {
                S9xInputScreenChanged();
-               if (Config.touchscreenShow) {
-                       scaler->pause();
-                       SDL_FillRect(screen, NULL, 0);
-                       S9xInputScreenDraw(Settings.SixteenBit ? 2 : 1,
-                                                               screen->pixels, screen->pitch);
-                       SDL_Flip(screen);
-                       scaler->resume();
-               }
+       }
+
+       if (Config.touchscreenShow) {
+               scaler->pause();
+               SDL_FillRect(screen, NULL, 0);
+               S9xInputScreenDraw(Settings.SixteenBit ? 2 : 1,
+                                                       screen->pixels, screen->pitch);
+               SDL_Flip(screen);
+               scaler->resume();
        }
 }
 
@@ -176,10 +179,6 @@ void S9xInitDisplay(int argc, const char ** argv)
        if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) 
                DIE("SDL_InitSubSystem(VIDEO): %s", SDL_GetError());
 
-#if CONF_HD
-       hd_setup();
-#endif
-
        setupVideoSurface();
        drawOnscreenControls();
 }
@@ -198,17 +197,10 @@ void S9xVideoToggleFullscreen()
        drawOnscreenControls();
 }
 
-void S9xVideoOutputFocus(bool hasFocus)
+void processVideoEvent(const SDL_Event& event)
 {
-#if MAEMO
-       if (scaler) {
-               if (hasFocus) {
-                       scaler->resume();
-               } else {
-                       scaler->pause();
-               }
-       }
-#endif
+       if (scaler)
+               scaler->filter(event);
 }
 
 // This is here for completeness, but palette mode is useless on N8x0
@@ -239,6 +231,14 @@ bool8_32 S9xDeinitUpdate (int width, int height, bool8_32 sixteenBit)
 {
        scaler->finish();
 
+#if CONF_EXIT_BUTTON
+       if (ExitBtnRequiresDraw()) {
+               scaler->pause();
+               ExitBtnDraw(screen);
+               scaler->resume();
+       }
+#endif
+
        return TRUE;
 }