Mii: Difference between revisions
m Fix missing comma |
TimmSkiller (talk | contribs) move CFLStoreData here |
||
(2 intermediate revisions by 2 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 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 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 | |||
|} | |} | ||