mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 11:36:22 +00:00
SCUMM: Split ScummEngine::generateFilename, move HE specifics to class ScummEngine_v60he
This commit is contained in:
parent
fb53303847
commit
f19b27388c
@ -77,8 +77,6 @@ Common::String ScummEngine::generateFilename(const int room) const {
|
||||
snprintf(buf, sizeof(buf), "disk%02d.lec", diskNumber);
|
||||
}
|
||||
} else {
|
||||
char id = 0;
|
||||
|
||||
switch (_filenamePattern.genMethod) {
|
||||
case kGenDiskNum:
|
||||
snprintf(buf, sizeof(buf), _filenamePattern.pattern, diskNumber);
|
||||
@ -88,59 +86,6 @@ Common::String ScummEngine::generateFilename(const int room) const {
|
||||
snprintf(buf, sizeof(buf), _filenamePattern.pattern, room);
|
||||
break;
|
||||
|
||||
case kGenHEMac:
|
||||
case kGenHEMacNoParens:
|
||||
case kGenHEPC:
|
||||
if (room < 0) {
|
||||
id = '0' - room;
|
||||
} else if (_game.heversion >= 98) {
|
||||
int disk = 0;
|
||||
if (_heV7DiskOffsets)
|
||||
disk = _heV7DiskOffsets[room];
|
||||
|
||||
switch (disk) {
|
||||
case 2:
|
||||
id = 'b';
|
||||
// Special cases for Blue's games, which share common (b) files
|
||||
if (_game.id == GID_BIRTHDAY && !(_game.features & GF_DEMO))
|
||||
strcpy(buf, "Blue'sBirthday.(b)");
|
||||
else if (_game.id == GID_TREASUREHUNT)
|
||||
strcpy(buf, "Blue'sTreasureHunt.(b)");
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s.(b)", _filenamePattern.pattern);
|
||||
break;
|
||||
case 1:
|
||||
id = 'a';
|
||||
snprintf(buf, sizeof(buf), "%s.(a)", _filenamePattern.pattern);
|
||||
break;
|
||||
default:
|
||||
id = '0';
|
||||
snprintf(buf, sizeof(buf), "%s.he0", _filenamePattern.pattern);
|
||||
}
|
||||
} else if (_game.heversion >= 70) {
|
||||
id = (room == 0) ? '0' : '1';
|
||||
} else {
|
||||
id = diskNumber + '0';
|
||||
}
|
||||
|
||||
if (_filenamePattern.genMethod == kGenHEPC) {
|
||||
// For HE >= 98, we already called snprintf above.
|
||||
if (_game.heversion < 98 || room < 0)
|
||||
snprintf(buf, sizeof(buf), "%s.he%c", _filenamePattern.pattern, id);
|
||||
} else {
|
||||
if (id == '3') { // special case for cursors
|
||||
// For mac they're stored in game binary
|
||||
strncpy(buf, _filenamePattern.pattern, sizeof(buf));
|
||||
} else {
|
||||
if (_filenamePattern.genMethod == kGenHEMac)
|
||||
snprintf(buf, sizeof(buf), "%s (%c)", _filenamePattern.pattern, id);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s %c", _filenamePattern.pattern, id);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case kGenUnchanged:
|
||||
strncpy(buf, _filenamePattern.pattern, sizeof(buf));
|
||||
break;
|
||||
@ -153,6 +98,73 @@ Common::String ScummEngine::generateFilename(const int room) const {
|
||||
return buf;
|
||||
}
|
||||
|
||||
Common::String ScummEngine_v60he::generateFilename(const int room) const {
|
||||
char buf[128];
|
||||
char id = 0;
|
||||
|
||||
switch (_filenamePattern.genMethod) {
|
||||
case kGenHEMac:
|
||||
case kGenHEMacNoParens:
|
||||
case kGenHEPC:
|
||||
if (room < 0) {
|
||||
id = '0' - room;
|
||||
} else if (_game.heversion >= 98) {
|
||||
int disk = 0;
|
||||
if (_heV7DiskOffsets)
|
||||
disk = _heV7DiskOffsets[room];
|
||||
|
||||
switch (disk) {
|
||||
case 2:
|
||||
id = 'b';
|
||||
// Special cases for Blue's games, which share common (b) files
|
||||
if (_game.id == GID_BIRTHDAY && !(_game.features & GF_DEMO))
|
||||
strcpy(buf, "Blue'sBirthday.(b)");
|
||||
else if (_game.id == GID_TREASUREHUNT)
|
||||
strcpy(buf, "Blue'sTreasureHunt.(b)");
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s.(b)", _filenamePattern.pattern);
|
||||
break;
|
||||
case 1:
|
||||
id = 'a';
|
||||
snprintf(buf, sizeof(buf), "%s.(a)", _filenamePattern.pattern);
|
||||
break;
|
||||
default:
|
||||
id = '0';
|
||||
snprintf(buf, sizeof(buf), "%s.he0", _filenamePattern.pattern);
|
||||
}
|
||||
} else if (_game.heversion >= 70) {
|
||||
id = (room == 0) ? '0' : '1';
|
||||
} else {
|
||||
const int diskNumber = (room > 0) ? _res->roomno[rtRoom][room] : 0;
|
||||
id = diskNumber + '0';
|
||||
}
|
||||
|
||||
if (_filenamePattern.genMethod == kGenHEPC) {
|
||||
// For HE >= 98, we already called snprintf above.
|
||||
if (_game.heversion < 98 || room < 0)
|
||||
snprintf(buf, sizeof(buf), "%s.he%c", _filenamePattern.pattern, id);
|
||||
} else {
|
||||
if (id == '3') { // special case for cursors
|
||||
// For mac they're stored in game binary
|
||||
strncpy(buf, _filenamePattern.pattern, sizeof(buf));
|
||||
} else {
|
||||
if (_filenamePattern.genMethod == kGenHEMac)
|
||||
snprintf(buf, sizeof(buf), "%s (%c)", _filenamePattern.pattern, id);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s %c", _filenamePattern.pattern, id);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
// Fallback to original method
|
||||
return ScummEngine::generateFilename(room);
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static Common::String generateFilenameForDetection(const char *pattern, FilenameGenMethod genMethod) {
|
||||
char buf[128];
|
||||
|
||||
|
@ -67,6 +67,8 @@ public:
|
||||
ScummEngine_v60he(OSystem *syst, const DetectorResult &dr);
|
||||
~ScummEngine_v60he();
|
||||
|
||||
virtual Common::String generateFilename(const int room) const;
|
||||
|
||||
virtual void resetScumm();
|
||||
|
||||
protected:
|
||||
|
@ -613,7 +613,7 @@ public:
|
||||
|
||||
FilenamePattern _filenamePattern;
|
||||
|
||||
Common::String generateFilename(const int room) const;
|
||||
virtual Common::String generateFilename(const int room) const;
|
||||
|
||||
protected:
|
||||
Common::KeyState _keyPressed;
|
||||
|
Loading…
x
Reference in New Issue
Block a user