Code: Select all
# KINGDOM HEARTS HD 1.5 + 2.5 ReMIX (Microsoft Windows)
# KINGDOM HEARTS HD 2.8 Final Chapter Prologue (Microsoft Windows)
math is_hed = 0
math is_pkg = 0
get ext extension
if ext == "hed"
math is_pkg = 1
callfunction handle_hed_pkg 1
elif ext == "pkg"
math is_hed = 1
callfunction handle_hed_pkg 1
endif
startfunction handle_hed_pkg
open FDDE "hed" is_hed
open FDDE "pkg" is_pkg
get hed_size asize is_hed
xmath hed_files "hed_size / 0x20"
for i = 0 < hed_files
set name string ""
getdstring hash 0x10 is_hed
string hash_in_str b hash
putvarchr hash_in_str 32 0
get file_offset longlong is_hed
get file_size1 long is_hed
get file_size2 long is_hed
set name string hash_in_str
goto file_offset is_pkg
get file_size3 long is_pkg
get sub_entries long is_pkg
get compressed_file_size1 long is_pkg
get file_info3 long is_pkg
if sub_entries == 0
string name + "."
math file_offset + 16
if compressed_file_size1 <= 0xfffffff0
log name file_offset compressed_file_size1 is_pkg
else
log name file_offset file_size3 is_pkg
endif
else
string name1 p "%s/init." name
xmath helper "16 + (sub_entries * 0x30)"
math file_offset + helper
if compressed_file_size1 <= 0xfffffff0
log name1 file_offset compressed_file_size1 is_pkg
math file_offset + compressed_file_size1
else
log name1 file_offset file_size3 is_pkg
math file_offset + file_size3
endif
for j = 0 < sub_entries
string name2 p "%s/%u." name j
getdstring sbe_name 0x20 is_pkg
get sbe1 long is_pkg
get sbe2 long is_pkg
get sbe3 long is_pkg
get sbe4 long is_pkg
if sbe4 <= 0xfffffff0
log name2 file_offset sbe4 is_pkg
math file_offset + sbe4
else
log name2 file_offset sbe3 is_pkg
xmath sbe3_1 "sbe3 && 0x10"
math file_offset + sbe3_1
endif
next j
endif
next i
endfunction