mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-20 17:51:13 +02:00
Add restart emulation command
- Add RestartEmulation() method to MainWindowViewModel - Add 'Restart Emulation' menu item with Ctrl+R keybinding - Add locale translations for all supported languages - No confirmation dialog (faster restart experience)
This commit is contained in:
committed by
KeatonTheBot
parent
9104a75a48
commit
adc8ed594a
@@ -23,6 +23,7 @@
|
||||
"MenuBarOptionsStartGamesInFullscreen": "Start Games in Fullscreen Mode",
|
||||
"MenuBarOptionsStartGamesWithoutUI": "Start Games with UI Hidden",
|
||||
"MenuBarOptionsStopEmulation": "Stop Emulation",
|
||||
"MenuBarOptionsRestartEmulation": "Restart Emulation",
|
||||
"MenuBarOptionsSettings": "_Settings",
|
||||
"MenuBarOptionsManageUserProfiles": "_Manage User Profiles",
|
||||
"MenuBarActions": "_Actions",
|
||||
|
||||
@@ -115,6 +115,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
private string _screenshotKey = "F8";
|
||||
private float _volume;
|
||||
private ApplicationData _currentApplicationData;
|
||||
private bool _pendingRestart;
|
||||
private readonly AutoResetEvent _rendererWaitEvent;
|
||||
private int _customVSyncInterval;
|
||||
private int _customVSyncIntervalPercentageProxy;
|
||||
@@ -1092,6 +1093,14 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
|
||||
await LoadApplication(_currentApplicationData);
|
||||
}
|
||||
else if (_pendingRestart)
|
||||
{
|
||||
_pendingRestart = false;
|
||||
|
||||
Logger.Info?.Print(LogClass.Application, $"Restarting emulation for '{_currentApplicationData.Name}'");
|
||||
|
||||
await LoadApplication(_currentApplicationData);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, clear state.
|
||||
@@ -1100,6 +1109,21 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public void RestartEmulation()
|
||||
{
|
||||
if (AppHost is null || _currentApplicationData is null)
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.Application, "RestartEmulation called but no application is running.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.Info?.Print(LogClass.Application, $"Restart requested for '{_currentApplicationData.Name}'");
|
||||
|
||||
_pendingRestart = true;
|
||||
AppHost.Stop();
|
||||
}
|
||||
|
||||
private void Update_StatusBar(object sender, StatusUpdatedEventArgs args)
|
||||
{
|
||||
if (ShowMenuAndStatusBar && !ShowLoadProgress && Application.Current != null)
|
||||
|
||||
@@ -189,6 +189,11 @@
|
||||
Click="StopEmulation_Click"
|
||||
Header="{locale:Locale MenuBarOptionsStopEmulation}"
|
||||
InputGesture="Escape"
|
||||
IsEnabled="{Binding IsGameRunning}" />
|
||||
<MenuItem
|
||||
Name="RestartEmulationMenuItem"
|
||||
Header="{locale:Locale MenuBarOptionsRestartEmulation}"
|
||||
InputGesture="Ctrl + R"
|
||||
IsEnabled="{Binding IsGameRunning}"
|
||||
ToolTip.Tip="{locale:Locale StopEmulationTooltip}" />
|
||||
<MenuItem Command="{Binding SimulateWakeUpMessage}" Header="{locale:Locale MenuBarOptionsSimulateWakeUpMessage}" />
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<KeyBinding Gesture="Ctrl+A" Command="{Binding OpenAmiiboWindow}" />
|
||||
<KeyBinding Gesture="Ctrl+B" Command="{Binding OpenBinFile}" />
|
||||
<KeyBinding Gesture="Ctrl+," Command="{Binding OpenSettings}" />
|
||||
<KeyBinding Gesture="Ctrl+R" Command="{Binding RestartEmulation}" />
|
||||
</Window.KeyBindings>
|
||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<Grid.RowDefinitions>
|
||||
|
||||
Reference in New Issue
Block a user