| 78 |
|
Connection: TDataAccess; |
| 79 |
|
ConRepMsg: TStatusMessages; |
| 80 |
|
|
| 81 |
+ |
FileID: Integer; |
| 82 |
+ |
|
| 83 |
|
Strings: TStrings; |
| 84 |
|
i, j: Integer; |
| 85 |
|
temps: String; |
| 86 |
+ |
tempi: Integer; |
| 87 |
+ |
tempb: Byte; |
| 88 |
|
FileInfo: TFileInfo; |
| 89 |
+ |
DatLinks: TDatLinkList; |
| 90 |
+ |
RawLinks: TRawDataList; |
| 91 |
|
|
| 92 |
|
DatFileStream, RawFileStream: TMemoryStream; |
| 93 |
|
const |
| 276 |
|
Application.ProcessMessages; |
| 277 |
|
|
| 278 |
|
FileTime := Time; |
| 279 |
< |
for i := 0 to DatHeader.Files - 1 do |
| 279 |
> |
for FileID := 0 to DatHeader.Files - 1 do |
| 280 |
|
begin |
| 281 |
< |
FileInfo := Connection.GetFileInfo(i); |
| 281 |
> |
FileInfo := Connection.GetFileInfo(FileID); |
| 282 |
|
for j := 0 to 3 do |
| 283 |
< |
FilesHeader[i].Extension[j] := FileInfo.Extension[4 - j]; |
| 283 |
> |
FilesHeader[FileID].Extension[j] := FileInfo.Extension[4 - j]; |
| 284 |
|
if FileInfo.Size > 0 then |
| 285 |
|
begin |
| 286 |
< |
// DatLinks:=; |
| 281 |
< |
FilesHeader[i].DataAddr := Stream_Body.Size + 8; |
| 286 |
> |
FilesHeader[FileID].DataAddr := Stream_Body.Size + 8; |
| 287 |
|
DatFileStream := TMemoryStream.Create; |
| 288 |
< |
Connection.LoadDatFile(i, DatFileStream); |
| 288 |
> |
Connection.LoadDatFile(FileID, TStream(DatFileStream)); |
| 289 |
|
DatFileStream.Seek(4, soFromBeginning); |
| 290 |
|
DatFileStream.Write(LevelID, 4); |
| 291 |
|
|
| 292 |
< |
if (Pos(UpperCase(fileinfo.Extension), UpperCase(raws)) mod 4) = 1 then |
| 292 |
> |
DatLinks := Connection.GetDatLinks(FileID); |
| 293 |
> |
if Length(DatLinks) > 0 then |
| 294 |
> |
begin |
| 295 |
> |
for i := 0 to High(DatLinks) do |
| 296 |
> |
begin |
| 297 |
> |
DatFileStream.Seek(DatLinks[i].SrcOffset, soFromBeginning); |
| 298 |
> |
if DatLinks[i].DestID < 0 then |
| 299 |
> |
tempi := 0 |
| 300 |
> |
else |
| 301 |
> |
tempi := DatLinks[i].DestID * 256 + 1; |
| 302 |
> |
DatFileStream.Write(tempi, 4); |
| 303 |
> |
end; |
| 304 |
> |
end; |
| 305 |
> |
|
| 306 |
> |
RawLinks := Connection.GetRawList(FileID); |
| 307 |
> |
if Length(RawLinks) > 0 then |
| 308 |
|
begin |
| 309 |
< |
rawlist := OniDataConnection.GetRawList(i); |
| 290 |
< |
if Length(rawlist) > 0 then |
| 309 |
> |
for i := 0 to High(RawLinks) do |
| 310 |
|
begin |
| 311 |
< |
for j := 0 to High(rawlist) do |
| 311 |
> |
if RawLinks[i].RawSize > 0 then |
| 312 |
|
begin |
| 313 |
< |
if rawlist[j].raw_size > 0 then |
| 313 |
> |
RawFileStream := TMemoryStream.Create; |
| 314 |
> |
Connection.LoadRawFile(FileID, RawLinks[i].SrcOffset, TStream(RawFileStream)); |
| 315 |
> |
RawFileStream.Seek(0, soFromBeginning); |
| 316 |
> |
if RawLinks[i].LocSep then |
| 317 |
|
begin |
| 318 |
< |
if (UpperCase(fileinfo.Extension) = 'TXMP') and |
| 319 |
< |
((Data[$88] and $01) > 0) then |
| 320 |
< |
begin |
| 321 |
< |
OniImage.LoadFromTXMP(Connection, i); |
| 322 |
< |
OniImage.GetMipMappedImage(rawdata); |
| 323 |
< |
rawlist[j].raw_size := OniImage.GetImageDataSize(True); |
| 324 |
< |
Data[$90] := $08; |
| 325 |
< |
Data[$89] := 32; |
| 326 |
< |
{ if data[$90]<>OniImage.StoreType then begin |
| 327 |
< |
data[$90]:=OniImage.StoreType; |
| 328 |
< |
data[$89]:=(data[$89] and $CF) or $20; |
| 329 |
< |
end; |
| 308 |
< |
} end |
| 309 |
< |
else |
| 310 |
< |
begin |
| 311 |
< |
SetLength(rawdata, rawlist[j].raw_size); |
| 312 |
< |
OniDataConnection.LoadRawFile(i, rawlist[j].src_offset, @rawdata[0]); |
| 313 |
< |
end; |
| 314 |
< |
// data[$88]:=data[$88] and $FE; |
| 315 |
< |
|
| 316 |
< |
if rawlist[j].loc_sep then |
| 317 |
< |
begin |
| 318 |
< |
rawlist[j].raw_addr := Stream_Sep.Size; |
| 319 |
< |
Stream_Sep.Write(rawdata[0], Length(rawdata)); |
| 320 |
< |
end |
| 321 |
< |
else |
| 322 |
< |
begin |
| 323 |
< |
rawlist[j].raw_addr := Stream_Raw.Size; |
| 324 |
< |
Stream_Raw.Write(rawdata[0], Length(rawdata)); |
| 325 |
< |
end; |
| 326 |
< |
end |
| 327 |
< |
else |
| 328 |
< |
rawlist[j].raw_addr := 0; |
| 318 |
> |
RawLinks[i].RawAddr := Stream_Sep.Size; |
| 319 |
> |
Stream_sep.CopyFrom(RawFileStream, RawFileStream.Size); |
| 320 |
> |
end else begin |
| 321 |
> |
RawLinks[i].RawAddr := Stream_Raw.Size; |
| 322 |
> |
Stream_Raw.CopyFrom(RawFileStream, RawFileStream.Size); |
| 323 |
> |
end; |
| 324 |
> |
end else |
| 325 |
> |
RawLinks[i].RawAddr := 0; |
| 326 |
> |
end; |
| 327 |
> |
end; |
| 328 |
> |
|
| 329 |
> |
{ |
| 330 |
|
Data[rawlist[j].src_offset + 0] := (rawlist[j].raw_addr) and $FF; |
| 331 |
|
Data[rawlist[j].src_offset + 1] := (rawlist[j].raw_addr shr 8) and $FF; |
| 332 |
|
Data[rawlist[j].src_offset + 2] := (rawlist[j].raw_addr shr 16) and $FF; |
| 333 |
|
Data[rawlist[j].src_offset + 3] := (rawlist[j].raw_addr shr 24) and $FF; |
| 334 |
< |
end; |
| 334 |
< |
end; |
| 335 |
< |
end; |
| 336 |
< |
|
| 334 |
> |
} |
| 335 |
|
Stream_Body.Write(Data[0], Length(Data)); |
| 336 |
|
// |
| 337 |
|
end |