Skip to content

Commit

Permalink
fix: Reject any import on MANIAC-V2
Browse files Browse the repository at this point in the history
The corruption bug that makes Maniac Mansion always play in Demo mode inside
ScummVM after calling ScummTR doesn't only happen in the English V2 version;
I can also reproduce it with the French V2 version (from my DOTT CD).

So, this is likely a ScummRP/ScummTR bug. Let's just reject any modification
to a MANIAC-V2 game for now, then.

AFAIK, all versions of ScummTR so far have this bug.

MANIAC-V1 looks OK, ZAK-V2 looks OK too.

Issue #16.
  • Loading branch information
dwatteau committed Feb 26, 2022
1 parent 0009a71 commit 07b5141
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 27 deletions.
8 changes: 3 additions & 5 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,11 @@ This is quite tedious, indeed, but fortunately, the SCUMM games also provide som

### Maniac Mansion starts in demo mode after modifying it with ScummTR!

Yes, there is a very unfortunate bug in the original English version of Maniac Mansion “V2”: its `07.LFL` file appears to contain some invalid code that happens to work “by accident” (see <https://github.com/dwatteau/scummtr/issues/12>).
Yes, ScummTR and ScummRP have problems with the “V2” version of Maniac Mansion.

When `scummrp` or `scummtr` see this code, though, they don't know how to handle it, and the original bug is now triggered, giving weird results in the game. You will need to restore a backup, and avoid modifying this version for now.
The “V1” version of the game appears to be OK, though.

The “V1” English version of the game, and the “V2” non-English versions of the game, appear to be OK, though. So, as a work-around, you could maybe make your changes to a German or French *Maniac Mansion*, for example.

### When I extract the text from my non-English copy of The Dig, I still get English text
### When I extract the text from The Dig, I get English text although my game is not in English

It appears that *The Dig* contains both the original text and its translation, and that ScummTR only deals with the former.

Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

### Bugfixes

- ScummTR/ScummRP: Fix a fatal "Bad OIv2 offset" error with (at least) some versions of Maniac Mansion. This regression was introduced in 0.5.0.
- ScummTR/ScummRP: Fix a fatal "Bad OIv2 offset" error with (at least) some versions of Maniac Mansion and Zak McKracken. This regression was introduced in 0.5.0.

### Known bugs

- ScummTR/ScummRP: Mark all V2 versions of Maniac Mansions as unsupported, and not just the English V2 version. The French V2 version has the same corruption problem as the English version, for example.

## ScummTR 0.5.0 (2022-02-22)

Expand Down
2 changes: 1 addition & 1 deletion src/FontXY/FontXY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int main(int argc, char **argv)

if (argc != 3 || argv[1][0] == '\0' || argv[1][1] != '\0' || (argv[1][0] != 'i' && argv[1][0] != 'o'))
{
std::cout << "FontXY 0.5.0 (build " << SCUMMTR_BUILD_DATE << ") by Thomas Combeleran\n\n";
std::cout << "FontXY 0.5.1 (build " << SCUMMTR_BUILD_DATE << ") by Thomas Combeleran\n\n";
std::cout << "Usage: FontXY {i|o} <CHAR file>\n\nExamples:\tFontXY o CHAR_0002\n\t\tFontXY i CHAR_0003" << std::endl;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ScummFont/scummfont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static int32 glHeight = 0;

static int usage()
{
std::cout << "ScummFont 0.5.0 (build " << SCUMMTR_BUILD_DATE << ") by Thomas Combeleran\n\n";
std::cout << "ScummFont 0.5.1 (build " << SCUMMTR_BUILD_DATE << ") by Thomas Combeleran\n\n";
std::cout << "usage:\n";
std::cout << " scummfont {i|o} font bitmap.bmp\n\n";
std::cout << " o: Export bitmap.bmp from font\n";
Expand Down
7 changes: 6 additions & 1 deletion src/ScummRp/scummrp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*/

const char *const ScummRp::NAME = "ScummRp";
const char *const ScummRp::VERSION = "0.5.0";
const char *const ScummRp::VERSION = "0.5.1";
const char *const ScummRp::AUTHOR = "Thomas Combeleran";

const GameDefinition &ScummRp::game = ScummRp::_game;
Expand Down Expand Up @@ -408,6 +408,11 @@ int ScummRp::main(int argc, const char **argv)

ScummRp::_game = ScummRp::_gameDef[g];

#ifndef SCUMMRP_OK_TO_CORRUPT_MANIACV2
if (ScummRp::_game.version == 2 && ScummRp::_game.id == GID_MANIAC && ScummRp::_options & ScummRp::OPT_IMPORT)
ScummIO::fatal("Modifying Maniac Mansion V2 is known to corrupt it");
#endif

if (ScummRp::_options & ScummRp::OPT_IMPORT)
ScummRp::_fileOptions |= BlocksFile::BFOPT_BACKUP;
else
Expand Down
17 changes: 0 additions & 17 deletions src/ScummTr/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1479,23 +1479,6 @@ 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)
{
int32 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
8 changes: 7 additions & 1 deletion src/ScummTr/scummtr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/

const char *const ScummTr::NAME = "ScummTr";
const char *const ScummTr::VERSION = "0.5.0";
const char *const ScummTr::VERSION = "0.5.1";
const char *const ScummTr::AUTHOR = "Thomas Combeleran";

const ScummRp::Parameter ScummTr::_trParameters[] =
Expand Down Expand Up @@ -376,6 +376,12 @@ int ScummTr::main(int argc, const char **argv)
}

ScummRp::_game = ScummRp::_gameDef[g];

#ifndef SCUMMRP_OK_TO_CORRUPT_MANIACV2
if (ScummRp::_game.version == 2 && ScummRp::_game.id == GID_MANIAC && ScummRp::_options & ScummRp::OPT_IMPORT)
ScummIO::fatal("Modifying Maniac Mansion V2 is known to corrupt it");
#endif

if (ScummRp::_options & ScummRp::OPT_IMPORT)
{
ScummRp::_fileOptions |= BlocksFile::BFOPT_BACKUP;
Expand Down

0 comments on commit 07b5141

Please sign in to comment.