[Scummvm-git-logs] scummvm master -> 59c6d6fe4ba4b10d4885da7faf6f5883559229c3
criezy
noreply at scummvm.org
Thu Apr 27 00:25:49 UTC 2023
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a0e32ee370 IOS7: Remove support for non-sandboxed mode
a36dba4db9 IOS7: Cleanup code to access Document and app bundle paths
e8d87fb92a IOS7: Create log file in Document folder
c9b8bf2ca1 IOS7: Fix orientation detection when the view becomes visible
59c6d6fe4b IOS7: Add check of size for log file to make sure it does not grow too much
Commit: a0e32ee370abea47c2cd90b2cac541c35b0fb3e9
https://github.com/scummvm/scummvm/commit/a0e32ee370abea47c2cd90b2cac541c35b0fb3e9
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-04-26T22:31:31+01:00
Commit Message:
IOS7: Remove support for non-sandboxed mode
Changed paths:
audio/softsynth/fluidsynth.cpp
backends/platform/ios7/ios7_app_delegate.mm
backends/platform/ios7/ios7_osys_main.cpp
backends/platform/ios7/ios7_osys_main.h
backends/platform/ios7/ios7_osys_misc.mm
configure
devtools/create_project/xcode.cpp
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");
Commit: a36dba4db9402ef8221bb7a47fa19dfd0a7d42ee
https://github.com/scummvm/scummvm/commit/a36dba4db9402ef8221bb7a47fa19dfd0a7d42ee
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-04-27T01:24:30+01:00
Commit Message:
IOS7: Cleanup code to access Document and app bundle paths
Changed paths:
A backends/platform/ios7/ios7_misc.mm
backends/platform/ios7/ios7_app_delegate.mm
backends/platform/ios7/ios7_common.h
backends/platform/ios7/ios7_osys_main.cpp
backends/platform/ios7/module.mk
diff --git a/backends/platform/ios7/ios7_app_delegate.mm b/backends/platform/ios7/ios7_app_delegate.mm
index 55b6c8b7b24..517e509e96c 100644
--- a/backends/platform/ios7/ios7_app_delegate.mm
+++ b/backends/platform/ios7/ios7_app_delegate.mm
@@ -45,7 +45,7 @@
// Create the directory for savegames
NSFileManager *fm = [NSFileManager defaultManager];
- NSString *documentPath = [NSString stringWithUTF8String:iOS7_getDocumentsDir()];
+ NSString *documentPath = [NSString stringWithUTF8String:iOS7_getDocumentsDir().c_str()];
NSString *savePath = [documentPath stringByAppendingPathComponent:@"Savegames"];
if (![fm fileExistsAtPath:savePath]) {
[fm createDirectoryAtPath:savePath withIntermediateDirectories:YES attributes:nil error:nil];
@@ -142,14 +142,3 @@
}
@end
-
-const char *iOS7_getDocumentsDir() {
- NSArray *paths;
-#if TARGET_OS_IOS
- paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-#else
- paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
-#endif
- NSString *documentsDirectory = [paths objectAtIndex:0];
- return [documentsDirectory UTF8String];
-}
diff --git a/backends/platform/ios7/ios7_common.h b/backends/platform/ios7/ios7_common.h
index 6374e0114b6..50b46117af5 100644
--- a/backends/platform/ios7/ios7_common.h
+++ b/backends/platform/ios7/ios7_common.h
@@ -117,7 +117,8 @@ bool iOS7_isBigDevice();
void iOS7_buildSharedOSystemInstance();
void iOS7_main(int argc, char **argv);
-const char *iOS7_getDocumentsDir();
+Common::String iOS7_getDocumentsDir();
+Common::String iOS7_getAppBundleDir();
bool iOS7_touchpadModeEnabled();
uint getSizeNextPOT(uint size);
diff --git a/backends/platform/ios7/ios7_misc.mm b/backends/platform/ios7/ios7_misc.mm
new file mode 100644
index 00000000000..db9380ac208
--- /dev/null
+++ b/backends/platform/ios7/ios7_misc.mm
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <Foundation/NSArray.h>
+#include <Foundation/NSURL.h>
+#include <Foundation/NSFileManager.h>
+#include <Foundation/NSBundle.h>
+#include <Foundation/NSPathUtilities.h>
+#include "backends/platform/ios7/ios7_common.h"
+#include <common/str.h>
+
+Common::String iOS7_getDocumentsDir() {
+#if TARGET_OS_IOS
+ NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] firstObject];
+#else
+ NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask] firstObject];
+#endif
+ return Common::String([url fileSystemRepresentation]);
+}
+
+Common::String iOS7_getAppBundleDir() {
+ NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
+ if (bundlePath == nil)
+ return Common::String();
+ return Common::String([bundlePath fileSystemRepresentation]);
+}
diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index 7d43e8d468d..e27a095ef9e 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -98,13 +98,9 @@ OSystem_iOS7::OSystem_iOS7() :
ChRootFilesystemFactory *chFsFactory = new ChRootFilesystemFactory(_chrootBasePath);
_fsFactory = chFsFactory;
// Add virtual drive for bundle path
- CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
- if (fileUrl) {
- UInt8 buf[MAXPATHLEN];
- if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf)))
- chFsFactory->addVirtualDrive("appbundle:", Common::String((const char *)buf));
- CFRelease(fileUrl);
- }
+ Common::String appBubdlePath = iOS7_getAppBundleDir();
+ if (!appBubdlePath.empty())
+ chFsFactory->addVirtualDrive("appbundle:", appBubdlePath);
initVideoContext();
@@ -392,7 +388,7 @@ void iOS7_main(int argc, char **argv) {
//gDebugLevel = 10;
}
- chdir(iOS7_getDocumentsDir());
+ chdir(iOS7_getDocumentsDir().c_str());
g_system = OSystem_iOS7::sharedInstance();
assert(g_system);
diff --git a/backends/platform/ios7/module.mk b/backends/platform/ios7/module.mk
index 2075dfe6e25..ddda4a6f5ed 100644
--- a/backends/platform/ios7/module.mk
+++ b/backends/platform/ios7/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS := \
ios7_osys_sound.o \
ios7_osys_video.o \
ios7_osys_misc.o \
+ ios7_misc.o \
ios7_main.o \
ios7_video.o \
ios7_keyboard.o \
Commit: e8d87fb92ab11dccd6ee2918856d533d754dd56e
https://github.com/scummvm/scummvm/commit/e8d87fb92ab11dccd6ee2918856d533d754dd56e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-04-27T01:24:30+01:00
Commit Message:
IOS7: Create log file in Document folder
Previously no log file was used as it attempted to create it in
a directory not accessible by the application. The commit also fixes
accessing the log file from the Options dialog (it needs the
sandboxed path and not the full path).
Changed paths:
backends/platform/ios7/ios7_osys_main.cpp
backends/platform/ios7/ios7_osys_main.h
diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index e27a095ef9e..a1cce91824f 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -374,8 +374,9 @@ void iOS7_buildSharedOSystemInstance() {
void iOS7_main(int argc, char **argv) {
//OSystem_iOS7::migrateApp();
+ Common::String logFilePath = iOS7_getDocumentsDir() + "/scummvm.log";
- FILE *newfp = fopen("/var/mobile/.scummvm.log", "a");
+ FILE *newfp = fopen(logFilePath.c_str(), "a");
if (newfp != NULL) {
fclose(stdout);
fclose(stderr);
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index c9b97c3c7f6..43ab7fa9f5b 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -212,7 +212,7 @@ public:
bool isConnectionLimited() override;
- virtual Common::String getDefaultLogFileName() override { return Common::String("/var/mobile/.scummvm.log"); }
+ virtual Common::String getDefaultLogFileName() override { return Common::String("/scummvm.log"); }
protected:
void initVideoContext();
Commit: c9b8bf2ca13fcf19dbe1e284731562f90a0baeb2
https://github.com/scummvm/scummvm/commit/c9b8bf2ca13fcf19dbe1e284731562f90a0baeb2
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-04-27T01:24:30+01:00
Commit Message:
IOS7: Fix orientation detection when the view becomes visible
Changed paths:
backends/platform/ios7/ios7_scummvm_view_controller.mm
diff --git a/backends/platform/ios7/ios7_scummvm_view_controller.mm b/backends/platform/ios7/ios7_scummvm_view_controller.mm
index 6d66b8c92ec..4b9e3b389d2 100644
--- a/backends/platform/ios7/ios7_scummvm_view_controller.mm
+++ b/backends/platform/ios7/ios7_scummvm_view_controller.mm
@@ -57,14 +57,16 @@
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
- UIInterfaceOrientation orientationBefore = UIInterfaceOrientationUnknown;
+ UIInterfaceOrientation orientation = UIInterfaceOrientationUnknown;
if (@available(iOS 13.0, *)) {
- orientationBefore = [[[[self view] window] windowScene] interfaceOrientation];
+ orientation = [[[[self view] window] windowScene] interfaceOrientation];
} else {
- orientationBefore = [[UIApplication sharedApplication] statusBarOrientation];
+ orientation = [[UIApplication sharedApplication] statusBarOrientation];
+ }
+ if (orientation != UIInterfaceOrientationUnknown && orientation != currentOrientation) {
+ currentOrientation = orientation;
+ [[iOS7AppDelegate iPhoneView] interfaceOrientationChanged:orientation];
}
- if (currentOrientation != UIInterfaceOrientationUnknown)
- [[iOS7AppDelegate iPhoneView] interfaceOrientationChanged:currentOrientation];
}
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
Commit: 59c6d6fe4ba4b10d4885da7faf6f5883559229c3
https://github.com/scummvm/scummvm/commit/59c6d6fe4ba4b10d4885da7faf6f5883559229c3
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-04-27T01:24:30+01:00
Commit Message:
IOS7: Add check of size for log file to make sure it does not grow too much
Changed paths:
backends/platform/ios7/ios7_osys_main.cpp
backends/platform/ios7/ios7_osys_main.h
diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index a1cce91824f..3511ed83b16 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -374,19 +374,31 @@ void iOS7_buildSharedOSystemInstance() {
void iOS7_main(int argc, char **argv) {
//OSystem_iOS7::migrateApp();
- Common::String logFilePath = iOS7_getDocumentsDir() + "/scummvm.log";
- FILE *newfp = fopen(logFilePath.c_str(), "a");
- if (newfp != NULL) {
- fclose(stdout);
- fclose(stderr);
- *stdout = *newfp;
- *stderr = *newfp;
- setbuf(stdout, NULL);
- setbuf(stderr, NULL);
-
- //extern int gDebugLevel;
- //gDebugLevel = 10;
+ Common::String logFilePath = iOS7_getDocumentsDir() + "/scummvm.log";
+ FILE *logFile = fopen(logFilePath.c_str(), "a");
+ if (logFile != nullptr) {
+ // We check for log file size; if it's too big, we rewrite it.
+ // This happens only upon app launch
+ // NOTE: We don't check for file size each time we write a log message.
+ long sz = ftell(logFile);
+ if (sz > MAX_IOS7_SCUMMVM_LOG_FILESIZE_IN_BYTES) {
+ fclose(logFile);
+ fprintf(stdout, "Default log file is bigger than %dKB. It will be overwritten!", MAX_IOS7_SCUMMVM_LOG_FILESIZE_IN_BYTES / 1024);
+
+ // Create the log file from scratch overwriting the previous one
+ logFile = fopen(logFilePath.c_str(), "w");
+ if (logFile == nullptr)
+ fprintf(stdout, "Could not open default log file for rewrite!");
+ }
+ if (logFile != NULL) {
+ fclose(stdout);
+ fclose(stderr);
+ *stdout = *logFile;
+ *stderr = *logFile;
+ setbuf(stdout, NULL);
+ setbuf(stderr, NULL);
+ }
}
chdir(iOS7_getDocumentsDir().c_str());
@@ -398,9 +410,9 @@ void iOS7_main(int argc, char **argv) {
scummvm_main(argc, (const char *const *) argv);
g_system->quit(); // TODO: Consider removing / replacing this!
- if (newfp != NULL) {
+ if (logFile != NULL) {
//*stdout = NULL;
//*stderr = NULL;
- fclose(newfp);
+ fclose(logFile);
}
}
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index 43ab7fa9f5b..01f83a1e5e4 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -38,6 +38,7 @@
#define AUDIO_BUFFERS 3
#define WAVE_BUFFER_SIZE 2048
#define AUDIO_SAMPLE_RATE 44100
+#define MAX_IOS7_SCUMMVM_LOG_FILESIZE_IN_BYTES (100*1024)
typedef void (*SoundProc)(void *param, byte *buf, int len);
typedef int (*TimerProc)(int interval);
More information about the Scummvm-git-logs
mailing list