ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Global/DatLinks.pas
Revision: 122
Committed: Fri Mar 23 01:41:15 2007 UTC (18 years, 6 months ago) by alloc
Content type: text/x-pascal
File size: 29417 byte(s)
Log Message:

File Contents

# Content
1 unit DatLinks;
2 interface
3 uses TypeDefs, DataAccess;
4
5 type
6 THandler = function(Connection: TDataAccess; FileID: Integer): TDatLinkList;
7 TDatLinkHandler = record
8 Ext: String[4];
9 Handler: THandler;
10 end;
11 TDatLinkHandlers = array of TDatLinkHandler;
12
13 TDatLinks = class
14 private
15 FDatLinkHandlers: TDatLinkHandlers;
16 public
17 property RawListHandlers: TDatLinkHandlers read FDatLinkHandlers;
18 procedure InsertDatLinkHandler(ext: String; handler: THandler);
19 function GetDatLinks(ConnectionID, FileID: Integer): TDatLinkList;
20 function GetDatLink(ConnectionID, FileID, DatOffset: Integer): TDatLink;
21 end;
22
23
24 var
25 DatLinksManager: TDatLinks;
26
27
28 implementation
29 uses
30 ConnectionManager, Classes, SysUtils;
31
32
33
34 function AISA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
35 var
36 packages: Integer;
37 i: Integer;
38 begin
39 packages := 0;
40 Connection.LoadDatFilePart(fileid, $1E, 2, @packages);
41 SetLength(Result, packages * 2);
42 if packages > 0 then
43 begin
44 for i := 0 to packages - 1 do
45 begin
46 Result[i*2 + 0].SrcOffset := $20 + i * 352 + $28;
47 Result[i*2 + 0].DestID := -1;
48 Result[i*2 + 0].PosDestExts := 'ONCC';
49
50 Result[i*2 + 1].SrcOffset := $20 + i * 352 + $150;
51 Result[i*2 + 1].DestID := -1;
52 Result[i*2 + 1].PosDestExts := 'ONWC';
53 end;
54 end;
55 end;
56
57
58
59 function AKEV(Connection: TDataAccess; FileID: Integer): TDatLinkList;
60 const
61 types: array[0..16] of String[4] =
62 ('PNTA', 'PLEA', 'TXCA', 'AGQG', 'AGQR', 'AGQC', 'AGDB', 'TXMA', 'AKVA',
63 'AKBA', 'IDXA', 'IDXA', 'AKBP', 'ABNA', 'AKOT', 'AKAA', 'AKDA');
64 var
65 i: Integer;
66 begin
67 SetLength(Result, 17);
68 for i := 0 to 16 do
69 begin
70 Result[i].SrcOffset := $8 + i*4;
71 Result[i].DestID := -1;
72 Result[i].PosDestExts := types[i];
73 end;
74 end;
75
76
77
78 function AKOT(Connection: TDataAccess; FileID: Integer): TDatLinkList;
79 const
80 types: array[0..4] of String[4] =
81 ('OTIT', 'OTLF', 'QTNA', 'IDXA', 'IDXA');
82 var
83 i: Integer;
84 begin
85 SetLength(Result, 5);
86 for i := 0 to 4 do
87 begin
88 Result[i].SrcOffset := $8 + i*4;
89 Result[i].DestID := -1;
90 Result[i].PosDestExts := types[i];
91 end;
92 end;
93
94
95
96 function CBPI(Connection: TDataAccess; FileID: Integer): TDatLinkList;
97 var
98 i: Integer;
99 begin
100 SetLength(Result, 57);
101 for i := 0 to 56 do
102 begin
103 Result[i].SrcOffset := $8 + i*4;
104 Result[i].DestID := -1;
105 Result[i].PosDestExts := 'Impt';
106 end;
107 end;
108
109
110
111 function CBPM(Connection: TDataAccess; FileID: Integer): TDatLinkList;
112 var
113 i: Integer;
114 begin
115 SetLength(Result, 19);
116 for i := 0 to 18 do
117 begin
118 Result[i].SrcOffset := $8 + i*4;
119 Result[i].DestID := -1;
120 Result[i].PosDestExts := 'Mtrl';
121 end;
122 end;
123
124
125
126 function CONS(Connection: TDataAccess; FileID: Integer): TDatLinkList;
127 const
128 types: array[0..1] of String[4] =
129 ('OFGA', 'M3GM');
130 var
131 i: Integer;
132 begin
133 SetLength(Result, 2);
134 for i := 0 to 1 do
135 begin
136 Result[i].SrcOffset := $24 + i*4;
137 Result[i].DestID := -1;
138 Result[i].PosDestExts := types[i];
139 end;
140 end;
141
142
143
144 function CRSA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
145 var
146 packages: Integer;
147 i: Integer;
148 begin
149 packages := 0;
150 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
151 SetLength(Result, packages);
152 if packages > 0 then
153 begin
154 for i := 0 to packages - 1 do
155 begin
156 Result[i].SrcOffset := $20 + i*1100 + $A0;
157 Result[i].DestID := -1;
158 Result[i].PosDestExts := 'ONCC';
159 end;
160 end;
161 end;
162
163
164
165 function DOOR(Connection: TDataAccess; FileID: Integer): TDatLinkList;
166 const
167 types: array[0..2] of String[4] =
168 ('OFGA', 'OFGA', 'OBAN');
169 var
170 i: Integer;
171 begin
172 SetLength(Result, 3);
173 for i := 0 to 2 do
174 begin
175 Result[i].SrcOffset := $8 + i*4;
176 Result[i].DestID := -1;
177 Result[i].PosDestExts := types[i];
178 end;
179 end;
180
181
182
183 function DPge(Connection: TDataAccess; FileID: Integer): TDatLinkList;
184 const
185 types: array[0..0] of String[4] =
186 ('IGPG');
187 var
188 i: Integer;
189 begin
190 SetLength(Result, 1);
191 for i := 0 to 0 do
192 begin
193 Result[i].SrcOffset := $40 + i*4;
194 Result[i].DestID := -1;
195 Result[i].PosDestExts := types[i];
196 end;
197 end;
198
199
200
201 function FILM(Connection: TDataAccess; FileID: Integer): TDatLinkList;
202 const
203 types: array[0..1] of String[4] =
204 ('TRAM', 'TRAM');
205 var
206 i: Integer;
207 begin
208 SetLength(Result, 2);
209 for i := 0 to 1 do
210 begin
211 Result[i].SrcOffset := $28 + i*4;
212 Result[i].DestID := -1;
213 Result[i].PosDestExts := types[i];
214 end;
215 end;
216
217
218
219 function FXLR(Connection: TDataAccess; FileID: Integer): TDatLinkList;
220 const
221 types: array[0..1] of String[4] =
222 ('TXMP', 'M3GM');
223 var
224 i: Integer;
225 begin
226 SetLength(Result, 2);
227 for i := 0 to 1 do
228 begin
229 Result[i].SrcOffset := $0C + i*4;
230 Result[i].DestID := -1;
231 Result[i].PosDestExts := types[i];
232 end;
233 end;
234
235
236
237 function GMAN(Connection: TDataAccess; FileID: Integer): TDatLinkList;
238 var
239 packages: Integer;
240 i: Integer;
241 begin
242 packages := 0;
243 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
244 SetLength(Result, packages);
245 if packages > 0 then
246 begin
247 for i := 0 to packages - 1 do
248 begin
249 Result[i].SrcOffset := $20 + i*4;
250 Result[i].DestID := -1;
251 Result[i].PosDestExts := 'M3GM';
252 end;
253 end;
254 end;
255
256
257
258 function HPge(Connection: TDataAccess; FileID: Integer): TDatLinkList;
259 const
260 types: array[0..0] of String[4] =
261 ('IGPG');
262 var
263 i: Integer;
264 begin
265 SetLength(Result, 1);
266 for i := 0 to 0 do
267 begin
268 Result[i].SrcOffset := $0C + i*4;
269 Result[i].DestID := -1;
270 Result[i].PosDestExts := types[i];
271 end;
272 end;
273
274
275
276 function IGHH(Connection: TDataAccess; FileID: Integer): TDatLinkList;
277 const
278 types: array[0..1] of String[4] =
279 ('TXMP', 'TXMP');
280 var
281 i: Integer;
282 begin
283 SetLength(Result, 2);
284 for i := 0 to 1 do
285 begin
286 Result[i].SrcOffset := $24 + i*4;
287 Result[i].DestID := -1;
288 Result[i].PosDestExts := types[i];
289 end;
290 end;
291
292
293
294 function IGPA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
295 var
296 packages: Integer;
297 i: Integer;
298 begin
299 packages := 0;
300 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
301 SetLength(Result, packages);
302 if packages > 0 then
303 begin
304 for i := 0 to packages - 1 do
305 begin
306 Result[i].SrcOffset := $20 + i*4;
307 Result[i].DestID := -1;
308 Result[i].PosDestExts := 'IGPG';
309 end;
310 end;
311 end;
312
313
314
315 function IGPG(Connection: TDataAccess; FileID: Integer): TDatLinkList;
316 const
317 types: array[0..3] of String[4] =
318 ('TSFF', '*', 'IGSA', 'IGSA');
319 var
320 i: Integer;
321 begin
322 SetLength(Result, 4);
323 Result[0].SrcOffset := $8;
324 Result[0].DestID := -1;
325 Result[0].PosDestExts := types[0];
326
327 for i := 1 to 3 do
328 begin
329 Result[i].SrcOffset := $14 + i*4;
330 Result[i].DestID := -1;
331 Result[i].PosDestExts := types[i];
332 end;
333 end;
334
335
336
337 function IGSA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
338 var
339 packages: Integer;
340 i: Integer;
341 begin
342 packages := 0;
343 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
344 SetLength(Result, packages);
345 if packages > 0 then
346 begin
347 for i := 0 to packages - 1 do
348 begin
349 Result[i].SrcOffset := $20 + i*4;
350 Result[i].DestID := -1;
351 Result[i].PosDestExts := 'IGSt';
352 end;
353 end;
354 end;
355
356
357
358 function IGSt(Connection: TDataAccess; FileID: Integer): TDatLinkList;
359 const
360 types: array[0..0] of String[4] =
361 ('TSFF');
362 var
363 i: Integer;
364 begin
365 SetLength(Result, 1);
366 for i := 0 to 0 do
367 begin
368 Result[i].SrcOffset := $8 + i*4;
369 Result[i].DestID := -1;
370 Result[i].PosDestExts := types[i];
371 end;
372 end;
373
374
375
376 function Impt(Connection: TDataAccess; FileID: Integer): TDatLinkList;
377 const
378 types: array[0..0] of String[4] =
379 ('*');
380 var
381 i: Integer;
382 begin
383 SetLength(Result, 1);
384 for i := 0 to 0 do
385 begin
386 Result[i].SrcOffset := $10 + i*4;
387 Result[i].DestID := -1;
388 Result[i].PosDestExts := types[i];
389 end;
390 end;
391
392
393
394 function IPge(Connection: TDataAccess; FileID: Integer): TDatLinkList;
395 const
396 types: array[0..0] of String[4] =
397 ('IGPG');
398 var
399 i: Integer;
400 begin
401 SetLength(Result, 1);
402 for i := 0 to 0 do
403 begin
404 Result[i].SrcOffset := $0C + i*4;
405 Result[i].DestID := -1;
406 Result[i].PosDestExts := types[i];
407 end;
408 end;
409
410
411
412 function KeyI(Connection: TDataAccess; FileID: Integer): TDatLinkList;
413 var
414 i: Integer;
415 begin
416 SetLength(Result, 10);
417 for i := 0 to 9 do
418 begin
419 Result[i].SrcOffset := $08 + i*4;
420 Result[i].DestID := -1;
421 Result[i].PosDestExts := 'TXMP';
422 end;
423 end;
424
425
426
427 function M3GA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
428 var
429 packages: Integer;
430 i: Integer;
431 begin
432 packages := 0;
433 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
434 SetLength(Result, packages);
435 if packages > 0 then
436 begin
437 for i := 0 to packages - 1 do
438 begin
439 Result[i].SrcOffset := $20 + i*4;
440 Result[i].DestID := -1;
441 Result[i].PosDestExts := 'M3GM';
442 end;
443 end;
444 end;
445
446
447
448 function M3GM(Connection: TDataAccess; FileID: Integer): TDatLinkList;
449 const
450 types: array[0..7] of String[4] =
451 ('PNTA', 'VCRA', 'VCRA', 'TXCA', 'IDXA', 'IDXA', 'TXMP', '*');
452 var
453 i: Integer;
454 begin
455 SetLength(Result, 8);
456 for i := 0 to 7 do
457 begin
458 Result[i].SrcOffset := $0C + i*4;
459 Result[i].DestID := -1;
460 Result[i].PosDestExts := types[i];
461 end;
462 end;
463
464
465
466 function Mtrl(Connection: TDataAccess; FileID: Integer): TDatLinkList;
467 const
468 types: array[0..0] of String[4] =
469 ('*');
470 var
471 i: Integer;
472 begin
473 SetLength(Result, 1);
474 for i := 0 to 0 do
475 begin
476 Result[i].SrcOffset := $10 + i*4;
477 Result[i].DestID := -1;
478 Result[i].PosDestExts := types[i];
479 end;
480 end;
481
482
483
484 function OBDC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
485 var
486 packages: Integer;
487 i: Integer;
488 begin
489 packages := 0;
490 Connection.LoadDatFilePart(fileid, $1E, 2, @packages);
491 SetLength(Result, packages);
492 if packages > 0 then
493 begin
494 for i := 0 to packages - 1 do
495 begin
496 Result[i].SrcOffset := $20 + i*$18 + 4;
497 Result[i].DestID := -1;
498 Result[i].PosDestExts := 'OBAN';
499 end;
500 end;
501 end;
502
503
504
505 function OBOA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
506 var
507 packages: Integer;
508 i: Integer;
509 begin
510 packages := 0;
511 Connection.LoadDatFilePart(fileid, $1E, 2, @packages);
512 SetLength(Result, packages * 3);
513 if packages > 0 then
514 begin
515 for i := 0 to packages - 1 do
516 begin
517 Result[i*3 + 0].SrcOffset := $20 + i*240 + 0;
518 Result[i*3 + 0].DestID := -1;
519 Result[i*3 + 0].PosDestExts := 'M3GA';
520
521 Result[i*3 + 0].SrcOffset := $20 + i*240 + 4;
522 Result[i*3 + 0].DestID := -1;
523 Result[i*3 + 1].PosDestExts := 'OBAN';
524
525 Result[i*3 + 0].SrcOffset := $20 + i*240 + 8;
526 Result[i*3 + 0].DestID := -1;
527 Result[i*3 + 2].PosDestExts := 'ENVP';
528 end;
529 end;
530 end;
531
532
533
534 function OFGA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
535 var
536 packages: Integer;
537 i: Integer;
538 begin
539 packages := 0;
540 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
541 SetLength(Result, packages * 2 + 1);
542
543 Result[0].SrcOffset := $18;
544 Result[0].DestID := -1;
545 Result[0].PosDestExts := 'ENVP';
546 if packages > 0 then
547 begin
548 for i := 0 to packages - 1 do
549 begin
550 Result[1 + i*2 + 0].SrcOffset := $20 + i*12 + 4;
551 Result[1 + i*2 + 0].DestID := -1;
552 Result[1 + i*2 + 0].PosDestExts := 'M3GM';
553
554 Result[1 + i*2 + 1].SrcOffset := $20 + i*12 + 8;
555 Result[1 + i*2 + 1].DestID := -1;
556 Result[1 + i*2 + 1].PosDestExts := 'OBLS';
557 end;
558 end;
559 end;
560
561
562
563 function ONCC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
564 var
565 i: Integer;
566 begin
567 SetLength(Result, 10);
568 i := 0;
569 Result[i].SrcOffset := $28;
570 Result[i].DestID := -1;
571 Result[i].PosDestExts := 'TXMP';
572 Inc(i);
573 Result[i].SrcOffset := $434;
574 Result[i].DestID := -1;
575 Result[i].PosDestExts := 'ONCV';
576 Inc(i);
577 Result[i].SrcOffset := $438;
578 Result[i].DestID := -1;
579 Result[i].PosDestExts := 'ONCP';
580 Inc(i);
581 Result[i].SrcOffset := $43C;
582 Result[i].DestID := -1;
583 Result[i].PosDestExts := 'ONIA';
584 Inc(i);
585 Result[i].SrcOffset := $C3C;
586 Result[i].DestID := -1;
587 Result[i].PosDestExts := 'TRBS';
588 Inc(i);
589 Result[i].SrcOffset := $C40;
590 Result[i].DestID := -1;
591 Result[i].PosDestExts := 'TRMA';
592 Inc(i);
593 Result[i].SrcOffset := $C44;
594 Result[i].DestID := -1;
595 Result[i].PosDestExts := 'CBPM';
596 Inc(i);
597 Result[i].SrcOffset := $C48;
598 Result[i].DestID := -1;
599 Result[i].PosDestExts := 'CBPI';
600 Inc(i);
601 Result[i].SrcOffset := $C88;
602 Result[i].DestID := -1;
603 Result[i].PosDestExts := 'TRAC';
604 Inc(i);
605 Result[i].SrcOffset := $C8C;
606 Result[i].DestID := -1;
607 Result[i].PosDestExts := 'TRSC';
608 end;
609
610
611
612 function ONCV(Connection: TDataAccess; FileID: Integer): TDatLinkList;
613 begin
614 SetLength(Result, 1);
615 Result[0].SrcOffset := $8;
616 Result[0].DestID := -1;
617 Result[0].PosDestExts := '*';
618 end;
619
620
621
622 function ONLV(Connection: TDataAccess; FileID: Integer): TDatLinkList;
623 const
624 types: array[0..12] of String[4] =
625 ('AKEV', 'OBOA', 'ONMA', 'ONFA', 'ONTA', 'ONSK', 'AISA', 'AITR',
626 'ONSA', 'OBDC', 'ONOA', 'ENVP', 'CRSA');
627 var
628 i: Integer;
629 begin
630 SetLength(Result, 13);
631 for i := 0 to 5 do
632 begin
633 Result[i].SrcOffset := $48 + i*4;
634 Result[i].DestID := -1;
635 Result[i].PosDestExts := types[i];
636 end;
637 for i := 0 to 5 do
638 begin
639 Result[i+6].SrcOffset := $64 + i*4;
640 Result[i+6].DestID := -1;
641 Result[i+6].PosDestExts := types[i+6];
642 end;
643 Result[12].SrcOffset := $300;
644 Result[12].DestID := -1;
645 Result[12].PosDestExts := types[12];
646 end;
647
648
649
650 function ONOA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
651 var
652 packages: Integer;
653 i: Integer;
654 begin
655 packages := 0;
656 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
657 SetLength(Result, packages);
658 if packages > 0 then
659 begin
660 for i := 0 to packages - 1 do
661 begin
662 Result[i].SrcOffset := $20 + i*8 + 4;
663 Result[i].DestID := -1;
664 Result[i].PosDestExts := 'IDXA';
665 end;
666 end;
667 end;
668
669
670
671 function ONSK(Connection: TDataAccess; FileID: Integer): TDatLinkList;
672 var
673 i: Integer;
674 begin
675 SetLength(Result, 20);
676 for i := 0 to 19 do
677 begin
678 Result[i].SrcOffset := $08 + i*4;
679 Result[i].DestID := -1;
680 Result[i].PosDestExts := 'TXMP';
681 end;
682 end;
683
684
685
686 function ONVL(Connection: TDataAccess; FileID: Integer): TDatLinkList;
687 var
688 packages: Integer;
689 i: Integer;
690 begin
691 packages := 0;
692 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
693 SetLength(Result, packages);
694 if packages > 0 then
695 begin
696 for i := 0 to packages - 1 do
697 begin
698 Result[i].SrcOffset := $20 + i*4;
699 Result[i].DestID := -1;
700 Result[i].PosDestExts := 'ONCV';
701 end;
702 end;
703 end;
704
705
706
707 function ONWC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
708 var
709 i: Integer;
710 begin
711 SetLength(Result, 9);
712 i := 0;
713 Result[i].SrcOffset := $28;
714 Result[i].DestID := -1;
715 Result[i].PosDestExts := 'TXMP';
716 Inc(i);
717 Result[i].SrcOffset := $34;
718 Result[i].DestID := -1;
719 Result[i].PosDestExts := 'TXMP';
720 Inc(i);
721 Result[i].SrcOffset := $40;
722 Result[i].DestID := -1;
723 Result[i].PosDestExts := 'TXMP';
724 Inc(i);
725 Result[i].SrcOffset := $54;
726 Result[i].DestID := -1;
727 Result[i].PosDestExts := 'TXMP';
728 Inc(i);
729 Result[i].SrcOffset := $58;
730 Result[i].DestID := -1;
731 Result[i].PosDestExts := 'TXMP';
732 Inc(i);
733 Result[i].SrcOffset := $5C;
734 Result[i].DestID := -1;
735 Result[i].PosDestExts := 'TXMP';
736 Inc(i);
737 Result[i].SrcOffset := $60;
738 Result[i].DestID := -1;
739 Result[i].PosDestExts := 'M3GM';
740 Inc(i);
741 Result[i].SrcOffset := $6FC;
742 Result[i].DestID := -1;
743 Result[i].PosDestExts := 'TXMP';
744 Inc(i);
745 Result[i].SrcOffset := $700;
746 Result[i].DestID := -1;
747 Result[i].PosDestExts := 'TXMP';
748 end;
749
750
751
752 function OPge(Connection: TDataAccess; FileID: Integer): TDatLinkList;
753 begin
754 SetLength(Result, 1);
755 Result[0].SrcOffset := $0C;
756 Result[0].DestID := -1;
757 Result[0].PosDestExts := 'IGPA';
758 end;
759
760
761
762 function PSpc(Connection: TDataAccess; FileID: Integer): TDatLinkList;
763 begin
764 SetLength(Result, 1);
765 Result[0].SrcOffset := $50;
766 Result[0].DestID := -1;
767 Result[0].PosDestExts := '*';
768 end;
769
770
771
772 function PSpL(Connection: TDataAccess; FileID: Integer): TDatLinkList;
773 var
774 packages: Integer;
775 i: Integer;
776 begin
777 packages := 0;
778 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
779 SetLength(Result, packages);
780 if packages > 0 then
781 begin
782 for i := 0 to packages - 1 do
783 begin
784 Result[i].SrcOffset := $20 + i*8 + 4;
785 Result[i].DestID := -1;
786 Result[i].PosDestExts := '*';
787 end;
788 end;
789 end;
790
791
792
793 function PSUI(Connection: TDataAccess; FileID: Integer): TDatLinkList;
794 var
795 i: Integer;
796 begin
797 SetLength(Result, 44);
798 for i := 0 to 43 do
799 begin
800 Result[i].SrcOffset := $08 + i*4;
801 Result[i].DestID := -1;
802 Result[i].PosDestExts := 'PSpc';
803 end;
804 end;
805
806
807
808 function StNA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
809 var
810 packages: Integer;
811 i: Integer;
812 begin
813 packages := 0;
814 Connection.LoadDatFilePart(fileid, $1E, 2, @packages);
815 SetLength(Result, packages);
816 if packages > 0 then
817 begin
818 for i := 0 to packages - 1 do
819 begin
820 Result[i].SrcOffset := $20 + i*4;
821 Result[i].DestID := -1;
822 Result[i].PosDestExts := 'TStr';
823 end;
824 end;
825 end;
826
827
828
829 function TMRA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
830 var
831 packages: Integer;
832 i: Integer;
833 begin
834 packages := 0;
835 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
836 SetLength(Result, packages);
837 if packages > 0 then
838 begin
839 for i := 0 to packages - 1 do
840 begin
841 Result[i].SrcOffset := $20 + i*4;
842 Result[i].DestID := -1;
843 Result[i].PosDestExts := '*';
844 end;
845 end;
846 end;
847
848
849
850 function TRAC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
851 var
852 packages: Integer;
853 i: Integer;
854 begin
855 packages := 0;
856 Connection.LoadDatFilePart(fileid, $1E, 2, @packages);
857 SetLength(Result, packages + 1);
858 Result[0].SrcOffset := $18;
859 Result[0].DestID := -1;
860 Result[0].PosDestExts := 'TRAC';
861 if packages > 0 then
862 begin
863 for i := 0 to packages - 1 do
864 begin
865 Result[i+1].SrcOffset := $20 + i*12 + 8;
866 Result[i+1].DestID := -1;
867 Result[i+1].PosDestExts := 'TRAM';
868 end;
869 end;
870 end;
871
872
873
874 function TRAM(Connection: TDataAccess; FileID: Integer): TDatLinkList;
875 var
876 i: Integer;
877 begin
878 SetLength(Result, 2);
879 for i := 0 to 1 do
880 begin
881 Result[i].SrcOffset := $40 + i*4;
882 Result[i].DestID := -1;
883 Result[i].PosDestExts := 'TRAM';
884 end;
885 end;
886
887
888
889 function TRAS(Connection: TDataAccess; FileID: Integer): TDatLinkList;
890 begin
891 SetLength(Result, 1);
892 Result[0].SrcOffset := $08;
893 Result[0].DestID := -1;
894 Result[0].PosDestExts := 'TRAM';
895 end;
896
897
898
899 function TRBS(Connection: TDataAccess; FileID: Integer): TDatLinkList;
900 var
901 i: Integer;
902 begin
903 SetLength(Result, 5);
904 for i := 0 to 4 do
905 begin
906 Result[i].SrcOffset := $08 + i*4;
907 Result[i].DestID := -1;
908 Result[i].PosDestExts := 'TRCM';
909 end;
910 end;
911
912
913
914 function TRCM(Connection: TDataAccess; FileID: Integer): TDatLinkList;
915 const
916 types: array[0..2] of String[4] =
917 ('TRGA', 'TRTA', 'TRIA');
918 var
919 i: Integer;
920 begin
921 SetLength(Result, 3);
922 for i := 0 to 2 do
923 begin
924 Result[i].SrcOffset := $5C + i*4;
925 Result[i].DestID := -1;
926 Result[i].PosDestExts := types[i];
927 end;
928 end;
929
930
931
932 function TRGA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
933 var
934 packages: Integer;
935 i: Integer;
936 begin
937 packages := 0;
938 Connection.LoadDatFilePart(fileid, $1E, 2, @packages);
939 SetLength(Result, packages);
940 if packages > 0 then
941 begin
942 for i := 0 to packages - 1 do
943 begin
944 Result[i].SrcOffset := $20 + i*4;
945 Result[i].DestID := -1;
946 Result[i].PosDestExts := 'M3GM';
947 end;
948 end;
949 end;
950
951
952
953 function TRGE(Connection: TDataAccess; FileID: Integer): TDatLinkList;
954 begin
955 SetLength(Result, 1);
956 Result[0].SrcOffset := $20;
957 Result[0].DestID := -1;
958 Result[0].PosDestExts := 'M3GM';
959 end;
960
961
962
963 function TRIG(Connection: TDataAccess; FileID: Integer): TDatLinkList;
964 const
965 types: array[0..3] of String[4] =
966 ('M3GM', 'OBLS', 'TRGE', 'OBAN');
967 var
968 i: Integer;
969 begin
970 SetLength(Result, 4);
971 for i := 0 to 1 do
972 begin
973 Result[i].SrcOffset := $18 + i*4;
974 Result[i].DestID := -1;
975 Result[i].PosDestExts := types[i];
976 end;
977 for i := 0 to 1 do
978 begin
979 Result[i+2].SrcOffset := $24 + i*4;
980 Result[i+2].DestID := -1;
981 Result[i+2].PosDestExts := types[i+2];
982 end;
983 end;
984
985
986
987 function TRMA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
988 var
989 packages: Integer;
990 i: Integer;
991 begin
992 packages := 0;
993 Connection.LoadDatFilePart(fileid, $1E, 2, @packages);
994 SetLength(Result, packages);
995 if packages > 0 then
996 begin
997 for i := 0 to packages - 1 do
998 begin
999 Result[i].SrcOffset := $20 + i*4;
1000 Result[i].DestID := -1;
1001 Result[i].PosDestExts := 'TXMP';
1002 end;
1003 end;
1004 end;
1005
1006
1007
1008 function TRSC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1009 var
1010 packages: Integer;
1011 i: Integer;
1012 begin
1013 packages := 0;
1014 Connection.LoadDatFilePart(fileid, $1E, 2, @packages);
1015 SetLength(Result, packages);
1016 if packages > 0 then
1017 begin
1018 for i := 0 to packages - 1 do
1019 begin
1020 Result[i].SrcOffset := $20 + i*4;
1021 Result[i].DestID := -1;
1022 Result[i].PosDestExts := 'TRAS';
1023 end;
1024 end;
1025 end;
1026
1027
1028
1029 function TSFF(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1030 var
1031 packages: Integer;
1032 i: Integer;
1033 begin
1034 packages := 0;
1035 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
1036 SetLength(Result, packages + 1);
1037
1038 Result[0].SrcOffset := $18;
1039 Result[0].DestID := -1;
1040 Result[0].PosDestExts := 'TSFL';
1041 if packages > 0 then
1042 begin
1043 for i := 0 to packages - 1 do
1044 begin
1045 Result[i+1].SrcOffset := $20 + i*4;
1046 Result[i+1].DestID := -1;
1047 Result[i+1].PosDestExts := 'TSFT';
1048 end;
1049 end;
1050 end;
1051
1052
1053
1054 function TSFT(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1055 var
1056 i: Integer;
1057 begin
1058 SetLength(Result, 256);
1059 for i := 0 to 255 do
1060 begin
1061 Result[i].SrcOffset := $1C + i*4;
1062 Result[i].DestID := -1;
1063 Result[i].PosDestExts := 'TSGA';
1064 end;
1065 end;
1066
1067
1068
1069 function TURR(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1070 var
1071 i: Integer;
1072 begin
1073 SetLength(Result, 4);
1074 i := 0;
1075 Result[i].SrcOffset := $60;
1076 Result[i].DestID := -1;
1077 Result[i].PosDestExts := 'M3GM';
1078 Inc(i);
1079 Result[i].SrcOffset := $64;
1080 Result[i].DestID := -1;
1081 Result[i].PosDestExts := 'OBLS';
1082 Inc(i);
1083 Result[i].SrcOffset := $6C;
1084 Result[i].DestID := -1;
1085 Result[i].PosDestExts := 'M3GM';
1086 Inc(i);
1087 Result[i].SrcOffset := $74;
1088 Result[i].DestID := -1;
1089 Result[i].PosDestExts := 'M3GM';
1090 end;
1091
1092
1093
1094 function TXAN(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1095 var
1096 packages: Integer;
1097 i: Integer;
1098 begin
1099 packages := 0;
1100 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
1101 SetLength(Result, packages);
1102 if packages > 0 then
1103 begin
1104 for i := 0 to packages - 1 do
1105 begin
1106 Result[i].SrcOffset := $20 + i*4;
1107 Result[i].DestID := -1;
1108 Result[i].PosDestExts := 'TXMP';
1109 end;
1110 end;
1111 end;
1112
1113
1114
1115 function TXMA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1116 var
1117 packages: Integer;
1118 i: Integer;
1119 begin
1120 packages := 0;
1121 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
1122 SetLength(Result, packages);
1123 if packages > 0 then
1124 begin
1125 for i := 0 to packages - 1 do
1126 begin
1127 Result[i].SrcOffset := $20 + i*4;
1128 Result[i].DestID := -1;
1129 Result[i].PosDestExts := 'TXMP';
1130 end;
1131 end;
1132 end;
1133
1134
1135
1136 function TXMB(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1137 var
1138 packages: Integer;
1139 i: Integer;
1140 begin
1141 packages := 0;
1142 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
1143 SetLength(Result, packages);
1144 if packages > 0 then
1145 begin
1146 for i := 0 to packages - 1 do
1147 begin
1148 Result[i].SrcOffset := $20 + i*4;
1149 Result[i].DestID := -1;
1150 Result[i].PosDestExts := 'TXMP';
1151 end;
1152 end;
1153 end;
1154
1155
1156
1157 function TXMP(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1158 begin
1159 SetLength(Result, 2);
1160 Result[0].SrcOffset := $94;
1161 Result[0].DestID := -1;
1162 Result[0].PosDestExts := '*';
1163 Result[1].SrcOffset := $98;
1164 Result[1].DestID := -1;
1165 Result[1].PosDestExts := 'TXMP';
1166 end;
1167
1168
1169
1170 function TxtC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1171 begin
1172 SetLength(Result, 1);
1173 Result[0].SrcOffset := $08;
1174 Result[0].DestID := -1;
1175 Result[0].PosDestExts := 'IGPA';
1176 end;
1177
1178
1179
1180 function WMCL(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1181 var
1182 packages: Integer;
1183 i: Integer;
1184 begin
1185 packages := 0;
1186 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
1187 SetLength(Result, packages);
1188 if packages > 0 then
1189 begin
1190 for i := 0 to packages - 1 do
1191 begin
1192 Result[i].SrcOffset := $20 + i*8 + 4;
1193 Result[i].DestID := -1;
1194 Result[i].PosDestExts := '*';
1195 end;
1196 end;
1197 end;
1198
1199
1200
1201 function WMDD(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1202 var
1203 packages: Integer;
1204 i: Integer;
1205 begin
1206 packages := 0;
1207 Connection.LoadDatFilePart(fileid, $11C, 4, @packages);
1208 SetLength(Result, packages);
1209 if packages > 0 then
1210 begin
1211 for i := 0 to packages - 1 do
1212 begin
1213 Result[i].SrcOffset := $120 + i*292 + $134;
1214 Result[i].DestID := -1;
1215 Result[i].PosDestExts := 'TSFF';
1216 end;
1217 end;
1218 end;
1219
1220
1221
1222 function WMMB(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1223 var
1224 packages: Integer;
1225 i: Integer;
1226 begin
1227 packages := 0;
1228 Connection.LoadDatFilePart(fileid, $1C, 4, @packages);
1229 SetLength(Result, packages);
1230 if packages > 0 then
1231 begin
1232 for i := 0 to packages - 1 do
1233 begin
1234 Result[i].SrcOffset := $20 + i*4;
1235 Result[i].DestID := -1;
1236 Result[i].PosDestExts := 'WMM_';
1237 end;
1238 end;
1239 end;
1240
1241
1242
1243 function WPge(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1244 begin
1245 SetLength(Result, 2);
1246 Result[0].SrcOffset := $08;
1247 Result[0].DestID := -1;
1248 Result[0].PosDestExts := 'ONWC';
1249 Result[1].SrcOffset := $0C;
1250 Result[1].DestID := -1;
1251 Result[1].PosDestExts := 'IGPG';
1252 end;
1253
1254
1255
1256
1257
1258
1259
1260 function TDatLinks.GetDatLink(ConnectionID, FileID, DatOffset: Integer): TDatLink;
1261 var
1262 i: Integer;
1263 DatLinks: TDatLinkList;
1264 begin
1265 DatLinks := GetDatLinks(ConnectionID, FileID);
1266 Result.SrcOffset := -1;
1267 Result.DestID := -1;
1268 Result.PosDestExts := '';
1269 if Length(DatLinks) > 0 then
1270 begin
1271 for i := 0 to High(DatLinks) do
1272 begin
1273 if DatLinks[i].SrcOffset = DatOffset then
1274 begin
1275 Result.SrcOffset := DatOffset;
1276 Result.DestID := DatLinks[i].DestID;
1277 Result.PosDestExts := DatLinks[i].PosDestExts;
1278 Break;
1279 end;
1280 end;
1281 end;
1282 end;
1283
1284
1285 function TDatLinks.GetDatLinks(ConnectionID, FileID: Integer): TDatLinkList;
1286 var
1287 i: Integer;
1288 fileinfo: TFileInfo;
1289 begin
1290 SetLength(Result, 0);
1291 fileinfo := ConManager.Connection[ConnectionID].GetFileInfo(FileID);
1292 for i := 0 to High(FDatLinkHandlers) do
1293 if UpperCase(FDatLinkHandlers[i].Ext) = UpperCase(fileinfo.extension) then
1294 begin
1295 Result := FDatLinkHandlers[i].Handler(ConManager.Connection[ConnectionID], FileID);
1296 Break;
1297 end;
1298 end;
1299
1300 procedure TDatLinks.InsertDatLinkHandler(ext: String; handler: THandler);
1301 begin
1302 SetLength(FDatLinkHandlers, Length(FDatLinkHandlers) + 1);
1303 FDatLinkHandlers[High(FDatLinkHandlers)].Ext := ext;
1304 FDatLinkHandlers[High(FDatLinkHandlers)].handler := handler;
1305 end;
1306
1307
1308
1309
1310 initialization
1311 DatLinksManager := TDatLinks.Create;
1312 DatLinksManager.InsertDatLinkHandler('AISA', AISA);
1313 DatLinksManager.InsertDatLinkHandler('AKEV', AKEV);
1314 DatLinksManager.InsertDatLinkHandler('AKOT', AKOT);
1315 DatLinksManager.InsertDatLinkHandler('CBPI', AISA);
1316 DatLinksManager.InsertDatLinkHandler('CBPM', AKEV);
1317 DatLinksManager.InsertDatLinkHandler('CONS', AKOT);
1318 DatLinksManager.InsertDatLinkHandler('CRSA', AISA);
1319 DatLinksManager.InsertDatLinkHandler('DOOR', AKEV);
1320 DatLinksManager.InsertDatLinkHandler('DPge', AKOT);
1321 DatLinksManager.InsertDatLinkHandler('FILM', AISA);
1322 DatLinksManager.InsertDatLinkHandler('FXLR', AKEV);
1323 DatLinksManager.InsertDatLinkHandler('GMAN', AKOT);
1324 DatLinksManager.InsertDatLinkHandler('HPge', AISA);
1325 DatLinksManager.InsertDatLinkHandler('IGHH', AKEV);
1326 DatLinksManager.InsertDatLinkHandler('IGPA', AKOT);
1327 end.