support ExportFl on iOS 7

This commit is contained in:
Jesús A. Álvarez 2016-06-04 15:38:19 +02:00
parent c390e48140
commit b1bd3da561

View File

@ -37,7 +37,7 @@
#define kRAM_Size (kRAMa_Size + kRAMb_Size) #define kRAM_Size (kRAMa_Size + kRAMb_Size)
EXPORTVAR(ui3p, RAM) EXPORTVAR(ui3p, RAM)
@interface Emulator : NSObject <Emulator> @interface Emulator : NSObject <Emulator, UIAlertViewDelegate>
- (void)makeNewDisk:(NSString*)name size:(NSInteger)size; - (void)makeNewDisk:(NSString*)name size:(NSInteger)size;
- (void)updateScreen:(CGImageRef)screenImage; - (void)updateScreen:(CGImageRef)screenImage;
@ -1838,7 +1838,13 @@ static dispatch_once_t onceToken;
}]]; }]];
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertController animated:YES completion:nil]; [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertController animated:YES completion:nil];
} else { } else {
// iOS 7 fallback
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Export File", nil) message:NSLocalizedString(@"Enter new name", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Save", nil), nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
nameTextField = [alert textFieldAtIndex:0];
nameTextField.placeholder = name;
nameTextField.text = name;
[alert show];
} }
} }
@ -1857,6 +1863,16 @@ static dispatch_once_t onceToken;
SpeedStopped = falseblnr; SpeedStopped = falseblnr;
} }
- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex {
if (nameTextField) {
NSString *fileName = nil;
if (buttonIndex == alertView.firstOtherButtonIndex) {
fileName = nameTextField.text;
}
[self didMakeNewDisk:fileName size:vSonyNewDiskSize];
}
}
#pragma mark - Keyboard #pragma mark - Keyboard
- (int)translateScanCode:(int)scancode { - (int)translateScanCode:(int)scancode {