ifdefs for watchOS

This commit is contained in:
Jesús A. Álvarez 2024-03-25 20:20:19 +01:00
parent 8ba6622310
commit 87f3427725
2 changed files with 24 additions and 4 deletions

View File

@ -8,7 +8,15 @@
@import Foundation; @import Foundation;
@import CoreGraphics; @import CoreGraphics;
#if TARGET_OS_WATCH
#define CALayer NSObject
#define UIViewController NSObject
@interface NSObject (CALayer)
- (void)setContents:(id)contents;
@end
#else
@import QuartzCore; @import QuartzCore;
#endif
typedef NS_ENUM(NSInteger, EmulatorSpeed) { typedef NS_ENUM(NSInteger, EmulatorSpeed) {
EmulatorSpeedAllOut = -1, EmulatorSpeedAllOut = -1,

View File

@ -25,22 +25,26 @@
*/ */
@import UIKit; @import UIKit;
@import AudioUnit;
@import AudioToolbox;
#include "OSGCOMUI.h" #include "OSGCOMUI.h"
#include "OSGCOMUD.h" #include "OSGCOMUD.h"
#import "EmulatorProtocol.h" #import "EmulatorProtocol.h"
#if MySoundEnabled
@import AudioUnit;
@import AudioToolbox;
#endif
#define kRAM_Size (kRAMa_Size + kRAMb_Size) #define kRAM_Size (kRAMa_Size + kRAMb_Size)
EXPORTVAR(ui3p, RAM) EXPORTVAR(ui3p, RAM)
EXPORTVAR(ui3p, VidROM) EXPORTVAR(ui3p, VidROM)
EXPORTVAR(ui3p, VidMem) EXPORTVAR(ui3p, VidMem)
@interface MNVMBundleClassName : NSObject <Emulator> @interface MNVMBundleClassName : NSObject <Emulator>
#if IncludeSonyNew
- (void)makeNewDisk:(NSString*)name size:(NSInteger)size; - (void)makeNewDisk:(NSString*)name size:(NSInteger)size;
#endif
- (void)updateScreen:(CGImageRef)screenImage; - (void)updateScreen:(CGImageRef)screenImage;
@end @end
static __weak MNVMBundleClassName *sharedEmulator = nil; static __weak MNVMBundleClassName *sharedEmulator = nil;
@ -1646,7 +1650,9 @@ GLOBALPROC WaitForNextTick(void) {
@implementation MNVMBundleClassName @implementation MNVMBundleClassName
{ {
#if IncludeSonyNew
__block __weak UITextField *nameTextField; __block __weak UITextField *nameTextField;
#endif
} }
@synthesize dataPath; @synthesize dataPath;
@ -1760,9 +1766,13 @@ GLOBALPROC WaitForNextTick(void) {
} }
- (void)updateScreen:(CGImageRef)screenImage { - (void)updateScreen:(CGImageRef)screenImage {
#if TARGET_OS_WATCH
[screenLayer setContents:(__bridge id)screenImage];
#else
if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) { if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
screenLayer.contents = (__bridge id)screenImage; screenLayer.contents = (__bridge id)screenImage;
} }
#endif
} }
#pragma mark - Disk #pragma mark - Disk
@ -1789,6 +1799,7 @@ GLOBALPROC WaitForNextTick(void) {
return @"didEjectDisk"; return @"didEjectDisk";
} }
#if IncludeSonyNew
- (void)makeNewDisk:(NSString*)name size:(NSInteger)size { - (void)makeNewDisk:(NSString*)name size:(NSInteger)size {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Export File", nil) message:NSLocalizedString(@"Enter new name", nil) preferredStyle:UIAlertControllerStyleAlert]; UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Export File", nil) message:NSLocalizedString(@"Enter new name", nil) preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
@ -1819,6 +1830,7 @@ GLOBALPROC WaitForNextTick(void) {
vSonyNewDiskWanted = falseblnr; vSonyNewDiskWanted = falseblnr;
SpeedStopped = falseblnr; SpeedStopped = falseblnr;
} }
#endif
#pragma mark - Keyboard #pragma mark - Keyboard