diff options
-rw-r--r-- | engines/sci/engine/kernel_tables.h | 2 | ||||
-rw-r--r-- | engines/sci/engine/kstring.cpp | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index b26290612c..16d56d10a8 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 730f7af9b8..d9bb1c3531 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(); |