Added --list-saves support for PARALLACTION, and -x support for NipponSafes

svn-id: r33292
This commit is contained in:
Christopher Page 2008-07-25 21:24:09 +00:00
parent dac805c281
commit cbe0af1c19
4 changed files with 46 additions and 1 deletions

View file

@ -212,6 +212,7 @@ public:
}
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
virtual SaveStateList listSaves(const char *target) const;
};
bool ParallactionMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
@ -233,6 +234,34 @@ bool ParallactionMetaEngine::createInstance(OSystem *syst, Engine **engine, cons
return res;
}
SaveStateList ParallactionMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringList filenames;
char saveDesc[200];
Common::String pattern = target;
pattern += ".0??";
filenames = saveFileMan->listSavefiles(pattern.c_str());
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 2 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 2);
if (slotNum >= 0 && slotNum <= 99) {
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
if (in) {
in->readLine(saveDesc, 199);
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file));
delete in;
}
}
}
return saveList;
}
#if PLUGIN_ENABLED_DYNAMIC(PARALLACTION)
REGISTER_PLUGIN_DYNAMIC(PARALLACTION, PLUGIN_TYPE_ENGINE, ParallactionMetaEngine);
#else

View file

@ -114,6 +114,7 @@ int Parallaction::init() {
_location._hasSound = false;
_baseTime = 0;
_numLocations = 0;
_gameToLoad = -1;
_location._startPosition.x = -1000;
_location._startPosition.y = -1000;
_location._startFrame = 0;

View file

@ -345,6 +345,7 @@ protected: // data
uint32 _baseTime;
char _characterName1[50]; // only used in changeCharacter
int _gameToLoad;
Common::String _saveFileName;

View file

@ -240,7 +240,21 @@ int Parallaction_ns::go() {
_globalTable = _disk->loadTable("global");
guiStart();
// If requested, load a savegame instead of showing the intro
if (ConfMan.hasKey("save_slot")) {
_gameToLoad = ConfMan.getInt("save_slot");
if (_gameToLoad < 0 || _gameToLoad > 99)
_gameToLoad = -1;
}
if (_gameToLoad == -1) {
guiStart();
} else {
_disk->selectArchive((getFeatures() & GF_DEMO) ? "disk0" : "disk1");
_language = guiChooseLanguage();
_disk->setLanguage(_language);
doLoadGame(_gameToLoad);
}
if (quit())
return _eventMan->shouldRTL();