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-02-19 21:24:28 +00:00
|
|
|
#import "CSFastLoading.h"
|
2018-01-25 01:14:15 +00:00
|
|
|
#import "CSOpenGLView.h"
|
|
|
|
#import "CSStaticAnalyser.h"
|
2016-01-05 04:12:47 +00:00
|
|
|
|
2016-06-17 00:39:46 +00:00
|
|
|
@class CSMachine;
|
2018-03-22 13:48:19 +00:00
|
|
|
@protocol CSMachineDelegate
|
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,
|
|
|
|
CSMachineVideoSignalRGB
|
|
|
|
};
|
|
|
|
|
2018-06-13 23:22:34 +00:00
|
|
|
typedef NS_ENUM(NSInteger, CSMachineKeyboardInputMode) {
|
|
|
|
CSMachineKeyboardInputModeKeyboard,
|
|
|
|
CSMachineKeyboardInputModeJoystick
|
|
|
|
};
|
|
|
|
|
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"
|
|
|
|
|
2016-01-05 04:12:47 +00:00
|
|
|
@interface CSMachine : NSObject
|
|
|
|
|
2018-06-17 22:53:56 +00:00
|
|
|
- (nonnull instancetype)init NS_UNAVAILABLE;
|
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.
|
2017-08-27 20:36:21 +00:00
|
|
|
*/
|
2018-06-17 22:53:56 +00:00
|
|
|
- (nullable instancetype)initWithAnalyser:(nonnull CSStaticAnalyser *)result NS_DESIGNATED_INITIALIZER;
|
2017-08-27 20:36:21 +00:00
|
|
|
|
2018-03-22 02:18:13 +00:00
|
|
|
- (void)runForInterval:(NSTimeInterval)interval;
|
2016-06-01 02:16:20 +00:00
|
|
|
|
2016-06-13 23:30:41 +00:00
|
|
|
- (float)idealSamplingRateFromRange:(NSRange)range;
|
2016-06-17 00:51:35 +00:00
|
|
|
- (void)setAudioSamplingRate:(float)samplingRate bufferSize:(NSUInteger)bufferSize;
|
2016-06-01 23:04:07 +00:00
|
|
|
|
2018-06-17 22:53:56 +00:00
|
|
|
- (void)setView:(nullable CSOpenGLView *)view aspectRatio:(float)aspectRatio;
|
2016-06-01 02:16:20 +00:00
|
|
|
- (void)drawViewForPixelSize:(CGSize)pixelSize onlyIfDirty:(BOOL)onlyIfDirty;
|
2016-01-05 04:12:47 +00:00
|
|
|
|
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;
|
|
|
|
|
2018-06-17 22:53:56 +00:00
|
|
|
@property (nonatomic, strong, nullable) CSAudioQueue *audioQueue;
|
|
|
|
@property (nonatomic, readonly, nonnull) CSOpenGLView *view;
|
|
|
|
@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;
|
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;
|
|
|
|
|
2018-04-01 17:29:04 +00:00
|
|
|
- (bool)supportsVideoSignal:(CSMachineVideoSignal)videoSignal;
|
|
|
|
|
2018-06-13 23:22:34 +00:00
|
|
|
// Input control.
|
|
|
|
@property (nonatomic, readonly) BOOL hasKeyboard;
|
|
|
|
@property (nonatomic, readonly) BOOL hasJoystick;
|
|
|
|
@property (nonatomic, assign) CSMachineKeyboardInputMode inputMode;
|
|
|
|
|
2018-06-17 22:53:56 +00:00
|
|
|
// LED list.
|
|
|
|
@property (nonatomic, readonly, nonnull) NSArray<NSString *> *leds;
|
|
|
|
|
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;
|
2018-02-13 02:46:21 +00:00
|
|
|
|
2016-01-05 04:12:47 +00:00
|
|
|
@end
|