[Scummvm-git-logs] scummvm master -> ceed6b2c8c8611f36b2682fe6a4bfdee1d92a49c

sev- sev at scummvm.org
Sat Jul 25 11:31:37 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:
ceed6b2c8c NULL: Allow using Ctrl+C to open the debugger


Commit: ceed6b2c8c8611f36b2682fe6a4bfdee1d92a49c
    https://github.com/scummvm/scummvm/commit/ceed6b2c8c8611f36b2682fe6a4bfdee1d92a49c
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-07-25T13:31:33+02:00

Commit Message:
NULL: Allow using Ctrl+C to open the debugger

Changed paths:
    backends/platform/null/null.cpp
    configure


diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index 41a1f7c685..4f11864628 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -24,6 +24,7 @@
 #ifdef POSIX
 #include <sys/time.h>
 #include <unistd.h>
+#include <signal.h>
 #endif
 
 // We use some stdio.h functionality here thus we need to allow some
@@ -47,6 +48,7 @@
 #include "backends/graphics/null/null-graphics.h"
 #include "audio/mixer_intern.h"
 #include "common/scummsys.h"
+#include "gui/debugger.h"
 
 /*
  * Include header files needed for the getFilesystemFactory() method.
@@ -102,9 +104,22 @@ OSystem_NULL::OSystem_NULL() {
 OSystem_NULL::~OSystem_NULL() {
 }
 
+#ifdef POSIX
+static volatile bool intReceived = false;
+
+static sighandler_t last_handler;
+
+void intHandler(int dummy) {
+	signal(SIGINT, last_handler);
+	intReceived = true;
+}
+#endif
+
 void OSystem_NULL::initBackend() {
 #ifdef POSIX
 	gettimeofday(&_startTime, 0);
+
+	last_handler = signal(SIGINT, intHandler);
 #endif
 
 	_mutexManager = new NullMutexManager();
@@ -126,6 +141,24 @@ void OSystem_NULL::initBackend() {
 bool OSystem_NULL::pollEvent(Common::Event &event) {
 	((DefaultTimerManager *)getTimerManager())->checkTimers();
 
+#ifdef POSIX
+	if (intReceived) {
+		intReceived = false;
+
+#ifdef USE_TEXT_CONSOLE_FOR_DEBUGGER
+		GUI::Debugger *debugger = g_engine ? g_engine->getOrCreateDebugger() : nullptr;
+		if (debugger && !debugger->isActive()) {
+			last_handler = signal(SIGINT, intHandler);
+			event.type = Common::EVENT_DEBUGGER;
+			return true;
+		}
+#endif
+
+		event.type = Common::EVENT_QUIT;
+		return true;
+	}
+#endif
+
 	return false;
 }
 
diff --git a/configure b/configure
index 6ff5f5c0f6..b4852af733 100755
--- a/configure
+++ b/configure
@@ -3737,6 +3737,7 @@ case $_backend in
 		;;
 	null)
 		append_var DEFINES "-DUSE_NULL_DRIVER"
+		_text_console=yes
 		;;
 	openpandora)
 		append_var DEFINES "-DOPENPANDORA"




More information about the Scummvm-git-logs mailing list