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

dreammaster noreply at scummvm.org
Fri Aug 7 06:13:41 UTC 2026


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

Summary:
86f1029723 MADS: PHANTOM: Use correct text Id for demo version messages
f4f57ea07b MADS: DRAGONSPHERE: Use correct text Id for demo version messages


Commit: 86f102972336710a4754dfbe9c6beb5f6813087b
    https://github.com/scummvm/scummvm/commit/86f102972336710a4754dfbe9c6beb5f6813087b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-07T16:13:16+10:00

Commit Message:
MADS: PHANTOM: Use correct text Id for demo version messages

Previously I'd hardcoded the string because I didn't want to
manually disassemble the demo executable, but with the help
of a new console command to search the text (*messages.dat)
for a given string, I was able to properly locate it.

Assisted-by: Claude Code:claude-opus-4.8

Changed paths:
    engines/mads/console.cpp
    engines/mads/console.h
    engines/mads/phantom/global.cpp
    engines/mads/phantom/global.h
    engines/mads/phantom/rooms/room102.cpp
    engines/mads/phantom/rooms/room202.cpp


diff --git a/engines/mads/console.cpp b/engines/mads/console.cpp
index fd556faf787..2ce9dafb9b5 100644
--- a/engines/mads/console.cpp
+++ b/engines/mads/console.cpp
@@ -19,11 +19,14 @@
  *
  */
 
+#include "common/array.h"
 #include "mads/console.h"
 #include "mads/core/env.h"
 #include "mads/core/imath.h"
 #include "mads/core/kernel.h"
 #include "mads/core/matte.h"
+#include "mads/core/mem.h"
+#include "mads/core/text.h"
 
 namespace MADS {
 
@@ -32,6 +35,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
 	registerCmd("walkable", WRAP_METHOD(Console, cmdWalkable));
 	registerCmd("quotes", WRAP_METHOD(Console, cmdQuotes));
+	registerCmd("text", WRAP_METHOD(Console, cmdText));
 }
 
 int strToInt(const char *s) {
@@ -149,6 +153,81 @@ bool Console::cmdQuotes(int argc, const char **argv) {
 	return true;
 }
 
+static bool textBufferContains(const char *haystack, uint16 haystackLen, const char *needle) {
+	size_t needleLen = strlen(needle);
+	if (needleLen == 0 || haystackLen < needleLen)
+		return false;
+
+	for (uint16 i = 0; i + needleLen <= haystackLen; ++i) {
+		if (!scumm_strnicmp(haystack + i, needle, needleLen))
+			return true;
+	}
+
+	return false;
+}
+
+bool Console::cmdText(int argc, const char **argv) {
+	if (argc < 2) {
+		debugPrintf("Usage: %s <search string>\n", argv[0]);
+		return true;
+	}
+
+	Common::String search(argv[1]);
+	for (int i = 2; i < argc; ++i) {
+		search += ' ';
+		search += argv[i];
+	}
+
+	// Enumerate every Id in the compiled text file's directory table so each
+	// one can be individually decompressed via text_load() and searched.
+	// See text_load() in core/text.cpp for the canonical reader of this table.
+	char temp_buf[80];
+	Common::strcpy_s(temp_buf, text_filename);
+	Common::strcat_s(temp_buf, TEXT_COMPILED);
+
+	Common::SeekableReadStream *handle = env_open(temp_buf, "rb");
+	if (!handle) {
+		debugPrintf("Could not open %s\n", temp_buf);
+		return true;
+	}
+
+	word num_entries = handle->readUint16LE();
+	Common::Array<int32> ids;
+	for (int count = 0; count < num_entries; ++count) {
+		TextDirectory dir;
+		dir.load(handle);
+		ids.push_back(dir.id);
+	}
+
+	delete handle;
+
+	bool found = false;
+	for (uint i = 0; i < ids.size(); ++i) {
+		TextPtr text = text_load(ids[i]);
+		if (!text)
+			continue;
+
+		if (textBufferContains(text->text, text->length, search.c_str())) {
+			found = true;
+
+			Common::String display(text->text, text->length);
+			for (uint j = 0; j < display.size(); ++j) {
+				if (display[j] == '\0')
+					display[j] = '\n';
+			}
+
+			debugPrintf("--- %d ---\n%s\n\n", ids[i], display.c_str());
+		}
+
+		mem_free(text);
+	}
+
+	if (!found)
+		debugPrintf("No text entries contain \"%s\"\n", search.c_str());
+
+	return true;
+}
+
 bool Console::cmdWalkable(int argc, const char **argv) {
 	const byte *srcP = scr_walk.data - 1;
 	byte *destP = scr_orig.data;
diff --git a/engines/mads/console.h b/engines/mads/console.h
index 5b17ae58df1..6fec4c0a7d2 100644
--- a/engines/mads/console.h
+++ b/engines/mads/console.h
@@ -34,6 +34,7 @@ private:
 	bool cmdWalkable(int argc, const char **argv);
 	bool cmdDepth(int argc, const char **argv);
 	bool cmdQuotes(int argc, const char **argv);
+	bool cmdText(int argc, const char **argv);
 
 public:
 	Console();
diff --git a/engines/mads/phantom/global.cpp b/engines/mads/phantom/global.cpp
index e1678e5b610..7dd6ed25416 100644
--- a/engines/mads/phantom/global.cpp
+++ b/engines/mads/phantom/global.cpp
@@ -92,8 +92,6 @@ extern void room_506_synchronize(Common::Serializer &s);
 
 } // namespace Rooms
 
-const char *DEMO_MSG = "That command is not available in the demo version";
-
 void global_section_constructor() {
 	section_preload_code_pointer = NULL;
 	section_room_constructor = NULL;
diff --git a/engines/mads/phantom/global.h b/engines/mads/phantom/global.h
index 66584d8d183..27a26a33392 100644
--- a/engines/mads/phantom/global.h
+++ b/engines/mads/phantom/global.h
@@ -274,8 +274,6 @@ enum {
 #define FUGUE_B_MINOR             3
 #define FUGUE_C_MINOR             4
 
-extern const char *DEMO_MSG;
-
 extern void global_section_constructor();
 extern void sync_room(Common::Serializer &s);
 
diff --git a/engines/mads/phantom/rooms/room102.cpp b/engines/mads/phantom/rooms/room102.cpp
index f985b6fc633..4ad2c7c3363 100644
--- a/engines/mads/phantom/rooms/room102.cpp
+++ b/engines/mads/phantom/rooms/room102.cpp
@@ -165,7 +165,7 @@ void room_102_parser() {
 	    (player_said_2(push, orchestra_door)) ||
 	    (player_said_2(open, orchestra_door))) {
 		if (g_engine->isDemo()) {
-			popup_alert(26, DEMO_MSG, nullptr);
+			text_show(99);
 
 		} else if (local->anim_0_running) {
 			kernel_timing_trigger(QUARTER_SECOND, ROOM_102_TRY_AGAIN);
diff --git a/engines/mads/phantom/rooms/room202.cpp b/engines/mads/phantom/rooms/room202.cpp
index c4ca04e8554..6ad336c2d41 100644
--- a/engines/mads/phantom/rooms/room202.cpp
+++ b/engines/mads/phantom/rooms/room202.cpp
@@ -809,7 +809,7 @@ void room_202_parser() {
 
 	if (player_said_2(walk_through, left_door) || player_said_2(open, left_door)) {
 		if (g_engine->isDemo()) {
-			popup_alert(26, DEMO_MSG, nullptr);
+			text_show(99);
 			goto handled;
 		}
 
@@ -866,7 +866,7 @@ void room_202_parser() {
 
 	if (player_said_2(walk_through, left_archway)) {
 		if (g_engine->isDemo()) {
-			popup_alert(26, DEMO_MSG, nullptr);
+			text_show(99);
 		} else {
 			new_room = 201;
 		}
@@ -881,7 +881,7 @@ void room_202_parser() {
 
 	if (player_said_2(walk_through, middle_door)) {
 		if (g_engine->isDemo()) {
-			popup_alert(26, DEMO_MSG, nullptr);
+			text_show(99);
 		} else {
 			new_room = 204;
 		}
@@ -890,7 +890,7 @@ void room_202_parser() {
 
 	if (player_said_2(walk_through, right_door)) {
 		if (g_engine->isDemo()) {
-			popup_alert(26, DEMO_MSG, nullptr);
+			text_show(99);
 		} else {
 			new_room = 205;
 		}


Commit: f4f57ea07b7c3a597c3cb4d07a2bc96343c44b25
    https://github.com/scummvm/scummvm/commit/f4f57ea07b7c3a597c3cb4d07a2bc96343c44b25
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-07T16:13:16+10:00

Commit Message:
MADS: DRAGONSPHERE: Use correct text Id for demo version messages

Changed paths:
    engines/mads/dragonsphere/global.cpp
    engines/mads/dragonsphere/global.h
    engines/mads/dragonsphere/rooms/room106.cpp
    engines/mads/dragonsphere/rooms/room110.cpp


diff --git a/engines/mads/dragonsphere/global.cpp b/engines/mads/dragonsphere/global.cpp
index e7d2ed092db..1a6e1dd65c1 100644
--- a/engines/mads/dragonsphere/global.cpp
+++ b/engines/mads/dragonsphere/global.cpp
@@ -106,8 +106,6 @@ extern void room_909_synchronize(Common::Serializer &s);
 
 } // namespace Rooms
 
-const char *DEMO_MSG = "NOT AVAILABLE IN DEMO VERSION";
-
 void global_section_constructor() {
 	section_preload_code_pointer = NULL;
 	section_room_constructor = NULL;
diff --git a/engines/mads/dragonsphere/global.h b/engines/mads/dragonsphere/global.h
index 72222a681ff..818ca2d6887 100644
--- a/engines/mads/dragonsphere/global.h
+++ b/engines/mads/dragonsphere/global.h
@@ -256,8 +256,6 @@ enum {
 #define GRAPES_GROWING                  1  /* is for global[grapes_have_grown] in 411 */
 #define GRAPES_GROWN                    2
 
-extern const char *DEMO_MSG;
-
 extern void global_section_constructor();
 extern void sync_room(Common::Serializer &s);
 
diff --git a/engines/mads/dragonsphere/rooms/room106.cpp b/engines/mads/dragonsphere/rooms/room106.cpp
index 143a1ca65cc..61f3facdb56 100644
--- a/engines/mads/dragonsphere/rooms/room106.cpp
+++ b/engines/mads/dragonsphere/rooms/room106.cpp
@@ -1168,7 +1168,7 @@ static void room_106_parser() {
 	if (player_said_2(walk_through, door_to_meeting_room) || player_said_2(open, door_to_meeting_room) ||
 		player_said_2(pull, door_to_meeting_room)) {
 		if (g_engine->isDemo()) {
-			popup_alert(24, DEMO_MSG, nullptr);
+			text_show(999);
 			goto handled;
 		}
 
@@ -1238,7 +1238,7 @@ static void room_106_parser() {
 	if (player_said_2(walk_through, door_to_ballroom) || player_said_2(open, door_to_ballroom) ||
 		player_said_2(pull, door_to_ballroom)) {
 		if (g_engine->isDemo()) {
-			popup_alert(24, DEMO_MSG, nullptr);
+			text_show(999);
 			goto handled;
 		}
 
@@ -1308,7 +1308,7 @@ static void room_106_parser() {
 	if (player_said_2(walk_through, door_to_council_room) || player_said_2(open, door_to_council_room) ||
 		player_said_2(pull, door_to_council_room)) {
 		if (g_engine->isDemo()) {
-			popup_alert(24, DEMO_MSG, nullptr);
+			text_show(999);
 			goto handled;
 		}
 
diff --git a/engines/mads/dragonsphere/rooms/room110.cpp b/engines/mads/dragonsphere/rooms/room110.cpp
index 61e9109cefa..1853eb27c06 100644
--- a/engines/mads/dragonsphere/rooms/room110.cpp
+++ b/engines/mads/dragonsphere/rooms/room110.cpp
@@ -2394,7 +2394,7 @@ static void room_110_parser() {
 	}
 
 	if (g_engine->isDemo() && player_said_2(walk_down, road_to_east)) {
-		popup_alert(24, DEMO_MSG, nullptr);
+		text_show(999);
 		goto handled;
 	}
 




More information about the Scummvm-git-logs mailing list