This commit is contained in:
huangyuhui
2016-02-28 13:43:03 +08:00
parent f811d4c89f
commit d10a7fad20
6 changed files with 20 additions and 12 deletions

1
HMCL/launch.sh Executable file
View File

@@ -0,0 +1 @@
/home/huangyuhui/softwares/jdk1.8.0_65/jre/bin/java -XX:+UseG1GC -XX:-UseAdaptiveSizePolicy -XX:-OmitStackTraceInFastThrow -Xmn128m -Xmx3968m -Djava.library.path=/home/huangyuhui/game/testempty/versions/1.9-pre3/1.9-pre3-natives -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true -Duser.home=/home/huangyuhui/game -cp /home/huangyuhui/NetBeansProjects/HMCL/HMCL/build/classes/main/:/home/huangyuhui/NetBeansProjects/HMCL/HMCL/build/resources/main/:/home/huangyuhui/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.2.4/a60a5e993c98c864010053cb901b7eab25306568/gson-2.2.4.jar:/home/huangyuhui/NetBeansProjects/HMCL/MetroLookAndFeel/build/libs/MetroLookAndFeel.jar:/home/huangyuhui/NetBeansProjects/HMCL/HMCLAPI/build/libs/HMCLAPI.jar:/home/huangyuhui/.gradle/caches/modules-2/files-2.1/org.commonjava.googlecode.markdown4j/markdown4j/2.2-cj-1.0/ba35b052c48261a17e94ae5c31e8e9ad9b9f4d2c/markdown4j-2.2-cj-1.0.jar org.jackhuang.hellominecraft.launcher.Launcher -cp=/home/huangyuhui/game/testempty/libraries/oshi-project/oshi-core/1.1/oshi-core-1.1.jar:/home/huangyuhui/game/testempty/libraries/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar:/home/huangyuhui/game/testempty/libraries/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar:/home/huangyuhui/game/testempty/libraries/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar:/home/huangyuhui/game/testempty/libraries/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar:/home/huangyuhui/game/testempty/libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar:/home/huangyuhui/game/testempty/libraries/com/paulscode/codecwav/20101023/codecwav-20101023.jar:/home/huangyuhui/game/testempty/libraries/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar:/home/huangyuhui/game/testempty/libraries/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar:/home/huangyuhui/game/testempty/libraries/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar:/home/huangyuhui/game/testempty/libraries/io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar:/home/huangyuhui/game/testempty/libraries/com/google/guava/guava/17.0/guava-17.0.jar:/home/huangyuhui/game/testempty/libraries/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar:/home/huangyuhui/game/testempty/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar:/home/huangyuhui/game/testempty/libraries/commons-codec/commons-codec/1.9/commons-codec-1.9.jar:/home/huangyuhui/game/testempty/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar:/home/huangyuhui/game/testempty/libraries/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar:/home/huangyuhui/game/testempty/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar:/home/huangyuhui/game/testempty/libraries/com/mojang/authlib/1.5.22/authlib-1.5.22.jar:/home/huangyuhui/game/testempty/libraries/com/mojang/realms/1.8.1/realms-1.8.1.jar:/home/huangyuhui/game/testempty/libraries/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar:/home/huangyuhui/game/testempty/libraries/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar:/home/huangyuhui/game/testempty/libraries/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar:/home/huangyuhui/game/testempty/libraries/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar:/home/huangyuhui/game/testempty/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar:/home/huangyuhui/game/testempty/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar:/home/huangyuhui/game/testempty/libraries/org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209.jar:/home/huangyuhui/game/testempty/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209.jar:/home/huangyuhui/game/testempty/versions/1.9-pre3/1.9-pre3.jar -mainClass=net.minecraft.client.main.Main --username huangyuhui --version "HMCL 2.4.0.233" --gameDir /home/huangyuhui/game/testempty --assetsDir /home/huangyuhui/game/testempty/assets --assetIndex 1.9 --uuid c14d042145c04aff8ecbcf85ebbc4400 --accessToken 6fc6bdb6854c4692a5edcd3da4444fb0 --userType mojang --versionType "HMCL 2.4.0.233" --height 480 --width 854

View File

@@ -83,10 +83,9 @@ public abstract class AbstractMinecraftLoader implements IMinecraftLoader {
if (jv != null && jv.getParsedVersion() >= JdkVersion.JAVA_17)
res.add("-XX:+UseG1GC");
else
res.add("-XX:+UseConcMarkSweepGC");
res.add("-Xincgc");
res.add("-XX:-UseAdaptiveSizePolicy");
res.add("-XX:-OmitStackTraceInFastThrow");
res.add("-Xincgc");
res.add("-Xmn128m");
}

View File

@@ -97,6 +97,7 @@ public class LaunchingUIDaemon {
HMCLog.err("The game exited abnormally, exit code: " + t);
MessageBox.Show(C.i18n("launch.exited_abnormally") + " exit code: " + t);
WebFrame f = new WebFrame(jpm.getJavaProcess().getStdOutLines().toArray(new String[0]));
f.setModal(true);
f.setTitle("Game output");
f.setVisible(true);
checkExit((LauncherVisibility) obj.getTag());
@@ -105,6 +106,7 @@ public class LaunchingUIDaemon {
HMCLog.err("Cannot create jvm, exit code: " + t);
MessageBox.Show(C.i18n("launch.cannot_create_jvm") + " exit code: " + t);
WebFrame f = new WebFrame(jpm.getJavaProcess().getStdOutLines().toArray(new String[0]));
f.setModal(true);
f.setTitle("Game output");
f.setVisible(true);
checkExit((LauncherVisibility) obj.getTag());

View File

@@ -66,6 +66,14 @@ public class ProcessThread extends Thread {
line = "";
} else
line += (char) ch;
while ((ch = br.read()) != -1)
if (ch == '\n') {
printlnEvent.execute(line);
System.out.println("Minecraft: " + line);
p.getStdOutLines().add(line);
line = "";
} else
line += (char) ch;
stopEvent.execute(p);
} catch (Exception e) {
HMCLog.err("An error occured when reading process stdout/stderr.", e);

View File

@@ -21,6 +21,7 @@ import java.awt.Component;
import java.awt.EventQueue;
import java.awt.FontMetrics;
import java.awt.Frame;
import java.awt.Window;
import java.io.File;
import java.io.IOException;
import java.net.URI;
@@ -279,13 +280,13 @@ public class SwingUtils {
component.setEnabled(t);
}
public static void exitIfNoWindow(Frame thisFrame) {
public static void exitIfNoWindow(Window thisFrame) {
exitIfNoWindow(thisFrame, false);
}
public static void exitIfNoWindow(Frame thisFrame, boolean neededDispose) {
public static void exitIfNoWindow(Window thisFrame, boolean neededDispose) {
boolean flag = false;
for (Frame f : Frame.getFrames()) {
for (Window f : Window.getWindows()) {
if (f == thisFrame)
continue;
if (f.isVisible())

View File

@@ -17,13 +17,9 @@
*/
package org.jackhuang.hellominecraft.util.ui;
import java.awt.Frame;
import java.awt.HeadlessException;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JDialog;
import org.jackhuang.hellominecraft.util.StrUtils;
import org.jackhuang.hellominecraft.util.logging.Level;
@@ -31,14 +27,15 @@ import org.jackhuang.hellominecraft.util.logging.Level;
*
* @author huangyuhui
*/
public class WebFrame extends JFrame {
public class WebFrame extends JDialog {
public WebFrame(String... strs) {
this(("<html>" + StrUtils.parseParams(t -> ("<font color='#" + GraphicsUtils.getColor(Level.guessLevel((String) t, Level.INFO).COLOR) + "'>"), strs, t -> "</font><br />") + "</html>")
.replace(" ", "&nbsp;").replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;"));
}
public WebFrame(String content) throws HeadlessException {
public WebFrame(String content) {
super((JDialog) null, false);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {