mirror of
https://github.com/Luigi30/FruitMachine-Swift.git
synced 2025-02-16 23:31:01 +00:00
more preferences work
This commit is contained in:
parent
3bb4eed9d1
commit
a2b4003bb8
@ -58,15 +58,10 @@ class AppleI: NSObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runFrame() {
|
func runFrame() {
|
||||||
let startTime = CFAbsoluteTimeGetCurrent()
|
|
||||||
|
|
||||||
CPU.sharedInstance.cycles = 0
|
CPU.sharedInstance.cycles = 0
|
||||||
CPU.sharedInstance.cyclesInBatch = AppleI.CYCLES_PER_BATCH
|
CPU.sharedInstance.cyclesInBatch = AppleI.CYCLES_PER_BATCH
|
||||||
CPU.sharedInstance.runCyclesBatch()
|
CPU.sharedInstance.runCyclesBatch()
|
||||||
|
|
||||||
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
|
|
||||||
print("Time elapsed for runFrame: \(timeElapsed) s.")
|
|
||||||
|
|
||||||
//update the video display
|
//update the video display
|
||||||
CVPixelBufferLockBaseAddress(emulatorViewDelegate.pixels!, CVPixelBufferLockFlags(rawValue: 0))
|
CVPixelBufferLockBaseAddress(emulatorViewDelegate.pixels!, CVPixelBufferLockFlags(rawValue: 0))
|
||||||
let pixelBase = CVPixelBufferGetBaseAddress(emulatorViewDelegate.pixels!)
|
let pixelBase = CVPixelBufferGetBaseAddress(emulatorViewDelegate.pixels!)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
<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"/>
|
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||||
<rect key="contentRect" x="196" y="240" width="600" height="270"/>
|
<rect key="contentRect" x="196" y="240" width="600" height="270"/>
|
||||||
<rect key="screenRect" x="0.0" y="0.0" width="1916" height="936"/>
|
<rect key="screenRect" x="0.0" y="0.0" width="1916" height="936"/>
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<tabViewItems>
|
<tabViewItems>
|
||||||
<tabViewItem label="General" identifier="1" id="nQU-pA-pvF">
|
<tabViewItem label="General" identifier="1" id="nQU-pA-pvF">
|
||||||
<view key="view" id="iK8-x4-ay0">
|
<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"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
</view>
|
</view>
|
||||||
</tabViewItem>
|
</tabViewItem>
|
||||||
@ -102,6 +102,9 @@
|
|||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
|
<connections>
|
||||||
|
<action selector="btn_click_Monitor:" target="-2" id="3Je-Tb-j64"/>
|
||||||
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NzD-Hf-wKo">
|
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NzD-Hf-wKo">
|
||||||
<rect key="frame" x="421" y="149" width="81" height="32"/>
|
<rect key="frame" x="421" y="149" width="81" height="32"/>
|
||||||
@ -110,6 +113,9 @@
|
|||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
|
<connections>
|
||||||
|
<action selector="btn_click_Character:" target="-2" id="eI5-vI-eb4"/>
|
||||||
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cWc-WS-hPu">
|
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cWc-WS-hPu">
|
||||||
<rect key="frame" x="421" y="117" width="81" height="32"/>
|
<rect key="frame" x="421" y="117" width="81" height="32"/>
|
||||||
@ -118,6 +124,9 @@
|
|||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
|
<connections>
|
||||||
|
<action selector="btn_click_BASIC:" target="-2" id="DbT-4k-anJ"/>
|
||||||
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
</view>
|
</view>
|
||||||
|
@ -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? {
|
override var windowNibName : NSNib.Name? {
|
||||||
return NSNib.Name(rawValue: "PreferencesWindow")
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user