Permalink
Browse files

Merge pull request #10495 from KentuckyCompass/ios-profiler

iOS: Fix crash with USE_PROFILER, pass command line args to NativeInit, misc cleanups
  • Loading branch information...
unknownbrackets committed Jan 2, 2018
2 parents 263941e + e3af9f4 commit 307efe7ecb235541a39005e3db2b0a5f59211b86
Showing with 17 additions and 68 deletions.
  1. +2 −12 Core/Config.cpp
  2. +0 −5 UI/GameSettingsScreen.cpp
  3. +0 −5 UI/NativeApp.cpp
  4. +5 −45 ios/ViewController.mm
  5. +10 −1 ios/main.mm
View
@@ -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,21 +309,16 @@ 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;
#endif
}
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;
@@ -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)
View
@@ -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;
View
@@ -6,7 +6,6 @@
//
#import "ViewController.h"
#import "AudioEngine.h"
#import <GLKit/GLKit.h>
#include <cassert>
@@ -31,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() {
@@ -54,17 +49,12 @@
Draw::DrawContext *draw_;
};
float dp_xscale = 1.0f;
float dp_yscale = 1.0f;
double lastSelectPress = 0.0f;
double lastStartPress = 0.0f;
bool simulateAnalog = false;
extern ScreenManager *screenManager;
static float dp_xscale = 1.0f;
static float dp_yscale = 1.0f;
extern bool iosCanUseJit;
extern bool targetIsJailbroken;
static double lastSelectPress = 0.0f;
static double lastStartPress = 0.0f;
static bool simulateAnalog = false;
__unsafe_unretained static ViewController* sharedViewController;
static GraphicsContext *graphicsContext;
@@ -75,10 +65,7 @@ @interface ViewController ()
}
@property (nonatomic, strong) EAGLContext* context;
@property (nonatomic, strong) NSString* documentsPath;
@property (nonatomic, strong) NSString* bundlePath;
@property (nonatomic, strong) NSMutableArray<NSDictionary *>* 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));
@@ -87,39 +74,12 @@ @interface ViewController ()
@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];
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;
View
@@ -11,6 +11,7 @@
#import "PPSSPPUIApplication.h"
#include "base/NativeApp.h"
#include "profiler/profiler.h"
@interface UIApplication (Private)
-(void) suspend;
@@ -112,7 +113,15 @@ 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 {
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]));
}
}

0 comments on commit 307efe7

Please sign in to comment.