added method to start arma 3

This commit is contained in:
Niklas 2020-03-31 00:11:28 +02:00
parent fbfeef1a95
commit 687177f9d2
12 changed files with 292 additions and 136 deletions

View File

@ -338,7 +338,7 @@
</constraints> </constraints>
<properties> <properties>
<editable value="false"/> <editable value="false"/>
<text value="-noInit -noLogs"/> <text value=""/>
</properties> </properties>
</component> </component>
</children> </children>
@ -1784,7 +1784,9 @@
<model> <model>
<item value=""/> <item value=""/>
<item value="tbb4malloc_bi"/> <item value="tbb4malloc_bi"/>
<item value="tbb4malloc_bi_x64"/>
<item value="jemalloc_bi"/> <item value="jemalloc_bi"/>
<item value="jemalloc_bi_x64"/>
<item value="system"/> <item value="system"/>
</model> </model>
</properties> </properties>

View File

@ -201,11 +201,11 @@ public class LauncherGUI implements Observer {
fileChecker.addObserver(this); fileChecker.addObserver(this);
syncer.addObserver(this); syncer.addObserver(this);
if (Parameters.ARMA_PATH.toStringParameter().getConfigValue() == null || Parameters.ARMA_PATH.toStringParameter().getConfigValue().isEmpty()) { if (Parameters.ARMA_PATH.toParameter().getConfigValue() == null || ((String) Parameters.ARMA_PATH.toParameter().getConfigValue()).isEmpty()) {
final Path installationPath = ArmaUtils.getInstallationPath(); final Path installationPath = ArmaUtils.getInstallationPath();
if (installationPath != null) { if (installationPath != null) {
Parameters.ARMA_PATH.toStringParameter().save(installationPath.toAbsolutePath().toString()); Parameters.ARMA_PATH.toParameter().save(installationPath.toAbsolutePath().toString());
Parameters.MOD_PATH.toStringParameter().save(Paths.get( Parameters.MOD_PATH.toParameter().save(Paths.get(
installationPath.toAbsolutePath().toString(), ArmA3Launcher.config.getString("name") + " Mods" installationPath.toAbsolutePath().toString(), ArmA3Launcher.config.getString("name") + " Mods"
).toAbsolutePath().toString()); ).toAbsolutePath().toString());
techCheck(); techCheck();
@ -250,7 +250,8 @@ public class LauncherGUI implements Observer {
playPresetButton.setMargin(new Insets(10, 10, 10, 10)); playPresetButton.setMargin(new Insets(10, 10, 10, 10));
serverTable.setModel(new ServerTableModel()); final ServerTableModel serverTableModel = new ServerTableModel();
serverTable.setModel(serverTableModel);
presetList.setModel(new PresetTableModel()); presetList.setModel(new PresetTableModel());
presetList.setCellRenderer(new PresetListRenderer()); presetList.setCellRenderer(new PresetListRenderer());
@ -301,11 +302,41 @@ public class LauncherGUI implements Observer {
updateTreeScrolPane.getVerticalScrollBar().setUnitIncrement(16); updateTreeScrolPane.getVerticalScrollBar().setUnitIncrement(16);
splitView.setDividerLocation(-1); splitView.setDividerLocation(-1);
ListSelectionModel selectionModel = serverTable.getSelectionModel();
selectionModel.addListSelectionListener(e -> {
if (serverTable.getSelectedRow() == -1) {
playButton.setEnabled(false);
parameterText.setText("");
return;
}
ServerTableModel m = (ServerTableModel) serverTable.getModel();
Server server = m.getServer(serverTable.getSelectedRow());
parameterText.setText(ArmaUtils.getGameParameter(server.getPreset()));
techCheck();
});
playButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (serverTable.getSelectedRow() == -1) {
playButton.setEnabled(false);
parameterText.setText("");
return;
}
ServerTableModel m = (ServerTableModel) serverTable.getModel();
Server server = m.getServer(serverTable.getSelectedRow());
ArmaUtils.start(server.getPreset(), server.getStartparameter().stream().toArray(String[]::new));
}
});
presetList.addListSelectionListener(e -> { presetList.addListSelectionListener(e -> {
if (!e.getValueIsAdjusting()) { if (!e.getValueIsAdjusting()) {
PresetTableModel m = (PresetTableModel) presetList.getModel(); PresetTableModel m = (PresetTableModel) presetList.getModel();
Object elementAt = m.getElementAt(presetList.getSelectedIndex()); Object elementAt = m.getElementAt(presetList.getSelectedIndex());
Modset modset = (Modset) elementAt; Modset modset = (Modset) elementAt;
if (modset == null) return;
if (modset.getType() == Modset.Type.SERVER || modset.getType() == Modset.Type.PLACEHOLDER) { if (modset.getType() == Modset.Type.SERVER || modset.getType() == Modset.Type.PLACEHOLDER) {
renamePresetButton.setEnabled(false); renamePresetButton.setEnabled(false);
@ -315,8 +346,34 @@ public class LauncherGUI implements Observer {
removePresetButtom.setEnabled(true); removePresetButtom.setEnabled(true);
} }
clonePresetButton.setEnabled(modset.getType() != Modset.Type.PLACEHOLDER); clonePresetButton.setEnabled(modset.getType() != Modset.Type.PLACEHOLDER);
if (modset.getType() == Modset.Type.PLACEHOLDER) {
modList.setModel(new DefaultListModel<String>());
presetNotePane.setVisible(false);
presetList.clearSelection();
}
updateModList(modset); updateModList(modset);
techCheck();
}
});
playPresetButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (presetList.getSelectedIndex() == -1) {
playPresetButton.setEnabled(false);
parameterText.setText("");
return;
}
PresetTableModel model1 = (PresetTableModel) presetList.getModel();
if (presetList.getSelectedIndex() == -1) return;
Object elementAt = model1.getElementAt(presetList.getSelectedIndex());
Modset selectedModset = (Modset) elementAt;
if(selectedModset.getType() == Modset.Type.PLACEHOLDER) return;
ArmaUtils.start(selectedModset);
} }
}); });
@ -598,10 +655,12 @@ public class LauncherGUI implements Observer {
} }
public void techCheck() { public void techCheck() {
boolean pathSet = Parameters.ARMA_PATH.toStringParameter().getConfigValue() != null && Parameters.ARMA_PATH.toStringParameter().getConfigValue() != null; boolean pathSet = Parameters.ARMA_PATH.toParameter().getConfigValue() != null && Parameters.ARMA_PATH.toParameter().getConfigValue() != null;
if (SteamTimer.arma_running) {
playButton.setEnabled(false); playButton.setEnabled(false);
playPresetButton.setEnabled(false); playPresetButton.setEnabled(false);
if (SteamTimer.arma_running) {
syncIntensiveCheckButton.setEnabled(false); syncIntensiveCheckButton.setEnabled(false);
syncFastCheckButton.setEnabled(false); syncFastCheckButton.setEnabled(false);
refreshRepoButton.setEnabled(false); refreshRepoButton.setEnabled(false);
@ -614,22 +673,20 @@ public class LauncherGUI implements Observer {
} else { } else {
if (SteamTimer.steam_running) { if (SteamTimer.steam_running) {
if (pathSet) { if (pathSet) {
if (serverTable.getSelectedRow() != -1) {
playButton.setEnabled(true); playButton.setEnabled(true);
playPresetButton.setEnabled(true);
playButton.setToolTipText(null); playButton.setToolTipText(null);
playPresetButton.setToolTipText(null); }
} else {
playButton.setEnabled(false);
playPresetButton.setEnabled(false);
if (presetList.getSelectedIndex() != -1) {
playPresetButton.setEnabled(true);
playPresetButton.setToolTipText(null);
}
} else {
playButton.setToolTipText(LangUtils.getInstance().getString("path_not_set")); playButton.setToolTipText(LangUtils.getInstance().getString("path_not_set"));
playPresetButton.setToolTipText(LangUtils.getInstance().getString("path_not_set")); playPresetButton.setToolTipText(LangUtils.getInstance().getString("path_not_set"));
} }
} else { } else {
playButton.setEnabled(false);
playPresetButton.setEnabled(false);
playButton.setToolTipText(LangUtils.getInstance().getString("steam_not_running")); playButton.setToolTipText(LangUtils.getInstance().getString("steam_not_running"));
playPresetButton.setToolTipText(LangUtils.getInstance().getString("steam_not_running")); playPresetButton.setToolTipText(LangUtils.getInstance().getString("steam_not_running"));
} }
@ -673,7 +730,7 @@ public class LauncherGUI implements Observer {
for (int i = 0; i < directories.length; i++) { for (int i = 0; i < directories.length; i++) {
try { try {
readableDirectories[i] = URLDecoder.decode(directories[i], StandardCharsets.UTF_8.name()); readableDirectories[i] = URLDecoder.decode(directories[i], StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException | IllegalArgumentException e) {
readableDirectories[i] = directories[i]; readableDirectories[i] = directories[i];
} }
} }
@ -681,7 +738,7 @@ public class LauncherGUI implements Observer {
((JComboBox<String>) settingsProfileCombo).setModel(new DefaultComboBoxModel<>(readableDirectories)); ((JComboBox<String>) settingsProfileCombo).setModel(new DefaultComboBoxModel<>(readableDirectories));
initFolderChooser(settingsArmaPathText, settingsArmaPathBtn, Parameters.ARMA_PATH.toStringParameter(), new Callback.JFileSelectCallback() { initFolderChooser(settingsArmaPathText, settingsArmaPathBtn, Parameters.ARMA_PATH.toParameter(), new Callback.JFileSelectCallback() {
@Override @Override
public boolean allowSelection(File path) { public boolean allowSelection(File path) {
String sPath = path.getAbsolutePath(); String sPath = path.getAbsolutePath();
@ -702,7 +759,7 @@ public class LauncherGUI implements Observer {
} }
}); });
initFolderChooser(settingsModsPathText, settingsModsPathBtn, Parameters.MOD_PATH.toStringParameter(), new Callback.JFileSelectCallback() { initFolderChooser(settingsModsPathText, settingsModsPathBtn, Parameters.MOD_PATH.toParameter(), new Callback.JFileSelectCallback() {
@Override @Override
public boolean allowSelection(File path) { public boolean allowSelection(File path) {
String sPath = path.getAbsolutePath(); String sPath = path.getAbsolutePath();
@ -721,39 +778,39 @@ public class LauncherGUI implements Observer {
// -------------------------------- COMBO BOXES -------------------------------- // -------------------------------- COMBO BOXES --------------------------------
initComboBox(settingsLanguageCombo, Parameters.LANGUAGE.toStringParameter()); initComboBox(settingsLanguageCombo, Parameters.LANGUAGE.toParameter());
initComboBox(settingsBehaviorStartCombo, Parameters.BEHAVIOUR_AFTER_START.toStringParameter()); initComboBox(settingsBehaviorStartCombo, Parameters.BEHAVIOUR_AFTER_START.toParameter());
initComboBox(settingsProfileCombo, Parameters.PROFILE.toStringParameter(directories)); initComboBox(settingsProfileCombo, Parameters.PROFILE.toParameter(readableDirectories));
initComboBox(settingsExThreadsCombo, Parameters.EXTRA_THREADS.toStringParameter()); initComboBox(settingsExThreadsCombo, Parameters.EXTRA_THREADS.toParameter());
initComboBox(settingsMallocCombo, Parameters.MALLOC.toStringParameter()); initComboBox(settingsMallocCombo, Parameters.MALLOC.toParameter());
// -------------------------------- CHECK BOXES -------------------------------- // -------------------------------- CHECK BOXES --------------------------------
initCheckBox(settingsShowParameterBox, Parameters.SHOW_START_PARAMETER.toBooolParameter()); initCheckBox(settingsShowParameterBox, Parameters.SHOW_START_PARAMETER.toParameter());
settingsShowParameterBox.addItemListener(e -> parameterText.setVisible(e.getStateChange() == ItemEvent.SELECTED)); settingsShowParameterBox.addItemListener(e -> parameterText.setVisible(e.getStateChange() == ItemEvent.SELECTED));
initCheckBox(settingsCheckModsBox, Parameters.CHECK_MODSET.toBooolParameter()); initCheckBox(settingsCheckModsBox, Parameters.CHECK_MODSET.toParameter());
initCheckBox(settingsUseWorkshopBox, Parameters.USE_WORKSHOP.toBooolParameter()); initCheckBox(settingsUseWorkshopBox, Parameters.USE_WORKSHOP.toParameter());
settingsUseWorkshopBox.addItemListener(e -> { settingsUseWorkshopBox.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) { if (e.getStateChange() == ItemEvent.SELECTED) {
SwingUtilities.invokeLater(() -> warnBox(LangUtils.getInstance().getString("warning_workshop"), LangUtils.getInstance().getString("warning"))); SwingUtilities.invokeLater(() -> warnBox(LangUtils.getInstance().getString("warning_workshop"), LangUtils.getInstance().getString("warning")));
} }
}); });
initCheckBox(settingsUseSixtyFourBitBox, Parameters.USE_64_BIT_CLIENT.toBooolParameter()); initCheckBox(settingsUseSixtyFourBitBox, Parameters.USE_64_BIT_CLIENT.toParameter());
initCheckBox(settingsNoSplashBox, Parameters.NO_SPLASH.toBooolParameter()); initCheckBox(settingsNoSplashBox, Parameters.NO_SPLASH.toParameter());
initCheckBox(settingsSkipIntroBox, Parameters.SKIP_INTRO.toBooolParameter()); initCheckBox(settingsSkipIntroBox, Parameters.SKIP_INTRO.toParameter());
initCheckBox(settingsNoCBBox, Parameters.NO_CB.toBooolParameter()); initCheckBox(settingsNoCBBox, Parameters.NO_CB.toParameter());
initCheckBox(settingsNoLogsBox, Parameters.NO_LOGS.toBooolParameter()); initCheckBox(settingsNoLogsBox, Parameters.NO_LOGS.toParameter());
initCheckBox(settingsEnableHTBox, Parameters.ENABLE_HT.toBooolParameter()); initCheckBox(settingsEnableHTBox, Parameters.ENABLE_HT.toParameter());
initCheckBox(settingsHugeoagesBox, Parameters.HUGEPAGES.toBooolParameter()); initCheckBox(settingsHugeoagesBox, Parameters.HUGEPAGES.toParameter());
initCheckBox(settingsNoPauseBox, Parameters.NO_PAUSE.toBooolParameter()); initCheckBox(settingsNoPauseBox, Parameters.NO_PAUSE.toParameter());
initCheckBox(settingsShowScriptErrorsBox, Parameters.SHOW_SCRIPT_ERRORS.toBooolParameter()); initCheckBox(settingsShowScriptErrorsBox, Parameters.SHOW_SCRIPT_ERRORS.toParameter());
initCheckBox(settingsFilePatchingBox, Parameters.FILE_PATCHING.toBooolParameter()); initCheckBox(settingsFilePatchingBox, Parameters.FILE_PATCHING.toParameter());
initCheckBox(settingsCrashDiagBox, Parameters.CRASH_DIAG.toBooolParameter()); initCheckBox(settingsCrashDiagBox, Parameters.CRASH_DIAG.toParameter());
initCheckBox(settingsWindowBox, Parameters.WINDOW.toBooolParameter()); initCheckBox(settingsWindowBox, Parameters.WINDOW.toParameter());
// -------------------------------- SPINNER -------------------------------- // -------------------------------- SPINNER --------------------------------
@ -761,33 +818,33 @@ public class LauncherGUI implements Observer {
OperatingSystemMXBean mxbean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); OperatingSystemMXBean mxbean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
int memorySize = (int) (mxbean.getTotalPhysicalMemorySize() / 1024); int memorySize = (int) (mxbean.getTotalPhysicalMemorySize() / 1024);
initSpinner(settingsMaxMemSpinner, Parameters.MAX_MEM.toStringParameter(), -1, memorySize); initSpinner(settingsMaxMemSpinner, Parameters.MAX_MEM.toParameter(), -1, memorySize);
initSpinner(settingsMaxVRamSpinner, Parameters.MAX_VRAM.toStringParameter(), -1, 99999); initSpinner(settingsMaxVRamSpinner, Parameters.MAX_VRAM.toParameter(), -1, 99999);
initSpinner(settingsCpuCountSpinner, Parameters.CPU_COUNT.toStringParameter(), 0, Runtime.getRuntime().availableProcessors()); initSpinner(settingsCpuCountSpinner, Parameters.CPU_COUNT.toParameter(), 0, Runtime.getRuntime().availableProcessors());
initSpinner(settingsPosXSpinner, Parameters.POS_X.toStringParameter(), -1, 99999); initSpinner(settingsPosXSpinner, Parameters.POS_X.toParameter(), -1, 99999);
initSpinner(settingsPosYSpinner, Parameters.POS_Y.toStringParameter(), -1, 99999); initSpinner(settingsPosYSpinner, Parameters.POS_Y.toParameter(), -1, 99999);
// -------------------------------- -------------------------------- -------------------------------- // -------------------------------- -------------------------------- --------------------------------
} }
private void initCheckBox(JCheckBox cb, Parameter<Boolean> paraObj) { private void initCheckBox(JCheckBox cb, Parameter paraObj) {
cb.setSelected(paraObj.getValue()); cb.setSelected((Boolean) paraObj.getValue());
cb.addItemListener(new SettingsHandler.CheckBoxListener(paraObj)); cb.addItemListener(new SettingsHandler.CheckBoxListener(paraObj));
} }
private void initComboBox(JComboBox<String> cb, Parameter<String> paraObj) { private void initComboBox(JComboBox<String> cb, Parameter paraObj) {
cb.setSelectedIndex(paraObj.getIndex()); cb.setSelectedIndex(paraObj.getIndex());
if (cb.getItemListeners().length == 1) cb.addItemListener(new SettingsHandler.ComboBoxListener(paraObj)); if (cb.getItemListeners().length == 1) cb.addItemListener(new SettingsHandler.ComboBoxListener(paraObj));
} }
private void initFolderChooser(JTextField showText, JButton actionButton, Parameter<String> paraObj, Callback.JFileSelectCallback check) { private void initFolderChooser(JTextField showText, JButton actionButton, Parameter paraObj, Callback.JFileSelectCallback check) {
showText.setText(paraObj.getValue()); showText.setText((String) paraObj.getValue());
if (actionButton.getActionListeners().length == 0) if (actionButton.getActionListeners().length == 0)
actionButton.addActionListener(new SettingsHandler.Fileistener(mainPanel, paraObj, check)); actionButton.addActionListener(new SettingsHandler.Fileistener(mainPanel, paraObj, check));
} }
public void initSpinner(JSpinner spinner, Parameter<String> paraObj, int min, int max) { public void initSpinner(JSpinner spinner, Parameter paraObj, int min, int max) {
SpinnerNumberModel RAMModel = new SpinnerNumberModel(Integer.parseInt(paraObj.getValue()), min, max, 1); SpinnerNumberModel RAMModel = new SpinnerNumberModel(Integer.parseInt((String) paraObj.getValue()), min, max, 1);
spinner.setModel(RAMModel); spinner.setModel(RAMModel);
JComponent comp = spinner.getEditor(); JComponent comp = spinner.getEditor();
JFormattedTextField field = (JFormattedTextField) comp.getComponent(0); JFormattedTextField field = (JFormattedTextField) comp.getComponent(0);
@ -844,6 +901,8 @@ public class LauncherGUI implements Observer {
if (modset.getType() == Modset.Type.PLACEHOLDER) return; if (modset.getType() == Modset.Type.PLACEHOLDER) return;
int[] select = new int[modset.getMods().size()]; int[] select = new int[modset.getMods().size()];
parameterText.setText(ArmaUtils.getGameParameter(modset));
AtomicInteger selectCounter = new AtomicInteger(0); AtomicInteger selectCounter = new AtomicInteger(0);
RepositoryManger.MOD_LIST.stream() RepositoryManger.MOD_LIST.stream()
.filter((am) -> am instanceof Mod) .filter((am) -> am instanceof Mod)
@ -1061,9 +1120,9 @@ public class LauncherGUI implements Observer {
refreshRepoButton.setEnabled(true); refreshRepoButton.setEnabled(true);
updateRepoTree(); updateRepoTree();
final Parameter<Boolean> checkModsetParameter = Parameters.CHECK_MODSET.toBooolParameter(); final Parameter checkModsetParameter = Parameters.CHECK_MODSET.toParameter();
if(checkModsetParameter.getValue() != null && checkModsetParameter.getValue()) { if (checkModsetParameter.getValue() != null && (boolean) checkModsetParameter.getValue()) {
if(!fileChecker.isChecked()) { if (!fileChecker.isChecked()) {
SwingUtilities.invokeLater(() -> fileCheck(false)); SwingUtilities.invokeLater(() -> fileCheck(false));
Logger.getLogger(getClass().getName()).log(Level.INFO, "Started file check on launch"); Logger.getLogger(getClass().getName()).log(Level.INFO, "Started file check on launch");
} }
@ -1130,8 +1189,8 @@ public class LauncherGUI implements Observer {
lastSynclist = null; lastSynclist = null;
} else if (s.equals("syncStopped")) { } else if (s.equals("syncStopped")) {
final Parameter<Boolean> workshopParameter = Parameters.USE_WORKSHOP.toBooolParameter(); final Parameter workshopParameter = Parameters.USE_WORKSHOP.toParameter();
new Thread(() -> fileChecker.check(!(workshopParameter.getValue() != null && workshopParameter.getValue()))).start(); new Thread(() -> fileChecker.check(!(workshopParameter.getValue() != null && (boolean) workshopParameter.getValue()))).start();
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
syncDownloadButton.setEnabled(false); syncDownloadButton.setEnabled(false);
syncDownloadAbortButton.setEnabled(false); syncDownloadAbortButton.setEnabled(false);
@ -1142,8 +1201,8 @@ public class LauncherGUI implements Observer {
TaskBarUtils.getInstance().off(); TaskBarUtils.getInstance().off();
}); });
} else if (s.equals("syncComplete")) { } else if (s.equals("syncComplete")) {
final Parameter<Boolean> workshopParameter = Parameters.USE_WORKSHOP.toBooolParameter(); final Parameter workshopParameter = Parameters.USE_WORKSHOP.toParameter();
new Thread(() -> fileChecker.check(!(workshopParameter.getValue() != null && workshopParameter.getValue()))).start(); new Thread(() -> fileChecker.check(!(workshopParameter.getValue() != null && (boolean) workshopParameter.getValue()))).start();
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
syncDownloadButton.setEnabled(false); syncDownloadButton.setEnabled(false);
syncDownloadAbortButton.setEnabled(false); syncDownloadAbortButton.setEnabled(false);
@ -1234,6 +1293,9 @@ public class LauncherGUI implements Observer {
switch (tab) { switch (tab) {
case PLAY: case PLAY:
playPanelButton.setBackground(focusBackgroundColor); playPanelButton.setBackground(focusBackgroundColor);
parameterText.setText("");
serverTable.clearSelection();
break; break;
case UPDATE: case UPDATE:
@ -1247,6 +1309,14 @@ public class LauncherGUI implements Observer {
case PRESET: case PRESET:
presetPanelButton.setBackground(focusBackgroundColor); presetPanelButton.setBackground(focusBackgroundColor);
presetList.clearSelection();
modList.setModel(new DefaultListModel<String>());
presetNotePane.setVisible(false);
clonePresetButton.setEnabled(false);
renamePresetButton.setEnabled(false);
removePresetButtom.setEnabled(false);
break; break;
case SETTING: case SETTING:
@ -1276,6 +1346,7 @@ public class LauncherGUI implements Observer {
} }
tabbedPane1.setSelectedIndex(tab.getIndex()); tabbedPane1.setSelectedIndex(tab.getIndex());
techCheck();
} }
{ {
@ -1462,7 +1533,7 @@ public class LauncherGUI implements Observer {
panel6.add(playButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); panel6.add(playButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
parameterText = new JTextField(); parameterText = new JTextField();
parameterText.setEditable(false); parameterText.setEditable(false);
parameterText.setText("-noInit -noLogs"); parameterText.setText("");
panel6.add(parameterText, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); panel6.add(parameterText, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
updateTab = new JPanel(); updateTab = new JPanel();
updateTab.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 5, 0), -1, -1)); updateTab.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 5, 0), -1, -1));
@ -2042,7 +2113,9 @@ public class LauncherGUI implements Observer {
final DefaultComboBoxModel defaultComboBoxModel2 = new DefaultComboBoxModel(); final DefaultComboBoxModel defaultComboBoxModel2 = new DefaultComboBoxModel();
defaultComboBoxModel2.addElement(""); defaultComboBoxModel2.addElement("");
defaultComboBoxModel2.addElement("tbb4malloc_bi"); defaultComboBoxModel2.addElement("tbb4malloc_bi");
defaultComboBoxModel2.addElement("tbb4malloc_bi_x64");
defaultComboBoxModel2.addElement("jemalloc_bi"); defaultComboBoxModel2.addElement("jemalloc_bi");
defaultComboBoxModel2.addElement("jemalloc_bi_x64");
defaultComboBoxModel2.addElement("system"); defaultComboBoxModel2.addElement("system");
settingsMallocCombo.setModel(defaultComboBoxModel2); settingsMallocCombo.setModel(defaultComboBoxModel2);
panel35.add(settingsMallocCombo, new GridConstraints(23, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); panel35.add(settingsMallocCombo, new GridConstraints(23, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));

View File

@ -11,23 +11,23 @@ import java.util.logging.Logger;
/** /**
* Created by gurkengewuerz.de on 24.03.2020. * Created by gurkengewuerz.de on 24.03.2020.
*/ */
public class Parameter<T> { public class Parameter {
private String name; private String name;
private ParameterType pType; private ParameterType pType;
private Class<T> persistentClass; private Class<?> persistentClass;
private String[] values = null; private String[] values = null;
private String startParameter = ""; private String startParameter = "";
public Parameter(String name, ParameterType pType, Class<T> persistentClass) { public Parameter(String name, ParameterType pType, Class<?> persistentClass) {
this(name, pType, persistentClass, null, ""); this(name, pType, persistentClass, null, "");
} }
public Parameter(String name, ParameterType pType, Class<T> persistentClass, String startParameter) { public Parameter(String name, ParameterType pType, Class<?> persistentClass, String startParameter) {
this(name, pType, persistentClass, null, startParameter); this(name, pType, persistentClass, null, startParameter);
} }
public Parameter(String name, ParameterType pType, Class<T> persistentClass, String[] values, String startParameter) { public Parameter(String name, ParameterType pType, Class<?> persistentClass, String[] values, String startParameter) {
this.name = name; this.name = name;
this.pType = pType; this.pType = pType;
this.persistentClass = persistentClass; this.persistentClass = persistentClass;
@ -45,8 +45,8 @@ public class Parameter<T> {
return ""; return "";
} }
public void save(T data) { public void save(Object data) {
T def = getDefault(); Object def = getDefault();
if (data == def || (persistentClass.getTypeName().equals("java.lang.String") && String.valueOf(data).equals(String.valueOf(def)))) { if (data == def || (persistentClass.getTypeName().equals("java.lang.String") && String.valueOf(data).equals(String.valueOf(def)))) {
// remove entry from user config // remove entry from user config
@ -75,7 +75,7 @@ public class Parameter<T> {
public void save(int index) { public void save(int index) {
if(values == null) throw new IllegalAccessError("call of save(int index) is only allowed for ComboBoxes"); if(values == null) throw new IllegalAccessError("call of save(int index) is only allowed for ComboBoxes");
if(index > values.length - 1) throw new IndexOutOfBoundsException("index " + index + " is out of bound. Max: " + (values.length -1)); if(index > values.length - 1) throw new IndexOutOfBoundsException("index " + index + " is out of bound. Max: " + (values.length -1));
save((T) values[index]); save(values[index]);
} }
public String getParameter() { public String getParameter() {
@ -83,7 +83,7 @@ public class Parameter<T> {
return startParameter; return startParameter;
} }
public T getConfigValue() { public Object getConfigValue() {
// Get User Value else Default else null // Get User Value else Default else null
Ini.Section section = ArmA3Launcher.user_config.get(getUserConfigSectionName()); Ini.Section section = ArmA3Launcher.user_config.get(getUserConfigSectionName());
if (section != null) { if (section != null) {
@ -91,16 +91,16 @@ public class Parameter<T> {
String val = section.get(name); String val = section.get(name);
if (persistentClass.getTypeName().equals("java.lang.Boolean")) { if (persistentClass.getTypeName().equals("java.lang.Boolean")) {
return (T) (Boolean) Boolean.valueOf(val.toLowerCase()); return Boolean.valueOf(val.toLowerCase());
} else return (T) val; } else return val;
} }
} }
return null; return null;
} }
public T getValue() { public Object getValue() {
final T configValue = getConfigValue(); final Object configValue = getConfigValue();
if(configValue != null) return configValue; if(configValue != null) return configValue;
return getDefault(); return getDefault();
} }
@ -114,11 +114,11 @@ public class Parameter<T> {
return -1; return -1;
} }
public T getDefault() { public Object getDefault() {
if (persistentClass.getTypeName().equals("java.lang.Boolean")) { if (persistentClass.getTypeName().equals("java.lang.Boolean")) {
return (T) (Boolean) ArmA3Launcher.config.getBoolean( getUserConfigSectionName() + "." + name); return ArmA3Launcher.config.getBoolean( getUserConfigSectionName() + "." + name);
} else if (persistentClass.getTypeName().equals("java.lang.String")) } else if (persistentClass.getTypeName().equals("java.lang.String"))
return (T) ArmA3Launcher.config.getString(getUserConfigSectionName()+ "." + name); return ArmA3Launcher.config.getString(getUserConfigSectionName()+ "." + name);
else return null; else return null;
} }
@ -126,7 +126,7 @@ public class Parameter<T> {
return startParameter; return startParameter;
} }
enum ParameterType { public enum ParameterType {
ARMA, ARMA,
CLIENT CLIENT
} }

View File

@ -5,68 +5,70 @@ package de.mc8051.arma3launcher;
*/ */
public enum Parameters { public enum Parameters {
LANGUAGE("language", Parameter.ParameterType.CLIENT, "", new String[]{"system", "en_US", "de_DE"}), LANGUAGE("language", Parameter.ParameterType.CLIENT, String.class, "", new String[]{"system", "en_US", "de_DE"}),
BEHAVIOUR_AFTER_START("behaviourAfterStart", Parameter.ParameterType.CLIENT, "", new String[]{"nothing", "minimize", "exit"}), BEHAVIOUR_AFTER_START("behaviourAfterStart", Parameter.ParameterType.CLIENT, String.class, "", new String[]{"nothing", "minimize", "exit"}),
SHOW_START_PARAMETER("ShowStartParameter", Parameter.ParameterType.CLIENT), SHOW_START_PARAMETER("ShowStartParameter", Parameter.ParameterType.CLIENT, Boolean.class),
CHECK_MODSET("CheckModset", Parameter.ParameterType.CLIENT), CHECK_MODSET("CheckModset", Parameter.ParameterType.CLIENT, Boolean.class),
USE_WORKSHOP("UseWorkshop", Parameter.ParameterType.CLIENT), USE_WORKSHOP("UseWorkshop", Parameter.ParameterType.CLIENT, Boolean.class),
ARMA_PATH("armaPath", Parameter.ParameterType.CLIENT), ARMA_PATH("armaPath", Parameter.ParameterType.CLIENT, String.class),
MOD_PATH("modPath", Parameter.ParameterType.CLIENT), MOD_PATH("modPath", Parameter.ParameterType.CLIENT, String.class),
PROFILE("Profile", Parameter.ParameterType.ARMA, "name"), PROFILE("Profile", Parameter.ParameterType.ARMA, String.class, "name"),
USE_64_BIT_CLIENT("Use64BitClient", Parameter.ParameterType.ARMA, "Use64BitClient"), USE_64_BIT_CLIENT("Use64BitClient", Parameter.ParameterType.ARMA, Boolean.class),
NO_SPLASH("NoSplash", Parameter.ParameterType.ARMA, "noSplash"), NO_SPLASH("NoSplash", Parameter.ParameterType.ARMA, Boolean.class, "noSplash"),
SKIP_INTRO("SkipIntro", Parameter.ParameterType.ARMA, "skipIntro"), SKIP_INTRO("SkipIntro", Parameter.ParameterType.ARMA, Boolean.class, "skipIntro"),
WORLD("World", Parameter.ParameterType.ARMA, "world"), WORLD("World", Parameter.ParameterType.ARMA, String.class, "world"),
MAX_MEM("MaxMem", Parameter.ParameterType.ARMA, "maxMem"), MAX_MEM("MaxMem", Parameter.ParameterType.ARMA, String.class, "maxMem"),
MAX_VRAM("MaxVRAM", Parameter.ParameterType.ARMA, "maxVRAM"), MAX_VRAM("MaxVRAM", Parameter.ParameterType.ARMA, String.class, "maxVRAM"),
NO_CB("NoCB", Parameter.ParameterType.ARMA, "noCB"), NO_CB("NoCB", Parameter.ParameterType.ARMA, Boolean.class, "noCB"),
CPU_COUNT("CpuCount", Parameter.ParameterType.ARMA, "cpuCount"), CPU_COUNT("CpuCount", Parameter.ParameterType.ARMA, String.class, "cpuCount"),
EXTRA_THREADS("ExThreads", Parameter.ParameterType.ARMA, "exThreads", new String[]{"", "3", "7"}), EXTRA_THREADS("ExThreads", Parameter.ParameterType.ARMA, String.class, "exThreads", new String[]{"", "3", "7"}),
MALLOC("Malloc", Parameter.ParameterType.ARMA, "malloc", new String[]{"", "tbb4malloc_bi", "jemalloc_bi", "system"}), MALLOC("Malloc", Parameter.ParameterType.ARMA, String.class, "malloc", new String[]{"", "tbb4malloc_bi", "tbb4malloc_bi_x64", "jemalloc_bi", "jemalloc_bi_x64", "system"}),
NO_LOGS("NoLogs", Parameter.ParameterType.ARMA, "noLogs"), NO_LOGS("NoLogs", Parameter.ParameterType.ARMA, Boolean.class, "noLogs"),
ENABLE_HT("EnableHT", Parameter.ParameterType.ARMA, "enableHT"), ENABLE_HT("EnableHT", Parameter.ParameterType.ARMA, Boolean.class, "enableHT"),
HUGEPAGES("Hugepages", Parameter.ParameterType.ARMA, "hugepages"), HUGEPAGES("Hugepages", Parameter.ParameterType.ARMA, Boolean.class, "hugepages"),
NO_PAUSE("NoPause", Parameter.ParameterType.ARMA, "noPause"), NO_PAUSE("NoPause", Parameter.ParameterType.ARMA, Boolean.class, "noPause"),
SHOW_SCRIPT_ERRORS("ShowScriptErrors", Parameter.ParameterType.ARMA, "showScriptErrors"), SHOW_SCRIPT_ERRORS("ShowScriptErrors", Parameter.ParameterType.ARMA, Boolean.class, "showScriptErrors"),
FILE_PATCHING("FilePatching", Parameter.ParameterType.ARMA, "filePatching"), FILE_PATCHING("FilePatching", Parameter.ParameterType.ARMA, Boolean.class, "filePatching"),
INIT("Init", Parameter.ParameterType.ARMA, "init"), INIT("Init", Parameter.ParameterType.ARMA, String.class, "init"),
BETA("Beta", Parameter.ParameterType.ARMA, "beta"), BETA("Beta", Parameter.ParameterType.ARMA, String.class, "beta"),
CRASH_DIAG("CrashDiag", Parameter.ParameterType.ARMA, "crashDiag"), CRASH_DIAG("CrashDiag", Parameter.ParameterType.ARMA, Boolean.class, "crashDiag"),
WINDOW("Window", Parameter.ParameterType.ARMA, "window"), WINDOW("Window", Parameter.ParameterType.ARMA, Boolean.class, "window"),
POS_X("PosX", Parameter.ParameterType.ARMA, "posX"), POS_X("PosX", Parameter.ParameterType.ARMA, String.class, "posX"),
POS_Y("PosY", Parameter.ParameterType.ARMA, "posY"); POS_Y("PosY", Parameter.ParameterType.ARMA, String.class, "posY");
private String name; private String name;
private Parameter.ParameterType type; private Parameter.ParameterType type;
private String[] values; private String[] values;
private String startParameter; private String startParameter;
private Class<?> clazz;
Parameters(String name, Parameter.ParameterType type) { Parameters(String name, Parameter.ParameterType type, Class<?> clazz) {
this(name, type, ""); this(name, type, clazz, "");
} }
Parameters(String name, Parameter.ParameterType type, String startParameter) { Parameters(String name, Parameter.ParameterType type, Class<?> clazz, String startParameter) {
this(name, type, startParameter, null); this(name, type, clazz, startParameter, null);
} }
Parameters(String name, Parameter.ParameterType type, String startParameter, String[] values) { Parameters(String name, Parameter.ParameterType type, Class<?> clazz, String startParameter, String[] values) {
this.name = name; this.name = name;
this.type = type; this.type = type;
this.startParameter = startParameter; this.startParameter = startParameter;
this. values = values; this.values = values;
this.clazz = clazz;
} }
public Parameter<String> toStringParameter() { public Parameter toParameter() {
return new Parameter<String>(name, type, String.class, values, startParameter); return new Parameter(name, type, clazz, values, startParameter);
} }
public Parameter<String> toStringParameter(String... values) { public Parameter toParameter(String... values) {
return new Parameter<String>(name, type, String.class, values, startParameter); return new Parameter(name, type, clazz, values, startParameter);
} }
public Parameter<Boolean> toBooolParameter() { public Class<?> getClazz() {
return new Parameter<>(name, type, Boolean.class); return clazz;
} }
public String getName() { public String getName() {

View File

@ -18,9 +18,9 @@ import java.io.File;
public class SettingsHandler { public class SettingsHandler {
public static class CheckBoxListener implements ItemListener { public static class CheckBoxListener implements ItemListener {
private Parameter<Boolean> parameter; private Parameter parameter;
public CheckBoxListener(Parameter<Boolean> parameter) { public CheckBoxListener(Parameter parameter) {
this.parameter = parameter; this.parameter = parameter;
} }
@ -32,9 +32,9 @@ public class SettingsHandler {
public static class ComboBoxListener implements ItemListener { public static class ComboBoxListener implements ItemListener {
private Parameter<String> parameter; private Parameter parameter;
public ComboBoxListener(Parameter<String> parameter) { public ComboBoxListener(Parameter parameter) {
this.parameter = parameter; this.parameter = parameter;
} }
@ -50,10 +50,10 @@ public class SettingsHandler {
public static class Fileistener implements ActionListener { public static class Fileistener implements ActionListener {
private JPanel parent; private JPanel parent;
private Parameter<String> parameter; private Parameter parameter;
private Callback.JFileSelectCallback check; private Callback.JFileSelectCallback check;
public Fileistener(JPanel parent, Parameter<String> parameter, Callback.JFileSelectCallback check) { public Fileistener(JPanel parent, Parameter parameter, Callback.JFileSelectCallback check) {
this.parent = parent; this.parent = parent;
this.parameter = parameter; this.parameter = parameter;
this.check = check; this.check = check;
@ -82,9 +82,9 @@ public class SettingsHandler {
public static class SpinnerListener implements ChangeListener { public static class SpinnerListener implements ChangeListener {
private static long lastChange = -1; private static long lastChange = -1;
private Parameter<String> parameter; private Parameter parameter;
public SpinnerListener(Parameter<String> parameter) { public SpinnerListener(Parameter parameter) {
this.parameter = parameter; this.parameter = parameter;
} }

View File

@ -29,6 +29,7 @@ public class PresetTableModel extends AbstractListModel {
@Override @Override
public Object getElementAt(int index) { public Object getElementAt(int index) {
if(index == -1) return null;
return data.get(index); return data.get(index);
} }
} }

View File

@ -39,6 +39,10 @@ public class ServerTableModel extends AbstractTableModel {
return columnNames.length; return columnNames.length;
} }
public Server getServer(int row) {
return data.get(row);
}
@Override @Override
public Object getValueAt(int rowIndex, int columnIndex) { public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex == 0) return data.get(rowIndex).getName(); if (columnIndex == 0) return data.get(rowIndex).getName();

View File

@ -1,12 +1,16 @@
package de.mc8051.arma3launcher.objects; package de.mc8051.arma3launcher.objects;
import de.mc8051.arma3launcher.ArmA3Launcher; import de.mc8051.arma3launcher.ArmA3Launcher;
import de.mc8051.arma3launcher.Parameter;
import de.mc8051.arma3launcher.Parameters;
import org.ini4j.Ini; import org.ini4j.Ini;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
@ -108,8 +112,10 @@ public class Modset implements Comparable {
return type; return type;
} }
public void play() { public List<String> getStartParamter() {
// TODO: Implement play with this Modset return mods.stream()
.map(m -> new File((String) Parameters.MOD_PATH.toParameter().getValue(), m.getName()).getAbsolutePath())
.collect(Collectors.toList());
} }
public Modset clone(String newName, Type newType) { public Modset clone(String newName, Type newType) {

View File

@ -2,7 +2,9 @@ package de.mc8051.arma3launcher.objects;
import org.json.JSONObject; import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
/** /**
* Created by gurkengewuerz.de on 25.03.2020. * Created by gurkengewuerz.de on 25.03.2020.
@ -28,13 +30,13 @@ public class Server {
} }
public Server(JSONObject o) { public Server(JSONObject o) {
if(!o.has("name") || !o.has("password") || !o.has("ipaddress") || !o.has("port") || !o.has("preset")) return; if (!o.has("name") || !o.has("password") || !o.has("ipaddress") || !o.has("port") || !o.has("preset")) return;
name = o.getString("name"); name = o.getString("name");
password = o.getString("password"); password = o.getString("password");
ip = o.getString("ipaddress"); ip = o.getString("ipaddress");
port = o.getInt("port"); port = o.getInt("port");
if(!Modset.MODSET_LIST.containsKey(o.getString("preset"))) return; if (!Modset.MODSET_LIST.containsKey(o.getString("preset"))) return;
preset = Modset.MODSET_LIST.get(o.getString("preset")); preset = Modset.MODSET_LIST.get(o.getString("preset"));
SERVER_LIST.put(name, this); SERVER_LIST.put(name, this);
@ -59,4 +61,13 @@ public class Server {
public Modset getPreset() { public Modset getPreset() {
return preset; return preset;
} }
public ArrayList<String> getStartparameter() {
ArrayList<String> list = new ArrayList<>();
list.add("-connect=" + ip);
list.add("-port=" + port);
if (password.isEmpty())
list.add("-password=" + ip);
return list;
}
} }

View File

@ -98,8 +98,8 @@ public class Syncer implements Observable, SyncListener {
TaskBarUtils.getInstance().normal(); TaskBarUtils.getInstance().normal();
}); });
final Parameter<Boolean> workshopParameter = Parameters.USE_WORKSHOP.toBooolParameter(); final Parameter workshopParameter = Parameters.USE_WORKSHOP.toParameter();
if(workshopParameter.getValue() != null && workshopParameter.getValue()) workshopFiles = WorkshopUtil.workshopFiles(); if(workshopParameter.getValue() != null && (Boolean) workshopParameter.getValue()) workshopFiles = WorkshopUtil.workshopFiles();
boolean lastPause = false; boolean lastPause = false;
while (running) { while (running) {

View File

@ -18,7 +18,7 @@ public class WorkshopUtil {
public static Map<Path, Long> workshopFiles() { public static Map<Path, Long> workshopFiles() {
Map<Path, Long> fileMap = new HashMap<>(); Map<Path, Long> fileMap = new HashMap<>();
final String armaPath = Parameters.ARMA_PATH.toStringParameter().getValue(); final String armaPath = (String) Parameters.ARMA_PATH.toParameter().getValue();
if(armaPath == null) return fileMap; if(armaPath == null) return fileMap;
final Path workshopPath = Paths.get(armaPath, "!Workshop"); final Path workshopPath = Paths.get(armaPath, "!Workshop");

View File

@ -1,5 +1,8 @@
package de.mc8051.arma3launcher.utils; package de.mc8051.arma3launcher.utils;
import de.mc8051.arma3launcher.Parameter;
import de.mc8051.arma3launcher.Parameters;
import de.mc8051.arma3launcher.objects.Modset;
import de.ralleytn.simple.registry.Key; import de.ralleytn.simple.registry.Key;
import de.ralleytn.simple.registry.Registry; import de.ralleytn.simple.registry.Registry;
@ -9,8 +12,10 @@ import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.stream.Collectors;
/** /**
* Created by gurkengewuerz.de on 30.03.2020. * Created by gurkengewuerz.de on 30.03.2020.
@ -31,7 +36,7 @@ public class ArmaUtils {
if (regKey == null) return null; if (regKey == null) return null;
final Path main = Paths.get(regKey.getValueByName("main").getRawValue()); final Path main = Paths.get(regKey.getValueByName("main").getRawValue());
if(!checkArmaPath(main)) return null; if (!checkArmaPath(main)) return null;
return main; return main;
} }
@ -54,4 +59,56 @@ public class ArmaUtils {
} }
return false; return false;
} }
public static String getGameParameter(Modset modset) {
StringBuilder sb = new StringBuilder();
List<String> parameters = Arrays.stream(Parameters.values())
.filter(p -> p.getType() == Parameter.ParameterType.ARMA)
.filter(p -> !p.getStartParameter().isEmpty())
.filter(p -> {
if (p.getClazz() == Boolean.class) {
boolean b = (boolean) p.toParameter().getValue();
return b;
}
String paraVal = (String) p.toParameter().getValue();
return !(paraVal == null || paraVal.isEmpty() || paraVal.equals("-1") || paraVal.equals("0"));
})
.map(parameter -> {
final Class<?> clazz = parameter.getClazz();
if (clazz == Boolean.class) {
return "-" + parameter.getStartParameter();
}
return "\"-" + parameter.getStartParameter() + "=" + parameter.toParameter().getValue() + "\"";
})
.collect(Collectors.toList());
sb.append(String.join(" ", parameters)).append(" ");
final List<String> modParameter = modset.getStartParamter();
if (!modParameter.isEmpty())
sb.append("\"-mod=").append(String.join(";", modParameter)).append("\"");
return sb.toString();
}
public static void start(Modset modset) {
start(modset, new String[]{});
}
public static void start(Modset modset, String... additionalParams) {
final Parameter armaPathParameter = Parameters.ARMA_PATH.toParameter();
File arma3battleye = new File((String) armaPathParameter.getValue(), "arma3battleye.exe");
final Parameter use64Bit = Parameters.USE_64_BIT_CLIENT.toParameter();
String gameParameters = getGameParameter(modset);
String additionalParameters = String.join(" ", additionalParams);
String battleEye = "\"" + arma3battleye.getAbsolutePath() + "\" 2 1 1 -exe " + ((Boolean) use64Bit.getValue() ? "arma3_x64.exe" : "arma3.exe");
String command = battleEye + " " + gameParameters + " " + additionalParameters;
Logger.getLogger(ArmaUtils.class.getName()).log(Level.INFO, command);
try {
Runtime.getRuntime().exec(command);
} catch (IOException e) {
Logger.getLogger(ArmaUtils.class.getName()).log(Level.INFO, "Starting failed!", e);
}
}
} }