ENGINES: Change 2nd param of Engine::saveGameState to Common::String
This commit is contained in:
parent
86240bb0dc
commit
477d6233c3
50 changed files with 71 additions and 74 deletions
|
@ -807,7 +807,7 @@ public:
|
||||||
virtual ~AgiEngine();
|
virtual ~AgiEngine();
|
||||||
|
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 _lastTick;
|
uint32 _lastTick;
|
||||||
|
|
|
@ -1017,10 +1017,10 @@ Common::Error AgiEngine::loadGameState(int slot) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error AgiEngine::saveGameState(int slot, const char *desc) {
|
Common::Error AgiEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
char saveLoadSlot[12];
|
char saveLoadSlot[12];
|
||||||
sprintf(saveLoadSlot, "%s.%.3d", _targetName.c_str(), slot);
|
sprintf(saveLoadSlot, "%s.%.3d", _targetName.c_str(), slot);
|
||||||
if (saveGame(saveLoadSlot, desc) == errOK)
|
if (saveGame(saveLoadSlot, desc.c_str()) == errOK)
|
||||||
return Common::kNoError;
|
return Common::kNoError;
|
||||||
else
|
else
|
||||||
return Common::kUnknownError;
|
return Common::kUnknownError;
|
||||||
|
|
|
@ -126,7 +126,7 @@ public:
|
||||||
int modifyGameSpeed(int speedChange);
|
int modifyGameSpeed(int speedChange);
|
||||||
int getTimerDelay() const;
|
int getTimerDelay() const;
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
bool canLoadGameStateCurrently();
|
bool canLoadGameStateCurrently();
|
||||||
bool canSaveGameStateCurrently();
|
bool canSaveGameStateCurrently();
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ private:
|
||||||
void resetEngine();
|
void resetEngine();
|
||||||
bool loadPlainSaveFW(Common::SeekableReadStream &in, CineSaveGameFormat saveGameFormat);
|
bool loadPlainSaveFW(Common::SeekableReadStream &in, CineSaveGameFormat saveGameFormat);
|
||||||
bool loadTempSaveOS(Common::SeekableReadStream &in);
|
bool loadTempSaveOS(Common::SeekableReadStream &in);
|
||||||
bool makeLoad(char *saveName);
|
bool makeLoad(const Common::String &saveName);
|
||||||
void makeSaveFW(Common::OutSaveFile &out);
|
void makeSaveFW(Common::OutSaveFile &out);
|
||||||
void makeSaveOS(Common::OutSaveFile &out);
|
void makeSaveOS(Common::OutSaveFile &out);
|
||||||
void makeSave(char *saveFileName);
|
void makeSave(char *saveFileName);
|
||||||
|
|
|
@ -232,16 +232,16 @@ Common::Error CineEngine::loadGameState(int slot) {
|
||||||
return gameLoaded ? Common::kNoError : Common::kUnknownError;
|
return gameLoaded ? Common::kNoError : Common::kUnknownError;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error CineEngine::saveGameState(int slot, const char *desc) {
|
Common::Error CineEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
// Load savegame descriptions from index file
|
// Load savegame descriptions from index file
|
||||||
loadSaveDirectory();
|
loadSaveDirectory();
|
||||||
|
|
||||||
// Set description for selected slot making sure it ends with a trailing zero
|
// Set description for selected slot making sure it ends with a trailing zero
|
||||||
strncpy(currentSaveName[slot], desc, 20);
|
strncpy(currentSaveName[slot], desc.c_str(), 20);
|
||||||
currentSaveName[slot][sizeof(CommandeType) - 1] = 0;
|
currentSaveName[slot][sizeof(CommandeType) - 1] = 0;
|
||||||
|
|
||||||
// Update savegame descriptions
|
// Update savegame descriptions
|
||||||
Common::String indexFile = Common::String::format("%s.dir", _targetName.c_str());
|
Common::String indexFile = _targetName + ".dir";
|
||||||
|
|
||||||
Common::OutSaveFile *fHandle = _saveFileMan->openForSaving(indexFile);
|
Common::OutSaveFile *fHandle = _saveFileMan->openForSaving(indexFile);
|
||||||
if (!fHandle) {
|
if (!fHandle) {
|
||||||
|
|
|
@ -765,7 +765,7 @@ bool CineEngine::loadPlainSaveFW(Common::SeekableReadStream &in, CineSaveGameFor
|
||||||
return !(in.eos() || in.err());
|
return !(in.eos() || in.err());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CineEngine::makeLoad(char *saveName) {
|
bool CineEngine::makeLoad(const Common::String &saveName) {
|
||||||
Common::SharedPtr<Common::InSaveFile> saveFile(_saveFileMan->openForLoading(saveName));
|
Common::SharedPtr<Common::InSaveFile> saveFile(_saveFileMan->openForLoading(saveName));
|
||||||
|
|
||||||
if (!saveFile) {
|
if (!saveFile) {
|
||||||
|
|
|
@ -209,7 +209,7 @@ bool CruiseEngine::canLoadGameStateCurrently() {
|
||||||
return playerMenuEnabled != 0;
|
return playerMenuEnabled != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error CruiseEngine::saveGameState(int slot, const char *desc) {
|
Common::Error CruiseEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
return saveSavegameData(slot, desc);
|
return saveSavegameData(slot, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,6 @@ private:
|
||||||
void initialize();
|
void initialize();
|
||||||
void deinitialize();
|
void deinitialize();
|
||||||
bool loadLanguageStrings();
|
bool loadLanguageStrings();
|
||||||
bool makeLoad(char *saveName);
|
|
||||||
void mainLoop();
|
void mainLoop();
|
||||||
int processInput();
|
int processInput();
|
||||||
protected:
|
protected:
|
||||||
|
@ -100,7 +99,7 @@ public:
|
||||||
static const char *getSavegameFile(int saveGameIdx);
|
static const char *getSavegameFile(int saveGameIdx);
|
||||||
virtual Common::Error loadGameState(int slot);
|
virtual Common::Error loadGameState(int slot);
|
||||||
virtual bool canLoadGameStateCurrently();
|
virtual bool canLoadGameStateCurrently();
|
||||||
virtual Common::Error saveGameState(int slot, const char *desc);
|
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
virtual bool canSaveGameStateCurrently();
|
virtual bool canSaveGameStateCurrently();
|
||||||
virtual void syncSoundSettings();
|
virtual void syncSoundSettings();
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ static void handleSaveLoad(bool saveFlag) {
|
||||||
result = Common::String::format("Save %d", slot + 1);
|
result = Common::String::format("Save %d", slot + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_vm->saveGameState(slot, result.c_str());
|
_vm->saveGameState(slot, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,9 +229,9 @@ void MainMenuDialog::save() {
|
||||||
// If the user was lazy and entered no save name, come up with a default name.
|
// If the user was lazy and entered no save name, come up with a default name.
|
||||||
Common::String buf;
|
Common::String buf;
|
||||||
buf = Common::String::format("Save %d", slot + 1);
|
buf = Common::String::format("Save %d", slot + 1);
|
||||||
_engine->saveGameState(slot, buf.c_str());
|
_engine->saveGameState(slot, buf);
|
||||||
} else {
|
} else {
|
||||||
_engine->saveGameState(slot, result.c_str());
|
_engine->saveGameState(slot, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
|
@ -461,7 +461,7 @@ bool DraciEngine::canLoadGameStateCurrently() {
|
||||||
(_game->getLoopSubstatus() == kOuterLoop);
|
(_game->getLoopSubstatus() == kOuterLoop);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error DraciEngine::saveGameState(int slot, const char *desc) {
|
Common::Error DraciEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
return saveSavegameData(slot, desc, *this);
|
return saveSavegameData(slot, desc, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
static Common::String getSavegameFile(int saveGameIdx);
|
static Common::String getSavegameFile(int saveGameIdx);
|
||||||
virtual Common::Error loadGameState(int slot);
|
virtual Common::Error loadGameState(int slot);
|
||||||
virtual bool canLoadGameStateCurrently();
|
virtual bool canLoadGameStateCurrently();
|
||||||
virtual Common::Error saveGameState(int slot, const char *desc);
|
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
virtual bool canSaveGameStateCurrently();
|
virtual bool canSaveGameStateCurrently();
|
||||||
|
|
||||||
GUI::Debugger *getDebugger() { return _console; }
|
GUI::Debugger *getDebugger() { return _console; }
|
||||||
|
|
|
@ -470,7 +470,7 @@ bool Engine::canLoadGameStateCurrently() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error Engine::saveGameState(int slot, const char *desc) {
|
Common::Error Engine::saveGameState(int slot, const Common::String &desc) {
|
||||||
// Do nothing by default
|
// Do nothing by default
|
||||||
return Common::kNoError;
|
return Common::kNoError;
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ public:
|
||||||
* @param desc a description for the savestate, entered by the user
|
* @param desc a description for the savestate, entered by the user
|
||||||
* @return returns kNoError on success, else an error code.
|
* @return returns kNoError on success, else an error code.
|
||||||
*/
|
*/
|
||||||
virtual Common::Error saveGameState(int slot, const char *desc);
|
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether a game state can be saved.
|
* Indicates whether a game state can be saved.
|
||||||
|
|
|
@ -130,7 +130,7 @@ void HugoEngine::setMaxScore(const int newScore) {
|
||||||
_maxscore = newScore;
|
_maxscore = newScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error HugoEngine::saveGameState(int slot, const char *desc) {
|
Common::Error HugoEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
return (_file->saveGame(slot, desc) ? Common::kWritingFailed : Common::kNoError);
|
return (_file->saveGame(slot, desc) ? Common::kWritingFailed : Common::kNoError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -301,7 +301,7 @@ public:
|
||||||
void adjustScore(const int adjustment);
|
void adjustScore(const int adjustment);
|
||||||
int getMaxScore() const;
|
int getMaxScore() const;
|
||||||
void setMaxScore(const int newScore);
|
void setMaxScore(const int newScore);
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
bool hasFeature(EngineFeature f) const;
|
bool hasFeature(EngineFeature f) const;
|
||||||
const char *getCopyrightString() const;
|
const char *getCopyrightString() const;
|
||||||
|
|
|
@ -123,7 +123,7 @@ public:
|
||||||
virtual Common::Error loadGameState(int slot) {
|
virtual Common::Error loadGameState(int slot) {
|
||||||
return loadGame(slot) ? Common::kReadingFailed : Common::kNoError;
|
return loadGame(slot) ? Common::kReadingFailed : Common::kNoError;
|
||||||
}
|
}
|
||||||
virtual Common::Error saveGameState(int slot, const char *desc) {
|
virtual Common::Error saveGameState(int slot, const Common::String &desc) {
|
||||||
Common::String s(desc);
|
Common::String s(desc);
|
||||||
return saveGame(slot, s) ? Common::kReadingFailed : Common::kNoError;
|
return saveGame(slot, s) ? Common::kReadingFailed : Common::kNoError;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1168,7 +1168,7 @@ Common::Error MohawkEngine_Myst::loadGameState(int slot) {
|
||||||
return Common::kUnknownError;
|
return Common::kUnknownError;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error MohawkEngine_Myst::saveGameState(int slot, const char *desc) {
|
Common::Error MohawkEngine_Myst::saveGameState(int slot, const Common::String &desc) {
|
||||||
Common::StringArray saveList = _gameState->generateSaveGameList();
|
Common::StringArray saveList = _gameState->generateSaveGameList();
|
||||||
|
|
||||||
if ((uint)slot < saveList.size())
|
if ((uint)slot < saveList.size())
|
||||||
|
|
|
@ -193,7 +193,7 @@ public:
|
||||||
bool canLoadGameStateCurrently();
|
bool canLoadGameStateCurrently();
|
||||||
bool canSaveGameStateCurrently();
|
bool canSaveGameStateCurrently();
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
bool hasFeature(EngineFeature f) const;
|
bool hasFeature(EngineFeature f) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -727,7 +727,7 @@ Common::Error MohawkEngine_Riven::loadGameState(int slot) {
|
||||||
return _saveLoad->loadGame(_saveLoad->generateSaveGameList()[slot]) ? Common::kNoError : Common::kUnknownError;
|
return _saveLoad->loadGame(_saveLoad->generateSaveGameList()[slot]) ? Common::kNoError : Common::kUnknownError;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error MohawkEngine_Riven::saveGameState(int slot, const char *desc) {
|
Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &desc) {
|
||||||
Common::StringArray saveList = _saveLoad->generateSaveGameList();
|
Common::StringArray saveList = _saveLoad->generateSaveGameList();
|
||||||
|
|
||||||
if ((uint)slot < saveList.size())
|
if ((uint)slot < saveList.size())
|
||||||
|
|
|
@ -126,7 +126,7 @@ public:
|
||||||
bool canLoadGameStateCurrently() { return true; }
|
bool canLoadGameStateCurrently() { return true; }
|
||||||
bool canSaveGameStateCurrently() { return true; }
|
bool canSaveGameStateCurrently() { return true; }
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
bool hasFeature(EngineFeature f) const;
|
bool hasFeature(EngineFeature f) const;
|
||||||
|
|
||||||
typedef void (*TimerProc)(MohawkEngine_Riven *vm);
|
typedef void (*TimerProc)(MohawkEngine_Riven *vm);
|
||||||
|
|
|
@ -318,7 +318,7 @@ bool QueenEngine::canLoadOrSave() const {
|
||||||
return !_input->cutawayRunning() && !(_resource->isDemo() || _resource->isInterview());
|
return !_input->cutawayRunning() && !(_resource->isDemo() || _resource->isInterview());
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error QueenEngine::saveGameState(int slot, const char *desc) {
|
Common::Error QueenEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
debug(3, "Saving game to slot %d", slot);
|
debug(3, "Saving game to slot %d", slot);
|
||||||
char name[20];
|
char name[20];
|
||||||
Common::Error err = Common::kNoError;
|
Common::Error err = Common::kNoError;
|
||||||
|
@ -341,7 +341,7 @@ Common::Error QueenEngine::saveGameState(int slot, const char *desc) {
|
||||||
file->writeUint32BE(0);
|
file->writeUint32BE(0);
|
||||||
file->writeUint32BE(dataSize);
|
file->writeUint32BE(dataSize);
|
||||||
char description[32];
|
char description[32];
|
||||||
Common::strlcpy(description, desc, sizeof(description));
|
Common::strlcpy(description, desc.c_str(), sizeof(description));
|
||||||
file->write(description, sizeof(description));
|
file->write(description, sizeof(description));
|
||||||
|
|
||||||
// write save data
|
// write save data
|
||||||
|
|
|
@ -112,7 +112,7 @@ public:
|
||||||
void update(bool checkPlayerInput = false);
|
void update(bool checkPlayerInput = false);
|
||||||
|
|
||||||
bool canLoadOrSave() const;
|
bool canLoadOrSave() const;
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
void makeGameStateName(int slot, char *buf) const;
|
void makeGameStateName(int slot, char *buf) const;
|
||||||
int getGameStateSlot(const char *filename) const;
|
int getGameStateSlot(const char *filename) const;
|
||||||
|
|
|
@ -363,8 +363,8 @@ Common::Error SagaEngine::loadGameState(int slot) {
|
||||||
return Common::kNoError; // TODO: return success/failure
|
return Common::kNoError; // TODO: return success/failure
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error SagaEngine::saveGameState(int slot, const char *desc) {
|
Common::Error SagaEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
save(calcSaveFileName((uint)slot), desc);
|
save(calcSaveFileName((uint)slot), desc.c_str());
|
||||||
return Common::kNoError; // TODO: return success/failure
|
return Common::kNoError; // TODO: return success/failure
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -654,7 +654,7 @@ public:
|
||||||
|
|
||||||
const Common::Rect &getDisplayClip() const { return _displayClip;}
|
const Common::Rect &getDisplayClip() const { return _displayClip;}
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
bool canLoadGameStateCurrently();
|
bool canLoadGameStateCurrently();
|
||||||
bool canSaveGameStateCurrently();
|
bool canSaveGameStateCurrently();
|
||||||
const GameDisplayInfo &getDisplayInfo();
|
const GameDisplayInfo &getDisplayInfo();
|
||||||
|
|
|
@ -748,7 +748,7 @@ Common::Error SciEngine::loadGameState(int slot) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error SciEngine::saveGameState(int slot, const char *desc) {
|
Common::Error SciEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
Common::String fileName = Common::String::format("%s.%03d", _targetName.c_str(), slot);
|
Common::String fileName = Common::String::format("%s.%03d", _targetName.c_str(), slot);
|
||||||
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
|
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
|
||||||
Common::OutSaveFile *out = saveFileMan->openForSaving(fileName);
|
Common::OutSaveFile *out = saveFileMan->openForSaving(fileName);
|
||||||
|
|
|
@ -805,7 +805,7 @@ void SegManager::reconstructClones() {
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
|
|
||||||
bool gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename, const char *version) {
|
bool gamestate_save(EngineState *s, Common::WriteStream *fh, const Common::String &savename, const Common::String &version) {
|
||||||
TimeDate curTime;
|
TimeDate curTime;
|
||||||
g_system->getTimeAndDate(curTime);
|
g_system->getTimeAndDate(curTime);
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ struct SavegameMetadata {
|
||||||
* @param savename The description of the savegame
|
* @param savename The description of the savegame
|
||||||
* @return 0 on success, 1 otherwise
|
* @return 0 on success, 1 otherwise
|
||||||
*/
|
*/
|
||||||
bool gamestate_save(EngineState *s, Common::WriteStream *save, const char *savename, const char *version);
|
bool gamestate_save(EngineState *s, Common::WriteStream *save, const Common::String &savename, const Common::String &version);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restores a game state from a directory.
|
* Restores a game state from a directory.
|
||||||
|
|
|
@ -221,7 +221,7 @@ public:
|
||||||
virtual GUI::Debugger *getDebugger();
|
virtual GUI::Debugger *getDebugger();
|
||||||
Console *getSciDebugger();
|
Console *getSciDebugger();
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
bool canLoadGameStateCurrently();
|
bool canLoadGameStateCurrently();
|
||||||
bool canSaveGameStateCurrently();
|
bool canSaveGameStateCurrently();
|
||||||
void syncSoundSettings();
|
void syncSoundSettings();
|
||||||
|
|
|
@ -117,7 +117,7 @@ void ScummEngine::parseEvent(Common::Event event) {
|
||||||
if (_saveLoadSlot == 0)
|
if (_saveLoadSlot == 0)
|
||||||
_saveLoadSlot = 10;
|
_saveLoadSlot = 10;
|
||||||
|
|
||||||
sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
|
_saveLoadDescription = Common::String::format("Quicksave %d", _saveLoadSlot);
|
||||||
_saveLoadFlag = (event.kbd.hasFlags(Common::KBD_ALT)) ? 1 : 2;
|
_saveLoadFlag = (event.kbd.hasFlags(Common::KBD_ALT)) ? 1 : 2;
|
||||||
_saveTemporaryState = false;
|
_saveTemporaryState = false;
|
||||||
} else if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_f) {
|
} else if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_f) {
|
||||||
|
|
|
@ -103,7 +103,7 @@ bool ScummEngine::canLoadGameStateCurrently() {
|
||||||
return (VAR_MAINMENU_KEY == 0xFF || VAR(VAR_MAINMENU_KEY) != 0);
|
return (VAR_MAINMENU_KEY == 0xFF || VAR(VAR_MAINMENU_KEY) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error ScummEngine::saveGameState(int slot, const char *desc) {
|
Common::Error ScummEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
requestSave(slot, desc);
|
requestSave(slot, desc);
|
||||||
return Common::kNoError;
|
return Common::kNoError;
|
||||||
}
|
}
|
||||||
|
@ -135,13 +135,11 @@ bool ScummEngine::canSaveGameStateCurrently() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScummEngine::requestSave(int slot, const char *name) {
|
void ScummEngine::requestSave(int slot, const Common::String &name) {
|
||||||
_saveLoadSlot = slot;
|
_saveLoadSlot = slot;
|
||||||
_saveTemporaryState = false;
|
_saveTemporaryState = false;
|
||||||
_saveLoadFlag = 1; // 1 for save
|
_saveLoadFlag = 1; // 1 for save
|
||||||
assert(name);
|
_saveLoadDescription = name;
|
||||||
strncpy(_saveLoadName, name, sizeof(_saveLoadName));
|
|
||||||
_saveLoadName[sizeof(_saveLoadName) - 1] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScummEngine::requestLoad(int slot) {
|
void ScummEngine::requestLoad(int slot) {
|
||||||
|
@ -166,7 +164,7 @@ bool ScummEngine::saveState(Common::OutSaveFile *out, bool writeHeader) {
|
||||||
SaveGameHeader hdr;
|
SaveGameHeader hdr;
|
||||||
|
|
||||||
if (writeHeader) {
|
if (writeHeader) {
|
||||||
memcpy(hdr.name, _saveLoadName, sizeof(hdr.name));
|
Common::strlcpy(hdr.name, _saveLoadDescription.c_str(), sizeof(hdr.name));
|
||||||
saveSaveGameHeader(out, hdr);
|
saveSaveGameHeader(out, hdr);
|
||||||
}
|
}
|
||||||
#if !defined(__DS__) && !defined(__N64__) /* && !defined(__PLAYSTATION2__) */
|
#if !defined(__DS__) && !defined(__N64__) /* && !defined(__PLAYSTATION2__) */
|
||||||
|
@ -387,7 +385,8 @@ bool ScummEngine::loadState(int slot, bool compat) {
|
||||||
if (hdr.ver == VER(7))
|
if (hdr.ver == VER(7))
|
||||||
hdr.ver = VER(8);
|
hdr.ver = VER(8);
|
||||||
|
|
||||||
memcpy(_saveLoadName, hdr.name, sizeof(hdr.name));
|
hdr.name[sizeof(hdr.name)-1] = 0;
|
||||||
|
_saveLoadDescription = hdr.name;
|
||||||
|
|
||||||
// Unless specifically requested with _saveSound, we do not save the iMUSE
|
// Unless specifically requested with _saveSound, we do not save the iMUSE
|
||||||
// state for temporary state saves - such as certain cutscenes in DOTT,
|
// state for temporary state saves - such as certain cutscenes in DOTT,
|
||||||
|
@ -589,9 +588,9 @@ bool ScummEngine::loadState(int slot, bool compat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::String ScummEngine::makeSavegameName(const Common::String &target, int slot, bool temporary) {
|
Common::String ScummEngine::makeSavegameName(const Common::String &target, int slot, bool temporary) {
|
||||||
char extension[6];
|
Common::String extension;
|
||||||
snprintf(extension, sizeof(extension), ".%c%02d", temporary ? 'c' : 's', slot);
|
extension = Common::String::format(".%c%02d", temporary ? 'c' : 's', slot);
|
||||||
return (target + extension);
|
return target + extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScummEngine::listSavegames(bool *marks, int num) {
|
void ScummEngine::listSavegames(bool *marks, int num) {
|
||||||
|
|
|
@ -213,7 +213,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
|
||||||
_saveLoadSlot = 0;
|
_saveLoadSlot = 0;
|
||||||
_lastSaveTime = 0;
|
_lastSaveTime = 0;
|
||||||
_saveTemporaryState = false;
|
_saveTemporaryState = false;
|
||||||
memset(_saveLoadName, 0, sizeof(_saveLoadName));
|
|
||||||
memset(_localScriptOffsets, 0, sizeof(_localScriptOffsets));
|
memset(_localScriptOffsets, 0, sizeof(_localScriptOffsets));
|
||||||
_scriptPointer = NULL;
|
_scriptPointer = NULL;
|
||||||
_scriptOrgPointer = NULL;
|
_scriptOrgPointer = NULL;
|
||||||
|
@ -2056,7 +2055,7 @@ void ScummEngine::scummLoop(int delta) {
|
||||||
// Trigger autosave if necessary.
|
// Trigger autosave if necessary.
|
||||||
if (!_saveLoadFlag && shouldPerformAutoSave(_lastSaveTime) && canSaveGameStateCurrently()) {
|
if (!_saveLoadFlag && shouldPerformAutoSave(_lastSaveTime) && canSaveGameStateCurrently()) {
|
||||||
_saveLoadSlot = 0;
|
_saveLoadSlot = 0;
|
||||||
sprintf(_saveLoadName, "Autosave %d", _saveLoadSlot);
|
_saveLoadDescription = Common::String::format("Autosave %d", _saveLoadSlot);
|
||||||
_saveLoadFlag = 1;
|
_saveLoadFlag = 1;
|
||||||
_saveTemporaryState = false;
|
_saveTemporaryState = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,7 +401,7 @@ public:
|
||||||
|
|
||||||
virtual Common::Error loadGameState(int slot);
|
virtual Common::Error loadGameState(int slot);
|
||||||
virtual bool canLoadGameStateCurrently();
|
virtual bool canLoadGameStateCurrently();
|
||||||
virtual Common::Error saveGameState(int slot, const char *desc);
|
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
virtual bool canSaveGameStateCurrently();
|
virtual bool canSaveGameStateCurrently();
|
||||||
|
|
||||||
virtual void pauseEngineIntern(bool pause);
|
virtual void pauseEngineIntern(bool pause);
|
||||||
|
@ -572,7 +572,7 @@ protected:
|
||||||
uint32 _lastSaveTime;
|
uint32 _lastSaveTime;
|
||||||
bool _saveTemporaryState;
|
bool _saveTemporaryState;
|
||||||
Common::String _saveLoadFileName;
|
Common::String _saveLoadFileName;
|
||||||
char _saveLoadName[32];
|
Common::String _saveLoadDescription;
|
||||||
|
|
||||||
bool saveState(Common::OutSaveFile *out, bool writeHeader = true);
|
bool saveState(Common::OutSaveFile *out, bool writeHeader = true);
|
||||||
bool saveState(int slot, bool compat);
|
bool saveState(int slot, bool compat);
|
||||||
|
@ -594,7 +594,7 @@ public:
|
||||||
bool getSavegameName(int slot, Common::String &desc);
|
bool getSavegameName(int slot, Common::String &desc);
|
||||||
void listSavegames(bool *marks, int num);
|
void listSavegames(bool *marks, int num);
|
||||||
|
|
||||||
void requestSave(int slot, const char *name);
|
void requestSave(int slot, const Common::String &name);
|
||||||
void requestLoad(int slot);
|
void requestLoad(int slot);
|
||||||
|
|
||||||
// thumbnail + info stuff
|
// thumbnail + info stuff
|
||||||
|
|
|
@ -282,7 +282,7 @@ Common::Error SkyEngine::loadGameState(int slot) {
|
||||||
return (result == GAME_RESTORED) ? Common::kNoError : Common::kUnknownError;
|
return (result == GAME_RESTORED) ? Common::kNoError : Common::kUnknownError;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error SkyEngine::saveGameState(int slot, const char *desc) {
|
Common::Error SkyEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
if (slot == 0)
|
if (slot == 0)
|
||||||
return Common::kWritePermissionDenied; // we can't overwrite the auto save
|
return Common::kWritePermissionDenied; // we can't overwrite the auto save
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
static bool isCDVersion();
|
static bool isCDVersion();
|
||||||
|
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
bool canLoadGameStateCurrently();
|
bool canLoadGameStateCurrently();
|
||||||
bool canSaveGameStateCurrently();
|
bool canSaveGameStateCurrently();
|
||||||
|
|
||||||
|
|
|
@ -336,8 +336,8 @@ bool SwordEngine::canLoadGameStateCurrently() {
|
||||||
return (mouseIsActive() && !_control->isPanelShown()); // Disable GMM loading when game panel is shown
|
return (mouseIsActive() && !_control->isPanelShown()); // Disable GMM loading when game panel is shown
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error SwordEngine::saveGameState(int slot, const char *desc) {
|
Common::Error SwordEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
_control->setSaveDescription(slot, desc);
|
_control->setSaveDescription(slot, desc.c_str());
|
||||||
_control->saveGameToFile(slot);
|
_control->saveGameToFile(slot);
|
||||||
return Common::kNoError; // TODO: return success/failure
|
return Common::kNoError; // TODO: return success/failure
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ protected:
|
||||||
|
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
bool canLoadGameStateCurrently();
|
bool canLoadGameStateCurrently();
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
bool canSaveGameStateCurrently();
|
bool canSaveGameStateCurrently();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -773,8 +773,8 @@ uint32 Sword2Engine::getMillis() {
|
||||||
return _system->getMillis();
|
return _system->getMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error Sword2Engine::saveGameState(int slot, const char *desc) {
|
Common::Error Sword2Engine::saveGameState(int slot, const Common::String &desc) {
|
||||||
uint32 saveVal = saveGame(slot, (const byte *)desc);
|
uint32 saveVal = saveGame(slot, (const byte *)desc.c_str());
|
||||||
|
|
||||||
if (saveVal == SR_OK)
|
if (saveVal == SR_OK)
|
||||||
return Common::kNoError;
|
return Common::kNoError;
|
||||||
|
|
|
@ -164,7 +164,7 @@ public:
|
||||||
void setSubtitles(bool b) { _useSubtitles = b; }
|
void setSubtitles(bool b) { _useSubtitles = b; }
|
||||||
|
|
||||||
// GMM Loading/Saving
|
// GMM Loading/Saving
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
bool canSaveGameStateCurrently();
|
bool canSaveGameStateCurrently();
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
bool canLoadGameStateCurrently();
|
bool canLoadGameStateCurrently();
|
||||||
|
|
|
@ -82,7 +82,7 @@ protected:
|
||||||
// void pauseEngineIntern(bool pause); // TODO: Implement this!!!
|
// void pauseEngineIntern(bool pause); // TODO: Implement this!!!
|
||||||
// void syncSoundSettings(); // TODO: Implement this!!!
|
// void syncSoundSettings(); // TODO: Implement this!!!
|
||||||
// Common::Error loadGameState(int slot); // TODO: Implement this?
|
// Common::Error loadGameState(int slot); // TODO: Implement this?
|
||||||
// Common::Error saveGameState(int slot, const char *desc); // TODO: Implement this?
|
// Common::Error saveGameState(int slot, const Common::String &desc); // TODO: Implement this?
|
||||||
// bool canLoadGameStateCurrently(); // TODO: Implement this?
|
// bool canLoadGameStateCurrently(); // TODO: Implement this?
|
||||||
// bool canSaveGameStateCurrently(); // TODO: Implement this?
|
// bool canSaveGameStateCurrently(); // TODO: Implement this?
|
||||||
|
|
||||||
|
|
|
@ -240,7 +240,7 @@ Common::Error TeenAgentEngine::loadGameState(int slot) {
|
||||||
return Common::kNoError;
|
return Common::kNoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error TeenAgentEngine::saveGameState(int slot, const char *desc) {
|
Common::Error TeenAgentEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
debug(0, "saving to slot %d", slot);
|
debug(0, "saving to slot %d", slot);
|
||||||
Common::ScopedPtr<Common::OutSaveFile> out(_saveFileMan->openForSaving(Common::String::format("teenagent.%02d", slot)));
|
Common::ScopedPtr<Common::OutSaveFile> out(_saveFileMan->openForSaving(Common::String::format("teenagent.%02d", slot)));
|
||||||
if (!out)
|
if (!out)
|
||||||
|
@ -253,7 +253,7 @@ Common::Error TeenAgentEngine::saveGameState(int slot, const char *desc) {
|
||||||
res->dseg.set_word(0x64B1, pos.y);
|
res->dseg.set_word(0x64B1, pos.y);
|
||||||
|
|
||||||
assert(res->dseg.size() >= 0x6478 + 0x777a);
|
assert(res->dseg.size() >= 0x6478 + 0x777a);
|
||||||
strncpy((char *)res->dseg.ptr(0x6478), desc, 0x16);
|
strncpy((char *)res->dseg.ptr(0x6478), desc.c_str(), 0x16);
|
||||||
out->write(res->dseg.ptr(0x6478), 0x777a);
|
out->write(res->dseg.ptr(0x6478), 0x777a);
|
||||||
if (!Graphics::saveThumbnail(*out))
|
if (!Graphics::saveThumbnail(*out))
|
||||||
warning("saveThumbnail failed");
|
warning("saveThumbnail failed");
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
|
|
||||||
virtual Common::Error run();
|
virtual Common::Error run();
|
||||||
virtual Common::Error loadGameState(int slot);
|
virtual Common::Error loadGameState(int slot);
|
||||||
virtual Common::Error saveGameState(int slot, const char *desc);
|
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
virtual bool canLoadGameStateCurrently() { return true; }
|
virtual bool canLoadGameStateCurrently() { return true; }
|
||||||
virtual bool canSaveGameStateCurrently() { return !scene_busy; }
|
virtual bool canSaveGameStateCurrently() { return !scene_busy; }
|
||||||
virtual bool hasFeature(EngineFeature f) const;
|
virtual bool hasFeature(EngineFeature f) const;
|
||||||
|
|
|
@ -410,7 +410,7 @@ Common::Error TinselEngine::loadGameState(int slot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
Common::Error TinselEngine::saveGameState(int slot, const char *desc) {
|
Common::Error TinselEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
Common::String saveName = _vm->getSavegameFilename((int16)(slot + 1));
|
Common::String saveName = _vm->getSavegameFilename((int16)(slot + 1));
|
||||||
char saveDesc[SG_DESC_LEN];
|
char saveDesc[SG_DESC_LEN];
|
||||||
Common::strlcpy(saveDesc, desc, SG_DESC_LEN);
|
Common::strlcpy(saveDesc, desc, SG_DESC_LEN);
|
||||||
|
|
|
@ -169,7 +169,7 @@ protected:
|
||||||
virtual bool hasFeature(EngineFeature f) const;
|
virtual bool hasFeature(EngineFeature f) const;
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
#if 0
|
#if 0
|
||||||
Common::Error saveGameState(int slot, const char *desc);
|
Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
#endif
|
#endif
|
||||||
bool canLoadGameStateCurrently();
|
bool canLoadGameStateCurrently();
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -318,7 +318,7 @@ public:
|
||||||
return _shouldQuit;
|
return _shouldQuit;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error saveGameState(int slot, const char *desc) {
|
Common::Error saveGameState(int slot, const Common::String &desc) {
|
||||||
|
|
||||||
return (saveGame(slot, desc) ? Common::kWritingFailed : Common::kNoError);
|
return (saveGame(slot, desc) ? Common::kWritingFailed : Common::kNoError);
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,7 +319,7 @@ void ToucheEngine::loadGameStateData(Common::ReadStream *stream) {
|
||||||
debug(0, "Loaded state, current episode %d", _currentEpisodeNum);
|
debug(0, "Loaded state, current episode %d", _currentEpisodeNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error ToucheEngine::saveGameState(int num, const char *description) {
|
Common::Error ToucheEngine::saveGameState(int num, const Common::String &description) {
|
||||||
bool saveOk = false;
|
bool saveOk = false;
|
||||||
Common::String gameStateFileName = generateGameStateFileName(_targetName.c_str(), num);
|
Common::String gameStateFileName = generateGameStateFileName(_targetName.c_str(), num);
|
||||||
Common::OutSaveFile *f = _saveFileMan->openForSaving(gameStateFileName);
|
Common::OutSaveFile *f = _saveFileMan->openForSaving(gameStateFileName);
|
||||||
|
@ -328,7 +328,7 @@ Common::Error ToucheEngine::saveGameState(int num, const char *description) {
|
||||||
f->writeUint16LE(0);
|
f->writeUint16LE(0);
|
||||||
char headerDescription[kGameStateDescriptionLen];
|
char headerDescription[kGameStateDescriptionLen];
|
||||||
memset(headerDescription, 0, kGameStateDescriptionLen);
|
memset(headerDescription, 0, kGameStateDescriptionLen);
|
||||||
strncpy(headerDescription, description, kGameStateDescriptionLen - 1);
|
strncpy(headerDescription, description.c_str(), kGameStateDescriptionLen - 1);
|
||||||
f->write(headerDescription, kGameStateDescriptionLen);
|
f->write(headerDescription, kGameStateDescriptionLen);
|
||||||
saveGameStateData(f);
|
saveGameStateData(f);
|
||||||
f->finalize();
|
f->finalize();
|
||||||
|
|
|
@ -513,7 +513,7 @@ protected:
|
||||||
|
|
||||||
void saveGameStateData(Common::WriteStream *stream);
|
void saveGameStateData(Common::WriteStream *stream);
|
||||||
void loadGameStateData(Common::ReadStream *stream);
|
void loadGameStateData(Common::ReadStream *stream);
|
||||||
virtual Common::Error saveGameState(int num, const char *description);
|
virtual Common::Error saveGameState(int num, const Common::String &description);
|
||||||
virtual Common::Error loadGameState(int num);
|
virtual Common::Error loadGameState(int num);
|
||||||
virtual bool canLoadGameStateCurrently();
|
virtual bool canLoadGameStateCurrently();
|
||||||
virtual bool canSaveGameStateCurrently();
|
virtual bool canSaveGameStateCurrently();
|
||||||
|
|
|
@ -124,7 +124,7 @@ Common::Error TSageEngine::loadGameState(int slot) {
|
||||||
/**
|
/**
|
||||||
* Save the game to the given slot index, and with the given name
|
* Save the game to the given slot index, and with the given name
|
||||||
*/
|
*/
|
||||||
Common::Error TSageEngine::saveGameState(int slot, const char *desc) {
|
Common::Error TSageEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
return _saver->save(slot, desc);
|
return _saver->save(slot, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public:
|
||||||
virtual bool canLoadGameStateCurrently();
|
virtual bool canLoadGameStateCurrently();
|
||||||
virtual bool canSaveGameStateCurrently();
|
virtual bool canSaveGameStateCurrently();
|
||||||
virtual Common::Error loadGameState(int slot);
|
virtual Common::Error loadGameState(int slot);
|
||||||
virtual Common::Error saveGameState(int slot, const char *desc);
|
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
||||||
Common::String generateSaveName(int slot);
|
Common::String generateSaveName(int slot);
|
||||||
|
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
|
@ -101,7 +101,7 @@ Common::Error TuckerEngine::loadGameState(int num) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error TuckerEngine::saveGameState(int num, const char *description) {
|
Common::Error TuckerEngine::saveGameState(int num, const Common::String &description) {
|
||||||
Common::Error ret = Common::kNoError;
|
Common::Error ret = Common::kNoError;
|
||||||
Common::String gameStateFileName = generateGameStateFileName(_targetName.c_str(), num);
|
Common::String gameStateFileName = generateGameStateFileName(_targetName.c_str(), num);
|
||||||
Common::OutSaveFile *f = _saveFileMan->openForSaving(gameStateFileName);
|
Common::OutSaveFile *f = _saveFileMan->openForSaving(gameStateFileName);
|
||||||
|
|
|
@ -565,7 +565,7 @@ protected:
|
||||||
|
|
||||||
template <class S> void saveOrLoadGameStateData(S &s);
|
template <class S> void saveOrLoadGameStateData(S &s);
|
||||||
virtual Common::Error loadGameState(int num);
|
virtual Common::Error loadGameState(int num);
|
||||||
virtual Common::Error saveGameState(int num, const char *description);
|
virtual Common::Error saveGameState(int num, const Common::String &description);
|
||||||
virtual bool canLoadGameStateCurrently();
|
virtual bool canLoadGameStateCurrently();
|
||||||
virtual bool canSaveGameStateCurrently();
|
virtual bool canSaveGameStateCurrently();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue