-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrmdp.bms
More file actions
251 lines (246 loc) · 7.39 KB
/
rmdp.bms
File metadata and controls
251 lines (246 loc) · 7.39 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# Remedy Entertainment - *.bin/*.rmdp
get remedy_extension extension
open FDDE "rmdp" 1
math 32bit_minus_one = 0xffffffff
math 64bit_minus_one = 0xffffffffffffffff
if remedy_extension == "bin"
get bin_endian_type byte
if bin_endian_type == 0
endian little
elif bin_endian_type == 1
endian big
endif
get bin_version long
get bin_directories long
get bin_files long
if bin_version >= 7
get bin05 longlong
endif
get bin_name_size long
getdstring bin_dummy_data 0x80
if bin_version <= 7
math sec_size_per_dir = 28
elif bin_version >= 8
math sec_size_per_dir = 48
endif
if bin_version == 2
math sec_size_per_file = 40
elif bin_version == 7
math sec_size_per_file = 48
elif bin_version >= 8
math sec_size_per_file = 60
endif
if bin_version == 2
math init_bin_hdr_size = 0x91
elif bin_version == 7
xmath init_bin_hdr_size "0x99 + 0x1c"
elif bin_version >= 8
xmath init_bin_hdr_size "0x99 + 0x30"
endif
xmath bin_directory_entries_sector_size "bin_directories * sec_size_per_dir"
xmath bin_file_entries_sector_size "bin_files * sec_size_per_file"
xmath bin_name_offset "bin_directory_entries_sector_size + bin_file_entries_sector_size + init_bin_hdr_size"
for one = 0 < bin_directories
if bin_version <= 7
get directory_01 long
putarray 01 one directory_01
get directory_02 long
putarray 02 one directory_02
get directory_03 long
putarray 03 one directory_03
get directory_04 long
putarray 04 one directory_04
get directory_05 long
putarray 05 one directory_05
get directory_06 long
putarray 06 one directory_06
get directory_07 long
putarray 07 one directory_07
elif bin_version >= 8
get directory_01 long
putarray 01 one directory_01
get directory_02 longlong
putarray 02 one directory_02
get directory_03 longlong
putarray 03 one directory_03
get directory_04 long
putarray 04 one directory_04
get directory_05 longlong
putarray 05 one directory_05
get directory_06 longlong
putarray 06 one directory_06
get directory_07 longlong
putarray 07 one directory_07
endif
next one
savepos temp_01
for one = 0 < bin_directories
getarray directory_05 05 one
if directory_05 == 32bit_minus_one || directory_05 == 64bit_minus_one
putarray 08 one ""
# alternatively i could've just put in "d:\data" but whatevs
else
math directory_05 + bin_name_offset
goto directory_05
get directory_08 string
putarray 08 one directory_08
endif
next one
goto temp_01
for two = 0 < bin_files
if bin_version == 2
get file_01 long
putarray 11 two file_01
get file_02 long
putarray 12 two file_02
get file_03 long
putarray 13 two file_03
get file_04 longlong
putarray 14 two file_04
get file_05 longlong
putarray 15 two file_05
get file_06 longlong
putarray 16 two file_06
get file_07 long
putarray 17 two file_07
elif bin_version == 7
get file_01 long
putarray 11 two file_01
get file_02 long
putarray 12 two file_02
get file_03 long
putarray 13 two file_03
get file_04 long
putarray 14 two file_04
get file_05 long
putarray 15 two file_05
get file_06 longlong
putarray 16 two file_06
get file_07 longlong
putarray 17 two file_07
get file_08 long
putarray 18 two file_08
get file_09 time64
putarray 19 two file_09
elif bin_version >= 8
get file_01 long
putarray 11 two file_01
get file_02 longlong
putarray 12 two file_02
get file_03 long
putarray 13 two file_03
get file_04 longlong
putarray 14 two file_04
get file_05 longlong
putarray 15 two file_05
get file_06 longlong
putarray 16 two file_06
get file_07 longlong
putarray 17 two file_07
get file_08 long
putarray 18 two file_08
get file_09 time64
putarray 19 two file_09
endif
next two
savepos temp_02
for two = 0 < bin_files
if bin_version == 2
getarray file_11 14 two
elif bin_version >= 7
getarray file_11 15 two
endif
math file_11 + bin_name_offset
goto file_11
get file_12 string
if bin_version == 2
putarray 18 two file_12
elif bin_version >= 7
putarray 20 two file_12
endif
next two
goto temp_02
for d1 = 0 < bin_directories
math current_number = d1
math current_string_index = 0
callfunction array_listing_of_directory_entry_within_sector 1
putarray 101 current_string_index directory_name_string
if parent_directory_number != 32bit_minus_one && parent_directory_number != 64bit_minus_one
for
math current_string_index + 1
math current_number = parent_directory_number
callfunction array_listing_of_directory_entry_within_sector 1
putarray 101 current_string_index directory_name_string
if parent_directory_number == 32bit_minus_one || parent_directory_number == 64bit_minus_one
break
endif
next
math last_string_index = current_string_index
math reordered_string_index = 0
set full_directory_name string ""
for
getarray current_string_key 101 last_string_index
if reordered_string_index >= 2
string full_directory_name + "\"
endif
string full_directory_name + current_string_key
if last_string_index != 0
math last_string_index - 1
math reordered_string_index + 1
else
break
endif
next
else
set full_directory_name string ""
endif
putarray 102 d1 full_directory_name
next d1
for f1 = 0 < bin_files
math current_number = f1
callfunction array_listing_of_file_entry_within_sector 1
getarray full_directory_name 102 directory_base_number
string full_file_name p "%s\%s" full_directory_name file_name_string
log full_file_name file_offset file_size 1
next f1
elif remedy_extension == "xml"
# SOON(TM)
elif remedy_extension == "packmeta"
# SOON(TM)
elif remedy_extension == "rmdp"
print " \n obviously, an .rmdp file cannot extract itself. "
cleanexit
endif
startfunction array_listing_of_directory_entry_within_sector
getarray directory_name_hash 01 current_number
getarray neighbor_directory_number 02 current_number
getarray parent_directory_number 03 current_number
getarray directory_04 04 current_number # this one is just dummy leftover data from whatever it is for all i care
getarray directory_name_offset 05 current_number
getarray incoming_directory_number 06 current_number
getarray base_file_number 07 current_number
getarray directory_name_string 08 current_number
endfunction
startfunction array_listing_of_file_entry_within_sector
if bin_version == 2
getarray file_01 11 current_number
getarray next_file_number 12 current_number
getarray directory_base_number 13 current_number
getarray file_name_offset 14 current_number
getarray file_offset 15 current_number
getarray file_size 16 current_number
getarray file_07 17 current_number
getarray file_name_string 18 current_number
elif bin_version >= 7
getarray file_01 11 current_number
getarray next_file_number 12 current_number
getarray directory_base_number 13 current_number
getarray file_04 14 current_number
getarray file_name_offset 15 current_number
getarray file_offset 16 current_number
getarray file_size 17 current_number
getarray file_08 18 current_number
getarray file_timestamp 19 current_number
getarray file_name_string 20 current_number
endif
endfunction