added ability to edit launch command, WIP

WARNING THIS IS NOT TESTED
This commit is contained in:
Jannik 2018-01-19 01:14:01 +01:00
parent a9f675ee5e
commit f331fb57a4
7 changed files with 99 additions and 50 deletions

View File

@ -18,7 +18,7 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" path="src/test/main"/> <classpathentry kind="src" path="src/test/main"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>

View File

@ -1,13 +1,13 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.compliance=9
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=9

View File

@ -141,6 +141,7 @@ public class Main extends Application {
mainWindowController.setLanguage("en_US"); mainWindowController.setLanguage("en_US");
mainWindowController.setLastLocalSync(0); mainWindowController.setLastLocalSync(0);
mainWindowController.setxPosHelper(0); mainWindowController.setxPosHelper(0);
mainWindowController.setExecuteCommand(mainWindowController.getCemuPath() + "/Cemu.exe -g ");
mainWindowController.saveSettings(); mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs) Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs)
System.exit(0); //finishes itself System.exit(0); //finishes itself
@ -212,11 +213,10 @@ public class Main extends Application {
Optional<ButtonType> result2 = alert2.showAndWait(); Optional<ButtonType> result2 = alert2.showAndWait();
if (result2.get() == ButtonType.OK) { if (result2.get() == ButtonType.OK) {
DirectoryChooser directoryChooser = new DirectoryChooser(); DirectoryChooser directoryChooser = new DirectoryChooser();
File selectedDirectory = directoryChooser.showDialog(primaryStage); File selectedDirectory = directoryChooser.showDialog(primaryStage);
mainWindowController.setRomPath(selectedDirectory.getAbsolutePath()); mainWindowController.setRomDirectoryPath(selectedDirectory.getAbsolutePath());
} else { } else {
mainWindowController.setRomPath(null); mainWindowController.setRomDirectoryPath(null);
} }
} }

View File

@ -157,6 +157,9 @@ public class MainWindowController {
@FXML @FXML
private JFXTextField courseSearchTextFiled; private JFXTextField courseSearchTextFiled;
@FXML
private JFXTextField executeCommandTextFiled;
@FXML @FXML
private TextFlow smmdbTextFlow; private TextFlow smmdbTextFlow;
@ -279,8 +282,9 @@ public class MainWindowController {
private boolean cloudSync; private boolean cloudSync;
private String cloudService = ""; // set cloud provider (at the moment only GoogleDrive, Dropbox is planed) private String cloudService = ""; // set cloud provider (at the moment only GoogleDrive, Dropbox is planed)
private String cemuPath; private String cemuPath;
private String romPath; private String romDirectoryPath;
private String gameExecutePath; private String gameExecutePath;
private String executeCommand;
private String color; private String color;
private String dialogBtnStyle; private String dialogBtnStyle;
private String selectedGameTitleID; private String selectedGameTitleID;
@ -399,7 +403,8 @@ public class MainWindowController {
} }
cemuTextField.setText(cemuPath); cemuTextField.setText(cemuPath);
romTextField.setText(romPath); romTextField.setText(romDirectoryPath);
executeCommandTextFiled.setText(getExecuteCommand());
colorPicker.setValue(Color.valueOf(getColor())); colorPicker.setValue(Color.valueOf(getColor()));
fullscreenToggleBtn.setSelected(isFullscreen()); fullscreenToggleBtn.setSelected(isFullscreen());
cloudSyncToggleBtn.setSelected(isCloudSync()); cloudSyncToggleBtn.setSelected(isCloudSync());
@ -800,6 +805,30 @@ public class MainWindowController {
} }
} }
}); });
cemuTextField.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
setCemuPath(cemuTextField.getText());
saveSettings();
}
});
romTextField.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
setRomDirectoryPath(romTextField.getText());
saveSettings();
}
});
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!"); LOGGER.info("initializing Actions done!");
} }
@ -846,7 +875,7 @@ public class MainWindowController {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
dbController.loadRomDirectory(getRomPath()); // reload the rom directory dbController.loadRomDirectory(getRomDirectoryPath()); // reload the rom directory
Platform.runLater(() -> { Platform.runLater(() -> {
refreshUIData(); // refresh the list of games displayed on screen refreshUIData(); // refresh the list of games displayed on screen
@ -938,7 +967,7 @@ public class MainWindowController {
if (romDirectory == null) { if (romDirectory == null) {
LOGGER.info("No Directory selected"); LOGGER.info("No Directory selected");
} else { } else {
setRomPath(romDirectory.getAbsolutePath()); setRomDirectoryPath(romDirectory.getAbsolutePath());
saveSettings(); saveSettings();
cemuTextField.setText(getCemuPath()); cemuTextField.setText(getCemuPath());
try { try {
@ -1041,24 +1070,16 @@ public class MainWindowController {
} }
} }
@FXML
void cemuTextFieldAction(ActionEvent event) {
setCemuPath(cemuTextField.getText());
saveSettings();
}
@FXML
void romTextFieldAction(ActionEvent event) {
setRomPath(romTextField.getText());
saveSettings();
}
@FXML @FXML
void fullscreenToggleBtnAction(ActionEvent event) { void fullscreenToggleBtnAction(ActionEvent event) {
if (fullscreen) { if (fullscreen) {
fullscreen = false; fullscreen = false;
setExecuteCommand(getExecuteCommand().replace("-f -g", "-g"));
executeCommandTextFiled.setText(getExecuteCommand());
} else { } else {
fullscreen = true; fullscreen = true;
setExecuteCommand(getExecuteCommand().replace("-g", "-f -g"));
executeCommandTextFiled.setText(getExecuteCommand());
} }
saveSettings(); saveSettings();
} }
@ -1638,7 +1659,8 @@ public class MainWindowController {
OutputStream outputStream; //new output-stream OutputStream outputStream; //new output-stream
try { try {
props.setProperty("cemuPath", getCemuPath()); props.setProperty("cemuPath", getCemuPath());
props.setProperty("romPath", getRomPath()); props.setProperty("romPath", getRomDirectoryPath());
props.setProperty("executeCommand", getExecuteCommand());
props.setProperty("color", getColor()); props.setProperty("color", getColor());
props.setProperty("language", getLanguage()); props.setProperty("language", getLanguage());
props.setProperty("fullscreen", String.valueOf(isFullscreen())); props.setProperty("fullscreen", String.valueOf(isFullscreen()));
@ -1690,10 +1712,17 @@ public class MainWindowController {
} }
try { try {
setRomPath(props.getProperty("romPath")); setRomDirectoryPath(props.getProperty("romPath"));
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("could not load romPath", e); LOGGER.error("could not load romPath", e);
setRomPath(""); 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 { try {
@ -1862,14 +1891,22 @@ public class MainWindowController {
this.cemuPath = cemuPath; this.cemuPath = cemuPath;
} }
public String getRomPath() { public String getRomDirectoryPath() {
return romPath; return romDirectoryPath;
} }
public void setRomPath(String romPath) { public void setRomDirectoryPath(String romDirectoryPath) {
this.romPath = romPath; this.romDirectoryPath = romDirectoryPath;
} }
public String getExecuteCommand() {
return executeCommand;
}
public void setExecuteCommand(String executeCommand) {
this.executeCommand = executeCommand;
}
public String getColor() { public String getColor() {
return color; return color;
} }

View File

@ -57,19 +57,22 @@ public class playGame extends Thread{
}); });
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
try{ try{
if(mainWindowController.isFullscreen()){ executeComand = mainWindowController.getExecuteCommand() + " \"" + mainWindowController.getGameExecutePath() + "\"";
if(System.getProperty("os.name").equals("Linux")){
executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\""; // if(mainWindowController.isFullscreen()){
} else { // if(System.getProperty("os.name").equals("Linux")){
executeComand = mainWindowController.getCemuPath()+"\\Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\""; // executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\"";
} // } else {
}else{ // executeComand = mainWindowController.getCemuPath()+"\\Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\"";
if(System.getProperty("os.name").equals("Linux")){ // }
executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -g \""+mainWindowController.getGameExecutePath()+"\""; // }else{
} else { // if(System.getProperty("os.name").equals("Linux")){
executeComand = mainWindowController.getCemuPath()+"\\Cemu.exe -g \""+mainWindowController.getGameExecutePath()+"\""; // executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -g \""+mainWindowController.getGameExecutePath()+"\"";
} // } else {
} // executeComand = mainWindowController.getCemuPath() + "\\Cemu.exe -g " + "\"" + mainWindowController.getGameExecutePath() + "\"";
// }
// }
LOGGER.info(executeComand); LOGGER.info(executeComand);
p = Runtime.getRuntime().exec(executeComand); p = Runtime.getRuntime().exec(executeComand);

View File

@ -149,7 +149,7 @@ public class DBController {
LOGGER.error("error while loading ROMs from ROM database, local_roms table", e); LOGGER.error("error while loading ROMs from ROM database, local_roms table", e);
} }
if (entries.size() == 0) { if (entries.size() == 0) {
loadRomDirectory(mainWindowController.getRomPath()); loadRomDirectory(mainWindowController.getRomDirectoryPath());
} }
} }

View File

@ -18,7 +18,7 @@
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.TextFlow?> <?import javafx.scene.text.TextFlow?>
<AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="904.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.cemu_UI.application.MainWindowController"> <AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="904.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.cemu_UI.application.MainWindowController">
<children> <children>
<ScrollPane fx:id="mainScrollPane" fitToWidth="true" layoutY="38.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0"> <ScrollPane fx:id="mainScrollPane" fitToWidth="true" layoutY="38.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<content> <content>
@ -91,12 +91,12 @@
<Insets left="-14.0" /> <Insets left="-14.0" />
</padding> </padding>
</VBox> </VBox>
<VBox spacing="10.0"> <VBox spacing="7.0">
<children> <children>
<Label fx:id="cemuDirectoryLbl" text="Cemu Directory" /> <Label fx:id="cemuDirectoryLbl" text="Cemu Directory" />
<HBox spacing="10.0"> <HBox spacing="10.0">
<children> <children>
<JFXTextField fx:id="cemuTextField" maxWidth="305.0" minWidth="305.0" onAction="#cemuTextFieldAction" prefHeight="32.0" prefWidth="305.0" promptText="cemu directory" /> <JFXTextField fx:id="cemuTextField" maxWidth="305.0" minWidth="305.0" prefHeight="32.0" prefWidth="305.0" promptText="cemu directory" />
<JFXButton fx:id="cemuTFBtn" onAction="#cemuTFBtnAction" prefHeight="32.0" text="choose directory" /> <JFXButton fx:id="cemuTFBtn" onAction="#cemuTFBtnAction" prefHeight="32.0" text="choose directory" />
</children> </children>
</HBox> </HBox>
@ -105,12 +105,12 @@
<Insets right="5.0" /> <Insets right="5.0" />
</padding> </padding>
</VBox> </VBox>
<VBox spacing="10.0"> <VBox spacing="7.0">
<children> <children>
<Label fx:id="romDirectoryLbl" text="Rom Directory" /> <Label fx:id="romDirectoryLbl" text="Rom Directory" />
<HBox spacing="10.0"> <HBox spacing="10.0">
<children> <children>
<JFXTextField fx:id="romTextField" maxWidth="305.0" minWidth="305.0" onAction="#romTextFieldAction" prefHeight="32.0" prefWidth="305.0" promptText="rom directory" /> <JFXTextField fx:id="romTextField" maxWidth="305.0" minWidth="305.0" prefHeight="32.0" prefWidth="305.0" promptText="rom directory" />
<JFXButton fx:id="romTFBtn" onAction="#romTFBtnAction" prefHeight="32.0" text="choose directory" /> <JFXButton fx:id="romTFBtn" onAction="#romTFBtnAction" prefHeight="32.0" text="choose directory" />
</children> </children>
</HBox> </HBox>
@ -170,6 +170,15 @@
<VBox.margin> <VBox.margin>
<Insets top="-10.0" /> <Insets top="-10.0" />
</VBox.margin></JFXToggleButton> </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" /> <Label fx:id="licensesLbl" text="Licenses" />
</children> </children>
<padding> <padding>