Glue services

From Nintendo Switch Brew
Jump to navigation Jump to search

arp:r

This is "nn::arp::detail::IReader".

Cmd Name
0 GetApplicationLaunchProperty
1 [10.0.0+] GetApplicationControlProperty ([1.0.0-9.2.0] GetApplicationLaunchPropertyWithApplicationId)
2 [10.0.0+] GetApplicationProcessProperty ([1.0.0-9.2.0] GetApplicationControlProperty)
3 [10.0.0+] GetApplicationInstanceId ([1.0.0-9.2.0] GetApplicationControlPropertyWithApplicationId)
4 [10.0.0+] GetApplicationInstanceUnregistrationNotifier
5 [10.0.0+] ListApplicationInstanceId
6 [10.0.0+] GetMicroApplicationInstanceId
7 [10.0.0+] GetApplicationCertificate
9998 [9.0.0-9.2.0] GetPreomiaApplicationLaunchProperty
9999 [9.0.0-9.2.0] GetPreomiaApplicationControlProperty

GetApplicationLaunchProperty

Takes an input u64 ProcessId. Returns an #ApplicationLaunchProperty.

[10.0.0+] Now takes an input #ApplicationInstanceId instead of ProcessId.

GetApplicationLaunchPropertyWithApplicationId

Takes an input u64 ApplicationId. Returns an #ApplicationLaunchProperty.

GetApplicationControlProperty

Takes an input u64 ProcessId and a type-0x16 output buffer containing an ApplicationControlProperty. No output.

[10.0.0+] Now takes an input #ApplicationInstanceId instead of ProcessId.

GetApplicationControlPropertyWithApplicationId

Takes an input u64 ApplicationId and a type-0x16 output buffer containing an ApplicationControlProperty. No output.

GetApplicationProcessProperty

Takes an input #ApplicationInstanceId. Returns an #ApplicationProcessProperty.

GetApplicationInstanceId

Takes an input u64 ProcessId. Returns an #ApplicationInstanceId.

GetApplicationInstanceUnregistrationNotifier

No input. Returns an #IUnregistrationNotifier.

ListApplicationInstanceId

Takes a type-0x6 output buffer containing an array of #ApplicationInstanceId. Returns an s32 Count.

GetMicroApplicationInstanceId

Same as #GetApplicationInstanceId.

GetApplicationCertificate

Takes an input #ApplicationInstanceId and a type-0x16 output buffer containing an #ApplicationCertificate. No output.

GetPreomiaApplicationLaunchProperty

Same as #GetApplicationLaunchProperty.

GetPreomiaApplicationControlProperty

Same as #GetApplicationControlProperty.

IUnregistrationNotifier

This is "nn::arp::detail::IUnregistrationNotifier".

Cmd Name
0 GetReadableHandle

GetReadableHandle

No input. Returns an output readable Event handle.

arp:w

This is "nn::arp::detail::IWriter".

Cmd Name
0 AcquireRegistrar
1 [10.0.0+] UnregisterApplicationInstance ([1.0.0-9.2.0] DeleteProperties)
2 [15.0.0+] AcquireApplicationProcessPropertyUpdater ([10.0.0-14.1.2] AcquireUpdater)
3 [15.0.0+] AcquireApplicationCertificateUpdater

AcquireRegistrar

No input. Returns an #IRegistrar.

UnregisterApplicationInstance

Takes an input #ApplicationInstanceId. No output.

AcquireUpdater

Takes an input #ApplicationInstanceId. Returns an #IUpdater.

AcquireApplicationProcessPropertyUpdater

Takes an input #ApplicationInstanceId. Returns an #IUpdater.

AcquireApplicationCertificateUpdater

Takes an input #ApplicationInstanceId. Returns an #IUpdater.

IRegistrar

This is "nn::arp::detail::IRegistrar".

Cmd Name
0 Issue
1 SetApplicationLaunchProperty
2 SetApplicationControlProperty

Issue

No input. Returns an output #ApplicationInstanceId.

SetApplicationLaunchProperty

Takes an input #ApplicationLaunchProperty. No output.

SetApplicationControlProperty

Takes a type-0x15 input buffer containing an ApplicationControlProperty. No output.

IUpdater

This is "nn::arp::detail::IUpdater".

Cmd Name
0 Issue
1 SetApplicationProcessProperty
2 DeleteApplicationProcessProperty
3 SetApplicationCertificate

Issue

No input/output.

SetApplicationProcessProperty

Takes an input u64 ProcessId and an input #ApplicationProcessProperty. No output.

DeleteApplicationProcessProperty

No input/output.

SetApplicationCertificate

Takes a type-0x15 input buffer containing an #ApplicationCertificate. No output.

bgtc:t

This is "nn::bgtc::ITaskService".

[11.0.0+] This is "nn::bgtc::ITaskServiceRoot".

Cmd Name
100 #CreateTaskService

CreateTaskService

No input. Returns an #ITaskService.

ITaskService

This is "nn::bgtc::ITaskService".

Cmd Name
1 NotifyTaskStarting
2 NotifyTaskFinished
3 GetTriggerEvent
4 IsInHalfAwake
5 NotifyClientName
6 [3.0.0+] IsInFullAwake
11 ScheduleTask
12 GetScheduledTaskInterval
13 UnscheduleTask
14 GetScheduleEvent
15 SchedulePeriodicTask
16 [9.0.0+] ScheduleStrictTask
101 [3.0.0+] GetOperationMode
102 [3.0.0+] WillDisconnectNetworkWhenEnteringSleep
103 [3.0.0+] WillStayHalfAwakeInsteadSleep
200 [12.0.0+] EnableStayHalfAwake

bgtc:sc

This is "nn::bgtc::IStateControlService".

Cmd Name
1 GetState
2 GetStateChangedEvent
3 NotifyEnteringHalfAwake
4 NotifyLeavingHalfAwake
5 [3.0.0+] SetIsUsingSleepUnsupportedDevices

[10.0.0+] NotifyEnteringHalfAwake now takes 1-byte of input.

time:a, time:r, time:u

These are "nn::timesrv::detail::service::IStaticService".

These were added with [9.0.0+].

The time:u service has max_sessions 17, time:a has max_sessions 4, and time:r has max_sessions 2.

Cmd Name Notes
0 GetStandardUserSystemClock Returns an #ISystemClock.
1 GetStandardNetworkSystemClock Returns an #ISystemClock.
2 GetStandardSteadyClock Returns an #ISteadyClock.
3 GetTimeZoneService Returns an #ITimeZoneService.
4 GetStandardLocalSystemClock Returns an #ISystemClock.
5 [4.0.0+] GetEphemeralNetworkSystemClock Returns an #ISystemClock.
20 [6.0.0+] GetSharedMemoryNativeHandle
30 [6.0.0-8.1.0] GetStandardNetworkClockOperationEventReadableHandle
31 [6.0.0-8.1.0] GetEphemeralNetworkClockOperationEventReadableHandle
50 [4.0.0+] SetStandardSteadyClockInternalOffset
51 [9.0.0+] GetStandardSteadyClockRtcValue
100 IsStandardUserSystemClockAutomaticCorrectionEnabled
101 SetStandardUserSystemClockAutomaticCorrectionEnabled
102 [5.0.0+] GetStandardUserSystemClockInitialYear
200 [3.0.0+] IsStandardNetworkSystemClockAccuracySufficient
201 [6.0.0+] GetStandardUserSystemClockAutomaticCorrectionUpdatedTime
300 [4.0.0+] CalculateMonotonicSystemClockBaseTimePoint
400 [4.0.0+] GetClockSnapshot
401 [4.0.0+] GetClockSnapshotFromSystemClockContext
500 [4.0.0+] CalculateStandardUserSystemClockDifferenceByUser
501 [4.0.0+] CalculateSpanBetween

ISteadyClock

This is "nn::timesrv::detail::service::ISteadyClock".

Cmd Name Notes
0 GetCurrentTimePoint No input, returns an output #SteadyClockTimePoint.
2 GetTestOffset No input, returns an output #TimeSpanType.
3 SetTestOffset Takes an input #TimeSpanType, no output.
100 [2.0.0+] GetRtcValue No input, returns an output s64.
101 [2.0.0+] IsRtcResetDetected No input, returns an output u8 bool.
102 [2.0.0+] GetSetupResultValue No input, returns an output u32.
200 [3.0.0+] GetInternalOffset No input, returns an output #TimeSpanType.
201 [3.0.0-3.0.2] SetInternalOffset Takes an input #TimeSpanType, no output.

SteadyClockTimePoint

Offset Size Description
0x0 0x8 A u64 representing a point in time.
0x8 0x10 An ID representing the clock source.

This is a 0x18-byte struct.

TimeSpanType

This is an u64.

ISystemClock

This is "nn::timesrv::detail::service::ISystemClock".

Cmd Name Notes
0 GetCurrentTime Returns an output #PosixTime.
1 SetCurrentTime Takes an input #PosixTime.
2 GetSystemClockContext Returns an output #SystemClockContext.
3 SetSystemClockContext Takes an input #SystemClockContext.
4 [9.0.0+] GetOperationEventReadableHandle

PosixTime

This is an s64 for UTC POSIX time.

SystemClockContext

This is an 0x20-byte struct.

Offset Size Description
0x0 0x8 a #PosixTime representing the system clock epoch.
0x8 0x18 a #SteadyClockTimePoint

ITimeZoneService

This is "nn::timesrv::detail::service::ITimeZoneService".

Cmd Name Notes
0 GetDeviceLocationName No input, returns an output #LocationName.
1 SetDeviceLocationName Takes an input #LocationName, no output.
2 GetTotalLocationNameCount No input, returns an output s32.
3 LoadLocationNameList
4 LoadTimeZoneRule Takes an input #LocationName and a type-0x16 output buffer for #TimeZoneRule, no output.
5 [2.0.0+] GetTimeZoneRuleVersion No input, returns an output #TimeZoneRuleVersion.
6 [5.0.0+] GetDeviceLocationNameAndUpdatedTime
7 [9.0.0+] SetDeviceLocationNameWithTimeZoneRule
8 [9.0.0+] ParseTimeZoneBinary Stubbed, return 0x7BC74.
20 [9.0.0+] GetDeviceLocationNameOperationEventReadableHandle
100 ToCalendarTime Takes an input #PosixTime and a type-0x15 input buffer for #TimeZoneRule, returns an output #CalendarTime and #CalendarAdditionalInfo.
101 ToCalendarTimeWithMyRule Takes an input #PosixTime, returns an output #CalendarTime and #CalendarAdditionalInfo.
201 ToPosixTime Takes an input #CalendarTime, a type-0x15 input buffer for #TimeZoneRule, an type-0xA output buffer for #PosixTime array, and returns an output s32.
202 ToPosixTimeWithMyRule Takes an input #CalendarTime, an type-0xA output buffer for #PosixTime array, and returns an output s32.

LoadLocationNameList

Takes an input s32 LocationName_index and a type-0x6 output buffer for #LocationName, returns an output s32 for total output entries.

LocationName

This contains a TimeZone location string with a max size of 0x24 bytes.

TimeZoneRule

This is an 0x4000-byte struct. Official sw uses fixed-size 0x4000 for the buffer size with the above commands.

This is loaded from the TimeZoneBinary title with the specified LocationName under the zoneinfo/ directory, the content is then converted into this TimeZoneRule structure.

The files contained under zoneinfo/ directory are Tzif2 files without Tzif1 header and data at the begining of them (see RFC8536 for more information).

The conversion of a Tzif2 file to a TimeZoneRule structure is based on tz database code with some custom modifications (Leap seconds aren't handled, no usage of "posixrules" and Tzif1 support stripped out).

Offset Size Description
0x0 0x4 timecnt
0x4 0x4 typecnt
0x8 0x4 charcnt
0xC 0x1 goback
0xD 0x1 goahead
0xE 0x2 Padding
0x10 0x8 * 1000 ats
0x1f50 0x1 * 1000 types
0x2338 0x10 * 128 ttis (time type information), struct ttinfo[1000]
0x2b38 0x1 * 512 chars
0x2d38 0x4 defaulttype
0x2d3c 0x12c4 Reserved / Unused

ttinfo

This is an 0x10-byte struct. Represent a Time Type Information used in #TimeZoneRule.

Offset Size Description
0x0 0x4 tt_gmtoff
0x4 0x1 tt_isdst
0x5 0x3 Padding
0x8 0x4 tt_abbrind
0xC 0x1 tt_ttisstd
0xD 0x1 tt_ttisgmt
0xE 0x2 Padding

TimeZoneRuleVersion

This is an u128.

CalendarTime

Offset Size Description
0x0 0x2 Year
0x2 0x1 Month
0x3 0x1 Day
0x4 0x1 Hour
0x5 0x1 Minute
0x6 0x1 Second
0x7 0x1 Padding / unknown?

This is an 0x8-byte struct.

CalendarAdditionalInfo

Offset Size Description
0x0 0x4 0-based day-of-week.
0x4 0x4 0-based day-of-year.
0x8 0x8 Timezone name string.
0x10 0x4 0 = no DST, 1 = DST.
0x14 0x4 s32 seconds relative to UTC for this timezone.

This is an 0x18-byte struct. This stores timezone info.

notif:a

This is "nn::notification::server::INotificationServicesForApplication".

This was added with [9.0.0+].

Cmd Name
500 #RegisterAlarmSetting
510 #UpdateAlarmSetting
520 #ListAlarmSettings
530 #LoadApplicationParameter
540 #DeleteAlarmSetting
1000 #Initialize

RegisterAlarmSetting

Takes a type-0x15 input buffer #AlarmSetting and a type-0x5 input buffer. Returns an #AlarmSettingId.

The second buffer can be empty (addr=0/size=0). Size must be <=0x400. This is the ApplicationParameter.

A maximum of 8 Alarms can be registered by an Application at the same time.

Before using the cmd, sdknso uses hid IsFirmwareUpdateNeededForNotification then if needed launches the controller-applet for firmware-update.

After using the cmd when it failed, ShowError will be used when the Result is in a certain range, otherwise this will assert.

UpdateAlarmSetting

Takes a type-0x15 input buffer #AlarmSetting and a type-0x5 input buffer. No output.

The second buffer can be empty (addr=0/size=0). Size must be <=0x400. This is the ApplicationParameter.

ListAlarmSettings

Takes a type-0x6 output buffer to receive an array of #AlarmSetting. Returns a s32 AlarmSettingsCount.

LoadApplicationParameter

Takes an input #AlarmSettingId and a type-0x6 output buffer containing the ApplicationParameter. Returns an u32 actual_size.

DeleteAlarmSetting

Takes an input #AlarmSettingId.

Initialize

Takes a PID-descriptor and an input u64 pid_reserved.

notif:s

This is "nn::notification::server::INotificationServices".

This was added with [9.0.0+].

Cmd Name
500 #RegisterAlarmSetting
510 #UpdateAlarmSetting
520 #ListAlarmSettings
530 #LoadApplicationParameter
540 #DeleteAlarmSetting
1000 #GetNotificationCount
1010 ListNotifications
1020 DeleteNotification
1030 ClearNotifications
1040 #GetNotificationSendingNotifier
1500 SetNotificationPresentationSetting
1510 GetNotificationPresentationSetting
2000 #GetAlarmSetting
2001 GetAlarmSettingWithApplicationParameter
2010 #SetAlarmSettingIsMuted
2020 #IsAlarmSettingDeletable
8000 RegisterAppletResourceUserId
8010 UnregisterAppletResourceUserId
8999 [10.0.0+] GetCurrentTime
9000 #GetAlarmSettingNextNotificationTime

GetNotificationCount

No input. Returns a total of 4-bytes of output.

GetNotificationSendingNotifier

No input. Returns an output #INotificationSystemEventAccessor.

INotificationSystemEventAccessor

This is "nn::notification::server::INotificationSystemEventAccessor".

This was added with [9.0.0+].

Cmd Name
0 GetSystemEvent

GetAlarmSetting

Takes an input #AlarmSettingId. Returns an #AlarmSetting.

SetAlarmSettingIsMuted

Takes an input #AlarmSettingId and a bool. No output.

IsAlarmSettingDeletable

Takes an input #AlarmSettingId. Returns a bool.

GetAlarmSettingNextNotificationTime

Takes an input #AlarmSettingId. Returns an u8 IsAlarmScheduled and a PosixTime for the next scheduled alarm.

ectx:w

This is "nn::err::context::IWriterForSystem".

This was added with [11.0.0+].

Cmd Name
0 #CreateContextRegistrar
1 CommitContext
2 RemoveContext

CreateContextRegistrar

No input. Returns an #IContextRegistrar.

IContextRegistrar

This is "nn::err::context::IContextRegistrar".

Cmd Name
0 Complete

ectx:r

This is "nn::err::context::IReaderForSystem".

This was added with [11.0.0+].

Cmd Name
0 GetContextInfo
1 PullContext
2 ListContextDescriptorWithResultForDebug

ectx:aw

This is "nn::err::context::IWriterForApplication".

This was added with [11.0.0+].

Cmd Name
0 #CreateContextRegistrar
1 CommitContext

pl:u

This is "nn::pl::sharedresource::detail::IPlatformSharedResourceManager".

This was added with [16.0.0+].

This has max_sessions 5.

Cmd Name
0 #RequestLoad
1 #GetLoadState
2 #GetSize
3 #GetSharedMemoryAddressOffset
4 #GetSharedMemoryNativeHandle
5 #GetSharedFontInOrderOfPriority
6 GetSharedFontInOrderOfPriorityForSystem

RequestLoad

Takes a #SharedFontType (uint32), no output.

GetLoadState

Takes a #SharedFontType (uint32), returns the #LoadState (uint32).

LoadState

Value Description
0x00 Loading
0x01 Loaded

GetSize

Takes a #SharedFontType (uint32), returns the Font Size (uint32).

GetSharedMemoryAddressOffset

Takes a #SharedFontType (uint32), returns the offset (uint32) to the Font Address.

GetSharedMemoryNativeHandle

No input, returns an output SharedMemory handle.

User-processes map this SharedMemory with size=0x1100000 and permissions=R--.

Font data is TTF, located at the offset returned by #GetSharedMemoryAddressOffset.

GetSharedFontInOrderOfPriority

Takes an input u64 LanguageCode and 3 type-0x6 output buffers, returns an output u8 and u32. The u8 is a bool to specify if the fonts are loaded or not and the u32 is the font count. The first buffer contains a list of Shared font types, the second buffer contains the font offsets and the final buffer contains the font sizes. The buffers are an array of u32s which specify information about a specific font. Buffer1[n] is related to Buffer2[n] and Buffer3[n]. Example: Font index 0s offset is at Buffer2[0], size is at Buffer3[0]. The fonts are relative to the shared memory created by #GetSharedFontSharedMemoryHandle

SharedFontType

Value Description
0x00 Japan, US and Europe (Standard)
0x01 Chinese Simplified
0x02 Extended Chinese Simplified
0x03 Chinese Traditional
0x04 Korean (Hangul)
0x05 Nintendo Extended
  • Nintendo Extended: Contains Nintendo-specific characters, including HID buttons, HID controller styles, applet icons, Wii(U) icons, etc.

ApplicationInstanceId

This is "nn::arp::ApplicationInstanceId".

This is an u64 ID bound to an application instance.

ApplicationKind

This is "nn::arp::ApplicationKind".

Value Description
0 Application
1 MicroApplication

ApplicationLaunchProperty

This is "nn::arp::ApplicationLaunchProperty".

This is a 0x10-byte struct.

Offset Size Description
0x00 0x08 Id
0x08 0x04 Version
0x0C 0x01 Storage
0x0D 0x01 PatchStorage
0x0E 0x01 Kind
0x0F 0x01 Reserved

ApplicationProcessProperty

This is "nn::arp::ApplicationProcessProperty".

This is a 0x1-byte struct.

[17.0.0+] This is a 0x10-byte struct.

Offset Size Description
0x00 0x01 ProgramIndex
0x01 0x0F

ApplicationCertificate

This is "nn::arp::ApplicationCertificate".

This is a 0x528-byte struct.

AlarmSettingId

This is "nn::notification::AlarmSettingId". This is an u16.

AlarmSetting

This is "nn::notification::AlarmSetting". Total size is 0x40 bytes. When initializing this to the defaults, the entire struct is cleared then the last 0xE-bytes are set to 0xFF.

Offset Size Description
0x00 0x02 #AlarmSettingId
0x02 0x01 Kind (0 = WeeklySchedule)
0x03 0x01 u8 bool Muted (non-zero/true = AlarmSetting turned off, zero/false = on).
0x04 0x04 Padding
0x08 0x10 UID. User account associated with this AlarmSetting. Used for the PreselectedUser when launching the Application when the system was previously in sleep-mode, instead of launching the applet for selecting the user.
0x18 0x08 ApplicationId
0x20 0x08 Not set by sdksno, besides clearing it during initialization.
0x28 0x18 Alarm schedule (WeeklyScheduleAlarmSetting)

Schedule:

Offset Size Description
0x00 0x0A Not set by sdksno, besides clearing it during initialization.
0x0A 0xE(7*2) Array of 7 entries where each entry is 2-bytes. Index is nn::time::DayOfWeek, Sun-Sat.

Array entries:

Each byte is set using an input s32. An entry with value 0xFFFF (the default) indicates that it's disabled. The high byte is the hour, the low byte is the minute. This uses local-time.

sdknso checks whether an entry is enabled with: return ({last 5-bits of the entry} < 3) && ((entry & 0xfc) < 60);. The first check is equivalent to comparing the second entry byte with value 24.