diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/events/ps3sdl/ps3sdl-events.cpp | 39 | ||||
-rw-r--r-- | backends/events/ps3sdl/ps3sdl-events.h | 1 |
2 files changed, 40 insertions, 0 deletions
diff --git a/backends/events/ps3sdl/ps3sdl-events.cpp b/backends/events/ps3sdl/ps3sdl-events.cpp index 4bcc8e15ba..eefc641844 100644 --- a/backends/events/ps3sdl/ps3sdl-events.cpp +++ b/backends/events/ps3sdl/ps3sdl-events.cpp @@ -25,6 +25,8 @@ #if defined(PLAYSTATION3) #include "backends/events/ps3sdl/ps3sdl-events.h" +#include "backends/platform/sdl/sdl.h" +#include "engines/engine.h" #include "common/util.h" #include "common/events.h" @@ -121,4 +123,41 @@ bool PS3SdlEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) { return true; } +/** + * The XMB (PS3 in game menu) needs the screen buffers to be constantly flip while open. + * This pauses execution and keeps redrawing the screen until the XMB is closed. + */ +void PS3SdlEventSource::preprocessEvents(SDL_Event *event) { + if (event->type == SDL_ACTIVEEVENT) { + if (event->active.state == SDL_APPMOUSEFOCUS && !event->active.gain) { + // XMB opened + if (g_engine) + g_engine->pauseEngine(true); + + for (;;) { + if (!SDL_PollEvent(event)) { + // Locking the screen forces a full redraw + Graphics::Surface* screen = g_system->lockScreen(); + if (screen) { + g_system->unlockScreen(); + g_system->updateScreen(); + } + SDL_Delay(10); + continue; + } + if (event->type == SDL_QUIT) + return; + if (event->type != SDL_ACTIVEEVENT) + continue; + if (event->active.state == SDL_APPMOUSEFOCUS && event->active.gain) { + // XMB closed + if (g_engine) + g_engine->pauseEngine(false); + return; + } + } + } + } +} + #endif diff --git a/backends/events/ps3sdl/ps3sdl-events.h b/backends/events/ps3sdl/ps3sdl-events.h index 328f613350..8cf2f43426 100644 --- a/backends/events/ps3sdl/ps3sdl-events.h +++ b/backends/events/ps3sdl/ps3sdl-events.h @@ -30,6 +30,7 @@ */ class PS3SdlEventSource : public SdlEventSource { protected: + void preprocessEvents(SDL_Event *event); bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event); bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event); }; |