Skip to content

Commit

Permalink
DS, N64: Fix SaveFileManagers
Browse files Browse the repository at this point in the history
Added updateSavefilesList() and openRawFile() stubs. It should build
fine now, I guess.
  • Loading branch information
Tkachov committed Aug 31, 2016
1 parent 153f06b commit 9d6ae2a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backends/platform/ds/arm9/source/gbampsave.cpp
Expand Up @@ -45,6 +45,17 @@ static Common::String getSavePath() {
// GBAMP Save File Manager
//////////////////////////

void GBAMPSaveFileManager::updateSavefilesList(Common::StringArray &lockedFiles) {
// TODO: implement this
// in this method manager should remember lockedFiles
// these files must not be opened for loading or saving, or listed by listSavefiles()
}

Common::InSaveFile *GBAMPSaveFileManager::openRawFile(const Common::String &filename) {
// TODO: make sure it returns raw file, not uncompressed save contents
return openForLoading(filename);
}

Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &filename, bool compress) {
Common::String fileSpec = getSavePath();
if (fileSpec.lastChar() != '/')
Expand Down
3 changes: 3 additions & 0 deletions backends/platform/ds/arm9/source/gbampsave.h
Expand Up @@ -27,6 +27,9 @@

class GBAMPSaveFileManager : public Common::SaveFileManager {
public:
virtual void updateSavefilesList(Common::StringArray &lockedFiles);
virtual Common::InSaveFile *openRawFile(const Common::String &filename);

virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true);
virtual Common::InSaveFile *openForLoading(const Common::String &filename);

Expand Down
15 changes: 15 additions & 0 deletions backends/platform/n64/framfs_save_manager.h
Expand Up @@ -102,6 +102,21 @@ class OutFRAMSave : public Common::WriteStream {

class FRAMSaveManager : public Common::SaveFileManager {
public:
virtual void updateSavefilesList(Common::StringArray &lockedFiles) {
// this method is used to lock saves while cloud syncing
// as there is no network on N64, this method wouldn't be used
// thus it's not implemtented
}

virtual Common::InSaveFile *openRawFile(const Common::String &filename) {
InFRAMSave *s = new InFRAMSave();
if (s->readSaveGame(filename.c_str())) {
return s;
} else {
delete s;
return 0;
}
}

virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) {
OutFRAMSave *s = new OutFRAMSave(filename.c_str());
Expand Down
15 changes: 15 additions & 0 deletions backends/platform/n64/pakfs_save_manager.h
Expand Up @@ -104,6 +104,21 @@ class OutPAKSave : public Common::WriteStream {

class PAKSaveManager : public Common::SaveFileManager {
public:
virtual void updateSavefilesList(Common::StringArray &lockedFiles) {
// this method is used to lock saves while cloud syncing
// as there is no network on N64, this method wouldn't be used
// thus it's not implemtented
}

virtual Common::InSaveFile *openRawFile(const Common::String &filename) {
InPAKSave *s = new InPAKSave();
if (s->readSaveGame(filename.c_str())) {
return s;
} else {
delete s;
return NULL;
}
}

virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) {
OutPAKSave *s = new OutPAKSave(filename.c_str());
Expand Down

0 comments on commit 9d6ae2a

Please sign in to comment.