1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 01:31:42 +00:00
CLK/OSBindings/Mac/Clock Signal/Machine/CSMachine.h

115 lines
3.9 KiB
C
Raw Normal View History

//
// CSMachine.h
// Clock Signal
//
// Created by Thomas Harte on 04/01/2016.
// Copyright 2016 Thomas Harte. All rights reserved.
//
#import <Foundation/Foundation.h>
2016-06-15 12:07:25 +00:00
#import "CSAudioQueue.h"
#import "CSJoystickManager.h"
#import "CSScanTargetView.h"
#import "CSStaticAnalyser.h"
@class CSMachine;
@protocol CSMachineDelegate <NSObject>
- (void)machineSpeakerDidChangeInputClock:(nonnull CSMachine *)machine;
- (void)machine:(nonnull CSMachine *)machine led:(nonnull NSString *)led didChangeToLit:(BOOL)isLit;
- (void)machine:(nonnull CSMachine *)machine ledShouldBlink:(nonnull NSString *)led;
@end
2018-04-01 17:29:04 +00:00
typedef NS_ENUM(NSInteger, CSMachineVideoSignal) {
CSMachineVideoSignalComposite,
CSMachineVideoSignalSVideo,
CSMachineVideoSignalRGB,
CSMachineVideoSignalMonochromeComposite
2018-04-01 17:29:04 +00:00
};
typedef NS_ENUM(NSInteger, CSMachineKeyboardInputMode) {
CSMachineKeyboardInputModeKeyboardPhysical,
CSMachineKeyboardInputModeKeyboardLogical,
CSMachineKeyboardInputModeJoystick,
};
2021-07-16 01:34:14 +00:00
@interface CSMachineLED: NSObject
@property(nonatomic, nonnull, readonly) NSString *name;
@property(nonatomic, readonly) BOOL isPersisent;
@end
// Deliberately low; to ensure CSMachine has been declared as an @class already.
#import "CSAtari2600.h"
#import "CSZX8081.h"
2021-06-08 01:21:45 +00:00
#import "CSAppleII.h"
@interface CSMachine : NSObject
+ (BOOL)attemptInstallROM:(nonnull NSURL *)url;
- (nonnull instancetype)init NS_UNAVAILABLE;
/*!
Initialises an instance of CSMachine.
@param result The CSStaticAnalyser result that describes the machine needed.
@param missingROMs An array that is filled with a list of ROMs that the machine requested but which
were not found; populated only if this `init` has failed.
*/
- (nullable instancetype)initWithAnalyser:(nonnull CSStaticAnalyser *)result missingROMs:(nullable inout NSMutableString *)missingROMs NS_DESIGNATED_INITIALIZER;
- (float)idealSamplingRateFromRange:(NSRange)range;
@property (readonly, getter=isStereo) BOOL stereo;
- (void)setAudioSamplingRate:(float)samplingRate bufferSize:(NSUInteger)bufferSize stereo:(BOOL)stereo;
- (void)setView:(nullable CSScanTargetView *)view aspectRatio:(float)aspectRatio;
- (void)start;
- (void)stop;
- (void)setKey:(uint16_t)key characters:(nullable NSString *)characters isPressed:(BOOL)isPressed;
- (void)clearAllKeys;
- (void)setMouseButton:(int)button isPressed:(BOOL)isPressed;
- (void)addMouseMotionX:(CGFloat)deltaX y:(CGFloat)deltaY;
2022-07-12 11:45:07 +00:00
@property (nonatomic, strong, nullable) CSAudioQueue *audioQueue;
@property (nonatomic, readonly, nonnull) CSScanTargetView *view;
@property (nonatomic, weak, nullable) id<CSMachineDelegate> delegate;
@property (nonatomic, readonly, nonnull) NSString *userDefaultsPrefix;
- (void)paste:(nonnull NSString *)string;
@property (nonatomic, readonly, nonnull) NSBitmapImageRep *imageRepresentation;
@property (nonatomic, assign) BOOL useFastLoadingHack;
2018-04-01 17:29:04 +00:00
@property (nonatomic, assign) CSMachineVideoSignal videoSignal;
@property (nonatomic, assign) BOOL useAutomaticTapeMotorControl;
@property (nonatomic, assign) BOOL useQuickBootingHack;
@property (nonatomic, readonly) BOOL canInsertMedia;
- (BOOL)supportsVideoSignal:(CSMachineVideoSignal)videoSignal;
// Volume contorl.
- (void)setVolume:(float)volume;
@property (nonatomic, readonly) BOOL hasAudioOutput;
2018-04-01 17:29:04 +00:00
// Input control.
@property (nonatomic, readonly) BOOL hasExclusiveKeyboard;
@property (nonatomic, readonly) BOOL shouldUsurpCommand;
@property (nonatomic, readonly) BOOL hasJoystick;
@property (nonatomic, readonly) BOOL hasMouse;
@property (nonatomic, assign) CSMachineKeyboardInputMode inputMode;
@property (nonatomic, nullable) CSJoystickManager *joystickManager;
// LED list.
2021-07-16 01:34:14 +00:00
@property (nonatomic, readonly, nonnull) NSArray<CSMachineLED *> *leds;
// Special-case accessors; undefined behaviour if accessed for a machine not of the corresponding type.
@property (nonatomic, readonly, nullable) CSAtari2600 *atari2600;
@property (nonatomic, readonly, nullable) CSZX8081 *zx8081;
2021-06-08 01:21:45 +00:00
@property (nonatomic, readonly, nullable) CSAppleII *appleII;
@end