source: oup/releases/0.34b/Global/DatLinks.pas@ 455

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