From 817887216da95d8065eb187bd887cb08f7618736 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sun, 24 Sep 2017 01:49:27 -0500 Subject: SCI32: Fix RAMA auto-save game Despite what game script disassembly lead me to believe, the game seems to create only one auto-save, which ends up being saved as 911.sg (not autorama.sg). This save file is created just before entering the underground Avian Lair in New York, and seems to be designed as some emergency backup since entering the Avian Lair is a one-way trip. --- engines/sci/engine/kfile.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index db7bbce640..d87013f01c 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -444,7 +444,7 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) { return SIGNAL_REG; } else if (g_sci->getGameId() == GID_RAMA) { int saveNo = -1; - if (name == "autorama.sg") { + if (name == "911.sg") { saveNo = kAutoSaveId; } else if (sscanf(name.c_str(), "ramasg.%i", &saveNo) == 1) { saveNo += kSaveIdShift; @@ -470,7 +470,9 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) { out = saveFileMan->openForSaving(fileName); if (out) { Common::String saveName; - if (saveNo != kAutoSaveId) { + if (saveNo == kAutoSaveId) { + saveName = _("(Autosave)"); + } else { saveName = getRamaSaveName(s, saveNo - kSaveIdShift); } Common::ScopedPtr versionFile(SearchMan.createReadStreamForMember("VERSION")); @@ -936,13 +938,12 @@ reg_t kFileIOWriteByte(EngineState *s, int argc, reg_t *argv) { } reg_t kFileIOReadWord(EngineState *s, int argc, reg_t *argv) { - const uint16 handle = argv[0].toUint16(); - FileHandle *f = getFileFromHandle(s, handle); + FileHandle *f = getFileFromHandle(s, argv[0].toUint16()); if (!f) return s->r_acc; reg_t value; - if (s->_fileHandles[handle]._name == "-scummvm-save-") { + if (f->_name == "-scummvm-save-") { value._segment = f->_in->readUint16LE(); value._offset = f->_in->readUint16LE(); } else { @@ -968,12 +969,12 @@ reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } - if (s->_fileHandles[handle]._name == "-scummvm-save-") { + if (f->_name == "-scummvm-save-") { f->_out->writeUint16LE(argv[1]._segment); f->_out->writeUint16LE(argv[1]._offset); } else { if (argv[1].isPointer()) { - error("Attempt to write non-number %04x:%04x", PRINT_REG(argv[1])); + error("kFileIO(WriteWord): Attempt to write non-number %04x:%04x to non-save file", PRINT_REG(argv[1])); } f->_out->writeUint16LE(argv[1].toUint16()); } -- cgit v1.2.3