Vita: add support for disabling 'screensaver' (screen dimming and suspend)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 01e2c54..880415e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2246,6 +2246,7 @@ elseif(VITA)
SceHid_stub
SceMotion_stub
ScePower_stub
+ SceProcessmgr_stub
m
)
if(HAVE_VIDEO_VITA_PIB)
diff --git a/src/video/vita/SDL_vitavideo.c b/src/video/vita/SDL_vitavideo.c
index 0de9c1d..4ea96fa 100644
--- a/src/video/vita/SDL_vitavideo.c
+++ b/src/video/vita/SDL_vitavideo.c
@@ -33,6 +33,7 @@
#include "../../events/SDL_keyboard_c.h"
/* VITA declarations */
+#include <psp2/kernel/processmgr.h>
#include "SDL_vitavideo.h"
#include "SDL_vitatouch.h"
#include "SDL_vitakeyboard.h"
@@ -346,8 +347,8 @@ VITA_RestoreWindow(_THIS, SDL_Window * window)
void
VITA_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
{
-
}
+
void
VITA_DestroyWindow(_THIS, SDL_Window * window)
{
@@ -555,6 +556,12 @@ void VITA_PumpEvents(_THIS)
#if !defined(SDL_VIDEO_VITA_PVR)
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
#endif
+
+ if (_this->suspend_screensaver) {
+ // cancel all idle timers to prevent vita going to sleep
+ sceKernelPowerTick(SCE_KERNEL_POWER_TICK_DEFAULT);
+ }
+
VITA_PollTouch();
VITA_PollKeyboard();
VITA_PollMouse();
diff --git a/src/video/vita/SDL_vitavideo.h b/src/video/vita/SDL_vitavideo.h
index 372c192..1b1aa4f 100644
--- a/src/video/vita/SDL_vitavideo.h
+++ b/src/video/vita/SDL_vitavideo.h
@@ -38,7 +38,6 @@ typedef struct SDL_VideoData
SceWChar16 ime_buffer[SCE_IME_DIALOG_MAX_TEXT_LENGTH];
SDL_bool ime_active;
-
} SDL_VideoData;