Add title of game to screenshot text (#6266)

* Add sanitize method

* Add app name to screenshot text output

* Add app name to screenshot text
This commit is contained in:
Kyle 2024-03-07 14:49:57 -08:00 committed by GitHub
parent 2505a1abcd
commit 4e1a60328e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 3 deletions

View file

@ -3,6 +3,7 @@ using Gtk;
using Ryujinx.Common;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.Common.Utilities;
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.GAL.Multithreading;
using Ryujinx.Graphics.Gpu;
@ -378,8 +379,12 @@ namespace Ryujinx.UI
{
lock (this)
{
var currentTime = DateTime.Now;
string filename = $"ryujinx_capture_{currentTime.Year}-{currentTime.Month:D2}-{currentTime.Day:D2}_{currentTime.Hour:D2}-{currentTime.Minute:D2}-{currentTime.Second:D2}.png";
string applicationName = Device.Processes.ActiveApplication.Name;
string sanitizedApplicationName = FileSystemUtils.SanitizeFileName(applicationName);
DateTime currentTime = DateTime.Now;
string filename = $"{sanitizedApplicationName}_{currentTime.Year}-{currentTime.Month:D2}-{currentTime.Day:D2}_{currentTime.Hour:D2}-{currentTime.Minute:D2}-{currentTime.Second:D2}.png";
string directory = AppDataManager.Mode switch
{
AppDataManager.LaunchMode.Portable or AppDataManager.LaunchMode.Custom => System.IO.Path.Combine(AppDataManager.BaseDirPath, "screenshots"),