From ca428098ff8b4db5332ba76d1e15d00adda07cbd Mon Sep 17 00:00:00 2001 From: WilliamWsyHK Date: Tue, 3 Dec 2024 23:15:29 +0800 Subject: [PATCH 1/5] Add Firmware keyword if it is indeed firmware --- src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs index e187b2360..ba2abe147 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs @@ -84,12 +84,18 @@ namespace Ryujinx.HLE.Loaders.Processes return false; } + bool isGame = ProgramId > 0x0100000000007FFF; + + string name = isGame + ? Name + : "Firmware"; + // TODO: LibHac npdm currently doesn't support version field. - string version = ProgramId > 0x0100000000007FFF + string version = isGame ? DisplayVersion : device.System.ContentManager.GetCurrentFirmwareVersion()?.VersionString ?? "?"; - Logger.Info?.Print(LogClass.Loader, $"Application Loaded: {Name} v{version} [{ProgramIdText}] [{(Is64Bit ? "64-bit" : "32-bit")}]"); + Logger.Info?.Print(LogClass.Loader, $"Application Loaded: {name} v{version} [{ProgramIdText}] [{(Is64Bit ? "64-bit" : "32-bit")}]"); return true; } From 19e44ecf70dbcd112a4b62d898ec60dc6d676ced Mon Sep 17 00:00:00 2001 From: WilliamWsyHK Date: Wed, 4 Dec 2024 00:00:01 +0800 Subject: [PATCH 2/5] Small enhancement --- src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs index ba2abe147..0329f5830 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs @@ -86,12 +86,12 @@ namespace Ryujinx.HLE.Loaders.Processes bool isGame = ProgramId > 0x0100000000007FFF; - string name = isGame + string name = isGame || !string.IsNullOrWhiteSpace(Name) ? Name : "Firmware"; // TODO: LibHac npdm currently doesn't support version field. - string version = isGame + string version = isGame || !string.IsNullOrWhiteSpace(DisplayVersion) ? DisplayVersion : device.System.ContentManager.GetCurrentFirmwareVersion()?.VersionString ?? "?"; From b832c982899c0949b1490f493e58b86dc6b93ccc Mon Sep 17 00:00:00 2001 From: WilliamWsyHK Date: Wed, 4 Dec 2024 01:38:04 +0800 Subject: [PATCH 3/5] Address comments from piplup55 and LotP1 --- .../Loaders/Processes/ProcessResult.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs index 0329f5830..e579751d8 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs @@ -84,15 +84,25 @@ namespace Ryujinx.HLE.Loaders.Processes return false; } - bool isGame = ProgramId > 0x0100000000007FFF; + bool IsFirmware(ulong programId) + { + return programId switch + { + >= 0x0100000000000819 and <= 0x010000000000081C => true, + _ => false + }; + } + + bool isFirmware = IsFirmware(ProgramId); + bool isMiiEdit = ProgramId == 0x0100000000001009; - string name = isGame || !string.IsNullOrWhiteSpace(Name) - ? Name + string name = !isFirmware + ? isMiiEdit ? "miiEdit from Firmware" : (!string.IsNullOrWhiteSpace(Name) ? Name : "") : "Firmware"; // TODO: LibHac npdm currently doesn't support version field. - string version = isGame || !string.IsNullOrWhiteSpace(DisplayVersion) - ? DisplayVersion + string version = !isFirmware && !isMiiEdit + ? (!string.IsNullOrWhiteSpace(DisplayVersion) ? DisplayVersion : "") : device.System.ContentManager.GetCurrentFirmwareVersion()?.VersionString ?? "?"; Logger.Info?.Print(LogClass.Loader, $"Application Loaded: {name} v{version} [{ProgramIdText}] [{(Is64Bit ? "64-bit" : "32-bit")}]"); From 4d6ad9389eebad67c31d0bf51f9a6cbecfaf0088 Mon Sep 17 00:00:00 2001 From: WilliamWsyHK Date: Wed, 4 Dec 2024 08:05:00 +0800 Subject: [PATCH 4/5] Update the statement to inline instead of method call --- src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs index e579751d8..8d3b337fa 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs @@ -84,16 +84,11 @@ namespace Ryujinx.HLE.Loaders.Processes return false; } - bool IsFirmware(ulong programId) + bool isFirmware = ProgramId switch { - return programId switch - { - >= 0x0100000000000819 and <= 0x010000000000081C => true, - _ => false - }; - } - - bool isFirmware = IsFirmware(ProgramId); + >= 0x0100000000000819 and <= 0x010000000000081C => true, + _ => false + }; bool isMiiEdit = ProgramId == 0x0100000000001009; string name = !isFirmware From 44fda575c29aaf4d11a6461f5fe3006452ae458f Mon Sep 17 00:00:00 2001 From: WilliamWsyHK Date: Thu, 5 Dec 2024 23:40:01 +0800 Subject: [PATCH 5/5] further simplify the firmware `ProgramId` check --- src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs index 8d3b337fa..82e7d7b06 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs @@ -84,11 +84,7 @@ namespace Ryujinx.HLE.Loaders.Processes return false; } - bool isFirmware = ProgramId switch - { - >= 0x0100000000000819 and <= 0x010000000000081C => true, - _ => false - }; + bool isFirmware = ProgramId is >= 0x0100000000000819 and <= 0x010000000000081C; bool isMiiEdit = ProgramId == 0x0100000000001009; string name = !isFirmware