Skip to content

Commit

Permalink
DREAMWEB: added savefiles enumeration
Browse files Browse the repository at this point in the history
  • Loading branch information
whoozle committed Jun 15, 2011
1 parent 14121a6 commit dc1c1d4
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions engines/dreamweb/detection.cpp
Expand Up @@ -25,11 +25,13 @@

#include "base/plugins.h"

#include "engines/advancedDetector.h"
#include "common/algorithm.h"
#include "common/system.h"

#include "dreamweb/dreamweb.h"

#include "engines/advancedDetector.h"

namespace DreamWeb {

struct DreamWebGameDescription {
Expand Down Expand Up @@ -70,7 +72,14 @@ class DreamWebMetaEngine : public AdvancedMetaEngine {
};

bool DreamWebMetaEngine::hasFeature(MetaEngineFeature f) const {
return false;
switch(f) {
case kSupportsListSaves:
case kSupportsLoadingDuringStartup:
case kSupportsDeleteSave:
return true;
default:
return false;
}
}

bool DreamWeb::DreamWebEngine::hasFeature(EngineFeature f) const {
Expand All @@ -86,13 +95,29 @@ bool DreamWebMetaEngine::createInstance(OSystem *syst, Engine **engine, const AD
}

SaveStateList DreamWebMetaEngine::listSaves(const char *target) const {
//Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray files = saveFileMan->listSavefiles("DREAMWEB.D??");
Common::sort(files.begin(), files.end());

SaveStateList saveList;
for(uint i = 0; i < files.size(); ++i) {
const Common::String &file = files[i];
Common::InSaveFile *stream = saveFileMan->openForLoading(file);
if (!stream)
error("cannot open save file %s", file.c_str());
char name[13] = {};
stream->seek(0x61);
stream->read(name, sizeof(name) - 1);
delete stream;

SaveStateDescriptor sd(i, name);
saveList.push_back(sd);
}

return saveList;
}

int DreamWebMetaEngine::getMaximumSaveSlot() const { return 99; }
int DreamWebMetaEngine::getMaximumSaveSlot() const { return 6; }

void DreamWebMetaEngine::removeSaveState(const char *target, int slot) const {
}
Expand Down

0 comments on commit dc1c1d4

Please sign in to comment.