diff options
author | Eugene Sandulenko | 2016-09-18 09:32:58 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-18 09:37:37 +0200 |
commit | b413d01113d39d74639cb8f068efb0f14110d646 (patch) | |
tree | 14ac49649cda792531f53acac8efca363d58bc54 /engines/fullpipe | |
parent | c42dfbc4968ff2cdc7ad1ed316164d4cab20b550 (diff) | |
download | scummvm-rg350-b413d01113d39d74639cb8f068efb0f14110d646.tar.gz scummvm-rg350-b413d01113d39d74639cb8f068efb0f14110d646.tar.bz2 scummvm-rg350-b413d01113d39d74639cb8f068efb0f14110d646.zip |
FULLPIPE: Implement map saving and save obfuscation
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/gameloader.cpp | 11 | ||||
-rw-r--r-- | engines/fullpipe/gameloader.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/stateloader.cpp | 11 |
3 files changed, 18 insertions, 6 deletions
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 8524a8ddf5..bbe99ab9f5 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -673,11 +673,14 @@ void GameLoader::writeSavegame(Scene *sc, const char *fname) { } } - //header.encSize = GameLoader_encryptSavegame((GameLoader *)header.unkField, (int)&cmemfile); - //CFile::Write((int)&cfile, (int)&header, header.saveSize); + header.encSize = stream.size(); - //if (_savegameCallback) - // _savegameCallback(saveFile, 1); + // Now obfuscate the data + for (uint i = 0; i < header.encSize; i++) + stream.getData()[i] += i & 0x7f; + + if (_savegameCallback) + _savegameCallback(archive, true); // Now dump it into save file Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(fname); diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index a11c0aab0b..b0347caa51 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -112,7 +112,7 @@ class GameLoader : public CObject { Sc2Array _sc2array; void *_sceneSwitcher; bool (*_preloadCallback)(PreloadItem &pre, int flag); - void *_savegameCallback; + void (*_savegameCallback)(MfcArchive *archive, bool mode); int16 _field_F8; int16 _field_FA; PreloadItems _preloadItems; diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index 1e1cf35abd..5142d2bfe2 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -37,6 +37,15 @@ namespace Fullpipe { +void gameLoaderSavegameCallback(MfcArchive *archive, bool mode) { + if (mode) + for (int i = 0; i < 200; i++) + archive->writeUint32LE(g_fp->_mapTable[i]); + else + for (int i = 0; i < 200; i++) + g_fp->_mapTable[i] = archive->readUint32LE(); +} + bool FullpipeEngine::loadGam(const char *fname, int scene) { _gameLoader = new GameLoader(); @@ -60,7 +69,7 @@ bool FullpipeEngine::loadGam(const char *fname, int scene) { // _sceneSwitcher = sceneSwitcher; // substituted with direct call _gameLoader->_preloadCallback = preloadCallback; - // _savegameCallback = gameLoaderSavegameCallback; // TODO + _gameLoader->_savegameCallback = gameLoaderSavegameCallback; _aniMan = accessScene(SC_COMMON)->getAniMan(); _scene2 = 0; |