1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-24 12:30:17 +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:
Thomas Harte 2016-04-18 08:21:00 -04:00
parent 6158275ea7
commit 94f148e212
6 changed files with 60 additions and 17 deletions

View File

@ -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)

View File

@ -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>

View File

@ -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() {

View File

@ -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)
}

View File

@ -21,5 +21,6 @@
- (void)drawViewForPixelSize:(CGSize)pixelSize onlyIfDirty:(BOOL)onlyIfDirty;
@property (nonatomic, assign) BOOL useFastLoadingHack;
@property (nonatomic, assign) BOOL useTelevisionOutput;
@end