Skip to content

API Reference

Core Classes

MiiDatabase

mii.database.MiiDatabase

Reads and manages Miis from a database file

Source code in src/mii/database.py
class MiiDatabase:
    """Reads and manages Miis from a database file"""

    def __init__(self, file_path: Path, mii_type: MiiType):
        """Initialize MiiDatabase by reading from a database file

        Args:
            file_path: Path to the database file
            mii_type: Type of Mii database (determines offset, size, etc.)

        Raises:
            MiiDatabaseError: If file doesn't exist or can't be read

        Examples:
            >>> from pathlib import Path
            >>> from mii import MiiDatabase, MiiType
            >>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
            >>> print(len(database))
        """
        # If the provided path doesn't exist, check known locations
        if not file_path.exists():
            known_locations = _get_known_database_locations(file_path.name)
            found_path = None

            for location in known_locations:
                if location.exists():
                    found_path = location
                    break

            if found_path:
                file_path = found_path
            else:
                raise MiiDatabaseError(f"{file_path} not found")

        self.file_path = file_path
        self.mii_type = mii_type
        self._miis: List[Mii] = []
        self._load_miis()

    def _load_miis(self) -> None:
        """Load all Miis from the database file into memory"""
        empty_mii = bytearray(self.mii_type.SIZE)

        try:
            with open(self.file_path, "rb") as infile:
                infile.seek(self.mii_type.OFFSET)

                mii_count = 0
                is_active = True

                while is_active and mii_count < self.mii_type.LIMIT:
                    mii_data = infile.read(self.mii_type.SIZE)

                    # Stop if we've run out of data
                    if len(mii_data) < self.mii_type.SIZE:
                        is_active = False
                    # Skip empty Miis but continue reading
                    elif mii_data == empty_mii:
                        continue
                    else:
                        # Parse the Mii data
                        mii = MiiParser.parse(mii_data, padding=self.mii_type.PADDING)
                        self._miis.append(mii)
                        mii_count += 1

        except PermissionError as e:
            raise MiiDatabaseError(
                f"Permission denied accessing {self.file_path}"
            ) from e
        except Exception as e:
            raise MiiDatabaseError(f"Error reading database: {e}") from e

    def __iter__(self) -> Iterator[Mii]:
        """Make MiiDatabase iterable"""
        return iter(self._miis)

    def __len__(self) -> int:
        """Return count of Miis in database"""
        return len(self._miis)

    def __getitem__(self, index: int) -> Mii:
        """Index access to Miis"""
        return self._miis[index]

    def filter(self, predicate: Callable[[Mii], bool]) -> List[Mii]:
        """Filter Miis by a predicate function

        Args:
            predicate: Function that takes a Mii and returns True to include it

        Returns:
            List of Miis that match the predicate

        Examples:
            >>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
            >>> red_miis = database.filter(lambda m: m.favorite_color == "Red")
            >>> named_miis = database.filter(lambda m: m.name and m.name != "Unnamed")
        """
        return [mii for mii in self._miis if predicate(mii)]

    def get_all(self) -> List[Mii]:
        """Get all Miis as a list"""
        return self._miis.copy()

    def get_by_name(self, name: str) -> Optional[Mii]:
        """Get the first Mii with a matching name (case-insensitive)

        Args:
            name: Name to search for

        Returns:
            Mii with matching name, or None if not found

        Examples:
            >>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
            >>> mii = database.get_by_name("My Mii")
            >>> if mii:
            ...     print(mii.creator_name)
        """
        name_lower = name.lower()
        for mii in self._miis:
            if mii.name.lower() == name_lower:
                return mii
        return None

    def get_favorites(self) -> List[Mii]:
        """Get all favorite Miis

        Returns:
            List of Miis marked as favorites

        Examples:
            >>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
            >>> favorites = database.get_favorites()
            >>> print(f"Found {len(favorites)} favorite Miis")
        """
        return self.filter(lambda m: m.is_favorite)

    def export_all(self, output_dir: Path, prefix: Optional[str] = None) -> List[Path]:
        """Export all Miis from this database to individual files

        Args:
            output_dir: Directory where Mii files should be written
            prefix: Optional prefix for filenames. If None, uses mii_type.PREFIX

        Returns:
            List of Path objects for the exported files

        Examples:
            >>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
            >>> exported = database.export_all(Path("./miis"))
            >>> print(f"Exported {len(exported)} Miis")
        """
        output_dir.mkdir(parents=True, exist_ok=True)
        file_prefix = prefix if prefix is not None else self.mii_type.PREFIX
        exported_paths: List[Path] = []

        for idx, mii in enumerate(self._miis):
            mii_name = f"{file_prefix}{idx:05d}.mii"
            output_path = output_dir / mii_name
            mii.export(output_path)
            exported_paths.append(output_path)

        return exported_paths

__getitem__(index)

Index access to Miis

Source code in src/mii/database.py
def __getitem__(self, index: int) -> Mii:
    """Index access to Miis"""
    return self._miis[index]

__init__(file_path, mii_type)

Initialize MiiDatabase by reading from a database file

Parameters:

Name Type Description Default
file_path Path

Path to the database file

required
mii_type MiiType

Type of Mii database (determines offset, size, etc.)

required

Raises:

Type Description
MiiDatabaseError

If file doesn't exist or can't be read

Examples:

>>> from pathlib import Path
>>> from mii import MiiDatabase, MiiType
>>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
>>> print(len(database))
Source code in src/mii/database.py
def __init__(self, file_path: Path, mii_type: MiiType):
    """Initialize MiiDatabase by reading from a database file

    Args:
        file_path: Path to the database file
        mii_type: Type of Mii database (determines offset, size, etc.)

    Raises:
        MiiDatabaseError: If file doesn't exist or can't be read

    Examples:
        >>> from pathlib import Path
        >>> from mii import MiiDatabase, MiiType
        >>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
        >>> print(len(database))
    """
    # If the provided path doesn't exist, check known locations
    if not file_path.exists():
        known_locations = _get_known_database_locations(file_path.name)
        found_path = None

        for location in known_locations:
            if location.exists():
                found_path = location
                break

        if found_path:
            file_path = found_path
        else:
            raise MiiDatabaseError(f"{file_path} not found")

    self.file_path = file_path
    self.mii_type = mii_type
    self._miis: List[Mii] = []
    self._load_miis()

__iter__()

Make MiiDatabase iterable

Source code in src/mii/database.py
def __iter__(self) -> Iterator[Mii]:
    """Make MiiDatabase iterable"""
    return iter(self._miis)

__len__()

Return count of Miis in database

Source code in src/mii/database.py
def __len__(self) -> int:
    """Return count of Miis in database"""
    return len(self._miis)

export_all(output_dir, prefix=None)

Export all Miis from this database to individual files

Parameters:

Name Type Description Default
output_dir Path

Directory where Mii files should be written

required
prefix Optional[str]

Optional prefix for filenames. If None, uses mii_type.PREFIX

None

Returns:

Type Description
List[Path]

List of Path objects for the exported files

Examples:

>>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
>>> exported = database.export_all(Path("./miis"))
>>> print(f"Exported {len(exported)} Miis")
Source code in src/mii/database.py
def export_all(self, output_dir: Path, prefix: Optional[str] = None) -> List[Path]:
    """Export all Miis from this database to individual files

    Args:
        output_dir: Directory where Mii files should be written
        prefix: Optional prefix for filenames. If None, uses mii_type.PREFIX

    Returns:
        List of Path objects for the exported files

    Examples:
        >>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
        >>> exported = database.export_all(Path("./miis"))
        >>> print(f"Exported {len(exported)} Miis")
    """
    output_dir.mkdir(parents=True, exist_ok=True)
    file_prefix = prefix if prefix is not None else self.mii_type.PREFIX
    exported_paths: List[Path] = []

    for idx, mii in enumerate(self._miis):
        mii_name = f"{file_prefix}{idx:05d}.mii"
        output_path = output_dir / mii_name
        mii.export(output_path)
        exported_paths.append(output_path)

    return exported_paths

filter(predicate)

Filter Miis by a predicate function

Parameters:

Name Type Description Default
predicate Callable[[Mii], bool]

Function that takes a Mii and returns True to include it

required

Returns:

Type Description
List[Mii]

List of Miis that match the predicate

Examples:

>>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
>>> red_miis = database.filter(lambda m: m.favorite_color == "Red")
>>> named_miis = database.filter(lambda m: m.name and m.name != "Unnamed")
Source code in src/mii/database.py
def filter(self, predicate: Callable[[Mii], bool]) -> List[Mii]:
    """Filter Miis by a predicate function

    Args:
        predicate: Function that takes a Mii and returns True to include it

    Returns:
        List of Miis that match the predicate

    Examples:
        >>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
        >>> red_miis = database.filter(lambda m: m.favorite_color == "Red")
        >>> named_miis = database.filter(lambda m: m.name and m.name != "Unnamed")
    """
    return [mii for mii in self._miis if predicate(mii)]

get_all()

Get all Miis as a list

Source code in src/mii/database.py
def get_all(self) -> List[Mii]:
    """Get all Miis as a list"""
    return self._miis.copy()

get_by_name(name)

Get the first Mii with a matching name (case-insensitive)

Parameters:

Name Type Description Default
name str

Name to search for

required

Returns:

Type Description
Optional[Mii]

Mii with matching name, or None if not found

Examples:

>>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
>>> mii = database.get_by_name("My Mii")
>>> if mii:
...     print(mii.creator_name)
Source code in src/mii/database.py
def get_by_name(self, name: str) -> Optional[Mii]:
    """Get the first Mii with a matching name (case-insensitive)

    Args:
        name: Name to search for

    Returns:
        Mii with matching name, or None if not found

    Examples:
        >>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
        >>> mii = database.get_by_name("My Mii")
        >>> if mii:
        ...     print(mii.creator_name)
    """
    name_lower = name.lower()
    for mii in self._miis:
        if mii.name.lower() == name_lower:
            return mii
    return None

get_favorites()

Get all favorite Miis

Returns:

Type Description
List[Mii]

List of Miis marked as favorites

Examples:

>>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
>>> favorites = database.get_favorites()
>>> print(f"Found {len(favorites)} favorite Miis")
Source code in src/mii/database.py
def get_favorites(self) -> List[Mii]:
    """Get all favorite Miis

    Returns:
        List of Miis marked as favorites

    Examples:
        >>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
        >>> favorites = database.get_favorites()
        >>> print(f"Found {len(favorites)} favorite Miis")
    """
    return self.filter(lambda m: m.is_favorite)

options: show_root_heading: true show_root_toc_entry: true show_source: true

Mii

mii.models.Mii dataclass

Represents a single Mii with all its data

Source code in src/mii/models.py
@dataclass
class Mii:
    """Represents a single Mii with all its data"""

    raw_data: bytes  # Original Mii bytes (for writing back to disk)
    name: str
    creator_name: str
    mii_id: bytes
    is_girl: bool
    birth_month: Optional[int]
    birth_day: Optional[int]
    favorite_color_index: int
    favorite_color: str
    is_favorite: bool
    padding: int = 0  # Padding bytes to append when writing to disk

    @property
    def is_wii_mii(self) -> bool:
        """Determine if this Mii is from Wii (True) or 3DS/WiiU (False)"""
        file_size = len(self.raw_data)
        if file_size == 74:
            return True  # Wii Mii
        elif file_size == 92:
            return False  # 3DS/WiiU Mii
        else:
            raise ValueError(f"Mii format is unknown (size: {file_size})")

    def get_creation_seconds(self) -> int:
        """Extract timestamp seconds from Mii data"""
        multiplier = 4 if self.is_wii_mii else 2
        seek_pos = 0x18 if self.is_wii_mii else 0xC
        str_id = self.raw_data[seek_pos : seek_pos + 4].hex()
        int_id = int(str_id[1:], 16)
        return int_id * multiplier

    def get_creation_datetime(self) -> datetime:
        """Get creation datetime for this Mii

        Returns:
            Datetime object representing when the Mii was created

        Examples:
            >>> mii = database[0]
            >>> creation_time = mii.get_creation_datetime()
            >>> print(creation_time.strftime("%Y-%m-%d %H:%M:%S"))
        """
        seconds = self.get_creation_seconds()
        base_date = datetime(2006, 1, 1) if self.is_wii_mii else datetime(2010, 1, 1)
        shift = timedelta(seconds=seconds)
        return base_date + shift

    def get_birthday_string(self) -> str:
        """Get formatted birthday string

        Returns:
            Formatted birthday string (e.g., "1/15") or "Not set"

        Examples:
            >>> mii = database[0]
            >>> print(mii.get_birthday_string())
            "1/15"
        """
        if self.birth_month and self.birth_day:
            return f"{self.birth_month}/{self.birth_day}"
        return "Not set"

    def get_gender_string(self) -> str:
        """Get formatted gender string

        Returns:
            "Female" or "Male"

        Examples:
            >>> mii = database[0]
            >>> print(mii.get_gender_string())
            "Female"
        """
        return "Female" if self.is_girl else "Male"

    def to_bytes(self) -> bytes:
        """Returns raw_data with padding appended if needed"""
        if self.padding > 0:
            return self.raw_data + bytearray(self.padding)
        return self.raw_data

    def get_mii_id_hex(self) -> str:
        """Get Mii ID as uppercase hex string

        Returns:
            Mii ID as uppercase hexadecimal string

        Examples:
            >>> mii = database[0]
            >>> print(mii.get_mii_id_hex())
            "A1B2C3D4"
        """
        return self.mii_id.hex().upper()

    def export(self, path: Path) -> None:
        """Write this Mii to a file

        Args:
            path: Path where the Mii file should be written

        Examples:
            >>> mii = database[0]
            >>> mii.export(Path("./my_mii.mii"))
        """
        path.parent.mkdir(parents=True, exist_ok=True)
        with open(path, "wb") as f:
            f.write(self.to_bytes())

is_wii_mii property

Determine if this Mii is from Wii (True) or 3DS/WiiU (False)

export(path)

Write this Mii to a file

Parameters:

Name Type Description Default
path Path

Path where the Mii file should be written

required

Examples:

>>> mii = database[0]
>>> mii.export(Path("./my_mii.mii"))
Source code in src/mii/models.py
def export(self, path: Path) -> None:
    """Write this Mii to a file

    Args:
        path: Path where the Mii file should be written

    Examples:
        >>> mii = database[0]
        >>> mii.export(Path("./my_mii.mii"))
    """
    path.parent.mkdir(parents=True, exist_ok=True)
    with open(path, "wb") as f:
        f.write(self.to_bytes())

get_birthday_string()

Get formatted birthday string

Returns:

Type Description
str

Formatted birthday string (e.g., "1/15") or "Not set"

Examples:

>>> mii = database[0]
>>> print(mii.get_birthday_string())
"1/15"
Source code in src/mii/models.py
def get_birthday_string(self) -> str:
    """Get formatted birthday string

    Returns:
        Formatted birthday string (e.g., "1/15") or "Not set"

    Examples:
        >>> mii = database[0]
        >>> print(mii.get_birthday_string())
        "1/15"
    """
    if self.birth_month and self.birth_day:
        return f"{self.birth_month}/{self.birth_day}"
    return "Not set"

get_creation_datetime()

Get creation datetime for this Mii

Returns:

Type Description
datetime

Datetime object representing when the Mii was created

Examples:

>>> mii = database[0]
>>> creation_time = mii.get_creation_datetime()
>>> print(creation_time.strftime("%Y-%m-%d %H:%M:%S"))
Source code in src/mii/models.py
def get_creation_datetime(self) -> datetime:
    """Get creation datetime for this Mii

    Returns:
        Datetime object representing when the Mii was created

    Examples:
        >>> mii = database[0]
        >>> creation_time = mii.get_creation_datetime()
        >>> print(creation_time.strftime("%Y-%m-%d %H:%M:%S"))
    """
    seconds = self.get_creation_seconds()
    base_date = datetime(2006, 1, 1) if self.is_wii_mii else datetime(2010, 1, 1)
    shift = timedelta(seconds=seconds)
    return base_date + shift

get_creation_seconds()

Extract timestamp seconds from Mii data

Source code in src/mii/models.py
def get_creation_seconds(self) -> int:
    """Extract timestamp seconds from Mii data"""
    multiplier = 4 if self.is_wii_mii else 2
    seek_pos = 0x18 if self.is_wii_mii else 0xC
    str_id = self.raw_data[seek_pos : seek_pos + 4].hex()
    int_id = int(str_id[1:], 16)
    return int_id * multiplier

get_gender_string()

Get formatted gender string

Returns:

Type Description
str

"Female" or "Male"

Examples:

>>> mii = database[0]
>>> print(mii.get_gender_string())
"Female"
Source code in src/mii/models.py
def get_gender_string(self) -> str:
    """Get formatted gender string

    Returns:
        "Female" or "Male"

    Examples:
        >>> mii = database[0]
        >>> print(mii.get_gender_string())
        "Female"
    """
    return "Female" if self.is_girl else "Male"

get_mii_id_hex()

Get Mii ID as uppercase hex string

Returns:

Type Description
str

Mii ID as uppercase hexadecimal string

Examples:

>>> mii = database[0]
>>> print(mii.get_mii_id_hex())
"A1B2C3D4"
Source code in src/mii/models.py
def get_mii_id_hex(self) -> str:
    """Get Mii ID as uppercase hex string

    Returns:
        Mii ID as uppercase hexadecimal string

    Examples:
        >>> mii = database[0]
        >>> print(mii.get_mii_id_hex())
        "A1B2C3D4"
    """
    return self.mii_id.hex().upper()

to_bytes()

Returns raw_data with padding appended if needed

Source code in src/mii/models.py
def to_bytes(self) -> bytes:
    """Returns raw_data with padding appended if needed"""
    if self.padding > 0:
        return self.raw_data + bytearray(self.padding)
    return self.raw_data

options: show_root_heading: true show_root_toc_entry: true show_source: true

MiiParser

mii.parser.MiiParser

Parses raw Mii bytes into Mii dataclass instances

Source code in src/mii/parser.py
class MiiParser:
    """Parses raw Mii bytes into Mii dataclass instances"""

    COLORS = [
        "Red",
        "Orange",
        "Yellow",
        "Green",
        "DarkGreen",
        "Blue",
        "LightBlue",
        "Pink",
        "Purple",
        "Brown",
        "White",
        "Black",
    ]

    @classmethod
    def _read_string(cls, data: bytes, offset: int, length: int) -> str:
        """Read UTF-16BE string from the data"""
        string_data = data[offset : offset + length]
        # Find the first null terminator (0x0000 in UTF-16BE)
        null_pos = string_data.find(b"\x00\x00")
        if null_pos != -1:
            # Ensure we align to 2-byte boundaries for UTF-16
            if null_pos % 2 != 0:
                null_pos -= 1
            string_data = string_data[: null_pos + 2]

        # Convert from UTF-16BE and remove null terminators
        return string_data.decode("utf-16be").rstrip("\x00")

    @classmethod
    def _read_mii_name(cls, data: bytes) -> str:
        """Read Mii name starting at offset 2"""
        return cls._read_string(data, 2, 20)

    @classmethod
    def _read_creator_name(cls, data: bytes) -> str:
        """Read creator name starting at offset 54"""
        return cls._read_string(data, 54, 20)

    @classmethod
    def _read_mii_metadata(cls, data: bytes) -> tuple:
        """Read and parse Mii metadata from first 2 bytes

        Returns:
            Tuple of (is_girl, birth_month, birth_day, favorite_color_index, is_favorite)
        """
        # Read first 2 bytes and convert to binary string
        metadata_bytes = data[0:2]
        binary_str = "".join(format(b, "08b") for b in metadata_bytes)

        # Extract metadata fields
        is_girl = int(binary_str[1], 2)
        birth_month = int(binary_str[2:6], 2)
        birth_day = int(binary_str[6:11], 2)
        favorite_color_index = int(binary_str[11:15], 2)
        is_favorite = int(binary_str[15], 2)

        return (is_girl, birth_month, birth_day, favorite_color_index, is_favorite)

    @classmethod
    def _read_mii_id(cls, data: bytes) -> bytes:
        """Read 4-byte Mii ID starting at offset 24"""
        return data[24:28]

    @classmethod
    def _get_color_name(cls, color_index: int) -> str:
        """Get color name from color index"""
        if 0 <= color_index < len(cls.COLORS):
            return cls.COLORS[color_index]
        return f"Unknown ({color_index})"

    @classmethod
    def parse(cls, data: bytes, padding: int = 0) -> Mii:
        """Parse raw Mii bytes into a Mii dataclass instance

        Args:
            data: Raw Mii bytes
            padding: Number of padding bytes to append when writing to disk

        Returns:
            Mii dataclass instance

        Examples:
            >>> with open("WII_PL00000.mii", "rb") as f:
            ...     mii_data = f.read()
            >>> mii = MiiParser.parse(mii_data)
            >>> print(mii.name)
        """
        mii_name = cls._read_mii_name(data)
        creator_name = cls._read_creator_name(data)
        metadata = cls._read_mii_metadata(data)
        mii_id = cls._read_mii_id(data)
        color_name = cls._get_color_name(metadata[3])

        return Mii(
            raw_data=data,
            name=mii_name or "Unnamed",
            creator_name=creator_name or "Unknown",
            mii_id=mii_id,
            is_girl=bool(metadata[0]),
            birth_month=metadata[1] if metadata[1] else None,
            birth_day=metadata[2] if metadata[2] else None,
            favorite_color_index=metadata[3],
            favorite_color=color_name,
            is_favorite=bool(metadata[4]),
            padding=padding,
        )

parse(data, padding=0) classmethod

Parse raw Mii bytes into a Mii dataclass instance

Parameters:

Name Type Description Default
data bytes

Raw Mii bytes

required
padding int

Number of padding bytes to append when writing to disk

0

Returns:

Type Description
Mii

Mii dataclass instance

Examples:

>>> with open("WII_PL00000.mii", "rb") as f:
...     mii_data = f.read()
>>> mii = MiiParser.parse(mii_data)
>>> print(mii.name)
Source code in src/mii/parser.py
@classmethod
def parse(cls, data: bytes, padding: int = 0) -> Mii:
    """Parse raw Mii bytes into a Mii dataclass instance

    Args:
        data: Raw Mii bytes
        padding: Number of padding bytes to append when writing to disk

    Returns:
        Mii dataclass instance

    Examples:
        >>> with open("WII_PL00000.mii", "rb") as f:
        ...     mii_data = f.read()
        >>> mii = MiiParser.parse(mii_data)
        >>> print(mii.name)
    """
    mii_name = cls._read_mii_name(data)
    creator_name = cls._read_creator_name(data)
    metadata = cls._read_mii_metadata(data)
    mii_id = cls._read_mii_id(data)
    color_name = cls._get_color_name(metadata[3])

    return Mii(
        raw_data=data,
        name=mii_name or "Unnamed",
        creator_name=creator_name or "Unknown",
        mii_id=mii_id,
        is_girl=bool(metadata[0]),
        birth_month=metadata[1] if metadata[1] else None,
        birth_day=metadata[2] if metadata[2] else None,
        favorite_color_index=metadata[3],
        favorite_color=color_name,
        is_favorite=bool(metadata[4]),
        padding=padding,
    )

options: show_root_heading: true show_root_toc_entry: true show_source: true

MiiType

mii.types.MiiType

Bases: Enum

Enum describing different Mii database types with their configurations

Examples:

>>> from pathlib import Path
>>> from mii import MiiDatabase, MiiType
>>> # Load Wii Plaza database
>>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
>>> # Access type properties
>>> print(MiiType.WII_PLAZA.SOURCE)
>>> print(MiiType.WII_PLAZA.display_name)
Source code in src/mii/types.py
class MiiType(Enum):
    """Enum describing different Mii database types with their configurations

    Examples:
        >>> from pathlib import Path
        >>> from mii import MiiDatabase, MiiType
        >>> # Load Wii Plaza database
        >>> database = MiiDatabase(Path("RFL_DB.dat"), MiiType.WII_PLAZA)
        >>> # Access type properties
        >>> print(MiiType.WII_PLAZA.SOURCE)
        >>> print(MiiType.WII_PLAZA.display_name)
    """

    WII_PLAZA = ("RFL_DB.dat", 0x4, 74, 0, 100, "WII_PL")
    WII_PARADE = ("RFL_DB.dat", 0x1F1E0, 64, 10, 10_000, "WII_PA")
    WIIU_MAKER = ("FFL_ODB.dat", 0x8, 92, 0, 3_000, "WIIU_MA")
    _3DS_MAKER = ("CFL_DB.dat", 0x8, 92, 0, 100, "3DS_MA")

    def __init__(
        self, source: str, offset: int, size: int, padding: int, limit: int, prefix: str
    ):
        self.SOURCE = source
        self.OFFSET = offset
        self.SIZE = size
        self.PADDING = padding
        self.LIMIT = limit
        self.PREFIX = prefix

    @property
    def display_name(self) -> str:
        """Return a human-readable name for the Mii type"""
        return self.name.lower().replace("_", "-")

display_name property

Return a human-readable name for the Mii type

options: show_root_heading: true show_root_toc_entry: true show_source: true

Exceptions

MiiDatabaseError

mii.database.MiiDatabaseError

Bases: Exception

Exception raised during Mii database operations

Source code in src/mii/database.py
class MiiDatabaseError(Exception):
    """Exception raised during Mii database operations"""

    pass

options: show_root_heading: true show_root_toc_entry: true show_source: true