Skip to content

Instantly share code, notes, and snippets.

@ariankordi
Created November 17, 2025 20:54
Show Gist options
  • Select an option

  • Save ariankordi/82d0e7ec1451918f6ec8f4e5f028af1d to your computer and use it in GitHub Desktop.

Select an option

Save ariankordi/82d0e7ec1451918f6ec8f4e5f028af1d to your computer and use it in GitHub Desktop.
ImHex hex patterns for mii data (may expand and/or make into github repo
#pragma description "RFLiCharData (aka RFLStoreData, CFLiRFLMiiDataCore, FFLiMiiDataCoreRFL, FFLiMiiDataOfficialRFL)"
#pragma endian big
// Enums
enum Gender : u8 {
male = 0,
female = 1,
all = 2
};
enum FavoriteColor : u8 {
red = 0,
orange = 1,
yellow = 2,
yellowGreen = 3,
green = 4,
blue = 5,
skyBlue = 6,
pink = 7,
purple = 8,
brown = 9,
white = 10,
black = 11
};
enum Type : u8 {
normal = 0,
presented = 1, // downloaded from Check Mii Out Channel
underground = 2,
special = 3
};
enum CreateIdPlatform : u8 {
wii = 0,
ctr = 1,
ntr = 2,
wiiu = 3
};
// Bitfields
bitfield RFLiCharDataBits0 {
padding0 : 1;
gender : 1;
birthMonth : 4;
birthDay : 5;
favoriteColor : 4;
favorite : 1;
};
bitfield RFLiCharDataBits1 {
faceType : 3;
faceColor : 3;
faceTex : 4;
padding2 : 3;
localOnly : 1;
type : 2;
hairType : 7;
hairColor : 3;
hairFlip : 1;
padding3 : 5;
eyebrowType : 5;
eyebrowRotate : 5;
padding4 : 6;
eyebrowColor : 3;
eyebrowScale : 4;
eyebrowY : 5;
eyebrowX : 4;
eyeType : 6;
eyeRotate : 5;
eyeY : 5;
eyeColor : 3;
eyeScale : 4;
eyeX : 4;
padding5 : 5;
noseType : 4;
noseScale : 4;
noseY : 5;
padding6 : 3;
mouthType : 5;
mouthColor : 2;
mouthScale : 4;
mouthY : 5;
glassType : 4;
glassColor : 3;
glassScale : 4;
glassY : 5;
mustacheType : 2;
beardType : 2;
beardColor : 3;
beardScale : 4;
beardY : 5;
moleType : 1;
moleScale : 4;
moleY : 5;
moleX : 5;
padding8 : 1;
};
// Structs
bitfield CreateIdFlags {
normal : 1; // Set = normal, Clear = special
field1 : 1; // Set on DS/Wii U, clear on Wii/3DS
temporary : 1; // Set = random/temporary Mii
field3 : 1; // Set on 3DS/Wii U, clear on Wii/DS
dateHi : 4;
};
struct CreateId {
CreateIdFlags flags;
// 28-bit value packed across 4 bytes, big endian.
u8 dateMidHi;
u8 dateMidLo;
u8 dateLo;
// Reconstruct 28-bit createDateOffset (stored big endian)
u32 createDateOffset = ((flags.dateHi << 20) | (dateMidHi << 12) | (dateMidLo << 4) | (dateLo >> 4));
// Remaining 4 bits of dateLo are padding or unknown
u8 datePad = dateLo & 0x0F;
// Remaining 4 bytes: addrLow
u8 addrLow[4];
};
// ---- Main Struct ----
struct RFLiCharData {
// Initial bitfield for the first group of fields.
RFLiCharDataBits0 bits0;
// Name (UTF-16BE, 10 chars, not null-terminated, always 20 bytes).
char16 name[10];
u8 height;
u8 build;
// CreateId field, 8 bytes.
CreateId createId;
// Composite bitfields for the rest of the data.
RFLiCharDataBits1 bits1;
// Creator name (UTF-16BE, 10 chars, not null-terminated, always 20 bytes).
char16 creatorName[10];
// Note: CRC field is included in RFLStoreData
};
RFLiCharData rflCharData @ 0x0;
#pragma endian little
#pragma description "CFLiMiiDataPacket / Ver3StoreData (used on 3DS, Wii U, Miitomo, Switch inside amiibo data)"
// Enums
enum Gender : u8 {
male = 0,
female = 1,
all = 2
};
enum FavoriteColor : u8 {
red = 0,
orange = 1,
yellow = 2,
yellowGreen = 3,
green = 4,
blue = 5,
skyBlue = 6,
pink = 7,
purple = 8,
brown = 9,
white = 10,
black = 11
};
enum FontRegion : u8 {
jpUsEu = 0,
china = 1,
korea = 2,
taiwan = 3
};
enum RegionMove : u8 {
all = 0,
jpOnly = 1,
usOnly = 2,
euOnly = 3
};
enum BirthPlatform : u8 {
wii = 1,
ds = 2,
ctr = 3,
wiiu = 4
};
enum CreateIdPlatform : u8 {
wii = 0,
ctr = 1,
ntr = 2,
wiiu = 3
};
// Bitfields
bitfield Ver3StoreDataBits0 {
miiVersion : 8;
copyable : 1;
ngWord : 1;
regionMove : 2;
fontRegion : 2;
reserved0 : 2;
roomIndex : 4;
positionInRoom : 4;
authorType : 4;
birthPlatform : 3;
reserved1 : 1;
};
bitfield Ver3StoreDataBits1 {
gender : 1;
birthMonth : 4;
birthDay : 5;
favoriteColor : 4;
favorite : 1;
padding0 : 1;
};
bitfield Ver3StoreDataBits2 {
localOnly : 1;
faceType : 4;
faceColor : 3;
faceTex : 4;
faceMake : 4;
hairType : 8;
hairColor : 3;
hairFlip : 1;
padding1 : 4;
eyeType : 6;
eyeColor : 3;
eyeScale : 4;
eyeAspect : 3;
eyeRotate : 5;
eyeX : 4;
eyeY : 5;
padding2 : 2;
eyebrowType : 5;
eyebrowColor : 3;
eyebrowScale : 4;
eyebrowAspect : 3;
padding3 : 1;
eyebrowRotate : 5;
eyebrowX : 4;
eyebrowY : 5;
padding4 : 2;
noseType : 5;
noseScale : 4;
noseY : 5;
padding5 : 2;
mouthType : 6;
mouthColor : 3;
mouthScale : 4;
mouthAspect : 3;
mouthY : 5;
mustacheType : 3;
padding6 : 8;
beardType : 3;
beardColor : 3;
beardScale : 4;
beardY : 5;
padding7 : 1;
glassType : 4;
glassColor : 3;
glassScale : 4;
glassY : 5;
moleType : 1;
moleScale : 4;
moleX : 5;
moleY : 5;
padding8 : 1;
};
// Structs
bitfield CreateIdFlags {
dateHi : 4; ///< Bits 0-3 (LSB in little-endian view, but MSB in actual file)
field3 : 1; ///< Bit 4
temporary : 1; ///< Bit 5
field1 : 1; ///< Bit 6
normal : 1; ///< Bit 7 (MSB in real file, LSB in ImHex interpretation)
/*
normal : 1; ///< Set = Normal, Clear = Special
field1 : 1; ///< Set on DS/Wii U
temporary : 1; ///< Set = Random Mii (invalid/stale)
field3 : 1; ///< Set on 3DS/Wii U
dateHi : 4; ///< High 4 bits of 28-bit timestamp offset
*/
};
struct CreateId {
CreateIdFlags flags;
u8 dateMidHi;
u8 dateMidLo;
u8 dateLo;
u32 createDateOffset = ((flags.dateHi << 20) | (dateMidHi << 12) | (dateMidLo << 4) | (dateLo >> 4));
u8 datePad = dateLo & 0x0F;
u8 createIdBase[6]; ///< MAC, SHA-1, device hash, or random, depending on platform
};
struct Ver3StoreData {
Ver3StoreDataBits0 bits0;
u8 authorId[8];
CreateId createId;
u8 reserved2[2];
Ver3StoreDataBits1 bits1;
char16 name[10]; ///< UTF-16LE, not null-terminated
u8 height;
u8 build;
Ver3StoreDataBits2 bits2;
char16 creatorName[10]; ///< UTF-16LE, only present in CFLiPackedMiiDataOfficial
u16 padding9; ///< Only present in CFLiMiiDataPacket
u16 crc; ///< Only present in CFLiMiiDataPacket
};
Ver3StoreData ver3StoreData @ 0x00;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment