aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/iphone
diff options
context:
space:
mode:
authorOystein Eftevaag2009-02-16 23:21:18 +0000
committerOystein Eftevaag2009-02-16 23:21:18 +0000
commitd61b83814b9295d6fc4192344a96422fed2fe07d (patch)
treeba58dba3d0f8f5c29a94677a3608914cd450eaff /backends/platform/iphone
parent6ec40aa9f64101c82daa621610bb9d66a85b4001 (diff)
downloadscummvm-rg350-d61b83814b9295d6fc4192344a96422fed2fe07d.tar.gz
scummvm-rg350-d61b83814b9295d6fc4192344a96422fed2fe07d.tar.bz2
scummvm-rg350-d61b83814b9295d6fc4192344a96422fed2fe07d.zip
Updated the iphone xcode project to include dependency libs, and fixed config/savegame paths
svn-id: r38386
Diffstat (limited to 'backends/platform/iphone')
-rw-r--r--backends/platform/iphone/iphone_common.h3
-rw-r--r--backends/platform/iphone/iphone_video.m6
-rw-r--r--backends/platform/iphone/osys_iphone.cpp23
3 files changed, 29 insertions, 3 deletions
diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h
index 3c0d57aeb4..3c34af99ea 100644
--- a/backends/platform/iphone/iphone_common.h
+++ b/backends/platform/iphone/iphone_common.h
@@ -66,7 +66,8 @@ void iPhone_lockSurface();
void iPhone_unlockSurface();
void iPhone_initSurface(int width, int height, bool landscape);
bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY);
-
+const char* iPhone_getDocumentsDir();
+
#ifdef __cplusplus
}
#endif
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index ab85d2868a..d8919ec2b4 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -87,6 +87,12 @@ bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY) {
return true;
}
+const char* iPhone_getDocumentsDir() {
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+ NSString *documentsDirectory = [paths objectAtIndex:0];
+ return [documentsDirectory UTF8String];
+}
+
bool getLocalMouseCoords(CGPoint *point) {
if (point->x < _screenRect.origin.x || point->x >= _screenRect.origin.x + _screenRect.size.width ||
point->y < _screenRect.origin.y || point->y >= _screenRect.origin.y + _screenRect.size.height) {
diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp
index 09507a6914..756d42493e 100644
--- a/backends/platform/iphone/osys_iphone.cpp
+++ b/backends/platform/iphone/osys_iphone.cpp
@@ -88,7 +88,12 @@ int OSystem_IPHONE::timerHandler(int t) {
}
void OSystem_IPHONE::initBackend() {
+#ifdef IPHONE_OFFICIAL
+ _savefile = new DefaultSaveFileManager(iPhone_getDocumentsDir());
+#else
_savefile = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH);
+#endif
+
_timer = new DefaultTimerManager();
gettimeofday(&_startTime, NULL);
@@ -1345,12 +1350,26 @@ OSystem *OSystem_IPHONE_create() {
}
Common::SeekableReadStream *OSystem_IPHONE::createConfigReadStream() {
- Common::FSNode file(SCUMMVM_PREFS_PATH);
+#ifdef IPHONE_OFFICIAL
+ char buf[256];
+ strncpy(buf, iPhone_getDocumentsDir(), 256);
+ strncat(buf, "/Preferences", 256 - strlen(buf) );
+ Common::FSNode file(buf);
+#else
+ Common::FSNode file(SCUMMVM_PREFS_PATH);
+#endif
return file.createReadStream();
}
Common::WriteStream *OSystem_IPHONE::createConfigWriteStream() {
- Common::FSNode file(SCUMMVM_PREFS_PATH);
+#ifdef IPHONE_OFFICIAL
+ char buf[256];
+ strncpy(buf, iPhone_getDocumentsDir(), 256);
+ strncat(buf, "/Preferences", 256 - strlen(buf) );
+ Common::FSNode file(buf);
+#else
+ Common::FSNode file(SCUMMVM_PREFS_PATH);
+#endif
return file.createWriteStream();
}