aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2007-02-15 21:43:56 +0000
committerNicola Mettifogo2007-02-15 21:43:56 +0000
commite3e76b59b6022054433c6c1df994b5ef97d8fa82 (patch)
tree58a60b483d67be5211f5a5852bf92e2fcf2f3b6e /engines/parallaction
parent22c7239796e4804f1cbeb9876d622ee5ff6221a7 (diff)
downloadscummvm-rg350-e3e76b59b6022054433c6c1df994b5ef97d8fa82.tar.gz
scummvm-rg350-e3e76b59b6022054433c6c1df994b5ef97d8fa82.tar.bz2
scummvm-rg350-e3e76b59b6022054433c6c1df994b5ef97d8fa82.zip
fixed a bug in the original engine causing memory-protected systems to occasionally crash
svn-id: r25614
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/commands.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/engines/parallaction/commands.cpp b/engines/parallaction/commands.cpp
index fada14c94e..44910b35aa 100644
--- a/engines/parallaction/commands.cpp
+++ b/engines/parallaction/commands.cpp
@@ -295,11 +295,19 @@ void runCommands(Command *list, Zone *z) {
break;
case CMD_ON: // on
- u->_zone->_flags &= ~kFlagsRemove;
- u->_zone->_flags |= kFlagsActive;
- if ((u->_zone->_type & 0xFFFF) == kZoneGet) {
- addJob(&jobDisplayDroppedItem, u->_zone, kPriority17 );
- }
+ // WORKAROUND: the original DOS-based engine didn't check u->_zone before dereferencing
+ // the pointer to get structure members, thus leading to crashes in systems with memory
+ // protection.
+ // As a side note, the overwritten address is the 5th entry in the DOS interrupt table
+ // (print screen handler): this suggests that a system would hang when the print screen
+ // key is pressed after playing Nippon Safes, provided that this code path is taken.
+ if (u->_zone != NULL) {
+ u->_zone->_flags &= ~kFlagsRemove;
+ u->_zone->_flags |= kFlagsActive;
+ if ((u->_zone->_type & 0xFFFF) == kZoneGet) {
+ addJob(&jobDisplayDroppedItem, u->_zone, kPriority17 );
+ }
+ }
break;
case CMD_OFF: // off