Mii: Difference between revisions
m →Mii Database: Record it in little-endian |
TimmSkiller (talk | contribs) move CFLStoreData here |
||
(19 intermediate revisions by 7 users not shown) | |||
Line 90: | Line 90: | ||
==Checksum== | ==Checksum== | ||
The algorithm used to verify the integrity of the database is based on | The algorithm used to verify the integrity of the database is based on CRC-16/XMODEM. It is the same algorithm used to verify [http://wiibrew.org/wiki/Mii_Data#Block_format Mii Data on the Wii]. | ||
To obtain the correct value for the checksum, apply the algorithm to the first 0xC81E bytes of the database. This can be done using [https://gbatemp.net/threads/tutorial-give-your-mii-gold-pants-and-use-it-for-streetpass.379146/page-24#post-6569186 FixCRC]; alternativly a pseudocode implementation of the checksum algorithm is given below: | To obtain the correct value for the checksum, apply the algorithm to the first 0xC81E bytes of the database. This can be done using [https://gbatemp.net/threads/tutorial-give-your-mii-gold-pants-and-use-it-for-streetpass.379146/page-24#post-6569186 FixCRC]; alternativly a pseudocode implementation of the checksum algorithm is given below: | ||
Line 96: | Line 96: | ||
<source lang="python"> | <source lang="python"> | ||
def crc16_CCITTWii(u8[]: data) -> u16: | def crc16_CCITTWii(u8[]: data) -> u16: | ||
"""Calculate a checksum of data using the | """Calculate a checksum of data using the CRC-16/XMODEM implementation | ||
CRC-16/XMODEM implementation uses 0x0000 as the starting value | |||
""" | """ | ||
u32 crc := 0x0 | u32 crc := 0x0 | ||
Line 135: | Line 132: | ||
| 0x0 | | 0x0 | ||
| 0x1 | | 0x1 | ||
| Always 3 | | Mii Version - Always 3 | ||
|- | |- | ||
| 0x1 | | 0x1 | ||
| 0x1 | | 0x1 | ||
| bit 0: allow copying<br/>bit 1: | | bit 0: allow copying<br/>bit 1: profanity flag (whether in Mii name or creator name does not matter)<br/>bit 2-3: region lock (0=no lock, 1=JPN, 2=USA, 3=EUR)<br/>bit4-5:character set(0=JPN+USA+EUR, 1=CHN, 2=KOR, 3=TWN) | ||
|- | |- | ||
| 0x2 | | 0x2 | ||
Line 147: | Line 144: | ||
| 0x3 | | 0x3 | ||
| 0x1 | | 0x1 | ||
| bit 0-3: ?<br/>bit 4-6: | | bit 0-3: ?<br/>bit 4-6: Device Mii was originally made on (1=Wii, 2=DS, 3=3DS, 4=Wii U/Switch) | ||
|- | |- | ||
| 0x4 | | 0x4 | ||
Line 155: | Line 152: | ||
| 0xC | | 0xC | ||
| 0x4 | | 0x4 | ||
| Mii ID (big-endian 32bit unsigned integer):<br/>Bit 0..27: (bit[0..27] * 2) = date of creation (seconds since 01/01/2010 00:00:00)<br/>Bit 28: Always set?<br/>Bit 29: set for temporary Mii<br/>Bit 30: Set for DSi mii?<br/>Bit 31: not set | | Mii ID (big-endian 32bit unsigned integer):<br/>Bit 0..27: (bit[0..27] * 2) = date of creation (seconds since 01/01/2010 00:00:00)<br/>Bit 28: Always set?<br/>Bit 29: set for temporary Mii<br/>Bit 30: Set for DSi mii?<br/>Bit 31: not set if Mii is special | ||
|- | |- | ||
| 0x10 | | 0x10 | ||
Line 167: | Line 164: | ||
| 0x18 | | 0x18 | ||
| 0x2 | | 0x2 | ||
| | | bit 0: sex (0 if male, 1 if female)<br/>bit 1-4: birthday month<br/>bit 5-9: birthday day<br/>bit 10-13: favorite color<br/>bit 14: favorite mii (0 if false, 1 if true) | ||
|- | |- | ||
| 0x1A | | 0x1A | ||
Line 207: | Line 204: | ||
| 0x3E | | 0x3E | ||
| 0x2 | | 0x2 | ||
| bit 0-5: | | bit 0-5: mouth style<br/>bit 6-8: mouth color<br/>bit 9-12: mouth scale<br/>bit 13-15: mouth yscale | ||
|- | |- | ||
| 0x40 | | 0x40 | ||
| 0x2 | | 0x2 | ||
| bit 0-4: | | bit 0-4: mouth y position<br/>bit 5-7: mustach style | ||
|- | |- | ||
| 0x42 | | 0x42 | ||
Line 228: | Line 225: | ||
| 0x14 | | 0x14 | ||
| UTF-16 Author Name (10 chars max, 0000 terminated) | | UTF-16 Author Name (10 chars max, 0000 terminated) | ||
|} | |||
== CFLStoreData == | |||
This is a common Mii container object, used in games and system modules like [[Friend_Services|FRD]] and [[ACT_Services|ACT]]. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset !! Size !! Description | |||
|- | |||
| 0x0 || 0x5C || Base Mii data in the above format | |||
|- | |||
| 0x5C || 0x2 || padding, left as zeros usually | |||
|- | |||
| 0x5E || 0x2 || CRC16 over the previous 0x5E of data | |||
|} | |} | ||
Line 233: | Line 243: | ||
====Special (gold) Miis==== | ====Special (gold) Miis==== | ||
Specialness will override any other color | Specialness will override any other pants color. | ||
A special Mii cannot have sharing on or else it will be deemed invalid. | |||
Zeroed system-id and timestamp? | Zeroed system-id and timestamp? | ||
Line 251: | Line 261: | ||
====Personal (red) Mii==== | ====Personal (red) Mii==== | ||
A red Mii that happens to be the first in the file! | A red Mii that happens to be the first in the file! | ||
The Mii doesn't really need to be red, it is only red because the personal Mii is always favorited. | |||
==Mii values== | ==Mii values== | ||
Line 584: | Line 596: | ||
0x64,0x06,0x14, | 0x64,0x06,0x14, | ||
0x5d,0x66,0x1b, | 0x5d,0x66,0x1b, | ||
0x04,0x11,0x6e] | 0x04,0x11,0x6e], | ||
[0x7b,0x08,0x6a, | [0x7b,0x08,0x6a, | ||
0x48,0x03,0x15, | 0x48,0x03,0x15, | ||
Line 615: | Line 627: | ||
0x0f,0x0d,0x16, | 0x0f,0x0d,0x16, | ||
0x12,0x10,0x17] | 0x12,0x10,0x17] | ||
], | |||
eyes: [ | |||
[0x02,0x04,0x00, | |||
0x08,0x27,0x11, | |||
0x01,0x1a,0x10, | |||
0x0f,0x1b,0x14], | |||
[0x21,0x0b,0x13, | |||
0x20,0x09,0x0c, | |||
0x17,0x22,0x15, | |||
0x19,0x28,0x23], | |||
[0x05,0x29,0x0d, | |||
0x24,0x25,0x06, | |||
0x18,0x1e,0x1f, | |||
0x12,0x1c,0x2e], | |||
[0x07,0x2c,0x26, | |||
0x2a,0x2d,0x1d, | |||
0x03,0x2b,0x16, | |||
0x0a,0x0e,0x2f], | |||
[0x30,0x31,0x32, | |||
0x35,0x3b,0x38, | |||
0x36,0x3a,0x39, | |||
0x37,0x33,0x34] | |||
], | ], | ||
nose: [ | nose: [ |