-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgod-of-war_ps2_toc.bms
38 lines (35 loc) · 1.58 KB
/
god-of-war_ps2_toc.bms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# GOD OF WAR (PS2) - godofwar.toc
# ---
# TOC format itself is pretty simple. contains a TOC which has only file name, part number, file size and file offset fields.
# if file name field is empty (usually near the end of the file), that's it. that means no more files left for this TOC.
# of course, it can also store the same file 7 times in a row, and the pak files account for this as well.
# given how simple the format is, the script does not (and cannot) account for that in any way.
get name1 filename
if name1 != "godofwar.toc"
cleanexit
endif
for i = 0
getdstring file_name 12
if file_name == ""
# a null delimiter so the game can say "stop" when it finds out it has no more files to dig into memory
# (either by streaming stuff into memory or just loading the whole thing straight into it, which rarely happens)
print " no more files left "
break
endif
get part_number long
math part_number + 1
get file_size long
get file_offset long
math file_offset << 11
callfunction extract_file 1
next i
startfunction extract_file
# the TOC format uses two pak files - part1.pak and part2.pak
# the game loads those two files depending on where the file is at.
# as GOD OF WAR 2005 is a DVD9 game the devs had make sure all data is loaded
# anywhere the game wants within the disc, hence these two files.
# pak loading is streamlined here for simplicity sake.
string part_name p "part%u.pak" part_number
open FDSE part_name 1
log file_name file_offset file_size 1
endfunction