more preferences work

This commit is contained in:
Luigi Thirty 2017-07-31 22:39:28 -04:00
parent 3bb4eed9d1
commit a2b4003bb8
3 changed files with 66 additions and 8 deletions

View File

@ -57,16 +57,11 @@ class AppleI: NSObject {
CPU.sharedInstance.memoryInterface.read_overrides.append(PIAOverrides.readKBDCR)
}
func runFrame() {
let startTime = CFAbsoluteTimeGetCurrent()
func runFrame() {
CPU.sharedInstance.cycles = 0
CPU.sharedInstance.cyclesInBatch = AppleI.CYCLES_PER_BATCH
CPU.sharedInstance.runCyclesBatch()
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
print("Time elapsed for runFrame: \(timeElapsed) s.")
//update the video display
CVPixelBufferLockBaseAddress(emulatorViewDelegate.pixels!, CVPixelBufferLockFlags(rawValue: 0))
let pixelBase = CVPixelBufferGetBaseAddress(emulatorViewDelegate.pixels!)

View File

@ -17,7 +17,7 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="600" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1916" height="936"/>
@ -32,7 +32,7 @@
<tabViewItems>
<tabViewItem label="General" identifier="1" id="nQU-pA-pvF">
<view key="view" id="iK8-x4-ay0">
<rect key="frame" x="10" y="33" width="554" height="208"/>
<rect key="frame" x="10" y="33" width="137" height="0.0"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
</tabViewItem>
@ -102,6 +102,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="btn_click_Monitor:" target="-2" id="3Je-Tb-j64"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NzD-Hf-wKo">
<rect key="frame" x="421" y="149" width="81" height="32"/>
@ -110,6 +113,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="btn_click_Character:" target="-2" id="eI5-vI-eb4"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cWc-WS-hPu">
<rect key="frame" x="421" y="117" width="81" height="32"/>
@ -118,6 +124,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="btn_click_BASIC:" target="-2" id="DbT-4k-anJ"/>
</connections>
</button>
</subviews>
</view>

View File

@ -36,8 +36,62 @@ class PreferencesWindowController: NSWindowController {
}
}
func windowWillClose(_ notification: Notification) {
defaults.set(path_ROMMonitor.stringValue, forKey: "path_ROMMonitor")
defaults.set(path_ROMCharacter.stringValue, forKey: "path_ROMCharacter")
defaults.set(path_ROMBasic.stringValue, forKey: "path_ROMBasic")
defaults.synchronize()
}
override var windowNibName : NSNib.Name? {
return NSNib.Name(rawValue: "PreferencesWindow")
}
@IBAction func btn_click_Monitor(_ sender: NSButton) {
let picker = NSOpenPanel()
picker.title = "Select your Monitor ROM (apple1.rom)"
picker.showsHiddenFiles = false
picker.canChooseFiles = true
picker.canChooseDirectories = false
picker.allowsMultipleSelection = false
picker.allowedFileTypes = ["rom"]
if(picker.runModal() == .OK) {
path_ROMMonitor.stringValue = picker.url!.path
}
}
@IBAction func btn_click_Character(_ sender: NSButton) {
let picker = NSOpenPanel()
picker.title = "Select your Monitor ROM (apple1.vid)"
picker.showsHiddenFiles = false
picker.canChooseFiles = true
picker.canChooseDirectories = false
picker.allowsMultipleSelection = false
picker.allowedFileTypes = ["vid"]
if(picker.runModal() == .OK) {
path_ROMCharacter.stringValue = picker.url!.path
}
}
@IBAction func btn_click_BASIC(_ sender: NSButton) {
let picker = NSOpenPanel()
picker.title = "Select your Monitor ROM (basic.bin)"
picker.showsHiddenFiles = false
picker.canChooseFiles = true
picker.canChooseDirectories = false
picker.allowsMultipleSelection = false
picker.allowedFileTypes = ["bin"]
if(picker.runModal() == .OK) {
path_ROMBasic.stringValue = picker.url!.path
}
}
}