Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.user
*.userosscache
*.sln.docstates
.vscode

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
21 changes: 2 additions & 19 deletions UnionPatcher.Gui/Forms/FilePatchForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,8 @@ public Control CreatePatchButton(int tabIndex = 0) {
return control;
}

public Control CreateHelpButton(int tabIndex = 0) {
Button control = new() {
Text = "Help",
TabIndex = tabIndex,
};

control.Click += delegate {
Process process = new();

process.StartInfo.UseShellExecute = true;
process.StartInfo.FileName = "https://www.lbpunion.com";
process.Start();
};

return control;
}

public FilePatchForm() {
this.Title = "UnionPatcher - File Patch";
this.Title = "File Patch";
this.ClientSize = new Size(500, -1);
this.Content = new TableLayout {
Spacing = new Size(5,5),
Expand All @@ -61,7 +44,7 @@ public FilePatchForm() {
new TableCell(this.outputFileName = new FilePicker { TabIndex = 2, FileAction = FileAction.SaveFile, Filters = { new FileFilter("ELF files", "*.elf", "*.ELF"), new FileFilter("All Files", "*.*") }})
),
new TableRow(
new TableCell(this.CreateHelpButton(4)),
new TableCell(),
new TableCell(this.CreatePatchButton(3))
),
},
Expand Down
7 changes: 2 additions & 5 deletions UnionPatcher.Gui/Forms/ModeSelectionForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@ namespace LBPUnion.UnionPatcher.Gui.Forms;
public class ModeSelectionForm : Form {
#region UI
public ModeSelectionForm() {
this.Title = "Welcome to UnionPatcher";
this.ClientSize = new Size(500, -1);
this.Title = "UnionPatcher";
this.ClientSize = new Size(200, -1);
this.Content = new TableLayout {
Spacing = new Size(5, 5),
Padding = new Padding(10, 10, 10, 10),
Rows = {
new TableRow(
new TableCell(new Button(openRemotePatcher) { Text = "Remote Patcher (PS3)" })
),
new TableRow(
new TableCell(new Button(openLocalPatcher) { Text = "Local Patch (RPCS3)", Enabled = false })
),
new TableRow(
new TableCell(new Button(openFilePatcher) { Text = "File Patch (PS3/RPCS3)" })
),
Expand Down
86 changes: 38 additions & 48 deletions UnionPatcher.Gui/Forms/RemotePatchForm.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Eto.Drawing;
using Eto.Forms;

Expand Down Expand Up @@ -31,7 +32,7 @@ public Control CreatePatchButton(int tabIndex = 0)
Width = 200,
};

control.Click += delegate {
control.Click += async delegate {
if (string.IsNullOrEmpty(this.ps3LocalIP.Text))
{
Gui.CreateOkDialog("Error", "No PS3 IP address specified!");
Expand All @@ -56,24 +57,33 @@ public Control CreatePatchButton(int tabIndex = 0)
return;
}

try
Task patchTask = null;

if (this.lbpGameID.Text.ToUpper().StartsWith('B'))
{
if (this.lbpGameID.Text.ToUpper().StartsWith('B'))
{
this.RemotePatcher.DiscEBOOTRemotePatch(this.ps3LocalIP.Text, this.lbpGameID.Text, this.serverUrl.Text, this.ftpUser.Text, this.ftpPass.Text);
}
else
{
this.RemotePatcher.PSNEBOOTRemotePatch(this.ps3LocalIP.Text, this.lbpGameID.Text, this.serverUrl.Text, this.ftpUser.Text, this.ftpPass.Text);
}
patchTask = this.RemotePatcher.DiscEBOOTRemotePatch(this.ps3LocalIP.Text, this.lbpGameID.Text, this.serverUrl.Text, this.ftpUser.Text, this.ftpPass.Text);
}
catch (Exception e)
else
{
Gui.CreateOkDialog("Error occurred while patching", "An error occured while patching:\n" + e);
return;
patchTask = this.RemotePatcher.PSNEBOOTRemotePatch(this.ps3LocalIP.Text, this.lbpGameID.Text, this.serverUrl.Text, this.ftpUser.Text, this.ftpPass.Text);
}

Gui.CreateOkDialog("Success!", $"The Server URL for {this.lbpGameID.Text} on the PS3 at {this.ps3LocalIP.Text} has been patched to {this.serverUrl.Text}");
// Something went horribly wrong, this should be impossible to encounter.
if (patchTask == null) return;

Control revertButton = this.FindChild("revert");
foreach (Control control in this.Controls) control.Enabled = false;
Gui.CreateOkDialog("Sit Tight!", $"We're patching your title for {this.ps3LocalIP.Text}! Maybe grab some tea?");
try
{
await patchTask;
Gui.CreateOkDialog("Have fun!", $"The Server URL for {this.lbpGameID.Text} on the PS3 at {this.ps3LocalIP.Text} has been patched to {this.serverUrl.Text}");
}
catch (Exception e)
{
Gui.CreateOkDialog("Error occurred while patching", "An error occured while patching:\n" + e.Message);
}
foreach (Control control in this.Controls) control.Enabled = true;
};

return control;
Expand All @@ -85,10 +95,10 @@ public Control CreateRevertEBOOTButton(int tabIndex = 0)
{
Text = "Revert EBOOT",
TabIndex = tabIndex,
Width = 200,
Width = 50,
};

control.Click += delegate {
control.Click += async delegate {
if (string.IsNullOrEmpty(this.ps3LocalIP.Text))
{
Gui.CreateOkDialog("Form Error", "No PS3 IP address specified!");
Expand All @@ -100,45 +110,28 @@ public Control CreateRevertEBOOTButton(int tabIndex = 0)
Gui.CreateOkDialog("Form Error", "No game ID specified!");
return;
}

try

foreach (Control control in this.Controls) control.Enabled = false;
Task revertTask = this.RemotePatcher.RevertEBOOT(this.ps3LocalIP.Text, this.lbpGameID.Text, this.serverUrl.Text, this.ftpUser.Text, this.ftpPass.Text);

try
{
this.RemotePatcher.RevertEBOOT(this.ps3LocalIP.Text, this.lbpGameID.Text, this.serverUrl.Text, this.ftpUser.Text, this.ftpPass.Text);
await revertTask;
Gui.CreateOkDialog("Success!", $"UnionPatcher reverted your the EBOOT for {this.lbpGameID.Text} to stock. You're ready to patch your EBOOT again.");
}
catch (Exception e)
{
Gui.CreateOkDialog("Error occurred while reverting EBOOT", "An error occured while patching:\n" + e);
return;
Gui.CreateOkDialog("Error occurred while reverting EBOOT", "An error occured while patching:\n" + e.Message);
}

Gui.CreateOkDialog("Success!", $"UnionRemotePatcher reverted your the EBOOT for {this.lbpGameID.Text} to stock. You're ready to patch your EBOOT again.");
};

return control;
}

public Control CreateHelpButton(int tabIndex = 0)
{
Button control = new()
{
Text = "Help",
TabIndex = tabIndex,
};

control.Click += delegate {
Process process = new();

process.StartInfo.UseShellExecute = true;
process.StartInfo.FileName = "https://www.lbpunion.com";
process.Start();
foreach (Control control in this.Controls) control.Enabled = true;
};

return control;
}

void InitializeComponent()
{
this.Title = "UnionPatcher - Remote Patch";
this.Title = "Remote Patcher";
this.MinimumSize = new Size(450, 200);
this.Resizable = false;
this.Padding = 10;
Expand Down Expand Up @@ -169,11 +162,8 @@ void InitializeComponent()
new TableCell(this.ftpPass = new TextBox { TabIndex = 4 })
),
new TableRow(
new TableCell(this.CreateHelpButton(7)),
new TableRow(
new TableCell(this.CreatePatchButton(5)),
new TableCell(this.CreateRevertEBOOTButton(6))
)
new TableCell(this.CreateRevertEBOOTButton(6)),
new TableCell(this.CreatePatchButton(5))
),
},
};
Expand Down
Loading