Changeset 101 for oup/rewrite/Global


Ignore:
Timestamp:
Feb 20, 2007, 9:43:29 PM (18 years ago)
Author:
alloc
Message:
 
Location:
oup/rewrite/Global
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • oup/rewrite/Global/OniImgClass.pas

    r97 r101  
    700700var
    701701  data: TByteData;
     702  streampos: Integer;
    702703begin
    703704  GetAsBMP(data);
     705  streampos := Target.Position;
    704706  Target.Write(data[0], Length(data));
     707  Target.Seek(streampos, soFromBeginning);
    705708end;
    706709
  • oup/rewrite/Global/RawList.pas

    r97 r101  
    33interface
    44
    5 uses TypeDefs, ConnectionManager;
     5uses TypeDefs;
    66
    77type
    88  THandler = function(ConnectionID, FileID: Integer): TRawDataList;
    9   TRawListHandlers = record
     9  TRawListHandler = record
    1010    Ext:     String[4];
    1111    needed:  Boolean;
    1212    Handler: THandler;
    1313  end;
     14  TRawListHandlers = array of TRawListHandler;
    1415
    1516  TRawLists = class
     
    2526var
    2627  RawLists: TRawLists;
    27  
     28
    2829
    2930implementation
    3031
    3132uses
    32   Template;
     33  Template, ConnectionManager, Access_OniArchive, Classes, SysUtils;
    3334
    3435
     
    3940  i:     Integer;
    4041begin
    41   if not connection.OSisMac then
    42   begin
    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       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;
     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    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;
    5452  end;
    5553end;
     
    6462  i:     Integer;
    6563begin
    66   if not connection.OSisMac then
    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;
     64  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @links);
     65  SetLength(Result, links);
     66  for i := 0 to links - 1 do
     67  begin
     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;
    7974  end;
    8075end;
     
    9186  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $08, 4, @datasize);
    9287  SetLength(Result, 1);
    93   Result[0].src_offset := $0C;
    94   Result[0].raw_addr   := link;
    95   Result[0].raw_size   := datasize;
    96   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);
    9792end;
    9893
     
    108103  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $0C, 4, @link);
    109104  SetLength(Result, 1);
    110   Result[0].src_offset := $0C;
    111   Result[0].raw_addr   := link;
    112   Result[0].raw_size   := datasize;
    113   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);
    114109end;
    115110
     
    123118begin
    124119  SetLength(Result, 1);
    125   if not connection.OSisMac then
     120  if ConManager.Connection[ConnectionID].DataOS = DOS_MAC then
     121  begin
     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
    126127  begin
    127128    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $40, 4, @datasize);
    128129    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $44, 4, @link);
    129     Result[0].src_offset := $44;
    130   end
    131   else
    132   begin
    133     ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $10, 4, @datasize);
    134     ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $14, 4, @link);
    135     Result[0].src_offset := $14;
    136   end;
    137   Result[0].raw_addr := link;
    138   Result[0].raw_size := datasize;
    139   Result[0].loc_sep  := False;
     130    Result[0].SrcOffset := $44;
     131  end;
     132  Result[0].RawAddr := link;
     133  Result[0].RawSize := datasize;
     134  Result[0].LocSep  := False;
    140135end;
    141136
     
    148143  links: Integer;
    149144  j, k:  Integer;
    150   Data:  TByteData;
     145//  Data:  TByteData;
     146  Data:  TStream;
    151147begin
    152148  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $18, 4, @baselink);
     
    155151  begin
    156152    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20 + (links - 1) * 4, 4, @lastlink);
    157     SetLength(Data, lastlink + 1024);
    158     TOniDataDat(connection).LoadRawOffset(False,
    159       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);
    160158    //      connection.LoadRawFile(fileid,$1C,baselink,lastlink+1024,False,@data[0]);
     159    raise ENotImplemented.Create('RawList.SUBT');
     160  end;
     161{
    161162    k := 0;
    162163    for j := 0 to 1024 do
     
    182183    end;
    183184  end;
     185}
    184186end;
    185187
     
    203205  {y-pos}
    204206  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $0C, 4, @link);
    205   Result[0].src_offset := $0C;
    206   Result[0].raw_addr   := link;
    207   Result[0].raw_size   := frames * 4;
     207  Result[0].SrcOffset := $0C;
     208  Result[0].RawAddr   := link;
     209  Result[0].RawSize   := frames * 4;
    208210  {x-z-pos}
    209211  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $10, 4, @link);
    210   Result[1].src_offset := $10;
    211   Result[1].raw_addr   := link;
    212   Result[1].raw_size   := frames * 8;
     212  Result[1].SrcOffset := $10;
     213  Result[1].RawAddr   := link;
     214  Result[1].RawSize   := frames * 8;
    213215  {attacks}
    214216  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $182, 1, @tempb);
    215217  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $14, 4, @link);
    216   Result[2].src_offset := $14;
    217   Result[2].raw_addr   := link;
    218   Result[2].raw_size   := tempb * 32;
     218  Result[2].SrcOffset := $14;
     219  Result[2].RawAddr   := link;
     220  Result[2].RawSize   := tempb * 32;
    219221  {damage}
    220222  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $183, 1, @tempb);
    221223  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $18, 4, @link);
    222   Result[3].src_offset := $18;
    223   Result[3].raw_addr   := link;
    224   Result[3].raw_size   := tempb * 8;
     224  Result[3].SrcOffset := $18;
     225  Result[3].RawAddr   := link;
     226  Result[3].RawSize   := tempb * 8;
    225227  {motionblur}
    226228  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $184, 1, @tempb);
    227229  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @link);
    228   Result[4].src_offset := $1C;
    229   Result[4].raw_addr   := link;
    230   Result[4].raw_size   := tempb * 8;
     230  Result[4].SrcOffset := $1C;
     231  Result[4].RawAddr   := link;
     232  Result[4].RawSize   := tempb * 8;
    231233  {shortcut}
    232234  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $185, 1, @tempb);
    233235  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20, 4, @link);
    234   Result[5].src_offset := $20;
    235   Result[5].raw_addr   := link;
    236   Result[5].raw_size   := tempb * 8;
     236  Result[5].SrcOffset := $20;
     237  Result[5].RawAddr   := link;
     238  Result[5].RawSize   := tempb * 8;
    237239  {throw}
    238240  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $24, 4, @link);
    239   Result[6].src_offset := $24;
    240   Result[6].raw_addr   := link;
     241  Result[6].SrcOffset := $24;
     242  Result[6].RawAddr   := link;
    241243  if link > 0 then
    242     Result[6].raw_size := 24
     244    Result[6].RawSize := 24
    243245  else
    244     Result[6].raw_size := 0;
     246    Result[6].RawSize := 0;
    245247  {footstep}
    246248  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $186, 1, @tempb);
    247249  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $28, 4, @link);
    248   Result[7].src_offset := $28;
    249   Result[7].raw_addr   := link;
    250   Result[7].raw_size   := tempb * 4;
     250  Result[7].SrcOffset := $28;
     251  Result[7].RawAddr   := link;
     252  Result[7].RawSize   := tempb * 4;
    251253  {particle}
    252254  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $187, 1, @tempb);
    253255  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $2C, 4, @link);
    254   Result[8].src_offset := $2C;
    255   Result[8].raw_addr   := link;
    256   Result[8].raw_size   := tempb * 24;
     256  Result[8].SrcOffset := $2C;
     257  Result[8].RawAddr   := link;
     258  Result[8].RawSize   := tempb * 24;
    257259  {position}
    258260  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $30, 4, @link);
    259   Result[9].src_offset := $30;
    260   Result[9].raw_addr   := link;
    261   Result[9].raw_size   := frames * 8;
     261  Result[9].SrcOffset := $30;
     262  Result[9].RawAddr   := link;
     263  Result[9].RawSize   := frames * 8;
    262264  {particle}
    263265  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $154, 2, @tempw);
    264266  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $38, 4, @link);
    265   Result[11].src_offset := $38;
    266   Result[11].raw_addr   := link;
    267   Result[11].raw_size   := tempw * 34;
     267  Result[11].SrcOffset := $38;
     268  Result[11].RawAddr   := link;
     269  Result[11].RawSize   := tempw * 34;
    268270  {extent}
    269271  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $138, 4, @templ);
    270272  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $13C, 4, @link);
    271   Result[12].src_offset := $13C;
    272   Result[12].raw_addr   := link;
    273   Result[12].raw_size   := templ * 12;
     273  Result[12].SrcOffset := $13C;
     274  Result[12].RawAddr   := link;
     275  Result[12].RawSize   := templ * 12;
    274276
    275277  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $34, 4, @link);
     
    280282    i := 0;
    281283    SetLength(Data, $FFFF);
    282     TOniDataDat(connection).LoadRawOffset(False, link, $FFFF, Data);
     284    TAccess_OniArchive(ConManager.Connection[ConnectionID]).LoadRawOffset(
     285          False, link, $FFFF, Data);
    283286    offset := Data[$24] + Data[$25] * 256;
    284287    while (offset + i < Length(Data)) and (frame_count < frames - 1) do
     
    291294    begin
    292295      Inc(i, tempw);
    293       Result[10].raw_size := offset + i;
     296      Result[10].RawSize := offset + i;
    294297    end
    295298    else
    296299    begin
    297       Result[10].raw_size := 0;
     300      Result[10].RawSize := 0;
    298301    end;
    299302  end;
    300   Result[10].src_offset := $34;
    301   Result[10].raw_addr   := link;
     303  Result[10].SrcOffset := $34;
     304  Result[10].RawAddr   := link;
    302305end;
    303306
     
    327330  end;
    328331  SetLength(Result, 1);
    329   if not connection.OSisMac then
    330   begin
    331     Result[0].src_offset := $9C;
    332     Result[0].raw_addr   := link_pc;
     332  if ConManager.Connection[ConnectionID].DataOS = DOS_WIN then
     333  begin
     334    Result[0].SrcOffset := $9C;
     335    Result[0].RawAddr   := link_pc;
    333336  end
    334337  else
    335338  begin
    336     Result[0].src_offset := $A0;
    337     Result[0].raw_addr   := link_mac;
    338   end;
    339   Result[0].raw_size := datasize;
    340   Result[0].loc_sep  := connection.OSisMac;
     339    Result[0].SrcOffset := $A0;
     340    Result[0].RawAddr   := link_mac;
     341  end;
     342  Result[0].RawSize := datasize;
     343  Result[0].LocSep  := not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN);
    341344end;
    342345
  • oup/rewrite/Global/TypeDefs.pas

    r97 r101  
    99
    1010  TDataBackend = (DB_ONI, DB_ADB);
    11   TDataOS = (DOS_WIN, DOS_MAC);
     11  TDataOS = (DOS_WIN, DOS_WINDEMO, DOS_MAC, DOS_MACBETA);
    1212
    13   TChangeRights = set of (CR_EditDat, CR_EditRaw, CR_ResizeDat, CR_ResizeRaw);
     13  TChangeRights = set of (CR_EditDat, CR_EditRaw, CR_ResizeDat, CR_ResizeRaw, CR_AppendRaw);
    1414
    1515  TStatusMessages = (
     
    1919      SM_UnknownExtension,
    2020      SM_IncompatibleFile,
     21      SM_IncompatibleDBVersion,
    2122      SM_UnknownError
    2223  );
     24
     25  TExtensionsMap = array of packed record
     26      Ident:       array[0..$7] of Byte;
     27      Extension:   array[0..$3] of Char;
     28      ExtCount:    LongWord;
     29  end;
    2330
    2431  TFileInfo = packed record
     
    3037      DatAddr:     Integer;
    3138  end;
     39  TFiles = array of TFileInfo;
    3240
    3341  TRawDataInfo = record
Note: See TracChangeset for help on using the changeset viewer.