River : HLE: Make process identity explicit for service metadata resolution #100

Merged
Ghost merged 11 commits from Babib3l/Ryubing:hle-pid-process-metadata into master 2026-05-25 12:08:32 +00:00
Contributor

This PR is the first in a batch of structural changes to Ryujinx.

Changes

  • Added ProcessIdentity and ProcessKind to describe loaded programs by:
    • PID, program ID, application ID, program index, display version, process kind
  • Stored identity metadata on ProcessResult.
  • Added PID-based process lookup helpers to ProcessLoader.
  • Updated HLE services to resolve application metadata through the caller PID instead of Processes.ActiveApplication.
  • Added PTC/JIT disk cache initialization logging with PID, title ID, display version, selector, and enabled state.
  • Added ClientProcessId property to ServiceCtx (/src/Ryujinx.HLE/HOS/ServiceCtx.cs) that uses the handle descriptor PId when available, falling back to Process.Pid.
  • Updated 15 HLE service files to use context.ClientProcessId instead of context.Process.Pid for client process access, ensuring services correctly identify the calling process even when invoked via IPC with handle descriptors.

These changes make service metadata resolution more explicit and prepare the emulator for other structural changes later on.

This PR is the first in a batch of structural changes to Ryujinx. **Changes** - Added `ProcessIdentity` and `ProcessKind` to describe loaded programs by: - PID, program ID, application ID, program index, display version, process kind - Stored identity metadata on `ProcessResult`. - Added PID-based process lookup helpers to `ProcessLoader`. - Updated HLE services to resolve application metadata through the caller PID instead of `Processes.ActiveApplication`. - Added PTC/JIT disk cache initialization logging with PID, title ID, display version, selector, and enabled state. - Added `ClientProcessId` property to ServiceCtx (/src/Ryujinx.HLE/HOS/ServiceCtx.cs) that uses the handle descriptor PId when available, falling back to `Process.Pid`. - Updated 15 HLE service files to use `context.ClientProcessId` instead of `context.Process.Pid` for client process access, ensuring services correctly identify the calling process even when invoked via IPC with handle descriptors. These changes make service metadata resolution more explicit and prepare the emulator for other structural changes later on.
Babib3l changed title from hle-pid-process-metadata to HLE: Make process identity explicit for service metadata resolution 2026-05-15 21:27:09 +00:00
Babib3l changed title from HLE: Make process identity explicit for service metadata resolution to River : HLE: Make process identity explicit for service metadata resolution 2026-05-15 22:12:49 +00:00
Babib3l force-pushed hle-pid-process-metadata from 300001e330
All checks were successful
Build PR / linux-arm64 (Release) (pull_request) Successful in 7m30s
Build PR / linux-x64 (Release) (pull_request) Successful in 8m4s
Build PR / win-x64 (Release) (pull_request) Successful in 7m53s
Build PR / macOS Universal (Release) (pull_request) Successful in 8m13s
to 569988c4c9
All checks were successful
Build PR / win-x64 (Release) (pull_request) Successful in 11m21s
Build PR / macOS Universal (Release) (pull_request) Successful in 6m34s
Build PR / linux-x64 (Release) (pull_request) Successful in 11m42s
Build PR / linux-arm64 (Release) (pull_request) Successful in 6m31s
2026-05-16 01:26:44 +00:00
Compare
Babib3l force-pushed hle-pid-process-metadata from 569988c4c9
All checks were successful
Build PR / win-x64 (Release) (pull_request) Successful in 11m21s
Build PR / macOS Universal (Release) (pull_request) Successful in 6m34s
Build PR / linux-x64 (Release) (pull_request) Successful in 11m42s
Build PR / linux-arm64 (Release) (pull_request) Successful in 6m31s
to 3fbfd8bb87
All checks were successful
Build PR / macOS Universal (Release) (pull_request) Successful in 8m45s
Build PR / linux-x64 (Release) (pull_request) Successful in 8m55s
Build PR / win-x64 (Release) (pull_request) Successful in 9m2s
Build PR / linux-arm64 (Release) (pull_request) Successful in 5m25s
2026-05-17 03:41:51 +00:00
Compare
@ -182,7 +185,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
public ResultCode GetDisplayVersion(ServiceCtx context)
{
// If an NACP isn't found, the buffer will be all '\0' which seems to be the correct implementation.

in c/cpp land, all strings have a null terminator, so yeah, this checks out.

in c/cpp land, all strings have a null terminator, so yeah, this checks out.
Babib3l marked this conversation as resolved
@ -50,12 +50,13 @@ namespace Ryujinx.HLE.HOS.Services.Fatal
private ResultCode ThrowFatalWithCpuContextImpl(ServiceCtx context, ResultCode resultCode, ulong pid, FatalPolicy fatalPolicy, ReadOnlySpan<byte> cpuContext)
{
var process = context.Device.Processes.GetProcess(pid);

please dont use var :catsob:

please dont use var :catsob:
Babib3l marked this conversation as resolved
@ -32,3 +32,3 @@
}
PlayLogQueryCapability queryCapability = (PlayLogQueryCapability)context.Device.Processes.ActiveApplication.ApplicationControlProperties.PlayLogQueryCapability;
var process = context.Device.Processes.GetProcess(context.ClientProcessId);

:angry_cat:

:angry_cat:
Babib3l marked this conversation as resolved
@ -87,0 +91,4 @@
{
if (programId == 0)
{
return ProcessKind.Homebrew;

Homebrew and games are supposed to be one and the same according to Horizon, aren't they? If that's the case, shouldn't we combine them under the same classification? I guess unless its maybe an applet, but I'm not sure I've come across that.

Homebrew and games are supposed to be one and the same according to Horizon, aren't they? If that's the case, shouldn't we combine them under the same classification? I guess unless its maybe an applet, but I'm not sure I've come across that.
Author
Contributor

yep they're supposed to be the same, I changed GetProcessKind(0) to return ProcessKind.Application instead of ProcessKind.Homebrew
commit b4bfbe026e

yep they're supposed to be the same, I changed `GetProcessKind(0)` to return `ProcessKind.Application` instead of `ProcessKind.Homebrew` commit b4bfbe026ebdf96500fc8565efd534d97aa4117d
Babib3l marked this conversation as resolved
Babib3l force-pushed hle-pid-process-metadata from 3fbfd8bb87
All checks were successful
Build PR / macOS Universal (Release) (pull_request) Successful in 8m45s
Build PR / linux-x64 (Release) (pull_request) Successful in 8m55s
Build PR / win-x64 (Release) (pull_request) Successful in 9m2s
Build PR / linux-arm64 (Release) (pull_request) Successful in 5m25s
to 1023e63fd7
Some checks failed
Build PR / linux-arm64 (Release) (pull_request) Successful in 5m58s
Build PR / macOS Universal (Release) (pull_request) Failing after 10m2s
Build PR / linux-x64 (Release) (pull_request) Successful in 10m10s
Build PR / win-x64 (Release) (pull_request) Successful in 10m11s
Build PR / win-arm64 (Release) (pull_request) Successful in 10m20s
2026-05-24 13:04:03 +00:00
Compare
vars once again
Some checks failed
Build PR / macOS Universal (Release) (pull_request) Has been cancelled
Build PR / linux-x64 (Release) (pull_request) Has been cancelled
Build PR / linux-arm64 (Release) (pull_request) Has been cancelled
Build PR / win-arm64 (Release) (pull_request) Has been cancelled
Build PR / win-x64 (Release) (pull_request) Has been cancelled
94c5e37a00
Revert "vars once again"
Some checks failed
Build PR / linux-arm64 (Release) (pull_request) Successful in 4m4s
Build PR / win-x64 (Release) (pull_request) Successful in 7m3s
Build PR / win-arm64 (Release) (pull_request) Successful in 7m30s
Build PR / linux-x64 (Release) (pull_request) Successful in 7m36s
Build PR / macOS Universal (Release) (pull_request) Failing after 9m51s
c48f30d252
This reverts commit 94c5e37a00.
use ProcessResult type in IService and QueryPlayStatisticsManager
Some checks failed
Build PR / linux-arm64 (Release) (pull_request) Successful in 3m54s
Build PR / macOS Universal (Release) (pull_request) Has been cancelled
Build PR / win-x64 (Release) (pull_request) Has been cancelled
Build PR / win-arm64 (Release) (pull_request) Has been cancelled
Build PR / linux-x64 (Release) (pull_request) Has been cancelled
c5b1c86459
return Application for programId 0
All checks were successful
Build PR / linux-arm64 (Release) (pull_request) Successful in 3m52s
Build PR / win-arm64 (Release) (pull_request) Successful in 7m9s
Build PR / win-x64 (Release) (pull_request) Successful in 7m10s
Build PR / linux-x64 (Release) (pull_request) Successful in 7m13s
Build PR / macOS Universal (Release) (pull_request) Successful in 6m16s
b4bfbe026e
Ghost merged commit b62c58c2fe into master 2026-05-25 12:08:32 +00:00
Ghost deleted branch hle-pid-process-metadata 2026-05-25 12:08:33 +00:00
Ghost added this to the 1.4.0 milestone 2026-06-27 17:15:11 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
projects/Ryubing!100
No description provided.