mirror of
https://github.com/LBPUnion/UnionPatcher.git
synced 2025-04-22 12:35:18 +00:00
Squashed commit of the following: commit db54f752b1a7d876c8e8ac23f64fac0e133c6c42 Author: jvyden <jvyden@jvyden.xyz> Date: Tue Jun 14 21:50:24 2022 -0400 Fix warnings in Program.cs, remove version commit abab75e00a9fa5c762669365a130025b7fa28522 Author: jvyden <jvyden@jvyden.xyz> Date: Tue Jun 14 21:45:08 2022 -0400 Enforce file-scoped namespaces commit d004b8dd77546b0dedc572bc3e7849677a707697 Author: jvyden <jvyden@jvyden.xyz> Date: Tue Jun 14 21:43:53 2022 -0400 Cleanup remote patching commit d611df7e2e5ad86466acb3fe95b835e5df3efa38 Author: jvyden <jvyden@jvyden.xyz> Date: Tue Jun 14 21:25:57 2022 -0400 Theoretically working state commit 18b362e268d800bac3c6fa5c3ae0c0b896627648 Author: jvyden <jvyden@jvyden.xyz> Date: Tue Jun 14 21:10:58 2022 -0400 Import code from UnionRemotePatcher Co-authored-by: Logan Lowe <loganr.lowe@gmail.com>
51 lines
No EOL
1.5 KiB
C#
51 lines
No EOL
1.5 KiB
C#
using System.Diagnostics;
|
|
using LBPUnion.UnionPatcher;
|
|
|
|
namespace UnionPatcher.Cli;
|
|
|
|
public static class Program {
|
|
|
|
private static string? fileName;
|
|
public static string FileName {
|
|
get {
|
|
if(fileName != null) return fileName;
|
|
|
|
return fileName = (Path.GetFileName(Process.GetCurrentProcess().MainModule?.FileName) ?? "");
|
|
}
|
|
}
|
|
|
|
public static void Main(string[] args) {
|
|
if(args.Length < 3) {
|
|
PrintHelp();
|
|
return;
|
|
}
|
|
|
|
ElfFile eboot = new(new FileInfo(args[0]));
|
|
|
|
if(!eboot.IsValid) {
|
|
Console.WriteLine($"{eboot.Name} is not a valid ELF file (magic number mismatch)");
|
|
Console.WriteLine("The EBOOT must be decrypted before using this tool");
|
|
return;
|
|
}
|
|
|
|
if(eboot.Is64Bit == null) {
|
|
Console.WriteLine($"{eboot.Name} does not target a valid system");
|
|
return;
|
|
}
|
|
|
|
if(string.IsNullOrWhiteSpace(eboot.Architecture)) {
|
|
Console.WriteLine($"{eboot.Name} does not target a valid architecture (PowerPC or ARM)");
|
|
return;
|
|
}
|
|
|
|
Console.WriteLine($"{eboot.Name} targets {eboot.Architecture}");
|
|
|
|
Patcher.PatchFile(args[0], args[1], args[2]);
|
|
Console.WriteLine($"Successfully patched Server URL to {args[1]}.");
|
|
}
|
|
|
|
public static void PrintHelp() {
|
|
Console.WriteLine("UnionPatcher");
|
|
Console.WriteLine($" Usage: {FileName} <Input EBOOT.elf> <Server URL> <Output filename>");
|
|
}
|
|
} |