mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-24 08:04:14 +00:00
Improve indication of emulation being paused by the User (#5836)
* Improve indication of emulation being paused by the User * Use localised for Paused * Backup original title - PR comments fix * Add common helper method to assemble App title
This commit is contained in:
parent
2989c163a8
commit
93aeecc4f3
5 changed files with 42 additions and 14 deletions
|
@ -346,16 +346,9 @@ namespace Ryujinx.Ava
|
||||||
|
|
||||||
_viewModel.IsGameRunning = true;
|
_viewModel.IsGameRunning = true;
|
||||||
|
|
||||||
var activeProcess = Device.Processes.ActiveApplication;
|
|
||||||
|
|
||||||
string titleNameSection = string.IsNullOrWhiteSpace(activeProcess.Name) ? string.Empty : $" {activeProcess.Name}";
|
|
||||||
string titleVersionSection = string.IsNullOrWhiteSpace(activeProcess.DisplayVersion) ? string.Empty : $" v{activeProcess.DisplayVersion}";
|
|
||||||
string titleIdSection = $" ({activeProcess.ProgramIdText.ToUpper()})";
|
|
||||||
string titleArchSection = activeProcess.Is64Bit ? " (64-bit)" : " (32-bit)";
|
|
||||||
|
|
||||||
Dispatcher.UIThread.InvokeAsync(() =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
_viewModel.Title = $"Ryujinx {Program.Version} -{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}";
|
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device.Processes.ActiveApplication, Program.Version);
|
||||||
});
|
});
|
||||||
|
|
||||||
_viewModel.SetUiProgressHandlers(Device);
|
_viewModel.SetUiProgressHandlers(Device);
|
||||||
|
@ -727,6 +720,8 @@ namespace Ryujinx.Ava
|
||||||
Device?.System.TogglePauseEmulation(false);
|
Device?.System.TogglePauseEmulation(false);
|
||||||
|
|
||||||
_viewModel.IsPaused = false;
|
_viewModel.IsPaused = false;
|
||||||
|
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version);
|
||||||
|
Logger.Info?.Print(LogClass.Emulation, "Emulation was resumed");
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Pause()
|
internal void Pause()
|
||||||
|
@ -734,6 +729,8 @@ namespace Ryujinx.Ava
|
||||||
Device?.System.TogglePauseEmulation(true);
|
Device?.System.TogglePauseEmulation(true);
|
||||||
|
|
||||||
_viewModel.IsPaused = true;
|
_viewModel.IsPaused = true;
|
||||||
|
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, LocaleManager.Instance[LocaleKeys.Paused]);
|
||||||
|
Logger.Info?.Print(LogClass.Emulation, "Emulation was paused");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeSwitchInstance()
|
private void InitializeSwitchInstance()
|
||||||
|
|
|
@ -600,6 +600,7 @@
|
||||||
"Cancel": "Cancel",
|
"Cancel": "Cancel",
|
||||||
"Save": "Save",
|
"Save": "Save",
|
||||||
"Discard": "Discard",
|
"Discard": "Discard",
|
||||||
|
"Paused": "Paused",
|
||||||
"UserProfilesSetProfileImage": "Set Profile Image",
|
"UserProfilesSetProfileImage": "Set Profile Image",
|
||||||
"UserProfileEmptyNameError": "Name is required",
|
"UserProfileEmptyNameError": "Name is required",
|
||||||
"UserProfileNoImageError": "Profile image must be set",
|
"UserProfileNoImageError": "Profile image must be set",
|
||||||
|
|
30
src/Ryujinx.Ui.Common/Helper/TitleHelper.cs
Normal file
30
src/Ryujinx.Ui.Common/Helper/TitleHelper.cs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
using Ryujinx.HLE.Loaders.Processes;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ui.Common.Helper
|
||||||
|
{
|
||||||
|
public static class TitleHelper
|
||||||
|
{
|
||||||
|
public static string ActiveApplicationTitle(ProcessResult activeProcess, string applicationVersion, string pauseString = "")
|
||||||
|
{
|
||||||
|
if (activeProcess == null)
|
||||||
|
{
|
||||||
|
return String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
string titleNameSection = string.IsNullOrWhiteSpace(activeProcess.Name) ? string.Empty : $" {activeProcess.Name}";
|
||||||
|
string titleVersionSection = string.IsNullOrWhiteSpace(activeProcess.DisplayVersion) ? string.Empty : $" v{activeProcess.DisplayVersion}";
|
||||||
|
string titleIdSection = $" ({activeProcess.ProgramIdText.ToUpper()})";
|
||||||
|
string titleArchSection = activeProcess.Is64Bit ? " (64-bit)" : " (32-bit)";
|
||||||
|
|
||||||
|
string appTitle = $"Ryujinx {applicationVersion} -{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}";
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(pauseString))
|
||||||
|
{
|
||||||
|
appTitle += $" ({pauseString})";
|
||||||
|
}
|
||||||
|
|
||||||
|
return appTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1453,6 +1453,8 @@ namespace Ryujinx.Ui
|
||||||
_pauseEmulation.Sensitive = false;
|
_pauseEmulation.Sensitive = false;
|
||||||
_resumeEmulation.Sensitive = true;
|
_resumeEmulation.Sensitive = true;
|
||||||
_emulationContext.System.TogglePauseEmulation(true);
|
_emulationContext.System.TogglePauseEmulation(true);
|
||||||
|
Title = TitleHelper.ActiveApplicationTitle(_emulationContext.Processes.ActiveApplication, Program.Version, "Paused");
|
||||||
|
Logger.Info?.Print(LogClass.Emulation, "Emulation was paused");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResumeEmulation_Pressed(object sender, EventArgs args)
|
private void ResumeEmulation_Pressed(object sender, EventArgs args)
|
||||||
|
@ -1460,6 +1462,8 @@ namespace Ryujinx.Ui
|
||||||
_pauseEmulation.Sensitive = true;
|
_pauseEmulation.Sensitive = true;
|
||||||
_resumeEmulation.Sensitive = false;
|
_resumeEmulation.Sensitive = false;
|
||||||
_emulationContext.System.TogglePauseEmulation(false);
|
_emulationContext.System.TogglePauseEmulation(false);
|
||||||
|
Title = TitleHelper.ActiveApplicationTitle(_emulationContext.Processes.ActiveApplication, Program.Version);
|
||||||
|
Logger.Info?.Print(LogClass.Emulation, "Emulation was resumed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ActivatePauseMenu()
|
public void ActivatePauseMenu()
|
||||||
|
|
|
@ -11,6 +11,7 @@ using Ryujinx.Input;
|
||||||
using Ryujinx.Input.GTK3;
|
using Ryujinx.Input.GTK3;
|
||||||
using Ryujinx.Input.HLE;
|
using Ryujinx.Input.HLE;
|
||||||
using Ryujinx.Ui.Common.Configuration;
|
using Ryujinx.Ui.Common.Configuration;
|
||||||
|
using Ryujinx.Ui.Common.Helper;
|
||||||
using Ryujinx.Ui.Widgets;
|
using Ryujinx.Ui.Widgets;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using SixLabors.ImageSharp.Formats.Png;
|
using SixLabors.ImageSharp.Formats.Png;
|
||||||
|
@ -525,12 +526,7 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
var activeProcess = Device.Processes.ActiveApplication;
|
var activeProcess = Device.Processes.ActiveApplication;
|
||||||
|
|
||||||
string titleNameSection = string.IsNullOrWhiteSpace(activeProcess.Name) ? string.Empty : $" {activeProcess.Name}";
|
parent.Title = TitleHelper.ActiveApplicationTitle(activeProcess, Program.Version);
|
||||||
string titleVersionSection = string.IsNullOrWhiteSpace(activeProcess.DisplayVersion) ? string.Empty : $" v{activeProcess.DisplayVersion}";
|
|
||||||
string titleIdSection = $" ({activeProcess.ProgramIdText.ToUpper()})";
|
|
||||||
string titleArchSection = activeProcess.Is64Bit ? " (64-bit)" : " (32-bit)";
|
|
||||||
|
|
||||||
parent.Title = $"Ryujinx {Program.Version} -{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}";
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Thread renderLoopThread = new(Render)
|
Thread renderLoopThread = new(Render)
|
||||||
|
|
Loading…
Reference in a new issue