supported linux memory reading

This commit is contained in:
huangyuhui
2015-12-31 21:30:39 +08:00
parent 5f78f2725a
commit 6968809499
11 changed files with 146 additions and 78 deletions

View File

@@ -1,7 +1,7 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -46,7 +46,7 @@ public final class Launcher {
public static void println(String s) {
System.out.println(s);
}
static String classPath = "", proxyHost = "", proxyPort = "", proxyUsername = "", proxyPassword = "";
public static void main(String[] args) {
@@ -79,7 +79,14 @@ public final class Launcher {
int len = tokenized.length;
if (showInfo) {
LogWindow.INSTANCE.setTerminateGame(() -> Utils.shutdownForcely(1));
LogWindow.INSTANCE.setTerminateGame(() -> {
try {
Utils.shutdownForcely(1);
} catch (Exception e) {
MessageBox.Show(C.i18n("launcher.exit_failed"));
HMCLog.err("Failed to shutdown forcely", e);
}
});
try {
File logFile = new File("hmclmc.log");
if (!logFile.exists())
@@ -144,7 +151,7 @@ public final class Launcher {
int flag = 0;
try {
minecraftMain.invoke(null, new Object[] {(String[]) cmdList.toArray(new String[cmdList.size()])});
minecraftMain.invoke(null, new Object[]{(String[]) cmdList.toArray(new String[cmdList.size()])});
} catch (Throwable throwable) {
String trace = StrUtils.getStackTrace(throwable);
final String advice = MinecraftCrashAdvicer.getAdvice(trace);
@@ -159,7 +166,12 @@ public final class Launcher {
}
println("*** Game Exited ***");
Utils.shutdownForcely(1);
try {
Utils.shutdownForcely(flag);
} catch (Exception e) {
MessageBox.Show(C.i18n("launcher.exit_failed"));
HMCLog.err("Failed to shutdown forcely", e);
}
}
/*
static Object getShutdownHaltLock() {

View File

@@ -18,7 +18,6 @@
package org.jackhuang.hellominecraft.launcher.utils.installers;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.jackhuang.hellominecraft.utils.functions.Consumer;

View File

@@ -42,7 +42,7 @@ import org.jackhuang.hellominecraft.tasks.TaskWindow;
import org.jackhuang.hellominecraft.tasks.download.FileDownloadTask;
import org.jackhuang.hellominecraft.utils.system.IOUtils;
import org.jackhuang.hellominecraft.utils.MessageBox;
import org.jackhuang.hellominecraft.utils.Utils;
import org.jackhuang.hellominecraft.views.SwingUtils;
/**
*
@@ -196,16 +196,16 @@ public class MinecraftVersionManager extends IMinecraftProvider {
@Override
public File getRunDirectory(String id) {
switch (profile.getGameDirType()) {
case VERSION_FOLDER:
return new File(baseFolder, "versions/" + id + "/");
default:
return baseFolder;
case VERSION_FOLDER:
return new File(baseFolder, "versions/" + id + "/");
default:
return baseFolder;
}
}
@Override
public void open(String mv, String name) {
Utils.openFolder((name == null) ? getRunDirectory(mv) : new File(getRunDirectory(mv), name));
SwingUtils.openFolder((name == null) ? getRunDirectory(mv) : new File(getRunDirectory(mv), name));
}
@Override
@@ -236,7 +236,7 @@ public class MinecraftVersionManager extends IMinecraftProvider {
@Override
public IMinecraftLoader provideMinecraftLoader(UserProfileProvider p)
throws IllegalStateException {
throws IllegalStateException {
return new MinecraftLoader(profile, this, p);
}

View File

@@ -567,7 +567,15 @@ public class MainPagePanel extends AnimatedPanel implements Event<String> {
MainFrame.INSTANCE.dispose();
}
JavaProcessMonitor jpm = new JavaProcessMonitor(p);
jpm.stoppedEvent.register((sender3, t) -> {
jpm.applicationExitedAbnormallyEvent.register((sender2, t) -> {
MessageBox.Show(C.i18n("launch.exited_abnormally") + ", exit code: " + t);
return true;
});
jpm.jvmLaunchFailedEvent.register((sender2, t) -> {
MessageBox.Show(C.i18n("launch.cannot_create_jvm") + ", exit code: " + t);
return true;
});
jpm.stoppedEvent.register((sender2, t) -> {
if (obj.getProfile().getLauncherVisibility() != LauncherVisibility.KEEP && !LogWindow.INSTANCE.isVisible())
System.exit(0);
return true;