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
|
|
|
|
- (void)machineSpeakerDidChangeInputClock:(CSMachine *)machine;
|
|
|
|
@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
|
|
|
|
|
2017-08-27 20:36:21 +00:00
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
|
|
/*!
|
|
|
|
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-01-25 01:14:15 +00:00
|
|
|
- (instancetype)initWithAnalyser:(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
|
|
|
|
2016-04-12 03:12:56 +00:00
|
|
|
- (void)setView:(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-02-26 03:47:47 +00:00
|
|
|
- (void)setKey:(uint16_t)key characters:(NSString *)characters isPressed:(BOOL)isPressed;
|
2017-10-16 01:25:56 +00:00
|
|
|
- (void)clearAllKeys;
|
|
|
|
|
2016-06-15 12:07:59 +00:00
|
|
|
@property (nonatomic, strong) CSAudioQueue *audioQueue;
|
2016-04-25 00:34:25 +00:00
|
|
|
@property (nonatomic, readonly) CSOpenGLView *view;
|
2018-03-22 13:48:19 +00:00
|
|
|
@property (nonatomic, weak) id<CSMachineDelegate> delegate;
|
2016-09-13 02:06:03 +00:00
|
|
|
|
2016-10-03 01:56:50 +00:00
|
|
|
@property (nonatomic, readonly) NSString *userDefaultsPrefix;
|
|
|
|
|
2016-06-19 20:35:04 +00:00
|
|
|
- (void)paste:(NSString *)string;
|
|
|
|
|
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-02-13 02:46:21 +00:00
|
|
|
// Special-case accessors; undefined behaviour if accessed for a machine not of the corresponding type.
|
|
|
|
@property (nonatomic, readonly) CSAtari2600 *atari2600;
|
|
|
|
@property (nonatomic, readonly) CSZX8081 *zx8081;
|
|
|
|
|
2016-01-05 04:12:47 +00:00
|
|
|
@end
|