LDN services: Difference between revisions

No edit summary
Line 647: Line 647:


=== CreateGroup ===
=== CreateGroup ===
Takes a type-0x31 input buffer containing a 0x200-byte struct, no output.
Takes a type-0x31 input buffer containing a [[#GroupInfo]], no output.


[[Mario Kart Live: Home Circuit|mklive]] uses the following string with this: "Failed to create a group: %08X".
[[Mario Kart Live: Home Circuit|mklive]] uses the following string with this: "Failed to create a group: %08X".
Line 765: Line 765:


=== Join ===
=== Join ===
Takes a type-0x32 output buffer containing a [[#GroupInfo]] and a type-0x31 input buffer containing a 0x200-byte struct.
Takes a type-0x32 output buffer containing a [[#GroupInfo]] and a type-0x31 input buffer containing a [[#GroupInfo]].


This runs the same code as [[#CreateGroup]] to generate the [[#GroupInfo]] for the input struct (which with [[#CreateGroup]] would be available with [[#GetGroupInfo]]). The input struct is the same as [[#CreateGroup]].
This runs the same code as [[#CreateGroup]] to generate the [[#GroupInfo]] for the input struct (which with [[#CreateGroup]] would be available with [[#GetGroupInfo]]). The input struct is the same as [[#CreateGroup]].
Line 1,192: Line 1,192:
= GroupInfo =
= GroupInfo =
This is "nn::lp2p::GroupInfo". This is a 0x200-byte struct.
This is "nn::lp2p::GroupInfo". This is a 0x200-byte struct.
[[Mario Kart Live: Home Circuit|mklive]] sets the SSID to a string generated from random data, the key-data is also set to random data.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 1,199: Line 1,201:
! Description
! Description
|-
|-
| 0x10 || 0x8 || LocalCommunicationId
| 0x0 || 0x10 || When zero, this is set to randomly-generated data.
|-
| 0x10 || 0x8 || LocalCommunicationId. When zero, the value from control.nacp is loaded.
|-
| 0x18 || 0x6 || "GROUP ID  (BSSID)" [[#GroupId]]. When zero, the default is used.
|-
|-
| 0x18 || 0x6 || "GROUP ID  (BSSID)" [[#GroupId]]
| 0x1E || 0x15 || "GROUP NAME (SSID)" NUL-terminated string.
|-
|-
| 0x1E || 0x21 || "GROUP NAME (SSID)" NUL-terminated string.
| 0x3F || 0x1 || s8 Flags_mask count.
|-
| 0x40 || {above count} || Array of s8 with the above count. Each entry is an array index used to load a set of flags from a global array with the specified index. loaded_flags below is masked with the flags loaded here. global_flags are also masked with flags loaded from here.
|-
|-
| 0x84 || 0x2 || Wifi frequency: 24 = 2.4GHz, 50 = 5.0GHz.
| 0x84 || 0x2 || Wifi frequency: 24 = 2.4GHz, 50 = 5.0GHz.
Line 1,210: Line 1,218:
* 24: 1, 6, 11.
* 24: 1, 6, 11.
* 50: 36, 40, 44, 48.
* 50: 36, 40, 44, 48.
|-
| 0x8A || 0x1 || Security type. 0 = use defaults, 2 = encrypted, other-values = plaintext.
|-
| 0x8B || 0x1 ||
|-
| 0x8E || 0x1 || Bool flag, controls whether the SSID is hidden.
|-
| 0x8F || 0x1 || If zero, a default value of 0x20 is used.
|-
| 0x10F || 0x1 || Flags count.
|-
| 0x110 || {above count} || Array of s8 with the above count for total entries. The flags are loaded by: <nowiki>"loaded_flags |= BIT(s8_entryvalue)"</nowiki>, with each entry. Afterwards, loaded_flags is masked with 0x7. loaded_flags must be non-zero.
|-
| 0x1C0 || 0x1 || Key data size. Must be 0x20.
|-
| 0x1C1 || 0x20 || Key data.
|}
|}
The above loaded_flags are used when +0x8A is 0. global_flags are loaded from global data. Flags:
* Bit2 clear:
** global_flags must be non-zero, and loaded_flags bit1 must be set.
** u8 +0x8A is set to value 1.
** When the cached [[SPL_services#IsDevelopment|IsDevelopment]] value is false (retail), an error is thrown.
** u8 +0x8B is set to value 0.
* Otherwise, if bit2 is set:
** u8 +0x8A is set to value 2.
** global_flags bit1 set:
*** u8 +0x8B is set to value 1.
** Otherwise, if global_flags bit2 is set:
*** u8 +0x8B is set to value 2.


= ScanResult =
= ScanResult =