コード例 #1
0
ファイル: saveload.cpp プロジェクト: 33d/scummvm
Common::Error saveSavegameData(int saveGameIdx, const Common::String &saveName, DraciEngine &vm) {
	Common::String filename = vm.getSavegameFile(saveGameIdx);
	Common::SaveFileManager *saveMan = g_system->getSavefileManager();
	Common::OutSaveFile *f = saveMan->openForSaving(filename);
	if (f == NULL)
		return Common::kNoGameDataFoundError;

	TimeDate curTime;
	vm._system->getTimeAndDate(curTime);

	// Save the savegame header
	DraciSavegameHeader header;
	header.saveName = saveName;
	header.date = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
	header.time = ((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF);
	header.playtime = vm.getTotalPlayTime() / 1000;
	writeSavegameHeader(f, header);

	if (f->err()) {
		delete f;
		saveMan->removeSavefile(filename);
		return Common::kWritingFailed;
	} else {
		// Create the remainder of the savegame
		Common::Serializer s(NULL, f);
		vm._game->DoSync(s);

		f->finalize();
		delete f;
		return Common::kNoError;
	}
}
コード例 #2
0
ファイル: saveload.cpp プロジェクト: BenCastricum/scummvm
bool StarTrekEngine::saveGame(int slot, Common::String desc) {
	Common::String filename = getSavegameFilename(slot);
	Common::OutSaveFile *out;

	if (!(out = _saveFileMan->openForSaving(filename))) {
		warning("Can't create file '%s', game not saved", filename.c_str());
		return false;
	} else {
		debug(3, "Successfully opened %s for writing", filename.c_str());
	}

	SavegameMetadata meta;
	meta.version = CURRENT_SAVEGAME_VERSION;
	memset(meta.description, 0, sizeof(meta.description));
	strncpy(meta.description, desc.c_str(), SAVEGAME_DESCRIPTION_LEN);

	TimeDate curTime;
	_system->getTimeAndDate(curTime);
	meta.setSaveTimeAndDate(curTime);
	meta.playTime = g_engine->getTotalPlayTime();

	if (!saveOrLoadMetadata(nullptr, out, &meta)) {
		delete out;
		return false;
	}
	if (!saveOrLoadGameData(nullptr, out, &meta)) {
		delete out;
		return false;
	}

	out->finalize();
	delete out;
	return true;
}
コード例 #3
0
ファイル: detection.cpp プロジェクト: tiqpit/scummvm
Common::Error CineEngine::saveGameState(int slot, const Common::String &desc) {
	// Load savegame descriptions from index file
	loadSaveDirectory();

	// Set description for selected slot making sure it ends with a trailing zero
	strncpy(currentSaveName[slot], desc.c_str(), 20);
	currentSaveName[slot][sizeof(CommandeType) - 1] = 0;

	// Update savegame descriptions
	Common::String indexFile = _targetName + ".dir";

	Common::OutSaveFile *fHandle = _saveFileMan->openForSaving(indexFile);
	if (!fHandle) {
		warning("Unable to open file %s for saving", indexFile.c_str());
		return Common::kUnknownError;
	}

	fHandle->write(currentSaveName, 10 * 20);
	delete fHandle;

	// Save game
	char saveFileName[256];
	sprintf(saveFileName, "%s.%1d", _targetName.c_str(), slot);
	makeSave(saveFileName);

	checkDataDisk(-1);

	return Common::kNoError;
}
コード例 #4
0
ファイル: saves.cpp プロジェクト: BenCastricum/scummvm
Common::Error SavesManager::saveGameState(int slot, const Common::String &desc) {
	Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving(
		generateSaveName(slot));
	if (!out)
		return Common::kCreatingFileFailed;

	// Push map and party data to the save archives
	Map &map = *g_vm->_map;
	map.saveMaze();

	// Write the savegame header
	XeenSavegameHeader header;
	header._saveName = desc;
	writeSavegameHeader(out, header);

	// Loop through saving the sides' save archives
	SaveArchive *archives[2] = { File::_xeenSave, File::_darkSave };
	for (int idx = 0; idx < 2; ++idx) {
		if (archives[idx]) {
			archives[idx]->save(*out);
		} else {
			// Side isn't present
			out->writeUint32LE(0);
		}
	}

	// Write out miscellaneous
	FileManager &files = *g_vm->_files;
	files.save(*out);

	out->finalize();
	delete out;

	return Common::kNoError;
}
コード例 #5
0
ファイル: saveload.cpp プロジェクト: BenCastricum/scummvm
Common::Error SaveLoadManager::saveGame(int slot, const Common::String &saveName) {
	/* Pack any necessary data into the savegame data structure */
	// Set the selected slot number
	_vm->_globals->_saveData->_data[svLastSavegameSlot] = slot;

	// Set up the inventory
	for (int i = 0; i < 35; ++i)
		_vm->_globals->_saveData->_inventory[i] = _vm->_globals->_inventory[i];

	_vm->_globals->_saveData->_mapCarPosX = _vm->_objectsMan->_mapCarPosX;
	_vm->_globals->_saveData->_mapCarPosY = _vm->_objectsMan->_mapCarPosY;

	/* Create the savegame */
	Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot));
	if (!savefile)
		return Common::kCreatingFileFailed;

	// Set up the serializer
	Common::Serializer serializer(NULL, savefile);

	// Write out the savegame header
	hopkinsSavegameHeader header;
	header._saveName = saveName;
	header._version = HOPKINS_SAVEGAME_VERSION;
	writeSavegameHeader(savefile, header);

	// Write out the savegame data
	syncSavegameData(serializer, header._version);

	// Save file complete
	savefile->finalize();
	delete savefile;

	return Common::kNoError;
}
コード例 #6
0
ファイル: script.cpp プロジェクト: chrisws/scummvm
void Script::savegame(uint slot) {
	char save[15];
	char newchar;
	Common::OutSaveFile *file = SaveLoad::openForSaving(ConfMan.getActiveDomainName(), slot);

	if (!file) {
		debugC(9, kGroovieDebugScript, "Save file pointer is null");
		GUI::MessageDialog dialog(_("Failed to save game"), _("OK"));
		dialog.runModal();
		return;
	}

	// Saving the variables. It is endian safe because they're byte variables
	file->write(_variables, 0x400);
	delete file;

	// Cache the saved name
	for (int i = 0; i < 15; i++) {
		newchar = _variables[i] + 0x30;
		if ((newchar < 0x30 || newchar > 0x39) && (newchar < 0x41 || newchar > 0x7A)) {
			save[i] = '\0';
			break;
		} else {
			save[i] = newchar;
		}
	}
	_saveNames[slot] = save;
}
コード例 #7
0
ファイル: saveload.cpp プロジェクト: 33d/scummvm
Common::Error saveSavegameData(int saveGameIdx, const Common::String &saveName) {
	const char *filename = _vm->getSavegameFile(saveGameIdx);
	Common::SaveFileManager *saveMan = g_system->getSavefileManager();
	Common::OutSaveFile *f = saveMan->openForSaving(filename);
	if (f == NULL)
		return Common::kNoGameDataFoundError;

	// Save the savegame header
	CruiseSavegameHeader header;
	header.saveName = saveName;
	writeSavegameHeader(f, header);

	if (f->err()) {
		delete f;
		saveMan->removeSavefile(filename);
		return Common::kWritingFailed;
	} else {
		// Create the remainder of the savegame
		Common::Serializer s(NULL, f);
		DoSync(s);

		f->finalize();
		delete f;
		return Common::kNoError;
	}
}
コード例 #8
0
ファイル: saveload.cpp プロジェクト: MathiasBartl/scummvm
void saveAnimDataTable(Common::OutSaveFile &out) {
    out.writeUint16BE(NUM_MAX_ANIMDATA); // Entry count
    out.writeUint16BE(0x1E); // Entry size

    for (int i = 0; i < NUM_MAX_ANIMDATA; i++) {
        g_cine->_animDataTable[i].save(out);
    }
}
コード例 #9
0
ファイル: saveload.cpp プロジェクト: MathiasBartl/scummvm
void saveScreenParams(Common::OutSaveFile &out) {
    // Screen parameters, unhandled
    out.writeUint16BE(0);
    out.writeUint16BE(0);
    out.writeUint16BE(0);
    out.writeUint16BE(0);
    out.writeUint16BE(0);
    out.writeUint16BE(0);
}
コード例 #10
0
ファイル: saveload.cpp プロジェクト: MathiasBartl/scummvm
/** Save the 80 bytes long command buffer padded to that length with zeroes. */
void saveCommandBuffer(Common::OutSaveFile &out) {
    // Let's make sure there's space for the trailing zero
    // (That's why we subtract one from the maximum command buffer size here).
    uint32 size = MIN<uint32>(g_cine->_commandBuffer.size(), kMaxCommandBufferSize - 1);
    out.write(g_cine->_commandBuffer.c_str(), size);
    // Write the rest as zeroes (Here we also write the string's trailing zero)
    for (uint i = 0; i < kMaxCommandBufferSize - size; i++) {
        out.writeByte(0);
    }
}
コード例 #11
0
ファイル: avalanche.cpp プロジェクト: AReim1982/scummvm
bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) {
	Common::String fileName = getSaveFileName(slot);
	Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(fileName);
	if (!f) {
		warning("Can't create file '%s', game not saved.", fileName.c_str());
		return false;
	}

	f->writeUint32LE(MKTAG('A', 'V', 'A', 'L'));

	// Write version. We can't restore from obsolete versions.
	f->writeByte(kSavegameVersion);

	f->writeUint32LE(desc.size());
	f->write(desc.c_str(), desc.size());
	Graphics::saveThumbnail(*f);

	TimeDate t;
	_system->getTimeAndDate(t);
	f->writeSint16LE(t.tm_mday);
	f->writeSint16LE(t.tm_mon);
	f->writeSint16LE(t.tm_year);

	_totalTime += getTimeInSeconds() - _startTime;

	Common::Serializer sz(NULL, f);
	synchronize(sz);
	f->finalize();
	delete f;

	return true;
}
コード例 #12
0
void SaveManager::autoSave() {
	Common::OutSaveFile *file = g_system->getSavefileManager()->openForSaving(_engine->generateAutoSaveFileName());

	writeSaveGameHeader(file, "auto");

	_engine->getScriptManager()->serialize(file);

	// Cleanup
	file->finalize();
	delete file;
}
コード例 #13
0
void SaveManager::saveGame(uint slot, const Common::String &saveName, Common::MemoryWriteStreamDynamic *stream) {
	Common::SaveFileManager *saveFileManager = g_system->getSavefileManager();
	Common::OutSaveFile *file = saveFileManager->openForSaving(_engine->generateSaveFileName(slot));

	writeSaveGameHeader(file, saveName);

	file->write(stream->getData(), stream->size());

	file->finalize();
	delete file;
}
コード例 #14
0
ファイル: saveload.cpp プロジェクト: BenCastricum/scummvm
bool SaveLoadManager::save(const Common::String &file, const void *buf, size_t n) {
	Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(file);

	if (savefile) {
		size_t bytesWritten = savefile->write(buf, n);
		savefile->finalize();
		delete savefile;

		return bytesWritten == n;
	} else
		return false;
}
コード例 #15
0
ファイル: minigame.cpp プロジェクト: 33d/scummvm
void Minigame::saveHiscore(int minigameNum, int score) {
	Common::String filename = _vm->getTargetName() + "-highscore.dat";
	Common::OutSaveFile *file = g_system->getSavefileManager()->openForSaving(filename);
	if (file) {
		// Reserve a byte for future usage (rarely a bad idea, you never know...)
		file->writeByte(0);
		_hiScoreTable[minigameNum] = score;
		for (int i = 0; i < kMinigameCount; ++i)
			file->writeUint32LE(_hiScoreTable[i]);
		delete file;
	}
}
コード例 #16
0
ファイル: savegame.cpp プロジェクト: peres/scummvm
void SaveLoad::flushStream(GameId id) {
	Common::OutSaveFile *save = openForSaving(id);
	if (!save)
		error("SaveLoad::flushStream: cannot open savegame (%s)!", getFilename(id).c_str());

	if (!_savegame)
		error("SaveLoad::flushStream: savegame stream is invalid");

	save->write(_savegame->getData(), (uint32)_savegame->size());

	delete save;
}
コード例 #17
0
ファイル: saveload.cpp プロジェクト: Templier/scummvm-test
/**
 * DoSave
 */
static void DoSave() {
	Common::OutSaveFile *f;
	const char *fname;

	// Next getList() must do its stuff again
	NeedLoad = true;

	if (SaveSceneName == NULL)
		SaveSceneName = NewName();
	if (SaveSceneDesc[0] == 0)
		SaveSceneDesc = "unnamed";

	fname = SaveSceneName;

	f = _vm->getSaveFileMan()->openForSaving(fname);
	Common::Serializer s(0, f);

	if (f == NULL)
		goto save_failure;

	// Write out a savegame header
	SaveGameHeader hdr;
	hdr.id = SAVEGAME_ID;
	hdr.size = SAVEGAME_HEADER_SIZE;
	hdr.ver = CURRENT_VER;
	memcpy(hdr.desc, SaveSceneDesc, SG_DESC_LEN);
	hdr.desc[SG_DESC_LEN - 1] = 0;
	g_system->getTimeAndDate(hdr.dateTime);
	if (!syncSaveGameHeader(s, hdr) || f->err()) {
		goto save_failure;
	}

	DoSync(s);

	// Write out the special Id for Discworld savegames
	f->writeUint32LE(0xFEEDFACE);
	if (f->err())
		goto save_failure;

	f->finalize();
	delete f;
	return;

save_failure:
	if (f) {
		delete f;
		_vm->getSaveFileMan()->removeSavefile(fname);
	}
	GUI::MessageDialog dialog("Failed to save game state to file.");
	dialog.runModal();
}
コード例 #18
0
ファイル: database.cpp プロジェクト: tiqpit/scummvm
int16 GameDatabaseV2::savegame(const char *filename, const char *description, int16 version) {
	Common::OutSaveFile *out;
	int16 result = 0;
	if (!(out = g_system->getSavefileManager()->openForSaving(filename))) {
		warning("Can't create file '%s', game not saved", filename);
		return 6;
	}
	// Variable 0 is not saved
	out->write(_gameState + 2, _gameStateSize - 2);
	for (uint i = 0; i < _objects.size(); i++)
		_objects[i]->save(*out);
	delete out;
	return result;
}
コード例 #19
0
void SaveManager::saveGame(uint slot, const Common::String &saveName) {
	// The games only support 20 slots
	//assert(slot <= 1 && slot <= 20);

	Common::SaveFileManager *saveFileManager = g_system->getSavefileManager();
	Common::OutSaveFile *file = saveFileManager->openForSaving(_engine->generateSaveFileName(slot));

	writeSaveGameHeader(file, saveName);

	_engine->getScriptManager()->serialize(file);

	file->finalize();
	delete file;
}
コード例 #20
0
ファイル: gfx.cpp プロジェクト: Templier/scummvm-test
/**
 * Write active and backup palette to save
 * @param fHandle Savefile open for writing
 * @todo Add support for saving the palette in the 16 color version of Operation Stealth.
 *       Possibly combine with FWRenderer's savePalette-method?
 */
void OSRenderer::savePalette(Common::OutSaveFile &fHandle) {
	byte buf[kHighPalNumBytes];

	// We can have 16 color palette in many cases
	fHandle.writeUint16LE(_activePal.colorCount());

	// Write the active 256 color palette.
	_activePal.save(buf, sizeof(buf), CINE_LITTLE_ENDIAN);
	fHandle.write(buf, kHighPalNumBytes);

	// Write the active 256 color palette a second time.
	// FIXME: The backup 256 color palette should be saved here instead of the active one.
	fHandle.write(buf, kHighPalNumBytes);
}
コード例 #21
0
ファイル: saveload.cpp プロジェクト: vincenthamm/scummvm
Common::Error Saver::save(int slot, const Common::String &saveName) {
	assert(!getMacroRestoreFlag());
	Common::StackLock slock1(g_globals->_soundManager._serverDisabledMutex);

	// Signal any objects registered for notification
	_saveNotifiers.notify(false);

	// Set fields
	_macroSaveFlag = true;
	_saveSlot = slot;

	// Try and create the save file
	Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(g_vm->generateSaveName(slot));
	if (!saveFile)
		return Common::kCreatingFileFailed;

	// Set up the serializer
	Serializer serializer(NULL, saveFile);
	serializer.setSaveVersion(TSAGE_SAVEGAME_VERSION);

	// Write out the savegame header
	tSageSavegameHeader header;
	header.saveName = saveName;
	header.version = TSAGE_SAVEGAME_VERSION;
	writeSavegameHeader(saveFile, header);

	// Save out objects that need to come at the start of the savegame
	for (SynchronizedList<SaveListener *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) {
		(*i)->listenerSynchronize(serializer);
	}

	// Save each registered SaveObject descendant object into the savegame file
	for (SynchronizedList<SavedObject *>::iterator i = _objList.begin(); i != _objList.end(); ++i) {
		SavedObject *so = *i;
		serializer.validate(so->getClassName());
		so->synchronize(serializer);
	}

	// Save file complete
	saveFile->writeString("END");
	saveFile->finalize();
	delete saveFile;

	// Final post-save notification
	_macroSaveFlag = false;
	_saveNotifiers.notify(true);

	return Common::kNoError;
}
コード例 #22
0
bool BasePersistenceManager::saveFile(const Common::String &filename) {
    byte *prefixBuffer = _richBuffer;
    uint32 prefixSize = _richBufferSize;
    byte *buffer = ((Common::MemoryWriteStreamDynamic *)_saveStream)->getData();
    uint32 bufferSize = ((Common::MemoryWriteStreamDynamic *)_saveStream)->size();

    Common::SaveFileManager *saveMan = ((WintermuteEngine *)g_engine)->getSaveFileMan();
    Common::OutSaveFile *file = saveMan->openForSaving(filename);
    file->write(prefixBuffer, prefixSize);
    file->write(buffer, bufferSize);
    bool retVal = !file->err();
    file->finalize();
    delete file;
    return retVal;
}
コード例 #23
0
ファイル: game.cpp プロジェクト: clone2727/scummvm
void Game::saveGame(int slotNumber, const Common::String &saveName) {
	Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving(
		_vm->generateSaveName(slotNumber));

	MADSSavegameHeader header;
	header._saveName = saveName;
	writeSavegameHeader(out, header);

	Common::Serializer s(nullptr, out);
	synchronize(s, true);
	synchronize(s, false);

	out->finalize();
	delete out;
}
コード例 #24
0
ファイル: savegame.cpp プロジェクト: AReim1982/scummvm
/**
 * This test creates a savefile for the given testbed-state and could be reloaded using the saveFile API.
 * It is intended to test saving and loading from savefiles.
 */
bool SaveGametests::writeDataToFile(const char *fileName, const char *msg) {
	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
	Common::OutSaveFile *saveFile = saveFileMan->openForSaving(fileName);

	if (!saveFile) {
		Testsuite::logDetailedPrintf("Can't open saveFile %s\n", fileName);
		return false;
	}

	saveFile->writeString(msg);
	saveFile->finalize();
	delete saveFile;

	return true;
}
コード例 #25
0
ファイル: saveload.cpp プロジェクト: MathiasBartl/scummvm
void saveObjectScripts(Common::OutSaveFile &out) {
    ScriptList::const_iterator it;
    out.writeUint16BE(g_cine->_objectScripts.size());
    for (it = g_cine->_objectScripts.begin(); it != g_cine->_objectScripts.end(); ++it) {
        (*it)->save(out);
    }
}
コード例 #26
0
ファイル: detection.cpp プロジェクト: St0rmcrow/scummvm
void CineMetaEngine::removeSaveState(const char *target, int slot) const {
	// Load savegame descriptions from index file
	typedef char CommandeType[20];
	CommandeType saveNames[10];

	// Initialize all savegames' descriptions to empty strings
	// so that if the savegames' descriptions can only be partially read from file
	// then the missing ones are correctly set to empty strings.
	memset(saveNames, 0, sizeof(saveNames));

	Common::InSaveFile *in;
	char tmp[80];

	snprintf(tmp, 80, "%s.dir", target);
	in = g_system->getSavefileManager()->openForLoading(tmp);

	if (!in)
		return;

	in->read(saveNames, 10 * 20);
	delete in;

	// Set description for selected slot
	char slotName[20];
	slotName[0] = 0;
	strncpy(saveNames[slot], slotName, 20);

	// Update savegame descriptions
	char indexFile[80];
	snprintf(indexFile, 80, "%s.dir", target);

	Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving(indexFile);
	if (!out) {
		warning("Unable to open file %s for saving", indexFile);
		return;
	}

	out->write(saveNames, 10 * 20);
	delete out;

	// Delete save file
	char saveFileName[256];
	sprintf(saveFileName, "%s.%1d", target, slot);

	g_system->getSavefileManager()->removeSavefile(saveFileName);
}
コード例 #27
0
ファイル: detection.cpp プロジェクト: project-cabal/cabal
void SkyMetaEngine::removeSaveState(const char *target, int slot) const {
	if (slot == 0)	// do not delete the auto save
		return;

	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
	char fName[20];
	sprintf(fName,"SKY-VM.%03d", slot - 1);
	saveFileMan->removeSavefile(fName);

	// Load current save game descriptions
	Common::StringArray savenames;
	savenames.resize(MAX_SAVE_GAMES+1);
	Common::InSaveFile *inf;
	inf = saveFileMan->openForLoading("SKY-VM.SAV");
	if (inf != NULL) {
		char *tmpBuf =  new char[MAX_SAVE_GAMES * MAX_TEXT_LEN];
		char *tmpPtr = tmpBuf;
		inf->read(tmpBuf, MAX_SAVE_GAMES * MAX_TEXT_LEN);
		for (int i = 0; i < MAX_SAVE_GAMES; ++i) {
			savenames[i] = tmpPtr;
			tmpPtr += savenames[i].size() + 1;
		}
		delete inf;
		delete[] tmpBuf;
	}

	// Update the save game description at the given slot
	savenames[slot - 1] = "";

	// Save the updated descriptions
	Common::OutSaveFile *outf;

	outf = saveFileMan->openForSaving("SKY-VM.SAV");
	bool ioFailed = true;
	if (outf) {
		for (uint16 cnt = 0; cnt < MAX_SAVE_GAMES; cnt++) {
			outf->write(savenames[cnt].c_str(), savenames[cnt].size() + 1);
		}
		outf->finalize();
		if (!outf->err())
			ioFailed = false;
		delete outf;
	}
	if (ioFailed)
		warning("Unable to store Savegame names to file SKY-VM.SAV. (%s)", saveFileMan->popErrorDesc().c_str());
}
コード例 #28
0
ファイル: saveload.cpp プロジェクト: BenCastricum/scummvm
Common::OutSaveFile *SaveLoad::openForSaving(const Common::String &target, int slot) {
	// Validate the slot number
	if (!isSlotValid(slot)) {
		return nullptr;
	}

	// Open the savefile
	Common::String savename = getSlotSaveName(target, slot);
	Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(savename);
	if (!savefile) {
		return nullptr;
	}

	// Write the savefile version
	savefile->writeByte(SUPPORTED_SAVEFILE_VERSION);

	return savefile;
}
コード例 #29
0
ファイル: xeen.cpp プロジェクト: 86400/scummvm
Common::Error XeenEngine::saveGameState(int slot, const Common::String &desc) {
	Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving(
		generateSaveName(slot));
	if (!out)
		return Common::kCreatingFileFailed;

	XeenSavegameHeader header;
	header._saveName = desc;
	writeSavegameHeader(out, header);

	Common::Serializer s(nullptr, out);
	synchronize(s);

	out->finalize();
	delete out;

	return Common::kNoError;
}
コード例 #30
0
ファイル: cge_main.cpp プロジェクト: MaddTheSane/scummvm
void CGEEngine::saveGame(int slotNumber, const Common::String &desc) {
	// Set up the serializer
	Common::String slotName = generateSaveName(slotNumber);
	Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(slotName);

	// Write out the ScummVM savegame header
	SavegameHeader header;
	header.saveName = desc;
	header.version = kSavegameVersion;
	writeSavegameHeader(saveFile, header);

	// Write out the data of the savegame
	syncGame(NULL, saveFile, false);

	// Finish writing out game data
	saveFile->finalize();
	delete saveFile;
}