From 3e5833843ae24499ae413c5a01e74cb6ed65f87d Mon Sep 17 00:00:00 2001 From: Kentucky Compass Date: Sat, 30 Dec 2017 18:19:01 -0800 Subject: [PATCH 1/4] Remove references to AudioEngine, which isn't used anyway --- ios/ViewController.mm | 2 -- 1 file changed, 2 deletions(-) diff --git a/ios/ViewController.mm b/ios/ViewController.mm index c49a550710..33431324cf 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -6,7 +6,6 @@ // #import "ViewController.h" -#import "AudioEngine.h" #import #include @@ -78,7 +77,6 @@ static GraphicsContext *graphicsContext; @property (nonatomic, strong) NSString* documentsPath; @property (nonatomic, strong) NSString* bundlePath; @property (nonatomic, strong) NSMutableArray* touches; -@property (nonatomic) AudioEngine* audioEngine; //@property (nonatomic) iCadeReaderView* iCadeView; #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1 @property (nonatomic) GCController *gameController __attribute__((weak_import)); From 20794081eab467e25168a198c9c117b12ad1bbe8 Mon Sep 17 00:00:00 2001 From: Kentucky Compass Date: Mon, 1 Jan 2018 18:51:18 -0800 Subject: [PATCH 2/4] iOS: Nix iosCanUseJit and targetIsJailbroken. Move NativeInit call to main so it can take cmd line args. --- Core/Config.cpp | 14 ++------------ UI/GameSettingsScreen.cpp | 5 ----- UI/NativeApp.cpp | 5 ----- ios/ViewController.mm | 23 ----------------------- ios/main.mm | 8 +++++++- 5 files changed, 9 insertions(+), 46 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 78d8eb7b8f..744695e058 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -55,11 +55,6 @@ static const char *logSectionName = "LogDebug"; static const char *logSectionName = "Log"; #endif - -#ifdef IOS -extern bool iosCanUseJit; -#endif - struct ConfigSetting { enum Type { TYPE_TERMINATOR, @@ -314,11 +309,8 @@ static int DefaultNumWorkers() { return cpu_info.num_cores; } -// TODO: Default to IRJit on iOS when it's done. static int DefaultCpuCore() { -#ifdef IOS - return (int)(iosCanUseJit ? CPUCore::JIT : CPUCore::INTERPRETER); -#elif defined(ARM) || defined(ARM64) || defined(_M_IX86) || defined(_M_X64) +#if defined(ARM) || defined(ARM64) || defined(_M_IX86) || defined(_M_X64) return (int)CPUCore::JIT; #else return (int)CPUCore::INTERPRETER; @@ -326,9 +318,7 @@ static int DefaultCpuCore() { } static bool DefaultCodeGen() { -#ifdef IOS - return iosCanUseJit ? true : false; -#elif defined(ARM) || defined(ARM64) || defined(_M_IX86) || defined(_M_X64) +#if defined(ARM) || defined(ARM64) || defined(_M_IX86) || defined(_M_X64) return true; #else return false; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index c82f9c1113..bef66c4c0f 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -67,11 +67,6 @@ #include "gfx/gl_common.h" #endif -#ifdef IOS -extern bool iosCanUseJit; -extern bool targetIsJailbroken; -#endif - extern bool VulkanMayBeAvailable(); GameSettingsScreen::GameSettingsScreen(std::string gamePath, std::string gameID, bool editThenRestore) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 7ad706a0bc..1c51566224 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -130,11 +130,6 @@ std::string config_filename; bool g_graphicsInited; -#ifdef IOS -bool iosCanUseJit; -bool targetIsJailbroken; -#endif - // Really need to clean this mess of globals up... but instead I add more :P bool g_TakeScreenshot; static bool isOuya; diff --git a/ios/ViewController.mm b/ios/ViewController.mm index 33431324cf..6ba33c9328 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -62,9 +62,6 @@ bool simulateAnalog = false; extern ScreenManager *screenManager; -extern bool iosCanUseJit; -extern bool targetIsJailbroken; - __unsafe_unretained static ViewController* sharedViewController; static GraphicsContext *graphicsContext; @@ -98,26 +95,6 @@ static GraphicsContext *graphicsContext; if (self) { sharedViewController = self; self.touches = [NSMutableArray array]; - self.documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; - self.bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/assets/"]; - - iosCanUseJit = true; - targetIsJailbroken = false; - NSArray *jailPath = [NSArray arrayWithObjects: - @"/Applications/Cydia.app", - @"/private/var/lib/apt", - @"/private/var/stash", - @"/usr/sbin/sshd", - @"/usr/bin/sshd", nil]; - - for (NSString *string in jailPath) { - if ([[NSFileManager defaultManager] fileExistsAtPath:string]) { - // checking device jailbreak status in order to determine which message to show in GameSettingsScreen - targetIsJailbroken = true; - } - } - - NativeInit(0, NULL, [self.documentsPath UTF8String], [self.bundlePath UTF8String], NULL); iCadeToKeyMap[iCadeJoystickUp] = NKCODE_DPAD_UP; iCadeToKeyMap[iCadeJoystickRight] = NKCODE_DPAD_RIGHT; diff --git a/ios/main.mm b/ios/main.mm index c6eb2d3c7f..596e089bd5 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -112,7 +112,13 @@ int main(int argc, char *argv[]) { // Simulates a debugger. Makes it possible to use JIT (though only W^X) syscall(SYS_ptrace, 0 /*PTRACE_TRACEME*/, 0, 0, 0); + @autoreleasepool { - return UIApplicationMain(argc, argv, NSStringFromClass([PPSSPPUIApplication class]), NSStringFromClass([AppDelegate class])); + NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; + NSString *bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/assets/"]; + + NativeInit(argc, (const char**)argv, documentsPath.UTF8String, bundlePath.UTF8String, NULL); + + return UIApplicationMain(argc, argv, NSStringFromClass([PPSSPPUIApplication class]), NSStringFromClass([AppDelegate class])); } } From 873dcaa126949906e6289798b3164a1c8dd61e6a Mon Sep 17 00:00:00 2001 From: Kentucky Compass Date: Mon, 1 Jan 2018 19:01:10 -0800 Subject: [PATCH 3/4] iOS: call PROFILE_INIT so we don't crash with USE_PROFILER --- ios/main.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ios/main.mm b/ios/main.mm index 596e089bd5..27f9cbac71 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -11,6 +11,7 @@ #import "PPSSPPUIApplication.h" #include "base/NativeApp.h" +#include "profiler/profiler.h" @interface UIApplication (Private) -(void) suspend; @@ -113,6 +114,8 @@ int main(int argc, char *argv[]) // Simulates a debugger. Makes it possible to use JIT (though only W^X) syscall(SYS_ptrace, 0 /*PTRACE_TRACEME*/, 0, 0, 0); + PROFILE_INIT(); + @autoreleasepool { NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/assets/"]; From e3af9f401f1c5af5478eef206084da3857655b2c Mon Sep 17 00:00:00 2001 From: Kentucky Compass Date: Mon, 1 Jan 2018 19:06:08 -0800 Subject: [PATCH 4/4] iOS: ViewController cleanups - delete unused code and properties --- ios/ViewController.mm | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/ios/ViewController.mm b/ios/ViewController.mm index 6ba33c9328..2ec8d7e7a7 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -30,10 +30,6 @@ #define IS_IPAD() ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) #define IS_IPHONE() ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) -#ifndef kCFCoreFoundationVersionNumber_IOS_9_0 -#define kCFCoreFoundationVersionNumber_IOS_9_0 1240.10 -#endif - class IOSDummyGraphicsContext : public DummyGraphicsContext { public: IOSDummyGraphicsContext() { @@ -53,14 +49,12 @@ private: Draw::DrawContext *draw_; }; -float dp_xscale = 1.0f; -float dp_yscale = 1.0f; +static float dp_xscale = 1.0f; +static float dp_yscale = 1.0f; -double lastSelectPress = 0.0f; -double lastStartPress = 0.0f; -bool simulateAnalog = false; - -extern ScreenManager *screenManager; +static double lastSelectPress = 0.0f; +static double lastStartPress = 0.0f; +static bool simulateAnalog = false; __unsafe_unretained static ViewController* sharedViewController; static GraphicsContext *graphicsContext; @@ -71,8 +65,6 @@ static GraphicsContext *graphicsContext; } @property (nonatomic, strong) EAGLContext* context; -@property (nonatomic, strong) NSString* documentsPath; -@property (nonatomic, strong) NSString* bundlePath; @property (nonatomic, strong) NSMutableArray* touches; //@property (nonatomic) iCadeReaderView* iCadeView; #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1 @@ -82,13 +74,6 @@ static GraphicsContext *graphicsContext; @end @implementation ViewController --(bool) isArm64 { - size_t size; - cpu_type_t type; - size = sizeof(type); - sysctlbyname("hw.cputype", &type, &size, NULL, 0); - return type == CPU_TYPE_ARM64; -} -(id) init { self = [super init];