24 Commits
0.2.0 ... 055

Author SHA1 Message Date
6a2c5d050f update 0.2.1 (055) 2017-11-14 23:44:49 +01:00
b8f4f89ec6 renamed SmmdbAPIQuery to SMMDBAPIController 2017-11-14 12:02:39 +01:00
dafd0b84df maven buildsystem
* maven is now used to build cemu_UI
* cleaned up a lot of code for better overview
2017-11-13 16:44:39 +01:00
06429eaf87 added jfxokaycanceldialog class
* added jfxokaycanceldialog class
* code clean up
2017-11-11 22:27:19 +01:00
9e3b553851 added jfxinfodialog class
* added jfxinfodialog class
* code clean up
2017-11-10 17:11:19 +01:00
61e02f6ac1 added support for updating to different branches
* added support for updating to different branches
* smmdb api fixed bad response from http url, using https now
* code clean-up
2017-11-10 15:58:20 +01:00
40c6084412 Update LICENSE 2017-11-06 21:33:05 +01:00
6cc9790c5a added update support
* added a manuall update function
* added a auto update function
2017-11-06 10:42:31 +01:00
3bcbf902d5 added adialog to explain missing values if adding a game manually 2017-11-06 10:00:10 +01:00
3f85fdf07b fiyed typos 2017-11-04 17:04:21 +01:00
40dd2c48d3 Merge remote-tracking branch 'origin/master' 2017-10-31 14:11:40 +01:00
1a4027e687 added edit dialog
* added a dialog for editing existing games
* a few UI clean ups
* you need to have valid values in every text field if you're adding a new game manually
2017-10-31 14:11:17 +01:00
b76126add1 Create CONTRIBUTING.md 2017-10-30 18:55:00 +01:00
9c4934966c UI clean up
* added a dialog if cloud sync init fails
*  fixed sideMenuSlideOut() is call even if its already outside
* code clean up
2017-10-30 18:28:58 +01:00
74440e3d7e add new Game is now one dialog
* add new game will now show only one dialog
* code clean up
2017-10-30 17:52:45 +01:00
e4a316f62c added System.exit(0) in main 2017-10-29 23:57:39 +01:00
eb127282ad more lib updates and cloud sync fixes
* added a fallback if something went wrong with cloud sync init
* removed old libs
2017-10-29 23:27:36 +01:00
5b46a0b58c updated some libraries
* google api libraries 1.22 -> 1.23
* apache commons-io 2.3 -> 2.6
* apache commons-codec 1.10 -> 1.11
2017-10-29 22:04:40 +01:00
6169a5e7cd added support for cemu 1.11 save path change
see https://github.com/Seil0/cemu_UI/issues/6
2017-10-28 16:43:04 +02:00
f53055db7e buildnumber 043 -> 045 2017-10-26 23:40:09 +02:00
8d759a724b fixed PlayBtn Position on startup
* fixed playBtn has a wrong Position on startup
2017-10-26 21:13:56 +02:00
f6778a320f Merge remote-tracking branch 'origin/master' 2017-10-24 22:42:07 +02:00
607bcf8ace added a update section in the settings
* added "check now!" button (not working for now)
* added a toggle button for auto updates (not working for now)
* all labels used in the settings are now accessable from the mwc (preparation for supporting more languages)
2017-10-24 22:41:56 +02:00
c5d6a2f276 Update README.md 2017-10-24 21:33:29 +02:00
134 changed files with 1282 additions and 560 deletions

View File

@ -1,29 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
<classpathentry kind="lib" path="src/libraries/commons-io-2.5.jar"/>
<classpathentry kind="lib" path="src/libraries/google_apis/google-api-client-1.22.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_apis/google-api-services-drive-v3-rev68-1.22.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_apis/google-http-client-1.22.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_apis/google-http-client-jackson2-1.22.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_apis/google-oauth-client-1.22.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_apis/google-oauth-client-java6-1.22.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_apis/google-oauth-client-jetty-1.22.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_apis/javax.servlet-api-3.1.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_apis/jetty-6.1.25.jar"/>
<classpathentry kind="lib" path="src/libraries/google_apis/jetty-util-6.1.25.jar"/>
<classpathentry kind="lib" path="src/libraries/google_apis/jackson-core-2.8.8.jar"/>
<classpathentry kind="lib" path="src/libraries/commons-codec-1.10.jar"/>
<classpathentry kind="lib" path="src/libraries/minimal-json-0.9.4.jar"/>
<classpathentry kind="lib" path="src/libraries/commons-logging-api-1.1.jar"/>
<classpathentry kind="lib" path="src/libraries/commons-vfs2-2.1.1744488.2.jar"/>
<classpathentry kind="lib" path="src/libraries/flow-8.0.1.jar"/>
<classpathentry kind="lib" path="src/libraries/zip4j-1.3.2.jar"/>
<classpathentry kind="lib" path="src/libraries/log4j-api-2.8.2.jar"/>
<classpathentry kind="lib" path="src/libraries/log4j-core-2.8.2.jar"/>
<classpathentry kind="lib" path="src/libraries/sqlite-jdbc-3.20.0.jar"/>
<classpathentry kind="lib" path="src/libraries/jfoenix-1.9.1.jar"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

3
.gitignore vendored
View File

@ -48,4 +48,5 @@ Temporary Items
config.xml
client_secret.json
.directory
target/
cemu_UI.jar

View File

@ -15,8 +15,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>

View File

@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

View File

@ -9,4 +9,5 @@ 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.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

27
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,27 @@
# Contributing to cemu_UI
The following is a set of guidelines for contributing to cemu_UI.
## Java Sytleguide
If your willing to contribute to cemu_UI please us the following example as guide and rules to design your code.
* Use names for methods and variables that clarify their purpose. (This will help a lot to understand the code)
* Use as many spaces as necessary to make the code clear, but as little as possible.
* Sort all variables according to their type.
* For all (debugging) console outputs, use the log4j based logger. (syso/syse is okay for testing)
```java
// Use this as a sample Class:
public ClassName () {
void MethodName () {
double gameID; // Title-ID used on the Wii U
if (gameID == null) {
// Do something
}
// more code ...
}
}
```

17
LICENSE
View File

@ -1,13 +1,4 @@
"THE CHOCOLATE-WARE LICENSE" (Revision 1):
<@Seil0> wrote this file. As long as you retain
this notice this software is licensed under the
GNU GENERAL PUBLIC LICENSE Version 3 ,with the following additions:
* If we meet some day, and you think this stuff is worth it,
you can buy me a chocolate in return. - @Seil0
(license based in Beer-ware, see https://fedoraproject.org/wiki/Licensing/Beerware )
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
@ -640,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -661,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

View File

@ -7,16 +7,10 @@
cemu_UI is a simple, material design graphical frontend for [cemu](http://cemu.info/), a Wii U emulator. Downloads can be found [here](https://github.com/Seil0/cemu_UI/releases).
## Installation
Simply download the cemu_UI.jar from [releases](https://github.com/Seil0/cemu_UI/releases), make sure you have the latest version of java 8 oracle jre/jdk installed, open the file. cemu_UI creats a new directory "C:\Users\USERNAME\Documents\cemu_UI", where the database, settings and covers are stored. **first start can take while!**
Simply download the cemu_UI.jar from [releases](https://github.com/Seil0/cemu_UI/releases), make sure you have the latest version of java 8 oracle jre/jdk installed and open the file. cemu_UI creats a new directory "C:\Users\USERNAME\Documents\cemu_UI", where the database, settings and covers are stored. **first start can take while!**
If you want to use the cloud sync function read the [wiki](https://github.com/Seil0/cemu_UI/wiki#cloud-savegame-syncronisation) carefully!
## building from source
1. read the [license](https://github.com/Seil0/cemu_UI/blob/master/LICENSE)
2. download/clone the git repository
3. make sure you have the latest versionj of java 8 oracle jdk installed
4. place the unzip repository into your workspace and start eclipse, project should now be there **or** import the project to your workspace
## Features
* launch Games
@ -26,7 +20,7 @@ If you want to use the cloud sync function read the [wiki](https://github.com/Se
* automatic rom detection (only .rpx files with a app.xml)
* customisable UI
* [sync savegames via google drive](https://github.com/Seil0/cemu_UI/wiki)
* [smmdb api](http://smmdb.ddns.net/api) integration
* [smmdb api](https://github.com/Tarnadas/smmdb) integration
## [planed Features](https://github.com/Seil0/cemu_UI/projects/1) (no ETA)
@ -37,6 +31,8 @@ If you want to use the cloud sync function read the [wiki](https://github.com/Se
### If you have another idea, make a "new issue" with the ![#f03c15](https://placehold.it/15/fbca04/000000?text=+)`idea` lable
## [FAQ](https://github.com/Seil0/cemu_UI/wiki#faq)
### [building from source](https://github.com/Seil0/cemu_UI/wiki/Documantation)
## Screenshots

1
bin/.gitignore vendored
View File

@ -1 +0,0 @@
/application/

Binary file not shown.

View File

@ -1,117 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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.controls.JFXTreeTableView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.TextFlow?>
<AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="904.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
<children>
<ScrollPane fx:id="scrollPaneMain" fitToWidth="true" layoutY="38.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<content>
<AnchorPane fx:id="gamesAnchorPane">
<padding>
<Insets bottom="17.0" />
</padding></AnchorPane>
</content>
</ScrollPane>
<HBox fx:id="topHBox" prefHeight="38.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<JFXHamburger fx:id="menuHam" prefHeight="38.0" prefWidth="38.0" stylesheets="@MainWindows.css" />
</children>
</HBox>
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="568.0" prefWidth="175.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="38.0">
<children>
<JFXButton fx:id="aboutBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="190.0" onAction="#aboutBtnAction" prefHeight="38.0" prefWidth="190.0" text="About" textAlignment="LEFT">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<JFXButton fx:id="settingsBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="213.0" onAction="#settingsBtnAction" prefHeight="38.0" prefWidth="213.0" text="Settings" textAlignment="LEFT">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<JFXButton fx:id="addBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="193.0" onAction="#addBtnAction" prefHeight="38.0" prefWidth="193.0" text="Add new Game" textAlignment="LEFT">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<JFXButton fx:id="reloadRomsBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="199.0" onAction="#reloadRomsBtnAction" prefHeight="38.0" prefWidth="199.0" text="reload roms" textAlignment="LEFT">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<JFXButton fx:id="smmdbBtn" alignment="TOP_LEFT" onAction="#smmdbBtnAction" prefHeight="38.0" prefWidth="216.0" text="smmdb">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
</children>
</VBox>
<!-- space between settings sections 35px, between sections elements (label + element) 20px, between label and element 3px(or more) -->
<AnchorPane fx:id="settingsAnchorPane" layoutX="38.0" layoutY="27.0" style="-fx-background-color: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="175.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<children>
<Label layoutX="22.0" layoutY="59.0" text="Cemu Directory" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="59.0" />
<JFXTextField fx:id="cemuTextField" layoutX="18.0" layoutY="83.0" maxWidth="305.0" minWidth="305.0" onAction="#cemuTextFieldAction" prefHeight="32.0" prefWidth="305.0" promptText="cemu directory" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="79.0" />
<JFXTextField fx:id="romTextField" layoutX="18.0" layoutY="159.0" maxWidth="305.0" minWidth="305.0" onAction="#romTextFieldAction" prefHeight="32.0" prefWidth="305.0" promptText="rom directory" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="151.0" />
<JFXButton fx:id="romTFBtn" layoutX="337.0" layoutY="159.0" onAction="#romTFBtnAction" prefHeight="32.0" prefWidth="108.0" text="choose directory" AnchorPane.leftAnchor="333.0" AnchorPane.topAnchor="151.0" />
<JFXButton fx:id="cemuTFBtn" layoutX="333.0" layoutY="79.0" onAction="#cemuTFBtnAction" prefHeight="32.0" prefWidth="108.0" text="choose directory" AnchorPane.leftAnchor="333.0" AnchorPane.topAnchor="79.0" />
<JFXColorPicker fx:id="colorPicker" layoutX="22.0" layoutY="235.0" onAction="#colorPickerAction" AnchorPane.leftAnchor="16.0" AnchorPane.topAnchor="227.0" />
<JFXToggleButton fx:id="fullscreenToggleBtn" layoutX="14.0" layoutY="391.0" onAction="#fullscreenToggleBtnAction" text="start game in fullscreen" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="390.0" />
<Label layoutX="22.0" layoutY="135.0" text="Rom Directory" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="131.0" />
<Label layoutX="22.0" layoutY="211.0" text="main Color" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="203.0" />
<Label layoutX="14.0" layoutY="371.0" text="Cemu Settings" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="350.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<Label layoutX="22.0" layoutY="14.0" text="cemu_UI Settings" AnchorPane.leftAnchor="18.0" AnchorPane.topAnchor="14.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<JFXToggleButton fx:id="cloudSyncToggleBtn" layoutX="14.0" layoutY="264.0" onAction="#cloudSyncToggleBtnAction" text="cloud savegames (Google Drive)" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="267.0" />
</children>
</AnchorPane>
<AnchorPane fx:id="smmdbAnchorPane" style="-fx-background-color: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="175.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<children>
<JFXTreeTableView fx:id="courseTreeTable" layoutX="14.0" layoutY="14.0" prefHeight="537.0" prefWidth="405.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />
<ImageView fx:id="smmdbImageView" fitHeight="150.0" fitWidth="267.0" layoutX="436.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
<ScrollPane fx:id="smmdbScrollPane" layoutX="436.0" layoutY="181.0" prefHeight="290.0" prefWidth="267.0" AnchorPane.bottomAnchor="91.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="181.0">
<content>
<TextFlow fx:id="smmdbTextFlow" maxWidth="265.0" prefWidth="265.0" />
</content>
</ScrollPane>
<JFXButton fx:id="smmdbDownloadBtn" buttonType="RAISED" layoutX="436.0" layoutY="479.0" onAction="#smmdbDownloadBtnAction" prefHeight="38.0" prefWidth="267.0" text="download" AnchorPane.bottomAnchor="45.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="479.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<Label fx:id="helpLabel" layoutX="436.0" layoutY="538.0" prefHeight="17.0" prefWidth="267.0" text="please help me improving this! click me!">
<font>
<Font size="14.0" />
</font>
</Label>
</children></AnchorPane>
<JFXButton fx:id="playBtn" buttonType="RAISED" layoutX="396.0" maxHeight="28.0" minWidth="100.0" onAction="#playBtnAction" ripplerFill="#00aacc" text="play" textAlignment="CENTER" visible="false" AnchorPane.bottomAnchor="12.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<JFXButton fx:id="totalPlaytimeBtn" buttonType="RAISED" layoutX="275.5" maxHeight="32.0" minWidth="100.0" onAction="#totalPlaytimeBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="0 h 0 min" visible="false" AnchorPane.bottomAnchor="10.0">
</JFXButton>
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" layoutX="516.5" maxHeight="32.0" minWidth="100.0" onAction="#lastTimePlayedBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="Last played, never" visible="false" AnchorPane.bottomAnchor="10.0" />
</children>
</AnchorPane>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="ASCII"?>
<anttasks:AntTask xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:anttasks="http://org.eclipse.fx.ide.jdt/1.0" buildDirectory="${project}/build">
<deploy>
<application name="cemu_UI"/>
<info/>
</deploy>
<signjar/>
</anttasks:AntTask>

222
pom.xml Normal file
View File

@ -0,0 +1,222 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>cemu_UI</artifactId>
<version>0.2.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>cemu_UI</name>
<url>http://www.kellerkinder.xyz</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>com.eclipsesource.minimal-json</groupId>
<artifactId>minimal-json</artifactId>
<version>0.9.4</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.20.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
<version>2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.datafx/flow -->
<dependency>
<groupId>io.datafx</groupId>
<artifactId>flow</artifactId>
<version>8.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.lingala.zip4j/zip4j -->
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>1.3.2</version>
</dependency>
<!-- Google Drive-API libraries-->
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.api-client/google-api-client -->
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.apis/google-api-services-drive -->
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v3-rev87-1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.http-client/google-http-client -->
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.http-client/google-http-client-jackson2 -->
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client -->
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-java6 -->
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-java6</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-jetty -->
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0-b01</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mortbay.jetty/jetty -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>6.1.26</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mortbay.jetty/jetty-util -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>6.1.26</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>libraries/</classpathPrefix>
<mainClass>com.cemu_UI.application.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/libraries</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,86 +0,0 @@
/*
* HAMBURGER CSS
*/
.jfx-hamburgerW StackPane {
-fx-background-color: white;
-fx-background-radius: 5px;
}
.jfx-hamburgerB StackPane {
-fx-background-color: black;
-fx-background-radius: 5px;
}
/*
* TREE TABLE CSS
*/
.tree-table-view {
-fx-tree-table-color: rgba(0, 168, 204, 0.2);
-fx-tree-table-rippler-color: rgba(0, 168, 204, 0.4);
}
.tree-table-view:focused .tree-table-row-cell:selected {
-fx-background-color: -fx-tree-table-color;
-fx-table-cell-border-color: -fx-tree-table-color;
-fx-text-fill: BLACK;
}
.tree-table-view:focused .tree-table-row-cell:selected .tree-table-cell {
-fx-text-fill: BLACK;
}
.tree-table-view .jfx-rippler {
-jfx-rippler-fill: -fx-tree-table-rippler-color;
}
.tree-table-view .column-header,
.tree-table-view .column-header-background,
.tree-table-view .column-header-background .filler {
-fx-background-color: TRANSPARENT;
}
.tree-table-view .column-header {
-fx-border-width: 0 1 0 1;
-fx-border-color: #F3F3F3;
}
.tree-table-view .column-header .label {
-fx-text-fill: #949494;
-fx-padding: 16 0 16 0;
}
.tree-table-view .column-header .arrow, .tree-table-view .column-header .sort-order-dot {
-fx-background-color: #949494;
}
.tree-table-view .column-header:last-visible {
-fx-border-width: 0 2 0 1;
}
.tree-table-view .column-header-background {
-fx-border-width: 0 0.0 1 0;
-fx-border-color: #F3F3F3;
}
.tree-table-view .tree-table-cell {
-fx-border-width: 0 0 0 0;
-fx-padding: 16 0 16 0;
}
.tree-table-view .column-overlay {
-fx-background-color: -fx-tree-table-color;
}
.tree-table-view .column-resize-line, .tree-table-view .column-drag-header {
-fx-background-color: -fx-tree-table-rippler-color;
}
.tree-table-view:focused {
-fx-background-color: -fx-tree-table-color, -fx-box-border, -fx-control-inner-background;
-fx-background-insets: -1.4, 0, 1;
-fx-background-radius: 1.4, 0, 0;
/*....*/
-fx-padding: 1; /* 0.083333em; */
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss} [%t] %c{1} - %msg%n" />
</Console>
<File name="file" fileName="${sys:logFilename}" immediateFlush="true">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss} [%t] %c{1} - %msg%n" />
</File>
</Appenders>
<Loggers>
<Root level="debug" additivity="false">
<AppenderRef ref="console" />
<AppenderRef ref="file"/>
</Root>
</Loggers>
</Configuration>

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA.
*/
package application;
package com.cemu_UI.application;
import java.io.File;
import java.io.FileOutputStream;
@ -33,6 +33,9 @@ import java.util.TimerTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.cemu_UI.controller.CloudController;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
@ -66,16 +69,22 @@ public class Main extends Application {
@Override
public void start(Stage primaryStage) {
this.primaryStage = primaryStage;
cloudController = new CloudController(this);
mainWindow();
initActions();
try {
this.primaryStage = primaryStage;
cloudController = new CloudController(mainWindowController);
mainWindow();
initActions();
} catch (Exception e) {
LOGGER.error("ooooops",e);
}
}
private void mainWindow(){
try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml"));
pane = loader.load();
FXMLLoader loader = new FXMLLoader();
loader.setLocation(ClassLoader.getSystemResource("fxml/MainWindow.fxml"));
pane = (AnchorPane) loader.load();
// primaryStage.setResizable(false);
primaryStage.setTitle("cemu_UI");
// primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon
@ -100,7 +109,7 @@ public class Main extends Application {
//startup checks
//check if client_secret.jason is present
if (Main.class.getResourceAsStream("/resources/client_secret.json") == null) {
if (Main.class.getResourceAsStream("/client_secret.json") == null) {
LOGGER.error("client_secret is missing!!!!!");
Alert alert = new Alert(AlertType.ERROR);
@ -122,6 +131,7 @@ public class Main extends Application {
LOGGER.info("firststart, setting default values");
firstStart();
mainWindowController.setColor("00a8cc");
mainWindowController.setAutoUpdate(false);
mainWindowController.setxPosHelper(0);
mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs)
@ -148,6 +158,7 @@ public class Main extends Application {
//loading settings and initialize UI, dbController.main() loads all databases
mainWindowController.loadSettings();
mainWindowController.checkAutoUpdate();
mainWindowController.initActions();
mainWindowController.initUI();
mainWindowController.dbController.main();
@ -158,7 +169,7 @@ public class Main extends Application {
mainWindowController.addUIData();
scene = new Scene(pane); //create new scene, append pane to scene
scene.getStylesheets().add(Main.class.getResource("MainWindows.css").toExternalForm());
scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm());
primaryStage.setScene(scene); //append scene to stage
primaryStage.show(); //show stage
} catch (IOException e) {
@ -287,4 +298,9 @@ public class Main extends Application {
LOGGER = LogManager.getLogger(Main.class.getName());
launch(args);
}
@Override
public void stop() {
System.exit(0);
}
}

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA.
*/
package application;
package com.cemu_UI.application;
import java.awt.Desktop;
import java.awt.Graphics2D;
@ -42,6 +42,7 @@ import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Optional;
import java.util.Properties;
import javax.imageio.ImageIO;
import javax.swing.ProgressMonitor;
import javax.swing.ProgressMonitorInputStream;
@ -50,6 +51,14 @@ import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.cemu_UI.controller.SmmdbAPIController;
import com.cemu_UI.controller.UpdateController;
import com.cemu_UI.controller.dbController;
import com.cemu_UI.datatypes.CourseTableDataType;
import com.cemu_UI.datatypes.SmmdbApiDataType;
import com.cemu_UI.datatypes.UIROMDataType;
import com.cemu_UI.uiElements.JFXInfoDialog;
import com.cemu_UI.uiElements.JFXOkayCancelDialog;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker;
import com.jfoenix.controls.JFXDialog;
@ -61,9 +70,6 @@ import com.jfoenix.controls.JFXTreeTableColumn;
import com.jfoenix.controls.JFXTreeTableView;
import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition;
import datatypes.CourseTableDataType;
import datatypes.SmmdbApiDataType;
import datatypes.UIROMDataType;
import javafx.animation.FadeTransition;
import javafx.animation.ParallelTransition;
import javafx.animation.TranslateTransition;
@ -77,18 +83,23 @@ import javafx.fxml.FXML;
import javafx.geometry.Insets;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBar.ButtonData;
import javafx.scene.control.ButtonType;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Dialog;
import javafx.scene.control.Label;
import javafx.scene.control.MenuItem;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextInputDialog;
import javafx.scene.control.TextField;
import javafx.scene.control.TreeItem;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
@ -127,6 +138,9 @@ public class MainWindowController {
@FXML
private JFXButton romTFBtn;
@FXML
private JFXButton updateBtn;
@FXML
private JFXButton smmdbDownloadBtn;
@ -152,14 +166,26 @@ public class MainWindowController {
private TextFlow smmdbTextFlow;
@FXML
private JFXColorPicker colorPicker;
private JFXColorPicker colorPicker;
@FXML
private JFXToggleButton cloudSyncToggleBtn;
@FXML
private JFXToggleButton autoUpdateToggleBtn;
@FXML
private JFXToggleButton fullscreenToggleBtn;
@FXML
private JFXToggleButton cloudSyncToggleBtn;
private ChoiceBox<String> branchChoisBox;
@FXML
private AnchorPane mainAnchorPane;
@FXML
private AnchorPane gamesAnchorPane;
@FXML
private AnchorPane settingsAnchorPane;
@ -167,13 +193,10 @@ public class MainWindowController {
private AnchorPane smmdbAnchorPane;
@FXML
private AnchorPane gamesAnchorPane;
private ScrollPane mainScrollPane;
@FXML
private AnchorPane mainAnchorPane;
@FXML
private ScrollPane scrollPaneMain;
private ScrollPane settingsScrollPane;
@FXML
private ScrollPane smmdbScrollPane;
@ -190,6 +213,27 @@ public class MainWindowController {
@FXML
private Label helpLabel;
@FXML
private Label cemu_UISettingsLbl;
@FXML
private Label cemuDirectoryLbl;
@FXML
private Label romDirectoryLbl;
@FXML
private Label mainColorLbl;
@FXML
private Label updateLbl;
@FXML
private Label branchLbl;
@FXML
private Label cemuSettingsLbl;
@FXML
private JFXTreeTableView<CourseTableDataType> courseTreeTable = new JFXTreeTableView<CourseTableDataType>();
@ -211,12 +255,15 @@ public class MainWindowController {
Main main;
dbController dbController;
SmmdbApiQuery smmdbApiQuery;
SmmdbAPIController smmdbAPIController;
playGame playGame;
private UpdateController updateController;
private boolean menuTrue = false;
private boolean settingsTrue = false;
private boolean playTrue = false;
private boolean smmdbTrue = false;
private boolean autoUpdate = false;
private boolean useBeta = false;
private boolean fullscreen;
private boolean cloudSync;
private String cloudService = ""; //set cloud provider (at the moment only GoogleDrive, Dropbox is planed)
@ -228,8 +275,8 @@ public class MainWindowController {
private String selectedGameTitleID;
private String selectedGameTitle;
private String id;
private String version = "0.2.0";
private String buildNumber = "043";
private String version = "0.2.1";
private String buildNumber = "055";
private String versionName = "Puzzle Plank Galaxy";
private int xPos = -200;
private int yPos = 17;
@ -244,8 +291,9 @@ public class MainWindowController {
private File dirLinux = new File(System.getProperty("user.home") + "/cemu_UI");
private File configFileWin = new File(dirWin + "/config.xml");
private File configFileLinux = new File(dirLinux + "/config.xml");
File pictureCacheWin = new File(dirWin+"/picture_cache");
File pictureCacheLinux = new File(dirLinux+"/picture_cache");
private File pictureCacheWin = new File(dirWin+"/picture_cache");
private File pictureCacheLinux = new File(dirLinux+"/picture_cache");
private ObservableList<String> branches = FXCollections.observableArrayList("stable", "beta");
private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); //TODO add more IDs
private ObservableList<UIROMDataType> games = FXCollections.observableArrayList();
ObservableList<SmmdbApiDataType> courses = FXCollections.observableArrayList();
@ -254,6 +302,7 @@ public class MainWindowController {
Properties props = new Properties();
Properties gameProps = new Properties();
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
private HamburgerBackArrowBasicTransition burgerTask;
private MenuItem edit = new MenuItem("edit");
private MenuItem remove = new MenuItem("remove");
private MenuItem update = new MenuItem("update");
@ -261,22 +310,22 @@ public class MainWindowController {
private ContextMenu gameContextMenu = new ContextMenu(edit, remove, update, addDLC);
private Label lastGameLabel = new Label();
private ImageView add_circle_black = new ImageView(new Image("resources/icons/ic_add_circle_black_24dp_1x.png"));
private ImageView info_black = new ImageView(new Image("resources/icons/ic_info_black_24dp_1x.png"));
private ImageView settings_black = new ImageView(new Image("resources/icons/ic_settings_black_24dp_1x.png"));
private ImageView cached_black = new ImageView(new Image("resources/icons/ic_cached_black_24dp_1x.png"));
private ImageView smmdb_black = new ImageView(new Image("resources/icons/ic_get_app_black_24dp_1x.png"));
private ImageView add_circle_white = new ImageView(new Image("resources/icons/ic_add_circle_white_24dp_1x.png"));
private ImageView info_white = new ImageView(new Image("resources/icons/ic_info_white_24dp_1x.png"));
private ImageView settings_white = new ImageView(new Image("resources/icons/ic_settings_white_24dp_1x.png"));
private ImageView cached_white = new ImageView(new Image("resources/icons/ic_cached_white_24dp_1x.png"));
private ImageView smmdb_white = new ImageView(new Image("resources/icons/ic_get_app_white_24dp_1x.png"));
private Image close_black = new Image("resources/icons/close_black_2048x2048.png");
private ImageView add_circle_black = new ImageView(new Image("icons/ic_add_circle_black_24dp_1x.png"));
private ImageView info_black = new ImageView(new Image("icons/ic_info_black_24dp_1x.png"));
private ImageView settings_black = new ImageView(new Image("icons/ic_settings_black_24dp_1x.png"));
private ImageView cached_black = new ImageView(new Image("icons/ic_cached_black_24dp_1x.png"));
private ImageView smmdb_black = new ImageView(new Image("icons/ic_get_app_black_24dp_1x.png"));
private ImageView add_circle_white = new ImageView(new Image("icons/ic_add_circle_white_24dp_1x.png"));
private ImageView info_white = new ImageView(new Image("icons/ic_info_white_24dp_1x.png"));
private ImageView settings_white = new ImageView(new Image("icons/ic_settings_white_24dp_1x.png"));
private ImageView cached_white = new ImageView(new Image("icons/ic_cached_white_24dp_1x.png"));
private ImageView smmdb_white = new ImageView(new Image("icons/ic_get_app_white_24dp_1x.png"));
private Image close_black = new Image("icons/close_black_2048x2048.png");
public void setMain(Main main) {
this.main = main;
dbController = new dbController(this);
smmdbApiQuery = new SmmdbApiQuery();
smmdbAPIController = new SmmdbAPIController();
}
void initUI() {
@ -292,7 +341,15 @@ public class MainWindowController {
colorPicker.setValue(Color.valueOf(getColor()));
fullscreenToggleBtn.setSelected(isFullscreen());
cloudSyncToggleBtn.setSelected(isCloudSync());
edit.setDisable(true);
autoUpdateToggleBtn.setSelected(isAutoUpdate());
branchChoisBox.setItems(branches);
if (isUseBeta()) {
branchChoisBox.getSelectionModel().select(1);
} else {
branchChoisBox.getSelectionModel().select(0);
}
applyColor();
//initialize courseTable
@ -324,7 +381,7 @@ public class MainWindowController {
void initActions() {
LOGGER.info("initializing Actions ...");
HamburgerBackArrowBasicTransition burgerTask = new HamburgerBackArrowBasicTransition(menuHam);
burgerTask = new HamburgerBackArrowBasicTransition(menuHam);
menuHam.addEventHandler(MouseEvent.MOUSE_PRESSED, (e)->{
if (playTrue) {
playBtnSlideOut();
@ -334,14 +391,14 @@ public class MainWindowController {
burgerTask.setRate(-1.0);
burgerTask.play();
menuTrue = false;
}else{
} else {
sideMenuSlideIn();
burgerTask.setRate(1.0);
burgerTask.play();
menuTrue = true;
}
if (settingsTrue) {
settingsAnchorPane.setVisible(false);
settingsScrollPane.setVisible(false);
// setPath(tfPath.getText());
saveSettings();
settingsTrue = false;
@ -366,7 +423,88 @@ public class MainWindowController {
alert.initOwner(main.primaryStage);
alert.showAndWait();
}else{
//TODO show edit window
String[] gameInfo = dbController.getGameInfo(selectedGameTitleID);
//new Dialog
Dialog<Integer> dialog = new Dialog<>();
dialog.setTitle("edit game");
dialog.setHeaderText("You can edit the tile and rom/cover path.");
// Set the button types.
ButtonType okayBtn = new ButtonType("Okay", ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(okayBtn, ButtonType.CANCEL);
// Create gameTitle, titleID, gamePath and gameCover TextFields and Labels and two Btn for filechooser
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
TextField gameTitleTF = new TextField();
gameTitleTF.setPromptText("game tile");
TextField titleIDTF = new TextField();
titleIDTF.setPromptText("title ID");
TextField romPathTF = new TextField();
romPathTF.setPromptText("ROM path");
TextField gameCoverTF = new TextField();
gameCoverTF.setPromptText("cover path");
gameTitleTF.setText(gameInfo[0]);
titleIDTF.setText(gameInfo[3]);
romPathTF.setText(gameInfo[2]);
gameCoverTF.setText(gameInfo[1]);
titleIDTF.setEditable(false);
Button selectPathBtn = new Button("select .rpx file");
Button selectCoverBtn = new Button("select cover file");
selectPathBtn.setPrefWidth(110);
selectCoverBtn.setPrefWidth(110);
selectPathBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
FileChooser romDirectoryChooser = new FileChooser();
File romDirectory = romDirectoryChooser.showOpenDialog(main.primaryStage);
romPathTF.setText(romDirectory.getAbsolutePath());
}
});
selectCoverBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
FileChooser coverDirectoryChooser = new FileChooser();
File coverDirectory = coverDirectoryChooser.showOpenDialog(main.primaryStage);
gameCoverTF.setText(coverDirectory.getAbsolutePath());
}
});
grid.add(new Label("game title:"), 0, 0);
grid.add(gameTitleTF, 1, 0);
grid.add(new Label("title id:"), 0, 1);
grid.add(titleIDTF, 1, 1);
grid.add(new Label("ROM path:"), 0, 2);
grid.add(romPathTF, 1, 2);
grid.add(selectPathBtn, 2, 2);
grid.add(new Label("cover path:"), 0, 3);
grid.add(gameCoverTF, 1, 3);
grid.add(selectCoverBtn, 2, 3);
dialog.getDialogPane().setContent(grid);
Optional<Integer> result2 = dialog.showAndWait();
if (result2.isPresent()){
dbController.setGameInfo(gameTitleTF.getText(), gameInfo[3], romPathTF.getText(), gameCoverTF.getText());
games.remove(selectedUIDataIndex);
dbController.loadSingleRom(gameInfo[3]);
refreshUIData();
LOGGER.info("successfully edited \"" + gameInfo[0] + "\", new name is \"" + gameTitleTF.getText() + "\"");
}
}
}
});
@ -577,6 +715,18 @@ public class MainWindowController {
}
}
});
branchChoisBox.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) {
if (branchChoisBox.getItems().get((int) new_value).toString() == "beta") {
setUseBeta(true);
} else {
setUseBeta(false);
}
saveSettings();
}
});
LOGGER.info("initializing Actions done!");
}
@ -587,29 +737,13 @@ public class MainWindowController {
}
@FXML
void aboutBtnAction(){
JFXDialogLayout content= new JFXDialogLayout();
content.setHeading(new Text("cemu_UI"));
content.setBody(new Text("cemu_UI by @Seil0 \nVersion: "+version+" ("+buildNumber+") \""+versionName+"\" \nThis Application is made with free Software\nwww.kellerkinder.xyz"));
content.setPrefSize(350, 170);
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog =new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton button=new JFXButton("Okay");
button.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event){
dialog.close();
}
});
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
button.setPrefHeight(32);
button.setStyle(dialogBtnStyle);
content.setActions(button);
main.pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (main.pane.getHeight()-content.getPrefHeight())/2);
AnchorPane.setLeftAnchor(stackPane, (main.pane.getWidth()-content.getPrefWidth())/2);
dialog.show();
void aboutBtnAction(){
String headingText = "cemu_UI";
String bodyText = "cemu_UI by @Seil0 \nVersion: " + version + " (" + buildNumber + ") \"" + versionName + "\" \n"
+ "This Application is made with free Software\n"
+ "www.kellerkinder.xyz";
JFXInfoDialog aboutDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 350, 170, main.pane);
aboutDialog.show();
}
@FXML
@ -619,11 +753,11 @@ public class MainWindowController {
smmdbTrue = false;
}
if (settingsTrue) {
settingsAnchorPane.setVisible(false);
settingsScrollPane.setVisible(false);
settingsTrue = false;
saveSettings();
} else {
settingsAnchorPane.setVisible(true);
settingsScrollPane.setVisible(true);
settingsTrue = true;
}
}
@ -648,7 +782,7 @@ public class MainWindowController {
//start query
courses.removeAll(courses);
courses.addAll(smmdbApiQuery.startQuery());
courses.addAll(smmdbAPIController.startQuery());
//add query response to courseTreeTable
for(int i = 0; i < courses.size(); i++){
@ -714,6 +848,23 @@ public class MainWindowController {
}
}
@FXML
void updateBtnAction(ActionEvent event) {
updateController = new UpdateController(this, buildNumber, useBeta);
Thread updateThread = new Thread(updateController);
updateThread.setName("Updater");
updateThread.start();
}
@FXML
void autoUpdateToggleBtnAction(ActionEvent event) {
if(isAutoUpdate()){
setAutoUpdate(false);
}else{
setAutoUpdate(true);
}
saveSettings(); }
@FXML
void smmdbDownloadBtnAction(ActionEvent event){
String downloadUrl = "http://smmdb.ddns.net/api/downloadcourse?id=" + id + "&type=zip";
@ -806,48 +957,43 @@ public class MainWindowController {
if(cloudSync) {
cloudSync = false;
} else {
JFXDialogLayout content= new JFXDialogLayout();
content.setHeading(new Text("activate cloud savegame sync (beta)"));
content.setBody(new Text("You just activate the cloud savegame sync function of cemu_UI, \nwhich is currently in beta. Are you sure you want to do this?"));
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton okayBtn = new JFXButton("Okay");
okayBtn.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event){
cloudSync = true;
//TODO rework for other cloud services
cloudService = "GoogleDrive";
main.cloudController.initializeConnection(getCloudService(), getCemuPath());
main.cloudController.sync(getCloudService(), getCemuPath());
saveSettings();
dialog.close();
}
});
JFXButton cancelBtn = new JFXButton("Cancel");
cancelBtn.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event){
cloudSyncToggleBtn.setSelected(false);
dialog.close();
}
});
Label placeholder = new Label();
placeholder.setPrefSize(15, 10);
okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
okayBtn.setPrefHeight(32);
cancelBtn.setPrefHeight(32);
okayBtn.setStyle(dialogBtnStyle);
cancelBtn.setStyle(dialogBtnStyle);
content.setActions(cancelBtn, placeholder, okayBtn);
content.setPrefSize(419, 140);
main.pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (main.pane.getHeight()-content.getPrefHeight())/2);
AnchorPane.setLeftAnchor(stackPane, (main.pane.getWidth()-content.getPrefWidth())/2);
dialog.show();
String headingText = "activate cloud savegame sync (beta)";
String bodyText = "You just activate the cloud savegame sync function of cemu_UI, "
+ "\nwhich is currently in beta. Are you sure you want to do this?";
EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event){
cloudSync = true;
//TODO rework for other cloud services
cloudService = "GoogleDrive";
if (main.cloudController.initializeConnection(getCloudService(), getCemuPath())) {
main.cloudController.sync(getCloudService(), getCemuPath());
saveSettings();
} else {
cloudSyncToggleBtn.setSelected(false);
//cloud sync init error dialog
String headingText = "Error while initializing cloud sync!";
String bodyText = "There was some truble adding your game."
+ "\nPlease upload the app.log (which can be found in the cemu_UI directory)"
+ "\nto \"https://github.com/Seil0/cemu_UI/issues\" so we can fix this.";
JFXInfoDialog cloudSyncErrorDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 450, 170, main.pane);
cloudSyncErrorDialog.show();
}
}
};
EventHandler<ActionEvent> cancelAction = new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event){
cloudSyncToggleBtn.setSelected(false);
}
};
JFXOkayCancelDialog cloudSyncErrorDialog = new JFXOkayCancelDialog(headingText, bodyText, dialogBtnStyle,
419, 140, okayAction, cancelAction, main.pane);
cloudSyncErrorDialog.show();
}
}
@ -859,106 +1005,142 @@ public class MainWindowController {
@FXML
void addBtnAction(ActionEvent event){
boolean exit = false;
String romPath = null;
String coverPath = null;
String coverName = null;
String title = null;
String titleID = null;
File pictureCache;
TextInputDialog titleDialog = new TextInputDialog();
titleDialog.setTitle("cemu_UI");
titleDialog.setHeaderText("add new Game");
titleDialog.setContentText("Please enter the name of the game you want to add:");
titleDialog.initOwner(main.primaryStage);
Optional<String> titleResult = titleDialog.showAndWait();
if (titleResult.isPresent()){
title = titleResult.get();
}else{
exit = true;
}
//new Dialog
Dialog<Integer> dialog = new Dialog<>();
dialog.setTitle("add a new game");
dialog.setHeaderText("add a new game manually to cemu UI");
// Set the button types.
ButtonType okayBtn = new ButtonType("Okay", ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(okayBtn, ButtonType.CANCEL);
// Create gameTitle, titleID, gamePath and gameCover TextFields and Labels and two Btn for filechooser
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
TextField gameTitleTF = new TextField();
gameTitleTF.setPromptText("game tile");
TextField titleIDTF = new TextField();
titleIDTF.setPromptText("title ID");
TextField romPathTF = new TextField();
romPathTF.setPromptText("ROM path");
TextField gameCoverTF = new TextField();
gameCoverTF.setPromptText("cover path");
if(exit == false){
TextInputDialog titleIDDialog = new TextInputDialog();
titleIDDialog.setTitle("cemu_UI");
titleIDDialog.setHeaderText("add new Game");
titleIDDialog.setContentText("Please enter the title-ID (12345678-12345678) \nof the game you want to add:");
titleIDDialog.initOwner(main.primaryStage);
Optional<String> titleIDResult = titleIDDialog.showAndWait();
if (titleIDResult.isPresent()){
titleID = titleIDResult.get();
}else{
exit = true;
}
Button selectPathBtn = new Button("select .rpx file");
Button selectCoverBtn = new Button("select cover file");
selectPathBtn.setPrefWidth(110);
selectCoverBtn.setPrefWidth(110);
selectPathBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
FileChooser romDirectoryChooser = new FileChooser();
File romDirectory = romDirectoryChooser.showOpenDialog(main.primaryStage);
romPathTF.setText(romDirectory.getAbsolutePath());
}
});
selectCoverBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
FileChooser coverDirectoryChooser = new FileChooser();
File coverDirectory = coverDirectoryChooser.showOpenDialog(main.primaryStage);
gameCoverTF.setText(coverDirectory.getAbsolutePath());
}
});
grid.add(new Label("game title:"), 0, 0);
grid.add(gameTitleTF, 1, 0);
grid.add(new Label("title id:"), 0, 1);
grid.add(titleIDTF, 1, 1);
grid.add(new Label("ROM path:"), 0, 2);
grid.add(romPathTF, 1, 2);
grid.add(selectPathBtn, 2, 2);
grid.add(new Label("cover path:"), 0, 3);
grid.add(gameCoverTF, 1, 3);
grid.add(selectCoverBtn, 2, 3);
dialog.getDialogPane().setContent(grid);
Optional<Integer> result2 = dialog.showAndWait();
if (result2.isPresent()){
romPath = romPathTF.getText();
coverPath = gameCoverTF.getText();
title = gameTitleTF.getText();
titleID = titleIDTF.getText();
LOGGER.info("New game data \"" + title + "\", title-ID: " + titleID + "(not a bug!)");
}
if(exit == false){
Alert romAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
romAlert.setTitle("cemu_UI");
romAlert.setHeaderText("add new Game");
romAlert.setContentText("Please select the .rpx file from the game you want to add.");
romAlert.initOwner(main.primaryStage);
Optional<ButtonType> result = romAlert.showAndWait();
if (result.get() == ButtonType.OK){
FileChooser directoryChooser = new FileChooser();
File selectedDirectory = directoryChooser.showOpenDialog(main.primaryStage);
romPath = selectedDirectory.getAbsolutePath();
} else {
exit = true;
}
}
if(exit == false){
Alert coverAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
coverAlert.setTitle("cemu_UI");
coverAlert.setHeaderText("add new Game");
coverAlert.setContentText("Please select the cover for the game you want to add.");
coverAlert.initOwner(main.primaryStage);
Optional<ButtonType> coverResult = coverAlert.showAndWait();
if (coverResult.get() == ButtonType.OK){
FileChooser directoryChooser = new FileChooser();
File selectedDirectory = directoryChooser.showOpenDialog(main.primaryStage);
coverPath = selectedDirectory.getAbsolutePath();
} else {
exit = true;
}
}
/**
* if exit == true then don't add a rom
* else convert the cover to .png add copy it into the picture cache
* if one parameter dosen't contain any value do not add the game
* else convert the cover to .png add copy it into the picture cache,
* then add the rom to the local_roms database
*/
if(exit){
System.out.println(romPath.length());
if (romPath.length() == 0 || coverPath.length() == 0 || title.length() == 0 || titleID.length() == 0) {
LOGGER.info("No parameter set!");
}else{
//addGame error dialog
JFXDialogLayout content= new JFXDialogLayout();
content.setHeading(new Text("Error while adding a new Game!"));
content.setBody(new Text("There was some truble adding your game."
+ "\nOne of the needed values was empty, please try again to add your game."));
content.setPrefSize(450, 170);
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog errorDialog =new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton button=new JFXButton("Okay");
button.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event){
errorDialog.close();
}
});
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
button.setPrefHeight(32);
button.setStyle(dialogBtnStyle);
content.setActions(button);
main.pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (main.pane.getHeight()-content.getPrefHeight())/2);
AnchorPane.setLeftAnchor(stackPane, (main.pane.getWidth()-content.getPrefWidth())/2);
errorDialog.show();
} else {
coverName = new File(coverPath).getName();
try {
if(System.getProperty("os.name").equals("Linux")){
pictureCache = pictureCacheLinux;
}else{
pictureCache = pictureCacheWin;
if (System.getProperty("os.name").equals("Linux")) {
pictureCache = getPictureCacheLinux();
} else {
pictureCache = getPictureCacheWin();
}
BufferedImage originalImage = ImageIO.read(new File(coverPath));//load cover
BufferedImage originalImage = ImageIO.read(new File(coverPath)); //load cover
int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType();
BufferedImage resizeImagePNG = resizeImage(originalImage, type, 400, 600);
ImageIO.write(resizeImagePNG, "png", new File(pictureCache+"\\"+coverName)); //save image to pictureCache
coverPath = pictureCache+"\\"+coverName;
} catch (IOException e) {
LOGGER.error("Ops something went wrong!", e);
LOGGER.error("Ops something went wrong! Error while resizing cover.", e);
}
try {
dbController.addRom(title, coverPath, romPath, titleID, "", "", "", "0");
dbController.loadSingleRom(titleID);
refreshUIData();
} catch (SQLException e) {
LOGGER.error("Oops, something went wrong! Error during adding a game.", e);
LOGGER.error("Oops, something went wrong! Error while adding a game.", e);
}
}
}
@ -970,7 +1152,7 @@ public class MainWindowController {
* @param romPath : path to ROM file (.rpx)
* @param titleID : ROM ID
*/
void addGame(String title, String coverPath, String romPath, String titleID){
public void addGame(String title, String coverPath, String romPath, String titleID){
VBox VBox = new VBox();
Label gameTitleLabel = new Label();
JFXButton gameBtn = new JFXButton();
@ -1049,6 +1231,9 @@ public class MainWindowController {
}
if (menuTrue) {
sideMenuSlideOut();
burgerTask.setRate(-1.0);
burgerTask.play();
menuTrue = false;
}
}
@ -1089,9 +1274,32 @@ public class MainWindowController {
}
void refreshplayBtnPosition() {
playBtn.setLayoutX((main.pane.getWidth()/2)-50);
totalPlaytimeBtn.setLayoutX((main.pane.getWidth()/2)-50-20.5-100);
lastTimePlayedBtn.setLayoutX((main.pane.getWidth()/2)+50+20.5);
double width;
if (mainAnchorPane.getWidth() < 10) {
width = mainAnchorPane.getPrefWidth();
} else {
width = mainAnchorPane.getWidth();
}
playBtn.setLayoutX((width/2)-50);
totalPlaytimeBtn.setLayoutX((width/2)-50-20.5-100);
lastTimePlayedBtn.setLayoutX((width/2)+50+20.5);
}
void checkAutoUpdate() {
if(isAutoUpdate()){
try {
LOGGER.info("AutoUpdate: looking for updates on startup ...");
updateController = new UpdateController(this, buildNumber, useBeta);
Thread updateThread = new Thread(updateController);
updateThread.setName("Updater");
updateThread.start();
updateThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void addCourseDescription(SmmdbApiDataType course) {
@ -1221,8 +1429,9 @@ public class MainWindowController {
private void generatePosition() {
int xPosHelperMax;
//FIXME somehow the window width is set to 8, if we can find a way to get always the real window with
//(at the beginning we have to use prefWidth after resizing Width) we can remove this
/**FIXME somehow the window width is set to 8, if we can find a way to get always the real window with
*(at the beginning we have to use prefWidth after resizing Width) we can remove this
*/
if (mainAnchorPane.getWidth() < 10) {
xPosHelperMax = (int) Math.floor((mainAnchorPane.getPrefWidth() - 36) / 217);
} else {
@ -1239,8 +1448,8 @@ public class MainWindowController {
xPosHelper++;
}
System.out.println("Breit: " + mainAnchorPane.getPrefWidth());
System.out.println("Breit2: " + mainAnchorPane.getWidth());
// System.out.println("Breit: " + main.pane.getWidth());
// System.out.println("Breit2: " + mainAnchorPane.getWidth());
// System.out.println("xPosHelper: " + xPosHelper);
// System.out.println("yPos: " + yPos);
// System.out.println("xPos: " + xPos);
@ -1269,9 +1478,10 @@ public class MainWindowController {
playBtn.setStyle("-fx-text-fill: WHITE; -fx-font-family: Roboto Medium;");
cemuTFBtn.setStyle(btnStyleWhite);
romTFBtn.setStyle(btnStyleWhite);
updateBtn.setStyle(btnStyleWhite);
smmdbDownloadBtn.setStyle(btnStyleWhite);
playBtn.setStyle(btnStyleWhite);
aboutBtn.setGraphic(info_white);
settingsBtn.setGraphic(settings_white);
addBtn.setGraphic(add_circle_white);
@ -1290,6 +1500,7 @@ public class MainWindowController {
playBtn.setStyle("-fx-text-fill: BLACK; -fx-font-family: Roboto Medium;");
cemuTFBtn.setStyle(btnStyleBlack);
romTFBtn.setStyle(btnStyleBlack);
updateBtn.setStyle(btnStyleBlack);
smmdbDownloadBtn.setStyle(btnStyleBlack);
playBtn.setStyle(btnStyleBlack);
@ -1307,7 +1518,7 @@ public class MainWindowController {
}
}
void saveSettings(){
public void saveSettings(){
LOGGER.info("saving Settings ...");
OutputStream outputStream; //new output-stream
try {
@ -1315,7 +1526,9 @@ public class MainWindowController {
props.setProperty("romPath", getRomPath());
props.setProperty("color", getColor());
props.setProperty("fullscreen", String.valueOf(isFullscreen()));
props.setProperty("cloudSync", String.valueOf(cloudSync));
props.setProperty("cloudSync", String.valueOf(isCloudSync()));
props.setProperty("autoUpdate", String.valueOf(isAutoUpdate()));
props.setProperty("useBeta", String.valueOf(isUseBeta()));
if (getCloudService() == null) {
props.setProperty("cloudService", "");
} else {
@ -1387,6 +1600,20 @@ public class MainWindowController {
setCloudSync(false);
}
try {
setAutoUpdate(Boolean.parseBoolean(props.getProperty("autoUpdate")));
} catch (Exception e) {
LOGGER.error("cloud not load autoUpdate", e);
setAutoUpdate(false);
}
try {
setUseBeta(Boolean.parseBoolean(props.getProperty("useBeta")));
} catch (Exception e) {
LOGGER.error("cloud not load autoUpdate", e);
setUseBeta(false);
}
try {
setCloudService(props.getProperty("cloudService"));
} catch (Exception e) {
@ -1557,6 +1784,22 @@ public class MainWindowController {
this.color = color;
}
public File getPictureCacheLinux() {
return pictureCacheLinux;
}
public void setPictureCacheLinux(File pictureCacheLinux) {
this.pictureCacheLinux = pictureCacheLinux;
}
public File getPictureCacheWin() {
return pictureCacheWin;
}
public void setPictureCacheWin(File pictureCacheWin) {
this.pictureCacheWin = pictureCacheWin;
}
public int getxPos() {
return xPos;
}
@ -1597,6 +1840,22 @@ public class MainWindowController {
this.cloudSync = cloudSync;
}
public boolean isAutoUpdate() {
return autoUpdate;
}
public void setAutoUpdate(boolean autoUpdate) {
this.autoUpdate = autoUpdate;
}
public boolean isUseBeta() {
return useBeta;
}
public void setUseBeta(boolean useBeta) {
this.useBeta = useBeta;
}
public String getGameExecutePath() {
return gameExecutePath;
}
@ -1657,4 +1916,8 @@ public class MainWindowController {
return mainAnchorPane;
}
public JFXButton getUpdateBtn() {
return updateBtn;
}
}

View File

@ -19,13 +19,15 @@
* MA 02110-1301, USA.
*/
package application;
package com.cemu_UI.application;
import java.io.IOException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.cemu_UI.controller.dbController;
import javafx.application.Platform;
public class playGame extends Thread{
@ -34,7 +36,7 @@ public class playGame extends Thread{
dbController dbController;
private static final Logger LOGGER = LogManager.getLogger(playGame.class.getName());
public playGame(MainWindowController m, dbController db){
public playGame(MainWindowController m, com.cemu_UI.controller.dbController db){
mainWindowController = m;
dbController = db;
}

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA.
*/
package application;
package com.cemu_UI.controller;
import java.io.File;
import java.io.IOException;
@ -27,52 +27,60 @@ import java.io.IOException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import cloudControllerInstances.GoogleDriveController;
import com.cemu_UI.application.MainWindowController;
import com.cemu_UI.vendorCloudController.GoogleDriveController;
import javafx.application.Platform;
public class CloudController {
public CloudController(Main ma) {
main = ma;
public CloudController(MainWindowController mwc) {
this.mwc = mwc;
}
private Main main;
private MainWindowController mwc;
private GoogleDriveController googleDriveController = new GoogleDriveController();
private static final Logger LOGGER = LogManager.getLogger(CloudController.class.getName());
void initializeConnection(String cloudService, String cemuDirectory) {
public boolean initializeConnection(String cloudService, String cemuDirectory) {
boolean success = false;
LOGGER.info("sartting cloud initialisation ...");
if(cloudService.equals("GoogleDrive")) {
LOGGER.info("selected service is Google Drive");
try {
googleDriveController.main(cemuDirectory);
} catch (IOException e) {
LOGGER.error("error while initialize connection", e);
return success;
}
success = true;
}
if(cloudService.equals("Dropbox")) {
LOGGER.info("selected service is Dropbox");
}
LOGGER.info("cloud initialisation done!");
return success;
}
void stratupCheck(String cloudService, String cemuDirectory) {
public void stratupCheck(String cloudService, String cemuDirectory) {
if(cloudService.equals("GoogleDrive")) {
LOGGER.info("starting startup check google drive ...");
try {
if (!googleDriveController.checkFolder()) {
googleDriveController.creatFolder();
main.mainWindowController.saveSettings();
mwc.saveSettings();
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
Platform.runLater(() -> {
main.mainWindowController.getPlayBtn().setText("syncing...");
mwc.getPlayBtn().setText("syncing...");
});
googleDriveController.uploadAllFiles();
Platform.runLater(() -> {
main.mainWindowController.getPlayBtn().setText("play");
mwc.getPlayBtn().setText("play");
});
}
});
@ -91,14 +99,14 @@ public class CloudController {
void sync(String cloudService, String cemuDirectory) {
public void sync(String cloudService, String cemuDirectory) {
//running sync in a new thread, instead of blocking the main thread
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
Platform.runLater(() -> {
main.mainWindowController.getPlayBtn().setText("syncing...");
mwc.getPlayBtn().setText("syncing...");
});
LOGGER.info("starting synchronization in new thread ...");
@ -113,9 +121,9 @@ public class CloudController {
}
Platform.runLater(() -> {
main.mainWindowController.getPlayBtn().setText("play");
mwc.getPlayBtn().setText("play");
});
main.mainWindowController.saveSettings();
mwc.saveSettings();
LOGGER.info("synchronization successful!");
}
});

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA.
*/
package application;
package com.cemu_UI.controller;
import java.io.BufferedReader;
import java.io.IOException;
@ -30,18 +30,17 @@ import java.util.ArrayList;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.cemu_UI.datatypes.SmmdbApiDataType;
import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonValue;
import datatypes.SmmdbApiDataType;
public class SmmdbApiQuery {
public class SmmdbAPIController {
private String URL = "http://smmdb.ddns.net/api/getcourses?format=json";
private static final Logger LOGGER = LogManager.getLogger(SmmdbApiQuery.class.getName());
private String URL = "https://smmdb.ddns.net/api/getcourses?format=json";
private static final Logger LOGGER = LogManager.getLogger(SmmdbAPIController.class.getName());
public SmmdbApiQuery() {
public SmmdbAPIController() {
//Auto-generated constructor stub
}

View File

@ -0,0 +1,158 @@
/**
* cemu_UI
*
* Copyright 2017 <@Seil0>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package com.cemu_UI.controller;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.swing.ProgressMonitor;
import javax.swing.ProgressMonitorInputStream;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.cemu_UI.application.MainWindowController;
import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
import javafx.application.Platform;
public class UpdateController implements Runnable{
private MainWindowController mainWindowController;
private String buildNumber;
private String apiOutput;
private String updateBuildNumber; //tag_name from Github
private String browserDownloadUrl; //update download link
private String githubApiRelease = "https://api.github.com/repos/Seil0/cemu_UI/releases/latest";
private String githubApiBeta = "https://api.github.com/repos/Seil0/cemu_UI/releases";
private URL githubApiUrl;
private boolean useBeta;
private static final Logger LOGGER = LogManager.getLogger(UpdateController.class.getName());
/**
* updater for cemu_UI based on Project HomeFlix
* checks for Updates and download it in case there is one
*/
public UpdateController(MainWindowController mwc, String buildNumber, boolean useBeta){
mainWindowController = mwc;
this.buildNumber = buildNumber;
this.useBeta = useBeta;
}
public void run(){
System.out.println("checking for updates ...");
Platform.runLater(() -> {
mainWindowController.getUpdateBtn().setText("checking for updates ...");
});
try {
if (useBeta) {
githubApiUrl = new URL(githubApiBeta);
} else {
githubApiUrl = new URL(githubApiRelease);
}
// URL githubApiUrl = new URL(githubApiRelease);
BufferedReader ina = new BufferedReader(new InputStreamReader(githubApiUrl.openStream()));
apiOutput = ina.readLine();
ina.close();
} catch (IOException e) {
Platform.runLater(() -> {
LOGGER.error("could not check update version", e);
});
}
if (useBeta) {
JsonArray objectArray = Json.parse("{\"items\": " + apiOutput + "}").asObject().get("items").asArray();
JsonValue object = objectArray.get(0);
JsonArray objectAssets = object.asObject().get("assets").asArray();
updateBuildNumber = object.asObject().getString("tag_name", "");
// updateName = object.asObject().getString("name", "");
// updateChanges = object.asObject().getString("body", "");
for (JsonValue asset : objectAssets) {
browserDownloadUrl = asset.asObject().getString("browser_download_url", "");
}
} else {
JsonObject object = Json.parse(apiOutput).asObject();
JsonArray objectAssets = Json.parse(apiOutput).asObject().get("assets").asArray();
updateBuildNumber = object.getString("tag_name", "");
// updateName = object.getString("name", "");
// updateChanges = object.getString("body", "");
for (JsonValue asset : objectAssets) {
browserDownloadUrl = asset.asObject().getString("browser_download_url", "");
}
}
LOGGER.info("Build: "+buildNumber+", Update: "+updateBuildNumber);
//Compares the program BuildNumber with the current BuildNumber if program BuildNumber < current BuildNumber then perform a update
int iversion = Integer.parseInt(buildNumber);
int iaktVersion = Integer.parseInt(updateBuildNumber.replace(".", ""));
if(iversion >= iaktVersion){
Platform.runLater(() -> {
mainWindowController.getUpdateBtn().setText("no update available");
});
LOGGER.info("no update available");
}else{
Platform.runLater(() -> {
mainWindowController.getUpdateBtn().setText("update available");
});
LOGGER.info("update available");
LOGGER.info("download link: " + browserDownloadUrl);
try {
//open new Http connection, ProgressMonitorInputStream for downloading the data
HttpURLConnection conn = (HttpURLConnection) new URL(browserDownloadUrl).openConnection();
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, "Downloading...", conn.getInputStream());
ProgressMonitor pm = pmis.getProgressMonitor();
pm.setMillisToDecideToPopup(0);
pm.setMillisToPopup(0);
pm.setMinimum(0);// tell the progress bar that we start at the beginning of the stream
pm.setMaximum(conn.getContentLength());// tell the progress bar the total number of bytes we are going to read.
FileUtils.copyInputStreamToFile(pmis, new File("cemu_UI_update.jar")); //download update
org.apache.commons.io.FileUtils.copyFile(new File("cemu_UI_update.jar"), new File("cemu_UI.jar")); //TODO rename update to old name
org.apache.commons.io.FileUtils.deleteQuietly(new File("cemu_UI_update.jar")); //delete update
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again
System.exit(0); //finishes itself
} catch (IOException e) {
Platform.runLater(() -> {
LOGGER.info("could not download update files", e);
});
}
}
}
}

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA.
*/
package application;
package com.cemu_UI.controller;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
@ -45,6 +45,8 @@ import org.apache.logging.log4j.Logger;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import com.cemu_UI.application.MainWindowController;
public class dbController {
public dbController(MainWindowController m) {
@ -134,15 +136,16 @@ public class dbController {
}
}
void addRom(String title, String coverPath, String romPath, String titleID, String productCode, String region, String lastPlayed, String timePlayed) throws SQLException{
public void addRom(String title, String coverPath, String romPath, String titleID, String productCode, String region, String lastPlayed, String timePlayed) throws SQLException{
Statement stmt = connection.createStatement();
stmt.executeUpdate("insert into local_roms values ('"+title+"','"+coverPath+"','"+romPath+"','"+titleID+"','"+productCode+"','"+region+"','"+lastPlayed+"','"+timePlayed+"')");
stmt.executeUpdate("insert into local_roms values ('"+title+"','"+coverPath+"','"+romPath+"','"+titleID+"',"
+ "'"+productCode+"','"+region+"','"+lastPlayed+"','"+timePlayed+"')");
connection.commit();
stmt.close();
LOGGER.info("added \""+title+"\" to ROM database");
}
void removeRom(String titleID) throws SQLException{
public void removeRom(String titleID) throws SQLException{
Statement stmt = connection.createStatement();
stmt.executeUpdate("delete from local_roms where titleID = '"+titleID+"'");
connection.commit();
@ -167,7 +170,7 @@ public class dbController {
}
//load one single ROM after manual adding into the mainWindowController
void loadSingleRom(String titleID){
public void loadSingleRom(String titleID){
LOGGER.info("loading a single ROM (ID: "+titleID+") into the mainWindowController ...");
try {
Statement stmt = connection.createStatement();
@ -183,7 +186,7 @@ public class dbController {
}
//get all files with .rpx TODO add other formats
void loadRomDirectory(String directory){
public void loadRomDirectory(String directory){
File dir = new File(directory);
File appFile;
String[] extensions = new String[] { "rpx", "jsp" };
@ -191,15 +194,15 @@ public class dbController {
String coverPath;
if(System.getProperty("os.name").equals("Linux")){
pictureCache = mainWindowController.pictureCacheLinux;
pictureCache = mainWindowController.getPictureCacheLinux();
}else{
pictureCache = mainWindowController.pictureCacheWin;
pictureCache = mainWindowController.getPictureCacheWin();
}
try {
Statement stmt = connectionGames.createStatement();
LOGGER.info("Getting all .rpx files in " + dir.getCanonicalPath()+" including those in subdirectories");
Statement stmt = connectionGames.createStatement();
List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true);
LOGGER.info("Getting all .rpx files in " + dir.getCanonicalPath()+" including those in subdirectories");
for (File file : files) {
if(System.getProperty("os.name").equals("Linux")){
appFile = new File(file.getParent()+"/app.xml");
@ -266,7 +269,45 @@ public class dbController {
return resizedImage;
}
void setLastPlayed(String titleID){
/**
* getting info for a game with titleID
* @param titleID Title-ID of the Game
* @return title, coverPath, romPath, titleID (in this order)
*/
public String[] getGameInfo(String titleID){
String[] gameInfo = new String[4];
LOGGER.info("getting game info for titleID: "+titleID+" ...");
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM local_roms where titleID = '"+titleID+"'");
while (rs.next()) {
gameInfo[0] = rs.getString(1);// title
gameInfo[1] = rs.getString(2);// coverPath
gameInfo[2] = rs.getString(3);// romPath
gameInfo[3] = rs.getString(4);// titleID
}
stmt.close();
rs.close();
}catch (Exception e){
LOGGER.error("error while getting game info", e);
}
return gameInfo;
}
public void setGameInfo(String title, String titleID, String romPath, String coverPath){
LOGGER.info("setting game info for titleID: "+titleID+" ...");
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE local_roms SET title = '" + title + "', coverPath = '" + coverPath + "',"
+ " romPath = '" + romPath + "' WHERE titleID = '"+titleID+"';");
connection.commit();
stmt.close();
}catch (Exception e){
LOGGER.error("error while setting game info", e);
}
}
public void setLastPlayed(String titleID){
try{
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE local_roms SET lastPlayed=date('now') WHERE titleID = '"+titleID+"';");
@ -277,7 +318,7 @@ public class dbController {
}
}
String getLastPlayed(String titleID){
public String getLastPlayed(String titleID){
String lastPlayed = null;
try{
Statement stmt = connection.createStatement();
@ -291,7 +332,7 @@ public class dbController {
return lastPlayed;
}
void setTotalPlaytime(String timePlayed, String titleID){
public void setTotalPlaytime(String timePlayed, String titleID){
try{
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE local_roms SET timePlayed='"+timePlayed+"' WHERE titleID = '"+titleID+"';");
@ -303,7 +344,7 @@ public class dbController {
}
}
String getTotalPlaytime(String titleID){
public String getTotalPlaytime(String titleID){
String timePlayed = null;
try{
Statement stmt = connection.createStatement();
@ -317,5 +358,5 @@ public class dbController {
return timePlayed;
}
}

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA.
*/
package datatypes;
package com.cemu_UI.datatypes;
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject;

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA.
*/
package datatypes;
package com.cemu_UI.datatypes;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA.
*/
package datatypes;
package com.cemu_UI.datatypes;
import com.jfoenix.controls.JFXButton;

View File

@ -0,0 +1,86 @@
/**
* cemu_UI
*
* Copyright 2017 <@Seil0>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package com.cemu_UI.uiElements;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXDialog;
import com.jfoenix.controls.JFXDialogLayout;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Text;
public class JFXInfoDialog {
private String headingText;
private String bodyText;
private String dialogBtnStyle;
private int dialogWidth;
private int dialogHeight;
private Pane pane;
/**
* Creates a new JFoenix Dialog to show some information
* @param headingText Heading Text, just the heading
* @param bodyText body Text, all other text belongs here
* @param dialogBtnStyle Style of the okay button
* @param dialogWidth dialog width
* @param dialogHeight dialog height
* @param pane pane to which the dialog belongs
*/
public JFXInfoDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth, int dialogHeight, Pane pane) {
this.headingText = headingText;
this.bodyText = bodyText;
this.dialogBtnStyle = dialogBtnStyle;
this.dialogWidth = dialogWidth;
this.dialogHeight = dialogHeight;
this.pane = pane;
}
public void show() {
JFXDialogLayout content = new JFXDialogLayout();
content.setHeading(new Text(headingText));
content.setBody(new Text(bodyText));
content.setPrefSize(dialogWidth, dialogHeight);
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton button = new JFXButton("Okay");
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
dialog.close();
}
});
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
button.setPrefHeight(32);
button.setStyle(dialogBtnStyle);
content.setActions(button);
pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2);
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
dialog.show();
}
}

View File

@ -0,0 +1,105 @@
/**
* cemu_UI
*
* Copyright 2017 <@Seil0>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package com.cemu_UI.uiElements;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXDialog;
import com.jfoenix.controls.JFXDialogLayout;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Text;
public class JFXOkayCancelDialog {
private String headingText;
private String bodyText;
private String dialogBtnStyle;
private int dialogWidth;
private int dialogHeight;
private EventHandler<ActionEvent> okayAction;
private EventHandler<ActionEvent> cancelAction;
private Pane pane;
/**
* Creates a new JFoenix Dialog to show some information with okay and cancel option
* @param headingText Heading Text, just the heading
* @param bodyText body Text, all other text belongs here
* @param dialogBtnStyle Style of the okay button
* @param dialogWidth dialog width
* @param dialogHeight dialog height
* @param okayAction action which is performed if the okay button is clicked
* @param cancelAction action which is performed if the cancel button is clicked
* @param pane pane to which the dialog belongs
*/
public JFXOkayCancelDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth,
int dialogHeight, EventHandler<ActionEvent> okayAction, EventHandler<ActionEvent> cancelAction, Pane pane) {
this.headingText = headingText;
this.bodyText = bodyText;
this.dialogBtnStyle = dialogBtnStyle;
this.dialogWidth = dialogWidth;
this.dialogHeight = dialogHeight;
this.okayAction = okayAction;
this.cancelAction = cancelAction;
this.pane = pane;
}
public void show() {
JFXDialogLayout content= new JFXDialogLayout();
content.setHeading(new Text(headingText));
content.setBody(new Text(bodyText));
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton okayBtn = new JFXButton("Okay");
okayBtn.addEventHandler(ActionEvent.ACTION, okayAction);
okayBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
dialog.close();
});
okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
okayBtn.setPrefHeight(32);
okayBtn.setStyle(dialogBtnStyle);
JFXButton cancelBtn = new JFXButton("Cancel");
cancelBtn.addEventHandler(ActionEvent.ACTION, cancelAction);
cancelBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
dialog.close();
});
cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
cancelBtn.setPrefHeight(32);
cancelBtn.setStyle(dialogBtnStyle);
Label placeholder = new Label();
placeholder.setPrefSize(15, 10);
content.setActions(cancelBtn, placeholder, okayBtn);
content.setPrefSize(dialogWidth, dialogHeight);
pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (pane.getHeight()-content.getPrefHeight())/2);
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth()-content.getPrefWidth())/2);
dialog.show();
}
}

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA.
*/
package cloudControllerInstances;
package com.cemu_UI.vendorCloudController;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@ -56,7 +56,7 @@ import com.google.api.services.drive.model.FileList;
public class GoogleDriveController {
Drive service;
private String cemuDirectory;
private String saveDirectory;
private String folderID;
private ArrayList<java.io.File> localSavegames = new ArrayList<>();
private ArrayList<File> cloudSavegames = new ArrayList<>();
@ -64,7 +64,7 @@ public class GoogleDriveController {
private ArrayList<String> cloudSavegamesName = new ArrayList<>();
private static final Logger LOGGER = LogManager.getLogger(GoogleDriveController.class.getName());
private final String APPLICATION_NAME ="cemu_Ui Drive API Controller";
private final String APPLICATION_NAME ="cemu_Ui Drive API Controller"; //TODO add Google
//Directory to store user credentials for this application
private final java.io.File DATA_STORE_DIR = new java.io.File(System.getProperty("user.home"), ".credentials/cemu_UI_credential");
@ -101,13 +101,13 @@ public class GoogleDriveController {
*/
public Credential authorize() throws IOException {
// Load client secrets.
InputStream in = getClass().getClassLoader().getResourceAsStream("resources/client_secret.json");
InputStream in = getClass().getClassLoader().getResourceAsStream("client_secret.json");
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
//FIXME Linux fails to open a new browser window, application crashes, maybe a kde only bug
// Build flow and trigger user authorization request.
GoogleAuthorizationCodeFlow flow =
new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
.setDataStoreFactory(DATA_STORE_FACTORY)
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
.setDataStoreFactory(DATA_STORE_FACTORY)
.setAccessType("offline")
.build();
Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
@ -129,8 +129,18 @@ public class GoogleDriveController {
public void main(String cemuDirectory) throws IOException {
java.io.File dir = new java.io.File(cemuDirectory + "/mlc01/usr/save");
service = getDriveService();
this.cemuDirectory = cemuDirectory;
// cemu >= 1.11 uses /mlc01/usr/save/... instead of /mlc01/emulatorSave/...
if (dir.exists()) {
LOGGER.info("using new save path");
saveDirectory = cemuDirectory + "/mlc01/usr/save";
} else {
LOGGER.info("using old save path");
saveDirectory = cemuDirectory + "/mlc01/emulatorSave";
}
}
public void sync(String cemuDirectory) throws IOException {
@ -209,7 +219,7 @@ public class GoogleDriveController {
//reading all local savegames
private void getLocalSavegames() throws IOException {
java.io.File dir = new java.io.File(cemuDirectory+"/mlc01/emulatorSave");
java.io.File dir = new java.io.File(saveDirectory);
String[] extensions = new String[] { "dat","sav","bin" };
localSavegames.removeAll(localSavegames);
localSavegamesName.removeAll(localSavegamesName);
@ -263,17 +273,17 @@ public class GoogleDriveController {
//download a file from the cloud to the local savegames folder
private void downloadFile(File downloadFile) throws IOException{
LOGGER.info("downloading "+downloadFile.getName()+" ...");
java.io.File directory = new java.io.File(cemuDirectory+"/mlc01/emulatorSave/"+ downloadFile.getName().substring(0,8));
String file = downloadFile.getName().substring(9,downloadFile.getName().length());
if(!directory.exists()) {
LOGGER.info("dir dosent exist");
directory.mkdir();
}
java.io.File directory = new java.io.File(saveDirectory + "/" + downloadFile.getName().substring(0,8));
String file = downloadFile.getName().substring(9,downloadFile.getName().length());
if(!directory.exists()) {
LOGGER.info("dir dosent exist");
directory.mkdir();
}
OutputStream outputStream = new FileOutputStream(directory +"/"+ file);
service.files().get(downloadFile.getId()).executeMediaAndDownloadTo(outputStream);
outputStream.close();
LOGGER.info("download successfull, File ID: " + file); //TODO add FileID
OutputStream outputStream = new FileOutputStream(directory +"/"+ file);
service.files().get(downloadFile.getId()).executeMediaAndDownloadTo(outputStream);
outputStream.close();
LOGGER.info("download successfull, File ID: " + file); //TODO add FileID
}
//update a file in the cloud, by deleting the old one and uploading an new with the same id

View File

@ -7,6 +7,7 @@
<?import com.jfoenix.controls.JFXToggleButton?>
<?import com.jfoenix.controls.JFXTreeTableView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.image.ImageView?>
@ -16,9 +17,9 @@
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.TextFlow?>
<AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="904.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
<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">
<children>
<ScrollPane fx:id="scrollPaneMain" 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>
<AnchorPane fx:id="gamesAnchorPane">
<padding>
@ -28,7 +29,7 @@
</ScrollPane>
<HBox fx:id="topHBox" prefHeight="38.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<JFXHamburger fx:id="menuHam" prefHeight="38.0" prefWidth="38.0" stylesheets="@MainWindows.css" />
<JFXHamburger fx:id="menuHam" prefHeight="38.0" prefWidth="38.0" stylesheets="@../css/MainWindows.css" />
</children>
</HBox>
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="568.0" prefWidth="175.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="38.0">
@ -60,31 +61,40 @@
</JFXButton>
</children>
</VBox>
<!-- space between settings sections 35px, between sections elements (label + element) 20px, between label and element 3px(or more) -->
<AnchorPane fx:id="settingsAnchorPane" layoutX="38.0" layoutY="27.0" style="-fx-background-color: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="175.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<children>
<Label layoutX="22.0" layoutY="59.0" text="Cemu Directory" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="59.0" />
<JFXTextField fx:id="cemuTextField" layoutX="18.0" layoutY="83.0" maxWidth="305.0" minWidth="305.0" onAction="#cemuTextFieldAction" prefHeight="32.0" prefWidth="305.0" promptText="cemu directory" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="79.0" />
<JFXTextField fx:id="romTextField" layoutX="18.0" layoutY="159.0" maxWidth="305.0" minWidth="305.0" onAction="#romTextFieldAction" prefHeight="32.0" prefWidth="305.0" promptText="rom directory" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="151.0" />
<JFXButton fx:id="romTFBtn" layoutX="337.0" layoutY="159.0" onAction="#romTFBtnAction" prefHeight="32.0" prefWidth="108.0" text="choose directory" AnchorPane.leftAnchor="333.0" AnchorPane.topAnchor="151.0" />
<JFXButton fx:id="cemuTFBtn" layoutX="333.0" layoutY="79.0" onAction="#cemuTFBtnAction" prefHeight="32.0" prefWidth="108.0" text="choose directory" AnchorPane.leftAnchor="333.0" AnchorPane.topAnchor="79.0" />
<JFXColorPicker fx:id="colorPicker" layoutX="22.0" layoutY="235.0" onAction="#colorPickerAction" AnchorPane.leftAnchor="16.0" AnchorPane.topAnchor="227.0" />
<JFXToggleButton fx:id="fullscreenToggleBtn" layoutX="14.0" layoutY="391.0" onAction="#fullscreenToggleBtnAction" text="start game in fullscreen" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="390.0" />
<Label layoutX="22.0" layoutY="135.0" text="Rom Directory" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="131.0" />
<Label layoutX="22.0" layoutY="211.0" text="main Color" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="203.0" />
<Label layoutX="14.0" layoutY="371.0" text="Cemu Settings" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="350.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<Label layoutX="22.0" layoutY="14.0" text="cemu_UI Settings" AnchorPane.leftAnchor="18.0" AnchorPane.topAnchor="14.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<JFXToggleButton fx:id="cloudSyncToggleBtn" layoutX="14.0" layoutY="264.0" onAction="#cloudSyncToggleBtnAction" text="cloud savegames (Google Drive)" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="267.0" />
</children>
</AnchorPane>
<ScrollPane fx:id="settingsScrollPane" style="-fx-background: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="175.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<content>
<!-- space between settings sections 35px, between sections elements (label + element) 20px, between label and element 3px(or more) -->
<AnchorPane fx:id="settingsAnchorPane" prefHeight="562.0" prefWidth="511.0" style="-fx-background-color: white;">
<children>
<Label fx:id="cemuDirectoryLbl" layoutX="10.0" layoutY="39.0" text="Cemu Directory" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="39.0" />
<JFXTextField fx:id="cemuTextField" layoutX="10.0" layoutY="59.0" maxWidth="305.0" minWidth="305.0" onAction="#cemuTextFieldAction" prefHeight="32.0" prefWidth="305.0" promptText="cemu directory" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="59.0" />
<JFXTextField fx:id="romTextField" layoutX="10.0" layoutY="131.0" maxWidth="305.0" minWidth="305.0" onAction="#romTextFieldAction" prefHeight="32.0" prefWidth="305.0" promptText="rom directory" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="131.0" />
<JFXButton fx:id="romTFBtn" layoutX="329.0" layoutY="131.0" onAction="#romTFBtnAction" prefHeight="32.0" text="choose directory" AnchorPane.leftAnchor="329.0" AnchorPane.topAnchor="131.0" />
<JFXButton fx:id="cemuTFBtn" layoutX="329.0" layoutY="59.0" onAction="#cemuTFBtnAction" prefHeight="32.0" text="choose directory" AnchorPane.leftAnchor="329.0" AnchorPane.topAnchor="59.0" />
<JFXColorPicker fx:id="colorPicker" layoutX="12.0" layoutY="207.0" onAction="#colorPickerAction" AnchorPane.leftAnchor="12.0" AnchorPane.topAnchor="207.0" />
<JFXToggleButton fx:id="fullscreenToggleBtn" layoutX="16.0" layoutY="488.0" onAction="#fullscreenToggleBtnAction" text="start game in fullscreen" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="488.0" />
<Label fx:id="romDirectoryLbl" layoutX="10.0" layoutY="111.0" text="Rom Directory" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="111.0" />
<Label fx:id="mainColorLbl" layoutX="10.0" layoutY="183.0" text="main Color" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="183.0" />
<Label fx:id="cemuSettingsLbl" layoutX="16.0" layoutY="450.0" text="Cemu Settings" AnchorPane.leftAnchor="16.0" AnchorPane.topAnchor="465.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<Label fx:id="cemu_UISettingsLbl" layoutX="22.0" layoutY="14.0" text="cemu_UI Settings" AnchorPane.leftAnchor="18.0" AnchorPane.topAnchor="14.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<JFXToggleButton fx:id="cloudSyncToggleBtn" layoutX="10.0" layoutY="247.0" onAction="#cloudSyncToggleBtnAction" text="cloud savegames (Google Drive)" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="247.0" />
<Label fx:id="updateLbl" layoutX="10.0" layoutY="315.0" text="Updates" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="315.0" />
<JFXButton fx:id="updateBtn" layoutX="14.0" layoutY="335.0" onAction="#updateBtnAction" prefHeight="32.0" text="check now!" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="335.0" />
<JFXToggleButton fx:id="autoUpdateToggleBtn" layoutX="10.0" layoutY="372.0" onAction="#autoUpdateToggleBtnAction" text="check for updates on startup" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="372.0" />
<ChoiceBox fx:id="branchChoisBox" layoutX="270.0" layoutY="339.0" prefWidth="150.0" AnchorPane.leftAnchor="270.0" AnchorPane.topAnchor="339.0" />
<Label fx:id="branchLbl" layoutX="204.0" layoutY="337.0" prefHeight="32.0" text="Branch" AnchorPane.leftAnchor="204.0" AnchorPane.topAnchor="335.0" />
</children>
</AnchorPane>
</content>
</ScrollPane>
<AnchorPane fx:id="smmdbAnchorPane" style="-fx-background-color: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="175.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<children>
<JFXTreeTableView fx:id="courseTreeTable" layoutX="14.0" layoutY="14.0" prefHeight="537.0" prefWidth="405.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />

View File

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

View File

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 233 B

View File

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 235 B

View File

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 245 B

View File

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 114 B

View File

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 116 B

View File

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

View File

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

View File

Before

Width:  |  Height:  |  Size: 322 B

After

Width:  |  Height:  |  Size: 322 B

View File

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

Some files were not shown because too many files have changed in this diff Show More