[Scummvm-cvs-logs] scummvm master -> 0b9e6675ef7e7c2b11345ac2f556e5891222840c

clone2727 clone2727 at gmail.com
Mon Mar 14 03:06:27 CET 2011


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:
0b9e6675ef SCI: Add workaround for a QFG1 VGA Mac kFormat bug


Commit: 0b9e6675ef7e7c2b11345ac2f556e5891222840c
    https://github.com/scummvm/scummvm/commit/0b9e6675ef7e7c2b11345ac2f556e5891222840c
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-13T19:01:41-07:00

Commit Message:
SCI: Add workaround for a QFG1 VGA Mac kFormat bug

Also, fix the kernel signature for kFormat to require two parameters

Changed paths:
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/kstring.cpp



diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index b262906..16d56d1 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -348,7 +348,7 @@ static SciKernelMapEntry s_kernelMap[] = {
 	{ MAP_CALL(FindKey),           SIG_EVERYWHERE,           "l.",                    NULL,            kFindKey_workarounds },
 	{ MAP_CALL(FirstNode),         SIG_EVERYWHERE,           "[l0]",                  NULL,            NULL },
 	{ MAP_CALL(FlushResources),    SIG_EVERYWHERE,           "i",                     NULL,            NULL },
-	{ MAP_CALL(Format),            SIG_EVERYWHERE,           "r(.*)",                 NULL,            NULL },
+	{ MAP_CALL(Format),            SIG_EVERYWHERE,           "r[ri](.*)",             NULL,            NULL },
 	{ MAP_CALL(GameIsRestarting),  SIG_EVERYWHERE,           "(i)",                   NULL,            NULL },
 	{ MAP_CALL(GetAngle),          SIG_EVERYWHERE,           "iiii",                  NULL,            kGetAngle_workarounds },
 	{ MAP_CALL(GetCWD),            SIG_EVERYWHERE,           "r",                     NULL,            NULL },
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 730f7af..d9bb1c3 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -190,7 +190,6 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
 	char targetbuf[4096];
 	char *target = targetbuf;
 	reg_t position = argv[1]; /* source */
-	int index = argv[2].toUint16();
 	int mode = 0;
 	int paramindex = 0; /* Next parameter to evaluate */
 	char xfer;
@@ -201,9 +200,16 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
 
 	if (position.segment)
 		startarg = 2;
-	else
+	else {
+		// WORKAROUND: QFG1 VGA Mac calls this without the first parameter (dest). It then
+		// treats the source as the dest and overwrites the source string with an empty string.
+		if (argc < 3)
+			return NULL_REG;
+
 		startarg = 3; /* First parameter to use for formatting */
+	}
 
+	int index = (startarg == 3) ? argv[2].toUint16() : 0;
 	Common::String source_str = g_sci->getKernel()->lookupText(position, index);
 	const char* source = source_str.c_str();
 






More information about the Scummvm-git-logs mailing list