Changes

4,464 bytes added ,  20:56, 3 August 2017
Created page with "with is the library applet used to select a Mii. Internally it is called ''appletEd''. =Launching the applet= ''appletEd'' can be launched by calling APT:StartLibraryA..."
with is the library applet used to select a [[Mii]]. Internally it is called
''appletEd''.

=Launching the applet=

''appletEd'' can be launched by calling [[APT:StartLibraryApplet]] with
[[NS_and_APT_Services#AppIDs|AppID]] 0x402. It expects a pointer to a
[[#Parameter Buffer|buffer]] of 0x104 bytes to be passed as parameter. It does
not use other ressources, so an invalid [[SVC#typedef_Handle|handle]] of value 0
is expected.

After returning from the applet, [[#Return Buffer|part of the parameter buffer]]
is filled with the data of any selected Mii and some other related values.

=Parameter Buffer=

The applet can be configured to work in a flexible way by setting values in a
0x104 byte long buffer that is passed when launching it.

{| class="wikitable" border="1"
|-
! Index Byte
! Size
! Type
! Name
! Description
|-
| 0x000
| 1
| <code>1*u8</code>
| Cancel button flag
| If set to a nonzero value, a Button labeled ''(B) Cancel'' is displayed at the bottom of the applet.
This allows to cancel the selection of a Mii.
|-
| 0x001
| 1
| <code>1*u8</code>
| Enable Guest Mii selection flag
| If set to a nonzero value, 6 predefined ''Guest Miis'' can be selected on their own page.
|-
| 0x002
| 1
| <code>1*u8</code>
| Show on top screen flag
| If set to a nonzero value, the applet is displayed at the top screen instead of the touchscreen.
|-
| 0x003
| 5
| <code>5*u8</code>
| ''Unknown''
| May be padding to align the following data to a 8-byte boundary.
|-
| 0x008
| 128 (0x80)
| <code>64*u16</code>
| Title
| This is a UTF16-LE[https://en.wikipedia.org/wiki/UTF-16]-encoded, zero-terminated string that is displayed at the top of the applet.
If the first character is set to <code>'\x0000'</code> (null-terminator), a default title is displayed.
|-
| 0x088
| 4
| <code>4*u8</code>
| ''Unknown''
| May be padding.
|-
| 0x08C
| 1
| <code>1*u8</code>
| Show Guest Miis flag
| If set to a nonzero value, the applet initially shows the page where the Guest Miis are located.
Otherwise, it displays the user-created/-imported Miis after launch.
|-
| 0x08D
| 3
| <code>3*u8</code>
| ''Unknown''
| May be padding to align the following data to a 8-byte boundary.
|-
| 0x090
| 4
| <code>1*u32</code>
| Initially selected Mii index
| If set to a value <code>i</code>, the cursor is initially placed on the <code>i+1</code>st Mii in the [[Mii#Mii_Database|Mii database]].
If ''Show Guest Miis'' is set and <code>i</code> is in [0,...,5], the cursor is placed on the <code>i+1</code>st Guest Mii. In any other case a user's personal Mii is selected.
|-
| 0x094
| 6
| <code>6*u8</code>
| Guest Mii whitelist
| For each nonzero byte in this array, the corresponding Guest Mii is made selectable.
Otherwise they are greyed out and can't be selected.
|-
| 0x09A
| 100 (0x64)
| <code>100*u8</code>
| User Mii whitelist
| Like the above, only for the Miis found in the system's database.
A Mii's index in this array corresponds to its index in the system database.
|-
| 0x0FE
| 2
| <code>1*u16</code>
| ''Unknown''
| May be padding to align the following data to a 8-byte boundary.
|-
| 0x100
| 4
| <code>1*u32</code>
| Magic value <code>0x13DE28CF</code> (little Endian)
| Without this value, the applet refuses to display any Miis.
|}

=Return Buffer=

After selecting a Mii or canceling the operation, ''appletEd'' writes 0x84 byte
to the parameter buffer it was passed, starting at offset 0.

{| class="wikitable" border="1"
|-
! Index Byte
! Size
! Type
! Name
! Description
|-
| 0x00
| 4
| <code>1*u32</code>
| Return code
| Set to 1 if the action was canceled, 0 if a Mii was selected.
|-
| 0x04
| 4
| <code>1*u32</code>
| Guest Mii selected flag
| Set to 1 if a Guest Mii was selected, 0 if it was a user Mii.
|-
| 0x08
| 4
| <code>1*u32</code>
| Selected Guest Mii index
| If a Guest Mii was selected, this is set to the value corresponding to its index (i.e. 3 for Guest D).
Set to 0xFFFFFFFF (-1) if a user Mii was selected.
|-
| 0x0C
| 92 (0x5c)
| <code>1*struct mii</code>
| Selected Mii data
| If a Mii was selected, its data is copied here.
The same [[Mii#Mii format|format]] as in the system's Mii database is used.
|-
| 0x68
| 2
| <code>2*u8</code>
| ''Unknown''
| -
|-
| 0x6a
| 2
| <code>1*u16</code>
| Mii data checksum (?)
| This may be a [[Mii#Checksum|checksum]] of the returned Mii data.
|-
| 0x6c
| 24
| <code>12*u16</code>
| Guest Mii name
| The localized name as a UTF16-LE string of a Guest Mii if one was selected, zeroed otherwise.
|}
9

edits