From 59942d9a41cf7d43b95e9775aca66c241884b516 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 May 2012 00:05:48 +1000 Subject: TONY: Work on enabling GMM saving and loading --- engines/tony/detection.cpp | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'engines/tony/detection.cpp') diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp index 944f717f26..5b1092d2c0 100644 --- a/engines/tony/detection.cpp +++ b/engines/tony/detection.cpp @@ -25,6 +25,7 @@ #include "engines/advancedDetector.h" #include "common/system.h" +#include "graphics/surface.h" #include "tony/tony.h" #include "tony/game.h" @@ -75,18 +76,23 @@ public: virtual SaveStateList listSaves(const char *target) const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; + SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int slot) const; }; bool TonyMetaEngine::hasFeature(MetaEngineFeature f) const { return (f == kSupportsListSaves) || -// (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave); + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail); } bool Tony::TonyEngine::hasFeature(EngineFeature f) const { return - (f == kSupportsRTL); + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); } bool TonyMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { @@ -136,6 +142,30 @@ void TonyMetaEngine::removeSaveState(const char *target, int slot) const { g_system->getSavefileManager()->removeSavefile(filename); } +SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + Tony::RMString saveName; + byte difficulty; + + Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); + Graphics::Surface *thumbnail = new Graphics::Surface(); + thumbnail->create(160, 120, pixelFormat); + + if (Tony::RMOptionScreen::LoadThumbnailFromSaveState(slot, (byte *)thumbnail->pixels, saveName, difficulty)) { + // Create the return descriptor + SaveStateDescriptor desc(slot, (const char *)saveName); + desc.setDeletableFlag(true); + desc.setWriteProtectedFlag(false); + desc.setThumbnail(thumbnail); + + return desc; + } + + thumbnail->free(); + delete thumbnail; + return SaveStateDescriptor(); +} + + #if PLUGIN_ENABLED_DYNAMIC(TONY) REGISTER_PLUGIN_DYNAMIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine); #else -- cgit v1.2.3