ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Global/RawList.pas
(Generate patch)

Comparing:
oup/rewrite/Global/RawList.pas (file contents), Revision 97 by alloc, Mon Jan 22 23:05:45 2007 UTC vs.
oup/current/Global/RawList.pas (file contents), Revision 109 by alloc, Wed Feb 21 03:12:33 2007 UTC

# Line 2 | Line 2 | unit RawList;
2  
3   interface
4  
5 < uses TypeDefs, ConnectionManager;
5 > uses TypeDefs;
6  
7   type
8    THandler = function(ConnectionID, FileID: Integer): TRawDataList;
9 <  TRawListHandlers = record
9 >  TRawListHandler = record
10      Ext:     String[4];
11      needed:  Boolean;
12      Handler: THandler;
13    end;
14 +  TRawListHandlers = array of TRawListHandler;
15  
16    TRawLists = class
17      private
18        FRawListHandlers: TRawListHandlers;
19      public
20 +      property RawListHandlers: TRawListHandlers read FRawListHandlers;
21        procedure InsertRawListHandler(ext: String; needed: Boolean; handler: THandler);
22        function GetRawList(ConnectionID, FileID: Integer): TRawDataList;
23        function GetRawInfo(ConnectionID, FileID, DatOffset: Integer): TRawDataInfo;
# Line 24 | Line 26 | type
26  
27   var
28    RawLists: TRawLists;
29 <  
29 >
30  
31   implementation
32  
33   uses
34 <  Template;
34 >  Template, ConnectionManager, Access_OniArchive, Classes, SysUtils;
35  
36  
37   function AGDB(ConnectionID, FileID: Integer): TRawDataList;
# Line 38 | Line 40 | var
40    links: Integer;
41    i:     Integer;
42   begin
43 <  if not connection.OSisMac then
43 >  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @links);
44 >  links := links * 2;
45 >  SetLength(Result, links);
46 >  for i := 0 to links - 1 do
47    begin
48 <    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @links);
49 <    links := links * 2;
50 <    SetLength(Result, links);
51 <    for i := 0 to links - 1 do
52 <    begin
48 <      Result[i].src_offset := $20 + i * 4;
49 <      ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20 + i * 4, 4, @link);
50 <      Result[i].raw_addr := link;
51 <      Result[i].raw_size := 32;
52 <      Result[i].loc_sep  := False;
53 <    end;
48 >    Result[i].SrcOffset := $20 + i * 4;
49 >    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20 + i * 4, 4, @link);
50 >    Result[i].RawAddr := link;
51 >    Result[i].RawSize := 32;
52 >    Result[i].LocSep  := False;
53    end;
54   end;
55  
# Line 63 | Line 62 | var
62    links: Integer;
63    i:     Integer;
64   begin
65 <  if not connection.OSisMac then
65 >  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @links);
66 >  SetLength(Result, links);
67 >  for i := 0 to links - 1 do
68    begin
69 <    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @links);
70 <    SetLength(Result, links);
71 <    for i := 0 to links - 1 do
72 <    begin
73 <      Result[i].src_offset := $20 + i * $74 + $24;
74 <      ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20 + i * $74 + $24, 4, @link);
74 <      Result[i].raw_addr := link;
75 <      ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20 + i * $74 + $28, 4, @link);
76 <      Result[i].raw_size := link;
77 <      Result[i].loc_sep  := False;
78 <    end;
69 >    Result[i].SrcOffset := $20 + i * $74 + $24;
70 >    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20 + i * $74 + $24, 4, @link);
71 >    Result[i].RawAddr := link;
72 >    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20 + i * $74 + $28, 4, @link);
73 >    Result[i].RawSize := link;
74 >    Result[i].LocSep  := False;
75    end;
76   end;
77  
# Line 90 | Line 86 | begin
86    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $0C, 4, @link);
87    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $08, 4, @datasize);
88    SetLength(Result, 1);
89 <  Result[0].src_offset := $0C;
90 <  Result[0].raw_addr   := link;
91 <  Result[0].raw_size   := datasize;
92 <  Result[0].loc_sep    := connection.OSisMac;
89 >  Result[0].SrcOffset := $0C;
90 >  Result[0].RawAddr   := link;
91 >  Result[0].RawSize   := datasize;
92 >  Result[0].LocSep    := not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN);
93   end;
94  
95  
# Line 107 | Line 103 | begin
103    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $08, 4, @datasize);
104    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $0C, 4, @link);
105    SetLength(Result, 1);
106 <  Result[0].src_offset := $0C;
107 <  Result[0].raw_addr   := link;
108 <  Result[0].raw_size   := datasize;
109 <  Result[0].loc_sep    := connection.OSisMac;
106 >  Result[0].SrcOffset := $0C;
107 >  Result[0].RawAddr   := link;
108 >  Result[0].RawSize   := datasize;
109 >  Result[0].LocSep     := not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN);
110   end;
111  
112  
# Line 122 | Line 118 | var
118    datasize: Integer;
119   begin
120    SetLength(Result, 1);
121 <  if not connection.OSisMac then
121 >  if ConManager.Connection[ConnectionID].DataOS = DOS_MAC then
122    begin
123 <    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $40, 4, @datasize);
124 <    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $44, 4, @link);
125 <    Result[0].src_offset := $44;
123 >    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $10, 4, @datasize);
124 >    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $14, 4, @link);
125 >    Result[0].SrcOffset := $14;
126    end
127    else
128    begin
129 <    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $10, 4, @datasize);
130 <    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $14, 4, @link);
131 <    Result[0].src_offset := $14;
129 >    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $40, 4, @datasize);
130 >    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $44, 4, @link);
131 >    Result[0].SrcOffset := $44;
132    end;
133 <  Result[0].raw_addr := link;
134 <  Result[0].raw_size := datasize;
135 <  Result[0].loc_sep  := False;
133 >  Result[0].RawAddr := link;
134 >  Result[0].RawSize := datasize;
135 >  Result[0].LocSep  := False;
136   end;
137  
138  
# Line 147 | Line 143 | var
143    baselink, lastlink: Integer;
144    links: Integer;
145    j, k:  Integer;
146 <  Data:  TByteData;
146 > //  Data:  TByteData;
147 >  Data:  TStream;
148   begin
149    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $18, 4, @baselink);
150    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @links);
151    if links > 0 then
152    begin
153      ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20 + (links - 1) * 4, 4, @lastlink);
154 <    SetLength(Data, lastlink + 1024);
155 <    TOniDataDat(connection).LoadRawOffset(False,
156 <      baselink, lastlink + 1024, Data);
154 > //    SetLength(Data, lastlink + 1024);
155 >    Data := nil;
156 >    TAccess_OniArchive(ConManager.Connection[ConnectionID]).LoadRawOffset(
157 >          False, baselink, lastlink + 1024, Data);
158 > //    TOniDataDat(connection).LoadRawOffset(False, baselink, lastlink + 1024, Data);
159      //      connection.LoadRawFile(fileid,$1C,baselink,lastlink+1024,False,@data[0]);
160 +    raise ENotImplemented.Create('RawList.SUBT');
161 +  end;
162 + {
163      k := 0;
164      for j := 0 to 1024 do
165      begin
# Line 181 | Line 183 | begin
183        end;
184      end;
185    end;
186 + }
187   end;
188  
189  
# Line 202 | Line 205 | begin
205    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $16C, 2, @frames);
206    {y-pos}
207    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $0C, 4, @link);
208 <  Result[0].src_offset := $0C;
209 <  Result[0].raw_addr   := link;
210 <  Result[0].raw_size   := frames * 4;
208 >  Result[0].SrcOffset := $0C;
209 >  Result[0].RawAddr   := link;
210 >  Result[0].RawSize   := frames * 4;
211    {x-z-pos}
212    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $10, 4, @link);
213 <  Result[1].src_offset := $10;
214 <  Result[1].raw_addr   := link;
215 <  Result[1].raw_size   := frames * 8;
213 >  Result[1].SrcOffset := $10;
214 >  Result[1].RawAddr   := link;
215 >  Result[1].RawSize   := frames * 8;
216    {attacks}
217    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $182, 1, @tempb);
218    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $14, 4, @link);
219 <  Result[2].src_offset := $14;
220 <  Result[2].raw_addr   := link;
221 <  Result[2].raw_size   := tempb * 32;
219 >  Result[2].SrcOffset := $14;
220 >  Result[2].RawAddr   := link;
221 >  Result[2].RawSize   := tempb * 32;
222    {damage}
223    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $183, 1, @tempb);
224    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $18, 4, @link);
225 <  Result[3].src_offset := $18;
226 <  Result[3].raw_addr   := link;
227 <  Result[3].raw_size   := tempb * 8;
225 >  Result[3].SrcOffset := $18;
226 >  Result[3].RawAddr   := link;
227 >  Result[3].RawSize   := tempb * 8;
228    {motionblur}
229    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $184, 1, @tempb);
230    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @link);
231 <  Result[4].src_offset := $1C;
232 <  Result[4].raw_addr   := link;
233 <  Result[4].raw_size   := tempb * 8;
231 >  Result[4].SrcOffset := $1C;
232 >  Result[4].RawAddr   := link;
233 >  Result[4].RawSize   := tempb * 8;
234    {shortcut}
235    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $185, 1, @tempb);
236    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20, 4, @link);
237 <  Result[5].src_offset := $20;
238 <  Result[5].raw_addr   := link;
239 <  Result[5].raw_size   := tempb * 8;
237 >  Result[5].SrcOffset := $20;
238 >  Result[5].RawAddr   := link;
239 >  Result[5].RawSize   := tempb * 8;
240    {throw}
241    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $24, 4, @link);
242 <  Result[6].src_offset := $24;
243 <  Result[6].raw_addr   := link;
242 >  Result[6].SrcOffset := $24;
243 >  Result[6].RawAddr   := link;
244    if link > 0 then
245 <    Result[6].raw_size := 24
245 >    Result[6].RawSize := 24
246    else
247 <    Result[6].raw_size := 0;
247 >    Result[6].RawSize := 0;
248    {footstep}
249    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $186, 1, @tempb);
250    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $28, 4, @link);
251 <  Result[7].src_offset := $28;
252 <  Result[7].raw_addr   := link;
253 <  Result[7].raw_size   := tempb * 4;
251 >  Result[7].SrcOffset := $28;
252 >  Result[7].RawAddr   := link;
253 >  Result[7].RawSize   := tempb * 4;
254    {particle}
255    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $187, 1, @tempb);
256    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $2C, 4, @link);
257 <  Result[8].src_offset := $2C;
258 <  Result[8].raw_addr   := link;
259 <  Result[8].raw_size   := tempb * 24;
257 >  Result[8].SrcOffset := $2C;
258 >  Result[8].RawAddr   := link;
259 >  Result[8].RawSize   := tempb * 24;
260    {position}
261    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $30, 4, @link);
262 <  Result[9].src_offset := $30;
263 <  Result[9].raw_addr   := link;
264 <  Result[9].raw_size   := frames * 8;
262 >  Result[9].SrcOffset := $30;
263 >  Result[9].RawAddr   := link;
264 >  Result[9].RawSize   := frames * 8;
265    {particle}
266    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $154, 2, @tempw);
267    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $38, 4, @link);
268 <  Result[11].src_offset := $38;
269 <  Result[11].raw_addr   := link;
270 <  Result[11].raw_size   := tempw * 34;
268 >  Result[11].SrcOffset := $38;
269 >  Result[11].RawAddr   := link;
270 >  Result[11].RawSize   := tempw * 34;
271    {extent}
272    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $138, 4, @templ);
273    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $13C, 4, @link);
274 <  Result[12].src_offset := $13C;
275 <  Result[12].raw_addr   := link;
276 <  Result[12].raw_size   := templ * 12;
274 >  Result[12].SrcOffset := $13C;
275 >  Result[12].RawAddr   := link;
276 >  Result[12].RawSize   := templ * 12;
277  
278    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $34, 4, @link);
279    if link > 0 then
# Line 279 | Line 282 | begin
282      frame_count := 0;
283      i := 0;
284      SetLength(Data, $FFFF);
285 <    TOniDataDat(connection).LoadRawOffset(False, link, $FFFF, Data);
285 >    TAccess_OniArchive(ConManager.Connection[ConnectionID]).LoadRawOffset(
286 >          False, link, $FFFF, Data);
287      offset := Data[$24] + Data[$25] * 256;
288      while (offset + i < Length(Data)) and (frame_count < frames - 1) do
289      begin
# Line 290 | Line 294 | begin
294      if offset + i < Length(Data) then
295      begin
296        Inc(i, tempw);
297 <      Result[10].raw_size := offset + i;
297 >      Result[10].RawSize := offset + i;
298      end
299      else
300      begin
301 <      Result[10].raw_size := 0;
301 >      Result[10].RawSize := 0;
302      end;
303    end;
304 <  Result[10].src_offset := $34;
305 <  Result[10].raw_addr   := link;
304 >  Result[10].SrcOffset := $34;
305 >  Result[10].RawAddr   := link;
306   end;
307  
308  
# Line 326 | Line 330 | begin
330        datasize := x * y div 2;
331    end;
332    SetLength(Result, 1);
333 <  if not connection.OSisMac then
333 >  if ConManager.Connection[ConnectionID].DataOS = DOS_WIN then
334    begin
335 <    Result[0].src_offset := $9C;
336 <    Result[0].raw_addr   := link_pc;
335 >    Result[0].SrcOffset := $9C;
336 >    Result[0].RawAddr   := link_pc;
337    end
338    else
339    begin
340 <    Result[0].src_offset := $A0;
341 <    Result[0].raw_addr   := link_mac;
340 >    Result[0].SrcOffset := $A0;
341 >    Result[0].RawAddr   := link_mac;
342    end;
343 <  Result[0].raw_size := datasize;
344 <  Result[0].loc_sep  := connection.OSisMac;
343 >  Result[0].RawSize := datasize;
344 >  Result[0].LocSep  := not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN);
345   end;
346  
347  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)