| 1 | unit RawList;
|
|---|
| 2 | interface
|
|---|
| 3 | uses TypeDefs;
|
|---|
| 4 |
|
|---|
| 5 | type
|
|---|
| 6 | THandler = function(ConnectionID, FileID: Integer): TRawDataList;
|
|---|
| 7 | TRawListHandler = record
|
|---|
| 8 | Ext: String[4];
|
|---|
| 9 | needed: Boolean;
|
|---|
| 10 | Handler: THandler;
|
|---|
| 11 | end;
|
|---|
| 12 | TRawListHandlers = array of TRawListHandler;
|
|---|
| 13 |
|
|---|
| 14 | TRawLists = class
|
|---|
| 15 | private
|
|---|
| 16 | FRawListHandlers: TRawListHandlers;
|
|---|
| 17 | public
|
|---|
| 18 | property RawListHandlers: TRawListHandlers read FRawListHandlers;
|
|---|
| 19 | procedure InsertRawListHandler(ext: String; needed: Boolean; handler: THandler);
|
|---|
| 20 | function GetRawList(ConnectionID, FileID: Integer): TRawDataList;
|
|---|
| 21 | function GetRawInfo(ConnectionID, FileID, DatOffset: Integer): TRawDataInfo;
|
|---|
| 22 | end;
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | var
|
|---|
| 26 | RawLists: TRawLists;
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 | implementation
|
|---|
| 30 |
|
|---|
| 31 | uses
|
|---|
| 32 | ConnectionManager, Access_OniArchive, Classes, SysUtils, Math, _TemplateFile;
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 | function AGDB(ConnectionID, FileID: Integer): TRawDataList;
|
|---|
| 36 | var
|
|---|
| 37 | link: Integer;
|
|---|
| 38 | links: Integer;
|
|---|
| 39 | i: Integer;
|
|---|
| 40 | begin
|
|---|
| 41 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @links);
|
|---|
| 42 | links := links * 2;
|
|---|
| 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 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 | function AKVA(ConnectionID, FileID: Integer): TRawDataList;
|
|---|
| 60 | var
|
|---|
| 61 | link: Integer;
|
|---|
| 62 | links: Integer;
|
|---|
| 63 | i: Integer;
|
|---|
| 64 | begin
|
|---|
| 65 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @links);
|
|---|
| 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 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 | function BINA(ConnectionID, FileID: Integer): TRawDataList;
|
|---|
| 84 | var
|
|---|
| 85 | link: Integer;
|
|---|
| 86 | datasize: Integer;
|
|---|
| 87 | 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 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 | function OSBD(ConnectionID, FileID: Integer): TRawDataList;
|
|---|
| 103 | var
|
|---|
| 104 | link: Integer;
|
|---|
| 105 | datasize: Integer;
|
|---|
| 106 | 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);
|
|---|
| 115 | Result[0].RawType := 'OSBD';
|
|---|
| 116 | end;
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 | function SNDD(ConnectionID, FileID: Integer): TRawDataList;
|
|---|
| 122 | var
|
|---|
| 123 | link: Integer;
|
|---|
| 124 | datasize: Integer;
|
|---|
| 125 | begin
|
|---|
| 126 | SetLength(Result, 1);
|
|---|
| 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);
|
|---|
| 131 | Result[0].SrcOffset := $14;
|
|---|
| 132 | end
|
|---|
| 133 | else
|
|---|
| 134 | begin
|
|---|
| 135 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $40, 4, @datasize);
|
|---|
| 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 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 | function SUBT(ConnectionID, FileID: Integer): TRawDataList;
|
|---|
| 150 | 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);
|
|---|
| 165 | Data := nil;
|
|---|
| 166 | TAccess_OniArchive(ConManager.Connection[ConnectionID]).LoadRawOffset(
|
|---|
| 167 | False, baselink, lastlink + 1024, Data);
|
|---|
| 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 | 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;
|
|---|
| 191 | end;
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 | function TRAM(ConnectionID, FileID: Integer): TRawDataList;
|
|---|
| 197 | var
|
|---|
| 198 | i: Integer;
|
|---|
| 199 | link: Integer;
|
|---|
| 200 | frames: Word;
|
|---|
| 201 | tempb: Byte;
|
|---|
| 202 | tempw: Word;
|
|---|
| 203 | templ: Integer;
|
|---|
| 204 | Data: TByteData;
|
|---|
| 205 | offset: Word;
|
|---|
| 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 * 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 | 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 | 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
|
|---|
| 305 | begin
|
|---|
| 306 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $160, 2, @tempw);
|
|---|
| 307 | frame_count := 0;
|
|---|
| 308 | i := 0;
|
|---|
| 309 | SetLength(Data, $FFFF);
|
|---|
| 310 | TAccess_OniArchive(ConManager.Connection[ConnectionID]).LoadRawOffset(
|
|---|
| 311 | False, link, $FFFF, Data);
|
|---|
| 312 | offset := Data[$24] + Data[$25] * 256;
|
|---|
| 313 | while (offset + i < Length(Data)) and (frame_count < frames - 1) do
|
|---|
| 314 | begin
|
|---|
| 315 | Inc(i, tempw);
|
|---|
| 316 | frame_count := frame_count + Data[offset + i];
|
|---|
| 317 | Inc(i);
|
|---|
| 318 | end;
|
|---|
| 319 | if offset + i < Length(Data) then
|
|---|
| 320 | begin
|
|---|
| 321 | Inc(i, tempw);
|
|---|
| 322 | Result[10].RawSize := offset + i;
|
|---|
| 323 | end
|
|---|
| 324 | else
|
|---|
| 325 | 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 |
|
|---|
| 336 |
|
|---|
| 337 |
|
|---|
| 338 | function TXMP(ConnectionID, FileID: Integer): TRawDataList;
|
|---|
| 339 | var
|
|---|
| 340 | link_pc: Integer;
|
|---|
| 341 | link_mac: Integer;
|
|---|
| 342 | x, y: Word;
|
|---|
| 343 | storetype: Byte;
|
|---|
| 344 | datasize: Integer;
|
|---|
| 345 | mipmap: Byte;
|
|---|
| 346 |
|
|---|
| 347 | function GetImgSize(w,h, storetype: Integer): Integer;
|
|---|
| 348 | begin
|
|---|
| 349 | case storetype of
|
|---|
| 350 | 0, 1, 2:
|
|---|
| 351 | Result := w*h*2;
|
|---|
| 352 | 8:
|
|---|
| 353 | Result := w*h*4;
|
|---|
| 354 | 9:
|
|---|
| 355 | Result := Max(1, w div 4) * Max(1, h div 4) * 8;
|
|---|
| 356 | else
|
|---|
| 357 | Result := -1;
|
|---|
| 358 | end;
|
|---|
| 359 | end;
|
|---|
| 360 |
|
|---|
| 361 | begin
|
|---|
| 362 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $88, SizeOf(mipmap), @mipmap);
|
|---|
| 363 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $8C, SizeOf(x), @x);
|
|---|
| 364 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $8E, SizeOf(y), @y);
|
|---|
| 365 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $90, SizeOf(storetype), @storetype);
|
|---|
| 366 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $9C, 4, @link_pc);
|
|---|
| 367 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $A0, 4, @link_mac);
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 | datasize := GetImgSize(x, y, storetype);
|
|---|
| 371 | if (mipmap and $01) > 0 then
|
|---|
| 372 | begin
|
|---|
| 373 | repeat
|
|---|
| 374 | x := Max(x div 2, 1);
|
|---|
| 375 | y := Max(y div 2, 1);
|
|---|
| 376 | datasize := datasize + GetImgSize(x, y, storetype);
|
|---|
| 377 | until (x = 1) and (y = 1);
|
|---|
| 378 | end;
|
|---|
| 379 |
|
|---|
| 380 | SetLength(Result, 1);
|
|---|
| 381 | if ConManager.Connection[ConnectionID].DataOS = DOS_WIN then
|
|---|
| 382 | begin
|
|---|
| 383 | Result[0].SrcOffset := $9C;
|
|---|
| 384 | Result[0].RawAddr := link_pc;
|
|---|
| 385 | end
|
|---|
| 386 | else
|
|---|
| 387 | 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 |
|
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 | function TRawLists.GetRawInfo(ConnectionID, FileID,
|
|---|
| 401 | DatOffset: Integer): TRawDataInfo;
|
|---|
| 402 | var
|
|---|
| 403 | i: Integer;
|
|---|
| 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;
|
|---|
| 429 | end;
|
|---|
| 430 | end;
|
|---|
| 431 |
|
|---|
| 432 |
|
|---|
| 433 | function TRawLists.GetRawList(ConnectionID, FileID: Integer): TRawDataList;
|
|---|
| 434 | var
|
|---|
| 435 | i: Integer;
|
|---|
| 436 | fileinfo: TFileInfo;
|
|---|
| 437 | begin
|
|---|
| 438 | SetLength(Result, 0);
|
|---|
| 439 | fileinfo := ConManager.Connection[ConnectionID].GetFileInfo(FileID);
|
|---|
| 440 | for i := 0 to High(FRawListHandlers) do
|
|---|
| 441 | if UpperCase(FRawListHandlers[i].Ext) = UpperCase(fileinfo.extension) then
|
|---|
| 442 | begin
|
|---|
| 443 | if FRawListHandlers[i].needed then
|
|---|
| 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);
|
|---|
| 454 | begin
|
|---|
| 455 | SetLength(FRawListHandlers, Length(FRawListHandlers) + 1);
|
|---|
| 456 | FRawListHandlers[High(FRawListHandlers)].Ext := ext;
|
|---|
| 457 | FRawListHandlers[High(FRawListHandlers)].needed := needed;
|
|---|
| 458 | FRawListHandlers[High(FRawListHandlers)].handler := handler;
|
|---|
| 459 | // Raws := Raws + ext;
|
|---|
| 460 | AddToolListEntry('rawedit', '', ext);
|
|---|
| 461 | end;
|
|---|
| 462 |
|
|---|
| 463 |
|
|---|
| 464 |
|
|---|
| 465 |
|
|---|
| 466 | initialization
|
|---|
| 467 | RawLists := TRawLists.Create;
|
|---|
| 468 | RawLists.InsertRawListHandler('AGDB', False, AGDB);
|
|---|
| 469 | RawLists.InsertRawListHandler('AKVA', True, AKVA);
|
|---|
| 470 | RawLists.InsertRawListHandler('BINA', True, BINA);
|
|---|
| 471 | RawLists.InsertRawListHandler('OSBD', True, OSBD);
|
|---|
| 472 | RawLists.InsertRawListHandler('SNDD', True, SNDD);
|
|---|
| 473 | RawLists.InsertRawListHandler('SUBT', True, SUBT);
|
|---|
| 474 | RawLists.InsertRawListHandler('TRAM', True, TRAM);
|
|---|
| 475 | RawLists.InsertRawListHandler('TXMP', True, TXMP);
|
|---|
| 476 | end.
|
|---|