Homebrew ABI: Difference between revisions

No edit summary
No edit summary
Line 80: Line 80:


* 14: [[#RandomSeed]]
* 14: [[#RandomSeed]]
* 15: [[#UserIdStorage]]
* 16: [[#HosVersion]]


==== EndOfList ====
==== EndOfList ====
EndOfList is the final entry in the LoaderConfig.
EndOfList is the final entry in the LoaderConfig. It also provides optional human readable information about the Homebrew loader.


* '''Key:''' 0
* '''Key:''' 0
* '''Value[0]:''' Ignored.
* '''Value[0]:''' Pointer to loader information string, or zero if not present.
* '''Value[1]:''' Ignored.
* '''Value[1]:''' Size in bytes of the information string, or zero if not present.


==== MainThreadHandle ====
==== MainThreadHandle ====
Line 93: Line 97:
* '''Key:''' 1
* '''Key:''' 1
* '''Value[0]:''' Handle to the main thread.
* '''Value[0]:''' Handle to the main thread.
* '''Value[1]:''' Ignored.
* '''Value[1]:''' Reserved/should be zero.
* '''DefaultBehavior:''' Use main thread handle from entry function arguments.
* '''DefaultBehavior:''' Use main thread handle from entry function arguments.


Line 112: Line 116:


==== OverrideService ====
==== OverrideService ====
The NRO loader should be able to steal handles from more priliveged processes. In this case, the homebrew should use this handle instead of the normal one.
The NRO loader should be able to steal handles from more priliveged processes. In this case, homebrew should use this handle instead of the normal one.


Homebrew should allow up to 32 service overrides.
Homebrew should allow at least 32 service overrides.


Note: Overridden service handles should not be converted to domains or closed. If they are domain, they should be converted to sessions before passed to the homebrew application.
Note: Overridden service handles should not be converted to domains or closed. If they are domain, they should be converted to sessions before passed to the homebrew application.
Line 131: Line 135:


* '''Key:''' 5
* '''Key:''' 5
* '''Value[0]:''' Ignored.
* '''Value[0]:''' Reserved/should be zero.
* '''Value[1]:''' Argv string pointer.
* '''Value[1]:''' Argv string pointer.
* '''DefaultBehavior:''' Setting (argc == 1, argv[0] == "", argv[1] == NULL), or argv parsed in NSO0 fashion.
* '''DefaultBehavior:''' Setting (argc == 1, argv[0] == "", argv[1] == NULL), or argv parsed in NSO0 fashion.
Line 171: Line 175:
* '''Key:''' 8
* '''Key:''' 8
* '''Value[0]:''' AppletResourceUserId
* '''Value[0]:''' AppletResourceUserId
* '''Value[1]:''' Ignored.
* '''Value[1]:''' Reserved/should be zero.


==== Reserved9 ====
==== Reserved9 ====
This was originally stdiosockets which couldn't work long term in clean environments the way this was designed. Now reserved for future use.
This key has been deleted/reserved for future use.


==== ProcessHandle ====
==== ProcessHandle ====
Line 181: Line 185:
* '''Key:''' 10
* '''Key:''' 10
* '''Value[0]:''' Process handle.
* '''Value[0]:''' Process handle.
* '''Value[1]:''' Ignored.
* '''Value[1]:''' Reserved/should be zero.


==== LastLoadResult ====
==== LastLoadResult ====
Line 188: Line 192:
* '''Key:''' 11
* '''Key:''' 11
* '''Value[0]:''' Result.
* '''Value[0]:''' Result.
* '''Value[1]:''' Ignored.
* '''Value[1]:''' Reserved/should be zero.


==== AllocPages ====
==== AllocPages ====
Line 224: Line 228:
* '''Value[0]:''' Random data.
* '''Value[0]:''' Random data.
* '''Value[1]:''' More random data.
* '''Value[1]:''' More random data.
==== UserIdStorage ====
This key is used to provide persistent storage space for the preselected user id when launching homebrew under an application that has an account selection screen.
* '''Key''': 15
* '''Value[0]:''' Pointer to a buffer containing enough space (16 bytes) to store a user id.
* '''Value[1]:''' Reserved/should be zero.
==== HosVersion ====
This key provides the currently running version of Horizon OS.
* '''Key''': 16
* '''Value[0]:''' HOS version, formatted using libnx's [https://github.com/switchbrew/libnx/blob/master/nx/include/switch/runtime/hosversion.h#L11 MAKEHOSVERSION macro].
* '''Value[1]:''' Reserved/should be zero.