diff options
author | Bastien Bouclet | 2011-06-04 17:53:42 +0200 |
---|---|---|
committer | Bastien Bouclet | 2011-06-22 19:57:44 +0200 |
commit | f262d8932fc89ed8b02b5aff93a4bce7d68b34da (patch) | |
tree | e169e6beaf38b080835bfde6aeaf461affe3c773 /backends/events/ps3sdl/ps3sdl-events.cpp | |
parent | 6633a06519bfc0a826e1e1664b88c4dd413abbeb (diff) | |
download | scummvm-rg350-f262d8932fc89ed8b02b5aff93a4bce7d68b34da.tar.gz scummvm-rg350-f262d8932fc89ed8b02b5aff93a4bce7d68b34da.tar.bz2 scummvm-rg350-f262d8932fc89ed8b02b5aff93a4bce7d68b34da.zip |
PS3: Keep updating the screen while the XMB is open to prevent it from freezing
Diffstat (limited to 'backends/events/ps3sdl/ps3sdl-events.cpp')
-rw-r--r-- | backends/events/ps3sdl/ps3sdl-events.cpp | 39 |
1 files changed, 39 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 |