-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgran_turismo_2.bms
More file actions
123 lines (118 loc) · 3.68 KB
/
gran_turismo_2.bms
File metadata and controls
123 lines (118 loc) · 3.68 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Gran Turismo 2
# GT2.VOL, GT2.OVL
get polyphony_archivename basename
get polyphony_archivextension extension
if polyphony_archivename == "GT2"
if polyphony_archivextension == "VOL"
get vol_sign long
if vol_sign != 0x53465447 # GTFS
print " not a GTFS(GT2.VOL) file, contact me if you want me to take a look at your file. "
cleanexit
endif
get zero_01 long
get individual_entries short
get overall_entries short
get zero_02 long
for i = 0 < individual_entries
get entry_value long
xmath remaining_bytes_for_entry "entry_value & 0x7ff"
putarray 1 i remaining_bytes_for_entry
xmath entry_offset "(entry_value >> 11) & 0x1fffff"
putarray 2 i entry_offset
next i
getarray overall_entry_info_offset 2 1
math overall_entry_info_offset << 11
goto overall_entry_info_offset
for i = 0 < overall_entries
get file_timestamp time
putarray 3 i file_timestamp
get entry_info_index short
putarray 4 i entry_info_index
get entry_flag byte
xmath last_entry "(entry_flag >> 7) & 1"
putarray 5 i last_entry
xmath entry_type "entry_flag & 1"
putarray 6 i entry_type
getdstring entry_name 0x19
putarray 7 i entry_name
next i
for directory = 0 < 256
putarray 101 j 0
putarray 102 j 0
putarray 103 j ""
next directory
math current_entry = 0
math previous_entry = 0
math current_directory = 0
math all_parsed_entries = 0
xmath last_entry "overall_entries - 1"
callfunction parse_gtfs 1
startfunction parse_gtfs
for i = current_entry < overall_entries
putarray 101 current_directory current_entry
xmath next_entry "current_entry + 1"
putarray 102 current_directory next_entry
getarray file_timestamp 3 i
getarray entry_info_index 4 i
getarray entry_dead_end 5 i
getarray entry_type 6 i
getarray entry_name 7 i
putarray 103 current_directory entry_name
if entry_type = 0
xmath next_index "entry_info_index + 1"
getarray starting_file_offset 2 entry_info_index
math starting_file_offset << 11
getarray finishing_file_offset 2 next_index
math finishing_file_offset << 11
getarray remaining_bytes_within_stored_file 1 entry_info_index
xmath file_size "(finishing_file_offset - starting_file_offset) - remaining_bytes_within_stored_file"
putarray 8 i file_size
math file_offset = starting_file_offset
xmath keywords "current_directory + 1"
set file_name string ""
for name = 0 < keywords
getarray keyword 103 name
string file_name + "/"
string file_name + keyword
next name
putarray 9 i file_name
log file_name file_offset file_size
elif entry_type = 1
if entry_name != ".."
math current_directory + 1
math current_entry = entry_info_index
callfunction parse_gtfs 1
endif
endif
if next_entry == overall_entries
cleanexit
endif
if entry_dead_end = 1
if entry_type != 1
xmath previous_directory "current_directory - 1"
getarray current_entry 102 previous_directory
math current_directory - 1
callfunction parse_gtfs 1
endif
endif
math current_entry + 1
next i
endfunction
elif polyphony_archivextension == "OVL"
get header_limit long
goto 0
do
get file_offset long
get file_size long
savepos curr_off
xmath count "curr_off / 8"
string file_name p "GT2_%02d.OVL.GZ" count
# ^ all i saw from PS1 games are "uppercase" filenames so this script will attempt to stick with protocol if needed
log file_name file_offset file_size
while curr_off < header_limit
else
break
endif
else
break
endif