From a0e32ee370abea47c2cd90b2cac541c35b0fb3e9 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Wed, 26 Apr 2023 22:31:31 +0100 Subject: [PATCH] IOS7: Remove support for non-sandboxed mode --- audio/softsynth/fluidsynth.cpp | 4 +-- backends/platform/ios7/ios7_app_delegate.mm | 2 -- backends/platform/ios7/ios7_osys_main.cpp | 27 ++------------------- backends/platform/ios7/ios7_osys_main.h | 6 ----- backends/platform/ios7/ios7_osys_misc.mm | 19 +-------------- configure | 4 +-- devtools/create_project/xcode.cpp | 4 --- 7 files changed, 7 insertions(+), 59 deletions(-) diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp index 215bee4f578..f8bcc81b106 100644 --- a/audio/softsynth/fluidsynth.cpp +++ b/audio/softsynth/fluidsynth.cpp @@ -48,7 +48,7 @@ #include "audio/mpu401.h" #include "audio/softsynth/emumidi.h" #include "gui/message.h" -#if defined(IPHONE_IOS7) && defined(IPHONE_SANDBOXED) +#if defined(IPHONE_IOS7) #include "backends/platform/ios7/ios7_common.h" #endif #ifdef __ANDROID__ @@ -438,7 +438,7 @@ int MidiDriver_FluidSynth::open() { } else #endif // FS_HAS_STREAM_SUPPORT { -#if defined(IPHONE_IOS7) && defined(IPHONE_SANDBOXED) +#if defined(IPHONE_IOS7) // HACK: Due to the sandbox on non-jailbroken iOS devices, we need to deal // with the chroot filesystem. All the path selected by the user are // relative to the Document directory. So, we need to adjust the path to diff --git a/backends/platform/ios7/ios7_app_delegate.mm b/backends/platform/ios7/ios7_app_delegate.mm index fe0797dade5..55b6c8b7b24 100644 --- a/backends/platform/ios7/ios7_app_delegate.mm +++ b/backends/platform/ios7/ios7_app_delegate.mm @@ -43,7 +43,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { CGRect rect = [[UIScreen mainScreen] bounds]; -#ifdef IPHONE_SANDBOXED // Create the directory for savegames NSFileManager *fm = [NSFileManager defaultManager]; NSString *documentPath = [NSString stringWithUTF8String:iOS7_getDocumentsDir()]; @@ -51,7 +50,6 @@ if (![fm fileExistsAtPath:savePath]) { [fm createDirectoryAtPath:savePath withIntermediateDirectories:YES attributes:nil error:nil]; } -#endif _window = [[UIWindow alloc] initWithFrame:rect]; [_window retain]; diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp index d157d93f47d..7d43e8d468d 100644 --- a/backends/platform/ios7/ios7_osys_main.cpp +++ b/backends/platform/ios7/ios7_osys_main.cpp @@ -59,7 +59,6 @@ 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: @@ -84,7 +83,6 @@ public: } } }; -#endif OSystem_iOS7::OSystem_iOS7() : _mixer(NULL), _lastMouseTap(0), _queuedEventTime(0), @@ -95,7 +93,7 @@ OSystem_iOS7::OSystem_iOS7() : _mouseCursorPaletteEnabled(false), _gfxTransactionError(kTransactionSuccess) { _queuedInputEvent.type = Common::EVENT_INVALID; _touchpadModeEnabled = !iOS7_isBigDevice(); -#ifdef IPHONE_SANDBOXED + _chrootBasePath = iOS7_getDocumentsDir(); ChRootFilesystemFactory *chFsFactory = new ChRootFilesystemFactory(_chrootBasePath); _fsFactory = chFsFactory; @@ -107,9 +105,7 @@ OSystem_iOS7::OSystem_iOS7() : chFsFactory->addVirtualDrive("appbundle:", Common::String((const char *)buf)); CFRelease(fileUrl); } -#else - _fsFactory = new POSIXFilesystemFactory(); -#endif + initVideoContext(); memset(_gamePalette, 0, sizeof(_gamePalette)); @@ -146,11 +142,7 @@ int OSystem_iOS7::timerHandler(int t) { } void OSystem_iOS7::initBackend() { -#ifdef IPHONE_SANDBOXED _savefileManager = new SandboxedSaveFileManager(_chrootBasePath, "/Savegames"); -#else - _savefileManager = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH); -#endif _timerManager = new DefaultTimerManager(); @@ -354,12 +346,8 @@ OSystem_iOS7 *OSystem_iOS7::sharedInstance() { } Common::String OSystem_iOS7::getDefaultConfigFileName() { -#ifdef IPHONE_SANDBOXED Common::String path = "/Preferences"; return path; -#else - return SCUMMVM_PREFS_PATH; -#endif } void OSystem_iOS7::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { @@ -371,12 +359,8 @@ void OSystem_iOS7::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) { // Success: Add it to the search path Common::String bundlePath((const char *)buf); -#ifdef IPHONE_SANDBOXED POSIXFilesystemNode *posixNode = new POSIXFilesystemNode(bundlePath); s.add("__IOS_BUNDLE__", new Common::FSDirectory(AbstractFSNode::makeFSNode(posixNode)), priority); -#else - s.add("__IOS_BUNDLE__", new Common::FSDirectory(bundlePath), priority); -#endif } CFRelease(fileUrl); } @@ -408,14 +392,7 @@ void iOS7_main(int argc, char **argv) { //gDebugLevel = 10; } -#ifdef IPHONE_SANDBOXED chdir(iOS7_getDocumentsDir()); -#else - system("mkdir " SCUMMVM_ROOT_PATH); - system("mkdir " SCUMMVM_SAVE_PATH); - - chdir("/var/mobile/"); -#endif g_system = OSystem_iOS7::sharedInstance(); assert(g_system); diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h index 9959cf6fcd9..c9b97c3c7f6 100644 --- a/backends/platform/ios7/ios7_osys_main.h +++ b/backends/platform/ios7/ios7_osys_main.h @@ -39,10 +39,6 @@ #define WAVE_BUFFER_SIZE 2048 #define AUDIO_SAMPLE_RATE 44100 -#define SCUMMVM_ROOT_PATH "/var/mobile/Library/ScummVM" -#define SCUMMVM_SAVE_PATH SCUMMVM_ROOT_PATH "/Savegames" -#define SCUMMVM_PREFS_PATH SCUMMVM_ROOT_PATH "/Preferences" - typedef void (*SoundProc)(void *param, byte *buf, int len); typedef int (*TimerProc)(int interval); @@ -111,9 +107,7 @@ protected: Common::String _lastErrorMessage; -#ifdef IPHONE_SANDBOXED Common::String _chrootBasePath; -#endif public: diff --git a/backends/platform/ios7/ios7_osys_misc.mm b/backends/platform/ios7/ios7_osys_misc.mm index d0885120963..e7193f16a5f 100644 --- a/backends/platform/ios7/ios7_osys_misc.mm +++ b/backends/platform/ios7/ios7_osys_misc.mm @@ -56,13 +56,8 @@ void OSystem_iOS7::updateStartSettings(const Common::String &executable, Common: // If the bundle contains a scummvm.ini, use it as initial config NSString *iniPath = [bundle pathForResource:@"scummvm" ofType:@"ini"]; - if (iniPath && !settings.contains("initial-cfg")) { -#ifdef IPHONE_SANDBOXED + if (iniPath && !settings.contains("initial-cfg")) settings["initial-cfg"] = "appbundle:/scummvm.ini"; -#else - settings["initial-cfg"] = Common::String([iniPath fileSystemRepresentation]); -#endif - } // If a command was specified on the command line, do not override it if (!command.empty()) @@ -73,11 +68,7 @@ void OSystem_iOS7::updateStartSettings(const Common::String &executable, Common: if (autorunPath) { Common::File autorun; Common::String line; -#ifdef IPHONE_SANDBOXED if (autorun.open(Common::FSNode("appbundle:/scummvm-autorun"))) { -#else - if (autorun.open(Common::FSNode([autorunPath fileSystemRepresentation]))) { -#endif while (!autorun.eos()) { line = autorun.readLine(); if (!line.empty() && line[0] != '#') @@ -94,11 +85,7 @@ void OSystem_iOS7::updateStartSettings(const Common::String &executable, Common: if (exists && isDir) { // Use auto-detection command = "auto-detect"; -#ifdef IPHONE_SANDBOXED settings["path"] = "appbundle:/game"; -#else - settings["path"] = [gamePath fileSystemRepresentation]; -#endif return; } @@ -118,11 +105,7 @@ void OSystem_iOS7::updateStartSettings(const Common::String &executable, Common: if (exists && isDir) { // Detect and add games command = "add"; -#ifdef IPHONE_SANDBOXED settings["path"] = "appbundle:/games"; -#else - settings["path"] = [gamesPath fileSystemRepresentation]; -#endif settings["recursive"] = "true"; settings["exit"] = "false"; return; diff --git a/configure b/configure index 00554044ba2..e9e3abe6493 100755 --- a/configure +++ b/configure @@ -3622,7 +3622,7 @@ if test -n "$_host"; then ;; ios7*) add_line_to_config_mk 'IPHONE = 1' - append_var DEFINES "-DIPHONE -DIPHONE_IOS7 -DIPHONE_SANDBOXED" + append_var DEFINES "-DIPHONE -DIPHONE_IOS7" _backend="ios7" _seq_midi=no _timidity=no @@ -3904,7 +3904,7 @@ if test -n "$_host"; then ;; tvos) add_line_to_config_mk 'IPHONE = 1' - append_var DEFINES "-DIPHONE -DIPHONE_IOS7 -DIPHONE_SANDBOXED" + append_var DEFINES "-DIPHONE -DIPHONE_IOS7" _backend="ios7" _seq_midi=no _timidity=no diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index f8fd7b35c25..6f68c51749c 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -1303,7 +1303,6 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) { REMOVE_DEFINE(scummvm_defines, "MACOSX"); REMOVE_DEFINE(scummvm_defines, "IPHONE"); REMOVE_DEFINE(scummvm_defines, "IPHONE_IOS7"); - REMOVE_DEFINE(scummvm_defines, "IPHONE_SANDBOXED"); REMOVE_DEFINE(scummvm_defines, "SDL_BACKEND"); ADD_SETTING_LIST(scummvm_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvm_defines, kSettingsNoQuote | kSettingsAsList, 5); ADD_SETTING(scummvm_Debug, "GCC_WARN_ABOUT_RETURN_TYPE", "YES"); @@ -1398,7 +1397,6 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) { ADD_DEFINE(scummvmIOS_defines, "\"$(inherited)\""); ADD_DEFINE(scummvmIOS_defines, "IPHONE"); ADD_DEFINE(scummvmIOS_defines, "IPHONE_IOS7"); - ADD_DEFINE(scummvmIOS_defines, "IPHONE_SANDBOXED"); if (CONTAINS_DEFINE(setup.defines, "USE_SDL_NET")) ADD_DEFINE(scummvmIOS_defines, "WITHOUT_SDL"); ADD_SETTING_LIST(iPhone_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvmIOS_defines, kSettingsNoQuote | kSettingsAsList, 5); @@ -1556,7 +1554,6 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) { ADD_DEFINE(scummvmTVOS_defines, "\"$(inherited)\""); ADD_DEFINE(scummvmTVOS_defines, "IPHONE"); ADD_DEFINE(scummvmTVOS_defines, "IPHONE_IOS7"); - ADD_DEFINE(scummvmTVOS_defines, "IPHONE_SANDBOXED"); if (CONTAINS_DEFINE(setup.defines, "USE_SDL_NET")) ADD_DEFINE(scummvmTVOS_defines, "WITHOUT_SDL"); ADD_SETTING_LIST(tvOS_Debug, "GCC_PREPROCESSOR_DEFINITIONS", scummvmTVOS_defines, kSettingsNoQuote | kSettingsAsList, 5); @@ -1642,7 +1639,6 @@ void XcodeProvider::setupDefines(const BuildSetup &setup) { REMOVE_DEFINE(_defines, "MACOSX"); REMOVE_DEFINE(_defines, "IPHONE"); REMOVE_DEFINE(_defines, "IPHONE_IOS7"); - REMOVE_DEFINE(_defines, "IPHONE_SANDBOXED"); REMOVE_DEFINE(_defines, "SDL_BACKEND"); ADD_DEFINE(_defines, "CONFIG_H"); ADD_DEFINE(_defines, "UNIX");