use a ProcessBuilder instead of Runtime.exec
This commit is contained in:
parent
88e31468d4
commit
b88c530ac2
@ -141,7 +141,6 @@ public class Main extends Application {
|
||||
mainWindowController.setLanguage("en_US");
|
||||
mainWindowController.setLastLocalSync(0);
|
||||
mainWindowController.setxPosHelper(0);
|
||||
mainWindowController.setExecuteCommand(mainWindowController.getCemuPath() + "/Cemu.exe -g ");
|
||||
mainWindowController.saveSettings();
|
||||
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs)
|
||||
System.exit(0); //finishes itself
|
||||
|
@ -284,14 +284,13 @@ public class MainWindowController {
|
||||
private String cemuPath;
|
||||
private String romDirectoryPath;
|
||||
private String gameExecutePath;
|
||||
private String executeCommand;
|
||||
private String color;
|
||||
private String dialogBtnStyle;
|
||||
private String selectedGameTitleID;
|
||||
private String selectedGameTitle;
|
||||
private String id;
|
||||
private String version = "0.3.0";
|
||||
private String buildNumber = "073";
|
||||
private String buildNumber = "075";
|
||||
private String versionName = "Puzzle Plank Galaxy";
|
||||
private int xPos = -200;
|
||||
private int yPos = 17;
|
||||
@ -404,7 +403,6 @@ public class MainWindowController {
|
||||
|
||||
cemuTextField.setText(cemuPath);
|
||||
romTextField.setText(romDirectoryPath);
|
||||
executeCommandTextFiled.setText(getExecuteCommand());
|
||||
colorPicker.setValue(Color.valueOf(getColor()));
|
||||
fullscreenToggleBtn.setSelected(isFullscreen());
|
||||
cloudSyncToggleBtn.setSelected(isCloudSync());
|
||||
@ -822,14 +820,6 @@ public class MainWindowController {
|
||||
}
|
||||
});
|
||||
|
||||
executeCommandTextFiled.textProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||
setExecuteCommand(executeCommandTextFiled.getText());
|
||||
saveSettings();
|
||||
}
|
||||
});
|
||||
|
||||
LOGGER.info("initializing Actions done!");
|
||||
}
|
||||
|
||||
@ -1055,12 +1045,8 @@ public class MainWindowController {
|
||||
void fullscreenToggleBtnAction(ActionEvent event) {
|
||||
if (fullscreen) {
|
||||
fullscreen = false;
|
||||
setExecuteCommand(getExecuteCommand().replace("-f -g", "-g"));
|
||||
executeCommandTextFiled.setText(getExecuteCommand());
|
||||
} else {
|
||||
fullscreen = true;
|
||||
setExecuteCommand(getExecuteCommand().replace("-g", "-f -g"));
|
||||
executeCommandTextFiled.setText(getExecuteCommand());
|
||||
}
|
||||
saveSettings();
|
||||
}
|
||||
@ -1669,7 +1655,6 @@ public class MainWindowController {
|
||||
try {
|
||||
props.setProperty("cemuPath", getCemuPath());
|
||||
props.setProperty("romPath", getRomDirectoryPath());
|
||||
props.setProperty("executeCommand", getExecuteCommand());
|
||||
props.setProperty("color", getColor());
|
||||
props.setProperty("language", getLanguage());
|
||||
props.setProperty("fullscreen", String.valueOf(isFullscreen()));
|
||||
@ -1727,13 +1712,6 @@ public class MainWindowController {
|
||||
setRomDirectoryPath("");
|
||||
}
|
||||
|
||||
if (props.getProperty("executeCommand") == null) {
|
||||
LOGGER.error("could not load executeCommand, setting default instead!");
|
||||
setExecuteCommand(getCemuPath() + "\\Cemu.exe -g ");
|
||||
} else {
|
||||
setExecuteCommand(props.getProperty("executeCommand"));
|
||||
}
|
||||
|
||||
try {
|
||||
setColor(props.getProperty("color"));
|
||||
} catch (Exception e) {
|
||||
@ -1908,14 +1886,6 @@ public class MainWindowController {
|
||||
this.romDirectoryPath = romDirectoryPath;
|
||||
}
|
||||
|
||||
public String getExecuteCommand() {
|
||||
return executeCommand;
|
||||
}
|
||||
|
||||
public void setExecuteCommand(String executeCommand) {
|
||||
this.executeCommand = executeCommand;
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class playGame extends Thread{
|
||||
@Override
|
||||
public void run(){
|
||||
String selectedGameTitleID = mainWindowController.getSelectedGameTitleID();
|
||||
String executeComand;
|
||||
// String executeComand;
|
||||
long startTime;
|
||||
long endTime;
|
||||
int timePlayedNow;
|
||||
@ -57,25 +57,31 @@ public class playGame extends Thread{
|
||||
});
|
||||
startTime = System.currentTimeMillis();
|
||||
try{
|
||||
executeComand = mainWindowController.getExecuteCommand() + " \"" + mainWindowController.getGameExecutePath() + "\"";
|
||||
// executeComand = mainWindowController.getExecuteCommand() + " \"" + mainWindowController.getGameExecutePath() + "\"";
|
||||
|
||||
// if(mainWindowController.isFullscreen()){
|
||||
// if(System.getProperty("os.name").equals("Linux")){
|
||||
// executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\"";
|
||||
// } else {
|
||||
// executeComand = mainWindowController.getCemuPath()+"\\Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\"";
|
||||
// }
|
||||
// }else{
|
||||
// if(System.getProperty("os.name").equals("Linux")){
|
||||
// executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -g \""+mainWindowController.getGameExecutePath()+"\"";
|
||||
// } else {
|
||||
// executeComand = mainWindowController.getCemuPath() + "\\Cemu.exe -g " + "\"" + 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();
|
||||
|
||||
LOGGER.info(executeComand);
|
||||
|
||||
p = Runtime.getRuntime().exec(executeComand);
|
||||
p.waitFor();
|
||||
endTime = System.currentTimeMillis();
|
||||
timePlayedNow = (int) Math.floor(((endTime - startTime)/1000/60));
|
||||
|
@ -170,15 +170,6 @@
|
||||
<VBox.margin>
|
||||
<Insets top="-10.0" />
|
||||
</VBox.margin></JFXToggleButton>
|
||||
<VBox prefHeight="200.0" prefWidth="100.0" spacing="7.0">
|
||||
<children>
|
||||
<Label fx:id="cemuDirectoryLbl1" text="execute command" />
|
||||
<JFXTextField fx:id="executeCommandTextFiled" maxWidth="430.0" minWidth="430.0" prefHeight="25.0" prefWidth="430.0" promptText="execute command" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets right="5.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
<Label fx:id="licensesLbl" text="Licenses" />
|
||||
</children>
|
||||
<padding>
|
||||
|
Loading…
Reference in New Issue
Block a user