got some stuff out into a file.

This commit is contained in:
Nitsud Yarg 2026-05-21 20:59:27 -07:00
parent 6619ed5b32
commit 973392e649

View File

@ -19,7 +19,7 @@ def get_props():
for r in range(0,len(offsets_data),8):
test += 1
# offsets_data[4:8].hex()
card_index_name_data = int.from_bytes( offsets_data[r:r+4], byteorder='little' )
card_index_name_data = int.from_bytes( offsets_data[r:r+4], byteorder='little', signed=False )
if card_index_name_data == 0:
continue
#card_index_desc_data = int.from_bytes( offsets_data[r+4:r+8], byteorder='little' )
@ -57,10 +57,50 @@ def get_props():
#cd_db[card_id][f"desc_addr_{language_code}"] = hex(card_index_desc_data)
language_code = 'E'
offsets_data = Path(f"YGO_2020/bin/DLG_Indx_{language_code}.bin").read_bytes() # Get all the bytes
name_data = Path(f"YGO_2020/bin/DLG_Text_{language_code}.bin").read_bytes() # Get all the bytes
get_props()
#offsets_data = Path(f"YGO_2020/bin/DLG_Indx_{language_code}.bin").read_bytes() # Get all the bytes
e_name_data = Path(f"YGO_2020/main/howto_db/howtoplay_{language_code}.bin").read_bytes() # Get all the bytes
#get_props()
language_code = 'J'
j_name_data = Path(f"YGO_2020/main/howto_db/howtoplay_{language_code}.bin").read_bytes() # Get all the bytes
print("now what?")
help_dump = {}
i_e = 1624
i_j = 1624
c = 1
while (i_e < len(e_name_data) and i_j < len(j_name_data)):
help_dump[c] = {}
e = read_until_null(i_e,e_name_data)
help_dump[c]['en'] = e_name_data[i_e:e].decode("utf-16be", errors="replace")
print(help_dump[c]['en'] )
i_e = e + 2
e = read_until_null(i_j,j_name_data)
help_dump[c]['ja'] = j_name_data[i_j:e].decode("utf-16be", errors="replace")
print(help_dump[c]['ja'])
i_j = e + 2
c+=1
print(c, " - strings extracted.")
# c = 333 not sure how to index these anymore
with open("helptext_dump.json", "w", encoding="utf-8") as outfile:
json.dump(help_dump, outfile, ensure_ascii=False, indent=2)
exit()
## Attempt to get ids or sense out of the beginning block, no luck so far
for r in range(0,len(name_data),8):
#id = int.from_bytes( name_data[r:r+4], byteorder='big', signed=False )
#id = int(name_data[r:r+4], 16) & 0xFFFFFFFF
id = struct.unpack('<I', name_data[r:r+4])[0] ## Only one that seemed to match the hex editor values for some reason.
print(r, ": ", (name_data[r:r+4]), " - " , id)
if (id == 4): ## Why four?
break
# What's 1616/4 == 404
read_until_null(1624,name_data)
name_data[1624:read_until_null(1624,name_data)].decode("utf-16be", errors="replace")
## Old attempts at getting dlg file extracted, leaving block for reference
language_code = 'J'
offsets_data = Path(f"YGO_2020/bin/DLG_Indx_{language_code}.bin").read_bytes() # Get all the bytes
name_data = Path(f"YGO_2020/bin/DLG_Text_{language_code}.bin").read_bytes() # Get all the bytes