GROOVIE: Split detection features & adapt to new plugins.

This commit is contained in:
aryanrawlani28 2020-08-06 22:40:34 +05:30 committed by Eugene Sandulenko
parent 854a499307
commit 563cef1071
7 changed files with 138 additions and 67 deletions

2
configure vendored
View File

@ -6163,7 +6163,7 @@ done
declare -a static_detect_engines=("PLUMBERS" "AGI" "SCUMM" "SKY" "DREAMWEB" "DRASCULA" "LURE"
"SWORD1" "SWORD2" "SWORD25" "ADL" "QUEEN" "CGE" "CGE2" "ACCESS"
"ZVISION" "AGOS" "GOB" "COMPOSER" "DM" "DRACI" "DRAGONS" "GNAP"
"GRIFFON")
"GRIFFON" "GROOVIE")
detectId="_DETECTION"
echo "Creating engines/plugins_table.h"

View File

@ -20,13 +20,12 @@
*
*/
#include "groovie/groovie.h"
#include "groovie/detection.h"
#include "groovie/saveload.h"
#include "common/system.h"
#include "common/translation.h"
#include "engines/advancedDetector.h"
#include "groovie/detection.h"
namespace Groovie {
#define GAMEOPTION_T7G_FAST_MOVIE_SPEED GUIO_GAMEOPTIONS1
@ -358,62 +357,8 @@ public:
const char *getOriginalCopyright() const override {
return "Groovie Engine (C) 1990-1996 Trilobyte";
}
bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const override;
bool hasFeature(MetaEngineFeature f) const override;
SaveStateList listSaves(const char *target) const override;
int getMaximumSaveSlot() const override;
void removeSaveState(const char *target, int slot) const override;
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
};
bool GroovieMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
if (gd) {
*engine = new GroovieEngine(syst, (const GroovieGameDescription *)gd);
}
return gd != 0;
}
bool GroovieMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves) ||
(f == kSupportsLoadingDuringStartup) ||
(f == kSupportsDeleteSave) ||
(f == kSavesSupportMetaInfo);
}
SaveStateList GroovieMetaEngine::listSaves(const char *target) const {
return SaveLoad::listValidSaves(target);
}
int GroovieMetaEngine::getMaximumSaveSlot() const {
return SaveLoad::getMaximumSlot();
}
void GroovieMetaEngine::removeSaveState(const char *target, int slot) const {
if (!SaveLoad::isSlotValid(slot)) {
// Invalid slot, do nothing
return;
}
Common::String filename = SaveLoad::getSlotSaveName(target, slot);
g_system->getSavefileManager()->removeSavefile(filename);
}
SaveStateDescriptor GroovieMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
SaveStateDescriptor desc;
Common::InSaveFile *savefile = SaveLoad::openForLoading(target, slot, &desc);
delete savefile;
return desc;
}
} // End of namespace Groovie
#if PLUGIN_ENABLED_DYNAMIC(GROOVIE)
REGISTER_PLUGIN_DYNAMIC(GROOVIE, PLUGIN_TYPE_ENGINE, Groovie::GroovieMetaEngine);
#else
REGISTER_PLUGIN_STATIC(GROOVIE, PLUGIN_TYPE_ENGINE, Groovie::GroovieMetaEngine);
#endif
REGISTER_PLUGIN_STATIC(GROOVIE_DETECTION, PLUGIN_TYPE_METAENGINE, Groovie::GroovieMetaEngine);

View File

@ -24,7 +24,7 @@
#define GROOVIE_DETECTION_H
#include "engines/advancedDetector.h"
#include "groovie/script.h" // for EngineVersion
#include "groovie/detection_enums.h" // for EngineVersion
namespace Groovie {

View 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 Groovie {
enum EngineVersion {
kGroovieT7G,
kGroovieV2
};
} // End of namespace Groovie

View File

@ -0,0 +1,97 @@
/* 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 "groovie/groovie.h"
#include "groovie/saveload.h"
#include "common/system.h"
#include "common/translation.h"
#include "engines/advancedDetector.h"
#include "groovie/detection.h"
namespace Groovie {
class GroovieMetaEngineConnect : public AdvancedMetaEngineConnect {
public:
const char *getName() const override {
return "groovie";
}
bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const override;
bool hasFeature(MetaEngineFeature f) const override;
SaveStateList listSaves(const char *target) const override;
int getMaximumSaveSlot() const override;
void removeSaveState(const char *target, int slot) const override;
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
};
bool GroovieMetaEngineConnect::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
if (gd) {
*engine = new GroovieEngine(syst, (const GroovieGameDescription *)gd);
}
return gd != 0;
}
bool GroovieMetaEngineConnect::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves) ||
(f == kSupportsLoadingDuringStartup) ||
(f == kSupportsDeleteSave) ||
(f == kSavesSupportMetaInfo);
}
SaveStateList GroovieMetaEngineConnect::listSaves(const char *target) const {
return SaveLoad::listValidSaves(target);
}
int GroovieMetaEngineConnect::getMaximumSaveSlot() const {
return SaveLoad::getMaximumSlot();
}
void GroovieMetaEngineConnect::removeSaveState(const char *target, int slot) const {
if (!SaveLoad::isSlotValid(slot)) {
// Invalid slot, do nothing
return;
}
Common::String filename = SaveLoad::getSlotSaveName(target, slot);
g_system->getSavefileManager()->removeSavefile(filename);
}
SaveStateDescriptor GroovieMetaEngineConnect::querySaveMetaInfos(const char *target, int slot) const {
SaveStateDescriptor desc;
Common::InSaveFile *savefile = SaveLoad::openForLoading(target, slot, &desc);
delete savefile;
return desc;
}
} // End of namespace Groovie
#if PLUGIN_ENABLED_DYNAMIC(GROOVIE)
REGISTER_PLUGIN_DYNAMIC(GROOVIE, PLUGIN_TYPE_ENGINE, Groovie::GroovieMetaEngineConnect);
#else
REGISTER_PLUGIN_STATIC(GROOVIE, PLUGIN_TYPE_ENGINE, Groovie::GroovieMetaEngineConnect);
#endif

View File

@ -4,11 +4,11 @@ MODULE_OBJS := \
cell.o \
cursor.o \
debug.o \
detection.o \
font.o \
graphics.o \
groovie.o \
lzss.o \
metaengine.o \
music.o \
player.o \
resource.o \
@ -29,3 +29,6 @@ endif
# Include common rules
include $(srcdir)/rules.mk
# Detection objects
DETECT_OBJS += $(MODULE)/detection.o

View File

@ -24,6 +24,7 @@
#define GROOVIE_SCRIPT_H
#include "groovie/groovie.h"
#include "groovie/detection_enums.h"
#include "common/random.h"
#include "common/rect.h"
@ -38,11 +39,6 @@ struct Surface;
namespace Groovie {
enum EngineVersion {
kGroovieT7G,
kGroovieV2
};
class CellGame;
class Debugger;