Skip to content

Commit

Permalink
upgrade to Xcode 5.0, upgrade to ARC, fixed crash on iOS 7
Browse files Browse the repository at this point in the history
  • Loading branch information
dparnell committed Sep 13, 2013
1 parent cd561dd commit a848e7e
Show file tree
Hide file tree
Showing 20 changed files with 819 additions and 2,063 deletions.
3 changes: 0 additions & 3 deletions Classes/FlipsideView.m
Expand Up @@ -24,9 +24,6 @@ - (void)drawRect:(CGRect)rect {
}


- (void)dealloc {
[super dealloc];
}


@end
5 changes: 1 addition & 4 deletions Classes/FlipsideViewController.m
Expand Up @@ -16,7 +16,7 @@ - (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor];
NSData* htmlData = [NSData dataWithContentsOfFile: [[NSBundle mainBundle] pathForResource: @"about" ofType: @"html"]];
NSString* html = [[[NSString alloc] initWithData: htmlData encoding: NSUTF8StringEncoding] autorelease];
NSString* html = [[NSString alloc] initWithData: htmlData encoding: NSUTF8StringEncoding];
[webView loadHTMLString: html baseURL: nil];
}

Expand All @@ -36,9 +36,6 @@ - (void)didReceiveMemoryWarning {
}


- (void)dealloc {
[super dealloc];
}


@end
2 changes: 1 addition & 1 deletion Classes/MainView.h
Expand Up @@ -12,6 +12,6 @@
UIImage* _image;
}

@property(retain) UIImage* image;
@property(strong) UIImage* image;

@end
7 changes: 0 additions & 7 deletions Classes/MainView.m
Expand Up @@ -27,19 +27,12 @@ - (void)drawRect:(CGRect)rect {
}


- (void)dealloc {
[_image release];

[super dealloc];
}

- (UIImage*) image {
return _image;
}

- (void) setImage:(UIImage *)img {
[img retain];
[_image release];

_image = img;

Expand Down
16 changes: 8 additions & 8 deletions Classes/MainViewController.h
Expand Up @@ -29,13 +29,13 @@
- (IBAction) buttonPressed:(UIButton*)sender;
- (IBAction) buttonReleased:(UIButton*)sender;

@property(nonatomic,retain) IBOutlet MainView* lcd;

@property(nonatomic,retain) IBOutlet UIImageView* ann1;
@property(nonatomic,retain) IBOutlet UIImageView* ann2;
@property(nonatomic,retain) IBOutlet UIImageView* ann3;
@property(nonatomic,retain) IBOutlet UIImageView* ann4;
@property(nonatomic,retain) IBOutlet UIImageView* ann5;
@property(nonatomic,retain) IBOutlet UIImageView* ann6;
@property(nonatomic,strong) IBOutlet MainView* lcd;

@property(nonatomic,strong) IBOutlet UIImageView* ann1;
@property(nonatomic,strong) IBOutlet UIImageView* ann2;
@property(nonatomic,strong) IBOutlet UIImageView* ann3;
@property(nonatomic,strong) IBOutlet UIImageView* ann4;
@property(nonatomic,strong) IBOutlet UIImageView* ann5;
@property(nonatomic,strong) IBOutlet UIImageView* ann6;

@end
39 changes: 22 additions & 17 deletions Classes/MainViewController.m
Expand Up @@ -279,21 +279,20 @@ void disp_draw_nibble(word_20 addr, word_4 val) {
- (void) emulatorThread:(id)dummy {
BOOL limit_speed;

NSAutoreleasePool* pool = [NSAutoreleasePool new];
NSLog(@"starting emulation thread");
fRunning = YES;
fKeyInterrupt = NO;

limit_speed = [[NSUserDefaults standardUserDefaults] boolForKey: @"limit_speed"];
[pool release];
@autoreleasepool {
NSLog(@"starting emulation thread");
fRunning = YES;
fKeyInterrupt = NO;
limit_speed = [[NSUserDefaults standardUserDefaults] boolForKey: @"limit_speed"];
}
// NSLog(@"calling emulate");

emulate(limit_speed);
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {

}
return self;
}
Expand Down Expand Up @@ -364,7 +363,7 @@ - (void) startEmulation:(id)dummy {

// make sure that interrupts are enabled so that things will kick along!
saturn.intenable = 1;
emulatorThread = [[[NSThread alloc] initWithTarget: self selector: @selector(emulatorThread:) object: nil] retain];
emulatorThread = [[NSThread alloc] initWithTarget: self selector: @selector(emulatorThread:) object: nil];
[emulatorThread setName: @"Emulator Thread"];
[emulatorThread start];
}
Expand All @@ -375,7 +374,11 @@ - (void)viewDidLoad {
[super viewDidLoad];

NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.UIKit"] pathForResource:@"Tock" ofType:@"aiff"];
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &soundID);
if(path) {
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path], &soundID);
} else {
soundID = 0;
}

instance = self;
memset(&saturn, 0, sizeof(saturn));
Expand Down Expand Up @@ -476,9 +479,9 @@ - (void)didReceiveMemoryWarning {

- (void)dealloc {
instance = nil;
AudioServicesDisposeSystemSoundID(soundID);
[super dealloc];
if(soundID) {
AudioServicesDisposeSystemSoundID(soundID);
}
}

- (IBAction) buttonPressed:(UIButton*)sender {
Expand All @@ -487,11 +490,13 @@ - (IBAction) buttonPressed:(UIButton*)sender {

int i, r, c;

NSNumber* play_click = [[NSUserDefaults standardUserDefaults] objectForKey: @"key_click"];
if(soundID) {
NSNumber* play_click = [[NSUserDefaults standardUserDefaults] objectForKey: @"key_click"];

if([play_click boolValue]) {
AudioServicesPlaySystemSound(soundID);
}
if([play_click boolValue]) {
AudioServicesPlaySystemSound(soundID);
}
}

if (code == 0x8000) {
for (i = 0; i < 9; i++) {
Expand Down
8 changes: 4 additions & 4 deletions Classes/RootViewController.h
Expand Up @@ -19,10 +19,10 @@
UINavigationBar *flipsideNavigationBar;
}

@property (nonatomic, retain) IBOutlet UIButton *infoButton;
@property (nonatomic, retain) MainViewController *mainViewController;
@property (nonatomic, retain) UINavigationBar *flipsideNavigationBar;
@property (nonatomic, retain) FlipsideViewController *flipsideViewController;
@property (nonatomic, strong) IBOutlet UIButton *infoButton;
@property (nonatomic, strong) MainViewController *mainViewController;
@property (nonatomic, strong) UINavigationBar *flipsideNavigationBar;
@property (nonatomic, strong) FlipsideViewController *flipsideViewController;

- (IBAction)toggleView;

Expand Down
12 changes: 0 additions & 12 deletions Classes/RootViewController.m
Expand Up @@ -44,7 +44,6 @@ - (void)viewDidLoad {
self.view.backgroundColor = mainViewController.view.backgroundColor;
[self.view insertSubview:mainViewController.view belowSubview:infoButton];
}
[viewController release];
}


Expand All @@ -59,21 +58,17 @@ - (void)loadFlipsideViewController {


self.flipsideViewController = viewController;
[viewController release];

CGRect r = viewController.view.frame;
// Set up the navigation bar
UINavigationBar *aNavigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, r.size.width, 44.0)];
aNavigationBar.barStyle = UIBarStyleBlackOpaque;
self.flipsideNavigationBar = aNavigationBar;
[aNavigationBar release];

UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(toggleView)];
UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:@"i48"];
navigationItem.rightBarButtonItem = buttonItem;
[flipsideNavigationBar pushNavigationItem:navigationItem animated:NO];
[navigationItem release];
[buttonItem release];
}


Expand Down Expand Up @@ -133,13 +128,6 @@ - (void)didReceiveMemoryWarning {
}


- (void)dealloc {
[infoButton release];
[flipsideNavigationBar release];
[mainViewController release];
[flipsideViewController release];
[super dealloc];
}


@end
4 changes: 2 additions & 2 deletions Classes/i48AppDelegate.h
Expand Up @@ -15,8 +15,8 @@
RootViewController *rootViewController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet RootViewController *rootViewController;
@property (nonatomic, strong) IBOutlet UIWindow *window;
@property (nonatomic, strong) IBOutlet RootViewController *rootViewController;

@end

5 changes: 0 additions & 5 deletions Classes/i48AppDelegate.m
Expand Up @@ -34,10 +34,5 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application {
}


- (void)dealloc {
[rootViewController release];
[window release];
[super dealloc];
}

@end

0 comments on commit a848e7e

Please sign in to comment.