2016-01-05 04:12:47 +00:00
|
|
|
//
|
|
|
|
// CSMachine.h
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 04/01/2016.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2016 Thomas Harte. All rights reserved.
|
2016-01-05 04:12:47 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
2018-01-25 01:14:15 +00:00
|
|
|
|
2016-06-15 12:07:25 +00:00
|
|
|
#import "CSAudioQueue.h"
|
2018-07-22 20:55:47 +00:00
|
|
|
#import "CSJoystickManager.h"
|
2020-08-04 22:22:14 +00:00
|
|
|
#import "CSScanTargetView.h"
|
|
|
|
#import "CSStaticAnalyser.h"
|
2016-01-05 04:12:47 +00:00
|
|
|
|
2016-06-17 00:39:46 +00:00
|
|
|
@class CSMachine;
|
2020-12-31 20:23:46 +00:00
|
|
|
@protocol CSMachineDelegate <NSObject>
|
2018-06-17 22:53:56 +00:00
|
|
|
- (void)machineSpeakerDidChangeInputClock:(nonnull CSMachine *)machine;
|
2018-06-19 01:22:51 +00:00
|
|
|
- (void)machine:(nonnull CSMachine *)machine led:(nonnull NSString *)led didChangeToLit:(BOOL)isLit;
|
|
|
|
- (void)machine:(nonnull CSMachine *)machine ledShouldBlink:(nonnull NSString *)led;
|
2018-03-22 13:48:19 +00:00
|
|
|
@end
|
2016-06-17 00:39:46 +00:00
|
|
|
|
2018-04-01 17:29:04 +00:00
|
|
|
typedef NS_ENUM(NSInteger, CSMachineVideoSignal) {
|
|
|
|
CSMachineVideoSignalComposite,
|
|
|
|
CSMachineVideoSignalSVideo,
|
2019-02-13 00:52:32 +00:00
|
|
|
CSMachineVideoSignalRGB,
|
|
|
|
CSMachineVideoSignalMonochromeComposite
|
2018-04-01 17:29:04 +00:00
|
|
|
};
|
|
|
|
|
2018-06-13 23:22:34 +00:00
|
|
|
typedef NS_ENUM(NSInteger, CSMachineKeyboardInputMode) {
|
2020-02-29 23:17:39 +00:00
|
|
|
CSMachineKeyboardInputModeKeyboardPhysical,
|
|
|
|
CSMachineKeyboardInputModeKeyboardLogical,
|
|
|
|
CSMachineKeyboardInputModeJoystick,
|
2018-06-13 23:22:34 +00:00
|
|
|
};
|
|
|
|
|
2021-07-16 01:34:14 +00:00
|
|
|
@interface CSMachineLED: NSObject
|
|
|
|
@property(nonatomic, nonnull, readonly) NSString *name;
|
|
|
|
@property(nonatomic, readonly) BOOL isPersisent;
|
|
|
|
@end
|
|
|
|
|
2018-02-13 02:46:21 +00:00
|
|
|
// 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"
|
2018-02-13 02:46:21 +00:00
|
|
|
|
2016-01-05 04:12:47 +00:00
|
|
|
@interface CSMachine : NSObject
|
|
|
|
|
2021-06-06 18:56:43 +00:00
|
|
|
+ (BOOL)attemptInstallROM:(nonnull NSURL *)url;
|
2021-06-06 18:24:38 +00:00
|
|
|
|
2018-06-17 22:53:56 +00:00
|
|
|
- (nonnull instancetype)init NS_UNAVAILABLE;
|
2018-08-06 22:52:42 +00:00
|
|
|
|
2017-08-27 20:36:21 +00:00
|
|
|
/*!
|
|
|
|
Initialises an instance of CSMachine.
|
2017-11-08 03:51:06 +00:00
|
|
|
|
2018-01-25 01:14:15 +00:00
|
|
|
@param result The CSStaticAnalyser result that describes the machine needed.
|
2019-07-22 02:05:22 +00:00
|
|
|
@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.
|
2017-08-27 20:36:21 +00:00
|
|
|
*/
|
2021-06-06 18:56:43 +00:00
|
|
|
- (nullable instancetype)initWithAnalyser:(nonnull CSStaticAnalyser *)result missingROMs:(nullable inout NSMutableString *)missingROMs NS_DESIGNATED_INITIALIZER;
|
2017-08-27 20:36:21 +00:00
|
|
|
|
2016-06-13 23:30:41 +00:00
|
|
|
- (float)idealSamplingRateFromRange:(NSRange)range;
|
2020-12-31 20:23:46 +00:00
|
|
|
@property (readonly, getter=isStereo) BOOL stereo;
|
2020-02-16 19:05:50 +00:00
|
|
|
- (void)setAudioSamplingRate:(float)samplingRate bufferSize:(NSUInteger)bufferSize stereo:(BOOL)stereo;
|
2016-06-01 23:04:07 +00:00
|
|
|
|
2020-08-04 22:22:14 +00:00
|
|
|
- (void)setView:(nullable CSScanTargetView *)view aspectRatio:(float)aspectRatio;
|
2019-03-03 00:33:28 +00:00
|
|
|
|
2020-02-03 02:39:20 +00:00
|
|
|
- (void)start;
|
|
|
|
- (void)stop;
|
|
|
|
|
2018-06-17 22:53:56 +00:00
|
|
|
- (void)setKey:(uint16_t)key characters:(nullable NSString *)characters isPressed:(BOOL)isPressed;
|
2017-10-16 01:25:56 +00:00
|
|
|
- (void)clearAllKeys;
|
|
|
|
|
2019-06-11 22:41:41 +00:00
|
|
|
- (void)setMouseButton:(int)button isPressed:(BOOL)isPressed;
|
|
|
|
- (void)addMouseMotionX:(CGFloat)deltaX y:(CGFloat)deltaY;
|
|
|
|
|
2020-02-19 03:31:24 +00:00
|
|
|
@property (atomic, strong, nullable) CSAudioQueue *audioQueue;
|
2020-08-04 22:22:14 +00:00
|
|
|
@property (nonatomic, readonly, nonnull) CSScanTargetView *view;
|
2018-06-17 22:53:56 +00:00
|
|
|
@property (nonatomic, weak, nullable) id<CSMachineDelegate> delegate;
|
2016-09-13 02:06:03 +00:00
|
|
|
|
2018-06-17 22:53:56 +00:00
|
|
|
@property (nonatomic, readonly, nonnull) NSString *userDefaultsPrefix;
|
2016-10-03 01:56:50 +00:00
|
|
|
|
2018-06-17 22:53:56 +00:00
|
|
|
- (void)paste:(nonnull NSString *)string;
|
2018-07-28 03:37:24 +00:00
|
|
|
@property (nonatomic, readonly, nonnull) NSBitmapImageRep *imageRepresentation;
|
2016-06-19 20:35:04 +00:00
|
|
|
|
2017-11-25 02:36:22 +00:00
|
|
|
@property (nonatomic, assign) BOOL useFastLoadingHack;
|
2018-04-01 17:29:04 +00:00
|
|
|
@property (nonatomic, assign) CSMachineVideoSignal videoSignal;
|
2017-11-25 02:36:22 +00:00
|
|
|
@property (nonatomic, assign) BOOL useAutomaticTapeMotorControl;
|
2019-09-20 02:32:12 +00:00
|
|
|
@property (nonatomic, assign) BOOL useQuickBootingHack;
|
2017-11-25 02:36:22 +00:00
|
|
|
|
2018-08-06 22:52:42 +00:00
|
|
|
@property (nonatomic, readonly) BOOL canInsertMedia;
|
|
|
|
|
2020-03-22 17:24:23 +00:00
|
|
|
- (BOOL)supportsVideoSignal:(CSMachineVideoSignal)videoSignal;
|
|
|
|
|
|
|
|
// Volume contorl.
|
|
|
|
- (void)setVolume:(float)volume;
|
|
|
|
@property (nonatomic, readonly) BOOL hasAudioOutput;
|
2018-04-01 17:29:04 +00:00
|
|
|
|
2018-06-13 23:22:34 +00:00
|
|
|
// Input control.
|
2018-10-25 01:59:30 +00:00
|
|
|
@property (nonatomic, readonly) BOOL hasExclusiveKeyboard;
|
2019-09-22 17:53:38 +00:00
|
|
|
@property (nonatomic, readonly) BOOL shouldUsurpCommand;
|
2018-06-13 23:22:34 +00:00
|
|
|
@property (nonatomic, readonly) BOOL hasJoystick;
|
2019-06-11 22:21:56 +00:00
|
|
|
@property (nonatomic, readonly) BOOL hasMouse;
|
2018-06-13 23:22:34 +00:00
|
|
|
@property (nonatomic, assign) CSMachineKeyboardInputMode inputMode;
|
2018-07-22 20:55:47 +00:00
|
|
|
@property (nonatomic, nullable) CSJoystickManager *joystickManager;
|
2018-06-13 23:22:34 +00:00
|
|
|
|
2018-06-17 22:53:56 +00:00
|
|
|
// LED list.
|
2021-07-16 01:34:14 +00:00
|
|
|
@property (nonatomic, readonly, nonnull) NSArray<CSMachineLED *> *leds;
|
2018-06-17 22:53:56 +00:00
|
|
|
|
2018-02-13 02:46:21 +00:00
|
|
|
// Special-case accessors; undefined behaviour if accessed for a machine not of the corresponding type.
|
2018-06-17 22:53:56 +00:00
|
|
|
@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;
|
2018-02-13 02:46:21 +00:00
|
|
|
|
2016-01-05 04:12:47 +00:00
|
|
|
@end
|