1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-17 06:29:28 +00:00

Implements quick booting, and edges towards exposing it on the Mac.

It should already work in kiosk mode.
This commit is contained in:
Thomas Harte 2019-09-19 22:32:12 -04:00
parent e46601872b
commit 2e24da4614
8 changed files with 104 additions and 5 deletions

View File

@ -21,9 +21,9 @@ void append_bool(Configurable::SelectionSet &selection_set, const std::string &n
Enquires for a Boolean selection for option @c name from @c selections_by_option, storing it to @c result if found.
*/
bool get_bool(const Configurable::SelectionSet &selections_by_option, const std::string &name, bool &result) {
auto quickload = Configurable::selection<Configurable::BooleanSelection>(selections_by_option, "quickload");
if(!quickload) return false;
result = quickload->value;
auto selection = Configurable::selection<Configurable::BooleanSelection>(selections_by_option, name);
if(!selection) return false;
result = selection->value;
return true;
}

View File

@ -522,6 +522,12 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
void set_selections(const Configurable::SelectionSet &selections_by_option) override {
bool quick_boot;
if(Configurable::get_quick_boot(selections_by_option, quick_boot)) {
if(quick_boot) {
// Cf. Big Mess o' Wires' disassembly of the Mac Plus ROM, and the
// test at $E00. TODO: adapt as(/if?) necessary for other Macs.
ram_[0x02ae >> 1] = 0x40;
ram_[0x02b0 >> 1] = 0x00;
}
}
}

View File

@ -186,6 +186,7 @@
4B4518A31F75FD1C00926311 /* HFE.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4518951F75FD1B00926311 /* HFE.cpp */; };
4B4518A41F75FD1C00926311 /* OricMFMDSK.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4518971F75FD1B00926311 /* OricMFMDSK.cpp */; };
4B4518A51F75FD1C00926311 /* SSD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4518991F75FD1B00926311 /* SSD.cpp */; };
4B49F0A923346F7A0045E6A6 /* MacintoshOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B49F0A723346F7A0045E6A6 /* MacintoshOptions.xib */; };
4B4A76301DB1A3FA007AAE2E /* AY38910.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4A762E1DB1A3FA007AAE2E /* AY38910.cpp */; };
4B4B1A3C200198CA00A0F866 /* KonamiSCC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4B1A3A200198C900A0F866 /* KonamiSCC.cpp */; };
4B4B1A3D200198CA00A0F866 /* KonamiSCC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4B1A3A200198C900A0F866 /* KonamiSCC.cpp */; };
@ -912,6 +913,7 @@
4B45189A1F75FD1B00926311 /* SSD.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SSD.hpp; sourceTree = "<group>"; };
4B4518A71F76004200926311 /* TapeParser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = TapeParser.hpp; path = Parsers/TapeParser.hpp; sourceTree = "<group>"; };
4B4518A81F76022000926311 /* DiskImageImplementation.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = DiskImageImplementation.hpp; sourceTree = "<group>"; };
4B49F0A823346F7A0045E6A6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/MacintoshOptions.xib"; sourceTree = SOURCE_ROOT; };
4B4A762E1DB1A3FA007AAE2E /* AY38910.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AY38910.cpp; path = AY38910/AY38910.cpp; sourceTree = "<group>"; };
4B4A762F1DB1A3FA007AAE2E /* AY38910.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = AY38910.hpp; path = AY38910/AY38910.hpp; sourceTree = "<group>"; };
4B4B1A3A200198C900A0F866 /* KonamiSCC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KonamiSCC.cpp; sourceTree = "<group>"; };
@ -2134,6 +2136,7 @@
4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */,
4BEEE6BB20DC72EA003723BF /* CompositeOptions.xib */,
4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */,
4B49F0A723346F7A0045E6A6 /* MacintoshOptions.xib */,
4B2A332B1DB86821002876E3 /* OricOptions.xib */,
4B8FE2171DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib */,
4BD61662206B2AC700236112 /* QuickLoadOptions.xib */,
@ -2266,12 +2269,12 @@
4B6AAEA1230E3E1D0078E864 /* MassStorage */ = {
isa = PBXGroup;
children = (
4B74CF83231370BC00500CE8 /* MacintoshVolume.cpp */,
4B6AAEA2230E3E1D0078E864 /* MassStorageDevice.cpp */,
4B74CF84231370BC00500CE8 /* MacintoshVolume.hpp */,
4B6AAEA3230E3E1D0078E864 /* MassStorageDevice.hpp */,
4B74CF7E2312FA9C00500CE8 /* Formats */,
4B6AAEA5230E40250078E864 /* SCSI */,
4B74CF83231370BC00500CE8 /* MacintoshVolume.cpp */,
4B74CF84231370BC00500CE8 /* MacintoshVolume.hpp */,
);
path = MassStorage;
sourceTree = "<group>";
@ -3651,6 +3654,7 @@
4B79E4441E3AF38600141F11 /* cassette.png in Resources */,
4BB73EAC1B587A5100552FC2 /* MainMenu.xib in Resources */,
4B8FE21D1DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib in Resources */,
4B49F0A923346F7A0045E6A6 /* MacintoshOptions.xib in Resources */,
4BA3189422E7A4CA00D18CFA /* ROMImages in Resources */,
4B79E4461E3AF38600141F11 /* floppy525.png in Resources */,
4BEEE6BD20DC72EB003723BF /* CompositeOptions.xib in Resources */,
@ -4426,6 +4430,14 @@
name = OricOptions.xib;
sourceTree = "<group>";
};
4B49F0A723346F7A0045E6A6 /* MacintoshOptions.xib */ = {
isa = PBXVariantGroup;
children = (
4B49F0A823346F7A0045E6A6 /* Base */,
);
name = MacintoshOptions.xib;
sourceTree = "<group>";
};
4B55DD8120DF06680043F2E5 /* MachinePicker.xib */ = {
isa = PBXVariantGroup;
children = (

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MachineDocument" customModule="Clock_Signal" customModuleProvider="target">
<connections>
<outlet property="optionsPanel" destination="ZW7-Bw-4RP" id="JpE-wG-zRR"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="ZW7-Bw-4RP" customClass="MachinePanel" customModule="Clock_Signal" customModuleProvider="target">
<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="80" y="150" width="200" height="54"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="900"/>
<view key="contentView" id="tpZ-0B-QQu">
<rect key="frame" x="0.0" y="0.0" width="200" height="54"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="zPG-yW-4Gy">
<rect key="frame" x="18" y="18" width="164" height="18"/>
<buttonCell key="cell" type="check" title="Start Quickly" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="alI-Mw-35c">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="setFastBooting:" target="ZW7-Bw-4RP" id="AgA-2q-qUU"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="zPG-yW-4Gy" secondAttribute="bottom" constant="20" id="7u0-BP-FXG"/>
<constraint firstAttribute="trailing" secondItem="zPG-yW-4Gy" secondAttribute="trailing" constant="20" id="Mtb-hf-4ap"/>
<constraint firstItem="zPG-yW-4Gy" firstAttribute="leading" secondItem="tpZ-0B-QQu" secondAttribute="leading" constant="20" id="imk-5k-8nm"/>
<constraint firstItem="zPG-yW-4Gy" firstAttribute="top" secondItem="tpZ-0B-QQu" secondAttribute="top" constant="20" id="jAt-iF-uaT"/>
</constraints>
</view>
<connections>
<outlet property="fastBootingButton" destination="zPG-yW-4Gy" id="3Mq-l2-NEp"/>
</connections>
<point key="canvasLocation" x="-50" y="2"/>
</window>
</objects>
</document>

View File

@ -16,6 +16,7 @@ class MachinePanel: NSPanel {
return "\(self.machine.userDefaultsPrefix).\(key)"
}
// MARK: Fast Loading
var fastLoadingUserDefaultsKey: String {
return prefixedUserDefaultsKey("fastLoading")
}
@ -28,6 +29,20 @@ class MachinePanel: NSPanel {
}
}
// MARK: Quick Boot
var bootQuicklyUserDefaultsKey: String {
return prefixedUserDefaultsKey("bootQuickly")
}
@IBOutlet var fastBootingButton: NSButton?
@IBAction func setFastBooting(_ sender: NSButton!) {
// if let fastLoadingMachine = machine as? CSFastLoading {
// let useFastLoadingHack = sender.state == .on
// fastLoadingMachine.useFastLoadingHack = useFastLoadingHack
// UserDefaults.standard.set(useFastLoadingHack, forKey: fastLoadingUserDefaultsKey)
// }
}
// MARK: Display-Type Selection
fileprivate func signalForTag(tag: Int) -> CSMachineVideoSignal {
switch tag {
case 1: return .composite
@ -49,6 +64,7 @@ class MachinePanel: NSPanel {
}
}
// MARK: Restoring user defaults
func establishStoredOptions() {
let standardUserDefaults = UserDefaults.standard
standardUserDefaults.register(defaults: [
@ -62,6 +78,7 @@ class MachinePanel: NSPanel {
self.fastLoadingButton?.state = useFastLoadingHack ? .on : .off
}
if let displayTypeButton = self.displayTypeButton {
// Enable or disable options as per machine support.
var titlesToRemove: [String] = []

View File

@ -86,6 +86,7 @@ typedef NS_ENUM(NSInteger, CSMachineKeyboardInputMode) {
@property (nonatomic, assign) BOOL useFastLoadingHack;
@property (nonatomic, assign) CSMachineVideoSignal videoSignal;
@property (nonatomic, assign) BOOL useAutomaticTapeMotorControl;
@property (nonatomic, assign) BOOL useQuickBootingHack;
@property (nonatomic, readonly) BOOL canInsertMedia;

View File

@ -624,6 +624,19 @@ struct ActivityObserver: public Activity::Observer {
}
}
- (void)setUseQuickBootingHack:(BOOL)useQuickBootingHack {
Configurable::Device *configurable_device = _machine->configurable_device();
if(!configurable_device) return;
@synchronized(self) {
_useQuickBootingHack = useQuickBootingHack;
Configurable::SelectionSet selection_set;
append_quick_boot_selection(selection_set, useQuickBootingHack ? true : false);
configurable_device->set_selections(selection_set);
}
}
- (NSString *)userDefaultsPrefix {
// Assumes that the first machine in the targets list is the source of user defaults.
std::string name = Machine::ShortNameForTargetMachine(_analyser.targets.front()->machine);

View File

@ -219,6 +219,7 @@ static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(K
case Analyser::Machine::Atari2600: return @"Atari2600Options";
case Analyser::Machine::ColecoVision: return @"CompositeOptions";
case Analyser::Machine::Electron: return @"QuickLoadCompositeOptions";
case Analyser::Machine::Macintosh: return @"MacintoshOptions";
case Analyser::Machine::MasterSystem: return @"CompositeOptions";
case Analyser::Machine::MSX: return @"QuickLoadCompositeOptions";
case Analyser::Machine::Oric: return @"OricOptions";