From 55ee4c4d3b2a19d7053d80b5e3c8f26e00702022 Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Tue, 16 Jan 2018 23:16:11 -0600 Subject: [PATCH] Allow saving speed slider setting with config, and also added option to disable boot animation --- .../tools/jace/src/main/java/jace/EmulatorUILogic.java | 6 ++++++ .../jace/src/main/java/jace/JaceUIController.java | 10 ++++++++++ .../java/jace/config/ConfigurationUIController.java | 2 +- .../src/main/java/jace/lawless/LawlessComputer.java | 10 +++++++++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Platform/Apple/tools/jace/src/main/java/jace/EmulatorUILogic.java b/Platform/Apple/tools/jace/src/main/java/jace/EmulatorUILogic.java index 539d391c..d1c56bde 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/EmulatorUILogic.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/EmulatorUILogic.java @@ -81,6 +81,12 @@ public class EmulatorUILogic implements Reconfigurable { } }; } + + @ConfigurableField( + category = "General", + name = "Speed Setting" + ) + public int speedSetting = 1; @ConfigurableField( category = "General", diff --git a/Platform/Apple/tools/jace/src/main/java/jace/JaceUIController.java b/Platform/Apple/tools/jace/src/main/java/jace/JaceUIController.java index 488e428f..d489e2c9 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/JaceUIController.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/JaceUIController.java @@ -6,10 +6,12 @@ package jace; import com.sun.glass.ui.Application; +import jace.config.ConfigurableField; import jace.core.Card; import jace.core.Computer; import jace.core.Motherboard; import jace.core.Utility; +import jace.lawless.LawlessComputer; import jace.library.MediaCache; import jace.library.MediaConsumer; import jace.library.MediaConsumerParent; @@ -109,6 +111,8 @@ public class JaceUIController { assert appleScreen != null : "fx:id=\"appleScreen\" was not injected: check your FXML file 'JaceUI.fxml'."; controlOverlay.setVisible(false); menuButtonPane.setVisible(false); + controlOverlay.setFocusTraversable(false); + menuButtonPane.setFocusTraversable(false); NumberBinding aspectCorrectedWidth = rootPane.heightProperty().multiply(3.0).divide(2.0); NumberBinding width = new When( aspectRatioCorrectionEnabled.and(aspectCorrectedWidth.lessThan(rootPane.widthProperty())) @@ -125,6 +129,7 @@ public class JaceUIController { controlOverlay.setOnMouseClicked(this::hideControlOverlay); delayTimer.getKeyFrames().add(new KeyFrame(Duration.millis(3000), evt -> { hideControlOverlay(null); + rootPane.requestFocus(); })); } @@ -139,9 +144,11 @@ public class JaceUIController { ft.play(); } } + rootPane.requestFocus(); } Timeline delayTimer = new Timeline(); + private void resetMenuButtonTimer() { delayTimer.playFromStart(); } @@ -155,6 +162,7 @@ public class JaceUIController { ft.setFromValue(0.0); ft.setToValue(1.0); ft.play(); + rootPane.requestFocus(); } } @@ -226,6 +234,7 @@ public class JaceUIController { } }); speedSlider.valueProperty().addListener((val, oldValue, newValue) -> setSpeed(newValue.doubleValue())); + Platform.runLater(() -> speedSlider.setValue(Emulator.logic.speedSetting)); } private void connectButtons(Node n) { @@ -241,6 +250,7 @@ public class JaceUIController { } private void setSpeed(double speed) { + Emulator.logic.speedSetting = (int) speed; double speedRatio = convertSpeedToRatio(speed); if (speedRatio > 100.0) { Emulator.computer.getMotherboard().maxspeed = true; diff --git a/Platform/Apple/tools/jace/src/main/java/jace/config/ConfigurationUIController.java b/Platform/Apple/tools/jace/src/main/java/jace/config/ConfigurationUIController.java index edd4a26f..2fdd8276 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/config/ConfigurationUIController.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/config/ConfigurationUIController.java @@ -88,7 +88,7 @@ public class ConfigurationUIController { assert settingsScroll != null : "fx:id=\"settingsScroll\" was not injected: check your FXML file 'Configuration.fxml'."; assert deviceTree != null : "fx:id=\"deviceTree\" was not injected: check your FXML file 'Configuration.fxml'."; assert treeScroll != null : "fx:id=\"treeScroll\" was not injected: check your FXML file 'Configuration.fxml'."; - resetDeviceTree(); + cancelConfig(null); deviceTree.getSelectionModel().selectedItemProperty().addListener(this::selectionChanged); deviceTree.maxWidthProperty().bind(treeScroll.widthProperty()); } diff --git a/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessComputer.java b/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessComputer.java index 482e9cdc..69fa11ea 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessComputer.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessComputer.java @@ -4,6 +4,7 @@ import jace.apple2e.Apple2e; import jace.apple2e.RAM128k; import jace.apple2e.SoftSwitches; import jace.apple2e.VideoNTSC; +import jace.config.ConfigurableField; import jace.core.Card; import jace.core.Video; import jace.library.MediaConsumer; @@ -25,6 +26,8 @@ public class LawlessComputer extends Apple2e { byte[] bootScreen = null; boolean performedBootAnimation = false; LawlessImageTool gameDiskHandler = new LawlessImageTool(); + @ConfigurableField(name = "Boot Animation") + public boolean showBootAnimation = true; public LawlessComputer() { super(); @@ -49,7 +52,12 @@ public class LawlessComputer extends Apple2e { for (SoftSwitches s : SoftSwitches.values()) { s.getSwitch().reset(); } - (new Thread(this::startAnimation)).start(); + if (showBootAnimation) { + (new Thread(this::startAnimation)).start(); + } else { + finishColdStart(); + getMotherboard().requestSpeed(this); + } } public void startAnimation() {