diff --git a/GUI/Dialogs/Configuration/Configuration.swift b/GUI/Dialogs/Configuration/Configuration.swift
index 4ef3b0102..46136091c 100644
--- a/GUI/Dialogs/Configuration/Configuration.swift
+++ b/GUI/Dialogs/Configuration/Configuration.swift
@@ -104,38 +104,47 @@ class Configuration {
precondition(0 <= n && n <= 3)
return amiga.get(.DRIVE_CONNECT, drive: n) != 0
}
+
func setDfnConnected(_ n: Int, connect: Bool) {
precondition(0 <= n && n <= 3)
amiga.set(.DRIVE_CONNECT, drive: n, enable: connect)
}
+
func dfnType(_ n: Int) -> Int {
precondition(0 <= n && n <= 3)
return amiga.get(.DRIVE_TYPE, drive: n)
}
+
func setDfnType(_ n: Int, type: Int) {
precondition(0 <= n && n <= 3)
amiga.set(.DRIVE_TYPE, drive: n, value: type)
}
+
func dfnRpm(_ n: Int) -> Int {
precondition(0 <= n && n <= 3)
return amiga.get(.DRIVE_RPM, drive: n)
}
+
func setDfnRpm(_ n: Int, type: Int) {
precondition(0 <= n && n <= 3)
amiga.set(.DRIVE_RPM, drive: n, value: type)
}
+
func hdnConnected(_ n: Int) -> Bool {
precondition(0 <= n && n <= 3)
return amiga.get(.HDC_CONNECT, drive: n) != 0
}
+
func setHdnConnected(_ n: Int, connect: Bool) {
precondition(0 <= n && n <= 3)
amiga.set(.HDC_CONNECT, drive: n, enable: connect)
}
+
func hdnType(_ n: Int) -> Int {
precondition(0 <= n && n <= 3)
return amiga.get(.HDR_TYPE, drive: n)
}
+
func setHdnType(_ n: Int, type: Int) {
precondition(0 <= n && n <= 3)
amiga.set(.HDR_TYPE, drive: n, value: type)
@@ -145,83 +154,101 @@ class Configuration {
get { return dfnConnected(0) }
set { setDfnConnected(0, connect: newValue) }
}
+
var df0Type: Int {
get { return dfnType(0) }
set { setDfnType(0, type: newValue) }
}
+
var df0Rpm: Int {
get { return dfnRpm(0) }
set { setDfnRpm(0, type: newValue) }
}
+
var df1Connected: Bool {
get { return dfnConnected(1) }
set { setDfnConnected(1, connect: newValue) }
}
+
var df1Type: Int {
get { return dfnType(1) }
set { setDfnType(1, type: newValue) }
}
+
var df1Rpm: Int {
get { return dfnRpm(1) }
set { setDfnRpm(1, type: newValue) }
}
+
var df2Connected: Bool {
get { return dfnConnected(2) }
set { setDfnConnected(2, connect: newValue) }
}
+
var df2Type: Int {
get { return dfnType(2) }
set { setDfnType(2, type: newValue) }
}
+
var df2Rpm: Int {
get { return dfnRpm(2) }
set { setDfnRpm(2, type: newValue) }
}
+
var df3Connected: Bool {
get { return dfnConnected(3) }
set { setDfnConnected(3, connect: newValue) }
}
+
var df3Type: Int {
get { return dfnType(3) }
set { setDfnType(3, type: newValue) }
}
+
var df3Rpm: Int {
get { return dfnRpm(3) }
set { setDfnRpm(3, type: newValue) }
}
+
var hd0Connected: Bool {
get { return hdnConnected(0) }
set { setHdnConnected(0, connect: newValue) }
}
+
var hd0Type: Int {
get { return hdnType(0) }
set { setHdnType(0, type: newValue) }
}
+
var hd1Connected: Bool {
get { return hdnConnected(1) }
set { setHdnConnected(1, connect: newValue) }
}
+
var hd1Type: Int {
get { return hdnType(1) }
set { setHdnType(1, type: newValue) }
}
+
var hd2Connected: Bool {
get { return hdnConnected(2) }
set { setHdnConnected(2, connect: newValue) }
}
+
var hd2Type: Int {
get { return hdnType(2) }
set { setHdnType(2, type: newValue) }
}
+
var hd3Connected: Bool {
get { return hdnConnected(3) }
set { setHdnConnected(3, connect: newValue) }
}
+
var hd3Type: Int {
get { return hdnType(3) }
set { setHdnType(3, type: newValue) }
}
- // var hdPersist = [ false, false, false, false ]
var gameDevice1 = -1 {
didSet {
@@ -237,6 +264,7 @@ class Configuration {
parent.toolbar.validateVisibleItems()
}
}
+
var gameDevice2 = -1 {
didSet {
@@ -251,10 +279,32 @@ class Configuration {
parent.toolbar.validateVisibleItems()
}
}
+
+ var autofire: Bool {
+ get { return amiga.get(.JOY_AUTOFIRE, id: 1) != 0 }
+ set { amiga.set(.JOY_AUTOFIRE, enable: newValue) }
+ }
+
+ var autofireBursts: Bool {
+ get { return amiga.get(.JOY_AUTOFIRE_BURSTS, id: 1) != 0 }
+ set { amiga.set(.JOY_AUTOFIRE_BURSTS, enable: newValue) }
+ }
+
+ var autofireBullets: Int {
+ get { return amiga.get(.JOY_AUTOFIRE_BULLETS, id: 1) }
+ set { amiga.set(.JOY_AUTOFIRE_BULLETS, value: newValue) }
+ }
+
+ var autofireFrequency: Int {
+ get { return amiga.get(.JOY_AUTOFIRE_DELAY, id: 1) }
+ set { amiga.set(.JOY_AUTOFIRE_DELAY, value: newValue) }
+ }
+
var serialDevice: Int {
get { return amiga.get(.SER_DEVICE) }
set { amiga.set(.SER_DEVICE, value: newValue) }
}
+
var serialDevicePort: Int {
get { return amiga.get(.SRV_PORT, id: ServerType.SER.rawValue) }
set { amiga.set(.SRV_PORT, id: ServerType.SER.rawValue, value: newValue) }
diff --git a/GUI/Dialogs/Configuration/ConfigurationController.swift b/GUI/Dialogs/Configuration/ConfigurationController.swift
index a5904af55..2e0ebf995 100644
--- a/GUI/Dialogs/Configuration/ConfigurationController.swift
+++ b/GUI/Dialogs/Configuration/ConfigurationController.swift
@@ -146,6 +146,17 @@ class ConfigurationController: DialogController {
@IBOutlet weak var perSerialPort: NSTextField!
@IBOutlet weak var perSerialPortText: NSTextField!
+ // Joystick
+ @IBOutlet weak var perAutofire: NSButton!
+ @IBOutlet weak var perAutofireText: NSTextField!
+ @IBOutlet weak var perAutofireFrequency: NSSlider!
+ @IBOutlet weak var perAutofireFrequencyText1: NSTextField!
+ @IBOutlet weak var perAutofireFrequencyText2: NSTextField!
+ @IBOutlet weak var perAutofireCease: NSButton!
+ @IBOutlet weak var perAutofireCeaseText: NSTextField!
+ @IBOutlet weak var perAutofireBullets: NSTextField!
+ @IBOutlet weak var perAutofireBulletsText: NSTextField!
+
// Lock
@IBOutlet weak var perLockImage: NSButton!
@IBOutlet weak var perLockInfo1: NSTextField!
@@ -390,3 +401,26 @@ extension ConfigurationController: NSTabViewDelegate {
refresh()
}
}
+
+extension ConfigurationController: NSTextFieldDelegate {
+
+ func controlTextDidChange(_ obj: Notification) {
+
+ if let view = obj.object as? NSTextField {
+
+ let formatter = view.formatter as? NumberFormatter
+
+ switch view {
+
+ case perAutofireBullets:
+
+ if formatter?.number(from: view.stringValue) != nil {
+ perAutofireBulletsAction(view)
+ }
+
+ default:
+ break
+ }
+ }
+ }
+}
diff --git a/GUI/Dialogs/Configuration/PeripheralsConf.swift b/GUI/Dialogs/Configuration/PeripheralsConf.swift
index 7739b4a7e..039e4a16f 100644
--- a/GUI/Dialogs/Configuration/PeripheralsConf.swift
+++ b/GUI/Dialogs/Configuration/PeripheralsConf.swift
@@ -11,6 +11,14 @@ extension ConfigurationController {
func refreshPeripheralsTab() {
+ func update(_ component: NSTextField, enable: Bool) {
+ component.textColor = enable ? .controlTextColor : .disabledControlTextColor
+ component.isEnabled = enable
+ }
+ func update(_ component: NSControl, enable: Bool) {
+ component.isEnabled = enable
+ }
+
let poweredOff = emu.poweredOff
// Floppy drives
@@ -43,6 +51,20 @@ extension ConfigurationController {
perSerialPort.isHidden = config.serialDevice != nullmodem
perSerialPortText.isHidden = config.serialDevice != nullmodem
+ // Joysticks
+ let enable = config.autofire
+ perAutofire.state = enable ? .on : .off
+ perAutofireCease.state = config.autofireBursts ? .on : .off
+ perAutofireBullets.integerValue = config.autofireBullets
+ perAutofireFrequency.integerValue = config.autofireFrequency
+ update(perAutofireFrequency, enable: enable)
+ update(perAutofireFrequencyText1, enable: enable)
+ update(perAutofireFrequencyText2, enable: enable)
+ update(perAutofireCease, enable: enable)
+ update(perAutofireCeaseText, enable: enable)
+ update(perAutofireBullets, enable: enable && perAutofireCease.state == .on)
+ update(perAutofireBulletsText, enable: enable && perAutofireCease.state == .on)
+
// Lock controls if emulator is powered on
perDf1Connect.isEnabled = poweredOff
perDf2Connect.isEnabled = poweredOff && perDf1Connect.state == .on
@@ -120,6 +142,26 @@ extension ConfigurationController {
}
}
+ @IBAction func perAutofireAction(_ sender: NSButton!) {
+
+ config.autofire = (sender.state == .on)
+ }
+
+ @IBAction func perAutofireCeaseAction(_ sender: NSButton!) {
+
+ config.autofireBursts = (sender.state == .on)
+ }
+
+ @IBAction func perAutofireBulletsAction(_ sender: NSTextField!) {
+
+ config.autofireBullets = sender.integerValue
+ }
+
+ @IBAction func perAutofireFrequencyAction(_ sender: NSSlider!) {
+
+ config.autofireFrequency = sender.integerValue
+ }
+
@IBAction func perSerialDeviceAction(_ sender: NSPopUpButton!) {
config.serialDevice = sender.selectedTag()
diff --git a/GUI/Dialogs/Preferences/ControlsPrefs.swift b/GUI/Dialogs/Preferences/ControlsPrefs.swift
index 63aaa5a06..099c961ba 100644
--- a/GUI/Dialogs/Preferences/ControlsPrefs.swift
+++ b/GUI/Dialogs/Preferences/ControlsPrefs.swift
@@ -57,16 +57,6 @@ extension PreferencesController {
conDisconnectKeys.state = pref.disconnectJoyKeys ? .on : .off
- // Joystick buttons
- conAutofire.state = pref.autofire ? .on : .off
- conAutofireCease.state = pref.autofireBursts ? .on : .off
- conAutofireBullets.integerValue = pref.autofireBullets
- conAutofireFrequency.integerValue = pref.autofireFrequency
- conAutofireCease.isEnabled = conAutofire.state == .on
- conAutofireCeaseText.textColor = conAutofire.state == .on ? .controlTextColor : .disabledControlTextColor
- conAutofireBullets.isEnabled = conAutofire.state == .on && conAutofireCease.state == .on
- conAutofireFrequency.isEnabled = conAutofire.state == .on
-
// Mouse
conRetainMouseKeyComb.selectItem(withTag: pref.retainMouseKeyComb)
conRetainMouseKeyComb.isEnabled = pref.retainMouseWithKeys
@@ -141,30 +131,6 @@ extension PreferencesController {
pref.keyMaps[sender.tag] = [:]
refresh()
}
-
- @IBAction func conAutofireAction(_ sender: NSButton!) {
-
- pref.autofire = sender.state == .on
- refresh()
- }
-
- @IBAction func conAutofireCeaseAction(_ sender: NSButton!) {
-
- pref.autofireBursts = sender.state == .on
- refresh()
- }
-
- @IBAction func conAutofireBulletsAction(_ sender: NSTextField!) {
-
- pref.autofireBullets = sender.integerValue
- refresh()
- }
-
- @IBAction func conAutofireFrequencyAction(_ sender: NSSlider!) {
-
- pref.autofireFrequency = sender.integerValue
- refresh()
- }
@IBAction func conRetainMouseKeyCombAction(_ sender: NSPopUpButton!) {
diff --git a/GUI/Dialogs/Preferences/PreferencesController.swift b/GUI/Dialogs/Preferences/PreferencesController.swift
index 497be3da0..7b874bc68 100644
--- a/GUI/Dialogs/Preferences/PreferencesController.swift
+++ b/GUI/Dialogs/Preferences/PreferencesController.swift
@@ -93,13 +93,6 @@ class PreferencesController: DialogController {
@IBOutlet weak var conReleaseMouseWithKeys: NSButton!
@IBOutlet weak var conReleaseMouseByShaking: NSButton!
- // Joystick
- @IBOutlet weak var conAutofire: NSButton!
- @IBOutlet weak var conAutofireCease: NSButton!
- @IBOutlet weak var conAutofireCeaseText: NSTextField!
- @IBOutlet weak var conAutofireBullets: NSTextField!
- @IBOutlet weak var conAutofireFrequency: NSSlider!
-
//
// Devices
//
@@ -247,13 +240,7 @@ extension PreferencesController: NSTextFieldDelegate {
if formatter?.number(from: view.stringValue) != nil {
genSnapshotIntervalAction(view)
}
-
- case conAutofireBullets:
-
- if formatter?.number(from: view.stringValue) != nil {
- conAutofireBulletsAction(view)
- }
-
+
default:
break
}
diff --git a/GUI/XIB files/Configuration.xib b/GUI/XIB files/Configuration.xib
index 61a3d73ef..a7e2254d7 100644
--- a/GUI/XIB files/Configuration.xib
+++ b/GUI/XIB files/Configuration.xib
@@ -90,6 +90,15 @@
+
+
+
+
+
+
+
+
+
@@ -1698,7 +1707,7 @@ DQ
-
+
@@ -1706,8 +1715,127 @@ DQ
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@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