mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
MORTEVIELLE: Add detection entry for improved German translation
I also reworked a bit how detection work so that both the original and the improved German translations can be played.
This commit is contained in:
parent
3ef4222f33
commit
800ee561c9
@ -30,6 +30,7 @@ namespace Mortevielle {
|
||||
struct MortevielleGameDescription {
|
||||
ADGameDescription desc;
|
||||
Common::Language originalLanguage;
|
||||
uint8 dataFeature;
|
||||
};
|
||||
|
||||
uint32 MortevielleEngine::getGameFlags() const { return _gameDescription->desc.flags; }
|
||||
@ -38,6 +39,8 @@ Common::Language MortevielleEngine::getLanguage() const { return _gameDescriptio
|
||||
|
||||
Common::Language MortevielleEngine::getOriginalLanguage() const { return _gameDescription->originalLanguage; }
|
||||
|
||||
bool MortevielleEngine::useOriginalData() const { return _gameDescription->dataFeature == kUseOriginalData; }
|
||||
|
||||
}
|
||||
|
||||
static const PlainGameDescriptor MortevielleGame[] = {
|
||||
@ -53,6 +56,9 @@ public:
|
||||
MortevielleGame) {
|
||||
_md5Bytes = 512;
|
||||
_singleid = "mortevielle";
|
||||
// Use kADFlagUseExtraAsHint to distinguish between original and improved versions
|
||||
// (i.e. use or not of the game data file).
|
||||
_flags = kADFlagUseExtraAsHint;
|
||||
}
|
||||
virtual const char *getName() const {
|
||||
return "Mortevielle";
|
||||
|
@ -37,7 +37,7 @@ static const MortevielleGameDescription MortevielleGameDescriptions[] = {
|
||||
Common::kPlatformDOS,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO0()
|
||||
}, Common::FR_FRA
|
||||
}, Common::FR_FRA, kUseOriginalData
|
||||
},
|
||||
// German
|
||||
{
|
||||
@ -53,7 +53,24 @@ static const MortevielleGameDescription MortevielleGameDescriptions[] = {
|
||||
Common::kPlatformDOS,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO0()
|
||||
}, Common::DE_DEU
|
||||
}, Common::DE_DEU, kUseOriginalData
|
||||
},
|
||||
|
||||
// German, improved translation
|
||||
{
|
||||
{
|
||||
"mortevielle",
|
||||
"Improved Translation",
|
||||
{
|
||||
{"menual.mor", 0, "792aea282b07a1d74c4a4abeabc90c19", 144},
|
||||
{"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744},
|
||||
AD_LISTEND
|
||||
},
|
||||
Common::DE_DEU,
|
||||
Common::kPlatformDOS,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO0()
|
||||
}, Common::DE_DEU, kUseEngineDataFile
|
||||
},
|
||||
|
||||
// DOS English version doesn't exist. Technically, they are French or German versions,
|
||||
@ -73,7 +90,7 @@ static const MortevielleGameDescription MortevielleGameDescriptions[] = {
|
||||
Common::kPlatformDOS,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO0()
|
||||
}, Common::FR_FRA
|
||||
}, Common::FR_FRA, kUseEngineDataFile
|
||||
},
|
||||
|
||||
// English on top of German version
|
||||
@ -90,10 +107,10 @@ static const MortevielleGameDescription MortevielleGameDescriptions[] = {
|
||||
Common::kPlatformDOS,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO0()
|
||||
}, Common::DE_DEU
|
||||
}, Common::DE_DEU, kUseEngineDataFile
|
||||
},
|
||||
|
||||
{ AD_TABLE_END_MARKER , Common::EN_ANY}
|
||||
{ AD_TABLE_END_MARKER , Common::EN_ANY, kUseEngineDataFile}
|
||||
};
|
||||
|
||||
} // End of namespace Mortevielle
|
||||
|
@ -598,67 +598,69 @@ void Menu::initMenu() {
|
||||
Common::File f;
|
||||
|
||||
bool menuLoaded = false;
|
||||
// First try to read it from mort.dat
|
||||
if (!f.open(MORT_DAT))
|
||||
warning("File %s not found. Using default menu from game data", MORT_DAT);
|
||||
else {
|
||||
// Figure out what language Id is needed
|
||||
byte desiredLanguageId;
|
||||
switch(_vm->getLanguage()) {
|
||||
case Common::EN_ANY:
|
||||
desiredLanguageId = MORTDAT_LANG_ENGLISH;
|
||||
break;
|
||||
case Common::FR_FRA:
|
||||
desiredLanguageId = MORTDAT_LANG_FRENCH;
|
||||
break;
|
||||
case Common::DE_DEU:
|
||||
desiredLanguageId = MORTDAT_LANG_GERMAN;
|
||||
break;
|
||||
default:
|
||||
warning("Language not supported, switching to English");
|
||||
desiredLanguageId = MORTDAT_LANG_ENGLISH;
|
||||
break;
|
||||
}
|
||||
// First try to read it from mort.dat if useOriginalData() is false
|
||||
if (!_vm->useOriginalData()) {
|
||||
if (!f.open(MORT_DAT))
|
||||
warning("File %s not found. Using default menu from game data", MORT_DAT);
|
||||
else {
|
||||
// Figure out what language Id is needed
|
||||
byte desiredLanguageId;
|
||||
switch(_vm->getLanguage()) {
|
||||
case Common::EN_ANY:
|
||||
desiredLanguageId = MORTDAT_LANG_ENGLISH;
|
||||
break;
|
||||
case Common::FR_FRA:
|
||||
desiredLanguageId = MORTDAT_LANG_FRENCH;
|
||||
break;
|
||||
case Common::DE_DEU:
|
||||
desiredLanguageId = MORTDAT_LANG_GERMAN;
|
||||
break;
|
||||
default:
|
||||
warning("Language not supported, switching to English");
|
||||
desiredLanguageId = MORTDAT_LANG_ENGLISH;
|
||||
break;
|
||||
}
|
||||
|
||||
// Validate the data file header
|
||||
char fileId[4];
|
||||
f.read(fileId, 4);
|
||||
// Do not display warnings here. They would already have been displayed in MortevielleEngine::loadMortDat().
|
||||
if (strncmp(fileId, "MORT", 4) == 0 && f.readByte() >= MORT_DAT_REQUIRED_VERSION) {
|
||||
f.readByte(); // Minor version
|
||||
// Loop to load resources from the data file
|
||||
while (f.pos() < f.size()) {
|
||||
// Get the Id and size of the next resource
|
||||
char dataType[4];
|
||||
int dataSize;
|
||||
f.read(dataType, 4);
|
||||
dataSize = f.readUint16LE();
|
||||
if (!strncmp(dataType, "MENU", 4)) {
|
||||
// Read in the language
|
||||
byte languageId = f.readByte();
|
||||
--dataSize;
|
||||
// Validate the data file header
|
||||
char fileId[4];
|
||||
f.read(fileId, 4);
|
||||
// Do not display warnings here. They would already have been displayed in MortevielleEngine::loadMortDat().
|
||||
if (strncmp(fileId, "MORT", 4) == 0 && f.readByte() >= MORT_DAT_REQUIRED_VERSION) {
|
||||
f.readByte(); // Minor version
|
||||
// Loop to load resources from the data file
|
||||
while (f.pos() < f.size()) {
|
||||
// Get the Id and size of the next resource
|
||||
char dataType[4];
|
||||
int dataSize;
|
||||
f.read(dataType, 4);
|
||||
dataSize = f.readUint16LE();
|
||||
if (!strncmp(dataType, "MENU", 4)) {
|
||||
// Read in the language
|
||||
byte languageId = f.readByte();
|
||||
--dataSize;
|
||||
|
||||
// If the language isn't correct, then skip the entire block
|
||||
if (languageId != desiredLanguageId) {
|
||||
// If the language isn't correct, then skip the entire block
|
||||
if (languageId != desiredLanguageId) {
|
||||
f.skip(dataSize);
|
||||
continue;
|
||||
}
|
||||
if (dataSize == 6 * 24) {
|
||||
f.read(_charArr, dataSize);
|
||||
menuLoaded = true;
|
||||
} else
|
||||
warning("Wrong size %d for menu data. Expected %d or less", dataSize, 6 * 24);
|
||||
break;
|
||||
} else {
|
||||
// Other sections
|
||||
f.skip(dataSize);
|
||||
continue;
|
||||
}
|
||||
if (dataSize == 6 * 24) {
|
||||
f.read(_charArr, dataSize);
|
||||
menuLoaded = true;
|
||||
} else
|
||||
warning("Wrong size %d for menu data. Expected %d or less", dataSize, 6 * 24);
|
||||
break;
|
||||
} else {
|
||||
// Other sections
|
||||
f.skip(dataSize);
|
||||
}
|
||||
}
|
||||
// Close the file
|
||||
f.close();
|
||||
if (!menuLoaded)
|
||||
warning("Failed to load menu from mort.dat. Will use default menu from game data instead.");
|
||||
}
|
||||
// Close the file
|
||||
f.close();
|
||||
if (!menuLoaded)
|
||||
warning("Failed to load menu from mort.dat. Will use default menu from game data instead.");
|
||||
}
|
||||
|
||||
if (!menuLoaded) {
|
||||
|
@ -62,6 +62,11 @@ enum {
|
||||
MORTDAT_LANG_GERMAN = 2
|
||||
};
|
||||
|
||||
enum {
|
||||
kUseOriginalData = 0,
|
||||
kUseEngineDataFile = 1
|
||||
};
|
||||
|
||||
// Static string list
|
||||
enum {
|
||||
S_YES_NO = 0, S_GO_TO = 1, S_SOMEONE_ENTERS = 2, S_COOL = 3, S_LOURDE = 4,
|
||||
@ -444,6 +449,7 @@ public:
|
||||
uint32 getGameFlags() const;
|
||||
Common::Language getLanguage() const;
|
||||
Common::Language getOriginalLanguage() const;
|
||||
bool useOriginalData() const;
|
||||
static Common::String generateSaveFilename(const Common::String &target, int slot);
|
||||
Common::String generateSaveFilename(int slot) { return generateSaveFilename(_targetName, slot); }
|
||||
|
||||
|
@ -1993,8 +1993,8 @@ void MortevielleEngine::loadTexts() {
|
||||
Common::File ntpFile;
|
||||
|
||||
_txxFileFl = false;
|
||||
if (getLanguage() == Common::EN_ANY) {
|
||||
warning("English version expected - Switching to DAT file");
|
||||
if (!useOriginalData()) {
|
||||
warning("Using improved translation from DAT file");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user