78 Commits
077 ... master

Author SHA1 Message Date
Jannik 5728ea4f4d „README.md“ ändern 5 months ago
Jannik 13dd0a0150 Merge branch 'develop' of Seil0/cemu_UI into master 2 years ago
Jannik f584eef9b7
update to 0.3.0 2 years ago
Jannik a6b1ce7f72
some new css styling 2 years ago
Jannik 0fecb8bb16
more lambda code 2 years ago
Jannik 2689b03c16
minor clean up 2 years ago
Jannik bc36630ef2
removed unneeded methode 2 years ago
Jannik 07ded89069
Major code clean up 2 years ago
Jannik a4c8eb2efe
the license dialog is now a alert & reduced main usage in mwc 2 years ago
Jannik 7d376535ae
nicer dialog on first startup 2 years ago
Jannik 3f69169a6a
new constructor for UIROMDataType 2 years ago
Jannik 922c5197da
update to JavaFX 12.0.1 2 years ago
Jannik 0599945036
clean up some mwc code + UIROMDataType 2 years ago
Jannik df33c21826 some code clean up 2 years ago
Jannik e59b14074e added a few new games, updated some Japanese titles 2 years ago
Jannik 648d101c8e updated year 2 years ago
Jannik 4222101b68 Update 'README.md' 2 years ago
Jannik db8fcd4bdc major code clean up 2 years ago
Jannik 7434d0be25 minor clean up 2 years ago
Jannik 360badb841 removed travis.yml 2 years ago
Jannik 38421599a3 the updater now uses gitea 2 years ago
Jannik 3f6eeece7d updated some libs, code clean up 2 years ago
Jannik 36fd86d15c Merge branch 'develop' 3 years ago
Jannik 87eaec31ee „README.md“ ändern 3 years ago
Jannik a2f35de1c7 „README.md“ ändern 3 years ago
Jannik b879e22fcf deleted unused images 3 years ago
Jannik 960bec5283 „README.md“ ändern 3 years ago
Jannik ffb7bc971c removed eclipse specific files 3 years ago
Jannik 50088e0130 „.project“ löschen 3 years ago
Jannik a3fc8ba463 „.classpath“ löschen 3 years ago
Jannik ada6bec325 updated gitignore 3 years ago
Jannik bbfc9521a0 target java11/javafx11 3 years ago
Jannik 2ac66978ba updated some libraries 3 years ago
Jannik ed99e45115 cleaned up games.csv 3 years ago
Jannik dcd928096a updated a few games in games.csv 3 years ago
Jannik 1df6a91f41 Merge branch 'develop' of Seil0/cemu_UI into master 3 years ago
Jannik d46eace9d5 updated readme 3 years ago
Jannik 9e58a30390 updated readme 3 years ago
Jannik 010f109597 updated readme 3 years ago
Jannik d082482844 updated readme 3 years ago
Jannik fb1fd442f7 'README.md' ändern 3 years ago
Jannik 9839c303da download the games.db from gitea 3 years ago
Jannik b610dc337b 'README.md' ändern 3 years ago
Jannik f195addea8 version 0.3.1 (81) 3 years ago
Jannik e371859987 test commit 2 3 years ago
Jannik 8b62a732cd test commit 3 years ago
Jannik 41a0becd4f typo 3 years ago
Jannik 9b7a85cabe code clean up 3 years ago
Jannik cc4e73c45d InfoAlert & ProcessBuilder 3 years ago
Jannik c6a40f8937 updated some libs 3 years ago
Jannik e13c84382f biuld against java 10 3 years ago
Jannik ea34f10c09 fixed Hamburger icon has wrong color after color change 3 years ago
Jannik 4e4d32dc97
Update README.md 3 years ago
Jannik f1bb0607f7
Merge pull request #18 from Seil0/develop 3 years ago
Jannik 5758b23bff
Merge branch 'master' into develop 3 years ago
Jannik 1e7cea86ad code cleanup 3 years ago
Jannik 433767f81c Merge remote-tracking branch 'origin/develop' into develop 3 years ago
Jannik f9f63c0f3c code cleanup 3 years ago
Jannik fcaffecabf text fix 3 years ago
Jannik 7813778502 small cleanup 3 years ago
Jannik 662188813b removed workaround for xPosHelper Bug 3 years ago
Jannik b915cf7ad9 removed last unnecessary reboot 3 years ago
Jannik b4fc36621a code cleanup 3 years ago
Jannik 061f58105a documentation cleanups, code cleanup 3 years ago
Jannik 3a6a7b7cce * jfoenix 9.0.1 -> 9.0.2 3 years ago
Jannik f7675cf277
Update README.md 3 years ago
Jannik 4932731987
Update README.md 3 years ago
Jannik 2e3395caea minor fixes 3 years ago
Jannik 54078eb99f clean up 3 years ago
Jannik 79cb1c2476 fixed games are not loaded to mwc 3 years ago
Jannik b88c530ac2 use a ProcessBuilder instead of Runtime.exec 3 years ago
Jannik 88e31468d4 made choicebox matreial styled 3 years ago
Jannik 84b5eaedcd reworked startup process 3 years ago
Jannik f331fb57a4 added ability to edit launch command, WIP 3 years ago
Jannik a9f675ee5e
Update README.md 3 years ago
Jannik fe4fcb45d7 travis fix, first try 3 years ago
Jannik 52c2912ba2 maven compile plugin 3.7.0 3 years ago
Jannik 46455e9e9d Java 9, updated a few libs 3 years ago
  1. 33
      .classpath
  2. 3
      .gitignore
  3. 29
      .project
  4. 5
      .settings/org.eclipse.core.resources.prefs
  5. 13
      .settings/org.eclipse.jdt.core.prefs
  6. 4
      .settings/org.eclipse.m2e.core.prefs
  7. 1
      .travis.yml
  8. 26
      README.md
  9. BIN
      downloadContent/cemu_UI3.png
  10. BIN
      downloadContent/cemu_UI4.png
  11. 5158
      downloadContent/games.csv
  12. 420
      pom.xml
  13. 8
      src/main/java/com/cemu_UI/application/JavaFX11Main.java
  14. 269
      src/main/java/com/cemu_UI/application/Main.java
  15. 1665
      src/main/java/com/cemu_UI/application/MainWindowController.java
  16. 79
      src/main/java/com/cemu_UI/application/playGame.java
  17. 80
      src/main/java/com/cemu_UI/controller/CloudController.java
  18. 243
      src/main/java/com/cemu_UI/controller/DBController.java
  19. 2
      src/main/java/com/cemu_UI/controller/SmmdbAPIController.java
  20. 100
      src/main/java/com/cemu_UI/controller/UpdateController.java
  21. 419
      src/main/java/com/cemu_UI/controller/XMLController.java
  22. 2
      src/main/java/com/cemu_UI/datatypes/CourseTableDataType.java
  23. 29
      src/main/java/com/cemu_UI/datatypes/GlobalDataTypes.java
  24. 2
      src/main/java/com/cemu_UI/datatypes/SmmdbApiDataType.java
  25. 164
      src/main/java/com/cemu_UI/datatypes/UIROMDataType.java
  26. 250
      src/main/java/com/cemu_UI/uiElements/JFXEditGameAlert.java
  27. 229
      src/main/java/com/cemu_UI/uiElements/JFXEditGameDialog.java
  28. 106
      src/main/java/com/cemu_UI/uiElements/JFXInfoAlert.java
  29. 86
      src/main/java/com/cemu_UI/uiElements/JFXInfoDialog.java
  30. 129
      src/main/java/com/cemu_UI/uiElements/JFXOkayCancelAlert.java
  31. 104
      src/main/java/com/cemu_UI/uiElements/JFXTextAreaAlert.java
  32. 98
      src/main/java/com/cemu_UI/uiElements/JFXTextAreaInfoDialog.java
  33. 59
      src/main/java/com/cemu_UI/vendorCloudController/GoogleDriveController.java
  34. 152
      src/main/resources/css/MainWindows.css
  35. 92
      src/main/resources/fxml/MainWindow.fxml
  36. 4
      src/main/resources/locals/cemu_UI-Local_de_DE.properties
  37. 22
      src/main/resources/locals/cemu_UI-Local_en_US.properties
  38. 6
      src/test/main/com/cemu_UI/test/AppTest.java

33
.classpath

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<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="src" path="src/test/main"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
<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

@ -50,3 +50,6 @@ client_secret.json
.directory
target/
cemu_UI.jar
.classpath
.project
.settings/*

29
.project

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>cemu_UI</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<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>
</projectDescription>

5
.settings/org.eclipse.core.resources.prefs

@ -1,5 +0,0 @@
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

13
.settings/org.eclipse.jdt.core.prefs

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

4
.settings/org.eclipse.m2e.core.prefs

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

1
.travis.yml

@ -1 +0,0 @@
language: java

26
README.md

@ -1,18 +1,17 @@
# cemu_UI
![Total Downloads](https://img.shields.io/github/downloads/Seil0/cemu_UI/total.svg?style=flat-square)
[![](https://img.shields.io/travis/Seil0/cemu_UI/master.svg?style=flat-square)](https://travis-ci.org/Seil0/cemu_UI)
[![Latest](https://img.shields.io/github/release/Seil0/cemu_UI/all.svg?style=flat-square)](https://github.com/Seil0/cemu_UI/releases)
[![Latest](https://img.shields.io/badge/release-085-blue.svg?style=flat-square)](https://git.mosad.xyz/Seil0/cemu_UI/releases)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0)
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).
cemu_UI is a simple, material design graphical frontend for [cemu](http://cemu.info/), a Wii U emulator. Downloads can be found [here](https://git.mosad.xyz/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 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!**
Simply download the cemu_UI.jar from [Releases](https://git.mosad.xyz/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! If you have problems using the cloud synchronisation please update to version [075](https://github.com/Seil0/cemu_UI/releases/tag/075).
If you want to use the cloud sync function read the [wiki](https://git.mosad.xyz/Seil0/cemu_UI/wiki#cloud-savegame-syncronisation) carefully!
### [FAQ](https://github.com/Seil0/cemu_UI/wiki#faq)
### [FAQ](https://git.mosad.xyz/Seil0/cemu_UI/wiki#faq)
## Features
@ -22,20 +21,17 @@ If you want to use the cloud sync function read the [wiki](https://github.com/Se
* add updates and dlcs easier (only adding not downloading!)
* automatic rom detection (only .rpx files with a app.xml)
* customisable UI
* [sync savegames via google drive](https://github.com/Seil0/cemu_UI/wiki)
* [sync savegames via google drive](https://git.mosad.xyz/Seil0/cemu_UI/wiki)
* [smmdb api](https://github.com/Tarnadas/smmdb) integration
## [planed Features](https://github.com/Seil0/cemu_UI/projects/1) (no ETA)
## [planed Features](https://git.mosad.xyz/Seil0/cemu_UI/milestones)
* Controller support
* support more rom file formats in automatic detection
### If you have another idea, make a "new issue" with the ![#f03c15](https://placehold.it/15/fbca04/000000?text=+)`idea` lable
### If you have another idea, make a new issue!
### [building from source](https://github.com/Seil0/cemu_UI/wiki/Documantation)
### [building from source](https://git.mosad.xyz/Seil0/cemu_UI/wiki/Documentation)
## Screenshots
![Screenshot](/downloadContent/cemu_UI4.png)
![Screenshot](https://www.mosad.xyz/images/cemu_UI_MainWindow.webp)

BIN
downloadContent/cemu_UI3.png

Before

Width: 903  |  Height: 635  |  Size: 1006 KiB

BIN
downloadContent/cemu_UI4.png

Before

Width: 902  |  Height: 635  |  Size: 1.1 MiB

5158
downloadContent/games.csv
File diff suppressed because it is too large
View File

420
pom.xml

@ -1,211 +1,211 @@
<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.3-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.11.1</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.21.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.9.1</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-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.cemu_UI.application.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<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.3.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>cemu_UI</name>
<description>cemu_UI is a simple, material design graphical frontend for cemu, a Wii U emulator</description>
<url>https://www.mosad.xyz</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>12.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>12.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>12.0.1</version>
</dependency>
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>9.0.9</version>
</dependency>
<dependency>
<groupId>com.eclipsesource.minimal-json</groupId>
<artifactId>minimal-json</artifactId>
<version>0.9.5</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.27.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.11.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</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/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.apis/google-api-services-drive -->
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v3-rev136-1.25.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.25.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.25.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.25.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.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mortbay.jetty/jetty -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>6.1.26</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.cemu_UI.application.Main</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>cemu_UI</finalName>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.cemu_UI.application.JavaFX11Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

8
src/main/java/com/cemu_UI/application/JavaFX11Main.java

@ -0,0 +1,8 @@
package com.cemu_UI.application;
public class JavaFX11Main {
public static void main(String[] args) {
Main.main(args);
}
}

269
src/main/java/com/cemu_UI/application/Main.java

@ -1,7 +1,7 @@
/**
* cemu_UI
*
* Copyright 2017 <@Seil0>
* Copyright 2017-2019 <@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
@ -27,7 +27,6 @@ import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.util.Optional;
import java.util.Timer;
import java.util.TimerTask;
@ -35,51 +34,45 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.cemu_UI.controller.CloudController;
import com.cemu_UI.controller.XMLController;
import com.cemu_UI.uiElements.JFXInfoAlert;
import com.cemu_UI.uiElements.JFXOkayCancelAlert;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXMLLoader;
import javafx.stage.DirectoryChooser;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.layout.AnchorPane;
import javafx.stage.DirectoryChooser;
import javafx.stage.Stage;
public class Main extends Application {
private Stage primaryStage;
private final String gamesDBdownloadURL = "https://git.mosad.xyz/Seil0/cemu_UI/raw/branch/master/downloadContent/games.db";
private static Main main;
private static XMLController xmlController;
private MainWindowController mainWindowController;
private CloudController cloudController;
private Stage primaryStage;
private AnchorPane pane;
private Scene scene;
private static String userHome = System.getProperty("user.home");
private static String userName = System.getProperty("user.name");
private static String osName = System.getProperty("os.name");
private static String osArch = System.getProperty("os.arch");
private static String osVers = System.getProperty("os.version");
private static String javaVers = System.getProperty("java.version");
private static String javaVend= System.getProperty("java.vendor");
private String gamesDBdownloadURL = "https://github.com/Seil0/cemu_UI/raw/master/downloadContent/games.db";
public String dirWin = userHome + "/Documents/cemu_UI"; // Windows: C:/Users/"User"/Documents/cemu_UI
public String dirLinux = userHome + "/cemu_UI"; // Linux: /home/"User"/cemu_UI
private File directory;
private File configFile;
private File gamesDBFile;
private File reference_gamesFile;
private File pictureCache;
private static Logger LOGGER;
@Override
public void start(Stage primaryStage) {
try {
LOGGER.info("OS: " + osName + " " + osVers + " " + osArch);
LOGGER.info("Java: " + javaVend + " " + javaVers);
LOGGER.info("User: " + userName + " " + userHome);
LOGGER.info("OS: " + XMLController.getOsName() + " " + XMLController.getOsVers() + " " + XMLController.getOsVers());
LOGGER.info("Java: " + XMLController.getJavaVend() + " " + XMLController.getJavaVers());
LOGGER.info("User: " + XMLController.getUserName() + " " + XMLController.getUserHome());
this.primaryStage = primaryStage;
mainWindowController = new MainWindowController();
main = this;
mainWindow();
initActions();
} catch (Exception e) {
@ -91,75 +84,61 @@ public class Main extends Application {
private void mainWindow(){
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(ClassLoader.getSystemResource("fxml/MainWindow.fxml"));
loader.setLocation(getClass().getResource("/fxml/MainWindow.fxml"));
loader.setController(mainWindowController);
pane = (AnchorPane) loader.load();
primaryStage.setMinWidth(1130);
primaryStage.setMinHeight(600 + 34);
primaryStage.setTitle("cemu_UI");
// primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon
mainWindowController = loader.getController(); // Link of FXMLController and controller class
mainWindowController.setMain(this); // call setMain
cloudController = new CloudController(mainWindowController); // call cloudController constructor
// primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream(""))); //adds application icon
primaryStage.setOnCloseRequest(event -> System.exit(0));
// get OS and the specific paths
if (osName.equals("Linux")) {
directory = new File(dirLinux);
configFile = new File(dirLinux + "/config.xml");
gamesDBFile = new File(dirLinux + "/games.db");
reference_gamesFile = new File(dirLinux + "/reference_games.db");
pictureCache= new File(dirLinux+"/picture_cache");
} else {
directory = new File(dirWin);
configFile = new File(dirWin + "/config.xml");
gamesDBFile = new File(dirWin + "/games.db");
reference_gamesFile = new File(dirWin + "/reference_games.db");
pictureCache= new File(dirWin+"/picture_cache");
}
// generate window
scene = new Scene(pane); // create new scene, append pane to scene
scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm());
primaryStage.setScene(scene); // append scene to stage
primaryStage.show(); // show stage
cloudController = CloudController.getInstance(mainWindowController); // call cloudController constructor
// startup checks
// check if client_secret.jason is present
// check if client_secret.json is present
if (Main.class.getResourceAsStream("/client_secret.json") == null) {
LOGGER.error("client_secret is missing!!!!!");
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("cemu_UI");
alert.setHeaderText("Error");
alert.setContentText("client_secret is missing! Please contact the maintainer. \nIf you compiled cemu_UI by yourself see: \nhttps://github.com/Seil0/cemu_UI/wiki/Documantation");
alert.showAndWait();
JFXInfoAlert noCSAlert = new JFXInfoAlert("Error",
"client_secret is missing! Please contact the maintainer. \n"
+ "If you compiled cemu_UI by yourself see: \n"
+ "https://git.mosad.xyz/Seil0/cemu_UI/wiki/Documantation",
"-fx-button-type: RAISED; -fx-background-color: #00a8cc; -fx-text-fill: BLACK;", primaryStage);
noCSAlert.showAndWait();
}
if (!directory.exists()) {
if (!XMLController.getDirCemuUI().exists()) {
LOGGER.info("creating cemu_UI directory");
directory.mkdir();
pictureCache.mkdir();
XMLController.getDirCemuUI().mkdir();
XMLController.getPictureCache().mkdir();
}
if (!configFile.exists()) {
if (!XMLController.getConfigFile().exists()) {
LOGGER.info("firststart, setting default values");
firstStart();
mainWindowController.setColor("00a8cc");
mainWindowController.setAutoUpdate(false);
mainWindowController.setLanguage("en_US");
mainWindowController.setLastLocalSync(0);
mainWindowController.setxPosHelper(0);
mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs)
System.exit(0); //finishes itself
xmlController.saveSettings();
}
if (pictureCache.exists() != true) {
pictureCache.mkdir();
if (!XMLController.getPictureCache().exists()) {
XMLController.getPictureCache().mkdir();
}
if (!reference_gamesFile.exists()) {
if (gamesDBFile.exists()) {
gamesDBFile.delete();
if (!XMLController.getRference_gamesFile().exists()) {
if (XMLController.getGamesDBFile().exists()) {
XMLController.getGamesDBFile().delete();
}
try {
LOGGER.info("downloading ReferenceGameList.db... ");
URL website = new URL(gamesDBdownloadURL);
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(reference_gamesFile);
FileOutputStream fos = new FileOutputStream(XMLController.getRference_gamesFile());
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
LOGGER.info("finished downloading games.db");
@ -168,56 +147,68 @@ public class Main extends Application {
}
}
// loading settings and initialize UI, dbController.main() loads all databases
// init here as it loads the games to the mwc and the gui, therefore the window must exist
mainWindowController.init();
mainWindowController.dbController.init();
// if cloud sync is activated start sync
if(mainWindowController.isCloudSync()) {
cloudController.initializeConnection(mainWindowController.getCloudService(), mainWindowController.getCemuPath());
cloudController.sync(mainWindowController.getCloudService(), mainWindowController.getCemuPath(), directory.getPath());
}
mainWindowController.addUIData();
scene = new Scene(pane); // create new scene, append pane to scene
scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm());
primaryStage.setScene(scene); // append scene to stage
primaryStage.show(); // show stage
} catch (IOException e) {
e.printStackTrace();
if (XMLController.isCloudSync()) {
cloudController.initializeConnection(XMLController.getCloudService(), XMLController.getCemuPath());
cloudController.sync(XMLController.getCloudService(), XMLController.getCemuPath(), XMLController.getDirCemuUIPath());
}
} catch (IOException e) {
e.printStackTrace();
}
}
private void firstStart(){
Alert alert = new Alert(AlertType.CONFIRMATION); // new alert with file-chooser
alert.setTitle("cemu_UI");
alert.setHeaderText("cemu installation");
alert.setContentText("please select your cemu installation");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
DirectoryChooser directoryChooser = new DirectoryChooser();
File selectedDirectory = directoryChooser.showDialog(primaryStage);
mainWindowController.setCemuPath(selectedDirectory.getAbsolutePath());
public static void main(String[] args) {
String logPath = "";
if (System.getProperty("os.name").contains("Windows")) {
logPath = System.getProperty("user.home") + "/Documents/cemu_UI/app.log";
} else {
mainWindowController.setCemuPath(null);
logPath = System.getProperty("user.home") + "/cemu_UI/app.log";
}
Alert alert2 = new Alert(AlertType.CONFIRMATION); // new alert with file-chooser
alert2.setTitle("cemu_UI");
alert2.setHeaderText("rom directory");
alert2.setContentText("please select your rom directory");
Optional<ButtonType> result2 = alert2.showAndWait();
if (result2.get() == ButtonType.OK) {
System.setProperty("logFilename", logPath);
File logFile = new File(logPath);
logFile.delete();
LOGGER = LogManager.getLogger(Main.class.getName());
xmlController = new XMLController();
launch(args);
}
private void firstStart() {
JFXOkayCancelAlert cemuInstallAlert = new JFXOkayCancelAlert("cemu installation",
"please select your cemu installation",
"-fx-button-type: RAISED; -fx-background-color: #00a8cc; -fx-text-fill: BLACK;", primaryStage);
cemuInstallAlert.setOkayAction(e -> {
DirectoryChooser directoryChooser = new DirectoryChooser();
File selectedDirectory = directoryChooser.showDialog(primaryStage);
mainWindowController.setRomPath(selectedDirectory.getAbsolutePath());
} else {
mainWindowController.setRomPath(null);
}
XMLController.setCemuPath(selectedDirectory.getAbsolutePath());
});
cemuInstallAlert.setCancelAction(e -> {
XMLController.setCemuPath(null);
LOGGER.info("Action canceld by user!");
});
cemuInstallAlert.showAndWait();
JFXOkayCancelAlert romDirectoryAlert = new JFXOkayCancelAlert("rom directory",
"please select your rom directory",
"-fx-button-type: RAISED; -fx-background-color: #00a8cc; -fx-text-fill: BLACK;", primaryStage);
romDirectoryAlert.setOkayAction(e -> {
DirectoryChooser directoryChooser = new DirectoryChooser();
File selectedDirectory = directoryChooser.showDialog(primaryStage);
XMLController.setRomDirectoryPath(selectedDirectory.getAbsolutePath());
});
romDirectoryAlert.setCancelAction(e -> {
XMLController.setRomDirectoryPath(null);
LOGGER.info("Action canceld by user!");
});
romDirectoryAlert.showAndWait();
}
private void initActions() {
@ -229,20 +220,15 @@ public class Main extends Application {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, final Number newValue) {
int xPosHelperMax = (int) Math.floor((mainWindowController.getMainAnchorPane().getWidth() - 36) / 217);
// call only if there is enough space for a new row
if (mainWindowController.getOldXPosHelper() != xPosHelperMax) {
mainWindowController.refreshUIData();
}
// if saveTask is already running kill it
if (saveTask != null) saveTask.cancel();
saveTask = new TimerTask() {
@Override
public void run() {
mainWindowController.saveSettings();
public void run() {
XMLController.setWindowWidth(mainWindowController.getMainAnchorPane().getWidth());
xmlController.saveSettings();
}
};
timer.schedule(saveTask, delayTime);
@ -262,8 +248,9 @@ public class Main extends Application {
saveTask = new TimerTask() {
@Override
public void run() {
mainWindowController.saveSettings();
public void run() {
XMLController.setWindowHeight(mainWindowController.getMainAnchorPane().getHeight());
xmlController.saveSettings();
}
};
timer.schedule(saveTask, delayTime);
@ -293,55 +280,15 @@ public class Main extends Application {
primaryStage.maximizedProperty().addListener(maximizeListener);
}
public static void main(String[] args) {
// delete old log file and create new
if(osName.equals("Linux")){
System.setProperty("logFilename", userHome + "/cemu_UI/app.log");
File logFile = new File(userHome + "/cemu_UI/app.log");
logFile.delete();
}else{
System.setProperty("logFilename", userHome + "/Documents/cemu_UI/app.log");
File logFile = new File(userHome + "/Documents/cemu_UI/app.log");
logFile.delete();
}
LOGGER = LogManager.getLogger(Main.class.getName());
launch(args);
}
@Override
public void stop() {
System.exit(0);
}
public Stage getPrimaryStage() {
return primaryStage;
}
public void setPrimaryStage(Stage primaryStage) {
this.primaryStage = primaryStage;
public static Main getMain() {
return main;
}
public CloudController getCloudController() {
return cloudController;
}
public void setCloudController(CloudController cloudController) {
this.cloudController = cloudController;
}
public AnchorPane getPane() {
return pane;
}
public void setPane(AnchorPane pane) {
this.pane = pane;
}
public File getDirectory() {
return directory;
}
public void setDirectory(File directory) {
this.directory = directory;
}
}

1665
src/main/java/com/cemu_UI/application/MainWindowController.java
File diff suppressed because it is too large
View File

79
src/main/java/com/cemu_UI/application/playGame.java

@ -1,7 +1,7 @@
/**
* cemu_UI
*
* Copyright 2017 <@Seil0>
* Copyright 2017-2019 <@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
@ -27,25 +27,28 @@ import java.time.Instant;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.cemu_UI.controller.CloudController;
import com.cemu_UI.controller.DBController;
import com.cemu_UI.controller.XMLController;
import javafx.application.Platform;
public class playGame extends Thread{
public class playGame extends Thread {
MainWindowController mainWindowController;
DBController dbController;
private MainWindowController mainWindowController;
private DBController dbController;
private static final Logger LOGGER = LogManager.getLogger(playGame.class.getName());
public playGame(MainWindowController m, com.cemu_UI.controller.DBController db){
public playGame(MainWindowController m, com.cemu_UI.controller.DBController db) {
mainWindowController = m;
dbController = db;
}
@Override
public void run(){
public void run() {
String selectedGameTitleID = mainWindowController.getSelectedGameTitleID();
String executeComand;
String cemuBin = XMLController.getCemuPath() + "/Cemu.exe";
String gameExec = "\"" + mainWindowController.getGameExecutePath() + "\"";
long startTime;
long endTime;
int timePlayedNow;
@ -53,52 +56,50 @@ public class playGame extends Thread{
Process p;
Platform.runLater(() -> {
mainWindowController.main.getPrimaryStage().setIconified(true); // minimize cemu_UI
mainWindowController.getPrimaryStage().setIconified(true); // minimize cemu_UI
});
startTime = System.currentTimeMillis();
try{
if(mainWindowController.isFullscreen()){
if(System.getProperty("os.name").equals("Linux")){
executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\"";
try {
if (System.getProperty("os.name").equals("Linux")) {
if(XMLController.isFullscreen()){
p = new ProcessBuilder("wine", cemuBin, "-f", "-g", gameExec).start();
} else {
executeComand = mainWindowController.getCemuPath()+"\\Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\"";
p = new ProcessBuilder("wine", cemuBin, "-g", gameExec).start();
}
}else{
if(System.getProperty("os.name").equals("Linux")){
executeComand = "wine "+mainWindowController.getCemuPath()+"/Cemu.exe -g \""+mainWindowController.getGameExecutePath()+"\"";
} else {
if(XMLController.isFullscreen()){
p = new ProcessBuilder(cemuBin, "-f", "-g", gameExec).start();
} else {
executeComand = mainWindowController.getCemuPath()+"\\Cemu.exe -g \""+mainWindowController.getGameExecutePath()+"\"";
p = new ProcessBuilder(cemuBin, "-g", gameExec).start();
}
}
LOGGER.info(executeComand);
}
p = Runtime.getRuntime().exec(executeComand);
p.waitFor();
p.waitFor(); // wait until cemu is closed so we can calculate the played time
endTime = System.currentTimeMillis();
timePlayedNow = (int) Math.floor(((endTime - startTime)/1000/60));
timePlayed = Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID))+timePlayedNow;
dbController.setTotalPlaytime(Integer.toString(timePlayed), selectedGameTitleID);
Platform.runLater(() -> {
if(Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) > 60){
int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID))/60);
int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID))-60*hoursPlayed;
mainWindowController.totalPlaytimeBtn.setText(hoursPlayed+"h "+minutesPlayed+"min");
}else{
mainWindowController.totalPlaytimeBtn.setText(dbController.getTotalPlaytime(selectedGameTitleID)+ " min");
}
mainWindowController.main.getPrimaryStage().setIconified(false); // maximize cemu_UI
});
dbController.setTotalPlaytime(Integer.toString(timePlayed), selectedGameTitleID);
Platform.runLater(() -> {
if (Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) > 60) {
int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) / 60);
int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(selectedGameTitleID)) - 60 * hoursPlayed;
mainWindowController.totalPlaytimeBtn.setText(hoursPlayed + "h " + minutesPlayed + "min");
} else {
mainWindowController.totalPlaytimeBtn.setText(dbController.getTotalPlaytime(selectedGameTitleID) + " min");
}
mainWindowController.getPrimaryStage().setIconified(false); // maximize cemu_UI
});
//sync savegame with cloud service
if (mainWindowController.isCloudSync()) {
mainWindowController.setLastLocalSync(Instant.now().getEpochSecond());
mainWindowController.main.getCloudController().sync(mainWindowController.getCloudService(),
mainWindowController.getCemuPath(), mainWindowController.main.getDirectory().getPath());
if (XMLController.isCloudSync()) {
XMLController.setLastLocalSync(Instant.now().getEpochSecond());
CloudController.getInstance(mainWindowController).sync(XMLController.getCloudService(),
XMLController.getCemuPath(), XMLController.getDirCemuUIPath());
}
}catch (IOException | InterruptedException e){
e.printStackTrace();
} catch (IOException | InterruptedException e) {
LOGGER.error(e);
}
}

80
src/main/java/com/cemu_UI/controller/CloudController.java

@ -1,7 +1,7 @@
/**
* cemu_UI
*
* Copyright 2017 <@Seil0>
* Copyright 2017-2019 <@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
@ -33,6 +33,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.cemu_UI.application.MainWindowController;
import com.cemu_UI.datatypes.GlobalDataTypes.CloudService;
import com.cemu_UI.vendorCloudController.GoogleDriveController;
import javafx.application.Platform;
@ -40,20 +41,32 @@ import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;
public class CloudController {
public CloudController(MainWindowController mwc) {
this.mwc = mwc;
}
// TODO make singleton
private MainWindowController mwc;
private static CloudController instance = null;
private XMLController xmlController = new XMLController();
private GoogleDriveController googleDriveController = new GoogleDriveController();
private static final Logger LOGGER = LogManager.getLogger(CloudController.class.getName());
public boolean initializeConnection(String cloudService, String cemuDirectory) {
public CloudController(MainWindowController mwc) {
this.mwc = mwc;
}
public static CloudController getInstance(MainWindowController mwc) {
if (instance == null) {
instance = new CloudController(mwc);
}
return instance;
}
public boolean initializeConnection(CloudService cloudService, String cemuDirectory) {
boolean success = false;
LOGGER.info("sartting cloud initialisation ...");
if(cloudService.equals("GoogleDrive")) {
if(cloudService == CloudService.GoogleDrive) {
LOGGER.info("selected service is Google Drive");
try {
googleDriveController.main(cemuDirectory);
@ -64,7 +77,7 @@ public class CloudController {
success = true;
}
if(cloudService.equals("Dropbox")) {
if(cloudService == CloudService.Dropbox) {
LOGGER.info("selected service is Dropbox");
}
LOGGER.info("cloud initialisation done!");
@ -77,7 +90,7 @@ public class CloudController {
* @param cemuDirectory
* @param cemu_UIDirectory
*/
public void sync(String cloudService, String cemuDirectory, String cemu_UIDirectory) {
public void sync(CloudService cloudService, String cemuDirectory, String cemu_UIDirectory) {
// running sync in a new thread, instead of blocking the main thread
Thread thread = new Thread(new Runnable() {
@ -89,61 +102,59 @@ public class CloudController {
mwc.getPlayBtn().setText("syncing...");
});
LOGGER.info("starting synchronization in new thread ...");
// zip the saves folder
File zipFile = zipSavegames(cemu_UIDirectory, cemuDirectory);
// upload the zip
switch (cloudService) {
// use GoogleDriveController
case "GoogleDrive":
case GoogleDrive:
LOGGER.info("using GoogleDriveController");
long lastCloudSync = googleDriveController.getLastCloudSync();
if (!googleDriveController.checkFolder()) {
LOGGER.info("cloud sync folder dosen't exist, creating one!");
googleDriveController.creatFolder();
googleDriveController.uploadZipFile(zipFile);
} else if (mwc.getLastLocalSync() > lastCloudSync) {
} else if (XMLController.getLastLocalSync() > lastCloudSync) {
LOGGER.info("local is new, going to upload zip");
googleDriveController.uploadZipFile(zipFile);
} else if(mwc.getLastLocalSync() < lastCloudSync) {
} else if (XMLController.getLastLocalSync() < lastCloudSync) {
LOGGER.info("cloud is new, going to download zip");
unzipSavegames(cemuDirectory, googleDriveController.downloadZipFile(cemu_UIDirectory));
mwc.setLastLocalSync(lastCloudSync);
XMLController.setLastLocalSync(lastCloudSync);
break;
} else {
LOGGER.info("nothing to do");
break;
}
mwc.setLastLocalSync(Long.parseLong(zipFile.getName().substring(0, zipFile.getName().length()-4))); // set time of last sucessfull sync
XMLController.setLastLocalSync(Long.parseLong(zipFile.getName().substring(0, zipFile.getName().length() - 4))); // set time of last sucessfull sync
break;
case "Dropbox":
case Dropbox:
// do the thing
break;
default:
LOGGER.warn("no cloud vendor found!");
break;
}
zipFile.delete(); // delete zipfile in cem_UI directory
Platform.runLater(() -> {
mwc.getPlayBtn().setText("play");
mwc.getPlayBtn().setDisable(false);
mwc.saveSettings();
xmlController.saveSettings();
});
LOGGER.info("synchronization successful!");
} catch (Exception e) {
LOGGER.error("There was an error during syncronisation! Please open a new issue on the cemu_UI github page:", e);
LOGGER.error(
"There was an error during syncronisation! Please open a new issue on the cemu_UI github page:",
e);
}
}
});
@ -200,28 +211,17 @@ public class CloudController {
}
}
public String getFolderID(String cloudService) {
public String getFolderID(CloudService cloudService) {
String folderID = "";
if (cloudService != null) {
if (cloudService.equals("GoogleDrive")) {
if (cloudService == CloudService.GoogleDrive) {
folderID = googleDriveController.getFolderID();
}
if (cloudService.equals("Dropbox")) {
if (cloudService == CloudService.Dropbox) {
}
}
return folderID;
}
public void setFolderID(String folderID, String cloudService) {
if (cloudService != null) {
if (cloudService.equals("GoogleDrive")) {
googleDriveController.setFolderID(folderID);
}
if (cloudService.equals("Dropbox")) {
}
}
}
}

243
src/main/java/com/cemu_UI/controller/DBController.java

@ -1,7 +1,7 @@
/**
* cemu_UI
*
* Copyright 2017 <@Seil0>
* Copyright 2017-2019 <@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
@ -28,6 +28,7 @@ import java.io.IOException;
import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
@ -45,100 +46,94 @@ import org.apache.logging.log4j.Logger;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import com.cemu_UI.application.MainWindowController;
import com.cemu_UI.datatypes.UIROMDataType;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
public class DBController {