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: tuple of all the attribute configs. -
tag_config: The tag config object for the title. -
node_config: The node configuration for this title.
TitleConfigs can be loaded in several ways, each of them return a TitleConfig object.
# From a preset
TitleConfig.download_preset("Tomodachi Life NA-EU")Downloads a preset into {cwd}/presets folder, use TitleConfig.load_file to load the preset.
Full list of valid Presets. Make an issue with a Preset file if you want to officially add one to the library.
To check if a preset has an update, run TitleConfig.preset_has_update.
# From file path
config = TitleConfig.load_file("Configs/Title.yaml")For custom loading, the content can be directly specified using a string or dictionary.
config = TitleConfig.load_config(content)Custom configs can be created by utilizing a MSBP object.
from lms.project.msbpread 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.get_attribute_config("Main")
with open(path, "rb") as f:
msbt = read_msbt(f, attribute_config=main_attrs)Tag configs describe the structure of a specific tag, 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
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 if you would like to read the System tags.
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:
list_items: list_items is only valid if the datatype is LIST.
List of datatype names and aliases are located at LMS_Datatype.
Node configs describe the structure of a specific node, allowing them to be decoded. Example usage:
from lms.flowchart.msbfio import read_msbf_path
from lms.titleconfig.configimport TitleConfig
node_config = TitleConfig.load_file("Game.yaml").node_config
msbf = read_msbf_path("path/to/msbf", config=node_config)Node definitions are grouped into branch or event nodes, which must be defined under the node definitions key.
node_definitions:
branch:
...
event:
...A definition follows the format:
- id: 0
name: EvaluateExpression
parameter_type: string
parameters:
- name: expExample p8_8_16 definition
- id: 4
name: MoveCharacterToCoords
parameter_type: p8_8_16
parameters:
- name: x
- name: y
- name: zThe id is the condition_id or action_id of the node. Access that attribute directly through the node object. The parameter type must also match one of its node. If needed, you may have multiple definitions assigned to one id if they have varying parameter types too.
Parameter type must follow the table below:
| Pararmeter Type | Alias | Description |
|---|---|---|
PARAM_32_0 |
p32_0 |
32 bit value. |
PARAM_16_16 |
p16_16 |
Two 16 bit values. |
PARAM_8_8_16 |
p8_8_16 |
Three values (two 8 bits, then 16 bit) |
PARAM_16_8_8 |
p16_8_8 |
Three values, different order. |
PARAM_8_8_8_8 |
p8_8_8_8 |
Four values. |
STRING |
str |
String value. |
PARAM_32_1 |
p32_1 |
32 bit alternate value. |
By default, PyLibMS interprets parameter values as signed integers, this can be changed if you believe it is wrong by specifying a datatype in the parameter field. Ensure list_items is defined if the LIST datatype is being used.
- id: 1
name: SetupPrompt
parameter_type: PARAM_32_0
parameters:
- name: val
datatype: uint32
description: ''