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

ccawley2011 noreply at scummvm.org
Mon May 30 12:51:54 UTC 2022


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:
dd0304fb22 DS: Improve error reporting


Commit: dd0304fb22b2c812353deba9b858512c78a869ed
    https://github.com/scummvm/scummvm/commit/dd0304fb22b2c812353deba9b858512c78a869ed
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-05-30T13:51:40+01:00

Commit Message:
DS: Improve error reporting

Changed paths:
    backends/platform/ds/ds-graphics.cpp
    backends/platform/ds/dsmain.cpp
    backends/platform/ds/osystem_ds.cpp
    backends/platform/ds/osystem_ds.h


diff --git a/backends/platform/ds/ds-graphics.cpp b/backends/platform/ds/ds-graphics.cpp
index edf1b9fd9c8..157407356e1 100644
--- a/backends/platform/ds/ds-graphics.cpp
+++ b/backends/platform/ds/ds-graphics.cpp
@@ -163,10 +163,7 @@ void initHardware() {
 	irqSet(IRQ_VBLANK, VBlankHandler);
 	irqEnable(IRQ_VBLANK);
 
-#ifndef DISABLE_TEXT_CONSOLE
-	videoSetModeSub(MODE_0_2D);
-	consoleInit(NULL, 1, BgType_Text4bpp, BgSize_T_256x256, 30, 0, false, true);
-#else
+#ifdef DISABLE_TEXT_CONSOLE
 	videoSetModeSub(MODE_3_2D | DISPLAY_BG3_ACTIVE);
 #endif
 }
diff --git a/backends/platform/ds/dsmain.cpp b/backends/platform/ds/dsmain.cpp
index 8d9763f9eed..912358845b7 100644
--- a/backends/platform/ds/dsmain.cpp
+++ b/backends/platform/ds/dsmain.cpp
@@ -64,6 +64,8 @@
 // - Memory size for ite
 // - Try discworld?
 
+#include <nds.h>
+
 #include "backends/platform/ds/osystem_ds.h"
 #include "backends/plugins/ds/ds-provider.h"
 #include "base/main.h"
@@ -101,6 +103,11 @@ void fastRamReset() {
 /////////////////
 
 int main(int argc, char **argv) {
+#ifndef DISABLE_TEXT_CONSOLE
+	videoSetModeSub(MODE_0_2D);
+	consoleInit(NULL, 1, BgType_Text4bpp, BgSize_T_256x256, 30, 0, false, true);
+#endif
+
 	g_system = new OSystem_DS();
 	assert(g_system);
 
diff --git a/backends/platform/ds/osystem_ds.cpp b/backends/platform/ds/osystem_ds.cpp
index c72b2fd36f9..4de10d427cd 100644
--- a/backends/platform/ds/osystem_ds.cpp
+++ b/backends/platform/ds/osystem_ds.cpp
@@ -136,8 +136,29 @@ void OSystem_DS::quit() {
 
 void OSystem_DS::logMessage(LogMessageType::Type type, const char *message) {
 #ifndef DISABLE_TEXT_CONSOLE
-	printf("%s", message);
+	if (type == LogMessageType::kError) {
+		printf("\x1b[41m%s\x1b[39m", message);
+	} else {
+		printf("%s", message);
+	}
+#endif
+}
+
+void OSystem_DS::messageBox(LogMessageType::Type type, const char *message) {
+	if (type == LogMessageType::kError) {
+#ifdef DISABLE_TEXT_CONSOLE
+		consoleDemoInit();
+		printf("\x1b[41m%s\x1b[39m", message);
 #endif
+
+		printf("\nPress any button to continue\n");
+
+		while(1) {
+			swiWaitForVBlank();
+			scanKeys();
+			if (keysDown()) break;
+		}
+	}
 }
 
 static const Common::HardwareInputTableEntry ndsJoystickButtons[] = {
diff --git a/backends/platform/ds/osystem_ds.h b/backends/platform/ds/osystem_ds.h
index f2bd0305a9f..182e3a6a47a 100644
--- a/backends/platform/ds/osystem_ds.h
+++ b/backends/platform/ds/osystem_ds.h
@@ -153,6 +153,7 @@ public:
 	void refreshCursor(u16 *dst, const Graphics::Surface &src, const uint16 *palette);
 
 	virtual void logMessage(LogMessageType::Type type, const char *message);
+	virtual void messageBox(LogMessageType::Type type, const char *message);
 
 	void setMainScreen(int32 x, int32 y, int32 sx, int32 sy);
 	void setSubScreen(int32 x, int32 y, int32 sx, int32 sy);




More information about the Scummvm-git-logs mailing list