[97] | 1 | unit RawList;
|
---|
| 2 | interface
|
---|
[101] | 3 | uses TypeDefs;
|
---|
[97] | 4 |
|
---|
| 5 | type
|
---|
| 6 | THandler = function(ConnectionID, FileID: Integer): TRawDataList;
|
---|
[101] | 7 | TRawListHandler = record
|
---|
[97] | 8 | Ext: String[4];
|
---|
| 9 | needed: Boolean;
|
---|
| 10 | Handler: THandler;
|
---|
| 11 | end;
|
---|
[101] | 12 | TRawListHandlers = array of TRawListHandler;
|
---|
[97] | 13 |
|
---|
| 14 | TRawLists = class
|
---|
| 15 | private
|
---|
| 16 | FRawListHandlers: TRawListHandlers;
|
---|
| 17 | public
|
---|
[105] | 18 | property RawListHandlers: TRawListHandlers read FRawListHandlers;
|
---|
[97] | 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 |
|
---|
[101] | 28 |
|
---|
[97] | 29 | implementation
|
---|
| 30 |
|
---|
| 31 | uses
|
---|
[226] | 32 | ConnectionManager, Access_OniArchive, Classes, SysUtils, Math, _TemplateFile;
|
---|
[97] | 33 |
|
---|
| 34 |
|
---|
| 35 | function AGDB(ConnectionID, FileID: Integer): TRawDataList;
|
---|
| 36 | var
|
---|
| 37 | link: Integer;
|
---|
| 38 | links: Integer;
|
---|
| 39 | i: Integer;
|
---|
| 40 | begin
|
---|
[101] | 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
|
---|
[97] | 45 | begin
|
---|
[241] | 46 | Result[i].Name := '<TBD>';
|
---|
[101] | 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;
|
---|
[241] | 52 | Result[i].RawType := 'AGDB' + IntToStr(i mod 2);
|
---|
[97] | 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
|
---|
[101] | 65 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @links);
|
---|
| 66 | SetLength(Result, links);
|
---|
| 67 | for i := 0 to links - 1 do
|
---|
[97] | 68 | begin
|
---|
[241] | 69 | Result[i].Name := '<TBD>';
|
---|
[101] | 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;
|
---|
[241] | 76 | Result[i].RawType := 'AKVA';
|
---|
[97] | 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);
|
---|
[241] | 91 | Result[0].Name := 'Binary data';
|
---|
[101] | 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);
|
---|
[241] | 96 | Result[0].RawType := 'BINA';
|
---|
[97] | 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);
|
---|
[241] | 110 | Result[0].Name := 'Sound Binary Data';
|
---|
[101] | 111 | Result[0].SrcOffset := $0C;
|
---|
| 112 | Result[0].RawAddr := link;
|
---|
| 113 | Result[0].RawSize := datasize;
|
---|
[241] | 114 | Result[0].LocSep := not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN);
|
---|
| 115 | Result[0].RawType := 'OSBD';
|
---|
[97] | 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);
|
---|
[173] | 127 | if ConManager.Connection[ConnectionID].DataOS in [DOS_MACBETA, DOS_MAC] then
|
---|
[97] | 128 | begin
|
---|
[101] | 129 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $10, 4, @datasize);
|
---|
| 130 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $14, 4, @link);
|
---|
| 131 | Result[0].SrcOffset := $14;
|
---|
[97] | 132 | end
|
---|
| 133 | else
|
---|
| 134 | begin
|
---|
[101] | 135 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $40, 4, @datasize);
|
---|
| 136 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $44, 4, @link);
|
---|
| 137 | Result[0].SrcOffset := $44;
|
---|
[97] | 138 | end;
|
---|
[241] | 139 | Result[0].Name := 'Sound data';
|
---|
[101] | 140 | Result[0].RawAddr := link;
|
---|
| 141 | Result[0].RawSize := datasize;
|
---|
| 142 | Result[0].LocSep := False;
|
---|
[241] | 143 | Result[0].RawType := 'SNDD';
|
---|
[97] | 144 | end;
|
---|
| 145 |
|
---|
| 146 |
|
---|
| 147 |
|
---|
| 148 |
|
---|
| 149 | function SUBT(ConnectionID, FileID: Integer): TRawDataList;
|
---|
| 150 | var
|
---|
| 151 | baselink, lastlink: Integer;
|
---|
| 152 | links: Integer;
|
---|
[101] | 153 | Data: TStream;
|
---|
[147] | 154 | read: Integer;
|
---|
| 155 | char: Byte;
|
---|
| 156 | foundzeros: Byte;
|
---|
[97] | 157 | begin
|
---|
[147] | 158 | SetLength(Result, 0);
|
---|
| 159 |
|
---|
[97] | 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);
|
---|
[101] | 165 | Data := nil;
|
---|
| 166 | TAccess_OniArchive(ConManager.Connection[ConnectionID]).LoadRawOffset(
|
---|
| 167 | False, baselink, lastlink + 1024, Data);
|
---|
[149] | 168 | Data.Seek(lastlink, soFromBeginning);
|
---|
[147] | 169 |
|
---|
| 170 | foundzeros := 0;
|
---|
| 171 | repeat
|
---|
| 172 | read := Data.Read(char, 1);
|
---|
| 173 | if (read > 0) and (char = 0) then
|
---|
[97] | 174 | begin
|
---|
[147] | 175 | Inc(foundzeros);
|
---|
[97] | 176 | end;
|
---|
[147] | 177 | until (read = 0) or (foundzeros = 2);
|
---|
| 178 |
|
---|
| 179 | if foundzeros = 2 then
|
---|
| 180 | begin
|
---|
| 181 | SetLength(Result, 1);
|
---|
[222] | 182 | Result[0].Name := 'Subtitles';
|
---|
[147] | 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;
|
---|
[241] | 188 | Result[0].RawType := 'SUBT';
|
---|
[97] | 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;
|
---|
[168] | 206 | frame_count: Integer;
|
---|
[97] | 207 | begin
|
---|
| 208 | SetLength(Result, 13);
|
---|
| 209 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $16C, 2, @frames);
|
---|
[222] | 210 | {y-pos}
|
---|
[97] | 211 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $0C, 4, @link);
|
---|
[222] | 212 | Result[0].Name := 'y-pos';
|
---|
[101] | 213 | Result[0].SrcOffset := $0C;
|
---|
| 214 | Result[0].RawAddr := link;
|
---|
[222] | 215 | Result[0].RawSize := frames * 4;
|
---|
[241] | 216 | Result[0].RawType := 'TRAM0';
|
---|
[222] | 217 | {x-z-pos}
|
---|
[97] | 218 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $10, 4, @link);
|
---|
[222] | 219 | Result[1].Name := 'x-z-pos';
|
---|
[101] | 220 | Result[1].SrcOffset := $10;
|
---|
| 221 | Result[1].RawAddr := link;
|
---|
[222] | 222 | Result[1].RawSize := frames * 8;
|
---|
[241] | 223 | Result[1].RawType := 'TRAM1';
|
---|
[97] | 224 | {attacks}
|
---|
| 225 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $182, 1, @tempb);
|
---|
| 226 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $14, 4, @link);
|
---|
[222] | 227 | Result[2].Name := 'Attacks';
|
---|
[101] | 228 | Result[2].SrcOffset := $14;
|
---|
| 229 | Result[2].RawAddr := link;
|
---|
| 230 | Result[2].RawSize := tempb * 32;
|
---|
[241] | 231 | Result[2].RawType := 'TRAM2';
|
---|
[97] | 232 | {damage}
|
---|
| 233 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $183, 1, @tempb);
|
---|
| 234 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $18, 4, @link);
|
---|
[222] | 235 | Result[3].Name := 'Damage';
|
---|
[101] | 236 | Result[3].SrcOffset := $18;
|
---|
| 237 | Result[3].RawAddr := link;
|
---|
| 238 | Result[3].RawSize := tempb * 8;
|
---|
[241] | 239 | Result[3].RawType := 'TRAM3';
|
---|
[97] | 240 | {motionblur}
|
---|
| 241 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $184, 1, @tempb);
|
---|
| 242 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $1C, 4, @link);
|
---|
[222] | 243 | Result[4].Name := 'MotionBlur';
|
---|
[101] | 244 | Result[4].SrcOffset := $1C;
|
---|
| 245 | Result[4].RawAddr := link;
|
---|
[161] | 246 | Result[4].RawSize := tempb * 12;
|
---|
[241] | 247 | Result[4].RawType := 'TRAM4';
|
---|
[97] | 248 | {shortcut}
|
---|
| 249 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $185, 1, @tempb);
|
---|
| 250 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $20, 4, @link);
|
---|
[222] | 251 | Result[5].Name := 'Shortcut';
|
---|
[101] | 252 | Result[5].SrcOffset := $20;
|
---|
| 253 | Result[5].RawAddr := link;
|
---|
| 254 | Result[5].RawSize := tempb * 8;
|
---|
[241] | 255 | Result[5].RawType := 'TRAM5';
|
---|
[97] | 256 | {throw}
|
---|
| 257 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $24, 4, @link);
|
---|
[222] | 258 | Result[6].Name := 'Throw';
|
---|
[101] | 259 | Result[6].SrcOffset := $24;
|
---|
| 260 | Result[6].RawAddr := link;
|
---|
[209] | 261 | Result[6].RawSize := 24;
|
---|
[241] | 262 | Result[6].RawType := 'TRAM6';
|
---|
[97] | 263 | {footstep}
|
---|
| 264 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $186, 1, @tempb);
|
---|
| 265 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $28, 4, @link);
|
---|
[222] | 266 | Result[7].Name := 'Footstep';
|
---|
[101] | 267 | Result[7].SrcOffset := $28;
|
---|
| 268 | Result[7].RawAddr := link;
|
---|
| 269 | Result[7].RawSize := tempb * 4;
|
---|
[241] | 270 | Result[7].RawType := 'TRAM7';
|
---|
[97] | 271 | {particle}
|
---|
| 272 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $187, 1, @tempb);
|
---|
| 273 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $2C, 4, @link);
|
---|
[222] | 274 | Result[8].Name := 'Particle';
|
---|
[101] | 275 | Result[8].SrcOffset := $2C;
|
---|
| 276 | Result[8].RawAddr := link;
|
---|
| 277 | Result[8].RawSize := tempb * 24;
|
---|
[241] | 278 | Result[8].RawType := 'TRAM8';
|
---|
[97] | 279 | {position}
|
---|
| 280 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $30, 4, @link);
|
---|
[222] | 281 | Result[9].Name := 'Position';
|
---|
[101] | 282 | Result[9].SrcOffset := $30;
|
---|
| 283 | Result[9].RawAddr := link;
|
---|
| 284 | Result[9].RawSize := frames * 8;
|
---|
[241] | 285 | Result[9].RawType := 'TRAM9';
|
---|
[222] | 286 | {sound}
|
---|
[97] | 287 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $154, 2, @tempw);
|
---|
| 288 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $38, 4, @link);
|
---|
[222] | 289 | Result[11].Name := 'Sound';
|
---|
[101] | 290 | Result[11].SrcOffset := $38;
|
---|
| 291 | Result[11].RawAddr := link;
|
---|
| 292 | Result[11].RawSize := tempw * 34;
|
---|
[241] | 293 | Result[11].RawType := 'TRAM11';
|
---|
[97] | 294 | {extent}
|
---|
| 295 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $138, 4, @templ);
|
---|
| 296 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $13C, 4, @link);
|
---|
[222] | 297 | Result[12].Name := 'Extent';
|
---|
[101] | 298 | Result[12].SrcOffset := $13C;
|
---|
| 299 | Result[12].RawAddr := link;
|
---|
| 300 | Result[12].RawSize := templ * 12;
|
---|
[241] | 301 | Result[12].RawType := 'TRAM12';
|
---|
[97] | 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);
|
---|
[101] | 310 | TAccess_OniArchive(ConManager.Connection[ConnectionID]).LoadRawOffset(
|
---|
| 311 | False, link, $FFFF, Data);
|
---|
[97] | 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);
|
---|
[101] | 322 | Result[10].RawSize := offset + i;
|
---|
[97] | 323 | end
|
---|
| 324 | else
|
---|
| 325 | begin
|
---|
[101] | 326 | Result[10].RawSize := 0;
|
---|
[97] | 327 | end;
|
---|
| 328 | end;
|
---|
[222] | 329 | Result[10].Name := 'BodyParts Animation';
|
---|
[101] | 330 | Result[10].SrcOffset := $34;
|
---|
| 331 | Result[10].RawAddr := link;
|
---|
[241] | 332 | Result[10].RawType := 'TRAM10';
|
---|
[97] | 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;
|
---|
[118] | 345 | mipmap: Byte;
|
---|
[128] | 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 |
|
---|
[97] | 361 | begin
|
---|
[118] | 362 | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $88, SizeOf(mipmap), @mipmap);
|
---|
[97] | 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);
|
---|
[118] | 368 |
|
---|
| 369 |
|
---|
[128] | 370 | datasize := GetImgSize(x, y, storetype);
|
---|
[118] | 371 | if (mipmap and $01) > 0 then
|
---|
| 372 | begin
|
---|
| 373 | repeat
|
---|
[128] | 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);
|
---|
[118] | 378 | end;
|
---|
| 379 |
|
---|
[97] | 380 | SetLength(Result, 1);
|
---|
[101] | 381 | if ConManager.Connection[ConnectionID].DataOS = DOS_WIN then
|
---|
[97] | 382 | begin
|
---|
[101] | 383 | Result[0].SrcOffset := $9C;
|
---|
| 384 | Result[0].RawAddr := link_pc;
|
---|
[97] | 385 | end
|
---|
| 386 | else
|
---|
| 387 | begin
|
---|
[101] | 388 | Result[0].SrcOffset := $A0;
|
---|
| 389 | Result[0].RawAddr := link_mac;
|
---|
[97] | 390 | end;
|
---|
[222] | 391 | Result[0].Name := 'ImageData';
|
---|
[101] | 392 | Result[0].RawSize := datasize;
|
---|
| 393 | Result[0].LocSep := not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN);
|
---|
[241] | 394 | Result[0].RawType := 'TXMP';
|
---|
[97] | 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);
|
---|
[222] | 407 | Result.Name := '';
|
---|
[97] | 408 | Result.SrcID := -1;
|
---|
| 409 | Result.SrcOffset := -1;
|
---|
| 410 | Result.RawAddr := -1;
|
---|
| 411 | Result.RawSize := -1;
|
---|
[241] | 412 | Result.RawType := '';
|
---|
[97] | 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
|
---|
[222] | 419 | Result.Name := RawList[i].Name;
|
---|
[97] | 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;
|
---|
[241] | 425 | Result.RawType := RawList[i].RawType;
|
---|
[97] | 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;
|
---|
[209] | 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;
|
---|
[97] | 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;
|
---|
[178] | 468 | RawLists.InsertRawListHandler('AGDB', False, AGDB);
|
---|
[97] | 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.
|
---|