mirror of
https://github.com/LBPUnion/UnionPatcher.git
synced 2025-04-23 13:05:17 +00:00
Added ARM Linux support (#23)
* Ignored .DS_Store * Add arm64 linux scetool and code to work with it * added linux scetool for arm * Left some vestigial code, whoops
This commit is contained in:
parent
159dd9f3cc
commit
bb4d691364
5 changed files with 77 additions and 33 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -396,3 +396,4 @@ FodyWeavers.xsd
|
|||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
.DS_Store
|
||||
|
|
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,44 +38,53 @@ public class RemotePatch
|
|||
public static void LaunchSCETool(string args)
|
||||
{
|
||||
string platformExecutable = "";
|
||||
|
||||
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))
|
||||
switch (OSUtil.GetPlatform())
|
||||
{
|
||||
if (RuntimeInformation.OSArchitecture == Architecture.Arm64)
|
||||
{
|
||||
platformExecutable = "scetool/macarm64/scetool"; // For Apple Silicon Macs
|
||||
}
|
||||
else
|
||||
{
|
||||
platformExecutable = "scetool/mac64/scetool";
|
||||
}
|
||||
}
|
||||
if (platformExecutable != "")
|
||||
{
|
||||
ProcessStartInfo startInfo = new();
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.FileName = Path.GetFullPath(platformExecutable);
|
||||
startInfo.WorkingDirectory = Path.GetFullPath(".");
|
||||
startInfo.Arguments = args;
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
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)
|
||||
{
|
||||
platformExecutable = "scetool/macarm64/scetool"; // For Apple Silicon Macs
|
||||
}
|
||||
else
|
||||
{
|
||||
platformExecutable = "scetool/mac64/scetool";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Error starting SCETool. Your platform may not be supported yet.");
|
||||
|
||||
Console.WriteLine("\n\n===== START SCETOOL =====\n");
|
||||
using (Process proc = Process.Start(startInfo))
|
||||
{
|
||||
while (!proc.StandardOutput.EndOfStream) Console.WriteLine(proc.StandardOutput.ReadLine());
|
||||
proc.WaitForExit();
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine("\n===== END SCETOOL =====\n\n");
|
||||
}
|
||||
else
|
||||
ProcessStartInfo startInfo = new();
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.FileName = Path.GetFullPath(platformExecutable);
|
||||
startInfo.WorkingDirectory = Path.GetFullPath(".");
|
||||
startInfo.Arguments = args;
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
|
||||
Console.WriteLine("\n\n===== START SCETOOL =====\n");
|
||||
using (Process proc = Process.Start(startInfo))
|
||||
{
|
||||
throw new Exception("Error starting SCETool. Your platform may not be supported yet.");
|
||||
while (!proc.StandardOutput.EndOfStream) Console.WriteLine(proc.StandardOutput.ReadLine());
|
||||
proc.WaitForExit();
|
||||
}
|
||||
|
||||
Console.WriteLine("\n===== END SCETOOL =====\n\n");
|
||||
}
|
||||
|
||||
public void RevertEBOOT(string ps3ip, string gameID, string serverURL, string user, string pass)
|
||||
|
|
BIN
UnionPatcher/scetool/linuxarm/scetool
Executable file
BIN
UnionPatcher/scetool/linuxarm/scetool
Executable file
Binary file not shown.
BIN
UnionPatcher/scetool/linuxarm64/scetool
Normal file
BIN
UnionPatcher/scetool/linuxarm64/scetool
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue