Skip to content

Add string overrides support to modpkg format #84

@Crauzer

Description

@Crauzer

Overview

Add support for string overrides to the modpkg format, bringing feature parity with the Fantome format. This will allow modpkg mods to customize in-game text strings without shipping the entire lol.stringtable file.

Background

The Fantome format currently supports string overrides per layer (DESIGN.md). The modpkg format should support the same functionality to enable text customization in mods.

Current State

The ModpkgLayerMetadata struct in crates/ltk_modpkg/src/metadata.rs:75-86 currently only has:

  • name: String
  • priority: i32
  • description: Option<String>

Proposed Addition

Add a string_overrides field to match the Fantome format:

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct ModpkgLayerMetadata {
    pub name: String,
    pub priority: i32,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    // NEW FIELD
    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
    pub string_overrides: HashMap<String, String>,
}

Requirements

Core Implementation

  • Add string_overrides: HashMap<String, String> to ModpkgLayerMetadata
  • Update schema version from 1 to 2 in ModpkgMetadata
  • Ensure backward compatibility (schema v1 should still load without string_overrides)
  • Add tests for serialization/deserialization with string overrides
  • Update CHANGELOG.md with the breaking change

Format Specification

  • String overrides should map field names (from lol.stringtable) to new string values
  • Empty string_overrides map should be omitted from serialization (to keep files small)
  • Field names reference data/menu/en_us/lol.stringtable from Localized/Global.{locale}.wad.client

Builder Support

  • Update modpkg builder to support adding string overrides to layers
  • Ensure project conversion from Fantome preserves string overrides

Technical Notes

  • String overrides format should match Fantome's implementation for consistency
  • Full list of valid field names are in data/menu/en_us/lol.stringtable
  • cdragon-rst is the tool for working with RST hashtables (stringtable format)
  • Mods ship only the overrides, not the full stringtable, to stay up-to-date with game changes

Acceptance Criteria

  • ModpkgLayerMetadata has string_overrides field
  • Schema version bumped to 2
  • Backward compatibility maintained (v1 metadata still loads)
  • Roundtrip serialization tests pass with string overrides
  • Builder API supports setting string overrides
  • Documentation updated with example usage

Dependencies

This is a prerequisite for issue #83 (UI flow for string overrides in workshop)

Related

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions