mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-06 00:19:22 +02:00
ldn: Allow using an user-specified priority.
This commit is contained in:
parent
9e26b562d7
commit
eb780c49ac
@ -10,6 +10,9 @@
|
||||
#include "../sf/service.h"
|
||||
#include "../kernel/event.h"
|
||||
|
||||
#define LDN_PRIORITY_SYSTEM 0x38 ///< System priority for __nx_ldn_priority.
|
||||
#define LDN_PRIORITY_USER 0x5A ///< User priority for __nx_ldn_priority.
|
||||
|
||||
typedef enum {
|
||||
LdnServiceType_User = 0, ///< Initializes ldn:u.
|
||||
LdnServiceType_System = 1, ///< Initializes ldn:s.
|
||||
@ -276,6 +279,7 @@ Result ldnmGetNetworkConfig(LdnNetworkConfig *out);
|
||||
///@{
|
||||
|
||||
/// Initialize ldn.
|
||||
/// The priority is only used with ::LdnServiceType_System on [19.0.0+]. To optionally set this, define "s32 __nx_ldn_priority". The priority must be \ref LDN_PRIORITY_SYSTEM (default) or \ref LDN_PRIORITY_USER.
|
||||
Result ldnInitialize(LdnServiceType service_type);
|
||||
|
||||
/// Exit ldn.
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
static LdnServiceType g_ldnServiceType;
|
||||
|
||||
__attribute__((weak)) s32 __nx_ldn_priority = LDN_PRIORITY_SYSTEM;
|
||||
|
||||
static Service g_ldnSrv;
|
||||
static Service g_ldnmSrv;
|
||||
|
||||
@ -84,7 +86,6 @@ Result _ldnInitialize(LdnServiceType service_type) {
|
||||
Service srv_creator={0};
|
||||
Result rc = MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
s32 version=0;
|
||||
s32 priority=0x38;
|
||||
g_ldnServiceType = service_type;
|
||||
switch (g_ldnServiceType) {
|
||||
case LdnServiceType_User:
|
||||
@ -109,7 +110,7 @@ Result _ldnInitialize(LdnServiceType service_type) {
|
||||
version = 0x4;
|
||||
|
||||
if (g_ldnServiceType == LdnServiceType_System && hosversionAtLeast(19,0,0))
|
||||
rc = _ldnCmdInitializeWithPriority(version, priority);
|
||||
rc = _ldnCmdInitializeWithPriority(version, __nx_ldn_priority);
|
||||
else
|
||||
rc = _ldnCmdInitializeWithVersion(version);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user