From 79cb1c247699ca93120e7e1c596704ad6184c610 Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 3 Feb 2018 15:39:35 +0100 Subject: [PATCH] fixed games are not loaded to mwc * fixed games are not loaded to mwc * fixed processbuilder --- .classpath | 1 - .../application/MainWindowController.java | 2 +- .../com/cemu_UI/application/playGame.java | 39 +++++++------------ .../com/cemu_UI/controller/DBController.java | 1 + 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/.classpath b/.classpath index afa5ec2..c7307ff 100644 --- a/.classpath +++ b/.classpath @@ -20,7 +20,6 @@ - diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index db639c5..64c8d6a 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -1317,7 +1317,7 @@ public class MainWindowController { } //remove all games from gamesAnchorPane and add them afterwards - void refreshUIData() { + public void refreshUIData() { //remove all games form gamesAnchorPane gamesAnchorPane.getChildren().removeAll(gamesAnchorPane.getChildren()); diff --git a/src/main/java/com/cemu_UI/application/playGame.java b/src/main/java/com/cemu_UI/application/playGame.java index 4b7074f..d5e5eef 100644 --- a/src/main/java/com/cemu_UI/application/playGame.java +++ b/src/main/java/com/cemu_UI/application/playGame.java @@ -45,7 +45,8 @@ public class playGame extends Thread{ @Override public void run(){ String selectedGameTitleID = mainWindowController.getSelectedGameTitleID(); -// String executeComand; + String cemuBin = mainWindowController.getCemuPath() + "/Cemu.exe"; + String gameExec = "\"" + mainWindowController.getGameExecutePath() + "\""; long startTime; long endTime; int timePlayedNow; @@ -57,30 +58,20 @@ public class playGame extends Thread{ }); startTime = System.currentTimeMillis(); try{ -// executeComand = mainWindowController.getExecuteCommand() + " \"" + mainWindowController.getGameExecutePath() + "\""; - - if(mainWindowController.isFullscreen()){ - if(System.getProperty("os.name").equals("Linux")){ - p = new ProcessBuilder("wine", mainWindowController.getCemuPath() + "/Cemu.exe", "-f", - "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); - } else { - p = new ProcessBuilder(mainWindowController.getCemuPath() + "/Cemu.exe", "-f", - "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); - } - }else{ - if(System.getProperty("os.name").equals("Linux")){ - p = new ProcessBuilder("wine", mainWindowController.getCemuPath() + "/Cemu.exe", - "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); - } else { - p = new ProcessBuilder(mainWindowController.getCemuPath() + "/Cemu.exe", - "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); - } - } -// LOGGER.info(p.toString()); - -// p = Runtime.getRuntime().exec("); -// p = new ProcessBuilder("wine", "/home/jannik/Downloads/cemu_1.11.3/Cemu.exe", "-g \"" + mainWindowController.getGameExecutePath() + "\"").start(); + if (System.getProperty("os.name").equals("Linux")) { + if(mainWindowController.isFullscreen()){ + p = new ProcessBuilder("wine", cemuBin, "-f", "-g", gameExec).start(); + } else { + p = new ProcessBuilder("wine", cemuBin, "-g", gameExec).start(); + } + } else { + if(mainWindowController.isFullscreen()){ + p = new ProcessBuilder(cemuBin, "-f", "-g", gameExec).start(); + } else { + p = new ProcessBuilder(cemuBin, "-g", gameExec).start(); + } + } p.waitFor(); endTime = System.currentTimeMillis(); diff --git a/src/main/java/com/cemu_UI/controller/DBController.java b/src/main/java/com/cemu_UI/controller/DBController.java index 56de353..971035e 100644 --- a/src/main/java/com/cemu_UI/controller/DBController.java +++ b/src/main/java/com/cemu_UI/controller/DBController.java @@ -150,6 +150,7 @@ public class DBController { mainWindowController.reloadRoms(); } else { loadAllGames(); + mainWindowController.refreshUIData(); } }