2017-04-06 12:00:36 +02:00
/ * *
* cemu_UI
*
* Copyright 2017 < @Seil0 >
*
2017-10-15 13:37:45 +02:00
* 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 .
2017-04-06 12:00:36 +02:00
*
2017-10-15 13:37:45 +02:00
* 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 .
2017-04-06 12:00:36 +02:00
* /
2017-10-15 13:37:45 +02:00
2017-11-13 16:44:39 +01:00
package com.cemu_UI.application ;
2017-03-23 13:44:21 +01:00
2017-07-16 00:13:43 +02:00
import java.awt.Desktop ;
2017-03-23 13:44:21 +01:00
import java.awt.Graphics2D ;
import java.awt.image.BufferedImage ;
import java.io.File ;
import java.io.FileInputStream ;
import java.io.FileOutputStream ;
import java.io.IOException ;
import java.io.InputStream ;
import java.io.OutputStream ;
2017-03-28 17:40:01 +02:00
import java.math.BigInteger ;
2017-06-18 14:45:13 +02:00
import java.net.HttpURLConnection ;
2017-06-18 00:33:07 +02:00
import java.net.MalformedURLException ;
2017-07-16 00:13:43 +02:00
import java.net.URI ;
2017-06-18 00:33:07 +02:00
import java.net.URISyntaxException ;
import java.net.URL ;
2017-03-23 13:44:21 +01:00
import java.sql.SQLException ;
2017-03-23 16:17:38 +01:00
import java.time.LocalDate ;
import java.time.format.DateTimeFormatter ;
2017-06-18 13:01:04 +02:00
import java.util.ArrayList ;
2017-03-23 13:44:21 +01:00
import java.util.Optional ;
import java.util.Properties ;
2017-10-26 23:40:09 +02:00
2017-03-23 13:44:21 +01:00
import javax.imageio.ImageIO ;
2017-06-18 14:45:13 +02:00
import javax.swing.ProgressMonitor ;
import javax.swing.ProgressMonitorInputStream ;
2017-03-23 13:44:21 +01:00
import org.apache.commons.io.FileUtils ;
2017-08-27 20:44:08 +02:00
import org.apache.logging.log4j.LogManager ;
import org.apache.logging.log4j.Logger ;
2017-08-27 17:25:41 +02:00
2017-11-14 12:02:39 +01:00
import com.cemu_UI.controller.SmmdbAPIController ;
2017-11-13 16:44:39 +01:00
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 ;
2017-03-23 13:44:21 +01:00
import com.jfoenix.controls.JFXButton ;
import com.jfoenix.controls.JFXColorPicker ;
2017-11-13 16:44:39 +01:00
import com.jfoenix.controls.JFXDialog ;
import com.jfoenix.controls.JFXDialogLayout ;
2017-03-23 13:44:21 +01:00
import com.jfoenix.controls.JFXHamburger ;
import com.jfoenix.controls.JFXTextField ;
import com.jfoenix.controls.JFXToggleButton ;
2017-06-16 16:23:03 +02:00
import com.jfoenix.controls.JFXTreeTableColumn ;
import com.jfoenix.controls.JFXTreeTableView ;
2017-03-23 13:44:21 +01:00
import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition ;
2017-05-25 19:07:16 +02:00
2017-03-23 13:44:21 +01:00
import javafx.animation.FadeTransition ;
import javafx.animation.ParallelTransition ;
import javafx.animation.TranslateTransition ;
2017-06-16 16:23:03 +02:00
import javafx.beans.value.ChangeListener ;
import javafx.beans.value.ObservableValue ;
2017-04-06 12:00:36 +02:00
import javafx.collections.FXCollections ;
import javafx.collections.ObservableList ;
2017-03-23 13:44:21 +01:00
import javafx.event.ActionEvent ;
import javafx.event.EventHandler ;
import javafx.fxml.FXML ;
2017-03-26 14:21:19 +02:00
import javafx.geometry.Insets ;
2017-03-23 13:44:21 +01:00
import javafx.scene.control.Alert ;
2017-03-26 14:21:19 +02:00
import javafx.scene.control.Alert.AlertType ;
2017-10-30 17:52:45 +01:00
import javafx.scene.control.Button ;
import javafx.scene.control.ButtonBar.ButtonData ;
2017-03-23 13:44:21 +01:00
import javafx.scene.control.ButtonType ;
2017-11-10 15:58:20 +01:00
import javafx.scene.control.ChoiceBox ;
2017-03-23 13:44:21 +01:00
import javafx.scene.control.ContextMenu ;
2017-10-30 17:52:45 +01:00
import javafx.scene.control.Dialog ;
2017-03-23 13:44:21 +01:00
import javafx.scene.control.Label ;
import javafx.scene.control.MenuItem ;
import javafx.scene.control.ScrollPane ;
2017-10-30 17:52:45 +01:00
import javafx.scene.control.TextField ;
2017-06-16 16:23:03 +02:00
import javafx.scene.control.TreeItem ;
2017-03-23 13:44:21 +01:00
import javafx.scene.image.Image ;
import javafx.scene.image.ImageView ;
2017-07-16 00:13:43 +02:00
import javafx.scene.input.MouseButton ;
2017-03-23 13:44:21 +01:00
import javafx.scene.input.MouseEvent ;
import javafx.scene.layout.AnchorPane ;
2017-10-30 17:52:45 +01:00
import javafx.scene.layout.GridPane ;
2017-03-23 13:44:21 +01:00
import javafx.scene.layout.HBox ;
2017-11-13 16:44:39 +01:00
import javafx.scene.layout.StackPane ;
2017-03-23 13:44:21 +01:00
import javafx.scene.layout.VBox ;
import javafx.scene.paint.Color ;
2017-03-26 14:21:19 +02:00
import javafx.scene.paint.Paint ;
2017-03-23 13:44:21 +01:00
import javafx.scene.text.Font ;
import javafx.scene.text.FontWeight ;
2017-06-18 13:01:04 +02:00
import javafx.scene.text.Text ;
2017-06-18 00:33:07 +02:00
import javafx.scene.text.TextFlow ;
2017-03-23 13:44:21 +01:00
import javafx.stage.DirectoryChooser ;
import javafx.stage.FileChooser ;
import javafx.util.Duration ;
2017-08-26 00:13:09 +02:00
import net.lingala.zip4j.core.ZipFile ;
import net.lingala.zip4j.exception.ZipException ;
2017-03-23 13:44:21 +01:00
public class MainWindowController {
@FXML
private JFXButton aboutBtn ;
@FXML
private JFXButton settingsBtn ;
@FXML
private JFXButton addBtn ;
2017-03-25 15:18:45 +01:00
@FXML
private JFXButton reloadRomsBtn ;
2017-05-25 19:07:16 +02:00
@FXML
private JFXButton smmdbBtn ;
2017-03-23 13:44:21 +01:00
@FXML
private JFXButton cemuTFBtn ;
@FXML
private JFXButton romTFBtn ;
2017-10-24 22:41:56 +02:00
@FXML
private JFXButton updateBtn ;
2017-03-23 13:44:21 +01:00
@FXML
2017-06-18 00:33:07 +02:00
private JFXButton smmdbDownloadBtn ;
2017-03-23 13:44:21 +01:00
2017-03-23 16:17:38 +01:00
@FXML
2017-06-18 00:33:07 +02:00
private JFXButton playBtn ;
2017-03-23 16:17:38 +01:00
@FXML
private JFXButton lastTimePlayedBtn ;
2017-06-18 00:33:07 +02:00
@FXML
2017-09-12 15:04:21 +02:00
JFXButton totalPlaytimeBtn ;
2017-06-18 00:33:07 +02:00
2017-03-23 13:44:21 +01:00
@FXML
private JFXHamburger menuHam ;
@FXML
private JFXTextField cemuTextField ;
@FXML
private JFXTextField romTextField ;
2017-06-18 00:33:07 +02:00
@FXML
private TextFlow smmdbTextFlow ;
2017-03-23 13:44:21 +01:00
@FXML
2017-10-24 22:41:56 +02:00
private JFXColorPicker colorPicker ;
2017-03-23 13:44:21 +01:00
@FXML
2017-10-24 22:41:56 +02:00
private JFXToggleButton cloudSyncToggleBtn ;
2017-04-17 00:58:49 +02:00
@FXML
2017-10-24 22:41:56 +02:00
private JFXToggleButton autoUpdateToggleBtn ;
@FXML
private JFXToggleButton fullscreenToggleBtn ;
2017-11-10 15:58:20 +01:00
@FXML
private ChoiceBox < String > branchChoisBox ;
2017-03-23 13:44:21 +01:00
@FXML
2017-10-24 22:41:56 +02:00
private AnchorPane mainAnchorPane ;
2017-03-23 13:44:21 +01:00
2017-05-25 19:07:16 +02:00
@FXML
2017-10-24 22:41:56 +02:00
private AnchorPane gamesAnchorPane ;
2017-05-25 19:07:16 +02:00
2017-03-23 13:44:21 +01:00
@FXML
2017-10-24 22:41:56 +02:00
private AnchorPane settingsAnchorPane ;
2017-03-23 13:44:21 +01:00
2017-09-12 19:45:39 +02:00
@FXML
2017-10-24 22:41:56 +02:00
private AnchorPane smmdbAnchorPane ;
@FXML
private ScrollPane mainScrollPane ;
2017-09-12 19:45:39 +02:00
2017-03-23 13:44:21 +01:00
@FXML
2017-10-24 22:41:56 +02:00
private ScrollPane settingsScrollPane ;
2017-03-23 13:44:21 +01:00
2017-06-18 00:33:07 +02:00
@FXML
private ScrollPane smmdbScrollPane ;
2017-03-23 13:44:21 +01:00
@FXML
private VBox sideMenuVBox ;
@FXML
private HBox topHBox ;
2017-06-18 00:33:07 +02:00
@FXML
private ImageView smmdbImageView ;
2017-07-16 00:13:43 +02:00
@FXML
private Label helpLabel ;
2017-10-24 22:41:56 +02:00
@FXML
private Label cemu_UISettingsLbl ;
@FXML
private Label cemuDirectoryLbl ;
@FXML
private Label romDirectoryLbl ;
@FXML
private Label mainColorLbl ;
@FXML
private Label updateLbl ;
2017-11-10 15:58:20 +01:00
@FXML
private Label branchLbl ;
2017-10-24 22:41:56 +02:00
@FXML
private Label cemuSettingsLbl ;
2017-06-16 16:23:03 +02:00
@FXML
2017-06-16 23:35:56 +02:00
private JFXTreeTableView < CourseTableDataType > courseTreeTable = new JFXTreeTableView < CourseTableDataType > ( ) ;
2017-06-16 16:23:03 +02:00
@FXML
2017-08-26 00:13:09 +02:00
TreeItem < CourseTableDataType > root = new TreeItem < > ( new CourseTableDataType ( " " , " " , 0 , 0 ) ) ;
2017-06-16 16:23:03 +02:00
@FXML
2017-06-16 23:35:56 +02:00
private JFXTreeTableColumn < CourseTableDataType , String > titleColumn = new JFXTreeTableColumn < > ( " title " ) ;
2017-06-16 16:23:03 +02:00
@FXML
2017-08-26 00:13:09 +02:00
private JFXTreeTableColumn < CourseTableDataType , String > idColumn = new JFXTreeTableColumn < > ( " id " ) ;
2017-06-16 16:23:03 +02:00
@FXML
2017-08-26 00:13:09 +02:00
private JFXTreeTableColumn < CourseTableDataType , Integer > starsColumn = new JFXTreeTableColumn < > ( " stars " ) ;
2017-06-16 16:23:03 +02:00
@FXML
2017-08-26 00:13:09 +02:00
private JFXTreeTableColumn < CourseTableDataType , Integer > timeColumn = new JFXTreeTableColumn < > ( " time " ) ;
2017-06-16 16:23:03 +02:00
2017-03-28 17:40:01 +02:00
Main main ;
dbController dbController ;
2017-11-14 12:02:39 +01:00
SmmdbAPIController smmdbAPIController ;
2017-03-28 17:40:01 +02:00
playGame playGame ;
2017-11-06 10:42:31 +01:00
private UpdateController updateController ;
2017-03-23 13:44:21 +01:00
private boolean menuTrue = false ;
private boolean settingsTrue = false ;
private boolean playTrue = false ;
2017-06-16 16:23:03 +02:00
private boolean smmdbTrue = false ;
2017-11-06 10:42:31 +01:00
private boolean autoUpdate = false ;
2017-11-10 15:58:20 +01:00
private boolean useBeta = false ;
2017-03-23 13:44:21 +01:00
private boolean fullscreen ;
2017-04-17 00:58:49 +02:00
private boolean cloudSync ;
2017-06-01 16:21:24 +02:00
private String cloudService = " " ; //set cloud provider (at the moment only GoogleDrive, Dropbox is planed)
2017-03-23 13:44:21 +01:00
private String cemuPath ;
private String romPath ;
private String gameExecutePath ;
private String color ;
2017-08-01 20:11:17 +02:00
private String dialogBtnStyle ;
2017-08-27 20:44:08 +02:00
private String selectedGameTitleID ;
private String selectedGameTitle ;
private String id ;
2017-11-14 23:44:49 +01:00
private String version = " 0.2.1 " ;
private String buildNumber = " 055 " ;
2017-10-24 21:07:49 +02:00
private String versionName = " Puzzle Plank Galaxy " ;
2017-03-23 13:44:21 +01:00
private int xPos = - 200 ;
private int yPos = 17 ;
private int xPosHelper ;
2017-09-15 19:23:44 +02:00
private int oldXPosHelper ;
2017-04-06 12:00:36 +02:00
private int selectedUIDataIndex ;
2017-06-16 16:23:03 +02:00
private int selected ;
2017-09-12 20:13:26 +02:00
private double windowWidth ;
private double windowHeight ;
2017-03-23 13:44:21 +01:00
private DirectoryChooser directoryChooser = new DirectoryChooser ( ) ;
private File dirWin = new File ( System . getProperty ( " user.home " ) + " /Documents/cemu_UI " ) ;
private File dirLinux = new File ( System . getProperty ( " user.home " ) + " /cemu_UI " ) ;
2017-08-30 11:29:58 +02:00
private File configFileWin = new File ( dirWin + " /config.xml " ) ;
private File configFileLinux = new File ( dirLinux + " /config.xml " ) ;
2017-11-13 16:44:39 +01:00
private File pictureCacheWin = new File ( dirWin + " /picture_cache " ) ;
private File pictureCacheLinux = new File ( dirLinux + " /picture_cache " ) ;
2017-11-10 15:58:20 +01:00
private ObservableList < String > branches = FXCollections . observableArrayList ( " stable " , " beta " ) ;
2017-08-24 22:04:06 +02:00
private ObservableList < String > smmIDs = FXCollections . observableArrayList ( " fe31b7f2 " , " 44fc5929 " ) ; //TODO add more IDs
2017-06-16 23:35:56 +02:00
private ObservableList < UIROMDataType > games = FXCollections . observableArrayList ( ) ;
2017-06-16 16:37:56 +02:00
ObservableList < SmmdbApiDataType > courses = FXCollections . observableArrayList ( ) ;
2017-06-18 13:01:04 +02:00
ArrayList < Text > courseText = new ArrayList < Text > ( ) ;
ArrayList < Text > nameText = new ArrayList < Text > ( ) ;
2017-03-23 13:44:21 +01:00
Properties props = new Properties ( ) ;
Properties gameProps = new Properties ( ) ;
2017-08-27 20:44:08 +02:00
private static final Logger LOGGER = LogManager . getLogger ( MainWindowController . class . getName ( ) ) ;
2017-10-30 18:28:58 +01:00
private HamburgerBackArrowBasicTransition burgerTask ;
2017-03-23 13:44:21 +01:00
private MenuItem edit = new MenuItem ( " edit " ) ;
private MenuItem remove = new MenuItem ( " remove " ) ;
private MenuItem update = new MenuItem ( " update " ) ;
private MenuItem addDLC = new MenuItem ( " add DLC " ) ;
private ContextMenu gameContextMenu = new ContextMenu ( edit , remove , update , addDLC ) ;
private Label lastGameLabel = new Label ( ) ;
2017-11-13 16:44:39 +01:00
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 " ) ;
2017-03-23 13:44:21 +01:00
public void setMain ( Main main ) {
this . main = main ;
2017-03-25 15:18:45 +01:00
dbController = new dbController ( this ) ;
2017-11-14 12:02:39 +01:00
smmdbAPIController = new SmmdbAPIController ( ) ;
2017-03-23 13:44:21 +01:00
}
2017-09-12 20:13:26 +02:00
void initUI ( ) {
2017-10-14 15:42:13 +02:00
LOGGER . info ( " initializing UI ... " ) ;
2017-09-12 20:13:26 +02:00
if ( getWindowWidth ( ) > 100 & & getWindowHeight ( ) > 100 ) {
mainAnchorPane . setPrefSize ( getWindowWidth ( ) , getWindowHeight ( ) ) ;
}
refreshplayBtnPosition ( ) ;
2017-03-23 13:44:21 +01:00
cemuTextField . setText ( cemuPath ) ;
romTextField . setText ( romPath ) ;
colorPicker . setValue ( Color . valueOf ( getColor ( ) ) ) ;
fullscreenToggleBtn . setSelected ( isFullscreen ( ) ) ;
2017-04-25 22:16:30 +02:00
cloudSyncToggleBtn . setSelected ( isCloudSync ( ) ) ;
2017-11-06 10:42:31 +01:00
autoUpdateToggleBtn . setSelected ( isAutoUpdate ( ) ) ;
2017-11-10 15:58:20 +01:00
branchChoisBox . setItems ( branches ) ;
if ( isUseBeta ( ) ) {
branchChoisBox . getSelectionModel ( ) . select ( 1 ) ;
} else {
branchChoisBox . getSelectionModel ( ) . select ( 0 ) ;
}
2017-03-23 13:44:21 +01:00
applyColor ( ) ;
2017-06-16 16:23:03 +02:00
//initialize courseTable
2017-06-18 13:01:04 +02:00
titleColumn . setPrefWidth ( 160 ) ;
2017-08-26 00:13:09 +02:00
timeColumn . setPrefWidth ( 127 ) ;
2017-06-18 00:33:07 +02:00
starsColumn . setPrefWidth ( 100 ) ;
2017-06-16 16:23:03 +02:00
courseTreeTable . setRoot ( root ) ;
courseTreeTable . setShowRoot ( false ) ;
courseTreeTable . setEditable ( false ) ;
titleColumn . setCellValueFactory ( cellData - > cellData . getValue ( ) . getValue ( ) . title ) ;
2017-08-26 00:13:09 +02:00
idColumn . setCellValueFactory ( cellData - > cellData . getValue ( ) . getValue ( ) . id ) ;
2017-06-16 16:23:03 +02:00
starsColumn . setCellValueFactory ( cellData - > cellData . getValue ( ) . getValue ( ) . stars . asObject ( ) ) ;
2017-08-26 00:13:09 +02:00
timeColumn . setCellValueFactory ( cellData - > cellData . getValue ( ) . getValue ( ) . time . asObject ( ) ) ;
2017-06-16 16:23:03 +02:00
2017-08-27 18:21:56 +02:00
courseTreeTable . getColumns ( ) . add ( titleColumn ) ;
courseTreeTable . getColumns ( ) . add ( timeColumn ) ;
courseTreeTable . getColumns ( ) . add ( starsColumn ) ;
courseTreeTable . getColumns ( ) . add ( idColumn ) ;
2017-06-16 16:23:03 +02:00
courseTreeTable . getColumns ( ) . get ( 3 ) . setVisible ( false ) ; //hide idColumn (important)
2017-10-14 15:42:13 +02:00
LOGGER . info ( " initializing UI done " ) ;
2017-03-23 13:44:21 +01:00
}
2017-08-26 00:13:09 +02:00
/ * *
* initialize all actions not initialized by a own method
* /
2017-03-23 13:44:21 +01:00
void initActions ( ) {
2017-09-12 19:45:39 +02:00
LOGGER . info ( " initializing Actions ... " ) ;
2017-03-23 13:44:21 +01:00
2017-10-30 18:28:58 +01:00
burgerTask = new HamburgerBackArrowBasicTransition ( menuHam ) ;
2017-03-23 13:44:21 +01:00
menuHam . addEventHandler ( MouseEvent . MOUSE_PRESSED , ( e ) - > {
2017-06-16 16:23:03 +02:00
if ( playTrue ) {
2017-03-23 13:44:21 +01:00
playBtnSlideOut ( ) ;
}
2017-10-13 21:15:51 +02:00
if ( menuTrue ) {
2017-03-23 13:44:21 +01:00
sideMenuSlideOut ( ) ;
burgerTask . setRate ( - 1 . 0 ) ;
burgerTask . play ( ) ;
menuTrue = false ;
2017-10-30 18:28:58 +01:00
} else {
2017-06-16 16:23:03 +02:00
sideMenuSlideIn ( ) ;
burgerTask . setRate ( 1 . 0 ) ;
burgerTask . play ( ) ;
menuTrue = true ;
2017-03-23 13:44:21 +01:00
}
2017-06-16 16:23:03 +02:00
if ( settingsTrue ) {
2017-10-24 22:41:56 +02:00
settingsScrollPane . setVisible ( false ) ;
2017-03-23 13:44:21 +01:00
// setPath(tfPath.getText());
saveSettings ( ) ;
settingsTrue = false ;
}
2017-06-16 16:23:03 +02:00
if ( smmdbTrue ) {
smmdbAnchorPane . setVisible ( false ) ;
smmdbTrue = false ;
}
2017-03-23 13:44:21 +01:00
} ) ;
edit . setOnAction ( new EventHandler < ActionEvent > ( ) {
@Override
public void handle ( ActionEvent event ) {
2017-09-15 19:23:44 +02:00
LOGGER . info ( " edit " + selectedGameTitleID ) ;
2017-03-23 13:44:21 +01:00
if ( selectedGameTitleID = = null ) {
2017-09-15 19:23:44 +02:00
LOGGER . warn ( " trying to edit null! null is not valid! " ) ;
2017-03-23 13:44:21 +01:00
Alert alert = new Alert ( AlertType . WARNING ) ;
alert . setTitle ( " edit " ) ;
alert . setHeaderText ( " cemu_UI " ) ;
alert . setContentText ( " please select a game, \" " + selectedGameTitleID + " \" is not a valid type " ) ;
alert . initOwner ( main . primaryStage ) ;
alert . showAndWait ( ) ;
} else {
2017-10-31 14:11:17 +01:00
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 ( ) + " \" " ) ;
}
2017-03-23 13:44:21 +01:00
}
}
} ) ;
remove . setOnAction ( new EventHandler < ActionEvent > ( ) {
2017-06-29 14:52:58 +02:00
@Override
2017-03-23 13:44:21 +01:00
public void handle ( ActionEvent event ) {
2017-09-15 19:23:44 +02:00
LOGGER . info ( " remove " + selectedGameTitleID ) ;
2017-03-23 13:44:21 +01:00
if ( selectedGameTitleID = = null ) {
2017-09-15 19:23:44 +02:00
LOGGER . warn ( " trying to remove null! null is not valid! " ) ;
2017-03-23 13:44:21 +01:00
Alert alert = new Alert ( AlertType . WARNING ) ;
alert . setTitle ( " remove " ) ;
alert . setHeaderText ( " cemu_UI " ) ;
alert . setContentText ( " please select a game, \" " + selectedGameTitleID + " \" is not a valid type " ) ;
2017-03-28 17:40:01 +02:00
2017-03-23 13:44:21 +01:00
alert . initOwner ( main . primaryStage ) ;
alert . showAndWait ( ) ;
}
else {
2017-03-25 15:18:45 +01:00
Alert alert = new Alert ( AlertType . CONFIRMATION ) ;
alert . setTitle ( " remove " ) ;
alert . setHeaderText ( " cemu_UI " ) ;
alert . setContentText ( " Are you sure you want to delete " + selectedGameTitle + " ? " ) ;
alert . initOwner ( main . primaryStage ) ;
Optional < ButtonType > result = alert . showAndWait ( ) ;
if ( result . get ( ) = = ButtonType . OK ) {
try {
2017-09-12 19:45:39 +02:00
//remove game from database
2017-04-06 12:00:36 +02:00
games . remove ( selectedUIDataIndex ) ;
2017-03-25 15:18:45 +01:00
dbController . removeRom ( selectedGameTitleID ) ;
2017-09-12 19:45:39 +02:00
//refresh all games at gamesAnchorPane (UI)
refreshUIData ( ) ;
2017-04-06 12:00:36 +02:00
} catch ( Exception e ) {
2017-09-12 19:45:39 +02:00
LOGGER . error ( " error! " , e ) ;
2017-03-25 15:18:45 +01:00
}
}
2017-03-23 13:44:21 +01:00
}
}
} ) ;
update . setOnAction ( new EventHandler < ActionEvent > ( ) {
@Override
public void handle ( ActionEvent event ) {
String titleID = selectedGameTitleID ;
String updatePath ;
2017-09-15 19:23:44 +02:00
LOGGER . info ( " update: " + selectedGameTitleID ) ;
2017-03-23 13:44:21 +01:00
if ( selectedGameTitleID = = null ) {
2017-09-15 19:23:44 +02:00
LOGGER . warn ( " trying to update null! null is not valid! " ) ;
2017-03-23 13:44:21 +01:00
Alert alert = new Alert ( AlertType . WARNING ) ;
alert . setTitle ( " edit " ) ;
alert . setHeaderText ( " cemu_UI " ) ;
alert . setContentText ( " please select a game, \" " + selectedGameTitleID + " \" is not a valid type " ) ;
alert . initOwner ( main . primaryStage ) ;
alert . showAndWait ( ) ;
} else {
Alert updateAlert = new Alert ( AlertType . CONFIRMATION ) ; //new alert with file-chooser
updateAlert . setTitle ( " cemu_UI " ) ;
2017-03-23 16:17:38 +01:00
updateAlert . setHeaderText ( " update " + selectedGameTitle ) ;
2017-03-25 15:18:45 +01:00
updateAlert . setContentText ( " pleas select the update root directory " ) ;
2017-03-23 13:44:21 +01:00
updateAlert . initOwner ( main . primaryStage ) ;
Optional < ButtonType > result = updateAlert . showAndWait ( ) ;
if ( result . get ( ) = = ButtonType . OK ) {
DirectoryChooser directoryChooser = new DirectoryChooser ( ) ;
File selectedDirecroty = directoryChooser . showDialog ( main . primaryStage ) ;
updatePath = selectedDirecroty . getAbsolutePath ( ) ;
String [ ] parts = titleID . split ( " - " ) ; //split string into 2 parts at "-"
File srcDir = new File ( updatePath ) ;
File destDir = new File ( cemuPath + " \\ mlc01 \\ usr \\ title \\ " + parts [ 0 ] + " \\ " + parts [ 1 ] ) ;
2017-08-30 11:29:58 +02:00
LOGGER . info ( updatePath ) ;
LOGGER . info ( destDir . toString ( ) ) ;
2017-03-23 13:44:21 +01:00
if ( destDir . exists ( ) ! = true ) {
destDir . mkdir ( ) ;
}
try {
2017-08-30 11:29:58 +02:00
LOGGER . info ( " copying files... " ) ;
2017-03-23 16:17:38 +01:00
playBtn . setText ( " updating... " ) ;
playBtn . setDisable ( true ) ;
FileUtils . copyDirectory ( srcDir , destDir ) ; //TODO progress indicator
playBtn . setText ( " play " ) ;
playBtn . setDisable ( false ) ;
2017-08-30 11:29:58 +02:00
LOGGER . info ( " copying files done! " ) ;
2017-03-23 13:44:21 +01:00
} catch ( IOException e ) {
e . printStackTrace ( ) ;
}
} else {
updatePath = null ;
}
}
}
} ) ;
addDLC . setOnAction ( new EventHandler < ActionEvent > ( ) {
@Override
public void handle ( ActionEvent event ) {
2017-03-26 14:21:19 +02:00
String titleID = selectedGameTitleID ;
String dlcPath ;
2017-08-30 11:29:58 +02:00
LOGGER . info ( " add DLC: " + selectedGameTitleID ) ;
2017-03-26 14:21:19 +02:00
if ( selectedGameTitleID = = null ) {
2017-09-15 19:23:44 +02:00
LOGGER . warn ( " trying to add a dlc to null! null is not valid! " ) ;
2017-03-26 14:21:19 +02:00
Alert alert = new Alert ( AlertType . WARNING ) ;
alert . setTitle ( " add DLC " ) ;
alert . setHeaderText ( " cemu_UI " ) ;
alert . setContentText ( " please select a game, \" " + selectedGameTitleID + " \" is not a valid type " ) ;
alert . initOwner ( main . primaryStage ) ;
alert . showAndWait ( ) ;
} else {
Alert updateAlert = new Alert ( AlertType . CONFIRMATION ) ; //new alert with file-chooser
updateAlert . setTitle ( " cemu_UI " ) ;
updateAlert . setHeaderText ( " add a DLC to " + selectedGameTitle ) ;
updateAlert . setContentText ( " pleas select the DLC root directory " ) ;
updateAlert . initOwner ( main . primaryStage ) ;
Optional < ButtonType > result = updateAlert . showAndWait ( ) ;
if ( result . get ( ) = = ButtonType . OK ) {
DirectoryChooser directoryChooser = new DirectoryChooser ( ) ;
File selectedDirecroty = directoryChooser . showDialog ( main . primaryStage ) ;
dlcPath = selectedDirecroty . getAbsolutePath ( ) ;
String [ ] parts = titleID . split ( " - " ) ; //split string into 2 parts at "-"
File srcDir = new File ( dlcPath ) ;
File destDir = new File ( cemuPath + " \\ mlc01 \\ usr \\ title \\ " + parts [ 0 ] + " \\ " + parts [ 1 ] + " \\ aoc " ) ;
2017-08-30 11:29:58 +02:00
LOGGER . info ( dlcPath ) ;
LOGGER . info ( destDir . toString ( ) ) ;
2017-03-26 14:21:19 +02:00
if ( destDir . exists ( ) ! = true ) {
destDir . mkdir ( ) ;
}
try {
2017-08-30 11:29:58 +02:00
LOGGER . info ( " copying files... " ) ;
2017-03-26 14:21:19 +02:00
playBtn . setText ( " copying files... " ) ;
playBtn . setDisable ( true ) ;
FileUtils . copyDirectory ( srcDir , destDir ) ; //TODO progress indicator
playBtn . setText ( " play " ) ;
playBtn . setDisable ( false ) ;
2017-08-30 11:29:58 +02:00
LOGGER . info ( " copying files done! " ) ;
2017-03-26 14:21:19 +02:00
} catch ( IOException e ) {
e . printStackTrace ( ) ;
}
} else {
dlcPath = null ;
}
}
2017-03-23 13:44:21 +01:00
}
} ) ;
gamesAnchorPane . addEventHandler ( MouseEvent . MOUSE_CLICKED , new EventHandler < MouseEvent > ( ) {
@Override
public void handle ( MouseEvent event ) {
if ( playTrue ) {
playBtnSlideOut ( ) ;
}
}
} ) ;
topHBox . addEventHandler ( MouseEvent . MOUSE_CLICKED , new EventHandler < MouseEvent > ( ) {
@Override
public void handle ( MouseEvent event ) {
if ( playTrue ) {
playBtnSlideOut ( ) ;
}
}
} ) ;
2017-06-16 16:23:03 +02:00
//Change-listener for TreeTable
courseTreeTable . getSelectionModel ( ) . selectedItemProperty ( ) . addListener ( new ChangeListener < Object > ( ) {
@Override
public void changed ( ObservableValue < ? > observable , Object oldVal , Object newVal ) {
selected = courseTreeTable . getSelectionModel ( ) . getSelectedIndex ( ) ; //get selected item
2017-08-26 00:13:09 +02:00
//FIXME if a item is selected and you change the sorting,you can't select a new item
id = idColumn . getCellData ( selected ) ; //get name of selected item
2017-06-16 23:35:56 +02:00
for ( int i = 0 ; i < courses . size ( ) ; i + + ) {
2017-08-26 00:13:09 +02:00
if ( courses . get ( i ) . getId ( ) = = id ) {
try {
URL url = new URL ( " http://smmdb.ddns.net/courseimg/ " + id + " _full.jpg?v=3 " ) ;
Image image = new Image ( url . toURI ( ) . toString ( ) ) ;
smmdbImageView . setImage ( image ) ;
} catch ( MalformedURLException | URISyntaxException e ) {
e . printStackTrace ( ) ;
2017-06-18 13:01:04 +02:00
smmdbImageView . setImage ( close_black ) ;
2017-06-18 00:33:07 +02:00
}
2017-06-18 13:01:04 +02:00
addCourseDescription ( courses . get ( i ) ) ;
2017-06-16 23:35:56 +02:00
}
2017-06-18 13:01:04 +02:00
}
2017-06-16 16:23:03 +02:00
}
} ) ;
2017-07-16 00:13:43 +02:00
helpLabel . setOnMouseClicked ( new EventHandler < MouseEvent > ( ) {
@Override
public void handle ( MouseEvent mouseEvent ) {
if ( mouseEvent . getButton ( ) . equals ( MouseButton . PRIMARY ) ) {
try {
Desktop . getDesktop ( ) . browse ( new URI ( " https://github.com/Seil0/cemu_UI/issues/3 " ) ) ;
} catch ( IOException | URISyntaxException e ) {
e . printStackTrace ( ) ;
}
}
}
} ) ;
2017-11-10 15:58:20 +01:00
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 ( ) ;
}
} ) ;
2017-09-15 19:23:44 +02:00
2017-08-27 20:44:08 +02:00
LOGGER . info ( " initializing Actions done! " ) ;
2017-03-23 13:44:21 +01:00
}
@FXML
void detailsSlideoutBtnAction ( ActionEvent event ) {
playBtnSlideOut ( ) ;
}
@FXML
2017-11-10 17:11:19 +01:00
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 ( ) ;
2017-03-23 16:17:38 +01:00
}
2017-03-23 13:44:21 +01:00
@FXML
void settingsBtnAction ( ActionEvent event ) {
2017-06-18 13:01:04 +02:00
if ( smmdbTrue ) {
smmdbAnchorPane . setVisible ( false ) ;
smmdbTrue = false ;
}
if ( settingsTrue ) {
2017-10-24 22:41:56 +02:00
settingsScrollPane . setVisible ( false ) ;
2017-06-18 13:01:04 +02:00
settingsTrue = false ;
2017-03-23 13:44:21 +01:00
saveSettings ( ) ;
2017-06-18 13:01:04 +02:00
} else {
2017-10-24 22:41:56 +02:00
settingsScrollPane . setVisible ( true ) ;
2017-06-18 13:01:04 +02:00
settingsTrue = true ;
2017-03-23 13:44:21 +01:00
}
}
@FXML
2017-03-25 15:18:45 +01:00
void reloadRomsBtnAction ( ) throws IOException {
2017-03-26 14:21:19 +02:00
reloadRomsBtn . setText ( " reloading... " ) ;
dbController . loadRomDirectory ( getRomPath ( ) ) ; //TODO own thread
2017-03-25 15:18:45 +01:00
Runtime . getRuntime ( ) . exec ( " java -jar cemu_UI.jar " ) ; //start again (preventing Bugs)
System . exit ( 0 ) ; //finishes itself
}
2017-05-25 19:07:16 +02:00
@FXML
void smmdbBtnAction ( ) {
2017-06-16 16:23:03 +02:00
//show smmdbAnchorPane
if ( smmdbTrue ) {
smmdbAnchorPane . setVisible ( false ) ;
smmdbTrue = false ;
} else {
smmdbAnchorPane . setVisible ( true ) ;
smmdbTrue = true ;
2017-08-27 18:21:56 +02:00
//start query
courses . removeAll ( courses ) ;
2017-11-14 12:02:39 +01:00
courses . addAll ( smmdbAPIController . startQuery ( ) ) ;
2017-08-27 18:21:56 +02:00
//add query response to courseTreeTable
for ( int i = 0 ; i < courses . size ( ) ; i + + ) {
CourseTableDataType helpCourse = new CourseTableDataType ( courses . get ( i ) . getTitle ( ) , courses . get ( i ) . getId ( ) ,
courses . get ( i ) . getTime ( ) , courses . get ( i ) . getStars ( ) ) ;
root . getChildren ( ) . add ( new TreeItem < CourseTableDataType > ( helpCourse ) ) ; //add data to root-node
}
}
2017-05-25 19:07:16 +02:00
}
2017-06-04 20:15:04 +02:00
2017-03-25 15:18:45 +01:00
@FXML
void playBtnAction ( ActionEvent event ) throws InterruptedException , IOException {
dbController . setLastPlayed ( selectedGameTitleID ) ;
2017-03-28 17:40:01 +02:00
playGame = new playGame ( this , dbController ) ;
2017-03-25 15:18:45 +01:00
2017-03-28 17:40:01 +02:00
playGame . start ( ) ;
2017-03-25 15:18:45 +01:00
}
@FXML
2017-09-12 15:04:21 +02:00
void totalPlaytimeBtnAction ( ActionEvent event ) {
2017-03-25 15:18:45 +01:00
}
@FXML
void lastTimePlayedBtnAction ( ActionEvent event ) {
2017-03-23 13:44:21 +01:00
}
@FXML
void cemuTFBtnAction ( ActionEvent event ) {
2017-04-09 10:43:06 +02:00
File cemuDirectory = directoryChooser . showDialog ( main . primaryStage ) ;
2017-03-23 13:44:21 +01:00
if ( cemuDirectory = = null ) {
2017-08-30 11:29:58 +02:00
LOGGER . info ( " No Directory selected " ) ;
2017-03-23 13:44:21 +01:00
} else {
setCemuPath ( cemuDirectory . getAbsolutePath ( ) ) ;
saveSettings ( ) ;
cemuTextField . setText ( getCemuPath ( ) ) ;
try {
2017-04-06 23:20:43 +02:00
Runtime . getRuntime ( ) . exec ( " java -jar cemu_UI.jar " ) ; //start again
2017-03-23 13:44:21 +01:00
System . exit ( 0 ) ; //finishes itself
} catch ( IOException e ) {
2017-09-15 19:23:44 +02:00
LOGGER . error ( " an error occurred " , e ) ;
2017-03-23 13:44:21 +01:00
}
}
}
@FXML
void romTFBtnAction ( ActionEvent event ) {
File romDirectory = directoryChooser . showDialog ( main . primaryStage ) ;
if ( romDirectory = = null ) {
2017-08-30 11:29:58 +02:00
LOGGER . info ( " No Directory selected " ) ;
2017-03-23 13:44:21 +01:00
} else {
setRomPath ( romDirectory . getAbsolutePath ( ) ) ;
saveSettings ( ) ;
cemuTextField . setText ( getCemuPath ( ) ) ;
try {
2017-04-06 23:20:43 +02:00
Runtime . getRuntime ( ) . exec ( " java -jar cemu_UI.jar " ) ; //start again
2017-03-23 13:44:21 +01:00
System . exit ( 0 ) ; //finishes itself
} catch ( IOException e ) {
2017-09-15 19:23:44 +02:00
LOGGER . error ( " an error occurred " , e ) ;
2017-03-23 13:44:21 +01:00
}
}
}
2017-10-24 22:41:56 +02:00
@FXML
void updateBtnAction ( ActionEvent event ) {
2017-11-10 15:58:20 +01:00
updateController = new UpdateController ( this , buildNumber , useBeta ) ;
2017-11-06 10:42:31 +01:00
Thread updateThread = new Thread ( updateController ) ;
updateThread . setName ( " Updater " ) ;
updateThread . start ( ) ;
2017-10-24 22:41:56 +02:00
}
@FXML
void autoUpdateToggleBtnAction ( ActionEvent event ) {
2017-11-06 10:42:31 +01:00
if ( isAutoUpdate ( ) ) {
setAutoUpdate ( false ) ;
} else {
setAutoUpdate ( true ) ;
}
saveSettings ( ) ; }
2017-10-24 22:41:56 +02:00
2017-06-18 00:33:07 +02:00
@FXML
void smmdbDownloadBtnAction ( ActionEvent event ) {
2017-08-25 14:57:15 +02:00
String downloadUrl = " http://smmdb.ddns.net/api/downloadcourse?id= " + id + " &type=zip " ;
2017-08-26 00:13:09 +02:00
String downloadFileURL = getCemuPath ( ) + " / " + id + " .zip " ; //getCemuPath() + "/" + smmID + "/" + id + ".rar"
2017-07-16 00:13:43 +02:00
String outputFile = getCemuPath ( ) + " / " ;
2017-07-13 22:26:32 +02:00
2017-06-18 00:33:07 +02:00
try {
2017-06-18 14:45:13 +02:00
HttpURLConnection conn = ( HttpURLConnection ) new URL ( downloadUrl ) . 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.
2017-07-16 00:13:43 +02:00
FileUtils . copyInputStreamToFile ( pmis , new File ( downloadFileURL ) ) ; //download file + "/mlc01/emulatorSave"
pmis . close ( ) ;
2017-08-30 11:29:58 +02:00
LOGGER . info ( " downloaded successfull " ) ;
2017-07-16 00:13:43 +02:00
File downloadFile = new File ( downloadFileURL ) ;
2017-08-26 00:13:09 +02:00
String source = downloadFileURL ;
String destination = null ;
2017-08-27 17:25:41 +02:00
int highestCourseNumber = 0 ;
String courseName = null ;
2017-08-26 00:13:09 +02:00
for ( int i = 0 ; i < smmIDs . size ( ) ; i + + ) {
2017-08-27 17:25:41 +02:00
File smmDirectory = new File ( outputFile + " mlc01/emulatorSave/ " + smmIDs . get ( i ) ) ;
if ( smmDirectory . exists ( ) ) {
File [ ] courses = smmDirectory . listFiles ( File : : isDirectory ) ;
//get all existing courses in smm directory, new name is highest number +1
for ( int j = 0 ; j < courses . length ; j + + ) {
int courseNumber = Integer . parseInt ( courses [ j ] . getName ( ) . substring ( 6 ) ) ;
if ( courseNumber > highestCourseNumber ) {
highestCourseNumber = courseNumber ;
}
2017-08-26 00:13:09 +02:00
}
2017-08-27 17:25:41 +02:00
String number = " 000 " + ( highestCourseNumber + 1 ) ;
courseName = " course " + number . substring ( number . length ( ) - 3 , number . length ( ) ) ;
File courseDirectory = new File ( outputFile + " mlc01/emulatorSave/ " + smmIDs . get ( i ) + " / " ) ;
2017-08-27 18:21:56 +02:00
2017-08-26 00:13:09 +02:00
destination = courseDirectory . getPath ( ) ;
}
2017-07-13 22:26:32 +02:00
}
2017-07-16 00:13:43 +02:00
2017-08-27 17:25:41 +02:00
try {
2017-08-26 00:13:09 +02:00
ZipFile zipFile = new ZipFile ( source ) ;
zipFile . extractAll ( destination ) ;
2017-08-27 17:25:41 +02:00
//rename zipfile
File course = new File ( destination + " /course000 " ) ;
course . renameTo ( new File ( destination + " / " + courseName ) ) ;
2017-08-30 11:29:58 +02:00
LOGGER . info ( " Added new course: " + courseName + " , full path is: " + destination + " / " + courseName ) ;
2017-08-26 00:13:09 +02:00
} catch ( ZipException e ) {
2017-08-30 11:29:58 +02:00
LOGGER . error ( " an error occurred during unziping the file! " , e ) ;
2017-07-13 22:26:32 +02:00
}
2017-08-27 17:25:41 +02:00
2017-07-16 00:13:43 +02:00
downloadFile . delete ( ) ;
2017-06-18 14:45:13 +02:00
} catch ( IOException e ) {
2017-08-30 11:29:58 +02:00
LOGGER . error ( " something went wrong during downloading the course " , e ) ;
2017-06-18 00:33:07 +02:00
}
}
2017-03-23 13:44:21 +01:00
@FXML
void cemuTextFieldAction ( ActionEvent event ) {
setCemuPath ( cemuTextField . getText ( ) ) ;
2017-05-25 19:07:16 +02:00
saveSettings ( ) ;
2017-03-23 13:44:21 +01:00
}
@FXML
void romTextFieldAction ( ActionEvent event ) {
setRomPath ( romTextField . getText ( ) ) ;
2017-05-25 19:07:16 +02:00
saveSettings ( ) ;
2017-03-23 13:44:21 +01:00
}
@FXML
void fullscreenToggleBtnAction ( ActionEvent event ) {
if ( fullscreen ) {
fullscreen = false ;
} else {
fullscreen = true ;
}
2017-05-25 19:07:16 +02:00
saveSettings ( ) ;
2017-04-17 00:58:49 +02:00
}
@FXML
void cloudSyncToggleBtnAction ( ActionEvent event ) {
if ( cloudSync ) {
cloudSync = false ;
} else {
2017-11-14 23:44:49 +01:00
String headingText = " activate cloud savegame sync (beta) " ;
2017-11-11 22:27:19 +01:00
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 ( ) ;
2017-04-17 00:58:49 +02:00
}
2017-03-23 13:44:21 +01:00
}
@FXML
void colorPickerAction ( ActionEvent event ) {
editColor ( colorPicker . getValue ( ) . toString ( ) ) ;
applyColor ( ) ;
}
@FXML
void addBtnAction ( ActionEvent event ) {
String romPath = null ;
String coverPath = null ;
String coverName = null ;
String title = null ;
String titleID = null ;
File pictureCache ;
2017-10-31 14:11:17 +01:00
//new Dialog
2017-10-30 17:52:45 +01:00
Dialog < Integer > dialog = new Dialog < > ( ) ;
2017-10-30 18:28:58 +01:00
dialog . setTitle ( " add a new game " ) ;
dialog . setHeaderText ( " add a new game manually to cemu UI " ) ;
2017-03-23 13:44:21 +01:00
2017-10-30 17:52:45 +01:00
// Set the button types.
ButtonType okayBtn = new ButtonType ( " Okay " , ButtonData . OK_DONE ) ;
dialog . getDialogPane ( ) . getButtonTypes ( ) . addAll ( okayBtn , ButtonType . CANCEL ) ;
2017-03-23 13:44:21 +01:00
2017-10-30 17:52:45 +01:00
// 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 " ) ;
Button selectPathBtn = new Button ( " select .rpx file " ) ;
2017-10-30 18:28:58 +01:00
Button selectCoverBtn = new Button ( " select cover file " ) ;
2017-10-30 17:52:45 +01:00
2017-10-31 14:11:17 +01:00
selectPathBtn . setPrefWidth ( 110 ) ;
selectCoverBtn . setPrefWidth ( 110 ) ;
2017-10-30 17:52:45 +01:00
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 ( ) ;
2017-11-04 17:04:21 +01:00
LOGGER . info ( " New game data \" " + title + " \" , title-ID: " + titleID + " (not a bug!) " ) ;
2017-10-30 17:52:45 +01:00
}
2017-10-30 18:28:58 +01:00
2017-03-23 13:44:21 +01:00
/ * *
2017-11-04 17:04:21 +01:00
* if one parameter dosen ' t contain any value do not add the game
2017-10-31 14:11:17 +01:00
* else convert the cover to . png add copy it into the picture cache ,
2017-03-23 13:44:21 +01:00
* then add the rom to the local_roms database
* /
2017-10-31 14:11:17 +01:00
System . out . println ( romPath . length ( ) ) ;
if ( romPath . length ( ) = = 0 | | coverPath . length ( ) = = 0 | | title . length ( ) = = 0 | | titleID . length ( ) = = 0 ) {
2017-08-30 11:29:58 +02:00
LOGGER . info ( " No parameter set! " ) ;
2017-11-06 10:00:10 +01:00
//addGame error dialog
2017-11-13 16:44:39 +01:00
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 ( ) ;
2017-10-30 17:52:45 +01:00
} else {
2017-03-23 13:44:21 +01:00
coverName = new File ( coverPath ) . getName ( ) ;
try {
2017-10-30 17:52:45 +01:00
if ( System . getProperty ( " os.name " ) . equals ( " Linux " ) ) {
2017-11-13 16:44:39 +01:00
pictureCache = getPictureCacheLinux ( ) ;
2017-10-30 17:52:45 +01:00
} else {
2017-11-13 16:44:39 +01:00
pictureCache = getPictureCacheWin ( ) ;
2017-03-26 14:21:19 +02:00
}
2017-10-30 17:52:45 +01:00
BufferedImage originalImage = ImageIO . read ( new File ( coverPath ) ) ; //load cover
2017-03-26 14:21:19 +02:00
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 ;
2017-03-23 13:44:21 +01:00
} catch ( IOException e ) {
2017-10-30 17:52:45 +01:00
LOGGER . error ( " Ops something went wrong! Error while resizing cover. " , e ) ;
2017-03-23 13:44:21 +01:00
}
2017-03-26 14:21:19 +02:00
try {
dbController . addRom ( title , coverPath , romPath , titleID , " " , " " , " " , " 0 " ) ;
2017-03-23 13:44:21 +01:00
dbController . loadSingleRom ( titleID ) ;
2017-10-30 18:28:58 +01:00
refreshUIData ( ) ;
2017-03-23 13:44:21 +01:00
} catch ( SQLException e ) {
2017-10-30 17:52:45 +01:00
LOGGER . error ( " Oops, something went wrong! Error while adding a game. " , e ) ;
2017-03-23 13:44:21 +01:00
}
}
}
2017-05-25 19:07:16 +02:00
/ * *
2017-10-15 13:37:45 +02:00
* add game to games ( ArrayList ) and initialize all needed actions ( start , time stamps , titleID )
2017-05-25 19:07:16 +02:00
* @param title : game title
* @param coverPath : path to cover ( cache )
2017-10-15 13:37:45 +02:00
* @param romPath : path to ROM file ( . rpx )
* @param titleID : ROM ID
2017-05-25 19:07:16 +02:00
* /
2017-11-13 16:44:39 +01:00
public void addGame ( String title , String coverPath , String romPath , String titleID ) {
2017-03-23 13:44:21 +01:00
VBox VBox = new VBox ( ) ;
2017-10-15 13:37:45 +02:00
Label gameTitleLabel = new Label ( ) ;
2017-03-23 13:44:21 +01:00
JFXButton gameBtn = new JFXButton ( ) ;
2017-10-15 13:37:45 +02:00
ImageView imageView = new ImageView ( ) ;
Image coverImage = new Image ( new File ( coverPath ) . toURI ( ) . toString ( ) ) ;
2017-03-23 13:44:21 +01:00
generatePosition ( ) ;
2017-10-24 21:06:25 +02:00
2017-10-15 13:37:45 +02:00
UIROMDataType uiROMElement = new UIROMDataType ( VBox , gameTitleLabel , gameBtn , imageView , titleID , romPath ) ;
uiROMElement . getLabel ( ) . setText ( title ) ;
uiROMElement . getLabel ( ) . setMaxWidth ( 200 ) ;
uiROMElement . getLabel ( ) . setPadding ( new Insets ( 0 , 0 , 0 , 8 ) ) ;
uiROMElement . getLabel ( ) . setFont ( Font . font ( " System " , FontWeight . BOLD , 14 ) ) ;
// i think we can do this locally and remove the imageView from the data type since it's used as graphic
uiROMElement . getImageView ( ) . setImage ( coverImage ) ;
uiROMElement . getImageView ( ) . setFitHeight ( 300 ) ;
uiROMElement . getImageView ( ) . setFitWidth ( 200 ) ;
uiROMElement . getButton ( ) . setGraphic ( uiROMElement . getImageView ( ) ) ;
uiROMElement . getButton ( ) . setContextMenu ( gameContextMenu ) ;
uiROMElement . getButton ( ) . setStyle ( " -fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 3); " ) ;
uiROMElement . getButton ( ) . addEventHandler ( MouseEvent . MOUSE_CLICKED , new EventHandler < MouseEvent > ( ) {
@Override
public void handle ( MouseEvent event ) {
LOGGER . info ( " selected: " + title + " ; ID: " + titleID ) ;
// getting the selected game index by comparing event.getSource() with games.get(i).getButton()
for ( int i = 0 ; i < games . size ( ) ; i + + ) {
if ( games . get ( i ) . getButton ( ) = = event . getSource ( ) ) {
selectedUIDataIndex = i ;
}
}
gameExecutePath = romPath ;
selectedGameTitleID = titleID ;
selectedGameTitle = title ;
// underlining selected Label
lastGameLabel . setStyle ( " -fx-underline: false; " ) ;
games . get ( selectedUIDataIndex ) . getLabel ( ) . setStyle ( " -fx-underline: true; " ) ;
lastGameLabel = games . get ( selectedUIDataIndex ) . getLabel ( ) ;
// setting last played, if lastPlayed is empty game was never played before, else set correct date
if ( dbController . getLastPlayed ( titleID ) . equals ( " " ) | | dbController . getLastPlayed ( titleID ) . equals ( null ) ) {
lastTimePlayedBtn . setText ( " Last played, never " ) ;
totalPlaytimeBtn . setText ( dbController . getTotalPlaytime ( titleID ) + " min " ) ;
} else {
DateTimeFormatter dtf = DateTimeFormatter . ofPattern ( " yyyy-MM-dd " ) ;
int today = Integer . parseInt ( dtf . format ( LocalDate . now ( ) ) . replaceAll ( " - " , " " ) ) ;
int yesterday = Integer . parseInt ( dtf . format ( LocalDate . now ( ) . minusDays ( 1 ) ) . replaceAll ( " - " , " " ) ) ;
int lastPlayedDay = Integer . parseInt ( dbController . getLastPlayed ( titleID ) . replaceAll ( " - " , " " ) ) ;
if ( lastPlayedDay = = today ) {
lastTimePlayedBtn . setText ( " Last played, today " ) ;
} else if ( lastPlayedDay = = yesterday ) {
lastTimePlayedBtn . setText ( " Last played, yesterday " ) ;
} else {
lastTimePlayedBtn . setText ( " Last played, " + dbController . getLastPlayed ( titleID ) ) ;
}
}
// setting total playtime, if total playtime > 60 minutes, format is "x hours x minutes" (x h x min),
// else only minutes are showed
if ( Integer . parseInt ( dbController . getTotalPlaytime ( titleID ) ) > 60 ) {
int hoursPlayed = ( int ) Math . floor ( Integer . parseInt ( dbController . getTotalPlaytime ( titleID ) ) / 60 ) ;
int minutesPlayed = Integer . parseInt ( dbController . getTotalPlaytime ( titleID ) ) - 60 * hoursPlayed ;
totalPlaytimeBtn . setText ( hoursPlayed + " h " + minutesPlayed + " min " ) ;
} else {
totalPlaytimeBtn . setText ( dbController . getTotalPlaytime ( titleID ) + " min " ) ;
}
if ( ! playTrue ) {
playBtnSlideIn ( ) ;
}
if ( menuTrue ) {
sideMenuSlideOut ( ) ;
2017-10-30 18:28:58 +01:00
burgerTask . setRate ( - 1 . 0 ) ;
burgerTask . play ( ) ;
menuTrue = false ;
2017-10-15 13:37:45 +02:00
}
}
} ) ;
uiROMElement . getVBox ( ) . setLayoutX ( getxPos ( ) ) ;
uiROMElement . getVBox ( ) . setLayoutY ( getyPos ( ) ) ;
uiROMElement . getVBox ( ) . getChildren ( ) . addAll ( gameTitleLabel , gameBtn ) ;
// add uiROMElement to games list
games . add ( uiROMElement ) ;
2017-04-06 12:00:36 +02:00
}
2017-10-15 13:37:45 +02:00
//add all games saved in games(ArrayList) to gamesAnchorPane
2017-09-12 19:45:39 +02:00
void addUIData ( ) {
2017-04-06 12:00:36 +02:00
for ( int i = 0 ; i < games . size ( ) ; i + + ) {
gamesAnchorPane . getChildren ( ) . add ( games . get ( i ) . getVBox ( ) ) ;
}
2017-03-23 13:44:21 +01:00
}
2017-06-18 13:01:04 +02:00
2017-09-12 19:45:39 +02:00
//remove all games from gamesAnchorPane and add them afterwards
void refreshUIData ( ) {
//remove all games form gamesAnchorPane
gamesAnchorPane . getChildren ( ) . removeAll ( gamesAnchorPane . getChildren ( ) ) ;
//reset position
xPos = - 200 ;
yPos = 17 ;
xPosHelper = 0 ;
//add all games to gamesAnchorPane (UI)
for ( int i = 0 ; i < games . size ( ) ; i + + ) {
generatePosition ( ) ;
games . get ( i ) . getVBox ( ) . setLayoutX ( getxPos ( ) ) ;
games . get ( i ) . getVBox ( ) . setLayoutY ( getyPos ( ) ) ;
gamesAnchorPane . getChildren ( ) . add ( games . get ( i ) . getVBox ( ) ) ;
}
}
void refreshplayBtnPosition ( ) {
2017-10-26 21:13:56 +02:00
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 ) ;
2017-09-12 19:45:39 +02:00
}
2017-11-06 10:42:31 +01:00
void checkAutoUpdate ( ) {
if ( isAutoUpdate ( ) ) {
try {
LOGGER . info ( " AutoUpdate: looking for updates on startup ... " ) ;
2017-11-10 15:58:20 +01:00
updateController = new UpdateController ( this , buildNumber , useBeta ) ;
2017-11-06 10:42:31 +01:00
Thread updateThread = new Thread ( updateController ) ;
updateThread . setName ( " Updater " ) ;
updateThread . start ( ) ;
updateThread . join ( ) ;
} catch ( InterruptedException e ) {
e . printStackTrace ( ) ;
}
}
}
2017-06-18 13:01:04 +02:00
private void addCourseDescription ( SmmdbApiDataType course ) {
2017-08-26 00:13:09 +02:00
String courseTheme ;
String gameStyle ;
2017-06-18 13:01:04 +02:00
String difficulty ;
2017-08-26 00:13:09 +02:00
String autoscroll ;
2017-06-18 13:01:04 +02:00
smmdbTextFlow . getChildren ( ) . remove ( 0 , smmdbTextFlow . getChildren ( ) . size ( ) ) ;
nameText . clear ( ) ;
courseText . clear ( ) ;
2017-08-26 00:13:09 +02:00
switch ( course . getCourseTheme ( ) ) {
2017-06-18 13:01:04 +02:00
case 0 :
2017-08-26 00:13:09 +02:00
courseTheme = " Ground " ;
2017-06-18 13:01:04 +02:00
break ;
case 1 :
2017-08-26 00:13:09 +02:00
courseTheme = " Underground " ;
2017-06-18 13:01:04 +02:00
break ;
case 2 :
2017-08-26 00:13:09 +02:00
courseTheme = " Castle " ;
break ;
case 3 :
courseTheme = " Airship " ;
break ;
case 4 :
courseTheme = " Underwater " ;
break ;
case 5 :
courseTheme = " Ghost House " ;
2017-06-18 13:01:04 +02:00
break ;
default :
2017-08-26 00:13:09 +02:00
courseTheme = " notset " ;
2017-06-18 13:01:04 +02:00
break ;
}
2017-08-26 00:13:09 +02:00
switch ( course . getGameStyle ( ) ) {
2017-06-18 13:01:04 +02:00
case 0 :
2017-08-26 00:13:09 +02:00
gameStyle = " SMB " ;
2017-06-18 13:01:04 +02:00
break ;
case 1 :
2017-08-26 00:13:09 +02:00
gameStyle = " SMB3 " ;
2017-06-18 13:01:04 +02:00
break ;
case 2 :
2017-08-26 00:13:09 +02:00
gameStyle = " SMW " ;
2017-06-18 13:01:04 +02:00
break ;
case 3 :
2017-08-26 00:13:09 +02:00
gameStyle = " NSMBU " ;
2017-06-18 13:01:04 +02:00
break ;
default :
2017-08-26 00:13:09 +02:00
gameStyle = " notset " ;
2017-06-18 13:01:04 +02:00
break ;
}
switch ( course . getDifficulty ( ) ) {
case 0 :
difficulty = " Easy " ;
break ;
case 1 :
difficulty = " Normal " ;
break ;
case 2 :
difficulty = " Expert " ;
break ;
case 3 :
difficulty = " Super Expert " ;
break ;
case 4 :
difficulty = " Mixed " ;
break ;
default :
difficulty = " notset " ;
break ;
}
2017-08-26 00:13:09 +02:00
switch ( course . getAutoScroll ( ) ) {
case 0 :
autoscroll = " disabled " ;
break ;
case 1 :
autoscroll = " slow " ;
break ;
case 2 :
autoscroll = " medium " ;
break ;
case 3 :
autoscroll = " fast " ;
break ;
default :
autoscroll = " notset " ;
break ;
}
2017-06-18 13:01:04 +02:00
nameText . add ( 0 , new Text ( " title " + " : " ) ) ;
nameText . add ( 1 , new Text ( " owner " + " : " ) ) ;
2017-08-26 00:13:09 +02:00
nameText . add ( 2 , new Text ( " Course-Theme " + " : " ) ) ;
nameText . add ( 3 , new Text ( " Game-Style " + " : " ) ) ;
2017-06-18 13:01:04 +02:00
nameText . add ( 4 , new Text ( " difficulty " + " : " ) ) ;
2017-08-26 00:13:09 +02:00
nameText . add ( 5 , new Text ( " Auto-Scroll " + " : " ) ) ;
nameText . add ( 6 , new Text ( " Time " + " : " ) ) ;
nameText . add ( 7 , new Text ( " lastmodified " + " : " ) ) ;
nameText . add ( 8 , new Text ( " uploaded " + " : " ) ) ;
nameText . add ( 9 , new Text ( " nintendoid " + " : " ) ) ;
2017-06-18 13:01:04 +02:00
courseText . add ( 0 , new Text ( course . getTitle ( ) + " \ n " ) ) ;
2017-08-26 00:13:09 +02:00
courseText . add ( 1 , new Text ( course . getOwner ( ) + " \ n " ) ) ;
courseText . add ( 2 , new Text ( courseTheme + " \ n " ) ) ;
courseText . add ( 3 , new Text ( gameStyle + " \ n " ) ) ;
2017-06-18 13:01:04 +02:00
courseText . add ( 4 , new Text ( difficulty + " \ n " ) ) ;
2017-08-26 00:13:09 +02:00
courseText . add ( 5 , new Text ( autoscroll + " \ n " ) ) ;
courseText . add ( 6 , new Text ( course . getTime ( ) + " \ n " ) ) ;
courseText . add ( 7 , new Text ( new java . util . Date ( ( long ) course . getLastmodified ( ) * 1000 ) + " \ n " ) ) ;
courseText . add ( 8 , new Text ( new java . util . Date ( ( long ) course . getUploaded ( ) * 1000 ) + " \ n " ) ) ;
courseText . add ( 9 , new Text ( course . getNintendoid ( ) + " \ n " ) ) ;
2017-06-18 13:01:04 +02:00
for ( int i = 0 ; i < nameText . size ( ) ; i + + ) {
nameText . get ( i ) . setFont ( Font . font ( " System " , FontWeight . BOLD , 14 ) ) ;
courseText . get ( i ) . setFont ( Font . font ( " System " , 14 ) ) ;
smmdbTextFlow . getChildren ( ) . addAll ( nameText . get ( i ) , courseText . get ( i ) ) ;
}
}
2017-03-23 13:44:21 +01:00
2017-08-26 00:13:09 +02:00
/ * *
* xPosHelper based on window width = - 24 ( Windows ) / - 36 ( Linux )
* calculates how many games can be displayed in one row
* /
2017-06-18 13:01:04 +02:00
private void generatePosition ( ) {
2017-10-14 15:42:13 +02:00
int xPosHelperMax ;
2017-10-30 17:52:45 +01:00
/ * * 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
* /
2017-10-14 15:42:13 +02:00
if ( mainAnchorPane . getWidth ( ) < 10 ) {
xPosHelperMax = ( int ) Math . floor ( ( mainAnchorPane . getPrefWidth ( ) - 36 ) / 217 ) ;
} else {
xPosHelperMax = ( int ) Math . floor ( ( mainAnchorPane . getWidth ( ) - 36 ) / 217 ) ;
}
2017-08-11 20:01:43 +02:00
if ( xPosHelper = = xPosHelperMax ) {
2017-09-15 19:23:44 +02:00
oldXPosHelper = xPosHelper ;
2017-03-23 13:44:21 +01:00
xPos = 17 ;
yPos = yPos + 345 ;
xPosHelper = 1 ;
} else {
xPos = xPos + 217 ;
xPosHelper + + ;
}
2017-10-15 12:29:18 +02:00
2017-10-30 17:52:45 +01:00
// System.out.println("Breit: " + main.pane.getWidth());
2017-10-24 22:41:56 +02:00
// System.out.println("Breit2: " + mainAnchorPane.getWidth());
2017-08-11 20:01:43 +02:00
// System.out.println("xPosHelper: " + xPosHelper);
// System.out.println("yPos: " + yPos);
// System.out.println("xPos: " + xPos);
2017-03-23 13:44:21 +01:00
}
2017-06-18 13:01:04 +02:00
private void applyColor ( ) {
2017-03-28 17:40:01 +02:00
String boxStyle = " -fx-background-color: # " + getColor ( ) + " ; " ;
2017-03-23 13:44:21 +01:00
String btnStyleBlack = " -fx-button-type: RAISED; -fx-background-color: # " + getColor ( ) + " ; -fx-text-fill: BLACK; " ;
2017-03-28 17:40:01 +02:00
String btnStyleWhite = " -fx-button-type: RAISED; -fx-background-color: # " + getColor ( ) + " ; -fx-text-fill: WHITE; " ;
BigInteger icolor = new BigInteger ( getColor ( ) , 16 ) ;
BigInteger ccolor = new BigInteger ( " 78909cff " , 16 ) ;
2017-03-23 13:44:21 +01:00
2017-03-28 17:40:01 +02:00
sideMenuVBox . setStyle ( boxStyle ) ;
topHBox . setStyle ( boxStyle ) ;
2017-03-23 13:44:21 +01:00
cemuTextField . setFocusColor ( Color . valueOf ( getColor ( ) ) ) ;
romTextField . setFocusColor ( Color . valueOf ( getColor ( ) ) ) ;
2017-03-28 17:40:01 +02:00
if ( icolor . compareTo ( ccolor ) = = - 1 ) {
2017-08-01 20:11:17 +02:00
dialogBtnStyle = btnStyleWhite ;
2017-03-28 17:40:01 +02:00
aboutBtn . setStyle ( " -fx-text-fill: WHITE; " ) ;
settingsBtn . setStyle ( " -fx-text-fill: WHITE; " ) ;
addBtn . setStyle ( " -fx-text-fill: WHITE; " ) ;
reloadRomsBtn . setStyle ( " -fx-text-fill: WHITE; " ) ;
2017-05-25 19:07:16 +02:00
smmdbBtn . setStyle ( " -fx-text-fill: WHITE; " ) ;
2017-03-28 17:40:01 +02:00
playBtn . setStyle ( " -fx-text-fill: WHITE; -fx-font-family: Roboto Medium; " ) ;
cemuTFBtn . setStyle ( btnStyleWhite ) ;
romTFBtn . setStyle ( btnStyleWhite ) ;
2017-10-24 22:41:56 +02:00
updateBtn . setStyle ( btnStyleWhite ) ;
2017-06-18 00:33:07 +02:00
smmdbDownloadBtn . setStyle ( btnStyleWhite ) ;
2017-03-28 17:40:01 +02:00
playBtn . setStyle ( btnStyleWhite ) ;
2017-10-24 22:41:56 +02:00
2017-03-28 17:40:01 +02:00
aboutBtn . setGraphic ( info_white ) ;
settingsBtn . setGraphic ( settings_white ) ;
addBtn . setGraphic ( add_circle_white ) ;
reloadRomsBtn . setGraphic ( cached_white ) ;
2017-05-25 19:07:16 +02:00
smmdbBtn . setGraphic ( smmdb_white ) ;
2017-03-31 19:19:34 +02:00
menuHam . getStyleClass ( ) . add ( " jfx-hamburgerW " ) ;
2017-03-28 17:40:01 +02:00
} else {
2017-08-01 20:11:17 +02:00
dialogBtnStyle = btnStyleBlack ;
2017-03-28 17:40:01 +02:00
aboutBtn . setStyle ( " -fx-text-fill: BLACK; " ) ;
settingsBtn . setStyle ( " -fx-text-fill: BLACK; " ) ;
addBtn . setStyle ( " -fx-text-fill: BLACK; " ) ;
reloadRomsBtn . setStyle ( " -fx-text-fill: BLACK; " ) ;
2017-05-25 19:07:16 +02:00
smmdbBtn . setStyle ( " -fx-text-fill: BLACK; " ) ;
2017-03-28 17:40:01 +02:00
playBtn . setStyle ( " -fx-text-fill: BLACK; -fx-font-family: Roboto Medium; " ) ;
cemuTFBtn . setStyle ( btnStyleBlack ) ;
romTFBtn . setStyle ( btnStyleBlack ) ;
2017-10-24 22:41:56 +02:00
updateBtn . setStyle ( btnStyleBlack ) ;
2017-06-18 00:33:07 +02:00
smmdbDownloadBtn . setStyle ( btnStyleBlack ) ;
2017-03-28 17:40:01 +02:00
playBtn . setStyle ( btnStyleBlack ) ;
aboutBtn . setGraphic ( info_black ) ;
settingsBtn . setGraphic ( settings_black ) ;
addBtn . setGraphic ( add_circle_black ) ;
reloadRomsBtn . setGraphic ( cached_black ) ;
2017-05-25 19:07:16 +02:00
smmdbBtn . setGraphic ( smmdb_black ) ;
2017-03-31 19:19:34 +02:00
menuHam . getStyleClass ( ) . add ( " jfx-hamburgerB " ) ;
2017-03-28 17:40:01 +02:00
}
2017-04-06 12:00:36 +02:00
for ( int i = 0 ; i < games . size ( ) ; i + + ) {
games . get ( i ) . getButton ( ) . setRipplerFill ( Paint . valueOf ( getColor ( ) ) ) ;
2017-03-26 14:21:19 +02:00
}
2017-03-23 13:44:21 +01:00
}
2017-11-13 16:44:39 +01:00
public void saveSettings ( ) {
2017-09-12 15:04:21 +02:00
LOGGER . info ( " saving Settings ... " ) ;
2017-08-30 11:29:58 +02:00
OutputStream outputStream ; //new output-stream
try {
props . setProperty ( " cemuPath " , getCemuPath ( ) ) ;
props . setProperty ( " romPath " , getRomPath ( ) ) ;
props . setProperty ( " color " , getColor ( ) ) ;
props . setProperty ( " fullscreen " , String . valueOf ( isFullscreen ( ) ) ) ;
2017-11-06 10:42:31 +01:00
props . setProperty ( " cloudSync " , String . valueOf ( isCloudSync ( ) ) ) ;
props . setProperty ( " autoUpdate " , String . valueOf ( isAutoUpdate ( ) ) ) ;
2017-11-10 15:58:20 +01:00
props . setProperty ( " useBeta " , String . valueOf ( isUseBeta ( ) ) ) ;
2017-08-30 11:29:58 +02:00
if ( getCloudService ( ) = = null ) {
props . setProperty ( " cloudService " , " " ) ;
} else {
props . setProperty ( " cloudService " , getCloudService ( ) ) ;
}
props . setProperty ( " folderID " , main . cloudController . getFolderID ( getCloudService ( ) ) ) ;
2017-09-12 20:13:26 +02:00
props . setProperty ( " windowWidth " , String . valueOf ( mainAnchorPane . getWidth ( ) ) ) ;
props . setProperty ( " windowHeight " , String . valueOf ( mainAnchorPane . getHeight ( ) ) ) ;
2017-08-30 11:29:58 +02:00
if ( System . getProperty ( " os.name " ) . equals ( " Linux " ) ) {
outputStream = new FileOutputStream ( configFileLinux ) ;
} else {
outputStream = new FileOutputStream ( configFileWin ) ;
2017-03-23 13:44:21 +01:00
}
2017-08-30 11:29:58 +02:00
props . storeToXML ( outputStream , " cemu_UI settings " ) ; //write new .xml
outputStream . close ( ) ;
LOGGER . info ( " saving Settings done! " ) ;
} catch ( IOException e ) {
LOGGER . error ( " an error occured " , e ) ;
}
2017-03-23 13:44:21 +01:00
}
2017-08-30 11:29:58 +02:00
/ * *
* loading saved settings from the config . xml file
* if a value is not present , default is used instead
* /
2017-03-23 13:44:21 +01:00
void loadSettings ( ) {
2017-09-12 15:04:21 +02:00
LOGGER . info ( " loading settings ... " ) ;
2017-03-23 13:44:21 +01:00
InputStream inputStream ;
try {
if ( System . getProperty ( " os.name " ) . equals ( " Linux " ) ) {
2017-08-30 11:29:58 +02:00
inputStream = new FileInputStream ( configFileLinux ) ;
2017-03-23 13:44:21 +01:00
} else {
2017-08-30 11:29:58 +02:00
inputStream = new FileInputStream ( configFileWin ) ;
2017-03-23 13:44:21 +01:00
}
props . loadFromXML ( inputStream ) ; //new input-stream from .xml
2017-08-30 11:29:58 +02:00
try {
setCemuPath ( props . getProperty ( " cemuPath " ) ) ;
} catch ( Exception e ) {
LOGGER . error ( " cloud not load cemuPath " , e ) ;
setCemuPath ( " " ) ;
}
try {
setRomPath ( props . getProperty ( " romPath " ) ) ;
} catch ( Exception e ) {
LOGGER . error ( " could not load romPath " , e ) ;
setRomPath ( " " ) ;
}
try {
setColor ( props . getProperty ( " color " ) ) ;
} catch ( Exception e ) {
LOGGER . error ( " could not load color value, setting default instead " , e ) ;
setColor ( " 00a8cc " ) ;
}
try {
setFullscreen ( Boolean . parseBoolean ( props . getProperty ( " fullscreen " ) ) ) ;
} catch ( Exception e ) {
LOGGER . error ( " could not load fullscreen, setting default instead " , e ) ;
setFullscreen ( false ) ;
}
try {
setCloudSync ( Boolean . parseBoolean ( props . getProperty ( " cloudSync " ) ) ) ;
} catch ( Exception e ) {
LOGGER . error ( " could not load cloudSync, setting default instead " , e ) ;
setCloudSync ( false ) ;
}
2017-11-06 10:42:31 +01:00
try {
setAutoUpdate ( Boolean . parseBoolean ( props . getProperty ( " autoUpdate " ) ) ) ;
} catch ( Exception e ) {
LOGGER . error ( " cloud not load autoUpdate " , e ) ;
setAutoUpdate ( false ) ;
}
2017-11-10 15:58:20 +01:00
try {
setUseBeta ( Boolean . parseBoolean ( props . getProperty ( " useBeta " ) ) ) ;
} catch ( Exception e ) {
LOGGER . error ( " cloud not load autoUpdate " , e ) ;
setUseBeta ( false ) ;
}
2017-11-06 10:42:31 +01:00
2017-08-30 11:29:58 +02:00
try {
setCloudService ( props . getProperty ( " cloudService " ) ) ;
} catch ( Exception e ) {
LOGGER . error ( " could not load cloudSync " , e ) ;
setCloudService ( " " ) ;
}
try {
main . cloudController . setFolderID ( props . getProperty ( " folderID " ) , getCloudService ( ) ) ;
} catch ( Exception e ) {
LOGGER . error ( " could not load folderID, disable cloud sync. Please contact an developer " , e ) ;
setCloudSync ( false ) ;
}
2017-09-12 20:13:26 +02:00
try {
setWindowWidth ( Double . parseDouble ( props . getProperty ( " windowWidth " ) ) ) ;
} catch ( Exception e ) {
LOGGER . error ( " could not load windowWidth, setting default instead " , e ) ;
setWindowWidth ( 904 ) ;
}
try {
setWindowHeight ( Double . parseDouble ( props . getProperty ( " windowHeight " ) ) ) ;
} catch ( Exception e ) {
LOGGER . error ( " could not load windowHeight, setting default instead " , e ) ;
setWindowHeight ( 600 ) ;
}
2017-03-23 13:44:21 +01:00
inputStream . close ( ) ;
2017-08-27 20:44:08 +02:00
LOGGER . info ( " loading settings done! " ) ;
2017-03-23 13:44:21 +01:00
} catch ( IOException e ) {
2017-08-27 20:44:08 +02:00
LOGGER . error ( " an error occured " , e ) ;
2017-03-23 13:44:21 +01:00
}
}
private void sideMenuSlideIn ( ) {
sideMenuVBox . setVisible ( true ) ;
//fade in from 40% to 100% opacity in 400ms
FadeTransition fadeTransition = new FadeTransition ( Duration . millis ( 400 ) , sideMenuVBox ) ;
fadeTransition . setFromValue ( 0 . 4 ) ;
fadeTransition . setToValue ( 1 . 0 ) ;
//slide in in 400ms
TranslateTransition translateTransition = new TranslateTransition ( Duration . millis ( 400 ) , sideMenuVBox ) ;
2017-03-31 19:19:34 +02:00
translateTransition . setFromX ( - 175 ) ;
2017-03-23 13:44:21 +01:00
translateTransition . setToX ( 0 ) ;
//in case both animations are used (add (fadeTransition, translateTransition) in the second line under this command)
ParallelTransition parallelTransition = new ParallelTransition ( ) ;
parallelTransition . getChildren ( ) . addAll ( translateTransition ) ; //(fadeTransition, translateTransition);
parallelTransition . play ( ) ;
}
private void sideMenuSlideOut ( ) {
// sideMenuVBox.setVisible(false);
//fade out from 100% to 40% opacity in 400ms
FadeTransition fadeTransition = new FadeTransition ( Duration . millis ( 400 ) , sideMenuVBox ) ;
fadeTransition . setFromValue ( 1 . 0 ) ;
fadeTransition . setToValue ( 0 . 4 ) ;
//slide out in 400ms
TranslateTransition translateTransition = new TranslateTransition ( Duration . millis ( 400 ) , sideMenuVBox ) ;
translateTransition . setFromX ( 0 ) ;
2017-03-31 19:19:34 +02:00
translateTransition . setToX ( - 175 ) ;
2017-03-23 13:44:21 +01:00
//in case both animations are used (add (fadeTransition, translateTransition) in the second line under this command)
ParallelTransition parallelTransition = new ParallelTransition ( ) ;
parallelTransition . getChildren ( ) . addAll ( translateTransition ) ; //(fadeTransition, translateTransition);
parallelTransition . play ( ) ;
}
private void playBtnSlideIn ( ) {
playBtn . setVisible ( true ) ;
2017-03-25 15:18:45 +01:00
lastTimePlayedBtn . setVisible ( true ) ;
2017-09-12 15:04:21 +02:00
totalPlaytimeBtn . setVisible ( true ) ;
2017-03-23 13:44:21 +01:00
playTrue = true ;
2017-03-25 15:18:45 +01:00
TranslateTransition playBtnTransition = new TranslateTransition ( Duration . millis ( 300 ) , playBtn ) ;
playBtnTransition . setFromY ( 55 ) ;
playBtnTransition . setToY ( 0 ) ;
playBtnTransition . play ( ) ;
TranslateTransition lastTimePlayedBtnTransition = new TranslateTransition ( Duration . millis ( 300 ) , lastTimePlayedBtn ) ;
lastTimePlayedBtnTransition . setFromY ( 55 ) ;
lastTimePlayedBtnTransition . setToY ( 0 ) ;
lastTimePlayedBtnTransition . play ( ) ;
2017-09-12 15:04:21 +02:00
TranslateTransition timePlayedBtnTransition = new TranslateTransition ( Duration . millis ( 300 ) , totalPlaytimeBtn ) ;
2017-03-25 15:18:45 +01:00
timePlayedBtnTransition . setFromY ( 55 ) ;
timePlayedBtnTransition . setToY ( 0 ) ;
timePlayedBtnTransition . play ( ) ;
2017-03-23 13:44:21 +01:00
}
2017-03-26 14:21:19 +02:00
void playBtnSlideOut ( ) {
2017-03-23 13:44:21 +01:00
playTrue = false ;
2017-03-25 15:18:45 +01:00
TranslateTransition playBtnTransition = new TranslateTransition ( Duration . millis ( 300 ) , playBtn ) ;
playBtnTransition . setFromY ( 0 ) ;
playBtnTransition . setToY ( 56 ) ;
playBtnTransition . play ( ) ;
TranslateTransition lastTimePlayedBtnTransition = new TranslateTransition ( Duration . millis ( 300 ) , lastTimePlayedBtn ) ;
lastTimePlayedBtnTransition . setFromY ( 0 ) ;
lastTimePlayedBtnTransition . setToY ( 56 ) ;
lastTimePlayedBtnTransition . play ( ) ;
2017-09-12 15:04:21 +02:00
TranslateTransition timePlayedBtnTransition = new TranslateTransition ( Duration . millis ( 300 ) , totalPlaytimeBtn ) ;
2017-03-25 15:18:45 +01:00
timePlayedBtnTransition . setFromY ( 0 ) ;
timePlayedBtnTransition . setToY ( 56 ) ;
timePlayedBtnTransition . play ( ) ;
2017-03-23 16:17:38 +01:00
}
2017-03-23 13:44:21 +01:00
private void editColor ( String input ) {
StringBuilder sb = new StringBuilder ( input ) ;
sb . delete ( 0 , 2 ) ;
this . color = sb . toString ( ) ;
saveSettings ( ) ;
}
2017-06-18 13:01:04 +02:00
@SuppressWarnings ( " unused " )
2017-08-26 00:13:09 +02:00
/ * *
* @return the main color in hexadecimal format
* /
2017-06-18 13:01:04 +02:00
private String hexToRgb ( ) {
2017-09-15 19:23:44 +02:00
LOGGER . info ( getColor ( ) ) ;
2017-06-18 13:01:04 +02:00
int hex = Integer . parseInt ( getColor ( ) . substring ( 0 , 5 ) , 16 ) ;
int r = ( hex & 0xFF0000 ) > > 16 ;
int g = ( hex & 0xFF00 ) > > 8 ;
int b = ( hex & 0xFF ) ;
return r + " , " + g + " , " + b ;
}
2017-08-26 00:13:09 +02:00
/ * *
*
* @param originalImage original image which size is changed
* @param type type of the original image ( PNG , JPEG , . . . )
* @param imgWidth wanted width
* @param imgHeigth wanted height
* @return the rezised image
* /
2017-03-26 14:21:19 +02:00
private static BufferedImage resizeImage ( BufferedImage originalImage , int type , int imgWidth , int imgHeigth ) {
BufferedImage resizedImage = new BufferedImage ( imgWidth , imgHeigth , type ) ;
2017-03-23 13:44:21 +01:00
Graphics2D g = resizedImage . createGraphics ( ) ;
2017-03-26 14:21:19 +02:00
g . drawImage ( originalImage , 0 , 0 , imgWidth , imgHeigth , null ) ;
2017-03-23 13:44:21 +01:00
g . dispose ( ) ;
return resizedImage ;
}
public String getCemuPath ( ) {
return cemuPath ;
}
public void setCemuPath ( String cemuPath ) {
this . cemuPath = cemuPath ;
}
public String getRomPath ( ) {
return romPath ;
}
public void setRomPath ( String romPath ) {
this . romPath = romPath ;
}
public String getColor ( ) {
return color ;
}
public void setColor ( String color ) {
this . color = color ;
}
2017-11-13 16:44:39 +01:00
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 ;
}
2017-03-23 13:44:21 +01:00
public int getxPos ( ) {
return xPos ;
}
public void setxPos ( int xPos ) {
this . xPos = xPos ;
}
public int getyPos ( ) {
return yPos ;
}
public void setyPos ( int yPos ) {
this . yPos = yPos ;
}
public int getxPosHelper ( ) {
return xPosHelper ;
}
public void setxPosHelper ( int xPosHelper ) {
this . xPosHelper = xPosHelper ;
}
public boolean isFullscreen ( ) {
return fullscreen ;
}
public void setFullscreen ( boolean fullscreen ) {
this . fullscreen = fullscreen ;
}
2017-04-17 00:58:49 +02:00
public boolean isCloudSync ( ) {
return cloudSync ;
}
public void setCloudSync ( boolean cloudSync ) {
this . cloudSync = cloudSync ;
}
2017-11-06 10:42:31 +01:00
public boolean isAutoUpdate ( ) {
return autoUpdate ;
}
public void setAutoUpdate ( boolean autoUpdate ) {
this . autoUpdate = autoUpdate ;
}
2017-11-10 15:58:20 +01:00
public boolean isUseBeta ( ) {
return useBeta ;
}
public void setUseBeta ( boolean useBeta ) {
this . useBeta = useBeta ;
}
2017-03-28 17:40:01 +02:00
public String getGameExecutePath ( ) {
return gameExecutePath ;
}
public void setGameExecutePath ( String gameExecutePath ) {
this . gameExecutePath = gameExecutePath ;
}
public String getSelectedGameTitleID ( ) {
return selectedGameTitleID ;
}
public void setSelectedGameTitleID ( String selectedGameTitleID ) {
this . selectedGameTitleID = selectedGameTitleID ;
}
2017-04-17 00:58:49 +02:00
public String getCloudService ( ) {
return cloudService ;
}
public void setCloudService ( String cloudService ) {
this . cloudService = cloudService ;
}
2017-05-07 19:57:55 +02:00
public JFXButton getPlayBtn ( ) {
return playBtn ;
}
public void setPlayBtn ( JFXButton playBtn ) {
this . playBtn = playBtn ;
}
2017-09-12 20:13:26 +02:00
public double getWindowWidth ( ) {
return windowWidth ;
}
public void setWindowWidth ( double windowWidth ) {
this . windowWidth = windowWidth ;
}
public double getWindowHeight ( ) {
return windowHeight ;
}
public void setWindowHeight ( double windowHeight ) {
this . windowHeight = windowHeight ;
}
2017-09-15 19:23:44 +02:00
public int getOldXPosHelper ( ) {
return oldXPosHelper ;
}
public void setOldXPosHelper ( int oldXPosHelper ) {
this . oldXPosHelper = oldXPosHelper ;
}
public AnchorPane getMainAnchorPane ( ) {
return mainAnchorPane ;
}
2017-09-12 20:13:26 +02:00
2017-11-06 10:42:31 +01:00
public JFXButton getUpdateBtn ( ) {
return updateBtn ;
}
2017-03-23 13:44:21 +01:00
}