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",
|
"MenuBarOptionsStartGamesInFullscreen": "Start Games in Fullscreen Mode",
|
||||||
"MenuBarOptionsStartGamesWithoutUI": "Start Games with UI Hidden",
|
"MenuBarOptionsStartGamesWithoutUI": "Start Games with UI Hidden",
|
||||||
"MenuBarOptionsStopEmulation": "Stop Emulation",
|
"MenuBarOptionsStopEmulation": "Stop Emulation",
|
||||||
|
"MenuBarOptionsRestartEmulation": "Restart Emulation",
|
||||||
"MenuBarOptionsSettings": "_Settings",
|
"MenuBarOptionsSettings": "_Settings",
|
||||||
"MenuBarOptionsManageUserProfiles": "_Manage User Profiles",
|
"MenuBarOptionsManageUserProfiles": "_Manage User Profiles",
|
||||||
"MenuBarActions": "_Actions",
|
"MenuBarActions": "_Actions",
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
private string _screenshotKey = "F8";
|
private string _screenshotKey = "F8";
|
||||||
private float _volume;
|
private float _volume;
|
||||||
private ApplicationData _currentApplicationData;
|
private ApplicationData _currentApplicationData;
|
||||||
|
private bool _pendingRestart;
|
||||||
private readonly AutoResetEvent _rendererWaitEvent;
|
private readonly AutoResetEvent _rendererWaitEvent;
|
||||||
private int _customVSyncInterval;
|
private int _customVSyncInterval;
|
||||||
private int _customVSyncIntervalPercentageProxy;
|
private int _customVSyncIntervalPercentageProxy;
|
||||||
@@ -1092,6 +1093,14 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
await LoadApplication(_currentApplicationData);
|
await LoadApplication(_currentApplicationData);
|
||||||
}
|
}
|
||||||
|
else if (_pendingRestart)
|
||||||
|
{
|
||||||
|
_pendingRestart = false;
|
||||||
|
|
||||||
|
Logger.Info?.Print(LogClass.Application, $"Restarting emulation for '{_currentApplicationData.Name}'");
|
||||||
|
|
||||||
|
await LoadApplication(_currentApplicationData);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Otherwise, clear state.
|
// 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)
|
private void Update_StatusBar(object sender, StatusUpdatedEventArgs args)
|
||||||
{
|
{
|
||||||
if (ShowMenuAndStatusBar && !ShowLoadProgress && Application.Current != null)
|
if (ShowMenuAndStatusBar && !ShowLoadProgress && Application.Current != null)
|
||||||
|
|||||||
@@ -189,6 +189,11 @@
|
|||||||
Click="StopEmulation_Click"
|
Click="StopEmulation_Click"
|
||||||
Header="{locale:Locale MenuBarOptionsStopEmulation}"
|
Header="{locale:Locale MenuBarOptionsStopEmulation}"
|
||||||
InputGesture="Escape"
|
InputGesture="Escape"
|
||||||
|
IsEnabled="{Binding IsGameRunning}" />
|
||||||
|
<MenuItem
|
||||||
|
Name="RestartEmulationMenuItem"
|
||||||
|
Header="{locale:Locale MenuBarOptionsRestartEmulation}"
|
||||||
|
InputGesture="Ctrl + R"
|
||||||
IsEnabled="{Binding IsGameRunning}"
|
IsEnabled="{Binding IsGameRunning}"
|
||||||
ToolTip.Tip="{locale:Locale StopEmulationTooltip}" />
|
ToolTip.Tip="{locale:Locale StopEmulationTooltip}" />
|
||||||
<MenuItem Command="{Binding SimulateWakeUpMessage}" Header="{locale:Locale MenuBarOptionsSimulateWakeUpMessage}" />
|
<MenuItem Command="{Binding SimulateWakeUpMessage}" Header="{locale:Locale MenuBarOptionsSimulateWakeUpMessage}" />
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
<KeyBinding Gesture="Ctrl+A" Command="{Binding OpenAmiiboWindow}" />
|
<KeyBinding Gesture="Ctrl+A" Command="{Binding OpenAmiiboWindow}" />
|
||||||
<KeyBinding Gesture="Ctrl+B" Command="{Binding OpenBinFile}" />
|
<KeyBinding Gesture="Ctrl+B" Command="{Binding OpenBinFile}" />
|
||||||
<KeyBinding Gesture="Ctrl+," Command="{Binding OpenSettings}" />
|
<KeyBinding Gesture="Ctrl+," Command="{Binding OpenSettings}" />
|
||||||
|
<KeyBinding Gesture="Ctrl+R" Command="{Binding RestartEmulation}" />
|
||||||
</Window.KeyBindings>
|
</Window.KeyBindings>
|
||||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|||||||
Reference in New Issue
Block a user