Repository navigation
TitleConfig
TitleConfigs are configuration file used to alter how attributes, tags, and nodes are read. They come in the form of yaml files. They follow the structure of:
tag_definitions:
- ...
attribute_definitions:
- ...
node_definitions:
- ... -
attribute_configs: Dictionary of all the attribute configs mapped to their name. -
tag_config: The tag config object for the title.
TitleConfigs can be loaded in several ways, each of them return a TitleConfig object.
# From a preset
config = TitleConfig.load_preset("Tomodachi Life")Full list of valid Presets.
# From file path
config = TitleConfig.load_file("Configs/Title.yaml")For custom loading, the content can be directly specified using a string or dictionary.
content: str | dict
config = TitleConfig.load_config(content)Configs can be created by utilizing a MSBP object.
from LMS.Project.MSBPRead import read_msbp
from LMS.TitleConfig.Config import TitleConfig
with open(path, "rb") as f:
msbp = read_msbp(f)
TitleConfig.generate_file("Game.yaml", msbp)Attribute configs describe the structure of each attribute entry so that they are able to be fully decoded. There may be multiple for one game. Here is an example format for a singular entry.
name: Song
description: The attribute entries for all song MSBTs.
definitions:
... Definitions follow the structure of a ValueDefinition
The attribute is accessed by the name, and can be passed into read_msbt when reading.
from LMS.Message.MSBTStream import read_msbt
from LMS.TitleConfig.Config import TitleConfig
game_config = TitleConfig.load_file("Game.yaml")
main_attrs = game_config.attribute_configs["Main"]
with open(path, "rb") as f:
msbp = read_msbt(f, attribute_config=main_attrs)Tag configs describe the structure of a specific, allowing them to be decoded. Example usage:
from LMS.Message.MSBTStream import read_msbt
from LMS.TitleConfig.Config import TitleConfig
tag_config = TitleConfig.load_file("Game.yaml")
with open(path, "rb") as f:
msbp = read_msbt(f, tag_config=tag_config)To define a Tag first its Group must be defined at the top of the tag_definitions key.
tag_definitions:
groups:
1: Mii
2: MiiTalk
3: Date
4: ReferenceTo define a tag, the group index and tag index need to be specified. These can be found from their encoded representations.
- name: Mother
group_index: 2 # -> MiiTalk
tag_index: 11
description: ''
parameters: Parameter definitions follow the structure of a ValueDefinition
If the tag has parameters but the definitions for them are omitted, encoded tags will change from [group_index:tag_index] format to [group_name:tag_name] format. The parameters will remain encoded however.
Example full definition
- name: N_Year
group_index: 3 # -> Date
tag_index: 0 # First tag in the group
description: ''
parameters: # Parameter list
- name: buffer
description: ''
datatype: uint8
- name: zero
description: ''
datatype: list
list_items:
- 'False'
- 'True'
- name: format
description: ''
datatype: list
list_items:
- YYYY
- YY
- name: type
description: ''
datatype: list
list_items:
- Text
- VoiceThis converts [8:1 04-00-4D-00-72-00-08-00-4D-00-69-00-73-00-73-00] to [Gender:MyMii male="Mr" female="Miss"].
Attribute definitions and parameter tag definitions are defined by the following structure.
- name: ''
description: ''
datatype: # Valid LMS_Datatype name
list_items: # Only if type LISTThe datatype must be the name of a LMS_Datatype.