KYRA: (EOB/PC98) - fix original save file loading

This commit is contained in:
athrxx 2019-12-06 20:46:01 +01:00
parent f01d432c25
commit f446242215
2 changed files with 8 additions and 8 deletions

View File

@ -573,9 +573,9 @@ Common::Error EoBCoreEngine::go() {
// Import original save game files (especially the "Quick Start Party")
if (ConfMan.getBool("importOrigSaves")) {
//importOriginalSaveFile(-1);
//ConfMan.setBool("importOrigSaves", false);
//ConfMan.flushToDisk();
importOriginalSaveFile(-1);
ConfMan.setBool("importOrigSaves", false);
ConfMan.flushToDisk();
}
loadItemDefs();

View File

@ -648,7 +648,7 @@ Common::String EoBCoreEngine::readOriginalSaveFile(Common::String &file) {
Common::SeekableSubReadStream test(fs, 0, fs->size(), DisposeAfterUse::NO);
// detect source platform
// detect source platform (PC98 has the exact same file layout as DOS)
Common::Platform sourcePlatform = Common::kPlatformDOS;
test.seek(32);
uint16 testSJIS = test.readByte();
@ -656,9 +656,9 @@ Common::String EoBCoreEngine::readOriginalSaveFile(Common::String &file) {
int8 testStr = test.readSByte();
test.seek(66);
int8 testChr = test.readSByte();
test.seek(_flags.gameID == GI_EOB1 ? 48 : 70);
test.seek(_flags.gameID == GI_EOB1 ? 39 : 61);
uint32 exp = test.readUint32LE();
test.seek(_flags.gameID == GI_EOB1 ? 61 : 47);
test.seek(_flags.gameID == GI_EOB1 ? 61 : 27);
bool padding = !test.readByte();
test.seek(0);
@ -667,7 +667,7 @@ Common::String EoBCoreEngine::readOriginalSaveFile(Common::String &file) {
sourcePlatform = Common::kPlatformFMTowns;
}
if (padding && sourcePlatform == Common::kPlatformDOS && exp & 0xFF000000)
if (sourcePlatform == Common::kPlatformDOS && padding && (exp & 0xFF000000))
sourcePlatform = Common::kPlatformAmiga;
Common::SeekableSubReadStreamEndian in(fs, 0, fs->size(), sourcePlatform == Common::kPlatformAmiga, DisposeAfterUse::YES);
@ -702,7 +702,7 @@ Common::String EoBCoreEngine::readOriginalSaveFile(Common::String &file) {
c->constitutionCur = in.readSByte();
c->constitutionMax = in.readSByte();
c->charismaCur = in.readSByte();
c->charismaMax = in.readSByte();
c->charismaMax = in.readSByte();
if (_flags.gameID == GI_EOB2 && sourcePlatform == Common::kPlatformAmiga)
in.skip(1);
c->hitPointsCur = (_flags.gameID == GI_EOB1) ? in.readSByte() : in.readSint16();