Renamed SubstResFileNames::winName and macName to almostGameID / expandedName (the old names were misleading; the new ones aren't great either :)
svn-id: r21062
This commit is contained in:
parent
bea9b5e7d0
commit
bb38ea2c17
7 changed files with 35 additions and 35 deletions
|
@ -162,7 +162,7 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte
|
||||||
if (!_fileName[0]) { // We are running for the first time
|
if (!_fileName[0]) { // We are running for the first time
|
||||||
snprintf(_fileName, 256, "%s.he3", _vm->getBaseName());
|
snprintf(_fileName, 256, "%s.he3", _vm->getBaseName());
|
||||||
|
|
||||||
if (_vm->_substResFileName.winName != 0) {
|
if (_vm->_substResFileName.almostGameID != 0) {
|
||||||
char buf1[128];
|
char buf1[128];
|
||||||
|
|
||||||
_vm->generateSubstResFileName(_fileName, buf1, sizeof(buf1));
|
_vm->generateSubstResFileName(_fileName, buf1, sizeof(buf1));
|
||||||
|
@ -1291,7 +1291,7 @@ int MacResExtractor::extractResource(int id, byte **buf) {
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
if (!_fileName[0]) // We are running for the first time
|
if (!_fileName[0]) // We are running for the first time
|
||||||
if (_vm->_substResFileName.winName != 0) {
|
if (_vm->_substResFileName.almostGameID != 0) {
|
||||||
char buf1[128];
|
char buf1[128];
|
||||||
|
|
||||||
snprintf(buf1, 128, "%s.he3", _vm->getBaseName());
|
snprintf(buf1, 128, "%s.he3", _vm->getBaseName());
|
||||||
|
|
|
@ -161,7 +161,7 @@ void Sound::setupHEMusicFile() {
|
||||||
|
|
||||||
sprintf(buf, "%s.he4", _vm->getBaseName());
|
sprintf(buf, "%s.he4", _vm->getBaseName());
|
||||||
|
|
||||||
if (_vm->_substResFileName.winName != 0) {
|
if (_vm->_substResFileName.almostGameID != 0) {
|
||||||
_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
|
_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
|
||||||
strcpy(buf, buf1);
|
strcpy(buf, buf1);
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
|
||||||
|
|
||||||
sprintf(buf, "%s.he4", _vm->getBaseName());
|
sprintf(buf, "%s.he4", _vm->getBaseName());
|
||||||
|
|
||||||
if (_vm->_substResFileName.winName != 0) {
|
if (_vm->_substResFileName.almostGameID != 0) {
|
||||||
_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
|
_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
|
||||||
strcpy(buf, buf1);
|
strcpy(buf, buf1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1168,7 +1168,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
|
||||||
|
|
||||||
substLastIndex = findSubstResFileName(subst, tempName, substLastIndex);
|
substLastIndex = findSubstResFileName(subst, tempName, substLastIndex);
|
||||||
applySubstResFileName(subst, tempName, detectName, sizeof(detectName));
|
applySubstResFileName(subst, tempName, detectName, sizeof(detectName));
|
||||||
} while (subst.winName != 0);
|
} while (subst.almostGameID != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1284,10 +1284,10 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
|
||||||
|
|
||||||
substLastIndex = findSubstResFileName(subst, tempName, substLastIndex);
|
substLastIndex = findSubstResFileName(subst, tempName, substLastIndex);
|
||||||
applySubstResFileName(subst, tempName, detectName, sizeof(detectName));
|
applySubstResFileName(subst, tempName, detectName, sizeof(detectName));
|
||||||
} while (subst.winName != 0);
|
} while (subst.almostGameID != 0);
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
if (subst.winName != 0)
|
if (subst.almostGameID != 0)
|
||||||
debug(5, "Generated filename substitute: %s -> %s", tempName, detectName);
|
debug(5, "Generated filename substitute: %s -> %s", tempName, detectName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1299,7 +1299,7 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force game to have Mac platform if needed
|
// Force game to have Mac platform if needed
|
||||||
if (subst.winName) {
|
if (subst.almostGameID) {
|
||||||
if (subst.genMethod == kGenMac ||
|
if (subst.genMethod == kGenMac ||
|
||||||
subst.genMethod == kGenMacNoParens)
|
subst.genMethod == kGenMacNoParens)
|
||||||
game.platform = Common::kPlatformMacintosh;
|
game.platform = Common::kPlatformMacintosh;
|
||||||
|
|
|
@ -152,7 +152,7 @@ void ScummEngine::openRoom(const int room) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have substitute
|
// If we have substitute
|
||||||
if (_substResFileName.winName != 0 && !(_game.platform == Common::kPlatformNES || _game.platform == Common::kPlatformC64)) {
|
if (_substResFileName.almostGameID != 0 && !(_game.platform == Common::kPlatformNES || _game.platform == Common::kPlatformC64)) {
|
||||||
char tmpBuf[128];
|
char tmpBuf[128];
|
||||||
generateSubstResFileName(buf, tmpBuf, sizeof(tmpBuf));
|
generateSubstResFileName(buf, tmpBuf, sizeof(tmpBuf));
|
||||||
strcpy(buf, tmpBuf);
|
strcpy(buf, tmpBuf);
|
||||||
|
@ -255,7 +255,7 @@ bool ScummEngine::openFile(BaseScummFile &file, const char *filename, bool resou
|
||||||
// from target name. dottdemo.000 vs tentacle.000. So we should
|
// from target name. dottdemo.000 vs tentacle.000. So we should
|
||||||
// substitute those names too
|
// substitute those names too
|
||||||
if (resourceFile == true) {
|
if (resourceFile == true) {
|
||||||
if (_substResFileNameBundle.winName == 0) {
|
if (_substResFileNameBundle.almostGameID == 0) {
|
||||||
int substLastIndex = 0;
|
int substLastIndex = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -264,14 +264,14 @@ bool ScummEngine::openFile(BaseScummFile &file, const char *filename, bool resou
|
||||||
|
|
||||||
substLastIndex = findSubstResFileName(_substResFileNameBundle, filename, substLastIndex);
|
substLastIndex = findSubstResFileName(_substResFileNameBundle, filename, substLastIndex);
|
||||||
applySubstResFileName(_substResFileNameBundle, filename, name, sizeof(name));
|
applySubstResFileName(_substResFileNameBundle, filename, name, sizeof(name));
|
||||||
} while (_substResFileNameBundle.winName != 0);
|
} while (_substResFileNameBundle.almostGameID != 0);
|
||||||
|
|
||||||
if (_substResFileNameBundle.winName != 0) {
|
if (_substResFileNameBundle.almostGameID != 0) {
|
||||||
debug(5, "Generated substitute in Mac bundle: [%s -> %s]", filename, _substResFileNameBundle.winName);
|
debug(5, "Generated substitute in Mac bundle: [%s -> %s]", filename, _substResFileNameBundle.almostGameID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_substResFileNameBundle.winName != 0)
|
if (_substResFileNameBundle.almostGameID != 0)
|
||||||
applySubstResFileName(_substResFileNameBundle, filename, name, sizeof(name));
|
applySubstResFileName(_substResFileNameBundle, filename, name, sizeof(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,30 +292,30 @@ static SubstResFileNames substResFileNameTable[] = {
|
||||||
{ NULL, NULL, kGenAsIs }
|
{ NULL, NULL, kGenAsIs }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void applySubstResFileName(const SubstResFileNames &subst, char *buf, int bufsize, const char *ext, int num) {
|
static void applySubstResFileName(const SubstResFileNames &subst, char *buf, int bufsize, const char *ext, char num) {
|
||||||
switch (subst.genMethod) {
|
switch (subst.genMethod) {
|
||||||
case kGenMac:
|
case kGenMac:
|
||||||
case kGenMacNoParens:
|
case kGenMacNoParens:
|
||||||
if (num == '3') { // special case for cursors
|
if (num == '3') { // special case for cursors
|
||||||
// For mac they're stored in game binary
|
// For mac they're stored in game binary
|
||||||
strncpy(buf, subst.macName, bufsize);
|
strncpy(buf, subst.expandedName, bufsize);
|
||||||
} else {
|
} else {
|
||||||
if (subst.genMethod == kGenMac)
|
if (subst.genMethod == kGenMac)
|
||||||
snprintf(buf, bufsize, "%s (%c)", subst.macName, num);
|
snprintf(buf, bufsize, "%s (%c)", subst.expandedName, num);
|
||||||
else
|
else
|
||||||
snprintf(buf, bufsize, "%s %c", subst.macName, num);
|
snprintf(buf, bufsize, "%s %c", subst.expandedName, num);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kGenPC:
|
case kGenPC:
|
||||||
if (ext)
|
if (ext)
|
||||||
snprintf(buf, bufsize, "%s%s", subst.macName, ext);
|
snprintf(buf, bufsize, "%s%s", subst.expandedName, ext);
|
||||||
else
|
else
|
||||||
strncpy(buf, subst.macName, bufsize);
|
strncpy(buf, subst.expandedName, bufsize);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kGenAsIs:
|
case kGenAsIs:
|
||||||
strncpy(buf, subst.macName, bufsize);
|
strncpy(buf, subst.expandedName, bufsize);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -325,7 +325,7 @@ static void applySubstResFileName(const SubstResFileNames &subst, char *buf, int
|
||||||
}
|
}
|
||||||
|
|
||||||
bool applySubstResFileName(const SubstResFileNames &subst, const char *filename, char *buf, int bufsize) {
|
bool applySubstResFileName(const SubstResFileNames &subst, const char *filename, char *buf, int bufsize) {
|
||||||
if (subst.winName == 0)
|
if (subst.almostGameID == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
size_t len = strlen(filename);
|
size_t len = strlen(filename);
|
||||||
|
@ -341,7 +341,7 @@ bool applySubstResFileName(const SubstResFileNames &subst, const char *filename,
|
||||||
if (ext)
|
if (ext)
|
||||||
len = ext - filename;
|
len = ext - filename;
|
||||||
|
|
||||||
if (!scumm_strnicmp(filename, subst.winName, len)) {
|
if (!scumm_strnicmp(filename, subst.almostGameID, len)) {
|
||||||
applySubstResFileName(subst, buf, bufsize, ext, num);
|
applySubstResFileName(subst, buf, bufsize, ext, num);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -367,8 +367,8 @@ int findSubstResFileName(SubstResFileNames &subst, const char *filename, int ind
|
||||||
len = ext - filename;
|
len = ext - filename;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = index; substResFileNameTable[i].winName; i++) {
|
for (i = index; substResFileNameTable[i].almostGameID; i++) {
|
||||||
if (!scumm_strnicmp(filename, substResFileNameTable[i].winName, len)) {
|
if (!scumm_strnicmp(filename, substResFileNameTable[i].almostGameID, len)) {
|
||||||
subst = substResFileNameTable[i];
|
subst = substResFileNameTable[i];
|
||||||
return i+1;
|
return i+1;
|
||||||
}
|
}
|
||||||
|
@ -442,12 +442,12 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
|
||||||
|
|
||||||
// We read data directly from NES ROM instead of extracting it with
|
// We read data directly from NES ROM instead of extracting it with
|
||||||
// external tool
|
// external tool
|
||||||
if ((_game.platform == Common::kPlatformNES) && _substResFileName.winName) {
|
if ((_game.platform == Common::kPlatformNES) && _substResFileName.almostGameID) {
|
||||||
char tmpBuf[128];
|
char tmpBuf[128];
|
||||||
generateSubstResFileName("00.LFL", tmpBuf, sizeof(tmpBuf));
|
generateSubstResFileName("00.LFL", tmpBuf, sizeof(tmpBuf));
|
||||||
_fileHandle = new ScummNESFile();
|
_fileHandle = new ScummNESFile();
|
||||||
_containerFile = tmpBuf;
|
_containerFile = tmpBuf;
|
||||||
} else if ((_game.platform == Common::kPlatformC64) && _substResFileName.winName) {
|
} else if ((_game.platform == Common::kPlatformC64) && _substResFileName.almostGameID) {
|
||||||
const char *tmpBuf1, *tmpBuf2;
|
const char *tmpBuf1, *tmpBuf2;
|
||||||
if (_game.id == GID_MANIAC) {
|
if (_game.id == GID_MANIAC) {
|
||||||
tmpBuf1 = "maniac1.d64";
|
tmpBuf1 = "maniac1.d64";
|
||||||
|
@ -471,12 +471,12 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
|
||||||
// (we do that here); the rest is handled by the ScummFile class and
|
// (we do that here); the rest is handled by the ScummFile class and
|
||||||
// code in openResourceFile() (and in the Sound class, for MONSTER.SOU
|
// code in openResourceFile() (and in the Sound class, for MONSTER.SOU
|
||||||
// handling).
|
// handling).
|
||||||
if (_game.version >= 5 && _game.heversion == 0 && _substResFileName.winName &&
|
if (_game.version >= 5 && _game.heversion == 0 && _substResFileName.almostGameID &&
|
||||||
_game.platform == Common::kPlatformMacintosh &&
|
_game.platform == Common::kPlatformMacintosh &&
|
||||||
_substResFileName.genMethod == kGenAsIs) {
|
_substResFileName.genMethod == kGenAsIs) {
|
||||||
if (_fileHandle->open(_substResFileName.macName)) {
|
if (_fileHandle->open(_substResFileName.expandedName)) {
|
||||||
_containerFile = _substResFileName.macName;
|
_containerFile = _substResFileName.expandedName;
|
||||||
_substResFileName.winName = 0;
|
_substResFileName.almostGameID = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -343,8 +343,8 @@ enum GenMethods {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SubstResFileNames {
|
struct SubstResFileNames {
|
||||||
const char *winName;
|
const char *almostGameID;
|
||||||
const char *macName;
|
const char *expandedName;
|
||||||
GenMethods genMethod;
|
GenMethods genMethod;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ ScummFile *Sound::openSfxFile() {
|
||||||
basename[0] = _vm->getBaseName();
|
basename[0] = _vm->getBaseName();
|
||||||
basename[1] = "monster";
|
basename[1] = "monster";
|
||||||
|
|
||||||
if (_vm->_substResFileName.winName != 0) {
|
if (_vm->_substResFileName.almostGameID != 0) {
|
||||||
|
|
||||||
strcpy(buf, basename[0]);
|
strcpy(buf, basename[0]);
|
||||||
_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
|
_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
|
||||||
|
@ -1033,7 +1033,7 @@ ScummFile *Sound::openSfxFile() {
|
||||||
sprintf(buf, "%s.tlk", _vm->getBaseName());
|
sprintf(buf, "%s.tlk", _vm->getBaseName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_vm->_substResFileName.winName != 0) {
|
if (_vm->_substResFileName.almostGameID != 0) {
|
||||||
_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
|
_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
|
||||||
strcpy(buf, buf1);
|
strcpy(buf, buf1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue