feat: [#727] remove initial memory argument
This commit is contained in:
parent
f0f0d098c7
commit
036031222b
7 changed files with 170 additions and 133 deletions
|
@ -10,6 +10,7 @@ This changelog only contains the changes that are unreleased. For changes for in
|
|||
- Add in a unified modpack search to search across multiple platforms at once [#720]
|
||||
- Add category filtering when adding mods/shaders/worlds/resource packs
|
||||
- List the timeout and concurrent connection settings when downloads fail
|
||||
- Remove initial memory argument [#727]
|
||||
|
||||
### Fixes
|
||||
- Remove old OmitStackTraceInFastThrow JVM arg
|
||||
|
|
|
@ -1895,8 +1895,12 @@ public class Instance extends MinecraftVersion {
|
|||
instanceCfg.setProperty("MCLaunchMethod", "LauncherPart");
|
||||
instanceCfg.setProperty("MaxMemAlloc",
|
||||
Optional.ofNullable(launcher.maximumMemory).orElse(App.settings.maximumMemory) + "");
|
||||
instanceCfg.setProperty("MinMemAlloc",
|
||||
Optional.ofNullable(launcher.initialMemory).orElse(App.settings.initialMemory) + "");
|
||||
|
||||
if (ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false) {
|
||||
instanceCfg.setProperty("MinMemAlloc",
|
||||
Optional.ofNullable(launcher.initialMemory).orElse(App.settings.initialMemory) + "");
|
||||
}
|
||||
|
||||
instanceCfg.setProperty("MinecraftWinHeight", App.settings.windowHeight + "");
|
||||
instanceCfg.setProperty("MinecraftWinWidth", App.settings.windowWidth + "");
|
||||
instanceCfg.setProperty("OverrideCommands",
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.UUID;
|
|||
import com.atlauncher.FileSystem;
|
||||
import com.atlauncher.Gsons;
|
||||
import com.atlauncher.constants.Constants;
|
||||
import com.atlauncher.managers.ConfigManager;
|
||||
import com.atlauncher.managers.LogManager;
|
||||
import com.atlauncher.utils.OS;
|
||||
import com.atlauncher.utils.Timestamper;
|
||||
|
@ -391,16 +392,18 @@ public class Settings {
|
|||
boolean needToSave = false;
|
||||
int systemMemory = OS.getMaximumRam();
|
||||
|
||||
if (systemMemory != 0 && initialMemory > systemMemory) {
|
||||
LogManager.warn("Tried to allocate " + initialMemory + "MB for initial memory but only " + systemMemory
|
||||
+ "MB is available to use!");
|
||||
initialMemory = 512;
|
||||
needToSave = true;
|
||||
} else if (initialMemory > maximumMemory) {
|
||||
LogManager.warn("Tried to allocate " + initialMemory + "MB for initial memory which is more than "
|
||||
+ maximumMemory + "MB set for the maximum memory!");
|
||||
initialMemory = 512;
|
||||
needToSave = true;
|
||||
if (ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false) {
|
||||
if (systemMemory != 0 && initialMemory > systemMemory) {
|
||||
LogManager.warn("Tried to allocate " + initialMemory + "MB for initial memory but only " + systemMemory
|
||||
+ "MB is available to use!");
|
||||
initialMemory = 512;
|
||||
needToSave = true;
|
||||
} else if (initialMemory > maximumMemory) {
|
||||
LogManager.warn("Tried to allocate " + initialMemory + "MB for initial memory which is more than "
|
||||
+ maximumMemory + "MB set for the maximum memory!");
|
||||
initialMemory = 512;
|
||||
needToSave = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (systemMemory != 0 && maximumMemory > systemMemory) {
|
||||
|
|
|
@ -19,6 +19,8 @@ package com.atlauncher.data.multimc;
|
|||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.atlauncher.managers.ConfigManager;
|
||||
|
||||
public class MultiMCInstanceConfig {
|
||||
public String name;
|
||||
|
||||
|
@ -38,7 +40,8 @@ public class MultiMCInstanceConfig {
|
|||
name = "MultiMC Import";
|
||||
}
|
||||
|
||||
if (props.getProperty("MinMemAlloc") != null) {
|
||||
if (props.getProperty("MinMemAlloc") != null
|
||||
&& ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false) {
|
||||
initialMemory = Integer.parseInt(props.getProperty("MinMemAlloc"));
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ import com.atlauncher.constants.UIConstants;
|
|||
import com.atlauncher.data.Instance;
|
||||
import com.atlauncher.data.minecraft.JavaRuntime;
|
||||
import com.atlauncher.gui.components.JLabelWithHover;
|
||||
import com.atlauncher.managers.ConfigManager;
|
||||
import com.atlauncher.managers.DialogManager;
|
||||
import com.atlauncher.utils.ComboItem;
|
||||
import com.atlauncher.utils.Java;
|
||||
|
@ -100,65 +101,67 @@ public class JavaInstanceSettingsTab extends JPanel {
|
|||
int systemRam = OS.getSystemRam();
|
||||
setLayout(new GridBagLayout());
|
||||
|
||||
// Initial Memory Settings
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy++;
|
||||
gbc.insets = UIConstants.LABEL_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
|
||||
if (ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false) {
|
||||
// Initial Memory Settings
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy++;
|
||||
gbc.insets = UIConstants.LABEL_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
|
||||
|
||||
JLabelWithHover initialMemoryLabelWarning = new JLabelWithHover(WARNING_ICON,
|
||||
"<html>" + Utils.splitMultilinedString(GetText.tr(
|
||||
"You are running a 32 bit Java and therefore cannot use more than 1GB of Ram. Please see http://atl.pw/32bit for help."),
|
||||
80, "<br/>") + "</html>",
|
||||
RESTART_BORDER);
|
||||
JLabelWithHover initialMemoryLabelWarning = new JLabelWithHover(WARNING_ICON,
|
||||
"<html>" + Utils.splitMultilinedString(GetText.tr(
|
||||
"You are running a 32 bit Java and therefore cannot use more than 1GB of Ram. Please see http://atl.pw/32bit for help."),
|
||||
80, "<br/>") + "</html>",
|
||||
RESTART_BORDER);
|
||||
|
||||
JLabelWithHover initialMemoryLabel = new JLabelWithHover(GetText.tr("Initial Memory/Ram") + ":", HELP_ICON,
|
||||
"<html>" + Utils.splitMultilinedString(GetText.tr(
|
||||
"Initial memory/ram is the starting amount of memory/ram to use when starting Minecraft. This should be left at the default of 512 MB unless you know what your doing."),
|
||||
80, "<br/>") + "</html>");
|
||||
JLabelWithHover initialMemoryLabel = new JLabelWithHover(GetText.tr("Initial Memory/Ram") + ":", HELP_ICON,
|
||||
"<html>" + Utils.splitMultilinedString(GetText.tr(
|
||||
"Initial memory/ram is the starting amount of memory/ram to use when starting Minecraft. This should be left at the default of 512 MB unless you know what your doing."),
|
||||
80, "<br/>") + "</html>");
|
||||
|
||||
JPanel initialMemoryPanel = new JPanel();
|
||||
initialMemoryPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
|
||||
if (!Java.is64Bit()) {
|
||||
initialMemoryPanel.add(initialMemoryLabelWarning);
|
||||
}
|
||||
initialMemoryPanel.add(initialMemoryLabel);
|
||||
JPanel initialMemoryPanel = new JPanel();
|
||||
initialMemoryPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
|
||||
if (!Java.is64Bit()) {
|
||||
initialMemoryPanel.add(initialMemoryLabelWarning);
|
||||
}
|
||||
initialMemoryPanel.add(initialMemoryLabel);
|
||||
|
||||
add(initialMemoryPanel, gbc);
|
||||
add(initialMemoryPanel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel initialMemoryModel = new SpinnerNumberModel(
|
||||
getIfNotNull(this.instance.launcher.initialMemory, App.settings.initialMemory), null, null, 128);
|
||||
initialMemoryModel.setMinimum(128);
|
||||
initialMemoryModel.setMaximum((systemRam == 0 ? null : systemRam));
|
||||
initialMemory = new JSpinner(initialMemoryModel);
|
||||
((JSpinner.DefaultEditor) initialMemory.getEditor()).getTextField().setColumns(5);
|
||||
initialMemory.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
JSpinner s = (JSpinner) e.getSource();
|
||||
// if initial memory is larger than maximum memory, make maximum memory match
|
||||
if ((Integer) s.getValue() > (Integer) maximumMemory.getValue()) {
|
||||
maximumMemory.setValue((Integer) s.getValue());
|
||||
}
|
||||
gbc.gridx++;
|
||||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel initialMemoryModel = new SpinnerNumberModel(
|
||||
getIfNotNull(this.instance.launcher.initialMemory, App.settings.initialMemory), null, null, 128);
|
||||
initialMemoryModel.setMinimum(128);
|
||||
initialMemoryModel.setMaximum((systemRam == 0 ? null : systemRam));
|
||||
initialMemory = new JSpinner(initialMemoryModel);
|
||||
((JSpinner.DefaultEditor) initialMemory.getEditor()).getTextField().setColumns(5);
|
||||
initialMemory.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
JSpinner s = (JSpinner) e.getSource();
|
||||
// if initial memory is larger than maximum memory, make maximum memory match
|
||||
if ((Integer) s.getValue() > (Integer) maximumMemory.getValue()) {
|
||||
maximumMemory.setValue((Integer) s.getValue());
|
||||
}
|
||||
|
||||
if ((Integer) s.getValue() > 512 && !initialMemoryWarningShown) {
|
||||
initialMemoryWarningShown = true;
|
||||
int ret = DialogManager.yesNoDialog().setTitle(GetText.tr("Warning"))
|
||||
.setType(DialogManager.WARNING)
|
||||
.setContent(GetText.tr(
|
||||
"Setting initial memory above 512MB is not recommended and can cause issues. Are you sure you want to do this?"))
|
||||
.show();
|
||||
if ((Integer) s.getValue() > 512 && !initialMemoryWarningShown) {
|
||||
initialMemoryWarningShown = true;
|
||||
int ret = DialogManager.yesNoDialog().setTitle(GetText.tr("Warning"))
|
||||
.setType(DialogManager.WARNING)
|
||||
.setContent(GetText.tr(
|
||||
"Setting initial memory above 512MB is not recommended and can cause issues. Are you sure you want to do this?"))
|
||||
.show();
|
||||
|
||||
if (ret != 0) {
|
||||
initialMemory.setValue(512);
|
||||
if (ret != 0) {
|
||||
initialMemory.setValue(512);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
add(initialMemory, gbc);
|
||||
});
|
||||
add(initialMemory, gbc);
|
||||
}
|
||||
|
||||
// Maximum Memory Settings
|
||||
gbc.gridx = 0;
|
||||
|
@ -190,9 +193,11 @@ public class JavaInstanceSettingsTab extends JPanel {
|
|||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
JSpinner s = (JSpinner) e.getSource();
|
||||
// if initial memory is larger than maximum memory, make initial memory match
|
||||
if ((Integer) initialMemory.getValue() > (Integer) s.getValue()) {
|
||||
initialMemory.setValue(s.getValue());
|
||||
if (ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false) {
|
||||
// if initial memory is larger than maximum memory, make initial memory match
|
||||
if ((Integer) initialMemory.getValue() > (Integer) s.getValue()) {
|
||||
initialMemory.setValue(s.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if ((Integer) s.getValue() > 8192 && !maximumMemoryEightGBWarningShown) {
|
||||
|
@ -648,7 +653,8 @@ public class JavaInstanceSettingsTab extends JPanel {
|
|||
}
|
||||
|
||||
public boolean isValidJavaParamaters() {
|
||||
if (javaParameters.getText().contains("-Xms") || javaParameters.getText().contains("-Xmx")
|
||||
if ((ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false
|
||||
&& javaParameters.getText().contains("-Xms")) || javaParameters.getText().contains("-Xmx")
|
||||
|| javaParameters.getText().contains("-XX:PermSize")
|
||||
|| javaParameters.getText().contains("-XX:MetaspaceSize")) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("Help")).setContent(new HTMLBuilder().center().text(GetText.tr(
|
||||
|
@ -660,7 +666,12 @@ public class JavaInstanceSettingsTab extends JPanel {
|
|||
}
|
||||
|
||||
public void saveSettings() {
|
||||
Integer initialMemory = (Integer) this.initialMemory.getValue();
|
||||
if (ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false) {
|
||||
Integer initialMemory = (Integer) this.initialMemory.getValue();
|
||||
|
||||
this.instance.launcher.initialMemory = (initialMemory == App.settings.initialMemory ? null : initialMemory);
|
||||
}
|
||||
|
||||
Integer maximumMemory = (Integer) this.maximumMemory.getValue();
|
||||
Integer permGen = (Integer) this.permGen.getValue();
|
||||
String javaPath = this.javaPath.getText();
|
||||
|
@ -673,7 +684,6 @@ public class JavaInstanceSettingsTab extends JPanel {
|
|||
Boolean useSystemGlfwVal = ((ComboItem<Boolean>) useSystemGlfw.getSelectedItem()).getValue();
|
||||
Boolean useSystemOpenAlVal = ((ComboItem<Boolean>) useSystemOpenAl.getSelectedItem()).getValue();
|
||||
|
||||
this.instance.launcher.initialMemory = (initialMemory == App.settings.initialMemory ? null : initialMemory);
|
||||
this.instance.launcher.maximumMemory = (maximumMemory == App.settings.maximumMemory ? null : maximumMemory);
|
||||
this.instance.launcher.permGen = (permGen == App.settings.metaspace ? null : permGen);
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ import com.atlauncher.evnt.listener.SettingsListener;
|
|||
import com.atlauncher.evnt.manager.RelocalizationManager;
|
||||
import com.atlauncher.evnt.manager.SettingsManager;
|
||||
import com.atlauncher.gui.components.JLabelWithHover;
|
||||
import com.atlauncher.managers.ConfigManager;
|
||||
import com.atlauncher.managers.DialogManager;
|
||||
import com.atlauncher.utils.ComboItem;
|
||||
import com.atlauncher.utils.Java;
|
||||
|
@ -61,9 +62,9 @@ import com.atlauncher.utils.javafinder.JavaInfo;
|
|||
|
||||
@SuppressWarnings("serial")
|
||||
public class JavaSettingsTab extends AbstractSettingsTab implements RelocalizationListener, SettingsListener {
|
||||
private final JLabelWithHover initialMemoryLabel;
|
||||
private final JSpinner initialMemory;
|
||||
private final JLabelWithHover initialMemoryLabelWarning;
|
||||
private JLabelWithHover initialMemoryLabel;
|
||||
private JSpinner initialMemory;
|
||||
private JLabelWithHover initialMemoryLabelWarning;
|
||||
|
||||
private final JLabelWithHover maximumMemoryLabel;
|
||||
private final JSpinner maximumMemory;
|
||||
|
@ -108,62 +109,66 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
RelocalizationManager.addListener(this);
|
||||
SettingsManager.addListener(this);
|
||||
|
||||
// Initial Memory Settings
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy++;
|
||||
gbc.insets = UIConstants.LABEL_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
|
||||
if (ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false) {
|
||||
// Initial Memory Settings
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy++;
|
||||
gbc.insets = UIConstants.LABEL_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
|
||||
|
||||
initialMemoryLabelWarning = new JLabelWithHover(WARNING_ICON, new HTMLBuilder().center().split(100).text(GetText
|
||||
.tr("You're running a 32 bit Java and therefore cannot use more than 1GB of Ram. Please see http://atl.pw/32bit for help."))
|
||||
.build(), RESTART_BORDER);
|
||||
initialMemoryLabelWarning = new JLabelWithHover(WARNING_ICON,
|
||||
new HTMLBuilder().center().split(100).text(GetText
|
||||
.tr("You're running a 32 bit Java and therefore cannot use more than 1GB of Ram. Please see http://atl.pw/32bit for help."))
|
||||
.build(),
|
||||
RESTART_BORDER);
|
||||
|
||||
initialMemoryLabel = new JLabelWithHover(GetText.tr("Initial Memory/Ram") + ":", HELP_ICON,
|
||||
new HTMLBuilder().center().split(100).text(GetText.tr(
|
||||
"Initial memory/ram is the starting amount of memory/ram to use when starting Minecraft. This should be left at the default of 512 MB unless you know what your doing."))
|
||||
.build());
|
||||
initialMemoryLabel = new JLabelWithHover(GetText.tr("Initial Memory/Ram") + ":", HELP_ICON,
|
||||
new HTMLBuilder().center().split(100).text(GetText.tr(
|
||||
"Initial memory/ram is the starting amount of memory/ram to use when starting Minecraft. This should be left at the default of 512 MB unless you know what your doing."))
|
||||
.build());
|
||||
|
||||
JPanel initialMemoryPanel = new JPanel();
|
||||
initialMemoryPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
|
||||
if (!Java.is64Bit()) {
|
||||
initialMemoryPanel.add(initialMemoryLabelWarning);
|
||||
}
|
||||
initialMemoryPanel.add(initialMemoryLabel);
|
||||
JPanel initialMemoryPanel = new JPanel();
|
||||
initialMemoryPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
|
||||
if (!Java.is64Bit()) {
|
||||
initialMemoryPanel.add(initialMemoryLabelWarning);
|
||||
}
|
||||
initialMemoryPanel.add(initialMemoryLabel);
|
||||
|
||||
add(initialMemoryPanel, gbc);
|
||||
add(initialMemoryPanel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel initialMemoryModel = new SpinnerNumberModel(App.settings.initialMemory, null, null, 128);
|
||||
initialMemoryModel.setMinimum(128);
|
||||
initialMemoryModel.setMaximum((systemRam == 0 ? null : systemRam));
|
||||
initialMemory = new JSpinner(initialMemoryModel);
|
||||
((JSpinner.DefaultEditor) initialMemory.getEditor()).getTextField().setColumns(5);
|
||||
initialMemory.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
JSpinner s = (JSpinner) e.getSource();
|
||||
// if initial memory is larger than maximum memory, make maximum memory match
|
||||
if ((Integer) s.getValue() > (Integer) maximumMemory.getValue()) {
|
||||
maximumMemory.setValue((Integer) s.getValue());
|
||||
}
|
||||
gbc.gridx++;
|
||||
gbc.insets = UIConstants.FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
SpinnerNumberModel initialMemoryModel = new SpinnerNumberModel(App.settings.initialMemory, null, null, 128);
|
||||
initialMemoryModel.setMinimum(128);
|
||||
initialMemoryModel.setMaximum((systemRam == 0 ? null : systemRam));
|
||||
initialMemory = new JSpinner(initialMemoryModel);
|
||||
((JSpinner.DefaultEditor) initialMemory.getEditor()).getTextField().setColumns(5);
|
||||
initialMemory.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
JSpinner s = (JSpinner) e.getSource();
|
||||
// if initial memory is larger than maximum memory, make maximum memory match
|
||||
if ((Integer) s.getValue() > (Integer) maximumMemory.getValue()) {
|
||||
maximumMemory.setValue((Integer) s.getValue());
|
||||
}
|
||||
|
||||
if ((Integer) s.getValue() > 512 && !initialMemoryWarningShown) {
|
||||
initialMemoryWarningShown = true;
|
||||
int ret = DialogManager.yesNoDialog().setTitle(GetText.tr("Warning"))
|
||||
.setType(DialogManager.WARNING)
|
||||
.setContent(GetText.tr(
|
||||
"Setting initial memory above 512MB is not recommended and can cause issues. Are you sure you want to do this?"))
|
||||
.show();
|
||||
if ((Integer) s.getValue() > 512 && !initialMemoryWarningShown) {
|
||||
initialMemoryWarningShown = true;
|
||||
int ret = DialogManager.yesNoDialog().setTitle(GetText.tr("Warning"))
|
||||
.setType(DialogManager.WARNING)
|
||||
.setContent(GetText.tr(
|
||||
"Setting initial memory above 512MB is not recommended and can cause issues. Are you sure you want to do this?"))
|
||||
.show();
|
||||
|
||||
if (ret != 0) {
|
||||
initialMemory.setValue(512);
|
||||
if (ret != 0) {
|
||||
initialMemory.setValue(512);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
add(initialMemory, gbc);
|
||||
});
|
||||
add(initialMemory, gbc);
|
||||
}
|
||||
|
||||
// Maximum Memory Settings
|
||||
// Perm Gen Settings
|
||||
|
@ -200,9 +205,11 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
JSpinner s = (JSpinner) e.getSource();
|
||||
// if initial memory is larger than maximum memory, make initial memory match
|
||||
if ((Integer) initialMemory.getValue() > (Integer) s.getValue()) {
|
||||
initialMemory.setValue(s.getValue());
|
||||
if (ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false) {
|
||||
// if initial memory is larger than maximum memory, make initial memory match
|
||||
if ((Integer) initialMemory.getValue() > (Integer) s.getValue()) {
|
||||
initialMemory.setValue(s.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if ((Integer) s.getValue() > 8192 && !maximumMemoryEightGBWarningShown) {
|
||||
|
@ -648,7 +655,8 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
}
|
||||
|
||||
public boolean isValidJavaParamaters() {
|
||||
if (javaParameters.getText().contains("-Xms") || javaParameters.getText().contains("-Xmx")
|
||||
if ((ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false
|
||||
&& javaParameters.getText().contains("-Xms")) || javaParameters.getText().contains("-Xmx")
|
||||
|| javaParameters.getText().contains("-XX:PermSize")
|
||||
|| javaParameters.getText().contains("-XX:MetaspaceSize")) {
|
||||
DialogManager.okDialog().setTitle(GetText.tr("Help")).setContent(new HTMLBuilder().center().text(GetText.tr(
|
||||
|
@ -660,7 +668,10 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
}
|
||||
|
||||
public void save() {
|
||||
App.settings.initialMemory = (Integer) initialMemory.getValue();
|
||||
if (ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false) {
|
||||
App.settings.initialMemory = (Integer) initialMemory.getValue();
|
||||
}
|
||||
|
||||
App.settings.maximumMemory = (Integer) maximumMemory.getValue();
|
||||
App.settings.metaspace = (Integer) permGen.getValue();
|
||||
App.settings.windowWidth = (Integer) widthField.getValue();
|
||||
|
@ -690,14 +701,16 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
|
||||
@Override
|
||||
public void onRelocalization() {
|
||||
this.initialMemoryLabelWarning.setToolTipText(new HTMLBuilder().center().split(100).text(GetText.tr(
|
||||
"You're running a 32 bit Java and therefore cannot use more than 1GB of Ram. Please see http://atl.pw/32bit for help."))
|
||||
.build());
|
||||
if (ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false) {
|
||||
this.initialMemoryLabelWarning.setToolTipText(new HTMLBuilder().center().split(100).text(GetText.tr(
|
||||
"You're running a 32 bit Java and therefore cannot use more than 1GB of Ram. Please see http://atl.pw/32bit for help."))
|
||||
.build());
|
||||
|
||||
this.initialMemoryLabel.setText(GetText.tr("Initial Memory/Ram") + ":");
|
||||
this.initialMemoryLabel.setToolTipText(new HTMLBuilder().center().split(100).text(GetText.tr(
|
||||
"Initial memory/ram is the starting amount of memory/ram to use when starting Minecraft. This should be left at the default of 512 MB unless you know what your doing."))
|
||||
.build());
|
||||
this.initialMemoryLabel.setText(GetText.tr("Initial Memory/Ram") + ":");
|
||||
this.initialMemoryLabel.setToolTipText(new HTMLBuilder().center().split(100).text(GetText.tr(
|
||||
"Initial memory/ram is the starting amount of memory/ram to use when starting Minecraft. This should be left at the default of 512 MB unless you know what your doing."))
|
||||
.build());
|
||||
}
|
||||
|
||||
this.maximumMemoryLabel.setText(GetText.tr("Maximum Memory/Ram") + ":");
|
||||
this.maximumMemoryLabel.setToolTipText(new HTMLBuilder().center().split(100)
|
||||
|
|
|
@ -40,6 +40,7 @@ import com.atlauncher.data.MojangAccount;
|
|||
import com.atlauncher.data.minecraft.Library;
|
||||
import com.atlauncher.data.minecraft.LoggingClient;
|
||||
import com.atlauncher.data.minecraft.PropertyMapSerializer;
|
||||
import com.atlauncher.managers.ConfigManager;
|
||||
import com.atlauncher.managers.LWJGLManager;
|
||||
import com.atlauncher.managers.LogManager;
|
||||
import com.atlauncher.network.ErrorReporting;
|
||||
|
@ -176,7 +177,6 @@ public class MCLauncher {
|
|||
ErrorReporting.recordInstancePlay(instance.getPackName(), instance.getVersion(), instance.getLoaderVersion(),
|
||||
2);
|
||||
|
||||
int initialMemory = Optional.ofNullable(instance.launcher.initialMemory).orElse(App.settings.initialMemory);
|
||||
int maximumMemory = Optional.ofNullable(instance.launcher.maximumMemory).orElse(App.settings.maximumMemory);
|
||||
int permGen = Optional.ofNullable(instance.launcher.permGen).orElse(App.settings.metaspace);
|
||||
String javaArguments = Optional.ofNullable(instance.launcher.javaArguments).orElse(App.settings.javaParameters);
|
||||
|
@ -267,7 +267,10 @@ public class MCLauncher {
|
|||
}
|
||||
arguments.add(path);
|
||||
|
||||
arguments.add("-Xms" + initialMemory + "M");
|
||||
if (ConfigManager.getConfigItem("removeInitialMemoryOption", false) == false) {
|
||||
int initialMemory = Optional.ofNullable(instance.launcher.initialMemory).orElse(App.settings.initialMemory);
|
||||
arguments.add("-Xms" + initialMemory + "M");
|
||||
}
|
||||
|
||||
if (OS.getMaximumRam() != 0 && maximumMemory < instance.getMemory()) {
|
||||
if ((OS.getMaximumRam() / 2) < instance.getMemory()) {
|
||||
|
|
Loading…
Reference in a new issue