[Scummvm-cvs-logs] SF.net SVN: scummvm: [30079] scummvm/trunk/backends

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Dec 30 14:05:39 CET 2007


Revision: 30079
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30079&view=rev
Author:   fingolfin
Date:     2007-12-30 05:05:38 -0800 (Sun, 30 Dec 2007)

Log Message:
-----------
The PS2, DS and PalmOS ports currently do not properly implement their SaveFileManagers -- flagging the incorrect & invalid code by making it not compile. Note: Portser should probably also fix their code in the 0.11 branch

Modified Paths:
--------------
    scummvm/trunk/backends/platform/PalmOS/Src/be_save.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/be_save.h
    scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.h
    scummvm/trunk/backends/platform/ds/arm9/source/ramsave.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/ramsave.h
    scummvm/trunk/backends/platform/ps2/savefile.cpp
    scummvm/trunk/backends/platform/ps2/savefile.h
    scummvm/trunk/backends/saves/default/default-saves.cpp
    scummvm/trunk/backends/saves/default/default-saves.h

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_save.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_save.cpp	2007-12-30 09:37:35 UTC (rev 30078)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_save.cpp	2007-12-30 13:05:38 UTC (rev 30079)
@@ -27,6 +27,13 @@
 #include "common/savefile.h"
 #include "be_save.h"
 
+Common::StringList PalmSaveFileManager::listSavefiles(const char *pattern) {
+	TODO: Implement this. If you don't understand what it should do, just ask
+	(e.g. on scummvm-devel or Fingolfin). It should be pretty simple if you
+	use Common::matchString from common/util.h and read the Doxygen docs,
+	then combine this with the old code below...
+
+/*
 void PalmSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num) {
 	FileRef fileRef;
 	// try to open the dir
@@ -65,3 +72,5 @@
 
 	VFSFileClose(fileRef);
 }
+
+}

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_save.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_save.h	2007-12-30 09:37:35 UTC (rev 30078)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_save.h	2007-12-30 13:05:38 UTC (rev 30079)
@@ -30,7 +30,7 @@
 
 class PalmSaveFileManager : public DefaultSaveFileManager {
 public:
-	void listSavefiles(const char *prefix, bool *marks, int num);
+	Common::StringList listSavefiles(const char *pattern);
 };
 
 #endif

Modified: scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.cpp	2007-12-30 09:37:35 UTC (rev 30078)
+++ scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.cpp	2007-12-30 13:05:38 UTC (rev 30079)
@@ -164,62 +164,13 @@
 	}
 }
 
-void GBAMPSaveFileManager::listSavefiles(char const* prefix, bool* marks, int num) {
-//	memset(marks, true, num * sizeof(bool));
-//	return;
-	
-	// Seems like I misunderstood what this function was supposed to do.
-	// I thought I was meant to set the marks[] array according to which
-	// saves are present on disk.
-	enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
-	char name[128];
-	char path[128];
-	
-	DS::std_cwd((char *) getSavePath());
-	consolePrintf("Save path: %s\n", getSavePath());
-	
-	int fileType = FAT_FindFirstFileLFN(name);
-	
-	for (int r = 0; r < num; r++) {
-		marks[r] = false;
-	}
-	
-	do {
-	
-		if (fileType == TYPE_FILE) {
+Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) { 
 
-			FAT_GetLongFilename(name);
-			
-			for (int r = 0; r < num; r++) {
-				char str[128];
-				
-				
-				sprintf(str, "%s%02d", prefix, r);
-				consolePrintf("%s != %s", str, name);
-				if (!stricmp(str, name)) {
-					marks[r] = true;
-					consolePrintf("Matched %d", r);
-				}
-				
-			}
-			
-		}
-	
-	} while ((fileType = FAT_FindNextFileLFN(name)));
-	
-	FAT_chdir("/");
-}
-
-Common::StringList GBAMPSaveFileManager::listSavefiles(const char *regex) { 
-
-	
-
 	enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
 	char name[256];
-
 	
 	DS::std_cwd((char *) getSavePath());
-//	consolePrintf("Save path: '%s', regex: '%s'\n", getSavePath(),regex);
+//	consolePrintf("Save path: '%s', pattern: '%s'\n", getSavePath(),pattern);
 
 	
 	int fileType = FAT_FindFirstFileLFN(name);
@@ -238,16 +189,15 @@
 			}
 			
 			
-			if (Common::matchString(name, regex)) {
+			if (Common::matchString(name, pattern)) {
 				list.push_back(name);
 			}
 		}
-	
+
 	} while ((fileType = FAT_FindNextFileLFN(name)));
 	
 	FAT_chdir("/");
 
-
 	return list;
 }	
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.h	2007-12-30 09:37:35 UTC (rev 30078)
+++ scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.h	2007-12-30 13:05:38 UTC (rev 30079)
@@ -71,10 +71,8 @@
 	virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
 	
 	virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this
-	virtual Common::StringList listSavefiles(const char *regex);
+	virtual Common::StringList listSavefiles(const char *pattern);
 	
-	void listSavefiles(const char *prefix, bool *marks, int num);
-	
 	void deleteFile(char* name);
 	void listFiles();
 };

Modified: scummvm/trunk/backends/platform/ds/arm9/source/ramsave.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/ramsave.cpp	2007-12-30 09:37:35 UTC (rev 30078)
+++ scummvm/trunk/backends/platform/ds/arm9/source/ramsave.cpp	2007-12-30 13:05:38 UTC (rev 30079)
@@ -383,6 +383,18 @@
 	flushToSaveRAM();
 }
 
+void DSSaveFileManager::removeSavefile(const char *filename) {
+	TODO: Implement this. Most likely, you just have to use the code of deleteFile?
+}
+
+
+Common::StringList DSSaveFileManager::listSavefiles(const char *pattern) {
+	TODO: Implement this. If you don't understand what it should do, just ask
+	(e.g. on scummvm-devel or Fingolfin). It should be pretty simple if you
+	use Common::matchString from common/util.h and read the Doxygen docs,
+	then combine this with the old code below...
+
+/*
 void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num) {
 	memset(marks, true, num * sizeof(bool));
 	return;
@@ -398,7 +410,10 @@
 	}
 	
 }
+*/
 
+}
+
 DSSaveFile *DSSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) {
 	
 	// Find a free save slot

Modified: scummvm/trunk/backends/platform/ds/arm9/source/ramsave.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/ramsave.h	2007-12-30 09:37:35 UTC (rev 30078)
+++ scummvm/trunk/backends/platform/ds/arm9/source/ramsave.h	2007-12-30 13:05:38 UTC (rev 30079)
@@ -123,12 +123,9 @@
 	virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
 	virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
 
-	virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this
-	virtual Common::StringList listSavefiles(const char *regex) { return Common::StringList(); }	// TODO: I don't know what this is for!
-		
+	virtual bool removeSavefile(const char *filename);
+	virtual Common::StringList listSavefiles(const char *pattern);
 	
-	void listSavefiles(const char *prefix, bool *marks, int num);
-	
 	void flushToSaveRAM();
 	
 	void addBytesFree(int size) { sramBytesFree += size; }

Modified: scummvm/trunk/backends/platform/ps2/savefile.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/savefile.cpp	2007-12-30 09:37:35 UTC (rev 30078)
+++ scummvm/trunk/backends/platform/ps2/savefile.cpp	2007-12-30 13:05:38 UTC (rev 30079)
@@ -442,6 +442,17 @@
 	return NULL;
 }
 
+void Ps2SaveFileManager::removeSavefile(const char *filename) {
+	TODO: Implement this.
+}
+
+Common::StringList Ps2SaveFileManager::listSavefiles(const char *pattern) {
+	TODO: Implement this. If you don't understand what it should do, just ask
+	(e.g. on scummvm-devel or Fingolfin). It should be pretty simple if you
+	use Common::matchString from common/util.h and read the Doxygen docs,
+	then combine this with the old code below...
+
+/*
 void Ps2SaveFileManager::listSavefiles(const char *prefix, bool *marks, int num) {
 	_screen->wantAnim(true);
 
@@ -483,7 +494,9 @@
 	}
 	_screen->wantAnim(false);
 }
+*/
 
+
 bool Ps2SaveFileManager::setupIcon(const char *dest, const char *ico, const char *descr1, const char *descr2) {
 	mcIcon icon_sys;
 	memset(&icon_sys, 0, sizeof(mcIcon));

Modified: scummvm/trunk/backends/platform/ps2/savefile.h
===================================================================
--- scummvm/trunk/backends/platform/ps2/savefile.h	2007-12-30 09:37:35 UTC (rev 30078)
+++ scummvm/trunk/backends/platform/ps2/savefile.h	2007-12-30 13:05:38 UTC (rev 30079)
@@ -40,7 +40,7 @@
 
 	virtual Common::InSaveFile *openForLoading(const char *filename);
 	virtual Common::OutSaveFile *openForSaving(const char *filename);
-	virtual void listSavefiles(const char *prefix, bool *marks, int num);
+	virtual Common::StringList listSavefiles(const char *pattern);
 
 	void writeSaveNonblocking(char *name, void *buf, uint32 size);
 	void saveThread(void);

Modified: scummvm/trunk/backends/saves/default/default-saves.cpp
===================================================================
--- scummvm/trunk/backends/saves/default/default-saves.cpp	2007-12-30 09:37:35 UTC (rev 30078)
+++ scummvm/trunk/backends/saves/default/default-saves.cpp	2007-12-30 13:05:38 UTC (rev 30079)
@@ -114,11 +114,11 @@
 	strncat(buf, filename, bufsize-1);
 }
 
-Common::StringList DefaultSaveFileManager::listSavefiles(const char *regex) {
+Common::StringList DefaultSaveFileManager::listSavefiles(const char *pattern) {
 	FilesystemNode savePath(getSavePath());
 	FSList savefiles;
 	Common::StringList results;
-	Common::String search(regex);
+	Common::String search(pattern);
 
 	if (savePath.lookupFile(savefiles, search, false, true)) {
 		for (FSList::const_iterator file = savefiles.begin(); file != savefiles.end(); ++file) {

Modified: scummvm/trunk/backends/saves/default/default-saves.h
===================================================================
--- scummvm/trunk/backends/saves/default/default-saves.h	2007-12-30 09:37:35 UTC (rev 30078)
+++ scummvm/trunk/backends/saves/default/default-saves.h	2007-12-30 13:05:38 UTC (rev 30079)
@@ -34,7 +34,7 @@
  */
 class DefaultSaveFileManager : public Common::SaveFileManager {
 public:
-	virtual Common::StringList listSavefiles(const char *regex);
+	virtual Common::StringList listSavefiles(const char *pattern);
 	virtual Common::InSaveFile *openForLoading(const char *filename);
 	virtual Common::OutSaveFile *openForSaving(const char *filename);
 	virtual bool removeSavefile(const char *filename);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list