Skip to content

Commit 3e5c698

Browse files
committed
Support for adding in source strings
Documented the various expected formats for key strings, implementing them by letting you import your HEK source string files and applying some fixups to match MCC.
1 parent 671df49 commit 3e5c698

File tree

7 files changed

+582
-25
lines changed

7 files changed

+582
-25
lines changed

MCCLocalizationEditor/Dialogs/LocaleHelp.xaml

Lines changed: 129 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,135 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:MCCLocalizationEditor.Dialogs"
77
mc:Ignorable="d" WindowStyle="ToolWindow" Icon="../icon.ico"
8-
Title="About Localization Files" Height="400" Width="600">
8+
Title="About Localization Files" Height="420" Width="650">
99
<Grid Margin="4">
10-
<TextBlock TextWrapping="Wrap">
11-
Localization files aren't the most modification-friendly files. Key strings are stored as CRC32MPEG hashes instead so they aren't easily searchable without the original key.
12-
These keys are referenced by the game by prefixing a $ to the string. If there is no match the key is displayed instead. (The $ is not hashed)
13-
<LineBreak/>
14-
<LineBreak/>
15-
<Run TextDecorations="Underline" FontStyle="Italic">The bin files themselves store an all-caps hash of the filename, so when saving a bin with this tool, you should use the intended name and avoid renaming past that point. A bad hash will hang the game.</Run>
16-
<LineBreak/>
17-
<LineBreak/>
18-
In recent MCC builds game-specific bin files were introduced that override the localization stored in the cache files. String IDs become the key string and are hashed all the same.
19-
If a string is missing from a bin file, then the engine seems to fall back to the cache file's string.
20-
<LineBreak/>
21-
<LineBreak/>
22-
Always back up your files as any changes you make will flag the anticheat.
23-
<LineBreak/>
24-
<LineBreak/>
25-
There is also limited HTML-like markup support available in these files; most work as expected but image source should use <Run FontStyle="Italic">img://IMAGE_NAME</Run> where <Run FontStyle="Italic">IMAGE_NAME</Run>
26-
refers to the name of an image within a texture pack.
27-
<LineBreak/>
28-
<LineBreak/>
29-
However, not all text fields will actually resolve your markup, instead displaying the code as plain text.
30-
</TextBlock>
10+
<TabControl>
11+
<TabItem Header="General">
12+
<RichTextBox ScrollViewer.VerticalScrollBarVisibility="Auto" IsReadOnly="True">
13+
<RichTextBox.Document>
14+
<FlowDocument>
15+
<Paragraph>
16+
Localization files aren't the most modification-friendly files. Key strings are hashed as upper case with CRC32MPEG and stored using the hash so they aren't easily searchable without the original key.
17+
These keys are referenced by the game by prefixing a $ to the string. If there is no match the key is displayed instead. (The $ is not hashed)
18+
<LineBreak/>
19+
<LineBreak/>
20+
<Run TextDecorations="Underline" FontStyle="Italic">The bin files themselves store a hash of the filename like a key string, so when saving a bin with this tool, you should use the intended name and avoid renaming past that point. A bad hash will hang the game.</Run>
21+
<LineBreak/>
22+
<LineBreak/>
23+
These files were limited to just MCC's UI up until 2022 when game-specific bin files were introduced that override the localization stored in the cache files. There is a specific format to key strings. (See the Keys tab).
24+
If a string is missing from a bin file, then the engine should fall back to the cache file's string.
25+
<LineBreak/>
26+
<LineBreak/>
27+
However, because strings were externalized there may be string differences from the cache files themselves. This is especially the case for Halo 1, which uses CEA's own external set with various changes made.
28+
<LineBreak/>
29+
<LineBreak/>
30+
Modifications to the shipped bins WILL flag the anticheat so if you should keep a backup.
31+
<LineBreak/>
32+
<LineBreak/>
33+
As of 2023, it is now possible to include bins with your Steam Workshop mods, just put them in folders mirroring MCC's install, so
34+
<Run FontWeight="Medium">[mod_folder]\Data\UI\Localization\[bin file]</Run>. This will override MCC's copy when playing your mod.
35+
<LineBreak/>
36+
<LineBreak/>
37+
There is also limited HTML-like markup support available in these files; most work as expected but image source should use
38+
<Run FontStyle="Italic">img://IMAGE_NAME</Run> where
39+
<Run FontStyle="Italic">IMAGE_NAME</Run>
40+
refers to the name of an image within a texture pack.
41+
<LineBreak/>
42+
<LineBreak/>
43+
However, not all text fields will actually resolve your markup, instead displaying the code as plain text.
44+
</Paragraph>
45+
</FlowDocument>
46+
</RichTextBox.Document>
47+
</RichTextBox>
48+
</TabItem>
49+
<TabItem Header="Keys" ScrollViewer.VerticalScrollBarVisibility="Auto">
50+
<RichTextBox ScrollViewer.VerticalScrollBarVisibility="Auto" IsReadOnly="True">
51+
<RichTextBox.Document>
52+
<FlowDocument>
53+
<Paragraph>
54+
The keys used for each game use a particular format. Halo 2 and later are pretty straightforward but Halo 1 needs some explaining. Any instance of "|n" needs to be replaced with a real newline.
55+
<LineBreak/>
56+
<LineBreak/>
57+
<Run FontWeight="Bold" FontSize="16">Halo 1:</Run>
58+
<LineBreak/>
59+
During the development of Halo CE Anniversary, the game's strings were pulled from the tags for Saber's own engine. This process used somewhat hardcoded IDs that MCC would later adapt directly.
60+
<LineBreak/>
61+
<Run FontWeight="Bold">HUD Messages:</Run>
62+
<LineBreak/>
63+
For HUD messages, strings are stored split into elements as they are when added to a cache file. Only text elements are included, with variables being skipped.
64+
Then there is also an extra blank element at the end if it ended on a variable element. The quirks of Halo 1 should be solved automatically by using the Import Source option.
65+
<LineBreak/>
66+
<LineBreak/>
67+
The path
68+
<Run FontWeight="Medium">ui\hud\hud messages</Run> resolves to
69+
<Run FontWeight="Medium">HUD_GLOBALS_[message index]_[element index]</Run> , ex
70+
<Run FontWeight="Medium">HUD_GLOBALS_0_2</Run> (0_1 contained %action and was skipped).
71+
<LineBreak/>
72+
<LineBreak/>
73+
In these messages, enter_vehicle is a special case where the string was copied 3 times, and "%custom-1" is replaced with a seat type These 3 all occupy element 0 but the key is appended with the seat, ex
74+
<Run FontWeight="Medium">HUD_GLOBALS_6_0_DRIVER</Run>. Then, the split versions are stored in elements 10, 20, and 30 ex
75+
<Run FontWeight="Medium">HUD_GLOBALS_6_10</Run>.
76+
<LineBreak/>
77+
<LineBreak/>
78+
The path
79+
<Run FontWeight="Medium">levels\[scenario]\hud messages</Run> resolves to
80+
<Run FontWeight="Medium">[scenario]_HUD_MESSAGES_[message index]_[element index]</Run> , ex
81+
<Run FontWeight="Medium">A10_HUD_MESSAGES_4_2</Run> .
82+
<LineBreak/>
83+
<LineBreak/>
84+
<Run FontWeight="Bold">Unicode Lists:</Run>
85+
<LineBreak/>
86+
For unicode lists, things are also somewhat hardcoded.
87+
<LineBreak/>
88+
<LineBreak/>
89+
The path "
90+
<Run FontWeight="Medium">levels\[scenario]\[name]</Run> resolves to
91+
<Run FontWeight="Medium">[scenario]_[name]_[message index]</Run> , ex
92+
<Run FontWeight="Medium">A50_CUSTOM_OBJECT_NAMES_1</Run> .
93+
<LineBreak/>
94+
<LineBreak/>
95+
The path
96+
<Run FontWeight="Medium">ui\hud\[name]</Run> resolves to
97+
<Run FontWeight="Medium">UH_[name]_[message index]</Run> , ex
98+
<Run FontWeight="Medium">UH_HUD_ICON_MESSAGES_3</Run> .
99+
<LineBreak/>
100+
<LineBreak/>
101+
The path
102+
<Run FontWeight="Medium">ui\[name]</Run> resolves to
103+
<Run FontWeight="Medium">U_[name]_[message index]</Run>, ex
104+
<Run FontWeight="Medium">U_MULTIPLAYER_GAME_TEXT_5</Run>.
105+
<LineBreak/>
106+
<LineBreak/>
107+
The path
108+
<Run FontWeight="Medium">ui\shell\solo_game\player_help\[name]</Run> resolves to
109+
<Run FontWeight="Medium">USSP_[name]_[message index]</Run> , ex
110+
<Run FontWeight="Medium">USSP_PLAYER_HELP_TEXT_A10_2</Run> .
111+
<LineBreak/>
112+
<LineBreak/>
113+
Other lists might not be supported.
114+
<LineBreak/>
115+
<LineBreak/>
116+
<Run FontWeight="Bold" FontSize="16">Other:</Run>
117+
<LineBreak/>
118+
<Run FontWeight="Bold">Multilingual Unicode String Lists:</Run>
119+
<LineBreak/>
120+
For later titles' multilingual unicode string lists, they all use the format
121+
<Run FontWeight="Medium">[tag_path]_[string_id]</Run>, ex
122+
<Run FontWeight="Medium">UI\HUD\HUD_MESSAGES_BR_PICKUP</Run> .
123+
<LineBreak/>
124+
<LineBreak/>
125+
<Run FontWeight="Bold">Subtitles:</Run>
126+
<LineBreak/>
127+
For subtitles, all titles use the format
128+
<Run FontWeight="Medium">[tag_path][optional: permutation_index]</Run> , ex
129+
<Run FontWeight="Medium">SOUND\DIALOG\COMBAT\FLOOD_GM3\04_SEARCH\PRST</Run> for all permutations (officially these are left blank), or
130+
<Run FontWeight="Medium">SOUND\DIALOG\COMBAT\FLOOD_GM3\04_SEARCH\PRST1</Run> for the first permutation of the sound.
131+
</Paragraph>
132+
</FlowDocument>
133+
</RichTextBox.Document>
134+
</RichTextBox>
135+
</TabItem>
136+
</TabControl>
137+
31138
</Grid>
32139
</Window>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<Window x:Class="MCCLocalizationEditor.Dialogs.SourceDragDrop"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:MCCLocalizationEditor.Dialogs"
7+
mc:Ignorable="d"
8+
x:Name="window"
9+
Title="Load Source Strings" Height="450" Width="700">
10+
<Grid Margin="4" AllowDrop="True" Drop="Grid_Drop">
11+
<Grid.RowDefinitions>
12+
<RowDefinition Height="Auto"/>
13+
<RowDefinition Height="Auto"/>
14+
<RowDefinition Height="*"/>
15+
</Grid.RowDefinitions>
16+
17+
<TextBlock TextWrapping="Wrap">
18+
You should have the original bin file for your game opened. To add your source strings, select the intended title from the dropdown below then drag and drop your files to this window. It is recommended that you only include files that you've modified.
19+
<LineBreak/>
20+
<LineBreak/>
21+
Clicking "Read Files" will parse and add them to the current collection. This process will overwrite any existing strings that use the same keys.
22+
<LineBreak/>
23+
<LineBreak/>
24+
<Run FontWeight="Bold" FontStyle="Italic">It is important that you are dragging files from within your Halo Editing Kit's data (or data_sp, etc) folder as the relative path is needed to create the proper keys.</Run> For info on how these keys are set up, check the "About Locale Files" button on the main window.
25+
<LineBreak/>
26+
</TextBlock>
27+
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0,4,0,0">
28+
<TextBlock Text="Game:" VerticalAlignment="Center"/>
29+
<ComboBox x:Name="cmbGame" Width="150" Margin="4,0,0,0" SelectedIndex="0">
30+
<ComboBoxItem Content="Please Select"/>
31+
<ComboBoxItem Content="Halo 1"/>
32+
<ComboBoxItem Content="Everything Else"/>
33+
</ComboBox>
34+
<Button Content="Read Files" Width="200" Margin="16,0,0,0" Click="Button_Click" />
35+
</StackPanel>
36+
<ListBox x:Name="fileList" Grid.Row="2" Margin="0,4,0,0" />
37+
</Grid>
38+
</Window>

0 commit comments

Comments
 (0)