mirror of
https://github.com/LBPUnion/UnionPatcher.git
synced 2025-08-03 06:38:47 +00:00
task test 1
This commit is contained in:
parent
b67f63fff4
commit
d9c1ff7b40
2 changed files with 159 additions and 137 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,6 +9,7 @@
|
||||||
*.user
|
*.user
|
||||||
*.userosscache
|
*.userosscache
|
||||||
*.sln.docstates
|
*.sln.docstates
|
||||||
|
.vscode
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
*.userprefs
|
*.userprefs
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using LBPUnion.UnionPatcher.Communication;
|
using LBPUnion.UnionPatcher.Communication;
|
||||||
|
|
||||||
namespace LBPUnion.UnionPatcher;
|
namespace LBPUnion.UnionPatcher;
|
||||||
|
@ -13,10 +14,12 @@ public class RemotePatch
|
||||||
{
|
{
|
||||||
private readonly PS3MAPI _ps3Mapi = new();
|
private readonly PS3MAPI _ps3Mapi = new();
|
||||||
|
|
||||||
private static Dictionary<string, string> GetUsers(string ps3Ip, string user, string pass)
|
private static Dictionary<string, string> GetUsersAsync(string ps3Ip, string user, string pass)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Getting users...");
|
Console.WriteLine("Getting users...");
|
||||||
|
|
||||||
|
Task<Dictionary<string, string>> users = Task.Run(() =>
|
||||||
|
{
|
||||||
Dictionary<string, string> users = new();
|
Dictionary<string, string> users = new();
|
||||||
|
|
||||||
string[] userFolders = FTP.ListDirectory($"ftp://{ps3Ip}/dev_hdd0/home/", user, pass);
|
string[] userFolders = FTP.ListDirectory($"ftp://{ps3Ip}/dev_hdd0/home/", user, pass);
|
||||||
|
@ -33,6 +36,9 @@ public class RemotePatch
|
||||||
}
|
}
|
||||||
|
|
||||||
return users;
|
return users;
|
||||||
|
});
|
||||||
|
|
||||||
|
return users.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LaunchSCETool(string args)
|
public static void LaunchSCETool(string args)
|
||||||
|
@ -47,10 +53,12 @@ public class RemotePatch
|
||||||
if (RuntimeInformation.ProcessArchitecture == Architecture.X64)
|
if (RuntimeInformation.ProcessArchitecture == Architecture.X64)
|
||||||
{
|
{
|
||||||
platformExecutable = "scetool/linux64/scetool";
|
platformExecutable = "scetool/linux64/scetool";
|
||||||
} else if (RuntimeInformation.ProcessArchitecture == Architecture.Arm)
|
}
|
||||||
|
else if (RuntimeInformation.ProcessArchitecture == Architecture.Arm)
|
||||||
{
|
{
|
||||||
platformExecutable = "scetool/linuxarm/scetool";
|
platformExecutable = "scetool/linuxarm/scetool";
|
||||||
} else if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
}
|
||||||
|
else if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
||||||
{
|
{
|
||||||
platformExecutable = "scetool/linuxarm64/scetool";
|
platformExecutable = "scetool/linuxarm64/scetool";
|
||||||
}
|
}
|
||||||
|
@ -91,6 +99,8 @@ public class RemotePatch
|
||||||
{
|
{
|
||||||
Console.WriteLine("Restoring original EBOOT.BIN from EBOOT.BIN.BAK");
|
Console.WriteLine("Restoring original EBOOT.BIN from EBOOT.BIN.BAK");
|
||||||
|
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
// Create a simple directory structure
|
// Create a simple directory structure
|
||||||
Directory.CreateDirectory(@"eboot");
|
Directory.CreateDirectory(@"eboot");
|
||||||
Directory.CreateDirectory($@"eboot/{gameID}");
|
Directory.CreateDirectory($@"eboot/{gameID}");
|
||||||
|
@ -99,19 +109,25 @@ public class RemotePatch
|
||||||
// Now we'll check and see if a backup exists on the server, if so download it and then upload it back as EBOOT.BIN
|
// Now we'll check and see if a backup exists on the server, if so download it and then upload it back as EBOOT.BIN
|
||||||
if (FTP.FileExists($"ftp://{ps3ip}/dev_hdd0/game/{gameID}/USRDIR/EBOOT.BIN.BAK", user, pass))
|
if (FTP.FileExists($"ftp://{ps3ip}/dev_hdd0/game/{gameID}/USRDIR/EBOOT.BIN.BAK", user, pass))
|
||||||
{
|
{
|
||||||
|
|
||||||
FTP.DownloadFile($"ftp://{ps3ip}/dev_hdd0/game/{gameID}/USRDIR/EBOOT.BIN.BAK", @$"eboot/{gameID}/original/EBOOT.BIN.BAK", user, pass);
|
FTP.DownloadFile($"ftp://{ps3ip}/dev_hdd0/game/{gameID}/USRDIR/EBOOT.BIN.BAK", @$"eboot/{gameID}/original/EBOOT.BIN.BAK", user, pass);
|
||||||
FTP.UploadFile(@$"eboot/{gameID}/original/EBOOT.BIN.BAK", $"ftp://{ps3ip}/dev_hdd0/game/{gameID}/USRDIR/EBOOT.BIN", user, pass);
|
FTP.UploadFile(@$"eboot/{gameID}/original/EBOOT.BIN.BAK", $"ftp://{ps3ip}/dev_hdd0/game/{gameID}/USRDIR/EBOOT.BIN", user, pass);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new WebException("Could not find EBOOT.BIN.BAK on server.");
|
throw new WebException("Could not find EBOOT.BIN.BAK on server.");
|
||||||
}
|
}
|
||||||
|
}).Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PSNEBOOTRemotePatch(string ps3ip, string gameID, string serverURL, string user, string pass)
|
public void PSNEBOOTRemotePatch(string ps3ip, string gameID, string serverURL, string user, string pass)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Detected Digital Copy - Running in Full Mode");
|
Console.WriteLine("Detected Digital Copy - Running in Full Mode");
|
||||||
|
|
||||||
|
// Create a new thread so we don't occupy the UI thread.
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
string idps = "";
|
string idps = "";
|
||||||
string contentID = "";
|
string contentID = "";
|
||||||
Dictionary<string, string> users;
|
Dictionary<string, string> users;
|
||||||
|
@ -142,7 +158,7 @@ public class RemotePatch
|
||||||
File.WriteAllBytes(@"data/idps", IDPSHelper.StringToByteArray(idps));
|
File.WriteAllBytes(@"data/idps", IDPSHelper.StringToByteArray(idps));
|
||||||
|
|
||||||
// Scan the users on the system
|
// Scan the users on the system
|
||||||
users = GetUsers(ps3ip, user, pass);
|
users = GetUsersAsync(ps3ip, user, pass);
|
||||||
|
|
||||||
// Scan the system for a license for the game
|
// Scan the system for a license for the game
|
||||||
foreach (string currentUser in users.Keys.ToArray())
|
foreach (string currentUser in users.Keys.ToArray())
|
||||||
|
@ -196,6 +212,7 @@ public class RemotePatch
|
||||||
// And upload the encrypted, patched EBOOT to the system.
|
// And upload the encrypted, patched EBOOT to the system.
|
||||||
FTP.UploadFile(@$"eboot/{gameID}/patched/EBOOT.BIN",
|
FTP.UploadFile(@$"eboot/{gameID}/patched/EBOOT.BIN",
|
||||||
$"ftp://{ps3ip}/dev_hdd0/game/{gameID}/USRDIR/EBOOT.BIN", user, pass);
|
$"ftp://{ps3ip}/dev_hdd0/game/{gameID}/USRDIR/EBOOT.BIN", user, pass);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cut-down version that only patches disc copies
|
// Cut-down version that only patches disc copies
|
||||||
|
@ -203,6 +220,9 @@ public class RemotePatch
|
||||||
{
|
{
|
||||||
Console.WriteLine("Detected Disc Copy - Running in Simplified Mode");
|
Console.WriteLine("Detected Disc Copy - Running in Simplified Mode");
|
||||||
|
|
||||||
|
// Create a new thread so we don't occupy the UI thread.
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
// Create a simple directory structure
|
// Create a simple directory structure
|
||||||
Directory.CreateDirectory(@"eboot");
|
Directory.CreateDirectory(@"eboot");
|
||||||
Directory.CreateDirectory($@"eboot/{gameID}");
|
Directory.CreateDirectory($@"eboot/{gameID}");
|
||||||
|
@ -236,5 +256,6 @@ public class RemotePatch
|
||||||
// And upload the encrypted, patched EBOOT to the system.
|
// And upload the encrypted, patched EBOOT to the system.
|
||||||
FTP.UploadFile(@$"eboot/{gameID}/patched/EBOOT.BIN",
|
FTP.UploadFile(@$"eboot/{gameID}/patched/EBOOT.BIN",
|
||||||
$"ftp://{ps3ip}/dev_hdd0/game/{gameID}/USRDIR/EBOOT.BIN", user, pass);
|
$"ftp://{ps3ip}/dev_hdd0/game/{gameID}/USRDIR/EBOOT.BIN", user, pass);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue