diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 16ccfa9a1..5062c7298 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -55,7 +55,7 @@ Machine::Machine() : _tape.set_delegate(this); } -void Machine::setup_output() +void Machine::setup_output(float aspect_ratio) { _crt = std::unique_ptr(new Outputs::CRT::CRT(crt_cycles_per_line, 8, Outputs::CRT::DisplayType::PAL50, 1)); _crt->set_rgb_sampling_function( diff --git a/Machines/Electron/Electron.hpp b/Machines/Electron/Electron.hpp index 9a7b44172..b95b947c9 100644 --- a/Machines/Electron/Electron.hpp +++ b/Machines/Electron/Electron.hpp @@ -151,7 +151,7 @@ class Machine: public CPU6502::Processor, Tape::Delegate { void set_key_state(Key key, bool isPressed); - void setup_output(); + void setup_output(float aspect_ratio); Outputs::CRT::CRT *get_crt() { return _crt.get(); } Outputs::Speaker *get_speaker() { return &_speaker; } diff --git a/OSBindings/Mac/Clock Signal/Base.lproj/ElectronDocument.xib b/OSBindings/Mac/Clock Signal/Base.lproj/ElectronDocument.xib index b0920d364..520b3577b 100644 --- a/OSBindings/Mac/Clock Signal/Base.lproj/ElectronDocument.xib +++ b/OSBindings/Mac/Clock Signal/Base.lproj/ElectronDocument.xib @@ -1,5 +1,5 @@ - + @@ -16,15 +16,15 @@ - + - + - + diff --git a/OSBindings/Mac/Clock Signal/Documents/Atari2600Document.swift b/OSBindings/Mac/Clock Signal/Documents/Atari2600Document.swift index 8e42b1186..6c586c360 100644 --- a/OSBindings/Mac/Clock Signal/Documents/Atari2600Document.swift +++ b/OSBindings/Mac/Clock Signal/Documents/Atari2600Document.swift @@ -18,7 +18,7 @@ class Atari2600Document: MachineDocument { override func windowControllerDidLoadNib(aController: NSWindowController) { super.windowControllerDidLoadNib(aController) - atari2600.view = openGLView + atari2600.setView(openGLView, aspectRatio: 4.0 / 3.0) } override class func autosavesInPlace() -> Bool { diff --git a/OSBindings/Mac/Clock Signal/Documents/ElectronDocument.swift b/OSBindings/Mac/Clock Signal/Documents/ElectronDocument.swift index 14aa80ef1..31ba148cb 100644 --- a/OSBindings/Mac/Clock Signal/Documents/ElectronDocument.swift +++ b/OSBindings/Mac/Clock Signal/Documents/ElectronDocument.swift @@ -16,6 +16,7 @@ class ElectronDocument: MachineDocument { override func windowControllerDidLoadNib(aController: NSWindowController) { super.windowControllerDidLoadNib(aController) self.intendedCyclesPerSecond = 2000000 + aController.window?.contentAspectRatio = NSSize(width: 11.0, height: 10.0) openGLView.performWithGLContext({ if let osPath = NSBundle.mainBundle().pathForResource("os", ofType: "rom") { self.electron.setOSROM(NSData(contentsOfFile: osPath)!) @@ -23,7 +24,7 @@ class ElectronDocument: MachineDocument { if let basicPath = NSBundle.mainBundle().pathForResource("basic", ofType: "rom") { self.electron.setBASICROM(NSData(contentsOfFile: basicPath)!) } - self.electron.view = self.openGLView + self.electron.setView(self.openGLView, aspectRatio: 11.0 / 10.0) self.electron.audioQueue = self.audioQueue }) } diff --git a/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.h b/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.h index 9cb9b48e6..e3ab2f8c5 100644 --- a/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.h +++ b/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.h @@ -11,8 +11,6 @@ @interface CSElectron : CSMachine -- (void)setupOutput; - - (void)setOSROM:(nonnull NSData *)rom; - (void)setBASICROM:(nonnull NSData *)rom; - (void)setROM:(nonnull NSData *)rom slot:(int)slot; diff --git a/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm b/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm index 4809a2a27..559caafdb 100644 --- a/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm +++ b/OSBindings/Mac/Clock Signal/Wrappers/CSElectron.mm @@ -152,9 +152,9 @@ } } -- (void)setupOutput { +- (void)setupOutputWithAspectRatio:(float)aspectRatio { @synchronized(self) { - _electron.setup_output(); + _electron.setup_output(aspectRatio); } } diff --git a/OSBindings/Mac/Clock Signal/Wrappers/CSMachine+Subclassing.h b/OSBindings/Mac/Clock Signal/Wrappers/CSMachine+Subclassing.h index 2c16901f3..be409e6be 100644 --- a/OSBindings/Mac/Clock Signal/Wrappers/CSMachine+Subclassing.h +++ b/OSBindings/Mac/Clock Signal/Wrappers/CSMachine+Subclassing.h @@ -16,6 +16,6 @@ - (void)speaker:(Outputs::Speaker *)speaker didCompleteSamples:(const int16_t *)samples length:(int)length; - (void)performAsync:(dispatch_block_t)action; - (void)performSync:(dispatch_block_t)action; -- (void)setupOutput; +- (void)setupOutputWithAspectRatio:(float)aspectRatio; @end diff --git a/OSBindings/Mac/Clock Signal/Wrappers/CSMachine.h b/OSBindings/Mac/Clock Signal/Wrappers/CSMachine.h index ee4b6759a..88bb5b682 100644 --- a/OSBindings/Mac/Clock Signal/Wrappers/CSMachine.h +++ b/OSBindings/Mac/Clock Signal/Wrappers/CSMachine.h @@ -13,8 +13,8 @@ @interface CSMachine : NSObject - (void)runForNumberOfCycles:(int)numberOfCycles; +- (void)setView:(CSOpenGLView *)view aspectRatio:(float)aspectRatio; -@property (nonatomic, weak) CSOpenGLView *view; @property (nonatomic, weak) AudioQueue *audioQueue; @end diff --git a/OSBindings/Mac/Clock Signal/Wrappers/CSMachine.mm b/OSBindings/Mac/Clock Signal/Wrappers/CSMachine.mm index 8530a595f..cf19e4b9f 100644 --- a/OSBindings/Mac/Clock Signal/Wrappers/CSMachine.mm +++ b/OSBindings/Mac/Clock Signal/Wrappers/CSMachine.mm @@ -51,12 +51,11 @@ struct SpeakerDelegate: public Outputs::Speaker::Delegate { dispatch_async(_serialDispatchQueue, action); } -- (void)setupOutput {} +- (void)setupOutputWithAspectRatio:(float)aspectRatio {} -- (void)setView:(CSOpenGLView *)view { - _view = view; +- (void)setView:(CSOpenGLView *)view aspectRatio:(float)aspectRatio { [view performWithGLContext:^{ - [self setupOutput]; + [self setupOutputWithAspectRatio:aspectRatio]; }]; }