2 |
|
|
3 |
|
interface |
4 |
|
|
5 |
< |
uses SysUtils, Classes, Data, Dialogs, StrUtils; |
5 |
> |
uses SysUtils, Classes, Data, Dialogs, StrUtils, OniDataClass; |
6 |
|
|
7 |
|
type |
8 |
|
Tstructure_entry = record |
33 |
|
Global: array of TStructure_entry; |
34 |
|
Subs: array of TStructDefSub; |
35 |
|
end; |
36 |
< |
THandler = function(fileid: LongWord): TRawList; |
36 |
> |
THandler = function(connection: TOniData; fileid: LongWord): TRawList; |
37 |
|
|
38 |
|
TRawListHandlers = record |
39 |
|
Ext: String[4]; |
46 |
|
Raws: String; |
47 |
|
|
48 |
|
|
49 |
< |
function LoadStructureDefinition(fileid: LongWord): TStructDef; |
49 |
> |
function LoadStructureDefinition(connection: TOniData; fileid: LongWord): TStructDef; |
50 |
|
function GetDataType(typeid: Word): String; |
51 |
|
function GetTypeDataLength(datatype: Word): Word; |
52 |
|
|
53 |
|
implementation |
54 |
|
|
55 |
< |
uses Functions, OniDataClass, Forms, Template; |
55 |
> |
uses Functions, Forms, Template; |
56 |
|
|
57 |
|
|
58 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
< |
function AGDB(fileid: LongWord): TRawList; |
122 |
> |
function AGDB(connection: TOniData; fileid: LongWord): TRawList; |
123 |
|
var |
124 |
|
link: LongWord; |
125 |
|
links: LongWord; |
126 |
|
i: LongWord; |
127 |
|
begin |
128 |
< |
if not OniDataConnection.OSisMac then |
128 |
> |
if not connection.OSisMac then |
129 |
|
begin |
130 |
< |
OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links); |
130 |
> |
connection.LoadDatFilePart(fileid, $1C, 4, @links); |
131 |
|
links := links * 2; |
132 |
|
SetLength(Result, links); |
133 |
|
for i := 0 to links - 1 do |
134 |
|
begin |
135 |
|
Result[i].src_offset := $20 + i * 4; |
136 |
< |
OniDataConnection.LoadDatFilePart(fileid, $20 + i * 4, 4, @link); |
136 |
> |
connection.LoadDatFilePart(fileid, $20 + i * 4, 4, @link); |
137 |
|
Result[i].raw_addr := link; |
138 |
|
Result[i].raw_size := 0{????????????????????????????????}; |
139 |
|
Result[i].loc_sep := False; |
144 |
|
|
145 |
|
|
146 |
|
|
147 |
< |
function AKVA(fileid: LongWord): TRawList; |
147 |
> |
function AKVA(connection: TOniData; fileid: LongWord): TRawList; |
148 |
|
var |
149 |
|
link: LongWord; |
150 |
|
links: LongWord; |
151 |
|
i: LongWord; |
152 |
|
begin |
153 |
< |
if not OniDataConnection.OSisMac then |
153 |
> |
if not connection.OSisMac then |
154 |
|
begin |
155 |
< |
OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links); |
155 |
> |
connection.LoadDatFilePart(fileid, $1C, 4, @links); |
156 |
|
SetLength(Result, links); |
157 |
|
for i := 0 to links - 1 do |
158 |
|
begin |
159 |
|
Result[i].src_offset := $20 + i * $74 + $24; |
160 |
< |
OniDataConnection.LoadDatFilePart(fileid, $20 + i * $74 + $24, 4, @link); |
160 |
> |
connection.LoadDatFilePart(fileid, $20 + i * $74 + $24, 4, @link); |
161 |
|
Result[i].raw_addr := link; |
162 |
< |
OniDataConnection.LoadDatFilePart(fileid, $20 + i * $74 + $28, 4, @link); |
162 |
> |
connection.LoadDatFilePart(fileid, $20 + i * $74 + $28, 4, @link); |
163 |
|
Result[i].raw_size := link; |
164 |
|
Result[i].loc_sep := False; |
165 |
|
end; |
169 |
|
|
170 |
|
|
171 |
|
|
172 |
< |
function BINA(fileid: LongWord): TRawList; |
172 |
> |
function BINA(connection: TOniData; fileid: LongWord): TRawList; |
173 |
|
var |
174 |
|
link: LongWord; |
175 |
|
datasize: LongWord; |
176 |
|
begin |
177 |
< |
OniDataConnection.LoadDatFilePart(fileid, $0C, 4, @link); |
178 |
< |
OniDataConnection.LoadDatFilePart(fileid, $08, 4, @datasize); |
177 |
> |
connection.LoadDatFilePart(fileid, $0C, 4, @link); |
178 |
> |
connection.LoadDatFilePart(fileid, $08, 4, @datasize); |
179 |
|
SetLength(Result, 1); |
180 |
|
Result[0].src_offset := $0C; |
181 |
|
Result[0].raw_addr := link; |
182 |
|
Result[0].raw_size := datasize; |
183 |
< |
Result[0].loc_sep := OniDataConnection.OSisMac; |
183 |
> |
Result[0].loc_sep := connection.OSisMac; |
184 |
|
end; |
185 |
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
< |
function OSBD(fileid: LongWord): TRawList; |
189 |
> |
function OSBD(connection: TOniData; fileid: LongWord): TRawList; |
190 |
|
var |
191 |
|
link: LongWord; |
192 |
|
datasize: LongWord; |
193 |
|
begin |
194 |
< |
OniDataConnection.LoadDatFilePart(fileid, $08, 4, @datasize); |
195 |
< |
OniDataConnection.LoadDatFilePart(fileid, $0C, 4, @link); |
194 |
> |
connection.LoadDatFilePart(fileid, $08, 4, @datasize); |
195 |
> |
connection.LoadDatFilePart(fileid, $0C, 4, @link); |
196 |
|
SetLength(Result, 1); |
197 |
|
Result[0].src_offset := $0C; |
198 |
|
Result[0].raw_addr := link; |
203 |
|
|
204 |
|
|
205 |
|
|
206 |
< |
function SNDD(fileid: LongWord): TRawList; |
206 |
> |
function SNDD(connection: TOniData; fileid: LongWord): TRawList; |
207 |
|
var |
208 |
|
link: LongWord; |
209 |
|
datasize: LongWord; |
210 |
|
begin |
211 |
|
SetLength(Result, 1); |
212 |
< |
if not OniDataConnection.OSisMac then |
212 |
> |
if not connection.OSisMac then |
213 |
|
begin |
214 |
< |
OniDataConnection.LoadDatFilePart(fileid, $40, 4, @datasize); |
215 |
< |
OniDataConnection.LoadDatFilePart(fileid, $44, 4, @link); |
214 |
> |
connection.LoadDatFilePart(fileid, $40, 4, @datasize); |
215 |
> |
connection.LoadDatFilePart(fileid, $44, 4, @link); |
216 |
|
Result[0].src_offset := $44; |
217 |
|
end |
218 |
|
else |
219 |
|
begin |
220 |
< |
OniDataConnection.LoadDatFilePart(fileid, $10, 4, @datasize); |
221 |
< |
OniDataConnection.LoadDatFilePart(fileid, $14, 4, @link); |
220 |
> |
connection.LoadDatFilePart(fileid, $10, 4, @datasize); |
221 |
> |
connection.LoadDatFilePart(fileid, $14, 4, @link); |
222 |
|
Result[0].src_offset := $14; |
223 |
|
end; |
224 |
|
Result[0].raw_addr := link; |
229 |
|
|
230 |
|
|
231 |
|
|
232 |
< |
function SUBT(fileid: LongWord): TRawList; |
232 |
> |
function SUBT(connection: TOniData; fileid: LongWord): TRawList; |
233 |
|
var |
234 |
|
baselink, lastlink: LongWord; |
235 |
|
links: LongWord; |
236 |
|
j, k: LongWord; |
237 |
|
Data: Tdata; |
238 |
|
begin |
239 |
< |
OniDataConnection.LoadDatFilePart(fileid, $18, 4, @baselink); |
240 |
< |
OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links); |
239 |
> |
connection.LoadDatFilePart(fileid, $18, 4, @baselink); |
240 |
> |
connection.LoadDatFilePart(fileid, $1C, 4, @links); |
241 |
|
if links > 0 then |
242 |
|
begin |
243 |
< |
OniDataConnection.LoadDatFilePart(fileid, $20 + (links - 1) * 4, 4, @lastlink); |
243 |
> |
connection.LoadDatFilePart(fileid, $20 + (links - 1) * 4, 4, @lastlink); |
244 |
|
SetLength(Data, lastlink + 1024); |
245 |
< |
TOniDataDat(OniDataConnection).LoadRawOffset(False, |
245 |
> |
TOniDataDat(connection).LoadRawOffset(False, |
246 |
|
baselink, lastlink + 1024, Data); |
247 |
|
// OniDataConnection.LoadRawFile(fileid,$1C,baselink,lastlink+1024,False,@data[0]); |
248 |
|
k := 0; |
273 |
|
|
274 |
|
|
275 |
|
|
276 |
< |
function TRAM(fileid: LongWord): TRawList; |
276 |
> |
function TRAM(connection: TOniData; fileid: LongWord): TRawList; |
277 |
|
var |
278 |
|
i: Integer; |
279 |
|
link: LongWord; |
286 |
|
frame_count: Byte; |
287 |
|
begin |
288 |
|
SetLength(Result, 13); |
289 |
< |
OniDataConnection.LoadDatFilePart(fileid, $16C, 2, @frames); |
289 |
> |
connection.LoadDatFilePart(fileid, $16C, 2, @frames); |
290 |
|
{y-pos} |
291 |
< |
OniDataConnection.LoadDatFilePart(fileid, $0C, 4, @link); |
291 |
> |
connection.LoadDatFilePart(fileid, $0C, 4, @link); |
292 |
|
Result[0].src_offset := $0C; |
293 |
|
Result[0].raw_addr := link; |
294 |
|
Result[0].raw_size := frames * 4; |
295 |
|
{x-z-pos} |
296 |
< |
OniDataConnection.LoadDatFilePart(fileid, $10, 4, @link); |
296 |
> |
connection.LoadDatFilePart(fileid, $10, 4, @link); |
297 |
|
Result[1].src_offset := $10; |
298 |
|
Result[1].raw_addr := link; |
299 |
|
Result[1].raw_size := frames * 8; |
300 |
|
{attacks} |
301 |
< |
OniDataConnection.LoadDatFilePart(fileid, $182, 1, @tempb); |
302 |
< |
OniDataConnection.LoadDatFilePart(fileid, $14, 4, @link); |
301 |
> |
connection.LoadDatFilePart(fileid, $182, 1, @tempb); |
302 |
> |
connection.LoadDatFilePart(fileid, $14, 4, @link); |
303 |
|
Result[2].src_offset := $14; |
304 |
|
Result[2].raw_addr := link; |
305 |
|
Result[2].raw_size := tempb * 32; |
306 |
|
{damage} |
307 |
< |
OniDataConnection.LoadDatFilePart(fileid, $183, 1, @tempb); |
308 |
< |
OniDataConnection.LoadDatFilePart(fileid, $18, 4, @link); |
307 |
> |
connection.LoadDatFilePart(fileid, $183, 1, @tempb); |
308 |
> |
connection.LoadDatFilePart(fileid, $18, 4, @link); |
309 |
|
Result[3].src_offset := $18; |
310 |
|
Result[3].raw_addr := link; |
311 |
|
Result[3].raw_size := tempb * 8; |
312 |
|
{motionblur} |
313 |
< |
OniDataConnection.LoadDatFilePart(fileid, $184, 1, @tempb); |
314 |
< |
OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @link); |
313 |
> |
connection.LoadDatFilePart(fileid, $184, 1, @tempb); |
314 |
> |
connection.LoadDatFilePart(fileid, $1C, 4, @link); |
315 |
|
Result[4].src_offset := $1C; |
316 |
|
Result[4].raw_addr := link; |
317 |
|
Result[4].raw_size := tempb * 8; |
318 |
|
{shortcut} |
319 |
< |
OniDataConnection.LoadDatFilePart(fileid, $185, 1, @tempb); |
320 |
< |
OniDataConnection.LoadDatFilePart(fileid, $20, 4, @link); |
319 |
> |
connection.LoadDatFilePart(fileid, $185, 1, @tempb); |
320 |
> |
connection.LoadDatFilePart(fileid, $20, 4, @link); |
321 |
|
Result[5].src_offset := $20; |
322 |
|
Result[5].raw_addr := link; |
323 |
|
Result[5].raw_size := tempb * 8; |
324 |
|
{throw} |
325 |
< |
OniDataConnection.LoadDatFilePart(fileid, $24, 4, @link); |
325 |
> |
connection.LoadDatFilePart(fileid, $24, 4, @link); |
326 |
|
Result[6].src_offset := $24; |
327 |
|
Result[6].raw_addr := link; |
328 |
|
if link > 0 then |
330 |
|
else |
331 |
|
Result[6].raw_size := 0; |
332 |
|
{footstep} |
333 |
< |
OniDataConnection.LoadDatFilePart(fileid, $186, 1, @tempb); |
334 |
< |
OniDataConnection.LoadDatFilePart(fileid, $28, 4, @link); |
333 |
> |
connection.LoadDatFilePart(fileid, $186, 1, @tempb); |
334 |
> |
connection.LoadDatFilePart(fileid, $28, 4, @link); |
335 |
|
Result[7].src_offset := $28; |
336 |
|
Result[7].raw_addr := link; |
337 |
|
Result[7].raw_size := tempb * 4; |
338 |
|
{particle} |
339 |
< |
OniDataConnection.LoadDatFilePart(fileid, $187, 1, @tempb); |
340 |
< |
OniDataConnection.LoadDatFilePart(fileid, $2C, 4, @link); |
339 |
> |
connection.LoadDatFilePart(fileid, $187, 1, @tempb); |
340 |
> |
connection.LoadDatFilePart(fileid, $2C, 4, @link); |
341 |
|
Result[8].src_offset := $2C; |
342 |
|
Result[8].raw_addr := link; |
343 |
|
Result[8].raw_size := tempb * 24; |
344 |
|
{position} |
345 |
< |
OniDataConnection.LoadDatFilePart(fileid, $30, 4, @link); |
345 |
> |
connection.LoadDatFilePart(fileid, $30, 4, @link); |
346 |
|
Result[9].src_offset := $30; |
347 |
|
Result[9].raw_addr := link; |
348 |
|
Result[9].raw_size := frames * 8; |
349 |
|
{particle} |
350 |
< |
OniDataConnection.LoadDatFilePart(fileid, $154, 2, @tempw); |
351 |
< |
OniDataConnection.LoadDatFilePart(fileid, $38, 4, @link); |
350 |
> |
connection.LoadDatFilePart(fileid, $154, 2, @tempw); |
351 |
> |
connection.LoadDatFilePart(fileid, $38, 4, @link); |
352 |
|
Result[11].src_offset := $38; |
353 |
|
Result[11].raw_addr := link; |
354 |
|
Result[11].raw_size := tempw * 34; |
355 |
|
{extent} |
356 |
< |
OniDataConnection.LoadDatFilePart(fileid, $138, 4, @templ); |
357 |
< |
OniDataConnection.LoadDatFilePart(fileid, $13C, 4, @link); |
356 |
> |
connection.LoadDatFilePart(fileid, $138, 4, @templ); |
357 |
> |
connection.LoadDatFilePart(fileid, $13C, 4, @link); |
358 |
|
Result[12].src_offset := $13C; |
359 |
|
Result[12].raw_addr := link; |
360 |
|
Result[12].raw_size := templ * 12; |
361 |
|
|
362 |
< |
OniDataConnection.LoadDatFilePart(fileid, $34, 4, @link); |
362 |
> |
connection.LoadDatFilePart(fileid, $34, 4, @link); |
363 |
|
if link > 0 then |
364 |
|
begin |
365 |
< |
OniDataConnection.LoadDatFilePart(fileid, $160, 2, @tempw); |
365 |
> |
connection.LoadDatFilePart(fileid, $160, 2, @tempw); |
366 |
|
frame_count := 0; |
367 |
|
i := 0; |
368 |
|
SetLength(Data, $FFFF); |
369 |
< |
TOniDataDat(OniDataConnection).LoadRawOffset(False, link, $FFFF, Data); |
369 |
> |
TOniDataDat(connection).LoadRawOffset(False, link, $FFFF, Data); |
370 |
|
offset := Data[$24] + Data[$25] * 256; |
371 |
|
while (offset + i < Length(Data)) and (frame_count < frames - 1) do |
372 |
|
begin |
391 |
|
|
392 |
|
|
393 |
|
|
394 |
< |
function TXMP(fileid: LongWord): TRawList; |
394 |
> |
function TXMP(connection: TOniData; fileid: LongWord): TRawList; |
395 |
|
var |
396 |
|
link_pc: LongWord; |
397 |
|
link_mac: LongWord; |
399 |
|
storetype: Byte; |
400 |
|
datasize: LongWord; |
401 |
|
begin |
402 |
< |
OniDataConnection.LoadDatFilePart(fileid, $8C, SizeOf(x), @x); |
403 |
< |
OniDataConnection.LoadDatFilePart(fileid, $8E, SizeOf(y), @y); |
404 |
< |
OniDataConnection.LoadDatFilePart(fileid, $90, SizeOf(storetype), @storetype); |
405 |
< |
OniDataConnection.LoadDatFilePart(fileid, $9C, 4, @link_pc); |
406 |
< |
OniDataConnection.LoadDatFilePart(fileid, $A0, 4, @link_mac); |
402 |
> |
connection.LoadDatFilePart(fileid, $8C, SizeOf(x), @x); |
403 |
> |
connection.LoadDatFilePart(fileid, $8E, SizeOf(y), @y); |
404 |
> |
connection.LoadDatFilePart(fileid, $90, SizeOf(storetype), @storetype); |
405 |
> |
connection.LoadDatFilePart(fileid, $9C, 4, @link_pc); |
406 |
> |
connection.LoadDatFilePart(fileid, $A0, 4, @link_mac); |
407 |
|
case storetype of |
408 |
|
0, 1, 2: |
409 |
|
datasize := x * y * 2; |
413 |
|
datasize := x * y div 2; |
414 |
|
end; |
415 |
|
SetLength(Result, 1); |
416 |
< |
if not OniDataConnection.OSisMac then |
416 |
> |
if not connection.OSisMac then |
417 |
|
begin |
418 |
|
Result[0].src_offset := $9C; |
419 |
|
Result[0].raw_addr := link_pc; |
424 |
|
Result[0].raw_addr := link_mac; |
425 |
|
end; |
426 |
|
Result[0].raw_size := datasize; |
427 |
< |
Result[0].loc_sep := OniDataConnection.OSisMac; |
427 |
> |
Result[0].loc_sep := connection.OSisMac; |
428 |
|
end; |
429 |
|
|
430 |
|
|
443 |
|
|
444 |
|
|
445 |
|
|
446 |
< |
function LoadStructureDefinition(fileid: LongWord): TStructDef; |
446 |
> |
function LoadStructureDefinition(connection: TOniData; fileid: LongWord): TStructDef; |
447 |
|
var |
448 |
|
i: LongWord; |
449 |
|
current_type: Byte; //0: Global, 1: Undynamic, 2: Dynamic |
460 |
|
SetLength(Result.Global, 0); |
461 |
|
SetLength(Result.Subs, 0); |
462 |
|
Result.Data := False; |
463 |
< |
ext := OniDataConnection.GetFileInfo(fileid).Extension; |
463 |
> |
ext := connection.GetFileInfo(fileid).Extension; |
464 |
|
filename := ExtractFilePath(Application.ExeName) + '\StructDefs\' + ext + '.txt'; |
465 |
|
if FileExists(filename) then |
466 |
|
begin |
467 |
< |
Data := OniDataConnection.LoadDatFile(fileid); |
467 |
> |
Data := connection.LoadDatFile(fileid); |
468 |
|
AssignFile(deffile, filename); |
469 |
|
Reset(deffile); |
470 |
|
current_type := 0; |