source: oup/current/Global/DatLinks.pas@ 122

Last change on this file since 122 was 122, checked in by alloc, 18 years ago
File size: 28.7 KB
Line 
1unit DatLinks;
2interface
3uses TypeDefs, DataAccess;
4
5type
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
24var
25 DatLinksManager: TDatLinks;
26
27
28implementation
29uses
30 ConnectionManager, Classes, SysUtils;
31
32
33
34function AISA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
35var
36 packages: Integer;
37 i: Integer;
38begin
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;
55end;
56
57
58
59function AKEV(Connection: TDataAccess; FileID: Integer): TDatLinkList;
60const
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');
64var
65 i: Integer;
66begin
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;
74end;
75
76
77
78function AKOT(Connection: TDataAccess; FileID: Integer): TDatLinkList;
79const
80 types: array[0..4] of String[4] =
81 ('OTIT', 'OTLF', 'QTNA', 'IDXA', 'IDXA');
82var
83 i: Integer;
84begin
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;
92end;
93
94
95
96function CBPI(Connection: TDataAccess; FileID: Integer): TDatLinkList;
97var
98 i: Integer;
99begin
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;
107end;
108
109
110
111function CBPM(Connection: TDataAccess; FileID: Integer): TDatLinkList;
112var
113 i: Integer;
114begin
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;
122end;
123
124
125
126function CONS(Connection: TDataAccess; FileID: Integer): TDatLinkList;
127const
128 types: array[0..1] of String[4] =
129 ('OFGA', 'M3GM');
130var
131 i: Integer;
132begin
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;
140end;
141
142
143
144function CRSA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
145var
146 packages: Integer;
147 i: Integer;
148begin
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;
161end;
162
163
164
165function DOOR(Connection: TDataAccess; FileID: Integer): TDatLinkList;
166const
167 types: array[0..2] of String[4] =
168 ('OFGA', 'OFGA', 'OBAN');
169var
170 i: Integer;
171begin
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;
179end;
180
181
182
183function DPge(Connection: TDataAccess; FileID: Integer): TDatLinkList;
184const
185 types: array[0..0] of String[4] =
186 ('IGPG');
187var
188 i: Integer;
189begin
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;
197end;
198
199
200
201function FILM(Connection: TDataAccess; FileID: Integer): TDatLinkList;
202const
203 types: array[0..1] of String[4] =
204 ('TRAM', 'TRAM');
205var
206 i: Integer;
207begin
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;
215end;
216
217
218
219function FXLR(Connection: TDataAccess; FileID: Integer): TDatLinkList;
220const
221 types: array[0..1] of String[4] =
222 ('TXMP', 'M3GM');
223var
224 i: Integer;
225begin
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;
233end;
234
235
236
237function GMAN(Connection: TDataAccess; FileID: Integer): TDatLinkList;
238var
239 packages: Integer;
240 i: Integer;
241begin
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;
254end;
255
256
257
258function HPge(Connection: TDataAccess; FileID: Integer): TDatLinkList;
259const
260 types: array[0..0] of String[4] =
261 ('IGPG');
262var
263 i: Integer;
264begin
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;
272end;
273
274
275
276function IGHH(Connection: TDataAccess; FileID: Integer): TDatLinkList;
277const
278 types: array[0..1] of String[4] =
279 ('TXMP', 'TXMP');
280var
281 i: Integer;
282begin
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;
290end;
291
292
293
294function IGPA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
295var
296 packages: Integer;
297 i: Integer;
298begin
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;
311end;
312
313
314
315function IGPG(Connection: TDataAccess; FileID: Integer): TDatLinkList;
316const
317 types: array[0..3] of String[4] =
318 ('TSFF', '*', 'IGSA', 'IGSA');
319var
320 i: Integer;
321begin
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;
333end;
334
335
336
337function IGSA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
338var
339 packages: Integer;
340 i: Integer;
341begin
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;
354end;
355
356
357
358function IGSt(Connection: TDataAccess; FileID: Integer): TDatLinkList;
359const
360 types: array[0..0] of String[4] =
361 ('TSFF');
362var
363 i: Integer;
364begin
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;
372end;
373
374
375
376function Impt(Connection: TDataAccess; FileID: Integer): TDatLinkList;
377const
378 types: array[0..0] of String[4] =
379 ('*');
380var
381 i: Integer;
382begin
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;
390end;
391
392
393
394function IPge(Connection: TDataAccess; FileID: Integer): TDatLinkList;
395const
396 types: array[0..0] of String[4] =
397 ('IGPG');
398var
399 i: Integer;
400begin
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;
408end;
409
410
411
412function KeyI(Connection: TDataAccess; FileID: Integer): TDatLinkList;
413var
414 i: Integer;
415begin
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;
423end;
424
425
426
427function M3GA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
428var
429 packages: Integer;
430 i: Integer;
431begin
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;
444end;
445
446
447
448function M3GM(Connection: TDataAccess; FileID: Integer): TDatLinkList;
449const
450 types: array[0..7] of String[4] =
451 ('PNTA', 'VCRA', 'VCRA', 'TXCA', 'IDXA', 'IDXA', 'TXMP', '*');
452var
453 i: Integer;
454begin
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;
462end;
463
464
465
466function Mtrl(Connection: TDataAccess; FileID: Integer): TDatLinkList;
467const
468 types: array[0..0] of String[4] =
469 ('*');
470var
471 i: Integer;
472begin
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;
480end;
481
482
483
484function OBDC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
485var
486 packages: Integer;
487 i: Integer;
488begin
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;
501end;
502
503
504
505function OBOA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
506var
507 packages: Integer;
508 i: Integer;
509begin
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;
530end;
531
532
533
534function OFGA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
535var
536 packages: Integer;
537 i: Integer;
538begin
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;
559end;
560
561
562
563function ONCC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
564var
565 i: Integer;
566begin
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';
608end;
609
610
611
612function ONCV(Connection: TDataAccess; FileID: Integer): TDatLinkList;
613begin
614 SetLength(Result, 1);
615 Result[0].SrcOffset := $8;
616 Result[0].DestID := -1;
617 Result[0].PosDestExts := '*';
618end;
619
620
621
622function ONLV(Connection: TDataAccess; FileID: Integer): TDatLinkList;
623const
624 types: array[0..12] of String[4] =
625 ('AKEV', 'OBOA', 'ONMA', 'ONFA', 'ONTA', 'ONSK', 'AISA', 'AITR',
626 'ONSA', 'OBDC', 'ONOA', 'ENVP', 'CRSA');
627var
628 i: Integer;
629begin
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];
646end;
647
648
649
650function ONOA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
651var
652 packages: Integer;
653 i: Integer;
654begin
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;
667end;
668
669
670
671function ONSK(Connection: TDataAccess; FileID: Integer): TDatLinkList;
672var
673 i: Integer;
674begin
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;
682end;
683
684
685
686function ONVL(Connection: TDataAccess; FileID: Integer): TDatLinkList;
687var
688 packages: Integer;
689 i: Integer;
690begin
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;
703end;
704
705
706
707function ONWC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
708var
709 i: Integer;
710begin
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';
748end;
749
750
751
752function OPge(Connection: TDataAccess; FileID: Integer): TDatLinkList;
753begin
754 SetLength(Result, 1);
755 Result[0].SrcOffset := $0C;
756 Result[0].DestID := -1;
757 Result[0].PosDestExts := 'IGPA';
758end;
759
760
761
762function PSpc(Connection: TDataAccess; FileID: Integer): TDatLinkList;
763begin
764 SetLength(Result, 1);
765 Result[0].SrcOffset := $50;
766 Result[0].DestID := -1;
767 Result[0].PosDestExts := '*';
768end;
769
770
771
772function PSpL(Connection: TDataAccess; FileID: Integer): TDatLinkList;
773var
774 packages: Integer;
775 i: Integer;
776begin
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;
789end;
790
791
792
793function PSUI(Connection: TDataAccess; FileID: Integer): TDatLinkList;
794var
795 i: Integer;
796begin
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;
804end;
805
806
807
808function StNA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
809var
810 packages: Integer;
811 i: Integer;
812begin
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;
825end;
826
827
828
829function TMRA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
830var
831 packages: Integer;
832 i: Integer;
833begin
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;
846end;
847
848
849
850function TRAC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
851var
852 packages: Integer;
853 i: Integer;
854begin
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;
870end;
871
872
873
874function TRAM(Connection: TDataAccess; FileID: Integer): TDatLinkList;
875var
876 i: Integer;
877begin
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;
885end;
886
887
888
889function TRAS(Connection: TDataAccess; FileID: Integer): TDatLinkList;
890begin
891 SetLength(Result, 1);
892 Result[0].SrcOffset := $08;
893 Result[0].DestID := -1;
894 Result[0].PosDestExts := 'TRAM';
895end;
896
897
898
899function TRBS(Connection: TDataAccess; FileID: Integer): TDatLinkList;
900var
901 i: Integer;
902begin
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;
910end;
911
912
913
914function TRCM(Connection: TDataAccess; FileID: Integer): TDatLinkList;
915const
916 types: array[0..2] of String[4] =
917 ('TRGA', 'TRTA', 'TRIA');
918var
919 i: Integer;
920begin
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;
928end;
929
930
931
932function TRGA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
933var
934 packages: Integer;
935 i: Integer;
936begin
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;
949end;
950
951
952
953function TRGE(Connection: TDataAccess; FileID: Integer): TDatLinkList;
954begin
955 SetLength(Result, 1);
956 Result[0].SrcOffset := $20;
957 Result[0].DestID := -1;
958 Result[0].PosDestExts := 'M3GM';
959end;
960
961
962
963function TRIG(Connection: TDataAccess; FileID: Integer): TDatLinkList;
964const
965 types: array[0..3] of String[4] =
966 ('M3GM', 'OBLS', 'TRGE', 'OBAN');
967var
968 i: Integer;
969begin
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;
983end;
984
985
986
987function TRMA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
988var
989 packages: Integer;
990 i: Integer;
991begin
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;
1004end;
1005
1006
1007
1008function TRSC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1009var
1010 packages: Integer;
1011 i: Integer;
1012begin
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;
1025end;
1026
1027
1028
1029function TSFF(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1030var
1031 packages: Integer;
1032 i: Integer;
1033begin
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;
1050end;
1051
1052
1053
1054function TSFT(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1055var
1056 i: Integer;
1057begin
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;
1065end;
1066
1067
1068
1069function TURR(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1070var
1071 i: Integer;
1072begin
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';
1090end;
1091
1092
1093
1094function TXAN(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1095var
1096 packages: Integer;
1097 i: Integer;
1098begin
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;
1111end;
1112
1113
1114
1115function TXMA(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1116var
1117 packages: Integer;
1118 i: Integer;
1119begin
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;
1132end;
1133
1134
1135
1136function TXMB(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1137var
1138 packages: Integer;
1139 i: Integer;
1140begin
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;
1153end;
1154
1155
1156
1157function TXMP(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1158begin
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';
1166end;
1167
1168
1169
1170function TxtC(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1171begin
1172 SetLength(Result, 1);
1173 Result[0].SrcOffset := $08;
1174 Result[0].DestID := -1;
1175 Result[0].PosDestExts := 'IGPA';
1176end;
1177
1178
1179
1180function WMCL(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1181var
1182 packages: Integer;
1183 i: Integer;
1184begin
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;
1197end;
1198
1199
1200
1201function WMDD(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1202var
1203 packages: Integer;
1204 i: Integer;
1205begin
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;
1218end;
1219
1220
1221
1222function WMMB(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1223var
1224 packages: Integer;
1225 i: Integer;
1226begin
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;
1239end;
1240
1241
1242
1243function WPge(Connection: TDataAccess; FileID: Integer): TDatLinkList;
1244begin
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';
1252end;
1253
1254
1255
1256
1257
1258
1259
1260function TDatLinks.GetDatLink(ConnectionID, FileID, DatOffset: Integer): TDatLink;
1261var
1262 i: Integer;
1263 DatLinks: TDatLinkList;
1264begin
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;
1282end;
1283
1284
1285function TDatLinks.GetDatLinks(ConnectionID, FileID: Integer): TDatLinkList;
1286var
1287 i: Integer;
1288 fileinfo: TFileInfo;
1289begin
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;
1298end;
1299
1300procedure TDatLinks.InsertDatLinkHandler(ext: String; handler: THandler);
1301begin
1302 SetLength(FDatLinkHandlers, Length(FDatLinkHandlers) + 1);
1303 FDatLinkHandlers[High(FDatLinkHandlers)].Ext := ext;
1304 FDatLinkHandlers[High(FDatLinkHandlers)].handler := handler;
1305end;
1306
1307
1308
1309
1310initialization
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);
1327end.
Note: See TracBrowser for help on using the repository browser.