mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
Fix loc packer to use int based string ids (static mode)
This commit is contained in:
parent
8ed5a8440c
commit
a624c136fb
|
|
@ -113,7 +113,7 @@ colour_table = custom_target('Minecraft.Client_Colour_Table',
|
||||||
|
|
||||||
movies_path = meson.current_source_dir() / 'Build/Assets/movies'
|
movies_path = meson.current_source_dir() / 'Build/Assets/movies'
|
||||||
archive_sources = [
|
archive_sources = [
|
||||||
meson.current_source_dir() / 'Platform/Windows64Media/Media/languages.loc',
|
localisation, #meson.current_source_dir() / 'Platform/Windows64Media/Media/languages.loc',
|
||||||
colour_table,
|
colour_table,
|
||||||
asset_dir / 'splashes.txt',
|
asset_dir / 'splashes.txt',
|
||||||
asset_dir / 'graphics\SaveChest.png',
|
asset_dir / 'graphics\SaveChest.png',
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,9 @@ for lang_file_path in lang_file_paths:
|
||||||
print(f"Processed {len(langs)} languages")
|
print(f"Processed {len(langs)} languages")
|
||||||
|
|
||||||
# Write loc file
|
# Write loc file
|
||||||
# TODO: allow switching version and handle actually writing those versions
|
|
||||||
TARGET_LOC_VERSION = 0
|
TARGET_LOC_VERSION = 0
|
||||||
TARGET_LANG_VERSION = 0
|
TARGET_LANG_VERSION = 1
|
||||||
|
TARGET_LANG_STATIC = True
|
||||||
with open(output_file_path, "wb") as loc_file:
|
with open(output_file_path, "wb") as loc_file:
|
||||||
# Write header
|
# Write header
|
||||||
pack_stream(">2I", loc_file,
|
pack_stream(">2I", loc_file,
|
||||||
|
|
@ -93,13 +93,19 @@ with open(output_file_path, "wb") as loc_file:
|
||||||
|
|
||||||
# Write header
|
# Write header
|
||||||
pack_stream(">I", lang_stream, TARGET_LANG_VERSION) # version
|
pack_stream(">I", lang_stream, TARGET_LANG_VERSION) # version
|
||||||
|
if TARGET_LANG_VERSION > 0:
|
||||||
|
pack_stream("?", lang_stream, TARGET_LANG_STATIC)
|
||||||
write_string(lang_name, lang_stream) # lang name
|
write_string(lang_name, lang_stream) # lang name
|
||||||
pack_stream(">I", lang_stream, len(strings)) # string count
|
pack_stream(">I", lang_stream, len(strings)) # string count
|
||||||
|
|
||||||
# Write strings
|
# Write strings
|
||||||
for string_name, string in strings.items():
|
if TARGET_LANG_STATIC:
|
||||||
write_string(string_name, lang_stream)
|
for string in strings.values():
|
||||||
write_string(string, lang_stream)
|
write_string(string, lang_stream)
|
||||||
|
else:
|
||||||
|
for string_name, string in strings.items():
|
||||||
|
write_string(string_name, lang_stream)
|
||||||
|
write_string(string, lang_stream)
|
||||||
|
|
||||||
lang_sizes[lang_name] = lang_stream.tell() - old_stream_pos
|
lang_sizes[lang_name] = lang_stream.tell() - old_stream_pos
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue