aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2009-04-06 17:13:07 +0000
committerFilippos Karapetis2009-04-06 17:13:07 +0000
commitfe1584c140d911ebe86a1afe5a39882b705ebfaf (patch)
treef44496689afa49545cdf5117caa8ca697c62cd59 /engines/sci
parent74fdcca04e6a2f9270d6f061540068043b2015e1 (diff)
downloadscummvm-rg350-fe1584c140d911ebe86a1afe5a39882b705ebfaf.tar.gz
scummvm-rg350-fe1584c140d911ebe86a1afe5a39882b705ebfaf.tar.bz2
scummvm-rg350-fe1584c140d911ebe86a1afe5a39882b705ebfaf.zip
Fixed an issue with the password screen in LSL5 and kStrAt(). The game password, saved in file memory.drv (which can either exist in the game directory, or is created in the saves folder by ScummVM) is now working correctly, and the game can be started. Note that it's NOT currently possible not to set a password (you'll get the password screen anyway the next time, and it won't work).
svn-id: r39876
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kstring.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 1fc72c2ede..86d01efdc7 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -420,12 +420,21 @@ reg_t kStrAt(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return NULL_REG;
}
+ bool lsl5PasswordWorkaround = false;
+ // LSL5 stores the password at the beginning in memory.drv, using XOR encryption,
+ // which means that is_print_str() will fail. Therefore, do not use the heuristic to determine
+ // if we're handling a string or an array for LSL5's password screen (room 155)
+ // FIXME: implement function to get current room number
+ if (s->_gameName.equalsIgnoreCase("lsl5") && (KP_UINT(s->script_000->locals_block->locals[13]) == 155))
+ lsl5PasswordWorkaround = true;
+
+ const char* dst = (const char *)dest; // used just for code beautification purposes
+
if ((argc == 2) &&
/* Our pathfinder already works around the issue we're trying to fix */
- (strcmp(s->seg_manager->getDescription(argv[0]), AVOIDPATH_DYNMEM_STRING) != 0) &&
- ((strlen((const char*)dest) < 2) || (!is_print_str((const char*)dest))))
- /* SQ4 array handling detected */
- {
+ (strcmp(s->seg_manager->getDescription(argv[0]), AVOIDPATH_DYNMEM_STRING) != 0) &&
+ ((strlen(dst) < 2) || (!lsl5PasswordWorkaround && !is_print_str(dst)))) {
+ // SQ4 array handling detected
#ifndef SCUMM_BIG_ENDIAN
int odd = KP_UINT(argv[1]) & 1;
#else