Skip to content

Commit

Permalink
feat(scummtr): Try to detect and reject MANIAC-V2-EN
Browse files Browse the repository at this point in the history
This particular version has an original script bug that corrupts the
game when you modify it (the game will always switch to Demo mode).

The V1 English variant, and the V2 non-English variants don't have
this bug.

#12
  • Loading branch information
dwatteau committed Feb 5, 2022
1 parent 832a010 commit 4e89048
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

### Known bugs:

- MANIAC-V2-EN is unsupported. This is because of an existing bug in the original game: any change made to the resources would amplify it and corrupt the game. Possible workaround: work from MANIAC-V1-EN or from a non-English version of Maniac Mansion V2.
- ScummTR: the `-b` option may not correctly work with all games. Possible workaround: use the `-r` option.

### Portability (for developers):
Expand Down
17 changes: 17 additions & 0 deletions src/ScummTr/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,23 @@ void Script::_opv12()
_eatWordOrVar(opcode & 0x80);
break;
case 0x62: // stopScript
if (ScummRp::game.version == 2 && ScummRp::game.id == GID_MANIAC && _file->name() == "07.LFL" && _file->fullOffset() == 0x2351)
{
byte b;
b = _eatByteOrVar(opcode & 0x80);
if (b == 0x00 && _peekByte() != 0xD8)
{
#ifndef SCUMMTR_OK_TO_CORRUPT_MANIAC_V2_EN
// https://github.com/dwatteau/scummtr/issues/12
throw Script::Error("This version of Maniac Mansion V2 has an original bug that corrupts it if you modify it");
#endif
}
}
else
{
_eatByteOrVar(opcode & 0x80);
}
break;
case 0xE2: // stopScript
_eatByteOrVar(opcode & 0x80);
break;
Expand Down

0 comments on commit 4e89048

Please sign in to comment.