mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 04:35:16 +00:00
SHERLOCK: Split detection features & adapt to new plugins.
This commit is contained in:
parent
4458a2e243
commit
e29f02597c
2
configure
vendored
2
configure
vendored
@ -6166,7 +6166,7 @@ declare -a static_detect_engines=("PLUMBERS" "AGI" "SCUMM" "SKY" "DREAMWEB" "DRA
|
||||
"GRIFFON" "GROOVIE" "HDB" "HOPKINS" "HUGO" "ILLUSIONS" "KINGDOM"
|
||||
"KYRA" "LAB" "LASTEXPRESS" "LILLIPUT" "MACVENTURE" "MADE" "MADS"
|
||||
"MORTEVIELLE" "MUTATIONOFJB" "NEVERHOOD" "PARALLACTION" "PEGASUS"
|
||||
"PETKA" "PINK" "PRINCE")
|
||||
"PETKA" "PINK" "PRINCE" "SHERLOCK")
|
||||
detectId="_DETECTION"
|
||||
|
||||
echo "Creating engines/plugins_table.h"
|
||||
|
@ -20,35 +20,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sherlock/sherlock.h"
|
||||
#include "sherlock/saveload.h"
|
||||
#include "sherlock/scalpel/scalpel.h"
|
||||
#include "sherlock/tattoo/tattoo.h"
|
||||
#include "common/system.h"
|
||||
#include "common/translation.h"
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
struct SherlockGameDescription {
|
||||
ADGameDescription desc;
|
||||
|
||||
GameType gameID;
|
||||
};
|
||||
|
||||
GameType SherlockEngine::getGameID() const {
|
||||
return _gameDescription->gameID;
|
||||
}
|
||||
|
||||
Common::Platform SherlockEngine::getPlatform() const {
|
||||
return _gameDescription->desc.platform;
|
||||
}
|
||||
|
||||
Common::Language SherlockEngine::getLanguage() const {
|
||||
return _gameDescription->desc.language;
|
||||
}
|
||||
|
||||
} // End of namespace Sherlock
|
||||
#include "sherlock/detection_enums.h"
|
||||
#include "sherlock/detection.h"
|
||||
|
||||
static const PlainGameDescriptor sherlockGames[] = {
|
||||
{ "scalpel", "The Case of the Serrated Scalpel" },
|
||||
@ -162,120 +138,7 @@ public:
|
||||
const char *getOriginalCopyright() const override {
|
||||
return "Sherlock (C) 1992-1996 Mythos Software, (C) 1992-1996 Electronic Arts";
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of the game engine
|
||||
*/
|
||||
bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
|
||||
|
||||
/**
|
||||
* Returns a list of features the game's MetaEngine support
|
||||
*/
|
||||
bool hasFeature(MetaEngineFeature f) const override;
|
||||
|
||||
/**
|
||||
* Return a list of savegames
|
||||
*/
|
||||
SaveStateList listSaves(const char *target) const override;
|
||||
|
||||
/**
|
||||
* Returns the maximum number of allowed save slots
|
||||
*/
|
||||
int getMaximumSaveSlot() const override;
|
||||
|
||||
/**
|
||||
* Deletes a savegame in the specified slot
|
||||
*/
|
||||
void removeSaveState(const char *target, int slot) const override;
|
||||
|
||||
/**
|
||||
* Given a specified savegame slot, returns extended information for the save
|
||||
*/
|
||||
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
|
||||
};
|
||||
|
||||
bool SherlockMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
|
||||
const Sherlock::SherlockGameDescription *gd = (const Sherlock::SherlockGameDescription *)desc;
|
||||
if (gd) {
|
||||
switch (gd->gameID) {
|
||||
case Sherlock::GType_SerratedScalpel:
|
||||
*engine = new Sherlock::Scalpel::ScalpelEngine(syst, gd);
|
||||
break;
|
||||
case Sherlock::GType_RoseTattoo:
|
||||
*engine = new Sherlock::Tattoo::TattooEngine(syst, gd);
|
||||
break;
|
||||
default:
|
||||
error("Unknown game");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return gd != 0;
|
||||
}
|
||||
|
||||
bool SherlockMetaEngine::hasFeature(MetaEngineFeature f) const {
|
||||
return
|
||||
(f == kSupportsListSaves) ||
|
||||
(f == kSupportsLoadingDuringStartup) ||
|
||||
(f == kSupportsDeleteSave) ||
|
||||
(f == kSavesSupportMetaInfo) ||
|
||||
(f == kSavesSupportThumbnail) ||
|
||||
(f == kSavesSupportCreationDate) ||
|
||||
(f == kSavesSupportPlayTime) ||
|
||||
(f == kSimpleSavesNames);
|
||||
}
|
||||
|
||||
bool Sherlock::SherlockEngine::hasFeature(EngineFeature f) const {
|
||||
return
|
||||
(f == kSupportsReturnToLauncher) ||
|
||||
(f == kSupportsLoadingDuringRuntime) ||
|
||||
(f == kSupportsSavingDuringRuntime);
|
||||
}
|
||||
|
||||
bool Sherlock::SherlockEngine::isDemo() const {
|
||||
return _gameDescription->desc.flags & ADGF_DEMO;
|
||||
}
|
||||
|
||||
SaveStateList SherlockMetaEngine::listSaves(const char *target) const {
|
||||
return Sherlock::SaveManager::getSavegameList(target);
|
||||
}
|
||||
|
||||
int SherlockMetaEngine::getMaximumSaveSlot() const {
|
||||
return MAX_SAVEGAME_SLOTS;
|
||||
}
|
||||
|
||||
void SherlockMetaEngine::removeSaveState(const char *target, int slot) const {
|
||||
Common::String filename = Sherlock::SaveManager(nullptr, target).generateSaveName(slot);
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
SaveStateDescriptor SherlockMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
|
||||
Common::String filename = Sherlock::SaveManager(nullptr, target).generateSaveName(slot);
|
||||
Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(filename);
|
||||
|
||||
if (f) {
|
||||
Sherlock::SherlockSavegameHeader header;
|
||||
if (!Sherlock::SaveManager::readSavegameHeader(f, header, false)) {
|
||||
delete f;
|
||||
return SaveStateDescriptor();
|
||||
}
|
||||
delete f;
|
||||
|
||||
// Create the return descriptor
|
||||
SaveStateDescriptor desc(slot, header._saveName);
|
||||
desc.setThumbnail(header._thumbnail);
|
||||
desc.setSaveDate(header._year, header._month, header._day);
|
||||
desc.setSaveTime(header._hour, header._minute);
|
||||
desc.setPlayTime(header._totalFrames * GAME_FRAME_TIME);
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
return SaveStateDescriptor();
|
||||
}
|
||||
|
||||
|
||||
#if PLUGIN_ENABLED_DYNAMIC(SHERLOCK)
|
||||
REGISTER_PLUGIN_DYNAMIC(SHERLOCK, PLUGIN_TYPE_ENGINE, SherlockMetaEngine);
|
||||
#else
|
||||
REGISTER_PLUGIN_STATIC(SHERLOCK, PLUGIN_TYPE_ENGINE, SherlockMetaEngine);
|
||||
#endif
|
||||
REGISTER_PLUGIN_STATIC(SHERLOCK_DETECTION, PLUGIN_TYPE_METAENGINE, SherlockMetaEngine);
|
||||
|
31
engines/sherlock/detection.h
Normal file
31
engines/sherlock/detection.h
Normal file
@ -0,0 +1,31 @@
|
||||
/* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
struct SherlockGameDescription {
|
||||
ADGameDescription desc;
|
||||
|
||||
GameType gameID;
|
||||
};
|
||||
|
||||
} // End of namespace Sherlock
|
30
engines/sherlock/detection_enums.h
Normal file
30
engines/sherlock/detection_enums.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
enum GameType {
|
||||
GType_SerratedScalpel = 0,
|
||||
GType_RoseTattoo = 1
|
||||
};
|
||||
|
||||
} // End of namespace Sherlock
|
171
engines/sherlock/metaengine.cpp
Normal file
171
engines/sherlock/metaengine.cpp
Normal file
@ -0,0 +1,171 @@
|
||||
/* 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 "sherlock/sherlock.h"
|
||||
#include "sherlock/saveload.h"
|
||||
#include "sherlock/scalpel/scalpel.h"
|
||||
#include "sherlock/tattoo/tattoo.h"
|
||||
|
||||
#include "common/system.h"
|
||||
#include "common/translation.h"
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
#include "sherlock/detection.h"
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
GameType SherlockEngine::getGameID() const {
|
||||
return _gameDescription->gameID;
|
||||
}
|
||||
|
||||
Common::Platform SherlockEngine::getPlatform() const {
|
||||
return _gameDescription->desc.platform;
|
||||
}
|
||||
|
||||
Common::Language SherlockEngine::getLanguage() const {
|
||||
return _gameDescription->desc.language;
|
||||
}
|
||||
|
||||
} // End of namespace Sherlock
|
||||
|
||||
|
||||
class SherlockMetaEngineConnect : public AdvancedMetaEngineConnect {
|
||||
public:
|
||||
const char *getName() const override {
|
||||
return "sherlock";
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of the game engine
|
||||
*/
|
||||
bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
|
||||
|
||||
/**
|
||||
* Returns a list of features the game's MetaEngine support
|
||||
*/
|
||||
bool hasFeature(MetaEngineFeature f) const override;
|
||||
|
||||
/**
|
||||
* Return a list of savegames
|
||||
*/
|
||||
SaveStateList listSaves(const char *target) const override;
|
||||
|
||||
/**
|
||||
* Returns the maximum number of allowed save slots
|
||||
*/
|
||||
int getMaximumSaveSlot() const override;
|
||||
|
||||
/**
|
||||
* Deletes a savegame in the specified slot
|
||||
*/
|
||||
void removeSaveState(const char *target, int slot) const override;
|
||||
|
||||
/**
|
||||
* Given a specified savegame slot, returns extended information for the save
|
||||
*/
|
||||
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
|
||||
};
|
||||
|
||||
bool SherlockMetaEngineConnect::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
|
||||
const Sherlock::SherlockGameDescription *gd = (const Sherlock::SherlockGameDescription *)desc;
|
||||
if (gd) {
|
||||
switch (gd->gameID) {
|
||||
case Sherlock::GType_SerratedScalpel:
|
||||
*engine = new Sherlock::Scalpel::ScalpelEngine(syst, gd);
|
||||
break;
|
||||
case Sherlock::GType_RoseTattoo:
|
||||
*engine = new Sherlock::Tattoo::TattooEngine(syst, gd);
|
||||
break;
|
||||
default:
|
||||
error("Unknown game");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return gd != 0;
|
||||
}
|
||||
|
||||
bool SherlockMetaEngineConnect::hasFeature(MetaEngineFeature f) const {
|
||||
return
|
||||
(f == kSupportsListSaves) ||
|
||||
(f == kSupportsLoadingDuringStartup) ||
|
||||
(f == kSupportsDeleteSave) ||
|
||||
(f == kSavesSupportMetaInfo) ||
|
||||
(f == kSavesSupportThumbnail) ||
|
||||
(f == kSavesSupportCreationDate) ||
|
||||
(f == kSavesSupportPlayTime) ||
|
||||
(f == kSimpleSavesNames);
|
||||
}
|
||||
|
||||
bool Sherlock::SherlockEngine::hasFeature(EngineFeature f) const {
|
||||
return
|
||||
(f == kSupportsReturnToLauncher) ||
|
||||
(f == kSupportsLoadingDuringRuntime) ||
|
||||
(f == kSupportsSavingDuringRuntime);
|
||||
}
|
||||
|
||||
bool Sherlock::SherlockEngine::isDemo() const {
|
||||
return _gameDescription->desc.flags & ADGF_DEMO;
|
||||
}
|
||||
|
||||
SaveStateList SherlockMetaEngineConnect::listSaves(const char *target) const {
|
||||
return Sherlock::SaveManager::getSavegameList(target);
|
||||
}
|
||||
|
||||
int SherlockMetaEngineConnect::getMaximumSaveSlot() const {
|
||||
return MAX_SAVEGAME_SLOTS;
|
||||
}
|
||||
|
||||
void SherlockMetaEngineConnect::removeSaveState(const char *target, int slot) const {
|
||||
Common::String filename = Sherlock::SaveManager(nullptr, target).generateSaveName(slot);
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
SaveStateDescriptor SherlockMetaEngineConnect::querySaveMetaInfos(const char *target, int slot) const {
|
||||
Common::String filename = Sherlock::SaveManager(nullptr, target).generateSaveName(slot);
|
||||
Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(filename);
|
||||
|
||||
if (f) {
|
||||
Sherlock::SherlockSavegameHeader header;
|
||||
if (!Sherlock::SaveManager::readSavegameHeader(f, header, false)) {
|
||||
delete f;
|
||||
return SaveStateDescriptor();
|
||||
}
|
||||
delete f;
|
||||
|
||||
// Create the return descriptor
|
||||
SaveStateDescriptor desc(slot, header._saveName);
|
||||
desc.setThumbnail(header._thumbnail);
|
||||
desc.setSaveDate(header._year, header._month, header._day);
|
||||
desc.setSaveTime(header._hour, header._minute);
|
||||
desc.setPlayTime(header._totalFrames * GAME_FRAME_TIME);
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
return SaveStateDescriptor();
|
||||
}
|
||||
|
||||
#if PLUGIN_ENABLED_DYNAMIC(SHERLOCK)
|
||||
REGISTER_PLUGIN_DYNAMIC(SHERLOCK, PLUGIN_TYPE_ENGINE, SherlockMetaEngineConnect);
|
||||
#else
|
||||
REGISTER_PLUGIN_STATIC(SHERLOCK, PLUGIN_TYPE_ENGINE, SherlockMetaEngineConnect);
|
||||
#endif
|
@ -49,7 +49,6 @@ MODULE_OBJS = \
|
||||
tattoo/widget_verbs.o \
|
||||
animation.o \
|
||||
debugger.o \
|
||||
detection.o \
|
||||
events.o \
|
||||
fixed_text.o \
|
||||
fonts.o \
|
||||
@ -57,6 +56,7 @@ MODULE_OBJS = \
|
||||
inventory.o \
|
||||
journal.o \
|
||||
map.o \
|
||||
metaengine.o \
|
||||
music.o \
|
||||
objects.o \
|
||||
people.o \
|
||||
@ -77,3 +77,6 @@ endif
|
||||
|
||||
# Include common rules
|
||||
include $(srcdir)/rules.mk
|
||||
|
||||
# Detection objects
|
||||
DETECT_OBJS += $(MODULE)/detection.o
|
||||
|
@ -31,7 +31,9 @@
|
||||
#include "common/random.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/util.h"
|
||||
|
||||
#include "engines/engine.h"
|
||||
|
||||
#include "sherlock/animation.h"
|
||||
#include "sherlock/debugger.h"
|
||||
#include "sherlock/events.h"
|
||||
@ -48,6 +50,7 @@
|
||||
#include "sherlock/sound.h"
|
||||
#include "sherlock/talk.h"
|
||||
#include "sherlock/user_interface.h"
|
||||
#include "sherlock/detection_enums.h"
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
@ -58,11 +61,6 @@ enum {
|
||||
kDebugLevelMusic = 4 << 0
|
||||
};
|
||||
|
||||
enum GameType {
|
||||
GType_SerratedScalpel = 0,
|
||||
GType_RoseTattoo = 1
|
||||
};
|
||||
|
||||
#define SHERLOCK_SCREEN_WIDTH _vm->_screen->width()
|
||||
#define SHERLOCK_SCREEN_HEIGHT _vm->_screen->height()
|
||||
#define SHERLOCK_SCENE_WIDTH _vm->_screen->_backBuffer1.width()
|
||||
|
Loading…
x
Reference in New Issue
Block a user