diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/iphone/iphone_common.h | 3 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_video.m | 6 | ||||
-rw-r--r-- | backends/platform/iphone/osys_iphone.cpp | 23 |
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(); } |