diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..745c7f7 --- /dev/null +++ b/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..d68f086 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + cemu_UI + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + + org.eclipse.xtext.ui.shared.xtextNature + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/bin/application/Main.class b/bin/application/Main.class new file mode 100644 index 0000000..59c3a07 Binary files /dev/null and b/bin/application/Main.class differ diff --git a/bin/application/MainWindow.fxml b/bin/application/MainWindow.fxml new file mode 100644 index 0000000..e762ec0 --- /dev/null +++ b/bin/application/MainWindow.fxml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class new file mode 100644 index 0000000..d7bfc02 Binary files /dev/null and b/bin/application/MainWindowController$1.class differ diff --git a/bin/application/MainWindowController$2.class b/bin/application/MainWindowController$2.class new file mode 100644 index 0000000..103ae18 Binary files /dev/null and b/bin/application/MainWindowController$2.class differ diff --git a/bin/application/MainWindowController$3.class b/bin/application/MainWindowController$3.class new file mode 100644 index 0000000..278d9b9 Binary files /dev/null and b/bin/application/MainWindowController$3.class differ diff --git a/bin/application/MainWindowController$4.class b/bin/application/MainWindowController$4.class new file mode 100644 index 0000000..648318f Binary files /dev/null and b/bin/application/MainWindowController$4.class differ diff --git a/bin/application/MainWindowController$5.class b/bin/application/MainWindowController$5.class new file mode 100644 index 0000000..391012d Binary files /dev/null and b/bin/application/MainWindowController$5.class differ diff --git a/bin/application/MainWindowController$6.class b/bin/application/MainWindowController$6.class new file mode 100644 index 0000000..0da5c71 Binary files /dev/null and b/bin/application/MainWindowController$6.class differ diff --git a/bin/application/MainWindowController$7.class b/bin/application/MainWindowController$7.class new file mode 100644 index 0000000..b03be32 Binary files /dev/null and b/bin/application/MainWindowController$7.class differ diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class new file mode 100644 index 0000000..ca0c2bf Binary files /dev/null and b/bin/application/MainWindowController.class differ diff --git a/bin/application/application.css b/bin/application/application.css new file mode 100644 index 0000000..83d6f33 --- /dev/null +++ b/bin/application/application.css @@ -0,0 +1 @@ +/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ \ No newline at end of file diff --git a/bin/application/dbController.class b/bin/application/dbController.class new file mode 100644 index 0000000..3b8c3b9 Binary files /dev/null and b/bin/application/dbController.class differ diff --git a/bin/libraries/commons-io-2.5.jar b/bin/libraries/commons-io-2.5.jar new file mode 100644 index 0000000..107b061 Binary files /dev/null and b/bin/libraries/commons-io-2.5.jar differ diff --git a/bin/libraries/jfoenix-1.2.0.jar b/bin/libraries/jfoenix-1.2.0.jar new file mode 100644 index 0000000..550230d Binary files /dev/null and b/bin/libraries/jfoenix-1.2.0.jar differ diff --git a/bin/libraries/sqlite-jdbc-3.16.1.jar b/bin/libraries/sqlite-jdbc-3.16.1.jar new file mode 100644 index 0000000..9d4b5bb Binary files /dev/null and b/bin/libraries/sqlite-jdbc-3.16.1.jar differ diff --git a/bin/resources/icons/menu_icon_black.png b/bin/resources/icons/menu_icon_black.png new file mode 100644 index 0000000..19711de Binary files /dev/null and b/bin/resources/icons/menu_icon_black.png differ diff --git a/bin/resources/icons/menu_icon_white.png b/bin/resources/icons/menu_icon_white.png new file mode 100644 index 0000000..11adfa7 Binary files /dev/null and b/bin/resources/icons/menu_icon_white.png differ diff --git a/build.fxbuild b/build.fxbuild new file mode 100644 index 0000000..a28fff4 --- /dev/null +++ b/build.fxbuild @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/games.xml b/games.xml new file mode 100644 index 0000000..a07a877 --- /dev/null +++ b/games.xml @@ -0,0 +1,14 @@ + + + +cemu_UI_games +10 +aD:\Sonstiges\ROM's\wii u\Mario Kart 8\code\Turbo.rpx +ee3523 +-200 +C:\Users\Jannik\Documents\cemu_1.7.2\Cemu.exe +D:\Sonstiges\ROM's\wii u +0 +C:\Users\Jannik\Desktop\AMKE01.png +1 + diff --git a/src/application/Main.java b/src/application/Main.java new file mode 100644 index 0000000..b873857 --- /dev/null +++ b/src/application/Main.java @@ -0,0 +1,136 @@ +package application; + +import java.io.File; +import java.io.IOException; +import java.util.Optional; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.stage.DirectoryChooser; +import javafx.stage.FileChooser; +import javafx.stage.Stage; +import javafx.scene.Scene; +import javafx.scene.control.Alert; +import javafx.scene.control.ButtonType; +import javafx.scene.control.Alert.AlertType; +import javafx.scene.layout.AnchorPane; + + +public class Main extends Application { + + Stage primaryStage; + private MainWindowController mainWindowController; + private File dirWin = new File(System.getProperty("user.home") + "/Documents/cemu_UI"); //Windows: C:/Users/"User"/Documents/HomeFlix + private File dirLinux = new File(System.getProperty("user.home") + "/cemu_UI"); //Linux: /home/"User"/HomeFlix + private File fileWin = new File(dirWin + "/config.xml"); //Windows: C:/Users/"User"/Documents/HomeFlix/config.xml + private File fileLinux = new File(dirLinux + "/config.xml"); //Linux: /home/"User"/HomeFlix/config.xml + private File pictureCacheWin = new File(dirWin+"/picture_cache"); + private File pictureCacheLinux = new File(dirLinux+"/picture_cache"); + + @Override + public void start(Stage primaryStage) { + this.primaryStage = primaryStage; + mainWindow(); + } + + private void mainWindow(){ + try { + FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml")); + AnchorPane pane = loader.load(); + primaryStage.setMinHeight(600.00); + primaryStage.setMinWidth(900.00); + primaryStage.setResizable(false); + primaryStage.setTitle("cemu_UI"); +// primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/recources/Homeflix_Icon_64x64.png"))); //adds application icon + + mainWindowController = loader.getController(); //Link of FXMLController and controller class + mainWindowController.setMain(this); //call setMain + + //Linux if directory exists -> check config.xml + if(System.getProperty("os.name").equals("Linux")){ + if(dirLinux.exists() != true){ + dirLinux.mkdir(); + pictureCacheLinux.mkdir(); + }else if(fileLinux.exists() != true){ + firstStart(); + mainWindowController.setColor("00a8cc"); + mainWindowController.setxPosHelper(0); + mainWindowController.saveSettings(); + Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs) + System.exit(0); //finishes itself + } + if(pictureCacheLinux.exists() != true){ + pictureCacheLinux.mkdir(); + } + //windows + }else{ + if(dirWin.exists() != true){ + dirWin.mkdir(); + pictureCacheWin.mkdir(); + }else if(fileWin.exists() != true){ + firstStart(); + mainWindowController.setColor("00a8cc"); + mainWindowController.setxPosHelper(0); + mainWindowController.saveSettings(); + Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs) + System.exit(0); //finishes itself + } + if(pictureCacheWin.exists() != true){ + pictureCacheWin.mkdir(); + } + } + + //TODO download games.db + mainWindowController.loadSettings(); + + mainWindowController.dbController.main(); + mainWindowController.dbController.loadRoms(); + + mainWindowController.initActions(); + mainWindowController.initUI(); + + Scene scene = new Scene(pane); //create new scene, append pane to scene + + primaryStage.setScene(scene); //append scene to stage + primaryStage.show(); //show stage + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void firstStart(){ + Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser + alert.setTitle("cemu_UI"); + alert.setHeaderText("cemu installation"); + alert.setContentText("pleas select your cemu installation"); + + Optional result = alert.showAndWait(); + if (result.get() == ButtonType.OK){ + DirectoryChooser directoryChooser = new DirectoryChooser(); + File selectedDirectory = directoryChooser.showDialog(primaryStage); + mainWindowController.setCemuPath(selectedDirectory.getAbsolutePath()); + + } else { + mainWindowController.setCemuPath(null); + } + + Alert alert2 = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser + alert2.setTitle("cemu_UI"); + alert2.setHeaderText("rom directory"); + alert2.setContentText("pleas select your rom directory"); + + Optional result2 = alert2.showAndWait(); + if (result2.get() == ButtonType.OK){ + DirectoryChooser directoryChooser = new DirectoryChooser(); + File selectedDirectory = directoryChooser.showDialog(primaryStage); + mainWindowController.setRomPath(selectedDirectory.getAbsolutePath()); + + } else { + mainWindowController.setRomPath(null); + } + } + + public static void main(String[] args) { + launch(args); + } +} diff --git a/src/application/MainWindow.fxml b/src/application/MainWindow.fxml new file mode 100644 index 0000000..e762ec0 --- /dev/null +++ b/src/application/MainWindow.fxml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java new file mode 100644 index 0000000..d65fa7c --- /dev/null +++ b/src/application/MainWindowController.java @@ -0,0 +1,784 @@ +package application; + +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Optional; +import java.util.Properties; + +import javax.imageio.ImageIO; + +import org.apache.commons.io.FileUtils; + +import com.jfoenix.controls.JFXButton; +import com.jfoenix.controls.JFXColorPicker; +import com.jfoenix.controls.JFXHamburger; +import com.jfoenix.controls.JFXTextField; +import com.jfoenix.controls.JFXToggleButton; +import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition; +import javafx.animation.FadeTransition; +import javafx.animation.ParallelTransition; +import javafx.animation.TranslateTransition; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.fxml.FXML; +import javafx.scene.control.Alert; +import javafx.scene.control.ButtonType; +import javafx.scene.control.ContextMenu; +import javafx.scene.control.Label; +import javafx.scene.control.MenuItem; +import javafx.scene.control.ScrollPane; +import javafx.scene.control.TextInputDialog; +import javafx.scene.control.Alert.AlertType; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.AnchorPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import javafx.scene.paint.Color; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; +import javafx.stage.DirectoryChooser; +import javafx.stage.FileChooser; +import javafx.util.Duration; + +public class MainWindowController { + + @FXML + private JFXButton aboutBtn; + + @FXML + private JFXButton settingsBtn; + + @FXML + private JFXButton addBtn; + + @FXML + private JFXButton cemuTFBtn; + + @FXML + private JFXButton romTFBtn; + + @FXML + private JFXButton playBtn; + + @FXML + private JFXHamburger menuHam; + + @FXML + private JFXTextField cemuTextField; + + @FXML + private JFXTextField romTextField; + + @FXML + private JFXColorPicker colorPicker; + + @FXML + private JFXToggleButton fullscreenToggleBtn; + + @FXML + private AnchorPane settingsAnchorPane; + + @FXML + private AnchorPane gamesAnchorPane; + + @FXML + private ScrollPane scrollPaneMain; + + @FXML + private VBox sideMenuVBox; + + @FXML + private HBox topHBox; + + private Main main; + private boolean menuTrue = false; + private boolean settingsTrue = false; + private boolean playTrue = false; + private boolean fullscreen; + private String cemuPath; + private String romPath; + private String gameExecutePath; + private String selectedGameTitleID; + private String color; + private int xPos = -200; + private int yPos = 17; + private int xPosHelper; + private FileChooser fileChooser = new FileChooser(); + private DirectoryChooser directoryChooser = new DirectoryChooser(); + private File dirWin = new File(System.getProperty("user.home") + "/Documents/cemu_UI"); + private File dirLinux = new File(System.getProperty("user.home") + "/cemu_UI"); + private File fileWin = new File(dirWin + "/config.xml"); + private File fileLinux = new File(dirLinux + "/config.xml"); + File pictureCacheWin = new File(dirWin+"/picture_cache"); + File pictureCacheLinux = new File(dirLinux+"/picture_cache"); + private ArrayList gameCover = new ArrayList(); + private ArrayList