diff --git a/Directory.Packages.props b/Directory.Packages.props index f1d7cac61..64867fc5b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -42,7 +42,7 @@ - + diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index 7d7674c4e..1dd4a6b6d 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -793,7 +793,7 @@ private bool Filter(object arg) return false; } - private async Task HandleFirmwareInstallation(string filename) + public async Task HandleFirmwareInstallation(string filename) { try { diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index 96b3d08aa..c5f886ff3 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -139,8 +139,21 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e) base.OnApplyTemplate(e); NotificationHelper.SetNotificationManager(this); - - Executor.ExecuteBackgroundAsync(ShowIntelMacWarningAsync); + + Executor.ExecuteBackgroundAsync(async () => + { + await ShowIntelMacWarningAsync(); + FilePath firmwarePath = CommandLineState.FirmwareToInstallPathArg; + if (firmwarePath is not null) + { + if ((firmwarePath.ExistsAsFile && firmwarePath.Extension is "xci" or "zip") || + firmwarePath.ExistsAsDirectory) + await Dispatcher.UIThread.InvokeAsync(() => + ViewModel.HandleFirmwareInstallation(firmwarePath)); + else + Logger.Notice.Print(LogClass.UI, "Invalid firmware type provided. Path must be a directory, or a .zip or .xci file."); + } + }); } private void OnScalingChanged(object sender, EventArgs e) diff --git a/src/Ryujinx/Utilities/CommandLineState.cs b/src/Ryujinx/Utilities/CommandLineState.cs index 3eafb8d01..d6e8f669c 100644 --- a/src/Ryujinx/Utilities/CommandLineState.cs +++ b/src/Ryujinx/Utilities/CommandLineState.cs @@ -1,3 +1,4 @@ +using Gommon; using Ryujinx.Common.Logging; using System.Collections.Generic; @@ -13,6 +14,7 @@ public static class CommandLineState public static string OverrideBackendThreading { get; private set; } public static string OverrideHideCursor { get; private set; } public static string BaseDirPathArg { get; private set; } + public static FilePath FirmwareToInstallPathArg { get; private set; } public static string Profile { get; private set; } public static string LaunchPathArg { get; private set; } public static string LaunchApplicationId { get; private set; } @@ -41,6 +43,19 @@ public static void ParseArguments(string[] args) BaseDirPathArg = args[++i]; + arguments.Add(arg); + arguments.Add(args[i]); + break; + case "--install-firmware": + if (i + 1 >= args.Length) + { + Logger.Error?.Print(LogClass.Application, $"Invalid option '{arg}'"); + + continue; + } + + FirmwareToInstallPathArg = new FilePath(args[++i]); + arguments.Add(arg); arguments.Add(args[i]); break;