mirror of
https://github.com/LBPUnion/UnionPatcher.git
synced 2025-04-26 06:19:00 +00:00
Add arm64 linux scetool and code to work with it
This commit is contained in:
parent
a79090a844
commit
1c0599aad9
3 changed files with 77 additions and 21 deletions
34
UnionPatcher/OSUtil.cs
Normal file
34
UnionPatcher/OSUtil.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace LBPUnion.UnionPatcher
|
||||||
|
{
|
||||||
|
using RuntimeOSPlatform = System.Runtime.InteropServices.OSPlatform;
|
||||||
|
|
||||||
|
public enum OSPlatform
|
||||||
|
{
|
||||||
|
NotSupported,
|
||||||
|
Windows,
|
||||||
|
OSX,
|
||||||
|
Linux,
|
||||||
|
}
|
||||||
|
public class OSUtil
|
||||||
|
{
|
||||||
|
private static IEnumerable
|
||||||
|
<(OSPlatform Platform, RuntimeOSPlatform RuntimePlatform)?> EnumeratePlatforms()
|
||||||
|
{
|
||||||
|
yield return (OSPlatform.Windows, RuntimeOSPlatform.Windows);
|
||||||
|
yield return (OSPlatform.OSX, RuntimeOSPlatform.OSX);
|
||||||
|
yield return (OSPlatform.Linux, RuntimeOSPlatform.Linux);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OSPlatform GetPlatform()
|
||||||
|
{
|
||||||
|
return EnumeratePlatforms().FirstOrDefault(p
|
||||||
|
=> RuntimeInformation.IsOSPlatform(p.Value.RuntimePlatform))?.Platform ?? default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -38,13 +38,24 @@ public class RemotePatch
|
||||||
public static void LaunchSCETool(string args)
|
public static void LaunchSCETool(string args)
|
||||||
{
|
{
|
||||||
string platformExecutable = "";
|
string platformExecutable = "";
|
||||||
|
switch (OSUtil.GetPlatform())
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
||||||
platformExecutable = "scetool/win64/scetool.exe";
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
||||||
platformExecutable = "scetool/linux64/scetool";
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
||||||
{
|
{
|
||||||
|
case OSPlatform.Windows:
|
||||||
|
platformExecutable = "scetool/win64/scetool.exe";
|
||||||
|
break;
|
||||||
|
case OSPlatform.Linux:
|
||||||
|
if(RuntimeInformation.ProcessArchitecture == Architecture.X64)
|
||||||
|
{
|
||||||
|
platformExecutable = "scetool/linux64/scetool";
|
||||||
|
} else if (RuntimeInformation.ProcessArchitecture == Architecture.Arm)
|
||||||
|
{
|
||||||
|
platformExecutable = "scetool/linuxarm/scetool";
|
||||||
|
} else if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
||||||
|
{
|
||||||
|
platformExecutable = "scetool/linuxarm64/scetool";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OSPlatform.OSX:
|
||||||
if (RuntimeInformation.OSArchitecture == Architecture.Arm64)
|
if (RuntimeInformation.OSArchitecture == Architecture.Arm64)
|
||||||
{
|
{
|
||||||
platformExecutable = "scetool/macarm64/scetool"; // For Apple Silicon Macs
|
platformExecutable = "scetool/macarm64/scetool"; // For Apple Silicon Macs
|
||||||
|
@ -53,9 +64,12 @@ public class RemotePatch
|
||||||
{
|
{
|
||||||
platformExecutable = "scetool/mac64/scetool";
|
platformExecutable = "scetool/mac64/scetool";
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Error starting SCETool. Your platform may not be supported yet.");
|
||||||
|
|
||||||
}
|
}
|
||||||
if (platformExecutable != "")
|
|
||||||
{
|
|
||||||
ProcessStartInfo startInfo = new();
|
ProcessStartInfo startInfo = new();
|
||||||
startInfo.UseShellExecute = false;
|
startInfo.UseShellExecute = false;
|
||||||
startInfo.FileName = Path.GetFullPath(platformExecutable);
|
startInfo.FileName = Path.GetFullPath(platformExecutable);
|
||||||
|
@ -71,11 +85,7 @@ public class RemotePatch
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("\n===== END SCETOOL =====\n\n");
|
Console.WriteLine("\n===== END SCETOOL =====\n\n");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception("Error starting SCETool. Your platform may not be supported yet.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RevertEBOOT(string ps3ip, string gameID, string serverURL, string user, string pass)
|
public void RevertEBOOT(string ps3ip, string gameID, string serverURL, string user, string pass)
|
||||||
|
@ -228,4 +238,16 @@ public class RemotePatch
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static OSPlatform GetPlatform() // this should be moved elsewhere later
|
||||||
|
{
|
||||||
|
OSPlatform platform = new OSPlatform();
|
||||||
|
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) platform = OSPlatform.Windows;
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) platform = OSPlatform.Linux;
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) platform = OSPlatform.OSX;
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)) platform = OSPlatform.FreeBSD;
|
||||||
|
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
UnionPatcher/scetool/linuxarm64/scetool
Normal file
BIN
UnionPatcher/scetool/linuxarm64/scetool
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue