JSFiddle - React, Tailwind, and code Playground
by arian_
HTML
<h1>miitomo "mii_data" decode toy</h1>
<p>how do you find that data?
<ul>
<li>like this: <a target="_blank" href="https://mii-unsecure.ariankordi.net/miitomo_get_player_data/44324e285f30b11b?namespace=own_mii">https://mii-unsecure.ariankordi.net/miitomo_get_player_data/44324e285f30b11b?namespace=own_mii</a>
<ul><li>the id after <code>miitomo_get_player_data/</code> is the same one, as the first hex code, in your friend invite link, after <code>friend_code/</code></li></ul>
</li>
<li>look at <code>own_mii</code> or <code>stock_mii</code> in your miitomo cache folder, each file in there is json</li>
<br>
<li>fields beginning with underscores are unknown</li>
<li>negative values mean unset</li>
<li>topsState: 2 = untucked, 1 = tucked (i think)</li>
</ul>
</p>
<form onsubmit="decodeAndDisplay(event)">
<input id="dataInput" type="text" style="width: 600px" value="AwAAAAAAAhAlZ_____87AzIDEwA5A9MAWQMCUClVJBMDBgIHBwMCAMkAvQA9ATUBAAAA4A">
<br>
<button>Decode and Display</button>
</form>
<pre id="output"></pre>
JavaScript
/*
#pragma pack(push, 1)
typedef struct mii_data {
// note that a dataset of 32463 of these scraped from kaerutomo
// outfit/sidekick central has been used to guess constant/unused fields.
// unused = it has never been seen as non-zero in my dataset
uint32_t _0; // always 03000000, only LSB is used
uint8_t _4_4:4; // unused
uint8_t allColor:4;
uint8_t topslongColor:4;
uint8_t topsColor:4;
uint8_t bottomsAColor:4;
uint8_t bottomsBColor:4;
uint8_t shoesColor:4;
uint8_t accessoryColor:4;
uint8_t headwearColor:4;
uint8_t _8_0:4; // unk/1% of dataset
uint8_t _9; // unk/6% of dataset
int16_t allIndex; // bodyAll
int16_t topslongIndex;
int16_t topsIndex;
int16_t bottomsAIndex;
int16_t bottomsBIndex;
int16_t shoesIndex;
int16_t accessoryIndex; // bodyAcce
int16_t headwearIndex;
uint8_t topsState; // 02 = untucked, 01 = tucked (??), possible vals <= 4
uint8_t voiceParam[6]; // copied to JSON
uint8_t characterParam[5]; // copied to JSON
uint8_t specialMiiRegion; // copied to JSON, possible vals <= 4
uint8_t _27; // last 4 bits used 1% / first 4 unused
int16_t _28; // first 8 bits used 5%
int16_t _2a; // 5% used?
int16_t _2c; // first 8 bits used 5%
uint8_t _2e; // 5% used?
uint8_t _2f; // last 4 bits used 1% / first 4 unused
uint16_t _30; // unused
int16_t birthYear; // unset=0, min. 1900, birth day/month are in StoreData(?)
} mii_data;
*/
function decodeToObject(data) {
const readS16 = (offset) => (data[offset] | (data[offset + 1] << 8)) << 16 >> 16; // Signed 16-bit
const readU16 = (offset) => (data[offset] | (data[offset + 1] << 8)); // Unsigned 16-bit
const readS32 = (offset) => (data[offset] | (data[offset + 1] << 8) | (data[offset + 2] << 16) | (data[offset + 3] << 24));
const readU8 = (offset) => data[offset]; // Unsigned 8-bit
return {
_0:...