mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-12-13 13:37:00 +00:00
This window can be accessed via "Help" menu in the title bar. This menu's data is synced with the in-app-list LDN game data, and that has been modified to hide unjoinable games (in-progress and/or private (needing a passphrase)). You can still see these games in the list.
70 lines
2.1 KiB
C#
70 lines
2.1 KiB
C#
using FluentAvalonia.UI.Controls;
|
|
using Ryujinx.Ava.Common.Locale;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Ryujinx.Ava.Systems
|
|
{
|
|
internal static class Rebooter
|
|
{
|
|
|
|
private static readonly string _updateDir = Path.Combine(Path.GetTempPath(), "Ryujinx", "update");
|
|
|
|
public static void RebootAppWithGame(string gamePath, List<string> args)
|
|
{
|
|
_ = Reboot(gamePath, args);
|
|
|
|
}
|
|
|
|
private static async Task Reboot(string gamePath, List<string> args)
|
|
{
|
|
|
|
bool shouldRestart = true;
|
|
|
|
TaskDialog taskDialog = new()
|
|
{
|
|
Header = LocaleManager.Instance[LocaleKeys.RyujinxRebooter],
|
|
SubHeader = LocaleManager.Instance[LocaleKeys.DialogRebooterMessage],
|
|
IconSource = new SymbolIconSource { Symbol = Symbol.Games },
|
|
XamlRoot = RyujinxApp.MainWindow,
|
|
};
|
|
|
|
if (shouldRestart)
|
|
{
|
|
string executableDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
|
|
|
_ = taskDialog.ShowAsync(true);
|
|
await Task.Delay(500);
|
|
|
|
// Find the process name.
|
|
string ryuName = Path.GetFileName(Environment.ProcessPath) ?? string.Empty;
|
|
|
|
// Fallback if the executable could not be found.
|
|
if (ryuName.Length == 0 || !Path.Exists(Path.Combine(executableDirectory, ryuName)))
|
|
{
|
|
ryuName = OperatingSystem.IsWindows() ? "Ryujinx.exe" : "Ryujinx";
|
|
}
|
|
|
|
ProcessStartInfo processStart = new(ryuName)
|
|
{
|
|
UseShellExecute = true,
|
|
WorkingDirectory = executableDirectory,
|
|
};
|
|
|
|
foreach (var arg in args)
|
|
{
|
|
processStart.ArgumentList.Add(arg);
|
|
}
|
|
|
|
processStart.ArgumentList.Add(gamePath);
|
|
|
|
Process.Start(processStart);
|
|
|
|
Environment.Exit(0);
|
|
}
|
|
}
|
|
}
|
|
}
|