aboutsummaryrefslogtreecommitdiff
path: root/backends/events/ps3sdl/ps3sdl-events.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/events/ps3sdl/ps3sdl-events.cpp')
-rw-r--r--backends/events/ps3sdl/ps3sdl-events.cpp39
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