Compare commits

..

2 Commits

Author SHA1 Message Date
TSRBerry
52d6f2e656 hle: Set ProcessResult name from NACP (#4633)
* Extract titleName from nacp

* Address formatting feedback

* Check if the desired language is actually available
2023-04-05 03:34:21 +02:00
TSRBerry
c9bc4eaf58 Fix missing string enum converters for the config (#4634)
* Fix missing string enum converters for the config

* Revert changing KeyboardHotkeys to struct

This needs to be done because
Avalonia's TwoWay Binding breaks otherwise.
2023-04-03 15:37:27 +02:00
5 changed files with 40 additions and 9 deletions

View File

@@ -1,5 +1,9 @@
namespace Ryujinx.Common.Configuration.Hid.Controller
using Ryujinx.Common.Utilities;
using System.Text.Json.Serialization;
namespace Ryujinx.Common.Configuration.Hid.Controller
{
[JsonConverter(typeof(TypedStringEnumConverter<GamepadInputId>))]
public enum GamepadInputId : byte
{
Unbound,
@@ -51,4 +55,4 @@
Count
}
}
}

View File

@@ -1,5 +1,9 @@
namespace Ryujinx.Common.Configuration.Hid.Controller
using Ryujinx.Common.Utilities;
using System.Text.Json.Serialization;
namespace Ryujinx.Common.Configuration.Hid.Controller
{
[JsonConverter(typeof(TypedStringEnumConverter<StickInputId>))]
public enum StickInputId : byte
{
Unbound,
@@ -8,4 +12,4 @@
Count
}
}
}

View File

@@ -1,6 +1,8 @@
namespace Ryujinx.Common.Configuration.Hid
{
public struct KeyboardHotkeys
// NOTE: Please don't change this to struct.
// This breaks Avalonia's TwoWay binding, which makes us unable to save new KeyboardHotkeys.
public class KeyboardHotkeys
{
public Key ToggleVsync { get; set; }
public Key Screenshot { get; set; }

View File

@@ -405,7 +405,16 @@ namespace Ryujinx.HLE.Loaders.Processes
// Once everything is loaded, we can load cheats.
device.Configuration.VirtualFileSystem.ModLoader.LoadCheats(programId, tamperInfo, device.TamperMachine);
return new ProcessResult(metaLoader, applicationControlProperties, diskCacheEnabled, allowCodeMemoryForJit, processContextFactory.DiskCacheLoadState, process.Pid, meta.MainThreadPriority, meta.MainThreadStackSize);
return new ProcessResult(
metaLoader,
applicationControlProperties,
diskCacheEnabled,
allowCodeMemoryForJit,
processContextFactory.DiskCacheLoadState,
process.Pid,
meta.MainThreadPriority,
meta.MainThreadStackSize,
device.System.State.DesiredTitleLanguage);
}
public static Result LoadIntoMemory(KProcess process, IExecutable image, ulong baseAddress)

View File

@@ -2,6 +2,7 @@
using LibHac.Ns;
using Ryujinx.Common.Logging;
using Ryujinx.Cpu;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Loaders.Processes.Extensions;
using Ryujinx.Horizon.Common;
@@ -9,7 +10,7 @@ namespace Ryujinx.HLE.Loaders.Processes
{
public struct ProcessResult
{
public static ProcessResult Failed => new(null, new ApplicationControlProperty(), false, false, null, 0, 0, 0);
public static ProcessResult Failed => new(null, new ApplicationControlProperty(), false, false, null, 0, 0, 0, TitleLanguage.AmericanEnglish);
private readonly byte _mainThreadPriority;
private readonly uint _mainThreadStackSize;
@@ -35,7 +36,8 @@ namespace Ryujinx.HLE.Loaders.Processes
IDiskCacheLoadState diskCacheLoadState,
ulong pid,
byte mainThreadPriority,
uint mainThreadStackSize)
uint mainThreadStackSize,
TitleLanguage titleLanguage)
{
_mainThreadPriority = mainThreadPriority;
_mainThreadStackSize = mainThreadStackSize;
@@ -50,7 +52,17 @@ namespace Ryujinx.HLE.Loaders.Processes
{
ulong programId = metaLoader.GetProgramId();
Name = metaLoader.GetProgramName();
if (ApplicationControlProperties.Title.ItemsRo.Length > 0)
{
var langIndex = ApplicationControlProperties.Title.ItemsRo.Length > (int)titleLanguage ? (int)titleLanguage : 0;
Name = ApplicationControlProperties.Title[langIndex].NameString.ToString();
}
else
{
Name = metaLoader.GetProgramName();
}
ProgramId = programId;
ProgramIdText = $"{programId:x16}";
Is64Bit = metaLoader.IsProgram64Bit();