mirror of
https://github.com/qwerfd2/Groove_Coaster_2_Server.git
synced 2025-12-22 11:40:19 +00:00
toolset
This commit is contained in:
25
various-tools/sysmes/reader.py
Normal file
25
various-tools/sysmes/reader.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import struct
|
||||||
|
import json
|
||||||
|
|
||||||
|
def unpack_sysmes(filename, output_json):
|
||||||
|
with open(filename, 'rb') as f:
|
||||||
|
num_elements = struct.unpack('>H', f.read(2))[0] - 1
|
||||||
|
|
||||||
|
f.read(2)
|
||||||
|
|
||||||
|
strings = []
|
||||||
|
for _ in range(num_elements):
|
||||||
|
str_length = struct.unpack('>H', f.read(2))[0]
|
||||||
|
|
||||||
|
string_data = f.read(str_length)
|
||||||
|
decoded_string = string_data.decode('utf-8', errors='replace')
|
||||||
|
print(decoded_string)
|
||||||
|
strings.append(decoded_string)
|
||||||
|
|
||||||
|
with open(output_json, 'w', encoding='utf-8') as json_file:
|
||||||
|
json.dump(strings, json_file, ensure_ascii=False, indent=4)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
filename = "sysmes_it.dat"
|
||||||
|
output_json = "sysmes_it.json"
|
||||||
|
unpack_sysmes(filename, output_json)
|
||||||
7
various-tools/sysmes/readme.txt
Normal file
7
various-tools/sysmes/readme.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
sysmes.dat resides in the obb/ipa package and contains the game's localization strings.
|
||||||
|
|
||||||
|
reader unpacks one file from dat to json.
|
||||||
|
|
||||||
|
writer packs all 4 json files to 4 dat files.
|
||||||
|
|
||||||
|
Please be mindful of this.
|
||||||
44
various-tools/sysmes/writer.py
Normal file
44
various-tools/sysmes/writer.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import struct
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
FILES = {
|
||||||
|
"sysmes.json": "sysmes.dat",
|
||||||
|
"sysmes_en.json": "sysmes_en.dat",
|
||||||
|
"sysmes_fr.json": "sysmes_fr.dat",
|
||||||
|
"sysmes_it.json": "sysmes_it.dat"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Bodge - Not sure what tf is happening for the last string
|
||||||
|
APPEND_BYTES = {
|
||||||
|
"sysmes.json": "",
|
||||||
|
"sysmes_en.json": "AF E3 81 A7 E3 81 8D E3 81 BE E3 81 9B E3 82 93 E3 80 82 0A E3 82 A2 E3 82 AB E3 82 A6 E3 83 B3 E3 83 88 E3 82 92 E5 89 8A E9 99 A4 E3 81 97 E3 81 BE E3 81 99 E3 81 8B EF BC 9F 00 03 59 65 73 00 02 4E 6F 00 27 E3 82 A2 E3 82 AB E3 82 A6 E3 83 B3 E3 83 88 E3 82 92 E5 89 8A E9 99 A4 E3 81 97 E3 81 BE E3 81 97 E3 81 9F E3 80 82",
|
||||||
|
"sysmes_fr.json": "61 20 C3 A9 74 C3 A9 20 73 75 70 70 72 69 6D C3 A9 2E",
|
||||||
|
"sysmes_it.json": "83 88 E3 82 92 E5 89 8A E9 99 A4 E3 81 97 E3 81 BE E3 81 97 E3 81 9F E3 80 82"
|
||||||
|
}
|
||||||
|
|
||||||
|
def parse_hex_string(hex_string):
|
||||||
|
return bytes.fromhex(hex_string)
|
||||||
|
|
||||||
|
def pack_sysmes(input_json, output_filename, append_bytes):
|
||||||
|
with open(input_json, 'r', encoding='utf-8') as json_file:
|
||||||
|
strings = json.load(json_file)
|
||||||
|
|
||||||
|
with open(output_filename, 'wb') as f:
|
||||||
|
f.write(struct.pack('>H', len(strings) + 1)) # Bodge, last string is fucced
|
||||||
|
f.write(b'\x00\x00')
|
||||||
|
|
||||||
|
for string in strings:
|
||||||
|
encoded_string = string.encode('utf-8')
|
||||||
|
f.write(struct.pack('>H', len(encoded_string)))
|
||||||
|
f.write(encoded_string)
|
||||||
|
|
||||||
|
f.write(parse_hex_string(append_bytes))
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
for json_file, dat_file in FILES.items():
|
||||||
|
if os.path.exists(json_file):
|
||||||
|
print(f"Processing {json_file} → {dat_file}")
|
||||||
|
pack_sysmes(json_file, dat_file, APPEND_BYTES[json_file])
|
||||||
|
else:
|
||||||
|
print(f"Warning: {json_file} not found, skipped.")
|
||||||
Reference in New Issue
Block a user