diff options
Diffstat (limited to 'backends/platform/ios7')
-rw-r--r-- | backends/platform/ios7/ios7_common.h | 4 | ||||
-rw-r--r-- | backends/platform/ios7/ios7_osys_events.cpp | 12 | ||||
-rw-r--r-- | backends/platform/ios7/ios7_osys_main.cpp | 41 | ||||
-rw-r--r-- | backends/platform/ios7/ios7_osys_main.h | 4 | ||||
-rw-r--r-- | backends/platform/ios7/ios7_osys_video.mm | 1 | ||||
-rw-r--r-- | backends/platform/ios7/ios7_video.mm | 26 |
6 files changed, 51 insertions, 37 deletions
diff --git a/backends/platform/ios7/ios7_common.h b/backends/platform/ios7/ios7_common.h index 12740d4ae9..3609387efd 100644 --- a/backends/platform/ios7/ios7_common.h +++ b/backends/platform/ios7/ios7_common.h @@ -62,7 +62,6 @@ enum UIViewTapDescription { }; enum GraphicsModes { - kGraphicsModeLinear = 0, kGraphicsModeNone = 1, kGraphicsMode2xSaI, @@ -80,7 +79,7 @@ struct VideoContext { VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false), overlayWidth(), overlayHeight(), mouseX(), mouseY(), mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(), - mouseIsVisible(), graphicsMode(kGraphicsModeNone), shakeOffsetY() { + mouseIsVisible(), graphicsMode(kGraphicsModeNone), filtering(false), shakeOffsetY() { } // Game screen state @@ -102,6 +101,7 @@ struct VideoContext { // Misc state GraphicsModes graphicsMode; + bool filtering; int shakeOffsetY; }; diff --git a/backends/platform/ios7/ios7_osys_events.cpp b/backends/platform/ios7/ios7_osys_events.cpp index 3621c084db..da467cf5d6 100644 --- a/backends/platform/ios7/ios7_osys_events.cpp +++ b/backends/platform/ios7/ios7_osys_events.cpp @@ -91,16 +91,16 @@ bool OSystem_iOS7::pollEvent(Common::Event &event) { if (!handleEvent_secondMouseUp(event, internalEvent.value1, internalEvent.value2)) return false; break; - + case kInputKeyPressed: handleEvent_keyPressed(event, internalEvent.value1); break; - + case kInputSwipe: if (!handleEvent_swipe(event, internalEvent.value1, internalEvent.value2)) return false; break; - + case kInputTap: if (!handleEvent_tap(event, (UIViewTapDescription) internalEvent.value1, internalEvent.value2)) return false; @@ -109,7 +109,7 @@ bool OSystem_iOS7::pollEvent(Common::Event &event) { default: break; } - + return true; } return false; @@ -499,14 +499,14 @@ bool OSystem_iOS7::handleEvent_swipe(Common::Event &event, int direction, int to } break; } - + event.kbd.keycode = _queuedInputEvent.kbd.keycode = keycode; event.kbd.ascii = _queuedInputEvent.kbd.ascii = 0; event.type = Common::EVENT_KEYDOWN; _queuedInputEvent.type = Common::EVENT_KEYUP; event.kbd.flags = _queuedInputEvent.kbd.flags = 0; _queuedEventTime = getMillis() + kQueuedInputEventDelay; - + return true; } else if (touches == 2) { 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; diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h index cc2f1ccc06..174c160bd6 100644 --- a/backends/platform/ios7/ios7_osys_main.h +++ b/backends/platform/ios7/ios7_osys_main.h @@ -111,6 +111,10 @@ protected: char *_lastErrorMessage; +#ifdef IPHONE_SANDBOXED + Common::String _chrootBasePath; +#endif + public: OSystem_iOS7(); diff --git a/backends/platform/ios7/ios7_osys_video.mm b/backends/platform/ios7/ios7_osys_video.mm index 6784cf46f5..456796137e 100644 --- a/backends/platform/ios7/ios7_osys_video.mm +++ b/backends/platform/ios7/ios7_osys_video.mm @@ -76,7 +76,6 @@ int OSystem_iOS7::getDefaultGraphicsMode() const { bool OSystem_iOS7::setGraphicsMode(int mode) { switch (mode) { case kGraphicsModeNone: - case kGraphicsModeLinear: case kGraphicsMode2xSaI: case kGraphicsModeSuper2xSaI: case kGraphicsModeSuperEagle: diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm index 5c0434d43e..5baa83e8e8 100644 --- a/backends/platform/ios7/ios7_video.mm +++ b/backends/platform/ios7/ios7_video.mm @@ -442,26 +442,7 @@ uint getSizeNextPOT(uint size) { glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, tex); printOpenGLError(); - GLint filter = GL_LINEAR; - - switch (_videoContext.graphicsMode) { - case kGraphicsModeNone: - filter = GL_NEAREST; - break; - - case kGraphicsModeLinear: - case kGraphicsMode2xSaI: - case kGraphicsModeSuper2xSaI: - case kGraphicsModeSuperEagle: - case kGraphicsModeAdvMame2x: - case kGraphicsModeAdvMame3x: - case kGraphicsModeHQ2x: - case kGraphicsModeHQ3x: - case kGraphicsModeTV2x: - case kGraphicsModeDotMatrix: - filter = GL_LINEAR; - break; - } + GLint filter = _videoContext.filtering ? GL_LINEAR : GL_NEAREST; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); printOpenGLError(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); printOpenGLError(); @@ -478,9 +459,6 @@ uint getSizeNextPOT(uint size) { int scalerScale = 1; switch (_videoContext.graphicsMode) { - case kGraphicsModeLinear: - break; - case kGraphicsModeNone: break; #ifdef USE_SCALERS @@ -931,7 +909,7 @@ uint getSizeNextPOT(uint size) { CGPoint point = [touch locationInView:self]; if (![self getMouseCoords:point eventX:&x eventY:&y]) return; - + [self addEvent:InternalEvent(kInputMouseSecondDragged, x, y)]; } } |