GOB: add save handler stubs for Adibou1

Remove a blocking "floppy disk error" screen on some versions.
This commit is contained in:
Simon Delamarre 2022-10-29 00:43:40 +02:00 committed by Eugene Sandulenko
parent a0c30a957e
commit 680077d92b
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
4 changed files with 118 additions and 1 deletions

View File

@ -643,7 +643,7 @@ Common::Error GobEngine::initGameParts() {
_map = new Map_v2(this);
_goblin = new Goblin_v2(this);
_scenery = new Scenery_v2(this);
_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
_saveLoad = new SaveLoad_Adibou1(this, _targetName.c_str());
break;
case kGameTypeAbracadabra:

View File

@ -105,6 +105,7 @@ MODULE_OBJS := \
save/saveload_v4.o \
save/saveload_v6.o \
save/saveload_v7.o \
save/saveload_adibou1.o \
save/saveload_geisha.o \
save/saveload_fascin.o \
save/saveload_ajworld.o \

View File

@ -282,6 +282,33 @@ protected:
SaveFile *getSaveFile(const char *fileName);
};
/** Save/Load class for Adibou 1 */
class SaveLoad_Adibou1 : public SaveLoad {
public:
SaveLoad_Adibou1(GobEngine *vm, const char *targetName);
~SaveLoad_Adibou1() override;
SaveMode getSaveMode(const char *fileName) const override;
protected:
struct SaveFile {
const char *sourceName;
SaveMode mode;
SaveHandler *handler;
const char *description;
};
static SaveFile _saveFiles[];
FakeFileHandler *_bouHandler;
SaveHandler *getHandler(const char *fileName) const override;
const char *getDescription(const char *fileName) const override;
const SaveFile *getSaveFile(const char *fileName) const;
SaveFile *getSaveFile(const char *fileName);
};
/** Save/Load class for Goblins 3 and Lost in Time. */
class SaveLoad_v3 : public SaveLoad {
public:

View File

@ -0,0 +1,89 @@
/* 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.
*
*/
#include "gob/save/saveload.h"
#include "gob/save/saveconverter.h"
#include "gob/inter.h"
#include "gob/variables.h"
namespace Gob {
SaveLoad_Adibou1::SaveFile SaveLoad_Adibou1::_saveFiles[] = {
{ "bou.inf", kSaveModeSave, nullptr, "adibou1"},
};
SaveLoad_Adibou1::SaveLoad_Adibou1(GobEngine *vm, const char *targetName) :
SaveLoad(vm) {
_saveFiles[0].handler = _bouHandler = new FakeFileHandler(vm);
}
SaveLoad_Adibou1::~SaveLoad_Adibou1() {
delete _bouHandler;
}
const SaveLoad_Adibou1::SaveFile *SaveLoad_Adibou1::getSaveFile(const char *fileName) const {
for (int i = 0; i < ARRAYSIZE(_saveFiles); i++)
if (!scumm_stricmp(fileName, _saveFiles[i].sourceName))
return &_saveFiles[i];
return 0;
}
SaveLoad_Adibou1::SaveFile *SaveLoad_Adibou1::getSaveFile(const char *fileName) {
fileName = stripPath(fileName);
for (int i = 0; i < ARRAYSIZE(_saveFiles); i++)
if (!scumm_stricmp(fileName, _saveFiles[i].sourceName))
return &_saveFiles[i];
return 0;
}
SaveHandler *SaveLoad_Adibou1::getHandler(const char *fileName) const {
const SaveFile *saveFile = getSaveFile(fileName);
if (saveFile)
return saveFile->handler;
return 0;
}
const char *SaveLoad_Adibou1::getDescription(const char *fileName) const {
const SaveFile *saveFile = getSaveFile(fileName);
if (saveFile)
return saveFile->description;
return 0;
}
SaveLoad::SaveMode SaveLoad_Adibou1::getSaveMode(const char *fileName) const {
const SaveFile *saveFile = getSaveFile(fileName);
if (saveFile)
return saveFile->mode;
return kSaveModeNone;
}
} // End of namespace Gob