[Scummvm-git-logs] scummvm master -> 298c61844a6e56ca8fbca072fe45e55225435106

criezy criezy at scummvm.org
Sun Apr 26 15:19:44 UTC 2020


This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8b0b9f11c6 OSYSTEM: Add kFeatureNoQuit to remove Quit buttons and replace Quit with RTL
8958fe0f7b IOS7: Add support for kFeatureNoQuit
be6372df9c IOS7: Remove exit for normal application termination
4efcecb986 IOS7: Log error messages to the system error log facility
a5bad37f17 IOS: Use abort() instead of exit()
298c61844a IOS7: Use abort() instead of exit() for the Fatal error message view


Commit: 8b0b9f11c69b698269b0b471c52e863cadb1752e
    https://github.com/scummvm/scummvm/commit/8b0b9f11c69b698269b0b471c52e863cadb1752e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-04-26T16:19:37+01:00

Commit Message:
OSYSTEM: Add kFeatureNoQuit to remove Quit buttons and replace Quit with RTL

Some platforms should not allow quitting ScummVM. For example the Apple's
HUG for iOS state that we should "Never quit an iOS applications
programmatically". Adding the kFeatureNoQuit allows those backend
that need it to remove the possibility to quit the application.

Changed paths:
    backends/events/default/default-events.cpp
    common/system.h
    engines/dialogs.cpp
    gui/launcher.cpp


diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index ffadcd2509..e7ccbde3f3 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -95,6 +95,10 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
 	event = _eventQueue.pop();
 	bool forwardEvent = true;
 
+	// If the backend has the kFeatureNoQuit, replace Quit event with RTL
+	if (event.type == Common::EVENT_QUIT && g_system->hasFeature(OSystem::kFeatureNoQuit))
+		event.type = Common::EVENT_RTL;
+
 	switch (event.type) {
 	case Common::EVENT_KEYDOWN:
 		_modifierState = event.kbd.flags;
diff --git a/common/system.h b/common/system.h
index 9922e92aab..bf96f8bb07 100644
--- a/common/system.h
+++ b/common/system.h
@@ -418,7 +418,12 @@ public:
 		* Supports for using the native system file browser dialog
 		* through the DialogManager.
 		*/
-		kFeatureSystemBrowserDialog
+		kFeatureSystemBrowserDialog,
+
+		/**
+		* For platforms that should not have a Quit button
+		*/
+		kFeatureNoQuit
 
 	};
 
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp
index 07442c40d8..7f85bebe8b 100644
--- a/engines/dialogs.cpp
+++ b/engines/dialogs.cpp
@@ -95,8 +95,8 @@ MainMenuDialog::MainMenuDialog(Engine *engine)
 		_rtlButton = new GUI::ButtonWidget(this, "GlobalMenu.RTL", _c("~R~eturn to Launcher", "lowres"), 0, kRTLCmd);
 	_rtlButton->setEnabled(_engine->hasFeature(Engine::kSupportsRTL));
 
-
-	new GUI::ButtonWidget(this, "GlobalMenu.Quit", _("~Q~uit"), 0, kQuitCmd);
+	if (!g_system->hasFeature(OSystem::kFeatureNoQuit))
+		new GUI::ButtonWidget(this, "GlobalMenu.Quit", _("~Q~uit"), 0, kQuitCmd);
 
 	_aboutDialog = new GUI::AboutDialog();
 	_loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), false);
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index ae07aeb89d..d004bc52d1 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -136,8 +136,8 @@ void LauncherDialog::build() {
 	// Show ScummVM version
 	new StaticTextWidget(this, "Launcher.Version", gScummVMFullVersion);
 #endif
-
-	new ButtonWidget(this, "Launcher.QuitButton", _("~Q~uit"), _("Quit ScummVM"), kQuitCmd);
+	if (!g_system->hasFeature(OSystem::kFeatureNoQuit))
+		new ButtonWidget(this, "Launcher.QuitButton", _("~Q~uit"), _("Quit ScummVM"), kQuitCmd);
 	new ButtonWidget(this, "Launcher.AboutButton", _("A~b~out..."), _("About ScummVM"), kAboutCmd);
 	new ButtonWidget(this, "Launcher.OptionsButton", _("~O~ptions..."), _("Change global ScummVM options"), kOptionsCmd);
 	_startButton =


Commit: 8958fe0f7bc0452bba960a3b6608fb8a3caf400f
    https://github.com/scummvm/scummvm/commit/8958fe0f7bc0452bba960a3b6608fb8a3caf400f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-04-26T16:19:37+01:00

Commit Message:
IOS7: Add support for kFeatureNoQuit

Changed paths:
    backends/platform/ios7/ios7_osys_main.cpp


diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index 33e97cfad8..c831fd2a6e 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -174,6 +174,7 @@ bool OSystem_iOS7::hasFeature(Feature f) {
 	case kFeatureVirtualKeyboard:
 	case kFeatureClipboardSupport:
 	case kFeatureOpenUrl:
+	case kFeatureNoQuit:
 		return true;
 
 	default:


Commit: be6372df9cb73245d26f56930623be57d8ddc461
    https://github.com/scummvm/scummvm/commit/be6372df9cb73245d26f56930623be57d8ddc461
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-04-26T16:19:37+01:00

Commit Message:
IOS7: Remove exit for normal application termination

With the kFeatureNoQuit being now used, it should not get
there anyway.

Changed paths:
    backends/platform/ios7/ios7_osys_main.cpp


diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index c831fd2a6e..2074dc7096 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -415,7 +415,4 @@ void iOS7_main(int argc, char **argv) {
 		//*stderr = NULL;
 		fclose(newfp);
 	}
-
-	// prevents hanging on exit
-	exit(0);
 }


Commit: 4efcecb98642c9011c066eadc93e04c9550d925e
    https://github.com/scummvm/scummvm/commit/4efcecb98642c9011c066eadc93e04c9550d925e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-04-26T16:19:37+01:00

Commit Message:
IOS7: Log error messages to the system error log facility

Changed paths:
    backends/platform/ios7/ios7_osys_main.cpp
    backends/platform/ios7/ios7_osys_video.mm


diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index 2074dc7096..23278a30df 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -352,22 +352,6 @@ void OSystem_iOS7::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
 	}
 }
 
-void OSystem_iOS7::logMessage(LogMessageType::Type type, const char *message) {
-	FILE *output = 0;
-
-	if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
-		output = stdout;
-	else
-		output = stderr;
-
-	if (type == LogMessageType::kError) {
-		_lastErrorMessage = message;
-	}
-
-	fputs(message, output);
-	fflush(output);
-}
-
 bool iOS7_touchpadModeEnabled() {
 	OSystem_iOS7 *sys = (OSystem_iOS7 *) g_system;
 	return sys && sys->touchpadModeEnabled();
diff --git a/backends/platform/ios7/ios7_osys_video.mm b/backends/platform/ios7/ios7_osys_video.mm
index d31ca10ea3..43c48b05d2 100644
--- a/backends/platform/ios7/ios7_osys_video.mm
+++ b/backends/platform/ios7/ios7_osys_video.mm
@@ -61,6 +61,24 @@ void OSystem_iOS7::fatalError() {
 	}
 }
 
+void OSystem_iOS7::logMessage(LogMessageType::Type type, const char *message) {
+	FILE *output = 0;
+
+	if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+		output = stdout;
+	else
+		output = stderr;
+
+	if (type == LogMessageType::kError) {
+		_lastErrorMessage = message;
+		NSString *messageString = [NSString stringWithUTF8String:message];
+		NSLog(@"%@", messageString);
+	}
+
+	fputs(message, output);
+	fflush(output);
+}
+
 void OSystem_iOS7::engineInit() {
 	EventsBaseBackend::engineInit();
 	// Prevent the device going to sleep during game play (and in particular cut scenes)


Commit: a5bad37f17d392f16520c1cabf9fd45ef17e9499
    https://github.com/scummvm/scummvm/commit/a5bad37f17d392f16520c1cabf9fd45ef17e9499
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-04-26T16:19:37+01:00

Commit Message:
IOS: Use abort() instead of exit()

Changed paths:
    backends/platform/ios7/ios7_video.mm


diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index 0853bd9422..fa506d0ecf 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -36,19 +36,21 @@ static long g_lastTick = 0;
 static int g_frames = 0;
 #endif
 
-#define printOpenGLError() printOglError(__FILE__, __LINE__)
+void printError(const char *error_message) {
+	NSString *messageString = [NSString stringWithUTF8String:error_message];
+	NSLog(@"%@", messageString);
+	fprintf(stderr, "%s\n", error_message);
+}
 
-int printOglError(const char *file, int line) {
-	int retCode = 0;
+#define printOpenGLError() printOglError(__FILE__, __LINE__)
 
-	// returns 1 if an OpenGL error occurred, 0 otherwise.
+void printOglError(const char *file, int line) {
 	GLenum glErr = glGetError();
 	while (glErr != GL_NO_ERROR) {
-		fprintf(stderr, "glError: %u (%s: %d)\n", glErr, file, line);
-		retCode = 1;
+		Common::String error = Common::String::format("glError: %u (%s: %d)", glErr, file, line);
+		printError(error.c_str());
 		glErr = glGetError();
 	}
-	return retCode;
 }
 
 bool iOS7_isBigDevice() {
@@ -118,8 +120,8 @@ uint getSizeNextPOT(uint size) {
 
 	// In case creating the OpenGL ES context failed, we will error out here.
 	if (_context == nil) {
-		fprintf(stderr, "Could not create OpenGL ES context\n");
-		exit(-1);
+		printError("Could not create OpenGL ES context.");
+		abort();
 	}
 
 	if ([EAGLContext setCurrentContext:_context]) {
@@ -242,9 +244,8 @@ uint getSizeNextPOT(uint size) {
 	if (compileSuccess == GL_FALSE) {
 		GLchar messages[256];
 		glGetShaderInfoLog(shaderHandle, sizeof(messages), 0, &messages[0]);
-		NSString *messageString = [NSString stringWithUTF8String:messages];
-		NSLog(@"%@", messageString);
-		exit(1);
+		printError(messages);
+		abort();
 	}
 
 	return shaderHandle;
@@ -290,7 +291,7 @@ uint getSizeNextPOT(uint size) {
 	glGetProgramiv(programHandle, GL_LINK_STATUS, &linkSuccess);
 	if (linkSuccess == GL_FALSE) {
 		printOpenGLError();
-		exit(1);
+		abort();
 	}
 
 	glUseProgram(programHandle);


Commit: 298c61844a6e56ca8fbca072fe45e55225435106
    https://github.com/scummvm/scummvm/commit/298c61844a6e56ca8fbca072fe45e55225435106
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-04-26T16:19:37+01:00

Commit Message:
IOS7: Use abort() instead of exit() for the Fatal error message view

Changed paths:
    backends/platform/ios7/ios7_osys_video.mm


diff --git a/backends/platform/ios7/ios7_osys_video.mm b/backends/platform/ios7/ios7_osys_video.mm
index 43c48b05d2..e77fa8675b 100644
--- a/backends/platform/ios7/ios7_osys_video.mm
+++ b/backends/platform/ios7/ios7_osys_video.mm
@@ -36,7 +36,7 @@
 
 - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex {
 	OSystem_iOS7::sharedInstance()->quit();
-	exit(1);
+	abort();
 }
 
 @end




More information about the Scummvm-git-logs mailing list