minivmac4ios/Mini vMac/AppDelegate.m

74 lines
1.5 KiB
Mathematica
Raw Normal View History

2016-04-27 20:52:28 +00:00
//
// AppDelegate.m
// Mini vMac
//
// Created by Jesús A. Álvarez on 27/04/2016.
// Copyright © 2016 namedfork. All rights reserved.
//
#import "AppDelegate.h"
2016-05-01 17:05:36 +00:00
#include "CNFGRAPI.h"
#include "SYSDEPNS.h"
#include "MYOSGLUE.h"
IMPORTPROC RunEmulator(void);
2016-05-01 21:44:47 +00:00
IMPORTFUNC blnr GetSpeedStopped(void);
2016-05-01 17:05:36 +00:00
IMPORTPROC SetSpeedStopped(blnr stopped);
2016-05-01 21:44:47 +00:00
IMPORTPROC SetMouseButton(blnr down);
IMPORTPROC SetMouseLoc(ui4r h, ui4r v);
IMPORTPROC SetMouseDelta(ui4r dh, ui4r dv);
2016-05-01 17:05:36 +00:00
static AppDelegate *sharedAppDelegate = nil;
2016-04-27 20:52:28 +00:00
@interface AppDelegate ()
@end
@implementation AppDelegate
2016-05-01 17:05:36 +00:00
+ (instancetype)sharedInstance {
return sharedAppDelegate;
}
2016-04-27 20:52:28 +00:00
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
2016-05-01 21:44:47 +00:00
sharedAppDelegate = self;
2016-05-07 18:21:43 +00:00
[self performSelector:@selector(runEmulator) withObject:nil afterDelay:0.1];
2016-04-27 20:52:28 +00:00
return YES;
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
2016-05-01 17:05:36 +00:00
SetSpeedStopped(trueblnr);
2016-04-27 20:52:28 +00:00
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
2016-05-01 17:05:36 +00:00
SetSpeedStopped(falseblnr);
2016-04-27 20:52:28 +00:00
}
2016-05-01 21:44:47 +00:00
#pragma mark - Emulation
2016-05-01 17:05:36 +00:00
- (void)runEmulator {
RunEmulator();
2016-04-27 20:52:28 +00:00
}
2016-05-01 21:44:47 +00:00
- (BOOL)isEmulatorRunning {
return !GetSpeedStopped();
}
- (void)setEmulatorRunning:(BOOL)emulatorRunning {
SetSpeedStopped(emulatorRunning);
}
- (void)setMouseX:(NSInteger)x Y:(NSInteger)y {
SetMouseLoc(x, y);
}
- (void)moveMouseX:(NSInteger)x Y:(NSInteger)y {
SetMouseDelta(x, y);
}
- (void)setMouseButton:(BOOL)down {
SetMouseButton(down);
}
2016-04-27 20:52:28 +00:00
@end