From 5f3e9b7e25f7d9e47f05550dfc557bd3f5772e4f Mon Sep 17 00:00:00 2001 From: lantzelot-swe <75668734+lantzelot-swe@users.noreply.github.com> Date: Fri, 14 Jan 2022 14:33:05 +0100 Subject: [PATCH] feat: Add default joystick config to preferences --- src/main/java/se/lantz/gui/JoystickPanel.java | 6 +- .../preferences/InfoSlotPreferencesPanel.java | 1 - .../{PreferencesPanel.java => MiscPanel.java} | 141 +++++++----------- .../gui/preferences/PreferencesDialog.java | 12 +- .../gui/preferences/PreferencesTabPanel.java | 131 ++++++++++++++++ .../java/se/lantz/model/PreferencesModel.java | 20 +++ .../java/se/lantz/model/data/GameDetails.java | 8 +- src/main/java/se/lantz/util/FileManager.java | 12 ++ 8 files changed, 228 insertions(+), 103 deletions(-) rename src/main/java/se/lantz/gui/preferences/{PreferencesPanel.java => MiscPanel.java} (58%) create mode 100644 src/main/java/se/lantz/gui/preferences/PreferencesTabPanel.java diff --git a/src/main/java/se/lantz/gui/JoystickPanel.java b/src/main/java/se/lantz/gui/JoystickPanel.java index 6486278..c5afefb 100644 --- a/src/main/java/se/lantz/gui/JoystickPanel.java +++ b/src/main/java/se/lantz/gui/JoystickPanel.java @@ -154,10 +154,6 @@ public class JoystickPanel extends JPanel if (primaryJoyCheckBox == null) { String text = "Use port " + portnumber + " as Primary joystick"; - if (portnumber == 2) - { - text = text + " (Default setting)"; - } primaryJoyCheckBox = new JCheckBox(text); primaryJoyCheckBox.addItemListener((e) -> model.setPrimary(primaryJoyCheckBox.isSelected())); } @@ -332,7 +328,7 @@ public class JoystickPanel extends JPanel return configPanel; } - private JCheckBox getMouseCheckBox() + public JCheckBox getMouseCheckBox() { if (mouseCheckBox == null) { diff --git a/src/main/java/se/lantz/gui/preferences/InfoSlotPreferencesPanel.java b/src/main/java/se/lantz/gui/preferences/InfoSlotPreferencesPanel.java index c41d238..0d83a32 100644 --- a/src/main/java/se/lantz/gui/preferences/InfoSlotPreferencesPanel.java +++ b/src/main/java/se/lantz/gui/preferences/InfoSlotPreferencesPanel.java @@ -50,7 +50,6 @@ public class InfoSlotPreferencesPanel extends JPanel public InfoSlotPreferencesPanel(PreferencesModel model) { this.model = model; - this.setPreferredSize(new Dimension(335, 310)); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWeights = new double[] { 1.0, 0.0 }; gridBagLayout.columnWidths = new int[] { 0, 0 }; diff --git a/src/main/java/se/lantz/gui/preferences/PreferencesPanel.java b/src/main/java/se/lantz/gui/preferences/MiscPanel.java similarity index 58% rename from src/main/java/se/lantz/gui/preferences/PreferencesPanel.java rename to src/main/java/se/lantz/gui/preferences/MiscPanel.java index f37a702..612acd2 100644 --- a/src/main/java/se/lantz/gui/preferences/PreferencesPanel.java +++ b/src/main/java/se/lantz/gui/preferences/MiscPanel.java @@ -7,38 +7,35 @@ import java.awt.Insets; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.beans.Beans; -import java.util.Calendar; import javax.swing.JCheckBox; -import javax.swing.JPanel; -import javax.swing.border.EtchedBorder; -import javax.swing.border.TitledBorder; - -import se.lantz.model.PreferencesModel; import javax.swing.JLabel; +import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.JTextField; import javax.swing.SpinnerModel; import javax.swing.SpinnerNumberModel; import javax.swing.SwingUtilities; +import javax.swing.border.EtchedBorder; +import javax.swing.border.TitledBorder; -public class PreferencesPanel extends JPanel +import se.lantz.model.PreferencesModel; + +public class MiscPanel extends JPanel { private JPanel startupPanel; - private JPanel infoSlotPanel; private JCheckBox managerVersionCheckBox; private JCheckBox pcuaeVersionCheckBox; private PreferencesModel model; - private InfoSlotPreferencesPanel infoSlotPreferencesPanel; private JPanel favoritesPanel; private JLabel numberOfFavoritesLabel; private JSpinner favoritesSpinner; - public PreferencesPanel() + public MiscPanel(PreferencesModel model) { - model = new PreferencesModel(); - + this.model = model; + GridBagLayout gridBagLayout = new GridBagLayout(); setLayout(gridBagLayout); GridBagConstraints gbc_startupPanel = new GridBagConstraints(); @@ -50,29 +47,20 @@ public class PreferencesPanel extends JPanel gbc_startupPanel.gridy = 0; add(getStartupPanel(), gbc_startupPanel); GridBagConstraints gbc_favoritesPanel = new GridBagConstraints(); + gbc_favoritesPanel.weighty = 1.0; gbc_favoritesPanel.anchor = GridBagConstraints.NORTHWEST; gbc_favoritesPanel.weightx = 1.0; gbc_favoritesPanel.insets = new Insets(5, 5, 5, 5); - gbc_favoritesPanel.fill = GridBagConstraints.BOTH; + gbc_favoritesPanel.fill = GridBagConstraints.HORIZONTAL; gbc_favoritesPanel.gridx = 0; gbc_favoritesPanel.gridy = 1; add(getFavoritesPanel(), gbc_favoritesPanel); - GridBagConstraints gbc_infoSlotPanel = new GridBagConstraints(); - gbc_infoSlotPanel.weightx = 1.0; - gbc_infoSlotPanel.weighty = 1.0; - gbc_infoSlotPanel.anchor = GridBagConstraints.NORTHWEST; - gbc_infoSlotPanel.insets = new Insets(5, 5, 0, 5); - gbc_infoSlotPanel.fill = GridBagConstraints.BOTH; - gbc_infoSlotPanel.gridx = 0; - gbc_infoSlotPanel.gridy = 2; - add(getInfoSlotPanel(), gbc_infoSlotPanel); if (!Beans.isDesignTime()) { model.addPropertyChangeListener(e -> modelChanged()); //Trigger an initial read from the model modelChanged(); - getInfoSlotPreferencesPanel().init(); - } + } } private JPanel getStartupPanel() @@ -110,38 +98,13 @@ public class PreferencesPanel extends JPanel return startupPanel; } - private JPanel getInfoSlotPanel() - { - if (infoSlotPanel == null) - { - infoSlotPanel = new JPanel(); - infoSlotPanel - .setBorder(new TitledBorder(null, "Infoslot preferences", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - GridBagLayout gbl_infoSlotPanel = new GridBagLayout(); - gbl_infoSlotPanel.columnWidths = new int[] { 0, 0 }; - gbl_infoSlotPanel.rowHeights = new int[] { 0, 0 }; - gbl_infoSlotPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; - gbl_infoSlotPanel.rowWeights = new double[] { 1.0, Double.MIN_VALUE }; - infoSlotPanel.setLayout(gbl_infoSlotPanel); - GridBagConstraints gbc_infoSlotPreferencesPanel = new GridBagConstraints(); - gbc_infoSlotPreferencesPanel.fill = GridBagConstraints.BOTH; - gbc_infoSlotPreferencesPanel.weighty = 1.0; - gbc_infoSlotPreferencesPanel.weightx = 1.0; - gbc_infoSlotPreferencesPanel.anchor = GridBagConstraints.NORTHWEST; - gbc_infoSlotPreferencesPanel.insets = new Insets(0, 0, 0, 5); - gbc_infoSlotPreferencesPanel.gridx = 0; - gbc_infoSlotPreferencesPanel.gridy = 0; - infoSlotPanel.add(getInfoSlotPreferencesPanel(), gbc_infoSlotPreferencesPanel); - } - return infoSlotPanel; - } - private JCheckBox getManagerVersionCheckBox() { if (managerVersionCheckBox == null) { managerVersionCheckBox = new JCheckBox("Check for new version of PCUAE Manager at startup."); - managerVersionCheckBox.addItemListener((e) -> model.setCheckManagerVersionAtStartup(managerVersionCheckBox.isSelected())); + managerVersionCheckBox + .addItemListener((e) -> model.setCheckManagerVersionAtStartup(managerVersionCheckBox.isSelected())); } return managerVersionCheckBox; } @@ -151,16 +114,12 @@ public class PreferencesPanel extends JPanel if (pcuaeVersionCheckBox == null) { pcuaeVersionCheckBox = new JCheckBox("Check for new version of PCUAE main install at startup."); - pcuaeVersionCheckBox.addItemListener((e) -> model.setCheckPCUAEVersionAtStartup(pcuaeVersionCheckBox.isSelected())); + pcuaeVersionCheckBox + .addItemListener((e) -> model.setCheckPCUAEVersionAtStartup(pcuaeVersionCheckBox.isSelected())); } return pcuaeVersionCheckBox; } - public void savePreferences() - { - model.savePreferences(); - } - private void modelChanged() { getManagerVersionCheckBox().setSelected(model.isCheckManagerVersionAtStartup()); @@ -170,46 +129,50 @@ public class PreferencesPanel extends JPanel getFavoritesSpinner().setValue(model.getFavoritesCount()); } } - private InfoSlotPreferencesPanel getInfoSlotPreferencesPanel() { - if (infoSlotPreferencesPanel == null) { - infoSlotPreferencesPanel = new InfoSlotPreferencesPanel(model); - } - return infoSlotPreferencesPanel; - } - private JPanel getFavoritesPanel() { - if (favoritesPanel == null) { - favoritesPanel = new JPanel(); - favoritesPanel.setBorder(new TitledBorder(null, "Favorites preferences", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - GridBagLayout gbl_favoritesPanel = new GridBagLayout(); - favoritesPanel.setLayout(gbl_favoritesPanel); - GridBagConstraints gbc_numberOfFavoritesLabel = new GridBagConstraints(); - gbc_numberOfFavoritesLabel.insets = new Insets(5, 5, 5, 5); - gbc_numberOfFavoritesLabel.gridx = 0; - gbc_numberOfFavoritesLabel.gridy = 0; - favoritesPanel.add(getNumberOfFavoritesLabel(), gbc_numberOfFavoritesLabel); - GridBagConstraints gbc_favoritesSpinner = new GridBagConstraints(); - gbc_favoritesSpinner.anchor = GridBagConstraints.WEST; - gbc_favoritesSpinner.weightx = 1.0; - gbc_favoritesSpinner.insets = new Insets(5, 5, 5, 0); - gbc_favoritesSpinner.gridx = 1; - gbc_favoritesSpinner.gridy = 0; - favoritesPanel.add(getFavoritesSpinner(), gbc_favoritesSpinner); + + private JPanel getFavoritesPanel() + { + if (favoritesPanel == null) + { + favoritesPanel = new JPanel(); + favoritesPanel + .setBorder(new TitledBorder(null, "Favorites preferences", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + GridBagLayout gbl_favoritesPanel = new GridBagLayout(); + favoritesPanel.setLayout(gbl_favoritesPanel); + GridBagConstraints gbc_numberOfFavoritesLabel = new GridBagConstraints(); + gbc_numberOfFavoritesLabel.insets = new Insets(5, 5, 5, 5); + gbc_numberOfFavoritesLabel.gridx = 0; + gbc_numberOfFavoritesLabel.gridy = 0; + favoritesPanel.add(getNumberOfFavoritesLabel(), gbc_numberOfFavoritesLabel); + GridBagConstraints gbc_favoritesSpinner = new GridBagConstraints(); + gbc_favoritesSpinner.anchor = GridBagConstraints.WEST; + gbc_favoritesSpinner.weightx = 1.0; + gbc_favoritesSpinner.insets = new Insets(5, 5, 5, 0); + gbc_favoritesSpinner.gridx = 1; + gbc_favoritesSpinner.gridy = 0; + favoritesPanel.add(getFavoritesSpinner(), gbc_favoritesSpinner); } return favoritesPanel; } - private JLabel getNumberOfFavoritesLabel() { - if (numberOfFavoritesLabel == null) { - numberOfFavoritesLabel = new JLabel("Number of favorites lists"); + + private JLabel getNumberOfFavoritesLabel() + { + if (numberOfFavoritesLabel == null) + { + numberOfFavoritesLabel = new JLabel("Number of favorites lists"); } return numberOfFavoritesLabel; } - private JSpinner getFavoritesSpinner() { - if (favoritesSpinner == null) { - SpinnerModel spinnerModel = new SpinnerNumberModel(10, // initial value + + private JSpinner getFavoritesSpinner() + { + if (favoritesSpinner == null) + { + SpinnerModel spinnerModel = new SpinnerNumberModel(10, // initial value 1, // min 10, // max 1); - favoritesSpinner = new JSpinner(spinnerModel); + favoritesSpinner = new JSpinner(spinnerModel); JSpinner.NumberEditor numberEditor = new JSpinner.NumberEditor(favoritesSpinner, "####"); favoritesSpinner.setEditor(numberEditor); // Select all when gaining focus @@ -228,7 +191,7 @@ public class PreferencesPanel extends JPanel favoritesSpinner.addChangeListener(e -> { JSpinner textField = (JSpinner) e.getSource(); model.setFavoritesCount(Integer.parseInt(textField.getValue().toString())); - }); + }); } return favoritesSpinner; } diff --git a/src/main/java/se/lantz/gui/preferences/PreferencesDialog.java b/src/main/java/se/lantz/gui/preferences/PreferencesDialog.java index 3bd8624..70e926c 100644 --- a/src/main/java/se/lantz/gui/preferences/PreferencesDialog.java +++ b/src/main/java/se/lantz/gui/preferences/PreferencesDialog.java @@ -7,30 +7,30 @@ import se.lantz.gui.BaseDialog; public class PreferencesDialog extends BaseDialog { - private PreferencesPanel panel; + private PreferencesTabPanel panel; public PreferencesDialog(Frame owner) { super(owner); setTitle("PCUAE Manager preferences"); - addContent(getPreferencesPanel()); + addContent(getPreferencesTabPanel()); getOkButton().setText("Save"); getOkButton().setPreferredSize(null); - this.setPreferredSize(new Dimension(372, 570)); + this.setPreferredSize(new Dimension(366, 550)); this.setResizable(false); } - private PreferencesPanel getPreferencesPanel() + private PreferencesTabPanel getPreferencesTabPanel() { if (panel == null) { - panel = new PreferencesPanel(); + panel = new PreferencesTabPanel(); } return panel; } public void savePreferences() { - getPreferencesPanel().savePreferences(); + getPreferencesTabPanel().savePreferences(); } } diff --git a/src/main/java/se/lantz/gui/preferences/PreferencesTabPanel.java b/src/main/java/se/lantz/gui/preferences/PreferencesTabPanel.java new file mode 100644 index 0000000..1a27f53 --- /dev/null +++ b/src/main/java/se/lantz/gui/preferences/PreferencesTabPanel.java @@ -0,0 +1,131 @@ +package se.lantz.gui.preferences; + +import java.awt.BorderLayout; + +import javax.swing.JPanel; +import javax.swing.JTabbedPane; + +import se.lantz.model.PreferencesModel; +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; +import java.awt.Insets; +import se.lantz.gui.JoystickPanel; +import se.lantz.model.JoystickModel; +import javax.swing.JLabel; + +public class PreferencesTabPanel extends JPanel +{ + private PreferencesModel model; + private JTabbedPane tabbedPane; + private MiscPanel miscPanel; + private InfoSlotPreferencesPanel infoSlotPreferencesPanel; + private JPanel infoSlotBackgroundPanel; + private JPanel panel; + private JPanel joystickBackgroundPanel; + private JoystickPanel joystickPanel; + + private JoystickModel joyModel; + private JLabel infoLabel; + + public PreferencesTabPanel() + { + this.model = new PreferencesModel(); + this.joyModel = new JoystickModel(false); + setLayout(new BorderLayout(0, 0)); + add(getTabbedPane(), BorderLayout.CENTER); + + getInfoSlotPreferencesPanel().init(); + } + + private JTabbedPane getTabbedPane() + { + if (tabbedPane == null) + { + tabbedPane = new JTabbedPane(JTabbedPane.TOP); + tabbedPane.addTab("Misc.", null, getMiscPanel(), null); + tabbedPane.addTab("Infoslot", null, getInfoSlotBackgroundPanel(), null); + tabbedPane.addTab("Joystick", null, getJoystickBackgroundPanel(), null); + } + return tabbedPane; + } + + private MiscPanel getMiscPanel() + { + if (miscPanel == null) + { + miscPanel = new MiscPanel(model); + } + return miscPanel; + } + + private InfoSlotPreferencesPanel getInfoSlotPreferencesPanel() + { + if (infoSlotPreferencesPanel == null) + { + infoSlotPreferencesPanel = new InfoSlotPreferencesPanel(model); + } + return infoSlotPreferencesPanel; + } + + public void savePreferences() + { + model.setJoystickConfig(joyModel.getConfigString()); + model.savePreferences(); + } + + private JPanel getInfoSlotBackgroundPanel() { + if (infoSlotBackgroundPanel == null) { + infoSlotBackgroundPanel = new JPanel(); + GridBagLayout gbl_infoSlotBackgroundPanel = new GridBagLayout(); + infoSlotBackgroundPanel.setLayout(gbl_infoSlotBackgroundPanel); + GridBagConstraints gbc_panel = new GridBagConstraints(); + gbc_panel.fill = GridBagConstraints.HORIZONTAL; + gbc_panel.weighty = 1.0; + gbc_panel.insets = new Insets(5, 5, 5, 10); + gbc_panel.anchor = GridBagConstraints.NORTHWEST; + gbc_panel.weightx = 1.0; + gbc_panel.gridx = 0; + gbc_panel.gridy = 0; + infoSlotBackgroundPanel.add(getInfoSlotPreferencesPanel(), gbc_panel); + } + return infoSlotBackgroundPanel; + } + private JPanel getJoystickBackgroundPanel() { + if (joystickBackgroundPanel == null) { + joystickBackgroundPanel = new JPanel(); + GridBagLayout gbl_joystickBackgroundPanel = new GridBagLayout(); + joystickBackgroundPanel.setLayout(gbl_joystickBackgroundPanel); + GridBagConstraints gbc_infoLabel = new GridBagConstraints(); + gbc_infoLabel.fill = GridBagConstraints.HORIZONTAL; + gbc_infoLabel.weightx = 1.0; + gbc_infoLabel.insets = new Insets(10, 10, 20, 9); + gbc_infoLabel.gridx = 0; + gbc_infoLabel.gridy = 0; + joystickBackgroundPanel.add(getInfoLabel(), gbc_infoLabel); + GridBagConstraints gbc_joystickPanel = new GridBagConstraints(); + gbc_joystickPanel.insets = new Insets(0, 5, 0, 5); + gbc_joystickPanel.weighty = 1.0; + gbc_joystickPanel.weightx = 1.0; + gbc_joystickPanel.gridx = 0; + gbc_joystickPanel.gridy = 1; + joystickBackgroundPanel.add(getJoystickPanel(), gbc_joystickPanel); + } + return joystickBackgroundPanel; + } + private JoystickPanel getJoystickPanel() { + if (joystickPanel == null) { + joystickPanel = new JoystickPanel(2, joyModel); + //Don't allow mouse as default + joystickPanel.getMouseCheckBox().setVisible(false); + //Set initial value + joyModel.setConfigStringFromDb(model.getJoystickConfig()); + } + return joystickPanel; + } + private JLabel getInfoLabel() { + if (infoLabel == null) { + infoLabel = new JLabel("Specify the default joystick configuration to use when adding new games. Port 1 and Port 2 uses the same mapping."); + } + return infoLabel; + } +} diff --git a/src/main/java/se/lantz/model/PreferencesModel.java b/src/main/java/se/lantz/model/PreferencesModel.java index 37517b9..dc30f7f 100644 --- a/src/main/java/se/lantz/model/PreferencesModel.java +++ b/src/main/java/se/lantz/model/PreferencesModel.java @@ -19,6 +19,7 @@ public class PreferencesModel extends AbstractModel implements CommonInfoModel public static final String DESCRIPTION_ES = "infoSlotdescriptionEs"; public static final String DESCRIPTION_IT = "infoSlotdescriptionIt"; public static final String FAVORITESCOUNT = "favoritesCount"; + public static final String JOYSTICK = "joystick"; private boolean checkPCUAEVersionAtStartup = true; @@ -34,6 +35,8 @@ public class PreferencesModel extends AbstractModel implements CommonInfoModel private String author = ""; private String composer = "C64 SID Background Music"; private int favoritesCount = 10; + + private String joystickConfig = "J:2*:" + JoystickModel.DEFAULT_CONFIG; public PreferencesModel() { @@ -50,6 +53,7 @@ public class PreferencesModel extends AbstractModel implements CommonInfoModel setDescriptionIt(configuredProperties.getProperty(DESCRIPTION_IT, descriptionIt)); setYear(Integer.parseInt(configuredProperties.getProperty(YEAR, Integer.toString(year)))); setFavoritesCount(Integer.parseInt(configuredProperties.getProperty(FAVORITESCOUNT, Integer.toString(favoritesCount)))); + setJoystickConfig(configuredProperties.getProperty(JOYSTICK, joystickConfig)); } public boolean isCheckPCUAEVersionAtStartup() @@ -253,6 +257,21 @@ public class PreferencesModel extends AbstractModel implements CommonInfoModel } } + public String getJoystickConfig() + { + return joystickConfig; + } + + public void setJoystickConfig(String joystickConfig) + { + String old = getJoystickConfig(); + this.joystickConfig = joystickConfig; + if (!Objects.equals(old, joystickConfig)) + { + notifyChange(); + } + } + public void savePreferences() { Properties configuredProperties = FileManager.getConfiguredProperties(); @@ -269,6 +288,7 @@ public class PreferencesModel extends AbstractModel implements CommonInfoModel configuredProperties.put(DESCRIPTION_IT, descriptionIt); configuredProperties.put(YEAR, Integer.toString(year)); configuredProperties.put(FAVORITESCOUNT, Integer.toString(favoritesCount)); + configuredProperties.put(JOYSTICK, joystickConfig); FileManager.storeProperties(); } } diff --git a/src/main/java/se/lantz/model/data/GameDetails.java b/src/main/java/se/lantz/model/data/GameDetails.java index e2cecb6..9050cd9 100644 --- a/src/main/java/se/lantz/model/data/GameDetails.java +++ b/src/main/java/se/lantz/model/data/GameDetails.java @@ -1,6 +1,7 @@ package se.lantz.model.data; import se.lantz.model.JoystickModel; +import se.lantz.util.FileManager; /** * The data structure representing a specific game. @@ -33,8 +34,11 @@ public class GameDetails public GameDetails() { - setJoy1("J:1:" + JoystickModel.DEFAULT_CONFIG); - setJoy2("J:2*:" + JoystickModel.DEFAULT_CONFIG); + String configuredJoystick = FileManager.getConfiguredJoystickConfig(); + String joy1 = configuredJoystick.replace("J:2*:", "J:1:"); + joy1 = joy1.replace("J:2:", "J:1*:"); + setJoy1(joy1); + setJoy2(configuredJoystick); } public String getTitle() diff --git a/src/main/java/se/lantz/util/FileManager.java b/src/main/java/se/lantz/util/FileManager.java index f0a8219..4e42266 100644 --- a/src/main/java/se/lantz/util/FileManager.java +++ b/src/main/java/se/lantz/util/FileManager.java @@ -48,6 +48,7 @@ import se.lantz.db.DbConnector; import se.lantz.gui.exports.PublishWorker; import se.lantz.manager.SavedStatesManager; import se.lantz.model.InfoModel; +import se.lantz.model.JoystickModel; import se.lantz.model.MainViewModel; import se.lantz.model.PreferencesModel; import se.lantz.model.SavedStatesModel; @@ -78,6 +79,7 @@ public class FileManager private static Properties fileProperties; private static int currentNoOfFavorites = -1; + private static String currentJoystickConfig = ""; private MainViewModel model; private InfoModel infoModel; @@ -915,6 +917,7 @@ public class FileManager { //Reset to load again in getConfiguredNumberOfFavorites() currentNoOfFavorites = -1; + currentJoystickConfig = ""; try (OutputStream output = new FileOutputStream("./pcu.properties")) { // save properties to project root folder @@ -955,6 +958,15 @@ public class FileManager } return currentNoOfFavorites; } + + public static String getConfiguredJoystickConfig() + { + if (currentJoystickConfig.isEmpty()) + { + currentJoystickConfig = FileManager.getConfiguredProperties().getProperty(PreferencesModel.JOYSTICK, "J:2*:" + JoystickModel.DEFAULT_CONFIG); + } + return currentJoystickConfig; + } public static void backupDb(String targetFolderName) {