mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-23 20:29:42 +00:00
Wired in options, at least getting as far as the Objective-C bridge. Then fast loading makes it to the emulated machine, display output type doesn't.
This commit is contained in:
parent
6158275ea7
commit
94f148e212
@ -32,7 +32,7 @@ namespace {
|
||||
static const unsigned int real_time_clock_interrupt_1 = 16704;
|
||||
static const unsigned int real_time_clock_interrupt_2 = 56704;
|
||||
|
||||
static const unsigned int clock_rate_audio_divider = 1;
|
||||
static const unsigned int clock_rate_audio_divider = 8;
|
||||
}
|
||||
|
||||
#define graphics_line(v) ((((v) >> 7) - first_graphics_line + field_divider_line) % field_divider_line)
|
||||
|
@ -4,8 +4,10 @@
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="Atari2600Document" customModule="Clock_Signal" customModuleProvider="target">
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="ElectronDocument" customModule="Clock_Signal" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="displayTypeButton" destination="rh8-km-57n" id="4Np-OD-NLO"/>
|
||||
<outlet property="fastLoadingButton" destination="e1J-pw-zGw" id="yck-sy-WRa"/>
|
||||
<outlet property="openGLView" destination="gIp-Ho-8D9" id="GVg-Gs-Zn9"/>
|
||||
<outlet property="optionsPanel" destination="ZW7-Bw-4RP" id="JpE-wG-zRR"/>
|
||||
<outlet property="window" destination="xOd-HO-29H" id="JIz-fz-R2o"/>
|
||||
@ -28,8 +30,8 @@
|
||||
<outlet property="delegate" destination="-2" id="0bl-1N-x8E"/>
|
||||
</connections>
|
||||
</window>
|
||||
<window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" frameAutosaveName="" animationBehavior="default" id="ZW7-Bw-4RP" customClass="NSPanel">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" utility="YES" nonactivatingPanel="YES" HUD="YES"/>
|
||||
<window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="ZW7-Bw-4RP" customClass="NSPanel">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" nonactivatingPanel="YES" HUD="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="83" y="102" width="200" height="83"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1366" height="768"/>
|
||||
@ -45,19 +47,25 @@
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFastLoading:" target="-2" id="CTb-Dn-QiP"/>
|
||||
</connections>
|
||||
</button>
|
||||
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rh8-km-57n">
|
||||
<rect key="frame" x="18" y="17" width="165" height="26"/>
|
||||
<popUpButtonCell key="cell" type="push" title="Monitor" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="tJM-kX-gaK" id="8SX-c5-ud1">
|
||||
<popUpButtonCell key="cell" type="push" title="Monitor" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="tJM-kX-gaK" id="8SX-c5-ud1">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" id="L06-TO-EF0">
|
||||
<items>
|
||||
<menuItem title="Monitor" id="tJM-kX-gaK"/>
|
||||
<menuItem title="Monitor" state="on" id="tJM-kX-gaK"/>
|
||||
<menuItem title="Television" id="fFm-fS-rWG"/>
|
||||
</items>
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
<connections>
|
||||
<action selector="setDisplayType:" target="-2" id="kgH-SR-fI3"/>
|
||||
</connections>
|
||||
</popUpButton>
|
||||
</subviews>
|
||||
<constraints>
|
||||
|
@ -27,6 +27,7 @@ class ElectronDocument: MachineDocument {
|
||||
self.electron.setView(self.openGLView, aspectRatio: 11.0 / 10.0)
|
||||
self.electron.audioQueue = self.audioQueue
|
||||
})
|
||||
establishStoredOptions()
|
||||
}
|
||||
|
||||
override var windowNibName: String? {
|
||||
@ -41,7 +42,6 @@ class ElectronDocument: MachineDocument {
|
||||
switch pathExtension.lowercaseString {
|
||||
case "uef":
|
||||
electron.openUEFAtURL(url)
|
||||
electron.useFastLoadingHack = true
|
||||
return
|
||||
default: break;
|
||||
}
|
||||
@ -71,6 +71,40 @@ class ElectronDocument: MachineDocument {
|
||||
super.close()
|
||||
}
|
||||
|
||||
// MARK: IBActions
|
||||
@IBOutlet var displayTypeButton: NSPopUpButton!
|
||||
@IBAction func setDisplayType(sender: NSPopUpButton!) {
|
||||
switch sender.indexOfSelectedItem {
|
||||
case 1: electron.useTelevisionOutput = false
|
||||
default: electron.useTelevisionOutput = true
|
||||
}
|
||||
NSUserDefaults.standardUserDefaults().setInteger(sender.indexOfSelectedItem, forKey: self.displayTypeUserDefaultsKey)
|
||||
}
|
||||
|
||||
@IBOutlet var fastLoadingButton: NSButton!
|
||||
@IBAction func setFastLoading(sender: NSButton!) {
|
||||
electron.useFastLoadingHack = sender.state == NSOnState
|
||||
NSUserDefaults.standardUserDefaults().setBool(electron.useFastLoadingHack, forKey: self.fastLoadingUserDefaultsKey)
|
||||
}
|
||||
|
||||
private let displayTypeUserDefaultsKey = "electron.displayType"
|
||||
private let fastLoadingUserDefaultsKey = "electron.fastLoading"
|
||||
private func establishStoredOptions() {
|
||||
let standardUserDefaults = NSUserDefaults.standardUserDefaults()
|
||||
standardUserDefaults.registerDefaults([
|
||||
displayTypeUserDefaultsKey: 0,
|
||||
fastLoadingUserDefaultsKey: true
|
||||
])
|
||||
|
||||
let useFastLoadingHack = standardUserDefaults.boolForKey(self.fastLoadingUserDefaultsKey)
|
||||
electron.useFastLoadingHack = useFastLoadingHack
|
||||
self.fastLoadingButton.state = useFastLoadingHack ? NSOnState : NSOffState
|
||||
|
||||
let displayType = standardUserDefaults.integerForKey(self.displayTypeUserDefaultsKey)
|
||||
electron.useTelevisionOutput = (displayType == 1)
|
||||
self.displayTypeButton.selectItemAtIndex(displayType)
|
||||
}
|
||||
|
||||
// MARK: CSOpenGLViewDelegate
|
||||
override func runForNumberOfCycles(numberOfCycles: Int32) {
|
||||
if actionLock.tryLock() {
|
||||
|
@ -19,7 +19,7 @@ class MachineDocument: NSDocument, CSOpenGLViewDelegate, CSOpenGLViewResponderDe
|
||||
}
|
||||
|
||||
@IBOutlet weak var optionsPanel: NSPanel!
|
||||
@IBAction func showOptions(sender: AnyObject?) {
|
||||
@IBAction func showOptions(sender: AnyObject!) {
|
||||
optionsPanel?.setIsVisible(true)
|
||||
}
|
||||
|
||||
|
@ -21,5 +21,6 @@
|
||||
- (void)drawViewForPixelSize:(CGSize)pixelSize onlyIfDirty:(BOOL)onlyIfDirty;
|
||||
|
||||
@property (nonatomic, assign) BOOL useFastLoadingHack;
|
||||
@property (nonatomic, assign) BOOL useTelevisionOutput;
|
||||
|
||||
@end
|
||||
|
@ -112,25 +112,25 @@
|
||||
case VK_ANSI_Grave:
|
||||
case VK_ANSI_Backslash:
|
||||
_electron.set_key_state(Electron::Key::KeyCopy, isPressed); break;
|
||||
case VK_Return: _electron.set_key_state(Electron::Key::KeyReturn, isPressed); break;
|
||||
case VK_ANSI_Minus: _electron.set_key_state(Electron::Key::KeyMinus, isPressed); break;
|
||||
case VK_Return: _electron.set_key_state(Electron::Key::KeyReturn, isPressed); break;
|
||||
case VK_ANSI_Minus: _electron.set_key_state(Electron::Key::KeyMinus, isPressed); break;
|
||||
|
||||
case VK_RightArrow: _electron.set_key_state(Electron::Key::KeyRight, isPressed); break;
|
||||
case VK_RightArrow: _electron.set_key_state(Electron::Key::KeyRight, isPressed); break;
|
||||
case VK_LeftArrow: _electron.set_key_state(Electron::Key::KeyLeft, isPressed); break;
|
||||
case VK_DownArrow: _electron.set_key_state(Electron::Key::KeyDown, isPressed); break;
|
||||
case VK_UpArrow: _electron.set_key_state(Electron::Key::KeyUp, isPressed); break;
|
||||
|
||||
case VK_Delete: _electron.set_key_state(Electron::Key::KeyDelete, isPressed); break;
|
||||
case VK_Escape: _electron.set_key_state(Electron::Key::KeyEscape, isPressed); break;
|
||||
case VK_Delete: _electron.set_key_state(Electron::Key::KeyDelete, isPressed); break;
|
||||
case VK_Escape: _electron.set_key_state(Electron::Key::KeyEscape, isPressed); break;
|
||||
|
||||
case VK_ANSI_Comma: _electron.set_key_state(Electron::Key::KeyComma, isPressed); break;
|
||||
case VK_ANSI_Comma: _electron.set_key_state(Electron::Key::KeyComma, isPressed); break;
|
||||
case VK_ANSI_Period: _electron.set_key_state(Electron::Key::KeyFullStop, isPressed); break;
|
||||
|
||||
case VK_ANSI_Semicolon:
|
||||
_electron.set_key_state(Electron::Key::KeySemiColon, isPressed); break;
|
||||
case VK_ANSI_Quote: _electron.set_key_state(Electron::Key::KeyColon, isPressed); break;
|
||||
case VK_ANSI_Quote: _electron.set_key_state(Electron::Key::KeyColon, isPressed); break;
|
||||
|
||||
case VK_ANSI_Slash: _electron.set_key_state(Electron::Key::KeySlash, isPressed); break;
|
||||
case VK_ANSI_Slash: _electron.set_key_state(Electron::Key::KeySlash, isPressed); break;
|
||||
|
||||
case VK_Shift: _electron.set_key_state(Electron::Key::KeyShift, isPressed); break;
|
||||
case VK_Control: _electron.set_key_state(Electron::Key::KeyControl, isPressed); break;
|
||||
|
Loading…
Reference in New Issue
Block a user