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)Custom configs can be created by utilizing a MSBP object.
from lms.project.msbtio import read_msbp_path
from LMS.TitleConfig.Config import TitleConfig
msbp = read_msbp_path("path/to/msbp")
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.msbtio import write_msbt
from lms.titleconfig.configimport 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.msbtio import read_msbt_path
from lms.titleconfig.configimport TitleConfig
tag_config = TitleConfig.load_file("Game.yaml")
msbt = read_msbt("path/to/msbt", tag_config=tag_config)Tag reading errors can be silenced through a TagConfig.
tag_config = TitleConfig.load_file("Game.yaml")
tag_config.silence_reading_errors = True Tags that have had their errors silenced will have an exclamation mark prefixing the group id to indicate it was silenced.
Every single game that utilizes MSBT defines a tag group called System. These include the following set of tags:
RubyFontSizeColorPageBreak-
Reference(switch)
These are not by default read by PylibMS. You may create a custom configuration for your game (if it is not a preset already) and add these definitions to them.
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
- VoiceAttribute definitions and parameter tag definitions are defined by the following structure.
- name: ''
description: ''
datatype: # LMS_Datatype Name or alias
list_items: # Only if type LISTList of datatype names and aliases are located at the enum LMS_Datatype.