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

Diff Legend

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