From aa720ca9cd035912a422ece64111d80346b4f477 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Wed, 21 Sep 2016 10:45:16 -0500 Subject: SCI32: Fix deleting save games in KQ7 --- engines/sci/engine/kfile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 0980f3cdfe..596ff5e65a 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -378,7 +378,7 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) { byte *out = buffer; for (uint i = 0; i < numSaves; ++i) { - WRITE_UINT16(out, saves[i].id); + WRITE_UINT16(out, saves[i].id - kSaveIdShift); Common::strlcpy((char *)out + sizeof(int16), saves[i].name, SCI_MAX_SAVENAME_LENGTH); out += recordSize; } @@ -542,6 +542,13 @@ reg_t kFileIOUnlink(EngineState *s, int argc, reg_t *argv) { result = saveFileMan->removeSavefile(name); #ifdef ENABLE_SCI32 } else if (getSciVersion() >= SCI_VERSION_2) { + // Special case for KQ7, basically identical to the SQ4 case above, + // where the game hardcodes its save game names + if (name.hasPrefix("kq7cdsg.")) { + int saveNo = atoi(name.c_str() + name.size() - 3); + name = g_sci->getSavegameName(saveNo + kSaveIdShift); + } + // The file name may be already wrapped, so check both cases result = saveFileMan->removeSavefile(name); if (!result) { -- cgit v1.2.3