ENGINES: Begin class renaming of ME & AME
- ME -> MetaEngineStatic (static parts) - MEC -> MetaEngine (dynamic parts)
This commit is contained in:
parent
c48719404a
commit
71a820caff
17 changed files with 91 additions and 91 deletions
|
@ -784,7 +784,7 @@ static void listGames() {
|
|||
|
||||
const PluginList &plugins = EngineMan.getPlugins();
|
||||
for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
||||
const MetaEngine &metaengine = (*iter)->get<MetaEngine>();
|
||||
const MetaEngineStatic &metaengine = (*iter)->get<MetaEngineStatic>();
|
||||
|
||||
PlainGameList list = metaengine.getSupportedGames();
|
||||
for (PlainGameList::const_iterator v = list.begin(); v != list.end(); ++v) {
|
||||
|
@ -800,7 +800,7 @@ static void listEngines() {
|
|||
|
||||
const PluginList &plugins = EngineMan.getPlugins();
|
||||
for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
||||
const MetaEngine &metaEngine = (*iter)->get<MetaEngine>();
|
||||
const MetaEngineStatic &metaEngine = (*iter)->get<MetaEngineStatic>();
|
||||
printf("%-15s %s\n", metaEngine.getEngineId(), metaEngine.getName());
|
||||
}
|
||||
}
|
||||
|
@ -907,10 +907,10 @@ static Common::Error listSaves(const Common::String &singleTarget) {
|
|||
}
|
||||
}
|
||||
|
||||
const MetaEngineConnect &metaEngine = enginePlugin->get<MetaEngineConnect>();
|
||||
const MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
|
||||
Common::String qualifiedGameId = buildQualifiedGameName(game.engineId, game.gameId);
|
||||
|
||||
if (!metaEngine.hasFeature(MetaEngineConnect::kSupportsListSaves)) {
|
||||
if (!metaEngine.hasFeature(MetaEngine::kSupportsListSaves)) {
|
||||
// If the target was specified, treat this as an error, and otherwise skip it.
|
||||
if (!singleTarget.empty())
|
||||
// TODO: Include more info about the target (desc, engine name, ...) ???
|
||||
|
|
|
@ -133,7 +133,7 @@ static const Plugin *detectPlugin() {
|
|||
|
||||
// Query the plugin for the game descriptor
|
||||
printf(" Looking for a plugin supporting this target... %s\n", plugin->getName());
|
||||
PlainGameDescriptor game = plugin->get<MetaEngine>().findGame(gameId.c_str());
|
||||
PlainGameDescriptor game = plugin->get<MetaEngineStatic>().findGame(gameId.c_str());
|
||||
if (!game.gameId) {
|
||||
warning("'%s' is an invalid game ID for the engine '%s'. Use the --list-games option to list supported game IDs", gameId.c_str(), engineId.c_str());
|
||||
return 0;
|
||||
|
@ -182,7 +182,7 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common
|
|||
}
|
||||
|
||||
// Create the game's MetaEngine.
|
||||
const MetaEngine &metaEngine = plugin->get<MetaEngine>();
|
||||
const MetaEngineStatic &metaEngine = plugin->get<MetaEngineStatic>();
|
||||
if (err.getCode() == Common::kNoError) {
|
||||
// Set default values for all of the custom engine options
|
||||
// Apparently some engines query them in their constructor, thus we
|
||||
|
@ -200,7 +200,7 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common
|
|||
}
|
||||
|
||||
// Create the game's MetaEngineConnect.
|
||||
const MetaEngineConnect &metaEngineConnect = enginePluginToLaunchGame->get<MetaEngineConnect>();
|
||||
const MetaEngine &metaEngineConnect = enginePluginToLaunchGame->get<MetaEngine>();
|
||||
err = metaEngineConnect.createInstance(&system, &engine);
|
||||
|
||||
// Check for errors
|
||||
|
|
|
@ -634,7 +634,7 @@ QualifiedGameList EngineManager::findGamesMatching(const Common::String &engineI
|
|||
// If we got an engine name, look for THE game only in that engine
|
||||
const Plugin *p = EngineMan.findPlugin(engineId);
|
||||
if (p) {
|
||||
const MetaEngine &engine = p->get<MetaEngine>();
|
||||
const MetaEngineStatic &engine = p->get<MetaEngineStatic>();
|
||||
|
||||
PlainGameDescriptor pluginResult = engine.findGame(gameId.c_str());
|
||||
if (pluginResult.gameId) {
|
||||
|
@ -663,7 +663,7 @@ QualifiedGameList EngineManager::findGameInLoadedPlugins(const Common::String &g
|
|||
PluginList::const_iterator iter;
|
||||
|
||||
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
||||
const MetaEngine &engine = (*iter)->get<MetaEngine>();
|
||||
const MetaEngineStatic &engine = (*iter)->get<MetaEngineStatic>();
|
||||
PlainGameDescriptor pluginResult = engine.findGame(gameId.c_str());
|
||||
|
||||
if (pluginResult.gameId) {
|
||||
|
@ -686,7 +686,7 @@ DetectionResults EngineManager::detectGames(const Common::FSList &fslist) const
|
|||
// Iterate over all known games and for each check if it might be
|
||||
// the game in the presented directory.
|
||||
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
||||
const MetaEngine &metaEngine = (*iter)->get<MetaEngine>();
|
||||
const MetaEngineStatic &metaEngine = (*iter)->get<MetaEngineStatic>();
|
||||
DetectedGames engineCandidates = metaEngine.detectGames(fslist);
|
||||
|
||||
for (uint i = 0; i < engineCandidates.size(); i++) {
|
||||
|
@ -764,7 +764,7 @@ const Plugin *EngineManager::findLoadedPlugin(const Common::String &engineId) co
|
|||
const PluginList &plugins = getPlugins();
|
||||
|
||||
for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); iter++)
|
||||
if (engineId == (*iter)->get<MetaEngine>().getEngineId())
|
||||
if (engineId == (*iter)->get<MetaEngineStatic>().getEngineId())
|
||||
return *iter;
|
||||
|
||||
return 0;
|
||||
|
@ -816,7 +816,7 @@ QualifiedGameDescriptor EngineManager::findTarget(const Common::String &target,
|
|||
}
|
||||
|
||||
// Make sure it does support the game ID
|
||||
const MetaEngine &engine = foundPlugin->get<MetaEngine>();
|
||||
const MetaEngineStatic &engine = foundPlugin->get<MetaEngineStatic>();
|
||||
PlainGameDescriptor desc = engine.findGame(domain->getVal("gameid").c_str());
|
||||
if (!desc.gameId) {
|
||||
return QualifiedGameDescriptor();
|
||||
|
@ -873,7 +873,7 @@ void EngineManager::upgradeTargetForEngineId(const Common::String &target) const
|
|||
}
|
||||
|
||||
// Take the first detection entry
|
||||
const MetaEngine &metaEngine = plugin->get<MetaEngine>();
|
||||
const MetaEngineStatic &metaEngine = plugin->get<MetaEngineStatic>();
|
||||
DetectedGames candidates = metaEngine.detectGames(files);
|
||||
if (candidates.empty()) {
|
||||
warning("No games supported by the engine '%s' were found in path '%s' when upgrading target '%s'",
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
*/
|
||||
class FileMapArchive : public Common::Archive {
|
||||
public:
|
||||
FileMapArchive(const AdvancedMetaEngine::FileMap &fileMap) : _fileMap(fileMap) {}
|
||||
FileMapArchive(const AdvancedMetaEngineStatic::FileMap &fileMap) : _fileMap(fileMap) {}
|
||||
|
||||
bool hasFile(const Common::String &name) const override {
|
||||
return _fileMap.contains(name);
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
int listMembers(Common::ArchiveMemberList &list) const override {
|
||||
int files = 0;
|
||||
for (AdvancedMetaEngine::FileMap::const_iterator it = _fileMap.begin(); it != _fileMap.end(); ++it) {
|
||||
for (AdvancedMetaEngineStatic::FileMap::const_iterator it = _fileMap.begin(); it != _fileMap.end(); ++it) {
|
||||
list.push_back(Common::ArchiveMemberPtr(new Common::FSNode(it->_value)));
|
||||
++files;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
}
|
||||
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override {
|
||||
AdvancedMetaEngine::FileMap::const_iterator it = _fileMap.find(name);
|
||||
AdvancedMetaEngineStatic::FileMap::const_iterator it = _fileMap.find(name);
|
||||
if (it == _fileMap.end()) {
|
||||
return Common::ArchiveMemberPtr();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
const AdvancedMetaEngine::FileMap &_fileMap;
|
||||
const AdvancedMetaEngineStatic::FileMap &_fileMap;
|
||||
};
|
||||
|
||||
static Common::String sanitizeName(const char *name) {
|
||||
|
@ -120,7 +120,7 @@ static Common::String generatePreferredTarget(const ADGameDescription *desc) {
|
|||
return res;
|
||||
}
|
||||
|
||||
DetectedGame AdvancedMetaEngine::toDetectedGame(const ADDetectedGame &adGame) const {
|
||||
DetectedGame AdvancedMetaEngineStatic::toDetectedGame(const ADDetectedGame &adGame) const {
|
||||
const ADGameDescription *desc = adGame.desc;
|
||||
|
||||
const char *title;
|
||||
|
@ -186,7 +186,7 @@ bool cleanupPirated(ADDetectedGames &matched) {
|
|||
}
|
||||
|
||||
|
||||
DetectedGames AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const {
|
||||
DetectedGames AdvancedMetaEngineStatic::detectGames(const Common::FSList &fslist) const {
|
||||
FileMap allFiles;
|
||||
|
||||
if (fslist.empty())
|
||||
|
@ -232,7 +232,7 @@ DetectedGames AdvancedMetaEngine::detectGames(const Common::FSList &fslist) cons
|
|||
return detectedGames;
|
||||
}
|
||||
|
||||
const ExtraGuiOptions AdvancedMetaEngine::getExtraGuiOptions(const Common::String &target) const {
|
||||
const ExtraGuiOptions AdvancedMetaEngineStatic::getExtraGuiOptions(const Common::String &target) const {
|
||||
if (!_extraGuiOptions)
|
||||
return ExtraGuiOptions();
|
||||
|
||||
|
@ -260,7 +260,7 @@ const ExtraGuiOptions AdvancedMetaEngine::getExtraGuiOptions(const Common::Strin
|
|||
return options;
|
||||
}
|
||||
|
||||
Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
|
||||
Common::Error AdvancedMetaEngineStatic::createInstance(OSystem *syst, Engine **engine) const {
|
||||
assert(engine);
|
||||
|
||||
Common::Language language = Common::UNK_LANG;
|
||||
|
@ -359,7 +359,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
|
|||
|
||||
if (plugin) {
|
||||
// Call child class's createInstanceMethod.
|
||||
if (plugin->get<AdvancedMetaEngineConnect>().createInstance(syst, engine, agdDesc.desc)) {
|
||||
if (plugin->get<AdvancedMetaEngine>().createInstance(syst, engine, agdDesc.desc)) {
|
||||
return Common::Error(Common::kNoError);
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
|
|||
return Common::Error(Common::kNoGameDataFoundError);
|
||||
}
|
||||
|
||||
void AdvancedMetaEngine::composeFileHashMap(FileMap &allFiles, const Common::FSList &fslist, int depth, const Common::String &parentName) const {
|
||||
void AdvancedMetaEngineStatic::composeFileHashMap(FileMap &allFiles, const Common::FSList &fslist, int depth, const Common::String &parentName) const {
|
||||
if (depth <= 0)
|
||||
return;
|
||||
|
||||
|
@ -407,7 +407,7 @@ void AdvancedMetaEngine::composeFileHashMap(FileMap &allFiles, const Common::FSL
|
|||
}
|
||||
}
|
||||
|
||||
bool AdvancedMetaEngine::getFileProperties(const FileMap &allFiles, const ADGameDescription &game, const Common::String fname, FileProperties &fileProps) const {
|
||||
bool AdvancedMetaEngineStatic::getFileProperties(const FileMap &allFiles, const ADGameDescription &game, const Common::String fname, FileProperties &fileProps) const {
|
||||
// FIXME/TODO: We don't handle the case that a file is listed as a regular
|
||||
// file and as one with resource fork.
|
||||
|
||||
|
@ -439,7 +439,7 @@ bool AdvancedMetaEngine::getFileProperties(const FileMap &allFiles, const ADGame
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AdvancedMetaEngineConnect::getFilePropertiesExtern(uint md5Bytes, const FileMap &allFiles, const ADGameDescription &game, const Common::String fname, FileProperties &fileProps) const {
|
||||
bool AdvancedMetaEngine::getFilePropertiesExtern(uint md5Bytes, const FileMap &allFiles, const ADGameDescription &game, const Common::String fname, FileProperties &fileProps) const {
|
||||
// FIXME/TODO: We don't handle the case that a file is listed as a regular
|
||||
// file and as one with resource fork.
|
||||
|
||||
|
@ -471,7 +471,7 @@ bool AdvancedMetaEngineConnect::getFilePropertiesExtern(uint md5Bytes, const Fil
|
|||
return true;
|
||||
}
|
||||
|
||||
ADDetectedGames AdvancedMetaEngine::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const {
|
||||
ADDetectedGames AdvancedMetaEngineStatic::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const {
|
||||
FilePropertiesMap filesProps;
|
||||
ADDetectedGames matched;
|
||||
|
||||
|
@ -596,7 +596,7 @@ ADDetectedGames AdvancedMetaEngine::detectGame(const Common::FSNode &parent, con
|
|||
return matched;
|
||||
}
|
||||
|
||||
ADDetectedGame AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const {
|
||||
ADDetectedGame AdvancedMetaEngineStatic::detectGameFilebased(const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const {
|
||||
const ADFileBasedFallback *ptr;
|
||||
const char* const* filenames;
|
||||
|
||||
|
@ -644,11 +644,11 @@ ADDetectedGame AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles,
|
|||
return result;
|
||||
}
|
||||
|
||||
PlainGameList AdvancedMetaEngine::getSupportedGames() const {
|
||||
PlainGameList AdvancedMetaEngineStatic::getSupportedGames() const {
|
||||
return PlainGameList(_gameIds);
|
||||
}
|
||||
|
||||
PlainGameDescriptor AdvancedMetaEngine::findGame(const char *gameId) const {
|
||||
PlainGameDescriptor AdvancedMetaEngineStatic::findGame(const char *gameId) const {
|
||||
// First search the list of supported gameids for a match.
|
||||
const PlainGameDescriptor *g = findPlainGameDescriptor(gameId, _gameIds);
|
||||
if (g)
|
||||
|
@ -658,7 +658,7 @@ PlainGameDescriptor AdvancedMetaEngine::findGame(const char *gameId) const {
|
|||
return PlainGameDescriptor::empty();
|
||||
}
|
||||
|
||||
AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions)
|
||||
AdvancedMetaEngineStatic::AdvancedMetaEngineStatic(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions)
|
||||
: _gameDescriptors((const byte *)descs), _descItemSize(descItemSize), _gameIds(gameIds),
|
||||
_extraGuiOptions(extraGuiOptions) {
|
||||
|
||||
|
@ -670,7 +670,7 @@ AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, con
|
|||
_matchFullPaths = false;
|
||||
}
|
||||
|
||||
void AdvancedMetaEngine::initSubSystems(const ADGameDescription *gameDesc) const {
|
||||
void AdvancedMetaEngineStatic::initSubSystems(const ADGameDescription *gameDesc) const {
|
||||
#ifdef ENABLE_EVENTRECORDER
|
||||
if (gameDesc) {
|
||||
g_eventRec.processGameDescription(gameDesc);
|
||||
|
@ -678,12 +678,12 @@ void AdvancedMetaEngine::initSubSystems(const ADGameDescription *gameDesc) const
|
|||
#endif
|
||||
}
|
||||
|
||||
Common::Error AdvancedMetaEngineConnect::createInstance(OSystem *syst, Engine **engine) const {
|
||||
Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
|
||||
PluginList pl = PluginMan.getPlugins(PLUGIN_TYPE_ENGINE);
|
||||
if (pl.size() == 1) {
|
||||
Plugin *metaEnginePlugin = PluginMan.getMetaEngineFromEngine(pl[0]);
|
||||
if (metaEnginePlugin) {
|
||||
return metaEnginePlugin->get<AdvancedMetaEngine>().createInstance(syst, engine);
|
||||
return metaEnginePlugin->get<AdvancedMetaEngineStatic>().createInstance(syst, engine);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ struct ADExtraGuiOptionsMap {
|
|||
/**
|
||||
* A MetaEngine implementation based around the advanced detector code.
|
||||
*/
|
||||
class AdvancedMetaEngine : public MetaEngine {
|
||||
class AdvancedMetaEngineStatic : public MetaEngineStatic {
|
||||
protected:
|
||||
/**
|
||||
* Pointer to an array of objects which are either ADGameDescription
|
||||
|
@ -246,7 +246,7 @@ protected:
|
|||
bool _matchFullPaths;
|
||||
|
||||
public:
|
||||
AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions = 0);
|
||||
AdvancedMetaEngineStatic(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions = 0);
|
||||
|
||||
/**
|
||||
* Returns list of targets supported by the engine.
|
||||
|
@ -327,7 +327,7 @@ protected:
|
|||
/**
|
||||
* A MetaEngineConnect implementation of AdvancedMetaEngine.
|
||||
*/
|
||||
class AdvancedMetaEngineConnect : public MetaEngineConnect {
|
||||
class AdvancedMetaEngine : public MetaEngine {
|
||||
public:
|
||||
/**
|
||||
* Base createInstance for AMEC.
|
||||
|
|
|
@ -273,7 +273,7 @@ ConfigDialog::ConfigDialog() :
|
|||
assert(g_engine);
|
||||
|
||||
const Common::String &gameDomain = ConfMan.getActiveDomainName();
|
||||
const MetaEngineConnect &metaEngineConnect = g_engine->getMetaEngineConnect();
|
||||
const MetaEngine &metaEngineConnect = g_engine->getMetaEngineConnect();
|
||||
|
||||
// GUI: Add tab widget
|
||||
GUI::TabWidget *tab = new GUI::TabWidget(this, "GlobalConfig.TabWidget");
|
||||
|
|
|
@ -731,7 +731,7 @@ Common::Error Engine::loadGameState(int slot) {
|
|||
Common::Error result = loadGameStream(saveFile);
|
||||
if (result.getCode() == Common::kNoError) {
|
||||
ExtendedSavegameHeader header;
|
||||
if (MetaEngineConnect::readSavegameHeader(saveFile, &header))
|
||||
if (MetaEngine::readSavegameHeader(saveFile, &header))
|
||||
setTotalPlayTime(header.playtime);
|
||||
}
|
||||
|
||||
|
@ -757,7 +757,7 @@ Common::Error Engine::saveGameState(int slot, const Common::String &desc, bool i
|
|||
|
||||
Common::Error result = saveGameStream(saveFile, isAutosave);
|
||||
if (result.getCode() == Common::kNoError) {
|
||||
MetaEngineConnect::appendExtendedSave(saveFile, getTotalPlayTime() / 1000, desc, isAutosave);
|
||||
MetaEngine::appendExtendedSave(saveFile, getTotalPlayTime() / 1000, desc, isAutosave);
|
||||
|
||||
saveFile->finalize();
|
||||
}
|
||||
|
@ -865,20 +865,20 @@ EnginePlugin *Engine::getMetaEnginePlugin() const {
|
|||
|
||||
*/
|
||||
|
||||
MetaEngine &Engine::getMetaEngine() {
|
||||
MetaEngineStatic &Engine::getMetaEngine() {
|
||||
const Plugin *plugin = EngineMan.findPlugin(ConfMan.get("engineid"));
|
||||
assert(plugin);
|
||||
return plugin->get<MetaEngine>();
|
||||
return plugin->get<MetaEngineStatic>();
|
||||
}
|
||||
|
||||
MetaEngineConnect &Engine::getMetaEngineConnect() {
|
||||
MetaEngine &Engine::getMetaEngineConnect() {
|
||||
const Plugin *metaEnginePlugin = EngineMan.findPlugin(ConfMan.get("engineid"));
|
||||
assert(metaEnginePlugin);
|
||||
|
||||
const Plugin *enginePlugin = PluginMan.getEngineFromMetaEngine(metaEnginePlugin);
|
||||
assert(enginePlugin);
|
||||
|
||||
return enginePlugin->get<MetaEngineConnect>();
|
||||
return enginePlugin->get<MetaEngine>();
|
||||
}
|
||||
|
||||
PauseToken::PauseToken() : _engine(nullptr) {}
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
#include "common/singleton.h"
|
||||
|
||||
class OSystem;
|
||||
class MetaEngineStatic;
|
||||
class MetaEngine;
|
||||
class MetaEngineConnect;
|
||||
|
||||
namespace Audio {
|
||||
class Mixer;
|
||||
|
@ -379,8 +379,8 @@ public:
|
|||
*/
|
||||
static bool shouldQuit();
|
||||
|
||||
static MetaEngine &getMetaEngine();
|
||||
static MetaEngineConnect &getMetaEngineConnect();
|
||||
static MetaEngineStatic &getMetaEngine();
|
||||
static MetaEngine &getMetaEngineConnect();
|
||||
|
||||
/**
|
||||
* Pause the engine. This should stop any audio playback
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "graphics/managed_surface.h"
|
||||
#include "graphics/thumbnail.h"
|
||||
|
||||
Common::String MetaEngineConnect::getSavegameFile(int saveGameIdx, const char *target) const {
|
||||
Common::String MetaEngine::getSavegameFile(int saveGameIdx, const char *target) const {
|
||||
if (saveGameIdx == kSavegameFilePattern) {
|
||||
// Pattern requested
|
||||
const char *pattern = hasFeature(kSavesUseExtendedFormat) ? "%s.###" : "%s.s##";
|
||||
|
@ -49,7 +49,7 @@ Common::String MetaEngineConnect::getSavegameFile(int saveGameIdx, const char *t
|
|||
}
|
||||
}
|
||||
|
||||
Common::KeymapArray MetaEngineConnect::initKeymaps(const char *target) const {
|
||||
Common::KeymapArray MetaEngine::initKeymaps(const char *target) const {
|
||||
using namespace Common;
|
||||
|
||||
Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "engine-default", _("Default game keymap"));
|
||||
|
@ -128,7 +128,7 @@ Common::KeymapArray MetaEngineConnect::initKeymaps(const char *target) const {
|
|||
return Keymap::arrayOf(engineKeyMap);
|
||||
}
|
||||
|
||||
bool MetaEngineConnect::hasFeature(MetaEngineFeature f) const {
|
||||
bool MetaEngine::hasFeature(MetaEngineFeature f) const {
|
||||
return
|
||||
(f == kSupportsListSaves) ||
|
||||
(f == kSupportsDeleteSave) ||
|
||||
|
@ -140,7 +140,7 @@ bool MetaEngineConnect::hasFeature(MetaEngineFeature f) const {
|
|||
(f == kSavesUseExtendedFormat);
|
||||
}
|
||||
|
||||
void MetaEngineConnect::appendExtendedSave(Common::OutSaveFile *saveFile, uint32 playtime,
|
||||
void MetaEngine::appendExtendedSave(Common::OutSaveFile *saveFile, uint32 playtime,
|
||||
Common::String desc, bool isAutosave) {
|
||||
ExtendedSavegameHeader header;
|
||||
|
||||
|
@ -172,7 +172,7 @@ void MetaEngineConnect::appendExtendedSave(Common::OutSaveFile *saveFile, uint32
|
|||
saveFile->finalize();
|
||||
}
|
||||
|
||||
void MetaEngineConnect::saveScreenThumbnail(Common::OutSaveFile *saveFile) {
|
||||
void MetaEngine::saveScreenThumbnail(Common::OutSaveFile *saveFile) {
|
||||
// Create a thumbnail surface from the screen
|
||||
Graphics::Surface thumb;
|
||||
::createThumbnailFromScreen(&thumb);
|
||||
|
@ -182,7 +182,7 @@ void MetaEngineConnect::saveScreenThumbnail(Common::OutSaveFile *saveFile) {
|
|||
thumb.free();
|
||||
}
|
||||
|
||||
void MetaEngineConnect::parseSavegameHeader(ExtendedSavegameHeader *header, SaveStateDescriptor *desc) {
|
||||
void MetaEngine::parseSavegameHeader(ExtendedSavegameHeader *header, SaveStateDescriptor *desc) {
|
||||
int day = (header->date >> 24) & 0xFF;
|
||||
int month = (header->date >> 16) & 0xFF;
|
||||
int year = header->date & 0xFFFF;
|
||||
|
@ -195,14 +195,14 @@ void MetaEngineConnect::parseSavegameHeader(ExtendedSavegameHeader *header, Save
|
|||
desc->setDescription(header->description);
|
||||
}
|
||||
|
||||
void MetaEngineConnect::fillDummyHeader(ExtendedSavegameHeader *header) {
|
||||
void MetaEngine::fillDummyHeader(ExtendedSavegameHeader *header) {
|
||||
// This is wrong header, perhaps it is original savegame. Thus fill out dummy values
|
||||
header->date = (20 << 24) | (9 << 16) | 2016;
|
||||
header->time = (9 << 8) | 56;
|
||||
header->playtime = 0;
|
||||
}
|
||||
|
||||
WARN_UNUSED_RESULT bool MetaEngineConnect::readSavegameHeader(Common::InSaveFile *in, ExtendedSavegameHeader *header, bool skipThumbnail) {
|
||||
WARN_UNUSED_RESULT bool MetaEngine::readSavegameHeader(Common::InSaveFile *in, ExtendedSavegameHeader *header, bool skipThumbnail) {
|
||||
uint oldPos = in->pos();
|
||||
|
||||
in->seek(-4, SEEK_END);
|
||||
|
@ -264,7 +264,7 @@ WARN_UNUSED_RESULT bool MetaEngineConnect::readSavegameHeader(Common::InSaveFile
|
|||
// MetaEngineConnect default implementations
|
||||
//////////////////////////////////////////////
|
||||
|
||||
SaveStateList MetaEngineConnect::listSaves(const char *target) const {
|
||||
SaveStateList MetaEngine::listSaves(const char *target) const {
|
||||
if (!hasFeature(kSavesUseExtendedFormat))
|
||||
return SaveStateList();
|
||||
|
||||
|
@ -305,7 +305,7 @@ SaveStateList MetaEngineConnect::listSaves(const char *target) const {
|
|||
return saveList;
|
||||
}
|
||||
|
||||
SaveStateList MetaEngineConnect::listSaves(const char *target, bool saveMode) const {
|
||||
SaveStateList MetaEngine::listSaves(const char *target, bool saveMode) const {
|
||||
SaveStateList saveList = listSaves(target);
|
||||
int autosaveSlot = ConfMan.getInt("autosave_period") ? getAutosaveSlot() : -1;
|
||||
if (!saveMode || autosaveSlot == -1)
|
||||
|
@ -334,7 +334,7 @@ SaveStateList MetaEngineConnect::listSaves(const char *target, bool saveMode) co
|
|||
return saveList;
|
||||
}
|
||||
|
||||
void MetaEngine::registerDefaultSettings(const Common::String &) const {
|
||||
void MetaEngineStatic::registerDefaultSettings(const Common::String &) const {
|
||||
// Note that as we don't pass the target to getExtraGuiOptions
|
||||
// we get all the options, even those not relevant for the current
|
||||
// game. This is necessary because some engines unconditionally
|
||||
|
@ -345,7 +345,7 @@ void MetaEngine::registerDefaultSettings(const Common::String &) const {
|
|||
}
|
||||
}
|
||||
|
||||
GUI::OptionsContainerWidget *MetaEngine::buildEngineOptionsWidgetStatic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
GUI::OptionsContainerWidget *MetaEngineStatic::buildEngineOptionsWidgetStatic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
const ExtraGuiOptions engineOptions = getExtraGuiOptions(target);
|
||||
if (engineOptions.empty()) {
|
||||
return nullptr;
|
||||
|
@ -354,7 +354,7 @@ GUI::OptionsContainerWidget *MetaEngine::buildEngineOptionsWidgetStatic(GUI::Gui
|
|||
return new GUI::ExtraGuiOptionsWidget(boss, name, target, engineOptions);
|
||||
}
|
||||
|
||||
GUI::OptionsContainerWidget *MetaEngineConnect::buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
GUI::OptionsContainerWidget *MetaEngine::buildEngineOptionsWidgetDynamic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
const ExtraGuiOptions engineOptions = getExtraGuiOptions(target);
|
||||
if (engineOptions.empty()) {
|
||||
return nullptr;
|
||||
|
@ -363,14 +363,14 @@ GUI::OptionsContainerWidget *MetaEngineConnect::buildEngineOptionsWidgetDynamic(
|
|||
return new GUI::ExtraGuiOptionsWidget(boss, name, target, engineOptions);
|
||||
}
|
||||
|
||||
void MetaEngineConnect::removeSaveState(const char *target, int slot) const {
|
||||
void MetaEngine::removeSaveState(const char *target, int slot) const {
|
||||
if (!hasFeature(kSavesUseExtendedFormat))
|
||||
return;
|
||||
|
||||
g_system->getSavefileManager()->removeSavefile(getSavegameFile(slot, target));
|
||||
}
|
||||
|
||||
SaveStateDescriptor MetaEngineConnect::querySaveMetaInfos(const char *target, int slot) const {
|
||||
SaveStateDescriptor MetaEngine::querySaveMetaInfos(const char *target, int slot) const {
|
||||
if (!hasFeature(kSavesUseExtendedFormat))
|
||||
return SaveStateDescriptor();
|
||||
|
||||
|
|
|
@ -102,9 +102,9 @@ struct ExtendedSavegameHeader {
|
|||
* and other useful functionality. To instantiate actual Engine objects,
|
||||
* See the class MetaEngineConnect below.
|
||||
*/
|
||||
class MetaEngine : public PluginObject {
|
||||
class MetaEngineStatic : public PluginObject {
|
||||
public:
|
||||
virtual ~MetaEngine() {}
|
||||
virtual ~MetaEngineStatic() {}
|
||||
|
||||
/** Get the engine ID */
|
||||
virtual const char *getEngineId() const = 0;
|
||||
|
@ -178,14 +178,14 @@ public:
|
|||
* Since engine plugins can be used a external runtime libraries, these can live and build inside
|
||||
* the engine, while a MetaEngine will always build into the executable to be able to detect code.
|
||||
*/
|
||||
class MetaEngineConnect : public PluginObject {
|
||||
class MetaEngine : public PluginObject {
|
||||
private:
|
||||
/**
|
||||
* Converts the current screen contents to a thumbnail, and saves it
|
||||
*/
|
||||
static void saveScreenThumbnail(Common::OutSaveFile *saveFile);
|
||||
public:
|
||||
virtual ~MetaEngineConnect() {}
|
||||
virtual ~MetaEngine() {}
|
||||
|
||||
/**
|
||||
* Name of the engine plugin.
|
||||
|
|
|
@ -127,7 +127,7 @@ AboutDialog::AboutDialog()
|
|||
addLine(str);
|
||||
|
||||
str = "C2";
|
||||
str += (*iter)->get<MetaEngine>().getOriginalCopyright();
|
||||
str += (*iter)->get<MetaEngineStatic>().getOriginalCopyright();
|
||||
addLine(str);
|
||||
|
||||
//addLine("");
|
||||
|
|
|
@ -185,7 +185,7 @@ EditGameDialog::EditGameDialog(const String &domain)
|
|||
if (metaEnginePlugin) {
|
||||
int tabId = tab->addTab(_("Engine"), "GameOptions_Engine");
|
||||
|
||||
const MetaEngine &metaEngine = metaEnginePlugin->get<MetaEngine>();
|
||||
const MetaEngineStatic &metaEngine = metaEnginePlugin->get<MetaEngineStatic>();
|
||||
metaEngine.registerDefaultSettings(_domain);
|
||||
_engineOptions = metaEngine.buildEngineOptionsWidgetStatic(tab, "GameOptions_Engine.Container", _domain);
|
||||
|
||||
|
@ -232,7 +232,7 @@ EditGameDialog::EditGameDialog(const String &domain)
|
|||
//
|
||||
Common::KeymapArray keymaps;
|
||||
if (enginePlugin) {
|
||||
keymaps = enginePlugin->get<MetaEngineConnect>().initKeymaps(domain.c_str());
|
||||
keymaps = enginePlugin->get<MetaEngine>().initKeymaps(domain.c_str());
|
||||
}
|
||||
|
||||
if (!keymaps.empty()) {
|
||||
|
@ -340,7 +340,7 @@ EditGameDialog::EditGameDialog(const String &domain)
|
|||
// 9) The Achievements tab
|
||||
//
|
||||
if (enginePlugin) {
|
||||
const MetaEngineConnect &metaEngineConnect = enginePlugin->get<MetaEngineConnect>();
|
||||
const MetaEngine &metaEngineConnect = enginePlugin->get<MetaEngine>();
|
||||
Common::AchievementsInfo achievementsInfo = metaEngineConnect.getAchievementsInfo(domain);
|
||||
if (achievementsInfo.descriptions.size() > 0) {
|
||||
tab->addTab(_("Achievements"), "GameOptions_Achievements");
|
||||
|
|
|
@ -479,9 +479,9 @@ void LauncherDialog::loadGame(int item) {
|
|||
}
|
||||
|
||||
if (enginePlugin) {
|
||||
const MetaEngineConnect &metaEngineConnect = enginePlugin->get<MetaEngineConnect>();
|
||||
if (metaEngineConnect.hasFeature(MetaEngineConnect::kSupportsListSaves) &&
|
||||
metaEngineConnect.hasFeature(MetaEngineConnect::kSupportsLoadingDuringStartup)) {
|
||||
const MetaEngine &metaEngineConnect = enginePlugin->get<MetaEngine>();
|
||||
if (metaEngineConnect.hasFeature(MetaEngine::kSupportsListSaves) &&
|
||||
metaEngineConnect.hasFeature(MetaEngine::kSupportsLoadingDuringStartup)) {
|
||||
int slot = _loadDialog->runModalWithPluginAndTarget(enginePlugin, target);
|
||||
if (slot >= 0) {
|
||||
ConfMan.setActiveDomain(_domains[item]);
|
||||
|
|
|
@ -103,7 +103,7 @@ void SaveLoadCloudSyncProgressDialog::handleTickle() {
|
|||
#endif
|
||||
|
||||
#ifndef DISABLE_SAVELOADCHOOSER_GRID
|
||||
SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngineConnect &metaEngine) {
|
||||
SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine) {
|
||||
const Common::String &userConfig = ConfMan.get("gui_saveload_chooser", Common::ConfigManager::kApplicationDomain);
|
||||
|
||||
// Check (and update if necessary) the theme config here. This catches
|
||||
|
@ -114,8 +114,8 @@ SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngineConnect &metaEngi
|
|||
g_gui.checkScreenChange();
|
||||
|
||||
if (g_gui.getWidth() >= 640 && g_gui.getHeight() >= 400
|
||||
&& metaEngine.hasFeature(MetaEngineConnect::kSavesSupportMetaInfo)
|
||||
&& metaEngine.hasFeature(MetaEngineConnect::kSavesSupportThumbnail)
|
||||
&& metaEngine.hasFeature(MetaEngine::kSavesSupportMetaInfo)
|
||||
&& metaEngine.hasFeature(MetaEngine::kSavesSupportThumbnail)
|
||||
&& userConfig.equalsIgnoreCase("grid")) {
|
||||
// In case we are 640x400 or higher, this dialog is not in save mode,
|
||||
// the user requested the grid dialog and the engines supports it we
|
||||
|
@ -182,14 +182,14 @@ void SaveLoadChooserDialog::close() {
|
|||
Dialog::close();
|
||||
}
|
||||
|
||||
int SaveLoadChooserDialog::run(const Common::String &target, const MetaEngineConnect *metaEngine) {
|
||||
int SaveLoadChooserDialog::run(const Common::String &target, const MetaEngine *metaEngine) {
|
||||
_metaEngine = metaEngine;
|
||||
_target = target;
|
||||
_delSupport = _metaEngine->hasFeature(MetaEngineConnect::kSupportsDeleteSave);
|
||||
_metaInfoSupport = _metaEngine->hasFeature(MetaEngineConnect::kSavesSupportMetaInfo);
|
||||
_thumbnailSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngineConnect::kSavesSupportThumbnail);
|
||||
_saveDateSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngineConnect::kSavesSupportCreationDate);
|
||||
_playTimeSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngineConnect::kSavesSupportPlayTime);
|
||||
_delSupport = _metaEngine->hasFeature(MetaEngine::kSupportsDeleteSave);
|
||||
_metaInfoSupport = _metaEngine->hasFeature(MetaEngine::kSavesSupportMetaInfo);
|
||||
_thumbnailSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngine::kSavesSupportThumbnail);
|
||||
_saveDateSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngine::kSavesSupportCreationDate);
|
||||
_playTimeSupport = _metaInfoSupport && _metaEngine->hasFeature(MetaEngine::kSavesSupportPlayTime);
|
||||
|
||||
return runIntern();
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ void SaveLoadChooserDialog::handleTickle() {
|
|||
Common::Array<Common::String> files = CloudMan.getSyncingFiles();
|
||||
if (!files.empty()) {
|
||||
{
|
||||
SaveLoadCloudSyncProgressDialog dialog(_metaEngine ? _metaEngine->hasFeature(MetaEngineConnect::kSimpleSavesNames) : false);
|
||||
SaveLoadCloudSyncProgressDialog dialog(_metaEngine ? _metaEngine->hasFeature(MetaEngine::kSimpleSavesNames) : false);
|
||||
CloudMan.setSyncTarget(&dialog);
|
||||
int result = dialog.runModal();
|
||||
if (result == kCancelSyncCmd) {
|
||||
|
@ -302,7 +302,7 @@ void SaveLoadChooserDialog::listSaves() {
|
|||
|
||||
#if defined(USE_CLOUD) && defined(USE_LIBCURL)
|
||||
//if there is Cloud support, add currently synced files as "locked" saves in the list
|
||||
if (_metaEngine->hasFeature(MetaEngineConnect::kSimpleSavesNames)) {
|
||||
if (_metaEngine->hasFeature(MetaEngine::kSimpleSavesNames)) {
|
||||
Common::String pattern = _target + ".###";
|
||||
Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing
|
||||
for (uint32 i = 0; i < files.size(); ++i) {
|
||||
|
|
|
@ -65,7 +65,7 @@ enum SaveLoadChooserType {
|
|||
kSaveLoadDialogGrid = 1
|
||||
};
|
||||
|
||||
SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngineConnect &metaEngine);
|
||||
SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine);
|
||||
#endif // !DISABLE_SAVELOADCHOOSER_GRID
|
||||
|
||||
class SaveLoadChooserDialog : protected Dialog {
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
virtual SaveLoadChooserType getType() const = 0;
|
||||
#endif // !DISABLE_SAVELOADCHOOSER_GRID
|
||||
|
||||
int run(const Common::String &target, const MetaEngineConnect *metaEngine);
|
||||
int run(const Common::String &target, const MetaEngine *metaEngine);
|
||||
virtual const Common::U32String &getResultString() const = 0;
|
||||
|
||||
protected:
|
||||
|
@ -111,7 +111,7 @@ protected:
|
|||
virtual void listSaves();
|
||||
|
||||
const bool _saveMode;
|
||||
const MetaEngineConnect *_metaEngine;
|
||||
const MetaEngine *_metaEngine;
|
||||
bool _delSupport;
|
||||
bool _metaInfoSupport;
|
||||
bool _thumbnailSupport;
|
||||
|
|
|
@ -39,7 +39,7 @@ SaveLoadChooser::~SaveLoadChooser() {
|
|||
_impl = nullptr;
|
||||
}
|
||||
|
||||
void SaveLoadChooser::selectChooser(const MetaEngineConnect &engine) {
|
||||
void SaveLoadChooser::selectChooser(const MetaEngine &engine) {
|
||||
#ifndef DISABLE_SAVELOADCHOOSER_GRID
|
||||
const SaveLoadChooserType requestedType = getRequestedSaveLoadDialog(engine);
|
||||
if (!_impl || _impl->getType() != requestedType) {
|
||||
|
@ -94,7 +94,7 @@ int SaveLoadChooser::runModalWithCurrentTarget() {
|
|||
int SaveLoadChooser::runModalWithPluginAndTarget(const Plugin *plugin, const String &target) {
|
||||
assert(plugin->getType() == PLUGIN_TYPE_ENGINE);
|
||||
|
||||
selectChooser(plugin->get<MetaEngineConnect>());
|
||||
selectChooser(plugin->get<MetaEngine>());
|
||||
if (!_impl)
|
||||
return -1;
|
||||
|
||||
|
@ -109,10 +109,10 @@ int SaveLoadChooser::runModalWithPluginAndTarget(const Plugin *plugin, const Str
|
|||
|
||||
int ret;
|
||||
do {
|
||||
ret = _impl->run(target, &plugin->get<MetaEngineConnect>());
|
||||
ret = _impl->run(target, &plugin->get<MetaEngine>());
|
||||
#ifndef DISABLE_SAVELOADCHOOSER_GRID
|
||||
if (ret == kSwitchSaveLoadDialog) {
|
||||
selectChooser(plugin->get<MetaEngineConnect>());
|
||||
selectChooser(plugin->get<MetaEngine>());
|
||||
}
|
||||
#endif // !DISABLE_SAVELOADCHOOSER_GRID
|
||||
} while (ret < -1);
|
||||
|
|
|
@ -40,7 +40,7 @@ protected:
|
|||
const U32String _buttonLabel;
|
||||
const bool _saveMode;
|
||||
|
||||
void selectChooser(const MetaEngineConnect &engine);
|
||||
void selectChooser(const MetaEngine &engine);
|
||||
public:
|
||||
SaveLoadChooser(const U32String &title, const U32String &buttonLabel, bool saveMode);
|
||||
~SaveLoadChooser();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue