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

Comparing oup/current/Global/RawList.pas (file contents):
Revision 144 by alloc, Sun Apr 1 14:44:32 2007 UTC vs.
Revision 241 by alloc, Tue Jul 17 22:27:16 2007 UTC

# Line 29 | Line 29 | var
29   implementation
30  
31   uses
32 <  Template, ConnectionManager, Access_OniArchive, Classes, SysUtils, Math;
32 >  ConnectionManager, Access_OniArchive, Classes, SysUtils, Math, _TemplateFile;
33  
34  
35   function AGDB(ConnectionID, FileID: Integer): TRawDataList;
# Line 43 | Line 43 | begin
43    SetLength(Result, links);
44    for i := 0 to links - 1 do
45    begin
46 +    Result[i].Name    := '<TBD>';
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 +    Result[i].RawType := 'AGDB' + IntToStr(i mod 2);
53    end;
54   end;
55  
# Line 64 | Line 66 | begin
66    SetLength(Result, links);
67    for i := 0 to links - 1 do
68    begin
69 +    Result[i].Name    := '<TBD>';
70      Result[i].SrcOffset := $20 + i * $74 + $24;
71      ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20 + i * $74 + $24, 4, @link);
72      Result[i].RawAddr := link;
73      ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20 + i * $74 + $28, 4, @link);
74      Result[i].RawSize := link;
75      Result[i].LocSep  := False;
76 +    Result[i].RawType := 'AKVA';
77    end;
78   end;
79  
# Line 84 | Line 88 | begin
88    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $0C, 4, @link);
89    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $08, 4, @datasize);
90    SetLength(Result, 1);
91 +  Result[0].Name      := 'Binary data';
92    Result[0].SrcOffset := $0C;
93    Result[0].RawAddr   := link;
94    Result[0].RawSize   := datasize;
95    Result[0].LocSep    := not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN);
96 +  Result[0].RawType   := 'BINA';
97   end;
98  
99  
# Line 101 | Line 107 | begin
107    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $08, 4, @datasize);
108    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $0C, 4, @link);
109    SetLength(Result, 1);
110 +  Result[0].Name      := 'Sound Binary Data';
111    Result[0].SrcOffset := $0C;
112    Result[0].RawAddr   := link;
113    Result[0].RawSize   := datasize;
114 <  Result[0].LocSep     := not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN);
114 >  Result[0].LocSep    := not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN);
115 >  Result[0].RawType   := 'OSBD';
116   end;
117  
118  
# Line 116 | Line 124 | var
124    datasize: Integer;
125   begin
126    SetLength(Result, 1);
127 <  if ConManager.Connection[ConnectionID].DataOS = DOS_MAC then
127 >  if ConManager.Connection[ConnectionID].DataOS in [DOS_MACBETA, DOS_MAC] then
128    begin
129      ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $10, 4, @datasize);
130      ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $14, 4, @link);
# Line 128 | Line 136 | begin
136      ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $44, 4, @link);
137      Result[0].SrcOffset := $44;
138    end;
139 +  Result[0].Name    := 'Sound data';
140    Result[0].RawAddr := link;
141    Result[0].RawSize := datasize;
142    Result[0].LocSep  := False;
143 +  Result[0].RawType := 'SNDD';
144   end;
145  
146  
# Line 141 | Line 151 | var
151    baselink, lastlink: Integer;
152    links: Integer;
153    Data:  TStream;
154 +  read:  Integer;
155 +  char:  Byte;
156 +  foundzeros: Byte;
157   begin
158 +  SetLength(Result, 0);
159 +
160    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $18, 4, @baselink);
161    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @links);
162    if links > 0 then
163    begin
164      ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20 + (links - 1) * 4, 4, @lastlink);
150 //    SetLength(Data, lastlink + 1024);
165      Data := nil;
166      TAccess_OniArchive(ConManager.Connection[ConnectionID]).LoadRawOffset(
167            False, baselink, lastlink + 1024, Data);
168 < //    TOniDataDat(connection).LoadRawOffset(False, baselink, lastlink + 1024, Data);
169 <    //      connection.LoadRawFile(fileid,$1C,baselink,lastlink+1024,False,@data[0]);
170 <    raise ENotImplemented.Create('RawList.SUBT');
171 <  end;
172 < {
173 <    k := 0;
160 <    for j := 0 to 1024 do
161 <    begin
162 <      if (Data[lastlink + j] = $00) or (j = 1024) then
168 >    Data.Seek(lastlink, soFromBeginning);
169 >
170 >    foundzeros := 0;
171 >    repeat
172 >      read := Data.Read(char, 1);
173 >      if (read > 0) and (char = 0) then
174        begin
175 <        if j < 1024 then
165 <        begin
166 <          if k = 0 then
167 <          begin
168 <            k := 1;
169 <          end
170 <          else
171 <          begin
172 <            SetLength(Result, 1);
173 <            Result[0].src_offset := $18;
174 <            Result[0].raw_addr   := baselink;
175 <            Result[0].raw_size   := lastlink + j;
176 <            Break;
177 <          end;
178 <        end;
175 >        Inc(foundzeros);
176        end;
177 +    until (read = 0) or (foundzeros = 2);
178 +
179 +    if foundzeros = 2 then
180 +    begin
181 +      SetLength(Result, 1);
182 +      Result[0].Name      := 'Subtitles';
183 +      Result[0].SrcID     := FileID;
184 +      Result[0].SrcOffset := $18;
185 +      Result[0].RawAddr   := baselink;
186 +      Result[0].RawSize   := Data.Position;
187 +      Result[0].LocSep    := False;
188 +      Result[0].RawType   := 'SUBT';
189      end;
190    end;
182 }
191   end;
192  
193  
# Line 195 | Line 203 | var
203    templ:  Integer;
204    Data:   TByteData;
205    offset: Word;
206 <  frame_count: Byte;
206 >  frame_count: Integer;
207   begin
208    SetLength(Result, 13);
209    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $16C, 2, @frames);
210    {y-pos}
211    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $0C, 4, @link);
212 +  Result[0].Name      := 'y-pos';
213    Result[0].SrcOffset := $0C;
214    Result[0].RawAddr   := link;
215    Result[0].RawSize   := frames * 4;
216 +  Result[0].RawType   := 'TRAM0';
217    {x-z-pos}
218    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $10, 4, @link);
219 +  Result[1].Name      := 'x-z-pos';
220    Result[1].SrcOffset := $10;
221    Result[1].RawAddr   := link;
222    Result[1].RawSize   := frames * 8;
223 +  Result[1].RawType   := 'TRAM1';
224    {attacks}
225    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $182, 1, @tempb);
226    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $14, 4, @link);
227 +  Result[2].Name      := 'Attacks';
228    Result[2].SrcOffset := $14;
229    Result[2].RawAddr   := link;
230    Result[2].RawSize   := tempb * 32;
231 +  Result[2].RawType   := 'TRAM2';
232    {damage}
233    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $183, 1, @tempb);
234    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $18, 4, @link);
235 +  Result[3].Name      := 'Damage';
236    Result[3].SrcOffset := $18;
237    Result[3].RawAddr   := link;
238    Result[3].RawSize   := tempb * 8;
239 +  Result[3].RawType   := 'TRAM3';
240    {motionblur}
241    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $184, 1, @tempb);
242    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @link);
243 +  Result[4].Name      := 'MotionBlur';
244    Result[4].SrcOffset := $1C;
245    Result[4].RawAddr   := link;
246 <  Result[4].RawSize   := tempb * 8;
246 >  Result[4].RawSize   := tempb * 12;
247 >  Result[4].RawType   := 'TRAM4';
248    {shortcut}
249    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $185, 1, @tempb);
250    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20, 4, @link);
251 +  Result[5].Name      := 'Shortcut';
252    Result[5].SrcOffset := $20;
253    Result[5].RawAddr   := link;
254    Result[5].RawSize   := tempb * 8;
255 +  Result[5].RawType   := 'TRAM5';
256    {throw}
257    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $24, 4, @link);
258 +  Result[6].Name      := 'Throw';
259    Result[6].SrcOffset := $24;
260    Result[6].RawAddr   := link;
261 <  if link > 0 then
262 <    Result[6].RawSize := 24
242 <  else
243 <    Result[6].RawSize := 0;
261 >  Result[6].RawSize := 24;
262 >  Result[6].RawType   := 'TRAM6';
263    {footstep}
264    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $186, 1, @tempb);
265    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $28, 4, @link);
266 +  Result[7].Name      := 'Footstep';
267    Result[7].SrcOffset := $28;
268    Result[7].RawAddr   := link;
269    Result[7].RawSize   := tempb * 4;
270 +  Result[7].RawType   := 'TRAM7';
271    {particle}
272    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $187, 1, @tempb);
273    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $2C, 4, @link);
274 +  Result[8].Name      := 'Particle';
275    Result[8].SrcOffset := $2C;
276    Result[8].RawAddr   := link;
277    Result[8].RawSize   := tempb * 24;
278 +  Result[8].RawType   := 'TRAM8';
279    {position}
280    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $30, 4, @link);
281 +  Result[9].Name      := 'Position';
282    Result[9].SrcOffset := $30;
283    Result[9].RawAddr   := link;
284    Result[9].RawSize   := frames * 8;
285 <  {particle}
285 >  Result[9].RawType   := 'TRAM9';
286 >  {sound}
287    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $154, 2, @tempw);
288    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $38, 4, @link);
289 +  Result[11].Name      := 'Sound';
290    Result[11].SrcOffset := $38;
291    Result[11].RawAddr   := link;
292    Result[11].RawSize   := tempw * 34;
293 +  Result[11].RawType   := 'TRAM11';
294    {extent}
295    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $138, 4, @templ);
296    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $13C, 4, @link);
297 +  Result[12].Name      := 'Extent';
298    Result[12].SrcOffset := $13C;
299    Result[12].RawAddr   := link;
300    Result[12].RawSize   := templ * 12;
301 +  Result[12].RawType   := 'TRAM12';
302  
303    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $34, 4, @link);
304    if link > 0 then
# Line 297 | Line 326 | begin
326        Result[10].RawSize := 0;
327      end;
328    end;
329 +  Result[10].Name      := 'BodyParts Animation';
330    Result[10].SrcOffset := $34;
331    Result[10].RawAddr   := link;
332 +  Result[10].RawType   := 'TRAM10';
333   end;
334  
335  
# Line 357 | Line 388 | begin
388      Result[0].SrcOffset := $A0;
389      Result[0].RawAddr   := link_mac;
390    end;
391 +  Result[0].Name    := 'ImageData';
392    Result[0].RawSize := datasize;
393    Result[0].LocSep  := not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN);
394 +  Result[0].RawType   := 'TXMP';
395   end;
396  
397  
# Line 371 | Line 404 | var
404    RawList: TRawDataList;
405   begin
406    RawList          := GetRawList(ConnectionID, FileID);
407 +  Result.Name      := '';
408    Result.SrcID     := -1;
409    Result.SrcOffset := -1;
410    Result.RawAddr   := -1;
411    Result.RawSize   := -1;
412 +  Result.RawType   := '';
413    if Length(RawList) > 0 then
414    begin
415      for i := 0 to High(RawList) do
416      begin
417        if RawList[i].SrcOffset = DatOffset then
418        begin
419 +        Result.Name      := RawList[i].Name;
420          Result.SrcID     := FileID;
421          Result.SrcOffset := RawList[i].SrcOffset;
422          Result.RawAddr   := RawList[i].RawAddr;
423          Result.RawSize   := RawList[i].RawSize;
424          Result.LocSep    := RawList[i].LocSep;
425 +        Result.RawType   := RawList[i].RawType;
426          Break;
427        end;
428      end;
# Line 407 | Line 444 | begin
444          Result := FRawListHandlers[i].Handler(ConnectionID, FileID);
445        Break;
446      end;
447 +  if Length(Result) > 0 then
448 +    for i := 0 to High(Result) do
449 +      if Result[i].RawAddr = 0 then
450 +        Result[i].RawSize := 0;
451   end;
452  
453   procedure TRawLists.InsertRawListHandler(ext: String; needed: Boolean; handler: THandler);
# Line 424 | Line 465 | end;
465  
466   initialization
467    RawLists := TRawLists.Create;
468 <  RawLists.InsertRawListHandler('AGDB', True, AGDB);
468 >  RawLists.InsertRawListHandler('AGDB', False, AGDB);
469    RawLists.InsertRawListHandler('AKVA', True, AKVA);
470    RawLists.InsertRawListHandler('BINA', True, BINA);
471    RawLists.InsertRawListHandler('OSBD', True, OSBD);

Diff Legend

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