aboutsummaryrefslogtreecommitdiff
path: root/backends/events/ps3sdl
diff options
context:
space:
mode:
authorBastien Bouclet2011-06-04 17:53:42 +0200
committerBastien Bouclet2011-06-22 19:57:44 +0200
commitf262d8932fc89ed8b02b5aff93a4bce7d68b34da (patch)
treee169e6beaf38b080835bfde6aeaf461affe3c773 /backends/events/ps3sdl
parent6633a06519bfc0a826e1e1664b88c4dd413abbeb (diff)
downloadscummvm-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')
-rw-r--r--backends/events/ps3sdl/ps3sdl-events.cpp39
-rw-r--r--backends/events/ps3sdl/ps3sdl-events.h1
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);
};