diff options
Diffstat (limited to 'backends/platform/ios7/ios7_osys_main.cpp')
-rw-r--r-- | backends/platform/ios7/ios7_osys_main.cpp | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp index c1280a2969..3a627478f9 100644 --- a/backends/platform/ios7/ios7_osys_main.cpp +++ b/backends/platform/ios7/ios7_osys_main.cpp @@ -52,8 +52,7 @@ const OSystem::GraphicsMode OSystem_iOS7::s_supportedGraphicsModes[] = { - { "none", "No filtering", kGraphicsModeNone }, - { "linear", "Linear filtering", kGraphicsModeLinear }, + { "none", "Normal", kGraphicsModeNone }, #ifdef ENABLE_IOS7_SCALERS #ifdef USE_SCALERS @@ -79,6 +78,33 @@ AQCallbackStruct OSystem_iOS7::s_AudioQueue; SoundProc OSystem_iOS7::s_soundCallback = NULL; void *OSystem_iOS7::s_soundParam = NULL; +#ifdef IPHONE_SANDBOXED +class SandboxedSaveFileManager : public DefaultSaveFileManager { + Common::String _sandboxRootPath; +public: + + SandboxedSaveFileManager(Common::String sandboxRootPath, Common::String defaultSavepath) + : DefaultSaveFileManager(defaultSavepath), _sandboxRootPath(sandboxRootPath) { + } + + virtual bool removeSavefile(const Common::String &filename) override { + Common::String chrootedFile = getSavePath() + "/" + filename; + Common::String realFilePath = _sandboxRootPath + chrootedFile; + + if (remove(realFilePath.c_str()) != 0) { + if (errno == EACCES) + setError(Common::kWritePermissionDenied, "Search or write permission denied: "+chrootedFile); + + if (errno == ENOENT) + setError(Common::kPathDoesNotExist, "removeSavefile: '"+chrootedFile+"' does not exist or path is invalid"); + return false; + } else { + return true; + } + } +}; +#endif + OSystem_iOS7::OSystem_iOS7() : _mixer(NULL), _lastMouseTap(0), _queuedEventTime(0), _mouseNeedTextureUpdate(false), _secondaryTapped(false), _lastSecondaryTap(0), @@ -89,7 +115,8 @@ OSystem_iOS7::OSystem_iOS7() : _queuedInputEvent.type = Common::EVENT_INVALID; _touchpadModeEnabled = !iOS7_isBigDevice(); #ifdef IPHONE_SANDBOXED - _fsFactory = new ChRootFilesystemFactory(iOS7_getDocumentsDir()); + _chrootBasePath = iOS7_getDocumentsDir(); + _fsFactory = new ChRootFilesystemFactory(_chrootBasePath); #else _fsFactory = new POSIXFilesystemFactory(); #endif @@ -124,7 +151,7 @@ int OSystem_iOS7::timerHandler(int t) { void OSystem_iOS7::initBackend() { #ifdef IPHONE_SANDBOXED - _savefileManager = new DefaultSaveFileManager("/Savegames"); + _savefileManager = new SandboxedSaveFileManager(_chrootBasePath, "/Savegames"); #else _savefileManager = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH); #endif @@ -143,6 +170,7 @@ void OSystem_iOS7::initBackend() { bool OSystem_iOS7::hasFeature(Feature f) { switch (f) { case kFeatureCursorPalette: + case kFeatureFilteringMode: return true; default: @@ -159,6 +187,9 @@ void OSystem_iOS7::setFeatureState(Feature f, bool enable) { _mouseCursorPaletteEnabled = enable; } break; + case kFeatureFilteringMode: + _videoContext->filtering = enable; + break; case kFeatureAspectRatioCorrection: _videoContext->asprectRatioCorrection = enable; break; @@ -172,6 +203,8 @@ bool OSystem_iOS7::getFeatureState(Feature f) { switch (f) { case kFeatureCursorPalette: return _mouseCursorPaletteEnabled; + case kFeatureFilteringMode: + return _videoContext->filtering; case kFeatureAspectRatioCorrection: return _videoContext->asprectRatioCorrection; |