Skip to content

Commit

Permalink
UI: --install-firmware startup flag.
Browse files Browse the repository at this point in the history
Has the normal UI flow, this is just for systems where the file picker doesn't show up.
  • Loading branch information
GreemDev committed Feb 20, 2025
1 parent de16d8f commit c2ed0fd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.3-build14" />
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" />
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.30.0-build32" />
<PackageVersion Include="Gommon" Version="2.7.1" />
<PackageVersion Include="Gommon" Version="2.7.1.1" />
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />
<PackageVersion Include="Sep" Version="0.6.0" />
<PackageVersion Include="shaderc.net" Version="0.1.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ private bool Filter(object arg)
return false;
}

private async Task HandleFirmwareInstallation(string filename)
public async Task HandleFirmwareInstallation(string filename)
{
try
{
Expand Down
17 changes: 15 additions & 2 deletions src/Ryujinx/UI/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions src/Ryujinx/Utilities/CommandLineState.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Gommon;
using Ryujinx.Common.Logging;
using System.Collections.Generic;

Expand All @@ -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; }
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c2ed0fd

Please sign in to comment.