mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-11 22:31:52 +09:00
proper bootstrap codes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import net.torvald.unicode.BULLET
|
||||
import net.torvald.unicode.ENDASH
|
||||
|
||||
@@ -223,6 +224,22 @@ Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
""").split('\n')
|
||||
|
||||
|
||||
private val javaVersion = System.getProperty("java.version")
|
||||
private val osName = App.OSName
|
||||
private val osVersion = App.OSVersion
|
||||
private val sysArch = App.systemArch
|
||||
private val processor = App.processor
|
||||
private val processorVendor = App.processorVendor
|
||||
private val glinfo = Gdx.graphics.glVersion.debugVersionString
|
||||
|
||||
val systeminfo: List<String>; get() = """
|
||||
JRE Version: $javaVersion
|
||||
Operation System: $osName $osVersion
|
||||
Architecture: $sysArch
|
||||
Processor: $processor ($processorVendor)
|
||||
GL Info: $glinfo
|
||||
""".split('\n')
|
||||
|
||||
|
||||
val gpl3: List<String>; get() = """ GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
@@ -64,16 +64,33 @@ public class Principii {
|
||||
String extracmd = devMode ? " -ea" : "";
|
||||
String OS = OSName.toUpperCase();
|
||||
String CPUARCH = System.getProperty("os.arch").toUpperCase();
|
||||
String runtimeRoot;
|
||||
String runtimeArch;
|
||||
if (!CPUARCH.equals("AMD64") && !CPUARCH.equals("AARCH64")) {
|
||||
System.err.println("Unsupported CPU architecture: " + CPUARCH);
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
runtimeArch = CPUARCH.equals("AMD64") ? "x86" : "arm";
|
||||
}
|
||||
|
||||
if (OS.contains("WIN")) {
|
||||
// reserved for future use
|
||||
runtimeRoot = "runtime-windows-" + runtimeArch;
|
||||
}
|
||||
else if (OS.contains("OS X") || OS.contains("MACOS")) { // OpenJDK for mac will still report "Mac OS X" with version number "10.16", even on Big Sur and beyond
|
||||
runtimeRoot = "runtime-osx-" + runtimeArch;
|
||||
extracmd += " -XstartOnFirstThread";
|
||||
}
|
||||
else {
|
||||
runtimeRoot = "runtime-linux-" + runtimeArch;
|
||||
extracmd += " -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd";
|
||||
}
|
||||
|
||||
String runtime = new File("out/"+runtimeRoot+"/bin/java").getAbsolutePath();
|
||||
System.out.println("Runtime path: "+runtime);
|
||||
|
||||
|
||||
|
||||
getDefaultDirRoot();
|
||||
configDir = defaultDir + "/config.json";
|
||||
@@ -84,40 +101,13 @@ public class Principii {
|
||||
|
||||
int xmx = getConfigInt("jvm_xmx");
|
||||
|
||||
String runtime = new File("./out/runtime-osx-x86/bin/java").getAbsolutePath();
|
||||
|
||||
System.out.println("Runtime path: "+runtime);
|
||||
|
||||
try {
|
||||
Process proc = Runtime.getRuntime().exec(runtime+extracmd+" -Xms1G -Xmx"+xmx+"G -cp ./out/TerrarumBuild.jar net.torvald.terrarum.App");
|
||||
|
||||
Thread tp = new Thread(() -> {
|
||||
String p = null;
|
||||
while (proc.isAlive()) {
|
||||
try {
|
||||
p = proc.inputReader().readLine();
|
||||
}
|
||||
catch (IOException ignored) {
|
||||
}
|
||||
if (p != null) System.out.println(p);
|
||||
}
|
||||
});
|
||||
Thread te = new Thread(() -> {
|
||||
String e = null;
|
||||
while (proc.isAlive()) {
|
||||
try {
|
||||
e = proc.errorReader().readLine();
|
||||
}
|
||||
catch (IOException ignored) {
|
||||
}
|
||||
if (e != null) System.err.println(e);
|
||||
}
|
||||
});
|
||||
|
||||
tp.start();
|
||||
te.start();
|
||||
|
||||
System.exit(proc.waitFor());
|
||||
String[] cmd = (runtime+extracmd+" -Xms1G -Xmx"+xmx+"G -cp ./out/TerrarumBuild.jar net.torvald.terrarum.App").split(" ");
|
||||
ProcessBuilder pb = new ProcessBuilder(cmd);
|
||||
pb.inheritIO();
|
||||
System.exit(pb.start().waitFor());
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -26,6 +26,7 @@ object UITitleRemoConYaml {
|
||||
- MENU_LABEL_CREDITS
|
||||
- MENU_LABEL_COPYRIGHT : net.torvald.terrarum.modulebasegame.ui.UITitleCredits
|
||||
- MENU_CREDIT_GPL_DNT : net.torvald.terrarum.modulebasegame.ui.UITitleGPL3
|
||||
- MENU_LABEL_SYSTEM_INFO : net.torvald.terrarum.modulebasegame.ui.UISystemInfo
|
||||
- MENU_LABEL_RETURN
|
||||
- MENU_LABEL_QUIT
|
||||
"""
|
||||
|
||||
@@ -43,4 +43,5 @@ open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
|
||||
}
|
||||
|
||||
class UITitleCredits(val remoCon: UIRemoCon) : UITitleWallOfText(CreditSingleton.credit)
|
||||
class UITitleGPL3(val remoCon: UIRemoCon) : UITitleWallOfText(CreditSingleton.gpl3)
|
||||
class UITitleGPL3(val remoCon: UIRemoCon) : UITitleWallOfText(CreditSingleton.gpl3)
|
||||
class UISystemInfo(val remoCon: UIRemoCon) : UITitleWallOfText(CreditSingleton.systeminfo)
|
||||
Reference in New Issue
Block a user