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