Permalink
Browse files

Merge pull request #10489 from KentuckyCompass/arc-fixes

Modernization of iOS Objective-C code to use Automatic Reference Counting
  • Loading branch information...
hrydgard committed Jan 1, 2018
2 parents bf36965 + 67c6ecd commit 28acc2e9de04efeee6363ac2a4dcf75c7279e164
Showing with 19 additions and 27 deletions.
  1. +5 −0 CMakeLists.txt
  2. +0 −6 ios/PPSSPPUIApplication.mm
  3. +11 −16 ios/ViewController.mm
  4. +2 −2 ios/iCade/iCadeReaderView.h
  5. +0 −1 ios/iCade/iCadeReaderView.m
  6. +1 −2 ios/main.mm
View
@@ -692,6 +692,11 @@ elseif(IOS)
set_source_files_properties(ios/AppDelegate.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/ViewController.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/iOSCoreAudio.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/PPSSPPUIApplication.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/iCade/iCadeReaderView.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/main.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set(TargetBin PPSSPP)
elseif(USING_QT_UI)
@@ -60,12 +60,6 @@
@implementation PPSSPPUIApplication
- (instancetype)init {
auto instance = [super init];
instance.delegate = [[AppDelegate alloc] init];
return instance;
}
- (void)decodeKeyEvent:(NSInteger *)eventMem {
NSInteger eventType = eventMem[GSEVENT_TYPE];
NSInteger eventScanCode = eventMem[GSEVENTKEY_KEYCODE];
View
@@ -66,18 +66,18 @@
extern bool iosCanUseJit;
extern bool targetIsJailbroken;
ViewController* sharedViewController;
__unsafe_unretained static ViewController* sharedViewController;
static GraphicsContext *graphicsContext;
@interface ViewController ()
{
std::map<uint16_t, uint16_t> iCadeToKeyMap;
}
@property (nonatomic) EAGLContext* context;
@property (nonatomic) NSString* documentsPath;
@property (nonatomic) NSString* bundlePath;
@property (nonatomic) NSMutableArray* touches;
@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
@@ -214,24 +214,19 @@ - (void)viewDidLoad {
#endif
}
- (void)viewDidUnload
{
[super viewDidUnload];
if ([EAGLContext currentContext] == self.context) {
[EAGLContext setCurrentContext:nil];
}
self.context = nil;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (void)dealloc
{
[self viewDidUnload];
sharedViewController = nil;
if ([EAGLContext currentContext] == self.context) {
[EAGLContext setCurrentContext:nil];
}
self.context = nil;
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
if ([GCController class]) {
@@ -50,7 +50,7 @@
@interface iCadeReaderView : UIView<UIKeyInput> {
UIView *inputView;
iCadeState _iCadeState;
id<iCadeEventDelegate> _delegate;
id<iCadeEventDelegate> __weak _delegate;
struct {
bool stateChanged:1;
@@ -60,7 +60,7 @@
}
@property (nonatomic, assign) iCadeState iCadeState;
@property (nonatomic, assign) id<iCadeEventDelegate> delegate;
@property (nonatomic, weak) id<iCadeEventDelegate> delegate;
@property (nonatomic, assign) BOOL active;
@end
@@ -49,7 +49,6 @@ - (id)initWithFrame:(CGRect)frame {
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
[super dealloc];
}
- (void)didEnterBackground {
View
@@ -113,7 +113,6 @@ 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]), nil);
//return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
return UIApplicationMain(argc, argv, NSStringFromClass([PPSSPPUIApplication class]), NSStringFromClass([AppDelegate class]));
}
}

0 comments on commit 28acc2e

Please sign in to comment.