AGI: Add support for Mac Manhunter games

Macintosh versions of GR and MH1-2 use the same combined directory
filename convention as DOS, Atari ST and Apple IIgs (but not Amiga or
CoCo3). However, the filename convention for volumes uses the common
AGI v2 format, without a game id prefix.

Example:
DOS: GRDIR, GRVOL.x
Mac: GRDIR, VOL.x

To account for this, we'll use the following:
1. Rather than take the directory filename prefix from volume files,
   we now get this from the directory files themselves (which makes
   more sense anyway).
2. Later, when loading individual volumes, check for Mac platform and
   exclude the prefix from the path.

This improves the previous single game check for Mac Gold Rush, which
formed directory and volume paths for that game only. This check is
now obsolete and has been removed. The detection flag that was used to
invoke the workaround has also been removed.
This commit is contained in:
trembyle 2022-01-05 18:50:55 -05:00 committed by Filippos Karapetis
parent fffdc507ea
commit 23348808e0
3 changed files with 22 additions and 22 deletions

View File

@ -37,14 +37,14 @@ enum AgiGameID {
GID_AGIDEMO,
GID_BC,
GID_DDP,
GID_GOLDRUSH,
GID_GOLDRUSH, // V3
GID_KQ1,
GID_KQ2,
GID_KQ3,
GID_KQ4,
GID_LSL1,
GID_MH1,
GID_MH2,
GID_MH1, // V3
GID_MH2, // V3
GID_MIXEDUP,
GID_PQ1,
GID_SQ1,
@ -65,10 +65,9 @@ enum AgiGameFeatures {
GF_AGIMOUSE = (1 << 0), // this disables "Click-to-walk mouse interface"
GF_AGDS = (1 << 1),
GF_AGI256 = (1 << 2), // marks fanmade AGI-256 games
GF_MACGOLDRUSH = (1 << 3), // use "grdir" instead of "dir" for volume loading
GF_FANMADE = (1 << 4), // marks fanmade games
GF_OLDAMIGAV20 = (1 << 5),
GF_2GSOLDSOUND = (1 << 6)
GF_FANMADE = (1 << 3), // marks fanmade games
GF_OLDAMIGAV20 = (1 << 4),
GF_2GSOLDSOUND = (1 << 5)
};
enum BooterDisks {

View File

@ -368,7 +368,7 @@ static const AGIGameDescription gameDescriptions[] = {
},
GID_GOLDRUSH,
GType_V3,
GF_MACGOLDRUSH,
0,
0x3149
},
@ -609,10 +609,10 @@ static const AGIGameDescription gameDescriptions[] = {
GAME_PS("mh1", "updated", "d47da950c62289f8d4ccf36af73365f2", 495, 0x2440, GID_MH1, Common::kPlatformCoCo3),
{
// Manhunter NY (Mac) 1.22 7.21/89 [AGI 2.917]
// Manhunter NY (Mac) 1.22 8/31/88
{
"mh1",
"1.22 1989-07-21",
"1.22 1988-08-31",
AD_ENTRY2s("mhdir", "0c7b86f05fe02c2e26cff1b07450b82a", 2123,
"vol.0", "338d7053d8cf08b517edebad2807975d", 115078),
Common::EN_ANY,
@ -621,9 +621,9 @@ static const AGIGameDescription gameDescriptions[] = {
GAMEOPTIONS_DEFAULT
},
GID_MH1,
GType_V2,
GType_V3,
0,
0x2917
0x3149
},
// Manhunter SF (ST) 1.0 7/29/89
@ -642,10 +642,10 @@ static const AGIGameDescription gameDescriptions[] = {
GAME3("mh2", "3.03 1989-08-17 5.25\"", "mh2dir", "b90e4795413c43de469a715fb3c1fa93", 0x3149, GID_MH2),
{
// Manhunter SF (Mac) 1.81 10/23/89 [AGI 2.917]
// Manhunter SF (Mac) 3.03 10/23/89
{
"mh2",
"1.81 1989-10-23",
"3.03 1989-10-23",
AD_ENTRY2s("mh2dir", "b90e4795413c43de469a715fb3c1fa93", 2588,
"vol.0", "b174bcf485bc348eae77782f9da4143e", 115338),
Common::EN_ANY,
@ -654,9 +654,9 @@ static const AGIGameDescription gameDescriptions[] = {
GAMEOPTIONS_DEFAULT
},
GID_MH1,
GType_V2,
GType_V3,
0,
0x2917
0x3149
},
// Manhunter SF (CoCo3 720k) [AGI 2.023]

View File

@ -46,9 +46,9 @@ int AgiLoader_v3::detectGame() {
Common::String f = file->getName();
f.toLowercase();
if (f.hasSuffix("vol.0")) {
if (f.hasSuffix("dir")) {
memset(_vm->_game.name, 0, 8);
strncpy(_vm->_game.name, f.c_str(), MIN((uint)8, f.size() > 5 ? f.size() - 5 : f.size()));
strncpy(_vm->_game.name, f.c_str(), MIN((uint)6, f.size() > 3 ? f.size() - 3 : f.size()));
debugC(3, kDebugLevelMain, "game.name = %s", _vm->_game.name);
ec = errOK;
@ -111,9 +111,6 @@ int AgiLoader_v3::init() {
if (_vm->getPlatform() == Common::kPlatformAmiga) {
path = Common::String("dirs");
_vm->_game.name[0] = 0; // Empty prefix
} else if (_vm->getFeatures() & GF_MACGOLDRUSH) {
path = "grdir";
_vm->_game.name[0] = 0; // Empty prefix
} else {
path = Common::String(_vm->_game.name) + DIR_;
}
@ -206,7 +203,11 @@ uint8 *AgiLoader_v3::loadVolRes(AgiDir *agid) {
Common::String path;
debugC(3, kDebugLevelResources, "(%p)", (void *)agid);
path = Common::String::format("%svol.%i", _vm->_game.name, agid->volume);
if (_vm->getPlatform() == Common::kPlatformMacintosh) {
path = Common::String::format("vol.%i", agid->volume);
} else {
path = Common::String::format("%svol.%i", _vm->_game.name, agid->volume);
}
if (agid->offset != _EMPTY && fp.open(path)) {
fp.seek(agid->offset, SEEK_SET);