mirror of
https://github.com/patchzyy/wiicompiled
synced 2026-09-28 15:29:25 -04:00
0d04be19d6
* macos: add x86_64 Intel support * aurora: construct texture replacement index entries * Switch back to LLVM 22 so build can succeed on at least some systems (#141) two upstream LLVM bugs currently prevent building on some of the newest distros. There is no current LLVM release that works on them so we are pending fixes from LLVM https://github.com/patchzyy/Wiicompiled/issues/136 * Fix GC Pocket+ rumble stop handling (#148) * macos: package universal setup tools * ci: build macOS input expression tests * runtime: Do not force 14.0 minimum anymore new minimum is 12.0 * Update network_socket.cpp * fix(macos): increase guest fiber stack size (#154) * v0.2.28 * Update settings_overlay.cpp * macos: support older libc++ algorithms * Load console identity from NAND setting.txt (#164) * Add synthetic recompilation CI workflow (#161) * version * macos: allow undefined MTLLogStateDescriptor for older SDKs * tests: deflake input expression timing window test * import setting.txt (#169) * import setting.txt * coderabbit ugh * Treat empty MKW save as missing rather than corrupt (#168) * treat empty mkw save as missing first-run format zero-fills rksys.dat before any real save; a quit before the first save left an all-zero file that read back as corrupt and trapped the user in a delete/recreate loop. read opens now treat an all-zero rksys.dat as absent (a real save always begins with the RKSD0006 header), so the game recreates it from scratch. also ignore native build output. * shorten * I dont really want to change this to be honest. * extra safety --------- Co-authored-by: patchzyy <64382339+patchzyy@users.noreply.github.com> * version 0.2.30 * csnum fix * update * build: Fix mac tests * translator: emit null statement after continuation labels for C++17 compatibility * review fixes --------- Co-authored-by: theofficialgman <28281419+theofficialgman@users.noreply.github.com> Co-authored-by: Cristian Boehm <75502884+GalaxisBeast@users.noreply.github.com> Co-authored-by: patchzyy <64382339+patchzyy@users.noreply.github.com> Co-authored-by: Wubbzee <41394708+JGM01@users.noreply.github.com>
137 lines
5.2 KiB
C#
137 lines
5.2 KiB
C#
namespace WiiCompiled.Setup.Windows;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
internal static class Program
|
|
{
|
|
private static int Main(string[] args)
|
|
{
|
|
var progressJson = CommandLine.WantsProgressJson(args);
|
|
|
|
try
|
|
{
|
|
PlatformChecks.EnsureSupportedHost();
|
|
|
|
if (args.Length == 0 && GetConsoleProcessList(new uint[1], 1) == 1)
|
|
{
|
|
Console.Out.WriteLine(
|
|
"Mario Kart WiiCompiled is installed through Wheel Wizard - download it from " +
|
|
"https://github.com/TeamWheelWizard/WheelWizard");
|
|
Console.ReadKey(intercept: true);
|
|
return 0;
|
|
}
|
|
|
|
CommandLine command;
|
|
try
|
|
{
|
|
command = CommandLine.Parse(args);
|
|
}
|
|
catch (ArgumentException ex) when (args.Length > 0)
|
|
{
|
|
// A command line was supplied, so a caller is driving this process. Rejecting the
|
|
// command with a modal dialog would hang that caller forever.
|
|
if (progressJson) new NdjsonInstallReporter().Failure(ex.Message);
|
|
else Console.Error.WriteLine(ex.Message);
|
|
return 1;
|
|
}
|
|
|
|
if (command.Mode == AppMode.Version)
|
|
return ConsoleCommands.Version();
|
|
|
|
if (command.Mode == AppMode.Help)
|
|
return ConsoleCommands.Help();
|
|
|
|
if (command.Mode == AppMode.SelfTest)
|
|
return SelfTests.Run();
|
|
|
|
if (command.Mode == AppMode.VerifyInputs)
|
|
return ConsoleCommands.VerifyInputs(command);
|
|
|
|
if (command.Mode == AppMode.EmitPayloadIdentities)
|
|
return ConsoleCommands.EmitPayloadIdentities(command);
|
|
|
|
if (command.Mode == AppMode.CheckProducts)
|
|
{
|
|
using var cancellationSignal = CancellationSignal.ObserveEnvironment();
|
|
return ConsoleCommands.CheckProducts(command, cancellationSignal.Token);
|
|
}
|
|
|
|
if (command.Mode is AppMode.LaunchBase or AppMode.LaunchRetro)
|
|
return GameLaunchService.LaunchAsync(
|
|
command.Mode == AppMode.LaunchBase ? BuildProfile.Base : BuildProfile.RetroRewind)
|
|
.GetAwaiter().GetResult();
|
|
|
|
if (command.Mode is AppMode.SilentInstall or AppMode.RepairProducts)
|
|
{
|
|
using var cancellationSignal = CancellationSignal.ObserveEnvironment();
|
|
return command.Mode == AppMode.SilentInstall
|
|
? ConsoleCommands.Install(command, cancellationSignal.Token).GetAwaiter().GetResult()
|
|
: ConsoleCommands.RepairProducts(command, cancellationSignal.Token)
|
|
.GetAwaiter().GetResult();
|
|
}
|
|
|
|
if (command.Mode is AppMode.Uninstall or AppMode.SilentUninstall)
|
|
{
|
|
UninstallService.StartWorker(command.InstallDirectory!,
|
|
quiet: command.Mode == AppMode.SilentUninstall || command.Quiet);
|
|
return 0;
|
|
}
|
|
|
|
if (command.Mode == AppMode.UninstallWorker)
|
|
return UninstallService.RunWorker(command.InstallDirectory!, command.Quiet);
|
|
|
|
return ConsoleCommands.Help();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
// A caller reading the NDJSON protocol must always receive a terminal result line, even
|
|
// when the failure happened before the installer was reached (a bad command line, for
|
|
// instance). ConsoleCommands already reports its own failures, so this only fires for
|
|
// errors raised outside it.
|
|
if (progressJson)
|
|
{
|
|
new NdjsonInstallReporter().Failure(ex.Message);
|
|
Console.Error.WriteLine(ex);
|
|
}
|
|
else
|
|
{
|
|
Console.Error.WriteLine(ex);
|
|
}
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
[DllImport("kernel32.dll", SetLastError = true)]
|
|
private static extern uint GetConsoleProcessList(
|
|
[Out] uint[] processList,
|
|
uint processCount);
|
|
}
|
|
|
|
internal static class PlatformChecks
|
|
{
|
|
public static void EnsureSupportedHost()
|
|
{
|
|
if (!OperatingSystem.IsWindows() || !Environment.Is64BitOperatingSystem)
|
|
throw new PlatformNotSupportedException("WiiCompiled requires 64-bit Windows.");
|
|
if (!OperatingSystem.IsWindowsVersionAtLeast(10, 0, 18362))
|
|
throw new PlatformNotSupportedException("WiiCompiled requires Windows 10 version 1903 or newer.");
|
|
}
|
|
}
|
|
|
|
internal static class ProductInfo
|
|
{
|
|
public const string Name = "WiiCompiled";
|
|
public const string Version = "0.2.31";
|
|
|
|
/// <summary>
|
|
/// The setup executable is copied into the installation under this name. It is the launcher and
|
|
/// launch entry point named by the Wheel Wizard contract, so the name is part of that interface.
|
|
/// </summary>
|
|
public const string SetupCopyName = "WiiCompiled-Setup.exe";
|
|
|
|
public const string UninstallKey = @"Software\Microsoft\Windows\CurrentVersion\Uninstall\WiiCompiled";
|
|
public static string DefaultInstallDirectory =>
|
|
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
|
"Programs", "WiiCompiled");
|
|
}
|