From e23a44b1942654df93f9afb91fd311dabab87575 Mon Sep 17 00:00:00 2001 From: Downforce Agent Date: Tue, 9 Apr 2024 23:24:54 -0500 Subject: [PATCH] we're getting there --- src/Kermit.java | 130 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 113 insertions(+), 17 deletions(-) diff --git a/src/Kermit.java b/src/Kermit.java index 37fb2f9..1ccf581 100644 --- a/src/Kermit.java +++ b/src/Kermit.java @@ -18,6 +18,7 @@ import javax.swing.*; import javax.swing.text.StyleConstants; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; @@ -31,7 +32,8 @@ public class Kermit implements ActionListener { SDK_FAILURE(3), WHAT_OS(4), EXPORT_LOCATION(5), - DONE(6); + IMPORT_LOCATION(6), + DONE(7); public final int value; @@ -46,12 +48,27 @@ public class Kermit implements ActionListener { JButton button3 = new JButton("Cancel"); JButton button4 = new JButton("Back"); JTextPane dialogText = new JTextPane(); + JRadioButton buttonCompat = new JRadioButton("Compatibility (for consoles)"); + JRadioButton buttonFast = new JRadioButton("Fast Mode (for Vita3K emulator)"); + ButtonGroup radg1 = new ButtonGroup(); Pages page = Pages.AGREEMENT; javax.swing.text.StyledDocument document = dialogText.getStyledDocument(); javax.swing.text.SimpleAttributeSet align= new javax.swing.text.SimpleAttributeSet(); public void setup(File fConf) { //File variable is redundant. unused // todo Disable MissPiggy + + frame.getContentPane().setBackground(Color.WHITE); + radg1.add(buttonCompat); + radg1.add(buttonFast); + + button.addActionListener(this); + button2.addActionListener(this); + button3.addActionListener(this); + button4.addActionListener(this); + buttonCompat.addActionListener(this); + buttonFast.addActionListener(this); + changePage(Pages.AGREEMENT); } @@ -60,13 +77,20 @@ public class Kermit implements ActionListener { if (actionEvent.getSource() == button2){ System.exit(0); } else if (actionEvent.getSource() == button){ + //frame.removeAll(); freezes?? switch (page) { case AGREEMENT: - frame.remove(button); - frame.remove(button2); + button.setVisible(false);frame.remove(button); + button2.setVisible(false);frame.remove(button2); + dialogText.setVisible(false);frame.remove(dialogText); changePage(Pages.EXPORT_MODE); break; case EXPORT_MODE: + button.setVisible(false);frame.remove(button); + button2.setVisible(false);frame.remove(button3); + dialogText.setVisible(false);frame.remove(dialogText); + buttonCompat.setVisible(false);frame.remove(buttonCompat); + buttonFast.setVisible(false);frame.remove(buttonFast); if (Main.repatch) {changePage(Pages.SDK_INSTALL);} else {changePage(Pages.EXPORT_LOCATION);} break; case SDK_INSTALL: @@ -76,6 +100,9 @@ public class Kermit implements ActionListener { case WHAT_OS: break; case EXPORT_LOCATION: + changePage(Pages.IMPORT_LOCATION); + break; + case IMPORT_LOCATION: changePage(Pages.DONE); break; case DONE: @@ -88,6 +115,36 @@ public class Kermit implements ActionListener { throw new UnsupportedOperationException("ERROR: Undefined behavior in Kermit's event listener. Get a programmer!"); //JOptionPane OhShit = new JOptionPane.showMessageDialog(null, "Fuck"); } + } else if (actionEvent.getSource() == button4){ + //frame.removeAll(); freezes?? + switch (page) { // todo remove elements when going to previous page + case EXPORT_MODE: + changePage(Pages.AGREEMENT); + break; + case SDK_INSTALL: + changePage(Pages.EXPORT_MODE); + break; + case SDK_FAILURE: + break; + case WHAT_OS: + changePage(Pages.SDK_INSTALL); + break; + case EXPORT_LOCATION: + if (Main.repatch) {changePage(Pages.WHAT_OS);} else {changePage(Pages.EXPORT_MODE);} + break; + case IMPORT_LOCATION: + changePage(Pages.EXPORT_LOCATION); + break; + default: + throw new UnsupportedOperationException("ERROR: Undefined behavior in Kermit's event listener. Get a programmer!"); + //JOptionPane OhShit = new JOptionPane.showMessageDialog(null, "Fuck"); + } + } else if (actionEvent.getSource() == buttonCompat) { + Main.repatch = true; + button.setEnabled(true); + } else if (actionEvent.getSource() == buttonFast) { + Main.repatch = false; + button.setEnabled(true); } } @@ -96,14 +153,15 @@ public class Kermit implements ActionListener { case AGREEMENT: page = Pages.AGREEMENT; + button.setVisible(true); button.setBounds(292, 343, 300, 30); - button.addActionListener(this); frame.add(button); + button2.setVisible(true); button2.setBounds(0, 343, 292, 30); - button2.addActionListener(this); frame.add(button2); + dialogText.setVisible(true); dialogText.setHighlighter(null); dialogText.getCaret().setVisible(false); dialogText.setFocusable(false); @@ -130,29 +188,36 @@ public class Kermit implements ActionListener { case EXPORT_MODE: page = Pages.EXPORT_MODE; + button.setVisible(true); + button.setEnabled(false); button.setBounds(292, 343, 300, 30); - button.addActionListener(this); frame.add(button); - button2.setBounds(0, 343, 292, 30); - button2.addActionListener(this); - frame.add(button2); + button3.setVisible(true); + button3.setBounds(0, 343, 292, 30); + frame.add(button3); + dialogText.setVisible(true); dialogText.setHighlighter(null); dialogText.getCaret().setVisible(false); dialogText.setFocusable(false); - dialogText.setBounds(0, 0, 592, 343); - //dialogText.setAlignmentX(JComponent.CENTER_ALIGNMENT); - //dialogText.setAlignmentY(JComponent.CENTER_ALIGNMENT); + dialogText.setBounds(0, 40, 592, 150); StyleConstants.setAlignment(align, StyleConstants.ALIGN_CENTER); document.setParagraphAttributes(0, document.getLength(), align, false); - //dialogText.setText("Aww Fiddlesticks, what now?"); - dialogText.setText("WELCOME TO FIRESTAR\n\n" + - "This initial setup guide will help you prepare your Playstation Vita, Playstation TV, or Vita3K emulator to play WipEout mods. You will be asked a series of questions to help Firestar decide the most optimal installation method for you.\n\n" + - "If you encounter any issues while using Firestar you may contact the author at bonkmaykr@screwgravity.net\n\n" + - "DISCLAIMER: This program is free software licensed under the GNU General Public License version 3.0. You may share this program and it's source code so long as you extend the same rights to others. The developers of this software are never responsible for any damage to your game console and Firestar is provided to you without any warranty or legal guarantee. By using Firestar, you agree to these terms. For more information, visit https://www.gnu.org/licenses/gpl-3.0.en.html"); + dialogText.setText("Please choose how Firestar will deploy your mods.\n\n" + + "Compatibility mode requires software from the PSVita SDK, but works on real hardware.\n" + + "Fast mode is easiest, but won't work on FAT32/exFAT drives like what the Vita uses."); frame.add(dialogText); + buttonCompat.setBounds(40, 200, 300, 25); + buttonFast.setBounds(40, 230, 300, 25); + buttonCompat.setBackground(Color.WHITE); + buttonFast.setBackground(Color.WHITE); + buttonCompat.setVisible(true); + buttonFast.setVisible(true); + frame.add(buttonCompat); + frame.add(buttonFast); + frame.setSize(600, 400); frame.setTitle("Initial Setup"); frame.setAlwaysOnTop(true); @@ -163,6 +228,34 @@ public class Kermit implements ActionListener { break; case SDK_INSTALL: page = Pages.SDK_INSTALL; + + button.setVisible(true); + button.setBounds(292, 343, 300, 30); + button.addActionListener(this); + frame.add(button); + + button3.setVisible(true); + button3.setBounds(0, 343, 292, 30); + button3.addActionListener(this); + frame.add(button3); + + dialogText.setVisible(true); + dialogText.setHighlighter(null); + dialogText.getCaret().setVisible(false); + dialogText.setFocusable(false); + dialogText.setBounds(0, 40, 592, 300); + StyleConstants.setAlignment(align, StyleConstants.ALIGN_CENTER); + document.setParagraphAttributes(0, document.getLength(), align, false); + dialogText.setText("it works!"); + frame.add(dialogText); + + frame.setSize(600, 400); + frame.setTitle("Initial Setup"); + frame.setAlwaysOnTop(true); + frame.setDefaultCloseOperation(0); + frame.setResizable(false); + frame.setLayout(null); + frame.setVisible(true); break; case SDK_FAILURE: page = Pages.SDK_FAILURE; @@ -173,6 +266,9 @@ public class Kermit implements ActionListener { case EXPORT_LOCATION: page = Pages.EXPORT_LOCATION; break; + case IMPORT_LOCATION: + page = Pages.IMPORT_LOCATION; + break; case DONE: page = Pages.DONE; break;