Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions forge-gui-desktop/src/main/java/forge/view/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public static void main(final String[] args) {

//install our error handler
ExceptionHandler.registerErrorHandling();
GuiBase.logHWInfo();

// Start splash screen first, then data models, then controller.
if (args.length == 0) {
Expand Down
4 changes: 2 additions & 2 deletions forge-gui-mobile/src/forge/Forge.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ public static Localizer getLocalizer() {
public void create() {
//install our error handler
ExceptionHandler.registerErrorHandling();
//init hwInfo to log
System.out.println(GuiBase.getHWInfo());
//log version and system info
GuiBase.logHWInfo();
// closeSplashScreen() is called early on non-Windows OS so it will not crash, LWJGL3 bug on AWT Splash.
if (OperatingSystem.isWindows())
getDeviceAdapter().closeSplashScreen();
Expand Down
35 changes: 26 additions & 9 deletions forge-gui/src/main/java/forge/gui/GuiBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import forge.gui.interfaces.IGuiBase;
import forge.gui.interfaces.IGuiGame;
import forge.localinstance.properties.ForgePreferences;
import org.tinylog.Logger;

public class GuiBase {
private static IGuiBase guiInterface;
Expand Down Expand Up @@ -42,17 +43,33 @@ public static void setDeviceInfo(HWInfo hw, int AndroidAPI, int RAM, String dir)
downloadsDir = dir;
}
public static String getHWInfo() {
Runtime runtime = Runtime.getRuntime();
StringBuilder sb = new StringBuilder();
sb.append("##########################################\n");
sb.append("APP: Forge v.").append(getInterface().getCurrentVersion());
if (hwInfo != null) {
return "##########################################\n" +
"APP: Forge v." + getInterface().getCurrentVersion() +
"\nDEV: " + hwInfo.device().getName() + (hwInfo.getChipset() ?
"\nSOC: " + hwInfo.device().getChipset() :
"\nCPU: " + hwInfo.device().getCpuDescription()) +
"\nRAM: " + deviceRAM + " MB" +
"\nOS: " + hwInfo.os().getRawDescription() +
"\n##########################################";
sb.append("\nDEV: ").append(hwInfo.device().getName());
sb.append(hwInfo.getChipset()
? "\nSOC: " + hwInfo.device().getChipset()
: "\nCPU: " + hwInfo.device().getCpuDescription());
sb.append("\nRAM: ").append(deviceRAM).append(" MB");
sb.append("\nOS: ").append(hwInfo.os().getRawDescription());
} else {
sb.append("\nJava: ").append(System.getProperty("java.version"))
.append(" (").append(System.getProperty("java.vendor")).append(")");
sb.append("\nOS: ").append(System.getProperty("os.name"))
.append(" ").append(System.getProperty("os.version"))
.append(" ").append(System.getProperty("os.arch"));
sb.append("\nRAM: ").append(runtime.maxMemory() / 1024 / 1024)
.append(" MB max, ").append(runtime.availableProcessors()).append(" CPUs");
}
sb.append("\n##########################################");
return sb.toString();
}
public static void logHWInfo() {
for (String line : getHWInfo().split("\n")) {
Logger.info(line);
}
return "";
}
public static String getDownloadsDir() {
return downloadsDir;
Expand Down