Mii: Difference between revisions
Meleemeister (talk | contribs) →Checksum: The implementation is not wrong it's just a different one called CRC-16/XMODEM |
|||
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 | ||