Removed -XstartOnFirstThread to fix freezed launched game. GH-257

This commit is contained in:
huangyuhui
2018-02-01 15:57:55 +08:00
parent 31c05c9b20
commit cec8249b24
18 changed files with 87 additions and 45 deletions

View File

@@ -117,13 +117,15 @@ public final class AccountsPage extends StackPane implements DecoratorPage {
return item; return item;
} }
public void addNewAccount() { @FXML
private void addNewAccount() {
txtUsername.setText(""); txtUsername.setText("");
txtPassword.setText(""); txtPassword.setText("");
dialog.show(); dialog.show();
} }
public void onCreationAccept() { @FXML
private void onCreationAccept() {
int type = cboType.getSelectionModel().getSelectedIndex(); int type = cboType.getSelectionModel().getSelectedIndex();
String username = txtUsername.getText(); String username = txtUsername.getText();
String password = txtPassword.getText(); String password = txtPassword.getText();
@@ -158,7 +160,8 @@ public final class AccountsPage extends StackPane implements DecoratorPage {
}); });
} }
public void onCreationCancel() { @FXML
private void onCreationCancel() {
dialog.close(); dialog.close();
} }

View File

@@ -169,7 +169,8 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
FXUtils.setOverflowHidden(drawerWrapper); FXUtils.setOverflowHidden(drawerWrapper);
} }
public void onMouseMoved(MouseEvent mouseEvent) { @FXML
private void onMouseMoved(MouseEvent mouseEvent) {
if (!primaryStage.isMaximized() && !primaryStage.isFullScreen() && !maximized) { if (!primaryStage.isMaximized() && !primaryStage.isFullScreen() && !maximized) {
if (!primaryStage.isResizable()) if (!primaryStage.isResizable())
updateInitMouseValues(mouseEvent); updateInitMouseValues(mouseEvent);
@@ -210,11 +211,13 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
} }
} }
public void onMouseReleased() { @FXML
private void onMouseReleased() {
isDragging = false; isDragging = false;
} }
public void onMouseDragged(MouseEvent mouseEvent) { @FXML
private void onMouseDragged(MouseEvent mouseEvent) {
this.isDragging = true; this.isDragging = true;
if (mouseEvent.isPrimaryButtonDown() && (this.xOffset != -1.0 || this.yOffset != -1.0)) { if (mouseEvent.isPrimaryButtonDown() && (this.xOffset != -1.0 || this.yOffset != -1.0)) {
if (!this.primaryStage.isFullScreen() && !mouseEvent.isStillSincePress() && !this.primaryStage.isMaximized() && !this.maximized) { if (!this.primaryStage.isFullScreen() && !mouseEvent.isStillSincePress() && !this.primaryStage.isMaximized() && !this.maximized) {
@@ -278,11 +281,13 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
} }
} }
public void onMin() { @FXML
private void onMin() {
primaryStage.setIconified(true); primaryStage.setIconified(true);
} }
public void onMax() { @FXML
private void onMax() {
if (!max) return; if (!max) return;
if (!this.isCustomMaximize()) { if (!this.isCustomMaximize()) {
this.primaryStage.setMaximized(!this.primaryStage.isMaximized()); this.primaryStage.setMaximized(!this.primaryStage.isMaximized());
@@ -320,7 +325,8 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
} }
} }
public void onClose() { @FXML
private void onClose() {
onCloseButtonAction.get().run(); onCloseButtonAction.get().run();
} }
@@ -473,16 +479,19 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
setContent(page, nav.getAnimation().getAnimationProducer()); setContent(page, nav.getAnimation().getAnimationProducer());
} }
public void onRefresh() { @FXML
private void onRefresh() {
((Refreshable) contentPlaceHolder.getChildren().get(0)).refresh(); ((Refreshable) contentPlaceHolder.getChildren().get(0)).refresh();
} }
public void onCloseNav() { @FXML
private void onCloseNav() {
wizardController.onCancel(); wizardController.onCancel();
showPage(null); showPage(null);
} }
public void onBack() { @FXML
private void onBack() {
wizardController.onPrev(true); wizardController.onPrev(true);
} }

View File

@@ -43,7 +43,8 @@ public class InstallerController {
private String liteLoader; private String liteLoader;
private String optiFine; private String optiFine;
public void initialize() { @FXML
private void initialize() {
FXUtils.smoothScrolling(scrollPane); FXUtils.smoothScrolling(scrollPane);
} }
@@ -80,7 +81,8 @@ public class InstallerController {
} }
} }
public void onAdd() { @FXML
private void onAdd() {
String gameVersion = GameVersion.minecraftVersion(profile.getRepository().getVersionJar(version)); String gameVersion = GameVersion.minecraftVersion(profile.getRepository().getVersionJar(version));
if (gameVersion == null) if (gameVersion == null)

View File

@@ -47,7 +47,8 @@ public class InstallerItem extends BorderPane {
lblInstallerVersion.setText(Main.i18n("archive.version") + ": " + version); lblInstallerVersion.setText(Main.i18n("archive.version") + ": " + version);
} }
public void onDelete() { @FXML
private void onDelete() {
deleteCallback.accept(this); deleteCallback.accept(this);
} }
} }

View File

@@ -143,7 +143,7 @@ public final class LogWindow extends Stage {
} }
} }
private class LogWindowImpl extends StackPane { public class LogWindowImpl extends StackPane {
@FXML @FXML
private WebView webView; private WebView webView;
@@ -225,11 +225,13 @@ public final class LogWindow extends Stage {
engine.executeScript("specific([" + res + "])"); engine.executeScript("specific([" + res + "])");
} }
public void onTerminateGame() { @FXML
private void onTerminateGame() {
LauncherHelper.stopManagedProcesses(); LauncherHelper.stopManagedProcesses();
} }
public void onClear() { @FXML
private void onClear() {
engine.executeScript("clear()"); engine.executeScript("clear()");
} }
} }

View File

@@ -189,7 +189,8 @@ public final class MainPage extends StackPane implements DecoratorPage {
FXUtils.resetChildren(masonryPane, children); FXUtils.resetChildren(masonryPane, children);
} }
public void onVersionManagement() { @FXML
private void onVersionManagement() {
versionPopup.hide(); versionPopup.hide();
switch (versionList.getSelectionModel().getSelectedIndex()) { switch (versionList.getSelectionModel().getSelectedIndex()) {
case 0: case 0:

View File

@@ -57,7 +57,8 @@ public final class ModController {
private ModManager modManager; private ModManager modManager;
private String versionId; private String versionId;
public void initialize() { @FXML
private void initialize() {
FXUtils.smoothScrolling(scrollPane); FXUtils.smoothScrolling(scrollPane);
rootPane.setOnDragOver(event -> { rootPane.setOnDragOver(event -> {
@@ -135,7 +136,8 @@ public final class ModController {
} }
public void onAdd() { @FXML
private void onAdd() {
FileChooser chooser = new FileChooser(); FileChooser chooser = new FileChooser();
chooser.setTitle(Main.i18n("mods.choose_mod")); chooser.setTitle(Main.i18n("mods.choose_mod"));
chooser.getExtensionFilters().setAll(new FileChooser.ExtensionFilter(Main.i18n("extension.mod"), "*.jar", "*.zip", "*.litemod")); chooser.getExtensionFilters().setAll(new FileChooser.ExtensionFilter(Main.i18n("extension.mod"), "*.jar", "*.zip", "*.litemod"));

View File

@@ -71,14 +71,16 @@ public final class ProfilePage extends StackPane implements DecoratorPage {
btnDelete.setVisible(false); btnDelete.setVisible(false);
} }
public void onDelete() { @FXML
private void onDelete() {
if (profile != null) { if (profile != null) {
Settings.INSTANCE.deleteProfile(profile); Settings.INSTANCE.deleteProfile(profile);
Controllers.navigate(null); Controllers.navigate(null);
} }
} }
public void onSave() { @FXML
private void onSave() {
if (profile != null) { if (profile != null) {
profile.setName(txtProfileName.getText()); profile.setName(txtProfileName.getText());
if (StringUtils.isNotBlank(getLocation())) if (StringUtils.isNotBlank(getLocation()))

View File

@@ -50,7 +50,8 @@ public final class VersionListItem extends StackPane {
FXUtils.limitHeight(imageViewContainer, 32); FXUtils.limitHeight(imageViewContainer, 32);
} }
public void onSettings() { @FXML
private void onSettings() {
handler.run(); handler.run();
} }

View File

@@ -99,25 +99,30 @@ public final class VersionPage extends StackPane implements DecoratorPage {
installerController.loadVersion(profile, id); installerController.loadVersion(profile, id);
} }
public void onBrowseMenu() { @FXML
private void onBrowseMenu() {
browseList.getSelectionModel().select(-1); browseList.getSelectionModel().select(-1);
browsePopup.show(btnBrowseMenu, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, -12, 15); browsePopup.show(btnBrowseMenu, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, -12, 15);
} }
public void onManagementMenu() { @FXML
private void onManagementMenu() {
managementList.getSelectionModel().select(-1); managementList.getSelectionModel().select(-1);
managementPopup.show(btnManagementMenu, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, -12, 15); managementPopup.show(btnManagementMenu, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, -12, 15);
} }
public void onDelete() { @FXML
private void onDelete() {
deleteVersion(profile, version); deleteVersion(profile, version);
} }
public void onExport() { @FXML
private void onExport() {
exportVersion(profile, version); exportVersion(profile, version);
} }
public void onBrowse() { @FXML
private void onBrowse() {
String sub; String sub;
switch (browseList.getSelectionModel().getSelectedIndex()) { switch (browseList.getSelectionModel().getSelectedIndex()) {
case 0: case 0:
@@ -147,7 +152,8 @@ public final class VersionPage extends StackPane implements DecoratorPage {
FXUtils.openFolder(new File(profile.getRepository().getRunDirectory(version), sub)); FXUtils.openFolder(new File(profile.getRepository().getRunDirectory(version), sub));
} }
public void onManagement() { @FXML
private void onManagement() {
switch (managementList.getSelectionModel().getSelectedIndex()) { switch (managementList.getSelectionModel().getSelectedIndex()) {
case 0: // rename a version case 0: // rename a version
renameVersion(profile, version); renameVersion(profile, version);

View File

@@ -77,7 +77,8 @@ public final class VersionSettingsController {
@FXML private JFXButton btnIconSelection; @FXML private JFXButton btnIconSelection;
@FXML private ImageView iconView; @FXML private ImageView iconView;
public void initialize() { @FXML
private void initialize() {
lblPhysicalMemory.setText(Main.i18n("settings.physical_memory") + ": " + OperatingSystem.TOTAL_MEMORY + "MB"); lblPhysicalMemory.setText(Main.i18n("settings.physical_memory") + ": " + OperatingSystem.TOTAL_MEMORY + "MB");
FXUtils.smoothScrolling(scroll); FXUtils.smoothScrolling(scroll);
@@ -245,14 +246,16 @@ public final class VersionSettingsController {
gameDirItem.setSubtitle(profile.getRepository().getRunDirectory(versionId).getAbsolutePath()); gameDirItem.setSubtitle(profile.getRepository().getRunDirectory(versionId).getAbsolutePath());
} }
public void onShowAdvanced() { @FXML
private void onShowAdvanced() {
if (!rootPane.getChildren().contains(advancedSettingsPane)) if (!rootPane.getChildren().contains(advancedSettingsPane))
rootPane.getChildren().add(advancedSettingsPane); rootPane.getChildren().add(advancedSettingsPane);
else else
rootPane.getChildren().remove(advancedSettingsPane); rootPane.getChildren().remove(advancedSettingsPane);
} }
public void onExploreIcon() { @FXML
private void onExploreIcon() {
FileChooser chooser = new FileChooser(); FileChooser chooser = new FileChooser();
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(Main.i18n("extension.png"), "*.png")); chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(Main.i18n("extension.png"), "*.png"));
File selectedFile = chooser.showOpenDialog(Controllers.getStage()); File selectedFile = chooser.showOpenDialog(Controllers.getStage());

View File

@@ -59,7 +59,8 @@ public class YggdrasilAccountLoginPane extends StackPane {
txtPassword.setOnAction(e -> onAccept()); txtPassword.setOnAction(e -> onAccept());
} }
public void onAccept() { @FXML
private void onAccept() {
String username = oldAccount.getUsername(); String username = oldAccount.getUsername();
String password = txtPassword.getText(); String password = txtPassword.getText();
progressBar.setVisible(true); progressBar.setVisible(true);
@@ -86,7 +87,8 @@ public class YggdrasilAccountLoginPane extends StackPane {
}); });
} }
public void onCancel() { @FXML
private void onCancel() {
failed.run(); failed.run();
dialog.close(); dialog.close();
} }

View File

@@ -128,7 +128,8 @@ public class InstallersPage extends StackPane implements WizardPage {
settings.remove(INSTALLER_TYPE); settings.remove(INSTALLER_TYPE);
} }
public void onInstall() { @FXML
private void onInstall() {
controller.getSettings().put("name", txtName.getText()); controller.getSettings().put("name", txtName.getText());
controller.onFinish(); controller.onFinish();
} }

View File

@@ -109,13 +109,15 @@ public final class ModpackPage extends StackPane implements WizardPage {
settings.remove(MODPACK_FILE); settings.remove(MODPACK_FILE);
} }
public void onInstall() { @FXML
private void onInstall() {
if (!txtModpackName.validate()) return; if (!txtModpackName.validate()) return;
controller.getSettings().put(MODPACK_NAME, txtModpackName.getText()); controller.getSettings().put(MODPACK_NAME, txtModpackName.getText());
controller.onFinish(); controller.onFinish();
} }
public void onDescribe() { @FXML
private void onDescribe() {
if (manifest != null) { if (manifest != null) {
WebStage stage = new WebStage(); WebStage stage = new WebStage();
stage.getWebView().getEngine().loadContent(manifest.getDescription()); stage.getWebView().getEngine().loadContent(manifest.getDescription());

View File

@@ -137,7 +137,8 @@ public final class ModpackFileSelectionPage extends StackPane implements WizardP
controller.getSettings().remove(MODPACK_FILE_SELECTION); controller.getSettings().remove(MODPACK_FILE_SELECTION);
} }
public void onNext() { @FXML
private void onNext() {
LinkedList<String> list = new LinkedList<>(); LinkedList<String> list = new LinkedList<>();
getFilesNeeded(rootNode, "minecraft", list); getFilesNeeded(rootNode, "minecraft", list);
controller.getSettings().put(MODPACK_FILE_SELECTION, list); controller.getSettings().put(MODPACK_FILE_SELECTION, list);

View File

@@ -69,7 +69,8 @@ public final class ModpackInfoPage extends StackPane implements WizardPage {
btnNext.setDisable(!txtModpackName.validate() || !txtModpackVersion.validate() || !txtModpackAuthor.validate()); btnNext.setDisable(!txtModpackName.validate() || !txtModpackVersion.validate() || !txtModpackAuthor.validate());
} }
public void onNext() { @FXML
private void onNext() {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(Main.i18n("modpack.wizard.step.initialization.save")); fileChooser.setTitle(Main.i18n("modpack.wizard.step.initialization.save"));
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(Main.i18n("modpack"), "*.zip")); fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(Main.i18n("modpack"), "*.zip"));

View File

@@ -96,21 +96,25 @@ public class DefaultWizardDisplayer extends StackPane implements AbstractWizardD
nowPage = page; nowPage = page;
} }
public void initialize() { @FXML
private void initialize() {
transitionHandler = new TransitionHandler(root); transitionHandler = new TransitionHandler(root);
wizardController.onStart(); wizardController.onStart();
} }
public void back() { @FXML
private void back() {
wizardController.onPrev(true); wizardController.onPrev(true);
} }
public void close() { @FXML
private void close() {
wizardController.onCancel(); wizardController.onCancel();
Controllers.navigate(null); Controllers.navigate(null);
} }
public void refresh() { @FXML
private void refresh() {
((Refreshable) nowPage).refresh(); ((Refreshable) nowPage).refresh();
} }
} }

View File

@@ -92,7 +92,6 @@ public final class Arguments {
static { static {
List<Argument> jvm = new LinkedList<>(); List<Argument> jvm = new LinkedList<>();
jvm.add(new RuledArgument(Collections.singletonList(new CompatibilityRule(CompatibilityRule.Action.ALLOW, new OSRestriction(OperatingSystem.OSX))), Collections.singletonList("-XstartOnFirstThread")));
jvm.add(new RuledArgument(Collections.singletonList(new CompatibilityRule(CompatibilityRule.Action.ALLOW, new OSRestriction(OperatingSystem.WINDOWS))), Collections.singletonList("-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump"))); jvm.add(new RuledArgument(Collections.singletonList(new CompatibilityRule(CompatibilityRule.Action.ALLOW, new OSRestriction(OperatingSystem.WINDOWS))), Collections.singletonList("-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump")));
jvm.add(new RuledArgument(Collections.singletonList(new CompatibilityRule(CompatibilityRule.Action.ALLOW, new OSRestriction(OperatingSystem.WINDOWS, "^10\\."))), Arrays.asList("-Dos.name=Windows 10", "-Dos.version=10.0"))); jvm.add(new RuledArgument(Collections.singletonList(new CompatibilityRule(CompatibilityRule.Action.ALLOW, new OSRestriction(OperatingSystem.WINDOWS, "^10\\."))), Arrays.asList("-Dos.name=Windows 10", "-Dos.version=10.0")));
jvm.add(new StringArgument("-Djava.library.path=${natives_directory}")); jvm.add(new StringArgument("-Djava.library.path=${natives_directory}"));