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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Aug 4 21:38:40 CEST 2008


Revision: 33621
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33621&view=rev
Author:   fingolfin
Date:     2008-08-04 19:38:28 +0000 (Mon, 04 Aug 2008)

Log Message:
-----------
Pushed some port specific code from DefaultSaveFileManager out to port specific code in backends/platform/

Modified Paths:
--------------
    scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp
    scummvm/trunk/backends/platform/gp2x/gp2x.cpp
    scummvm/trunk/backends/platform/iphone/osys_iphone.cpp
    scummvm/trunk/backends/platform/iphone/osys_iphone.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_base.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp	2008-08-04 19:32:52 UTC (rev 33620)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp	2008-08-04 19:38:28 UTC (rev 33621)
@@ -30,6 +30,9 @@
 #include "backends/timer/default/default-timer.h"
 #include "sound/mixer.h"
 
+#define DEFAULT_SAVE_PATH "/PALM/Programs/ScummVM/Saved"
+
+
 OSystem_PalmBase::OSystem_PalmBase() {
 	_overlayVisible = false;
 
@@ -100,7 +103,7 @@
 	// Create the savefile manager, if none exists yet (we check for this to
 	// allow subclasses to provide their own).
 	if (_saveMgr == 0) {
-		_saveMgr = new DefaultSaveFileManager();
+		_saveMgr = new DefaultSaveFileManager(DEFAULT_SAVE_PATH);
 	}
 
 	// Create and hook up the mixer, if none exists yet (we check for this to

Modified: scummvm/trunk/backends/platform/gp2x/gp2x.cpp
===================================================================
--- scummvm/trunk/backends/platform/gp2x/gp2x.cpp	2008-08-04 19:32:52 UTC (rev 33620)
+++ scummvm/trunk/backends/platform/gp2x/gp2x.cpp	2008-08-04 19:38:28 UTC (rev 33621)
@@ -219,7 +219,7 @@
 	// Create the savefile manager, if none exists yet (we check for this to
 	// allow subclasses to provide their own).
 	if (_savefile == 0) {
-		_savefile = new DefaultSaveFileManager();
+		_savefile = new DefaultSaveFileManager(savePath);
 	}
 
 	// Create and hook up the mixer, if none exists yet (we check for this to

Modified: scummvm/trunk/backends/platform/iphone/osys_iphone.cpp
===================================================================
--- scummvm/trunk/backends/platform/iphone/osys_iphone.cpp	2008-08-04 19:32:52 UTC (rev 33620)
+++ scummvm/trunk/backends/platform/iphone/osys_iphone.cpp	2008-08-04 19:38:28 UTC (rev 33621)
@@ -88,7 +88,7 @@
 }
 
 void OSystem_IPHONE::initBackend() {
-	_savefile = new DefaultSaveFileManager();
+	_savefile = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH);
 	_timer = new DefaultTimerManager();
 
 	gettimeofday(&_startTime, NULL);
@@ -1196,10 +1196,6 @@
 	return SCUMMVM_PREFS_PATH;
 }
 
-const char* OSystem_IPHONE::getSavePath() {
-	return SCUMMVM_SAVE_PATH;
-}
-
 void OSystem_IPHONE::migrateApp() {
 	// Migrate to the new 1.1.3 directory structure, if needed.
 	

Modified: scummvm/trunk/backends/platform/iphone/osys_iphone.h
===================================================================
--- scummvm/trunk/backends/platform/iphone/osys_iphone.h	2008-08-04 19:32:52 UTC (rev 33620)
+++ scummvm/trunk/backends/platform/iphone/osys_iphone.h	2008-08-04 19:38:28 UTC (rev 33621)
@@ -172,7 +172,6 @@
 
 	static void migrateApp();
 	static const char* getConfigPath();
-	static const char* getSavePath();	
 
 protected:
 	inline void addDirtyRect(int16 x1, int16 y1, int16 w, int16 h);

Modified: scummvm/trunk/backends/saves/default/default-saves.cpp
===================================================================
--- scummvm/trunk/backends/saves/default/default-saves.cpp	2008-08-04 19:32:52 UTC (rev 33620)
+++ scummvm/trunk/backends/saves/default/default-saves.cpp	2008-08-04 19:38:28 UTC (rev 33621)
@@ -41,10 +41,6 @@
 #include <sys/stat.h>
 #endif
 
-#ifdef IPHONE
-#include "backends/platform/iphone/osys_iphone.h"
-#endif
-
 #ifdef UNIX
 #ifdef MACOSX
 #define DEFAULT_SAVE_PATH "Documents/ScummVM Savegames"
@@ -53,8 +49,6 @@
 #endif
 #elif defined(__SYMBIAN32__)
 #define DEFAULT_SAVE_PATH "Savegames"
-#elif defined(PALMOS_MODE)
-#define DEFAULT_SAVE_PATH "/PALM/Programs/ScummVM/Saved"
 #endif
 
 DefaultSaveFileManager::DefaultSaveFileManager() {
@@ -62,27 +56,25 @@
 	// TODO: Remove this code here, and instead leave setting the
 	// default savepath to the ports using this class.
 #ifdef DEFAULT_SAVE_PATH
-	char savePath[MAXPATHLEN];
+	Common::String savePath;
 #if defined(UNIX) && !defined(IPHONE)
 	const char *home = getenv("HOME");
 	if (home && *home && strlen(home) < MAXPATHLEN) {
-		snprintf(savePath, MAXPATHLEN, "%s/%s", home, DEFAULT_SAVE_PATH);
+		savePath = home;
+		savePath += "/" DEFAULT_SAVE_PATH;
 		ConfMan.registerDefault("savepath", savePath);
 	}
 #elif defined(__SYMBIAN32__)
-	strcpy(savePath, Symbian::GetExecutablePath());
-	strcat(savePath, DEFAULT_SAVE_PATH);
-	strcat(savePath, "\\");
+	savePath = Symbian::GetExecutablePath();
+	savePath += DEFAULT_SAVE_PATH "\\";
 	ConfMan.registerDefault("savepath", savePath);
-#elif defined (IPHONE)
-	ConfMan.registerDefault("savepath", OSystem_IPHONE::getSavePath());
-
-#elif defined(PALMOS_MODE)
-	ConfMan.registerDefault("savepath", DEFAULT_SAVE_PATH);
 #endif
 #endif // #ifdef DEFAULT_SAVE_PATH
 }
 
+DefaultSaveFileManager::DefaultSaveFileManager(const Common::String &defaultSavepath) {
+	ConfMan.registerDefault("savepath", defaultSavepath);
+}
 
 
 Common::StringList DefaultSaveFileManager::listSavefiles(const char *pattern) {

Modified: scummvm/trunk/backends/saves/default/default-saves.h
===================================================================
--- scummvm/trunk/backends/saves/default/default-saves.h	2008-08-04 19:32:52 UTC (rev 33620)
+++ scummvm/trunk/backends/saves/default/default-saves.h	2008-08-04 19:38:28 UTC (rev 33621)
@@ -35,6 +35,7 @@
 class DefaultSaveFileManager : public Common::SaveFileManager {
 public:
 	DefaultSaveFileManager();
+	DefaultSaveFileManager(const Common::String &defaultSavepath);
 
 	virtual Common::StringList listSavefiles(const char *pattern);
 	virtual Common::InSaveFile *openForLoading(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