[Scummvm-git-logs] scummvm master -> ea53202de9add88ba932cd65b8e05a4234c1db8d
criezy
criezy at scummvm.org
Thu Jan 23 20:33:42 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ea53202de9 IPHONE: Disable idle timer while an engine is running
Commit: ea53202de9add88ba932cd65b8e05a4234c1db8d
https://github.com/scummvm/scummvm/commit/ea53202de9add88ba932cd65b8e05a4234c1db8d
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-01-23T20:33:37Z
Commit Message:
IPHONE: Disable idle timer while an engine is running
Changed paths:
backends/platform/iphone/iphone_video.h
backends/platform/iphone/iphone_video.mm
backends/platform/iphone/osys_main.h
backends/platform/iphone/osys_video.mm
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 8cba07c..1dac681 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -101,6 +101,9 @@
- (void)deviceOrientationChanged:(UIDeviceOrientation)orientation;
+- (void)disableIdleTimer;
+- (void)enableIdleTimer;
+
- (void)applicationSuspend;
- (void)applicationResume;
diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
index dc9436b..1eb5627 100644
--- a/backends/platform/iphone/iphone_video.mm
+++ b/backends/platform/iphone/iphone_video.mm
@@ -778,6 +778,14 @@ const char *iPhone_getDocumentsDir() {
return 0;
}
+- (void)disableIdleTimer {
+ [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
+}
+
+- (void)enableIdleTimer {
+ [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
+}
+
- (void)applicationSuspend {
[self addEvent:InternalEvent(kInputApplicationSuspended, 0, 0)];
}
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 427d806..e05e5b1 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -116,6 +116,9 @@ public:
virtual void initBackend();
+ virtual void engineInit();
+ virtual void engineDone();
+
virtual bool hasFeature(Feature f);
virtual void setFeatureState(Feature f, bool enable);
virtual bool getFeatureState(Feature f);
diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm
index a5dca7f..49811bf 100644
--- a/backends/platform/iphone/osys_video.mm
+++ b/backends/platform/iphone/osys_video.mm
@@ -28,6 +28,18 @@
#include "graphics/conversion.h"
+void OSystem_IPHONE::engineInit() {
+ EventsBaseBackend::engineInit();
+ // Prevent the device going to sleep during game play (and in particular cut scenes)
+ [g_iPhoneViewInstance performSelectorOnMainThread:@selector(disableIdleTimer) withObject:nil waitUntilDone: NO];
+}
+
+void OSystem_IPHONE::engineDone() {
+ EventsBaseBackend::engineDone();
+ // Allow the device going to sleep if idle while in the Launcher
+ [g_iPhoneViewInstance performSelectorOnMainThread:@selector(enableIdleTimer) withObject:nil waitUntilDone: NO];
+}
+
void OSystem_IPHONE::initVideoContext() {
_videoContext = [g_iPhoneViewInstance getVideoContext];
}
More information about the Scummvm-git-logs
mailing list