mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-20 00:41:12 +00:00
TONY: Implemented list-saves and delete save functionality
This commit is contained in:
parent
47ddb2ff33
commit
d5b80688e7
@ -27,6 +27,7 @@
|
||||
#include "common/system.h"
|
||||
|
||||
#include "tony/tony.h"
|
||||
#include "tony/game.h"
|
||||
|
||||
|
||||
namespace Tony {
|
||||
@ -71,10 +72,16 @@ public:
|
||||
|
||||
virtual bool hasFeature(MetaEngineFeature f) const;
|
||||
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
|
||||
virtual SaveStateList listSaves(const char *target) const;
|
||||
virtual int getMaximumSaveSlot() const;
|
||||
virtual void removeSaveState(const char *target, int slot) const;
|
||||
};
|
||||
|
||||
bool TonyMetaEngine::hasFeature(MetaEngineFeature f) const {
|
||||
return false;
|
||||
return
|
||||
(f == kSupportsListSaves) ||
|
||||
// (f == kSupportsLoadingDuringStartup) ||
|
||||
(f == kSupportsDeleteSave);
|
||||
}
|
||||
|
||||
bool Tony::TonyEngine::hasFeature(EngineFeature f) const {
|
||||
@ -90,6 +97,43 @@ bool TonyMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGame
|
||||
return gd != 0;
|
||||
}
|
||||
|
||||
SaveStateList TonyMetaEngine::listSaves(const char *target) const {
|
||||
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
|
||||
Common::StringArray filenames;
|
||||
Common::String saveDesc;
|
||||
Common::String pattern = "tony.0??";
|
||||
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
|
||||
// Obtain the last 3 digits of the filename, since they correspond to the save slot
|
||||
int slotNum = atoi(file->c_str() + file->size() - 3);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 999) {
|
||||
byte thumbnailData[160 * 120 * 2];
|
||||
Tony::RMString saveName;
|
||||
byte difficulty;
|
||||
|
||||
if (Tony::RMOptionScreen::LoadThumbnailFromSaveState(slotNum, thumbnailData, saveName, difficulty)) {
|
||||
// Add the save name to the savegame list
|
||||
saveList.push_back(SaveStateDescriptor(slotNum, (const char *)saveName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return saveList;
|
||||
}
|
||||
|
||||
int TonyMetaEngine::getMaximumSaveSlot() const { return 99; }
|
||||
|
||||
void TonyMetaEngine::removeSaveState(const char *target, int slot) const {
|
||||
Common::String filename = Tony::TonyEngine::GetSaveStateFileName(slot);
|
||||
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
#if PLUGIN_ENABLED_DYNAMIC(TONY)
|
||||
REGISTER_PLUGIN_DYNAMIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine);
|
||||
#else
|
||||
|
@ -263,6 +263,9 @@ public:
|
||||
// Polling per l'option screen
|
||||
void DoFrame(CORO_PARAM, RMInput *m_input);
|
||||
|
||||
// Retrieves a savegame's thumbnail, description, and difficulty level
|
||||
static bool LoadThumbnailFromSaveState(int numState, byte *lpDestBuf, RMString &name, byte &diff);
|
||||
|
||||
protected:
|
||||
|
||||
// Inizializza tutto per il nuovo stato
|
||||
@ -274,8 +277,6 @@ protected:
|
||||
void RefreshAll(CORO_PARAM);
|
||||
void RefreshThumbnails(void);
|
||||
|
||||
// Carica lo screenshot per il salvataggio
|
||||
bool LoadThumbnailFromSaveState(int numState, byte *lpDestBuf, RMString &name, byte &diff);
|
||||
};
|
||||
|
||||
} // End of namespace Tony
|
||||
|
@ -198,7 +198,7 @@ public:
|
||||
void AutoSave(CORO_PARAM);
|
||||
void SaveState(int n, const char *name);
|
||||
void LoadState(CORO_PARAM, int n);
|
||||
Common::String GetSaveStateFileName(int n);
|
||||
static Common::String GetSaveStateFileName(int n);
|
||||
|
||||
// Prende il thumbnail
|
||||
void GrabThumbnail(void);
|
||||
|
Loading…
Reference in New Issue
Block a user