mirror of
https://github.com/zydeco/minivmac4ios.git
synced 2025-02-19 07:31:01 +00:00
show "tap to restart" when emulated machine shuts down
This commit is contained in:
parent
8ad866b0dc
commit
be06c815f4
@ -23,7 +23,7 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="70W-4V-tYr" firstAttribute="bottom" secondItem="wfy-db-euE" secondAttribute="top" id="Xn1-gS-YTJ"/>
|
||||
<constraint firstItem="70W-4V-tYr" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="ddo-cc-64n"/>
|
||||
|
@ -32,7 +32,7 @@ typedef enum : NSInteger {
|
||||
|
||||
@property (nonatomic, readonly) NSBundle *bundle;
|
||||
@property (nonatomic, readonly) CGSize screenSize;
|
||||
@property (nonatomic, readonly) NSString *insertDiskNotification, *ejectDiskNotification;
|
||||
@property (nonatomic, readonly) NSString *insertDiskNotification, *ejectDiskNotification, *shutdownNotification;
|
||||
@property (nonatomic, readonly) NSInteger initialSpeed;
|
||||
|
||||
@property (nonatomic, readonly) BOOL anyDiskInserted;
|
||||
|
@ -705,6 +705,7 @@ LOCALFUNC blnr LoadMacRom(void) {
|
||||
}
|
||||
|
||||
SpeedStopped = trueblnr;
|
||||
return falseblnr;
|
||||
}
|
||||
|
||||
return trueblnr; /* keep launching Mini vMac, regardless */
|
||||
@ -1750,7 +1751,7 @@ static dispatch_once_t onceToken;
|
||||
UnInitOSGLU();
|
||||
if (ForceMacOff) {
|
||||
ForceMacOff = falseblnr;
|
||||
[self performSelector:_cmd withObject:nil afterDelay:0.5];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:self.shutdownNotification object:self];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1825,6 +1826,10 @@ static dispatch_once_t onceToken;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)shutdownNotification {
|
||||
return @"didShutDown";
|
||||
}
|
||||
|
||||
#pragma mark - Screen
|
||||
|
||||
@synthesize screenLayer;
|
||||
|
@ -36,6 +36,8 @@
|
||||
showSettingsGesture.direction = UISwipeGestureRecognizerDirectionRight;
|
||||
showSettingsGesture.numberOfTouchesRequired = 2;
|
||||
[self.view addGestureRecognizer:showSettingsGesture];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(emulatorDidShutDown:) name:[AppDelegate sharedEmulator].shutdownNotification object:nil];
|
||||
}
|
||||
|
||||
- (BOOL)prefersStatusBarHidden {
|
||||
@ -96,6 +98,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)emulatorDidShutDown:(NSNotification*)notification {
|
||||
UILabel *shutdownLabel = [[UILabel alloc] initWithFrame:self.view.bounds];
|
||||
shutdownLabel.text = NSLocalizedString(@"the emulated Mac has shut down\ntap to restart", nil);
|
||||
shutdownLabel.textColor = [UIColor whiteColor];
|
||||
[self.view addSubview:shutdownLabel];
|
||||
shutdownLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
[shutdownLabel addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(restartEmulator:)]];
|
||||
shutdownLabel.numberOfLines = -1;
|
||||
shutdownLabel.textAlignment = NSTextAlignmentCenter;
|
||||
shutdownLabel.userInteractionEnabled = YES;
|
||||
[UIView animateWithDuration:0.5 animations:^{
|
||||
self.screenView.alpha = 0.5;
|
||||
}];
|
||||
[self hideKeyboard:notification];
|
||||
}
|
||||
|
||||
- (void)restartEmulator:(UITapGestureRecognizer*)gestureRecognizer {
|
||||
if (gestureRecognizer.state == UIGestureRecognizerStateRecognized) {
|
||||
[UIView animateWithDuration:0.5 animations:^{
|
||||
self.screenView.alpha = 1.0;
|
||||
}];
|
||||
[gestureRecognizer.view removeFromSuperview];
|
||||
id emulator = [AppDelegate sharedEmulator];
|
||||
[emulator performSelector:@selector(run) withObject:nil afterDelay:0.1];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Keyboard
|
||||
|
||||
- (void)installKeyboardGestures {
|
||||
|
Loading…
x
Reference in New Issue
Block a user