RO services: Difference between revisions

From Nintendo Switch Brew
Jump to navigation Jump to search
Adubbz (talk | contribs)
Fixed capitalisation
 
fixup ro command names
 
(8 intermediate revisions by one other user not shown)
Line 1: Line 1:
Prior to 3.0.0, ro was included as part of [[Loader services]]. Despite the separation, the service name ldr:ro is retained to maintain compatibility with old games.
Prior to 3.0.0, ro was included as part of [[Loader_services|Loader]]. Despite the separation, the service name ldr:ro is retained to maintain compatibility with old games.


= ldr:ro, ro:1 =
= ldr:ro, ro:1 =
Line 6: Line 6:
[3.0.0+] This is "nn::ro::detail::IRoInterface".
[3.0.0+] This is "nn::ro::detail::IRoInterface".


[7.0.0+] ro:1 was added, and also creates nn::ro::detail::IRoInterface objects.
[7.0.0+] ro:1 was added and is also "nn::ro::detail::IRoInterface".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 12: Line 12:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#LoadNro]]
| 0 || [[#MapManualLoadModuleMemory]]
|-
|-
| 1 || UnloadNro
| 1 || [[#UnmapManualLoadModuleMemory]]
|-
|-
| 2 || [[#LoadNrr]]  
| 2 || [[#RegisterModuleInfo]]  
|-
|-
| 3 || UnloadNrr
| 3 || [[#UnregisterModuleInfo]]
|-
|-
| 4 || [[#Initialize]]
| 4 || [[#RegisterProcessHandle]]
|-
|-
| 10 || [7.0.0+] [[#LoadNrrEx]]
| 10 || [7.0.0+] [[#RegisterModuleInfoWithUserProcessHandle]]
|}
|}


== LoadNro ==
== MapManualLoadModuleMemory ==
{| class="wikitable" border="1"
Takes a PID-descriptor and 4 input u64s ('''nro_address''', '''nro_size''', '''bss_address''' and '''bss_size'''). Returns an output u64 ('''out_address''').
|-
 
! Word || Value
== UnmapManualLoadModuleMemory ==
|-
Takes a PID-descriptor and an input u64 ('''nro_address''').
| 0 || 0x00000004
 
|-
== RegisterModuleInfo ==
| 1 || 0x80000012
Takes a PID-descriptor and 2 input u64s ('''nrr_address''' and '''nrr_size''').
|-
 
| 2 || 0x00000001
[7.0.0+] [[NRR|NrrKind]] must be 0 (User) for this function to succeed.
|- style="border-top: double"
 
| 0-1 || Pid
== UnregisterModuleInfo ==
|- style="border-top: double"
Takes a PID-descriptor and an input u64s ('''nrr_address''').  
| 0 || "SCFI"
 
|-
== RegisterProcessHandle ==
| 1 || 0x00000000
Takes PID-descriptor and a process handle.
|-
 
| 2 || Always 0.
== RegisterModuleInfoWithUserProcessHandle ==
|-
Takes a PID-descriptor, a process handle and 2 input u64s ('''nrr_address''' and '''nrr_size''').
| 3 || Nro heap address
 
|-
First, this validates that the pid descriptor matches the pid for the process handle sent to this->Initialize() earlier. Then, this calls the same function as [[#RegisterModuleInfo|RegisterModuleInfo]], except using the passed process handle instead of the one sent to Initialize.
| 4 || Nro size
|-
| 5 || Bss backing heap address
|-
| 6 || Bss size
|}


== LoadNrr ==
When called from an ro:1 session, [[NRR|NrrKind]] must be 1 (JitPlugin). When called from ldr:ro session, [[NRR|NrrKind]] must be 0 (User).
[7.0.0+] A new 8-bit field at NRR + 0x33C (previously padding) must be 0 for this function to succeed.


{| class="wikitable" border="1"
= ro:dmnt =
|-
This is "nn::ro::detail::IDebugMonitorInterface".
! Word || Value
|-
| 0 || 0x00000004
|-
| 1 || 0x8000000E
|-
| 2 || 0x00000001
|-
|- style="border-top: double"
| 0-1 || Pid
|- style="border-top: double"
| 0 || "SFCI"
|-
| 1 || 0x00000002
|-
| 2 || Always 0.
|-
| 3 || Nrr address
|-
| 4 || Nrr size
|}


== Initialize ==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Word || Value
! Cmd || Name
|-
|-
| 0 || 0x00000004
| 0 || [[#GetProcessModuleInfo]]
|-
| 1 || 0x8000000A
|-
| 2 || 0x00000003
|- style="border-top: double"
| 0-1 || Pid
|-
| 2 || Process handle (0xFFFF8001)
|- style="border-top: double"
| 0 || "SFCI"
|-
| 1 || 0x00000004
|-
| 2 || Always 0.
|}
|}


== LoadNrrEx ==
== GetProcessModuleInfo ==
Takes in a u64 nrr_address, a u64 nrr_size, a pid descriptor, and a process handle.
Same as [[Loader_services#GetProcessModuleInfo|GetProcessModuleInfo]] from [[Loader_services#ldr:dmnt|ldr:dmnt]].
 
First, this validates that the pid descriptor matches the pid for the process handle sent to this->Initialize() earlier.
 
Then, this calls the same function as LoadNrr, except using the passed process handle instead of the one sent to Initialize.
 
When called from an ro:1 session, the field at NRR header + 0x33C must be 0x1. When called from ldr:ro session, the field at NRR header + 0x33C must be 0x0.


[[Category:Services]]
[[Category:Services]]

Latest revision as of 00:56, 29 May 2025

Prior to 3.0.0, ro was included as part of Loader. Despite the separation, the service name ldr:ro is retained to maintain compatibility with old games.

ldr:ro, ro:1

[1.0.0-2.3.0] This is "nn::ldr::detail::IRoInterface"

[3.0.0+] This is "nn::ro::detail::IRoInterface".

[7.0.0+] ro:1 was added and is also "nn::ro::detail::IRoInterface".

Cmd Name
0 #MapManualLoadModuleMemory
1 #UnmapManualLoadModuleMemory
2 #RegisterModuleInfo
3 #UnregisterModuleInfo
4 #RegisterProcessHandle
10 [7.0.0+] #RegisterModuleInfoWithUserProcessHandle

MapManualLoadModuleMemory

Takes a PID-descriptor and 4 input u64s (nro_address, nro_size, bss_address and bss_size). Returns an output u64 (out_address).

UnmapManualLoadModuleMemory

Takes a PID-descriptor and an input u64 (nro_address).

RegisterModuleInfo

Takes a PID-descriptor and 2 input u64s (nrr_address and nrr_size).

[7.0.0+] NrrKind must be 0 (User) for this function to succeed.

UnregisterModuleInfo

Takes a PID-descriptor and an input u64s (nrr_address).

RegisterProcessHandle

Takes PID-descriptor and a process handle.

RegisterModuleInfoWithUserProcessHandle

Takes a PID-descriptor, a process handle and 2 input u64s (nrr_address and nrr_size).

First, this validates that the pid descriptor matches the pid for the process handle sent to this->Initialize() earlier. Then, this calls the same function as RegisterModuleInfo, except using the passed process handle instead of the one sent to Initialize.

When called from an ro:1 session, NrrKind must be 1 (JitPlugin). When called from ldr:ro session, NrrKind must be 0 (User).

ro:dmnt

This is "nn::ro::detail::IDebugMonitorInterface".

Cmd Name
0 #GetProcessModuleInfo

GetProcessModuleInfo

Same as GetProcessModuleInfo from ldr:dmnt.