2009-12-29 23:18:24 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-06-26 17:21:50 +00:00
|
|
|
#include "mohawk/resource.h"
|
2009-12-29 23:18:24 +00:00
|
|
|
#include "mohawk/riven.h"
|
|
|
|
#include "mohawk/riven_saveload.h"
|
|
|
|
|
|
|
|
#include "common/util.h"
|
|
|
|
|
|
|
|
namespace Mohawk {
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
RivenSaveLoad::RivenSaveLoad(MohawkEngine_Riven *vm, Common::SaveFileManager *saveFileMan) : _vm(vm), _saveFileMan(saveFileMan) {
|
|
|
|
}
|
|
|
|
|
|
|
|
RivenSaveLoad::~RivenSaveLoad() {
|
|
|
|
}
|
|
|
|
|
2010-03-18 15:54:40 +00:00
|
|
|
Common::StringArray RivenSaveLoad::generateSaveGameList() {
|
2009-12-29 23:18:24 +00:00
|
|
|
return _saveFileMan->listSavefiles("*.rvn");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Note: The stack numbers we use do not match up to what the original executable,
|
|
|
|
// so, match them ;)
|
|
|
|
static uint16 mapOldStackIDToNew(uint16 oldID) {
|
|
|
|
switch (oldID) {
|
2009-12-30 07:14:09 +00:00
|
|
|
case 1:
|
|
|
|
return ospit;
|
|
|
|
case 2:
|
|
|
|
return pspit;
|
|
|
|
case 3:
|
|
|
|
return rspit;
|
|
|
|
case 4:
|
|
|
|
return tspit;
|
|
|
|
case 5:
|
|
|
|
return bspit;
|
|
|
|
case 6:
|
|
|
|
return gspit;
|
|
|
|
case 7:
|
|
|
|
return jspit;
|
|
|
|
case 8:
|
|
|
|
return aspit;
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
2010-06-26 17:21:50 +00:00
|
|
|
|
|
|
|
error("Unknown old stack ID %d", oldID);
|
2009-12-29 23:18:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint16 mapNewStackIDToOld(uint16 newID) {
|
|
|
|
switch (newID) {
|
2009-12-30 07:14:09 +00:00
|
|
|
case aspit:
|
|
|
|
return 8;
|
|
|
|
case bspit:
|
|
|
|
return 5;
|
|
|
|
case gspit:
|
|
|
|
return 6;
|
|
|
|
case jspit:
|
|
|
|
return 7;
|
|
|
|
case ospit:
|
|
|
|
return 1;
|
|
|
|
case pspit:
|
|
|
|
return 2;
|
|
|
|
case rspit:
|
|
|
|
return 3;
|
|
|
|
case tspit:
|
|
|
|
return 4;
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
2010-06-26 17:21:50 +00:00
|
|
|
|
|
|
|
error("Unknown new stack ID %d", newID);
|
2009-12-29 23:18:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RivenSaveLoad::loadGame(Common::String filename) {
|
|
|
|
if (_vm->getFeatures() & GF_DEMO) // Don't load games in the demo
|
|
|
|
return false;
|
|
|
|
|
2010-06-26 17:21:50 +00:00
|
|
|
Common::InSaveFile *loadFile = _saveFileMan->openForLoading(filename);
|
|
|
|
if (!loadFile)
|
2009-12-29 23:18:24 +00:00
|
|
|
return false;
|
|
|
|
|
2010-06-26 17:21:50 +00:00
|
|
|
debug(0, "Loading game from \'%s\'", filename.c_str());
|
|
|
|
|
|
|
|
MohawkArchive *mhk = new MohawkArchive();
|
|
|
|
mhk->open(loadFile);
|
2009-12-29 23:18:24 +00:00
|
|
|
|
|
|
|
// First, let's make sure we're using a saved game file from this version of Riven by checking the VERS resource
|
2010-06-26 17:21:50 +00:00
|
|
|
Common::SeekableReadStream *vers = mhk->getRawData(ID_VERS, 1);
|
2009-12-29 23:18:24 +00:00
|
|
|
uint32 saveGameVersion = vers->readUint32BE();
|
|
|
|
delete vers;
|
|
|
|
if ((saveGameVersion == kCDSaveGameVersion && (_vm->getFeatures() & GF_DVD))
|
|
|
|
|| (saveGameVersion == kDVDSaveGameVersion && !(_vm->getFeatures() & GF_DVD))) {
|
2010-06-26 17:21:50 +00:00
|
|
|
warning("Incompatible saved game versions. No support for this yet.");
|
|
|
|
delete mhk;
|
2009-12-29 23:18:24 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now, we'll read in the variable values.
|
2010-06-26 17:21:50 +00:00
|
|
|
Common::SeekableReadStream *vars = mhk->getRawData(ID_VARS, 1);
|
2009-12-29 23:18:24 +00:00
|
|
|
Common::Array<uint32> rawVariables;
|
|
|
|
|
|
|
|
while (!vars->eos()) {
|
|
|
|
vars->readUint32BE(); // Unknown (Stack?)
|
|
|
|
vars->readUint32BE(); // Unknown (0 or 1)
|
|
|
|
rawVariables.push_back(vars->readUint32BE());
|
|
|
|
}
|
|
|
|
|
|
|
|
delete vars;
|
|
|
|
|
|
|
|
// Next, we set the variables based on the name found by the index in the VARS resource.
|
|
|
|
// TODO: Merge with code in mohawk.cpp for loading names?
|
2010-06-26 17:21:50 +00:00
|
|
|
Common::SeekableReadStream *names = mhk->getRawData(ID_NAME, 1);
|
2009-12-29 23:18:24 +00:00
|
|
|
|
|
|
|
uint16 namesCount = names->readUint16BE();
|
|
|
|
uint16 *stringOffsets = new uint16[namesCount];
|
|
|
|
for (uint16 i = 0; i < namesCount; i++)
|
|
|
|
stringOffsets[i] = names->readUint16BE();
|
|
|
|
for (uint16 i = 0; i < namesCount; i++)
|
|
|
|
names->readUint16BE(); // Skip unknown values
|
|
|
|
uint32 curNamesPos = names->pos();
|
|
|
|
|
|
|
|
uint16 stackID = 0;
|
|
|
|
uint16 cardID = 0;
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
for (uint32 i = 0; i < rawVariables.size() && i < namesCount && !names->eos(); i++) {
|
|
|
|
names->seek(curNamesPos);
|
|
|
|
names->seek(stringOffsets[i], SEEK_CUR);
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-30 23:01:16 +00:00
|
|
|
Common::String name;
|
2009-12-29 23:18:24 +00:00
|
|
|
char c = (char)names->readByte();
|
|
|
|
|
|
|
|
while (c) {
|
|
|
|
name += c;
|
|
|
|
c = (char)names->readByte();
|
|
|
|
}
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2010-06-26 17:21:50 +00:00
|
|
|
// TODO: Some versions have two extra variables. However, the saves are
|
|
|
|
// still compatible with other saves of the same version (they come from DVD v1.1).
|
|
|
|
// There are used in the whark number puzzle. I thought jleftpos and jrightpos were
|
|
|
|
// for this purpose.
|
2010-02-16 01:48:19 +00:00
|
|
|
if (name == "dropLeftStart" || name == "dropRightStart")
|
|
|
|
continue;
|
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
uint32 *var = _vm->matchVarToString(name);
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
*var = rawVariables[i];
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2010-06-26 17:21:50 +00:00
|
|
|
if (name.equalsIgnoreCase("CurrentStackID"))
|
2009-12-29 23:18:24 +00:00
|
|
|
stackID = mapOldStackIDToNew(rawVariables[i]);
|
2010-06-26 17:21:50 +00:00
|
|
|
else if (name.equalsIgnoreCase("CurrentCardID"))
|
2009-12-29 23:18:24 +00:00
|
|
|
cardID = rawVariables[i];
|
2010-06-26 17:21:50 +00:00
|
|
|
else if (name.equalsIgnoreCase("ReturnStackID"))
|
2009-12-29 23:18:24 +00:00
|
|
|
*var = mapOldStackIDToNew(rawVariables[i]);
|
|
|
|
}
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
_vm->changeToStack(stackID);
|
|
|
|
_vm->changeToCard(cardID);
|
|
|
|
|
|
|
|
delete names;
|
2010-01-04 17:30:47 +00:00
|
|
|
delete[] stringOffsets;
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
// Reset zip mode data
|
|
|
|
_vm->_zipModeData.clear();
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
// Finally, we load in zip mode data.
|
2010-06-26 17:21:50 +00:00
|
|
|
Common::SeekableReadStream *zips = mhk->getRawData(ID_ZIPS, 1);
|
2009-12-29 23:18:24 +00:00
|
|
|
uint16 zipsRecordCount = zips->readUint16BE();
|
|
|
|
for (uint16 i = 0; i < zipsRecordCount; i++) {
|
|
|
|
ZipMode zip;
|
|
|
|
uint16 zipsNameLength = zips->readUint16BE();
|
|
|
|
for (uint16 j = 0; j < zipsNameLength; j++)
|
|
|
|
zip.name += zips->readByte();
|
|
|
|
zip.id = zips->readUint16BE();
|
|
|
|
_vm->_zipModeData.push_back(zip);
|
|
|
|
}
|
2010-06-26 17:21:50 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
delete zips;
|
2010-06-26 17:21:50 +00:00
|
|
|
delete mhk;
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() {
|
|
|
|
Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
|
|
|
|
if (_vm->getFeatures() & GF_DVD)
|
|
|
|
stream->writeUint32BE(kDVDSaveGameVersion);
|
|
|
|
else
|
|
|
|
stream->writeUint32BE(kCDSaveGameVersion);
|
|
|
|
return stream;
|
|
|
|
}
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVARSSection() {
|
|
|
|
Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
for (uint32 i = 0; i < _vm->getVarCount(); i++) {
|
|
|
|
stream->writeUint32BE(0); // Unknown
|
|
|
|
stream->writeUint32BE(0); // Unknown
|
2010-06-26 17:21:50 +00:00
|
|
|
|
|
|
|
// Remap returnstackid here because we don't actually want to change
|
|
|
|
// our internal returnstackid.
|
|
|
|
uint32 variable = _vm->getGlobalVar(i);
|
|
|
|
if (_vm->getGlobalVarName(i) == "returnstackid")
|
|
|
|
variable = mapNewStackIDToOld(variable);
|
|
|
|
|
|
|
|
stream->writeUint32BE(variable);
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return stream;
|
|
|
|
}
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genNAMESection() {
|
|
|
|
Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
stream->writeUint16BE((uint16)_vm->getVarCount());
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
uint16 curPos = 0;
|
|
|
|
for (uint16 i = 0; i < _vm->getVarCount(); i++) {
|
|
|
|
stream->writeUint16BE(curPos);
|
|
|
|
curPos += _vm->getGlobalVarName(i).size() + 1;
|
|
|
|
}
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
for (uint16 i = 0; i < _vm->getVarCount(); i++)
|
|
|
|
stream->writeUint16BE(i);
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
for (uint16 i = 0; i < _vm->getVarCount(); i++) {
|
|
|
|
stream->write(_vm->getGlobalVarName(i).c_str(), _vm->getGlobalVarName(i).size());
|
|
|
|
stream->writeByte(0);
|
|
|
|
}
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
return stream;
|
|
|
|
}
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genZIPSSection() {
|
|
|
|
Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
stream->writeUint16BE(_vm->_zipModeData.size());
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
for (uint16 i = 0; i < _vm->_zipModeData.size(); i++) {
|
|
|
|
stream->writeUint16BE(_vm->_zipModeData[i].name.size());
|
|
|
|
stream->write(_vm->_zipModeData[i].name.c_str(), _vm->_zipModeData[i].name.size());
|
|
|
|
stream->writeUint16BE(_vm->_zipModeData[i].id);
|
|
|
|
}
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RivenSaveLoad::saveGame(Common::String filename) {
|
|
|
|
// Note, this code is still WIP. It works quite well for now.
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
// Make sure we have the right extension
|
2010-06-26 17:21:50 +00:00
|
|
|
if (!filename.matchString("*.rvn", true))
|
2009-12-29 23:18:24 +00:00
|
|
|
filename += ".rvn";
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
// Convert class variables to variable numbers
|
|
|
|
*_vm->matchVarToString("currentstackid") = mapNewStackIDToOld(_vm->getCurStack());
|
|
|
|
*_vm->matchVarToString("currentcardid") = _vm->getCurCard();
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2010-06-26 17:21:50 +00:00
|
|
|
Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(filename);
|
|
|
|
if (!saveFile)
|
2009-12-29 23:18:24 +00:00
|
|
|
return false;
|
2010-06-26 17:21:50 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
debug (0, "Saving game to \'%s\'", filename.c_str());
|
|
|
|
|
|
|
|
Common::MemoryWriteStreamDynamic *versSection = genVERSSection();
|
|
|
|
Common::MemoryWriteStreamDynamic *nameSection = genNAMESection();
|
|
|
|
Common::MemoryWriteStreamDynamic *varsSection = genVARSSection();
|
|
|
|
Common::MemoryWriteStreamDynamic *zipsSection = genZIPSSection();
|
|
|
|
|
|
|
|
// Let's calculate the file size!
|
|
|
|
uint32 fileSize = 0;
|
|
|
|
fileSize += versSection->size();
|
|
|
|
fileSize += nameSection->size();
|
|
|
|
fileSize += varsSection->size();
|
|
|
|
fileSize += zipsSection->size();
|
|
|
|
fileSize += 16; // RSRC Header
|
|
|
|
fileSize += 4; // Type Table Header
|
|
|
|
fileSize += 4 * 8; // Type Table Entries
|
|
|
|
fileSize += 2; // Pseudo-Name entries
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
// IFF Header
|
|
|
|
saveFile->writeUint32BE(ID_MHWK);
|
|
|
|
saveFile->writeUint32BE(fileSize);
|
|
|
|
|
|
|
|
// RSRC Header
|
|
|
|
saveFile->writeUint32BE(ID_RSRC);
|
2010-01-26 23:05:52 +00:00
|
|
|
saveFile->writeUint16BE(0x100); // Resource Version (1.0)
|
|
|
|
saveFile->writeUint16BE(0); // No compaction
|
2009-12-29 23:18:24 +00:00
|
|
|
saveFile->writeUint32BE(fileSize + 8); // Add on the 8 from the IFF header
|
|
|
|
saveFile->writeUint32BE(28); // IFF + RSRC
|
|
|
|
saveFile->writeUint16BE(62); // File Table Offset
|
|
|
|
saveFile->writeUint16BE(44); // 4 + 4 * 10
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
//Type Table
|
|
|
|
saveFile->writeUint16BE(36); // After the Type Table Entries
|
|
|
|
saveFile->writeUint16BE(4); // 4 Type Table Entries
|
|
|
|
|
|
|
|
// Hardcode Entries
|
|
|
|
saveFile->writeUint32BE(ID_VERS);
|
|
|
|
saveFile->writeUint16BE(38);
|
|
|
|
saveFile->writeUint16BE(36);
|
|
|
|
|
|
|
|
saveFile->writeUint32BE(ID_NAME);
|
|
|
|
saveFile->writeUint16BE(44);
|
|
|
|
saveFile->writeUint16BE(36);
|
|
|
|
|
|
|
|
saveFile->writeUint32BE(ID_VARS);
|
|
|
|
saveFile->writeUint16BE(50);
|
|
|
|
saveFile->writeUint16BE(36);
|
|
|
|
|
|
|
|
saveFile->writeUint32BE(ID_ZIPS);
|
|
|
|
saveFile->writeUint16BE(56);
|
|
|
|
saveFile->writeUint16BE(36);
|
|
|
|
|
|
|
|
// Pseudo-Name Table/Name List
|
|
|
|
saveFile->writeUint16BE(0); // We don't need a name list
|
|
|
|
|
|
|
|
// VERS Section (Resource Table)
|
|
|
|
saveFile->writeUint16BE(1);
|
|
|
|
saveFile->writeUint16BE(1);
|
|
|
|
saveFile->writeUint16BE(1);
|
|
|
|
|
|
|
|
// NAME Section (Resource Table)
|
|
|
|
saveFile->writeUint16BE(1);
|
|
|
|
saveFile->writeUint16BE(1);
|
|
|
|
saveFile->writeUint16BE(2);
|
|
|
|
|
|
|
|
// VARS Section (Resource Table)
|
|
|
|
saveFile->writeUint16BE(1);
|
|
|
|
saveFile->writeUint16BE(1);
|
|
|
|
saveFile->writeUint16BE(3);
|
|
|
|
|
|
|
|
// ZIPS Section (Resource Table)
|
|
|
|
saveFile->writeUint16BE(1);
|
|
|
|
saveFile->writeUint16BE(1);
|
|
|
|
saveFile->writeUint16BE(4);
|
|
|
|
|
|
|
|
// File Table
|
|
|
|
saveFile->writeUint32BE(4);
|
|
|
|
|
|
|
|
// VERS Section (File Table)
|
|
|
|
saveFile->writeUint32BE(134);
|
|
|
|
saveFile->writeUint16BE(versSection->size() & 0xFFFF);
|
|
|
|
saveFile->writeByte((versSection->size() & 0xFF0000) >> 16);
|
|
|
|
saveFile->writeByte(0);
|
|
|
|
saveFile->writeUint16BE(0);
|
|
|
|
|
|
|
|
// NAME Section (File Table)
|
|
|
|
saveFile->writeUint32BE(134 + versSection->size());
|
|
|
|
saveFile->writeUint16BE(nameSection->size() & 0xFFFF);
|
|
|
|
saveFile->writeByte((nameSection->size() & 0xFF0000) >> 16);
|
|
|
|
saveFile->writeByte(0);
|
|
|
|
saveFile->writeUint16BE(0);
|
|
|
|
|
|
|
|
// VARS Section (File Table)
|
|
|
|
saveFile->writeUint32BE(134 + versSection->size() + nameSection->size());
|
|
|
|
saveFile->writeUint16BE(varsSection->size() & 0xFFFF);
|
|
|
|
saveFile->writeByte((varsSection->size() & 0xFF0000) >> 16);
|
|
|
|
saveFile->writeByte(0);
|
|
|
|
saveFile->writeUint16BE(0);
|
|
|
|
|
|
|
|
// ZIPS Section (File Table)
|
|
|
|
saveFile->writeUint32BE(134 + versSection->size() + nameSection->size() + varsSection->size());
|
|
|
|
saveFile->writeUint16BE(zipsSection->size() & 0xFFFF);
|
|
|
|
saveFile->writeByte((zipsSection->size() & 0xFF0000) >> 16);
|
|
|
|
saveFile->writeByte(0);
|
|
|
|
saveFile->writeUint16BE(0);
|
|
|
|
|
|
|
|
saveFile->write(versSection->getData(), versSection->size());
|
|
|
|
saveFile->write(nameSection->getData(), nameSection->size());
|
|
|
|
saveFile->write(varsSection->getData(), varsSection->size());
|
|
|
|
saveFile->write(zipsSection->getData(), zipsSection->size());
|
|
|
|
|
|
|
|
saveFile->finalize();
|
|
|
|
|
|
|
|
delete saveFile;
|
|
|
|
delete versSection;
|
|
|
|
delete nameSection;
|
|
|
|
delete varsSection;
|
|
|
|
delete zipsSection;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RivenSaveLoad::deleteSave(Common::String saveName) {
|
|
|
|
debug (0, "Deleting save file \'%s\'", saveName.c_str());
|
2010-06-26 17:21:50 +00:00
|
|
|
_saveFileMan->removeSavefile(saveName);
|
2009-12-29 23:18:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Mohawk
|