Pular para o conteúdo

Overview

Este conteúdo não está disponível em sua língua ainda.

Short for libMessageStudio, LMS is a proprietary tool utilized by Nintendo developers to store localized text. The following page describes the general structure that all LMS file formats follow.

OffsetTypeDescription
0x0MAGICMagic number
0x8u16BOM
0xAu16Unused
0xCu8Message encoding (0=UTF-8, 1=UTF-16, 2=UTF-32)
0xDu8Version number
0xEu16Number of blocks
0x10u16Unused
0x12u32Filesize
0x16padding [10]Padding
OffsetTypeDescription
0x0MAGICBlock Magic
0x4u32Block size (excludes header)
0x8padding [8]Padding
0x10-Block data

Labels in LMS file formats are looked up with a hash table. The amount of slots are stay consistent with the format itself no matter the amount of items there may be.

FormatSlot Count
MSBT101
MSBP29
MSBF59

The following hash algorithm is used:

def calculate_hash(label: str, slot_count: int):
hash = 0
for character in label:
hash = hash * 0x492 + ord(character)
return (hash & 0xFFFFFFFF) % slot_count
OffsetTypeDescription
0x0u32Slot count
0x4Hash slots [slotCount]Array of hash slots
LabelsLabel strings
OffsetTypeDescription
0x0u32Number of labels
0x4u32Offset to labels
OffsetTypeDescription
0x0u8Label length
0x1labelLengthLabel string
u32Item index