Changeset 87
- Timestamp:
- Jan 14, 2007, 11:59:34 PM (18 years ago)
- Location:
- oup/current
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/Code/DataStructures.pas
r46 r87 3 3 interface 4 4 5 uses SysUtils, Classes, Data, Dialogs, StrUtils ;5 uses SysUtils, Classes, Data, Dialogs, StrUtils, OniDataClass; 6 6 7 7 type … … 34 34 Subs: array of TStructDefSub; 35 35 end; 36 THandler = function( fileid: LongWord): TRawList;36 THandler = function(connection: TOniData; fileid: LongWord): TRawList; 37 37 38 38 TRawListHandlers = record … … 47 47 48 48 49 function LoadStructureDefinition( fileid: LongWord): TStructDef;49 function LoadStructureDefinition(connection: TOniData; fileid: LongWord): TStructDef; 50 50 function GetDataType(typeid: Word): String; 51 51 function GetTypeDataLength(datatype: Word): Word; … … 53 53 implementation 54 54 55 uses Functions, OniDataClass,Forms, Template;55 uses Functions, Forms, Template; 56 56 57 57 … … 120 120 121 121 122 function AGDB( fileid: LongWord): TRawList;122 function AGDB(connection: TOniData; fileid: LongWord): TRawList; 123 123 var 124 124 link: LongWord; … … 126 126 i: LongWord; 127 127 begin 128 if not OniDataConnection.OSisMac then129 begin 130 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);128 if not connection.OSisMac then 129 begin 130 connection.LoadDatFilePart(fileid, $1C, 4, @links); 131 131 links := links * 2; 132 132 SetLength(Result, links); … … 134 134 begin 135 135 Result[i].src_offset := $20 + i * 4; 136 OniDataConnection.LoadDatFilePart(fileid, $20 + i * 4, 4, @link);136 connection.LoadDatFilePart(fileid, $20 + i * 4, 4, @link); 137 137 Result[i].raw_addr := link; 138 138 Result[i].raw_size := 0{????????????????????????????????}; … … 145 145 146 146 147 function AKVA( fileid: LongWord): TRawList;147 function AKVA(connection: TOniData; fileid: LongWord): TRawList; 148 148 var 149 149 link: LongWord; … … 151 151 i: LongWord; 152 152 begin 153 if not OniDataConnection.OSisMac then154 begin 155 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);153 if not connection.OSisMac then 154 begin 155 connection.LoadDatFilePart(fileid, $1C, 4, @links); 156 156 SetLength(Result, links); 157 157 for i := 0 to links - 1 do 158 158 begin 159 159 Result[i].src_offset := $20 + i * $74 + $24; 160 OniDataConnection.LoadDatFilePart(fileid, $20 + i * $74 + $24, 4, @link);160 connection.LoadDatFilePart(fileid, $20 + i * $74 + $24, 4, @link); 161 161 Result[i].raw_addr := link; 162 OniDataConnection.LoadDatFilePart(fileid, $20 + i * $74 + $28, 4, @link);162 connection.LoadDatFilePart(fileid, $20 + i * $74 + $28, 4, @link); 163 163 Result[i].raw_size := link; 164 164 Result[i].loc_sep := False; … … 170 170 171 171 172 function BINA( fileid: LongWord): TRawList;172 function BINA(connection: TOniData; fileid: LongWord): TRawList; 173 173 var 174 174 link: LongWord; 175 175 datasize: LongWord; 176 176 begin 177 OniDataConnection.LoadDatFilePart(fileid, $0C, 4, @link); 178 OniDataConnection.LoadDatFilePart(fileid, $08, 4, @datasize); 177 connection.LoadDatFilePart(fileid, $0C, 4, @link); 178 connection.LoadDatFilePart(fileid, $08, 4, @datasize); 179 SetLength(Result, 1); 180 Result[0].src_offset := $0C; 181 Result[0].raw_addr := link; 182 Result[0].raw_size := datasize; 183 Result[0].loc_sep := connection.OSisMac; 184 end; 185 186 187 188 189 function OSBD(connection: TOniData; fileid: LongWord): TRawList; 190 var 191 link: LongWord; 192 datasize: LongWord; 193 begin 194 connection.LoadDatFilePart(fileid, $08, 4, @datasize); 195 connection.LoadDatFilePart(fileid, $0C, 4, @link); 179 196 SetLength(Result, 1); 180 197 Result[0].src_offset := $0C; … … 187 204 188 205 189 function OSBD(fileid: LongWord): TRawList;206 function SNDD(connection: TOniData; fileid: LongWord): TRawList; 190 207 var 191 208 link: LongWord; 192 209 datasize: LongWord; 193 210 begin 194 OniDataConnection.LoadDatFilePart(fileid, $08, 4, @datasize);195 OniDataConnection.LoadDatFilePart(fileid, $0C, 4, @link);196 211 SetLength(Result, 1); 197 Result[0].src_offset := $0C; 198 Result[0].raw_addr := link; 199 Result[0].raw_size := datasize; 200 Result[0].loc_sep := OniDataConnection.OSisMac; 201 end; 202 203 204 205 206 function SNDD(fileid: LongWord): TRawList; 207 var 208 link: LongWord; 209 datasize: LongWord; 210 begin 211 SetLength(Result, 1); 212 if not OniDataConnection.OSisMac then 213 begin 214 OniDataConnection.LoadDatFilePart(fileid, $40, 4, @datasize); 215 OniDataConnection.LoadDatFilePart(fileid, $44, 4, @link); 212 if not connection.OSisMac then 213 begin 214 connection.LoadDatFilePart(fileid, $40, 4, @datasize); 215 connection.LoadDatFilePart(fileid, $44, 4, @link); 216 216 Result[0].src_offset := $44; 217 217 end 218 218 else 219 219 begin 220 OniDataConnection.LoadDatFilePart(fileid, $10, 4, @datasize);221 OniDataConnection.LoadDatFilePart(fileid, $14, 4, @link);220 connection.LoadDatFilePart(fileid, $10, 4, @datasize); 221 connection.LoadDatFilePart(fileid, $14, 4, @link); 222 222 Result[0].src_offset := $14; 223 223 end; … … 230 230 231 231 232 function SUBT( fileid: LongWord): TRawList;232 function SUBT(connection: TOniData; fileid: LongWord): TRawList; 233 233 var 234 234 baselink, lastlink: LongWord; … … 237 237 Data: Tdata; 238 238 begin 239 OniDataConnection.LoadDatFilePart(fileid, $18, 4, @baselink);240 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @links);239 connection.LoadDatFilePart(fileid, $18, 4, @baselink); 240 connection.LoadDatFilePart(fileid, $1C, 4, @links); 241 241 if links > 0 then 242 242 begin 243 OniDataConnection.LoadDatFilePart(fileid, $20 + (links - 1) * 4, 4, @lastlink);243 connection.LoadDatFilePart(fileid, $20 + (links - 1) * 4, 4, @lastlink); 244 244 SetLength(Data, lastlink + 1024); 245 TOniDataDat( OniDataConnection).LoadRawOffset(False,245 TOniDataDat(connection).LoadRawOffset(False, 246 246 baselink, lastlink + 1024, Data); 247 247 // OniDataConnection.LoadRawFile(fileid,$1C,baselink,lastlink+1024,False,@data[0]); … … 274 274 275 275 276 function TRAM( fileid: LongWord): TRawList;276 function TRAM(connection: TOniData; fileid: LongWord): TRawList; 277 277 var 278 278 i: Integer; … … 287 287 begin 288 288 SetLength(Result, 13); 289 OniDataConnection.LoadDatFilePart(fileid, $16C, 2, @frames);289 connection.LoadDatFilePart(fileid, $16C, 2, @frames); 290 290 {y-pos} 291 OniDataConnection.LoadDatFilePart(fileid, $0C, 4, @link);291 connection.LoadDatFilePart(fileid, $0C, 4, @link); 292 292 Result[0].src_offset := $0C; 293 293 Result[0].raw_addr := link; 294 294 Result[0].raw_size := frames * 4; 295 295 {x-z-pos} 296 OniDataConnection.LoadDatFilePart(fileid, $10, 4, @link);296 connection.LoadDatFilePart(fileid, $10, 4, @link); 297 297 Result[1].src_offset := $10; 298 298 Result[1].raw_addr := link; 299 299 Result[1].raw_size := frames * 8; 300 300 {attacks} 301 OniDataConnection.LoadDatFilePart(fileid, $182, 1, @tempb);302 OniDataConnection.LoadDatFilePart(fileid, $14, 4, @link);301 connection.LoadDatFilePart(fileid, $182, 1, @tempb); 302 connection.LoadDatFilePart(fileid, $14, 4, @link); 303 303 Result[2].src_offset := $14; 304 304 Result[2].raw_addr := link; 305 305 Result[2].raw_size := tempb * 32; 306 306 {damage} 307 OniDataConnection.LoadDatFilePart(fileid, $183, 1, @tempb);308 OniDataConnection.LoadDatFilePart(fileid, $18, 4, @link);307 connection.LoadDatFilePart(fileid, $183, 1, @tempb); 308 connection.LoadDatFilePart(fileid, $18, 4, @link); 309 309 Result[3].src_offset := $18; 310 310 Result[3].raw_addr := link; 311 311 Result[3].raw_size := tempb * 8; 312 312 {motionblur} 313 OniDataConnection.LoadDatFilePart(fileid, $184, 1, @tempb);314 OniDataConnection.LoadDatFilePart(fileid, $1C, 4, @link);313 connection.LoadDatFilePart(fileid, $184, 1, @tempb); 314 connection.LoadDatFilePart(fileid, $1C, 4, @link); 315 315 Result[4].src_offset := $1C; 316 316 Result[4].raw_addr := link; 317 317 Result[4].raw_size := tempb * 8; 318 318 {shortcut} 319 OniDataConnection.LoadDatFilePart(fileid, $185, 1, @tempb);320 OniDataConnection.LoadDatFilePart(fileid, $20, 4, @link);319 connection.LoadDatFilePart(fileid, $185, 1, @tempb); 320 connection.LoadDatFilePart(fileid, $20, 4, @link); 321 321 Result[5].src_offset := $20; 322 322 Result[5].raw_addr := link; 323 323 Result[5].raw_size := tempb * 8; 324 324 {throw} 325 OniDataConnection.LoadDatFilePart(fileid, $24, 4, @link);325 connection.LoadDatFilePart(fileid, $24, 4, @link); 326 326 Result[6].src_offset := $24; 327 327 Result[6].raw_addr := link; … … 331 331 Result[6].raw_size := 0; 332 332 {footstep} 333 OniDataConnection.LoadDatFilePart(fileid, $186, 1, @tempb);334 OniDataConnection.LoadDatFilePart(fileid, $28, 4, @link);333 connection.LoadDatFilePart(fileid, $186, 1, @tempb); 334 connection.LoadDatFilePart(fileid, $28, 4, @link); 335 335 Result[7].src_offset := $28; 336 336 Result[7].raw_addr := link; 337 337 Result[7].raw_size := tempb * 4; 338 338 {particle} 339 OniDataConnection.LoadDatFilePart(fileid, $187, 1, @tempb);340 OniDataConnection.LoadDatFilePart(fileid, $2C, 4, @link);339 connection.LoadDatFilePart(fileid, $187, 1, @tempb); 340 connection.LoadDatFilePart(fileid, $2C, 4, @link); 341 341 Result[8].src_offset := $2C; 342 342 Result[8].raw_addr := link; 343 343 Result[8].raw_size := tempb * 24; 344 344 {position} 345 OniDataConnection.LoadDatFilePart(fileid, $30, 4, @link);345 connection.LoadDatFilePart(fileid, $30, 4, @link); 346 346 Result[9].src_offset := $30; 347 347 Result[9].raw_addr := link; 348 348 Result[9].raw_size := frames * 8; 349 349 {particle} 350 OniDataConnection.LoadDatFilePart(fileid, $154, 2, @tempw);351 OniDataConnection.LoadDatFilePart(fileid, $38, 4, @link);350 connection.LoadDatFilePart(fileid, $154, 2, @tempw); 351 connection.LoadDatFilePart(fileid, $38, 4, @link); 352 352 Result[11].src_offset := $38; 353 353 Result[11].raw_addr := link; 354 354 Result[11].raw_size := tempw * 34; 355 355 {extent} 356 OniDataConnection.LoadDatFilePart(fileid, $138, 4, @templ);357 OniDataConnection.LoadDatFilePart(fileid, $13C, 4, @link);356 connection.LoadDatFilePart(fileid, $138, 4, @templ); 357 connection.LoadDatFilePart(fileid, $13C, 4, @link); 358 358 Result[12].src_offset := $13C; 359 359 Result[12].raw_addr := link; 360 360 Result[12].raw_size := templ * 12; 361 361 362 OniDataConnection.LoadDatFilePart(fileid, $34, 4, @link);362 connection.LoadDatFilePart(fileid, $34, 4, @link); 363 363 if link > 0 then 364 364 begin 365 OniDataConnection.LoadDatFilePart(fileid, $160, 2, @tempw);365 connection.LoadDatFilePart(fileid, $160, 2, @tempw); 366 366 frame_count := 0; 367 367 i := 0; 368 368 SetLength(Data, $FFFF); 369 TOniDataDat( OniDataConnection).LoadRawOffset(False, link, $FFFF, Data);369 TOniDataDat(connection).LoadRawOffset(False, link, $FFFF, Data); 370 370 offset := Data[$24] + Data[$25] * 256; 371 371 while (offset + i < Length(Data)) and (frame_count < frames - 1) do … … 392 392 393 393 394 function TXMP( fileid: LongWord): TRawList;394 function TXMP(connection: TOniData; fileid: LongWord): TRawList; 395 395 var 396 396 link_pc: LongWord; … … 400 400 datasize: LongWord; 401 401 begin 402 OniDataConnection.LoadDatFilePart(fileid, $8C, SizeOf(x), @x);403 OniDataConnection.LoadDatFilePart(fileid, $8E, SizeOf(y), @y);404 OniDataConnection.LoadDatFilePart(fileid, $90, SizeOf(storetype), @storetype);405 OniDataConnection.LoadDatFilePart(fileid, $9C, 4, @link_pc);406 OniDataConnection.LoadDatFilePart(fileid, $A0, 4, @link_mac);402 connection.LoadDatFilePart(fileid, $8C, SizeOf(x), @x); 403 connection.LoadDatFilePart(fileid, $8E, SizeOf(y), @y); 404 connection.LoadDatFilePart(fileid, $90, SizeOf(storetype), @storetype); 405 connection.LoadDatFilePart(fileid, $9C, 4, @link_pc); 406 connection.LoadDatFilePart(fileid, $A0, 4, @link_mac); 407 407 case storetype of 408 408 0, 1, 2: … … 414 414 end; 415 415 SetLength(Result, 1); 416 if not OniDataConnection.OSisMac then416 if not connection.OSisMac then 417 417 begin 418 418 Result[0].src_offset := $9C; … … 425 425 end; 426 426 Result[0].raw_size := datasize; 427 Result[0].loc_sep := OniDataConnection.OSisMac;427 Result[0].loc_sep := connection.OSisMac; 428 428 end; 429 429 … … 444 444 445 445 446 function LoadStructureDefinition( fileid: LongWord): TStructDef;446 function LoadStructureDefinition(connection: TOniData; fileid: LongWord): TStructDef; 447 447 var 448 448 i: LongWord; … … 461 461 SetLength(Result.Subs, 0); 462 462 Result.Data := False; 463 ext := OniDataConnection.GetFileInfo(fileid).Extension;463 ext := connection.GetFileInfo(fileid).Extension; 464 464 filename := ExtractFilePath(Application.ExeName) + '\StructDefs\' + ext + '.txt'; 465 465 if FileExists(filename) then 466 466 begin 467 Data := OniDataConnection.LoadDatFile(fileid);467 Data := connection.LoadDatFile(fileid); 468 468 AssignFile(deffile, filename); 469 469 Reset(deffile); -
oup/current/Code/OniDataClass.pas
r86 r87 1 1 unit OniDataClass; 2 2 interface 3 uses Data, DataStructures,Classes, SysUtils, StrUtils,3 uses Data, Classes, SysUtils, StrUtils, 4 4 Dialogs, ABSDecUtil, ABSMain, DB, Windows; 5 5 … … 21 21 procedure Close; virtual; abstract; 22 22 23 function GetFileInfo(fileid: LongWord): TFileInfo; virtual; abstract;23 function GetFileInfo(fileid: Integer): TFileInfo; virtual; 24 24 function GetFilesList(ext: String; pattern: String; 25 25 NoEmptyFiles: Boolean; sort: TSortType): TStringArray; virtual; abstract; … … 73 73 procedure Close; override; 74 74 75 function GetFileInfo(fileid: LongWord): TFileInfo; override;75 function GetFileInfo(fileid: Integer): TFileInfo; override; 76 76 function GetFilesList(ext: String; pattern: String; 77 77 NoEmptyFiles: Boolean; sort: TSortType): TStringArray; override; … … 112 112 procedure UpdateListCache; 113 113 // function GetDatLinks(srcid:LongWord):TDatLinks; 114 function GetFileInfo(fileid: LongWord): TFileInfo; override;114 function GetFileInfo(fileid: Integer): TFileInfo; override; 115 115 function GetFilesList(ext: String; pattern: String; 116 116 NoEmptyFiles: Boolean; sort: TSortType): TStringArray; override; … … 142 142 constructor Create(OLDBFilename: String; var Result: Boolean); override; 143 143 procedure Close; override; 144 { 145 procedure UpdateListCache; 146 // function GetDatLinks(srcid:LongWord):TDatLinks; 147 function GetFileInfo(fileid: LongWord): TFileInfo; override; 148 function GetFilesList(ext: String; pattern: String; 149 NoEmptyFiles: Boolean; sort: TSortType): TStringArray; override; 150 function GetFilesCount: LongWord; override; 151 function GetExtensionsList: TStringArray; override; 152 function GetExtendedExtensionsList: TExtensionsMap; override; 153 function GetNamedFilesMap: TNamedFilesMap; 154 155 function LoadDatFile(fileid: LongWord): Tdata; override; 156 procedure UpdateDatFile(fileid: LongWord; Data: Tdata); override; 157 procedure LoadDatFilePart(fileid, offset, size: LongWord; target: Pointer); override; 158 procedure UpdateDatFilePart(fileid, offset, size: LongWord; target: Pointer); override; 159 160 function GetRawList(fileid: LongWord): TRawList; override; 161 procedure LoadRawFile(fileid, dat_offset: LongWord; target: Pointer); override; 162 procedure UpdateRawFile(fileid, dat_offset: LongWord; size: LongWord; 163 target: Pointer); override; 164 procedure LoadRawFilePart(fileid, dat_offset: LongWord; 165 offset, size: LongWord; target: Pointer); override; 166 procedure UpdateRawFilePart(fileid, dat_offset: LongWord; 167 offset, size: LongWord; target: Pointer); override; 168 } published 144 published 169 145 end; 170 146 … … 181 157 function CreateDataConnection(filename: String; backend: Integer): TOniData; 182 158 procedure CloseDataConnection(connection: TOniData); 159 function GetEmptyFileInfo: TFileInfo; 183 160 184 161 … … 187 164 188 165 implementation 189 uses Functions;166 uses DataStructures, Functions; 190 167 191 168 … … 252 229 253 230 231 function TOniData.GetFileInfo(fileid: Integer): TFileInfo; 232 begin 233 Result.ID := -1; 234 Result.FileName := ''; 235 Result.FileNameHex := ''; 236 Result.Extension := ''; 237 Result.Name := ''; 238 Result.Size := 0; 239 Result.FileType := 0; 240 Result.DatAddr := 0; 241 Result.opened := False; 242 end; 254 243 255 244 … … 378 367 379 368 380 function TOniDataDat.GetFileInfo(fileid: LongWord): TFileInfo; 381 begin 369 function TOniDataDat.GetFileInfo(fileid: Integer): TFileInfo; 370 begin 371 if fileid = -1 then 372 begin 373 Result := inherited GetFileInfo(fileid); 374 Exit; 375 end; 382 376 if fileid < Self.GetFilesCount then 383 377 Result := Fdat_files[fileid] … … 592 586 if RawListHandlers[i].needed then 593 587 begin 594 Result := RawListHandlers[i].Handler( fileid);588 Result := RawListHandlers[i].Handler(Self, fileid); 595 589 Break; 596 590 end … … 961 955 962 956 963 function TOniDataADB.GetFileInfo(fileid: LongWord): TFileInfo;957 function TOniDataADB.GetFileInfo(fileid: Integer): TFileInfo; 964 958 var 965 959 i: Integer; 966 960 begin 961 if fileid = -1 then 962 begin 963 Result := inherited GetFileInfo(fileid); 964 Exit; 965 end; 967 966 if fileid < Self.GetFilesCount then 968 967 begin … … 1484 1483 begin 1485 1484 DataConnections[i].Close; 1486 DataConnections[i].Free;1485 // DataConnections[i].Free; 1487 1486 DataConnections[i] := nil; 1488 1487 found := True; … … 1500 1499 1501 1500 1501 function GetEmptyFileInfo: TFileInfo; 1502 begin 1503 Result.ID := -1; 1504 Result.FileName := ''; 1505 Result.FileNameHex := ''; 1506 Result.Extension := ''; 1507 Result.Name := ''; 1508 Result.Size := 0; 1509 Result.FileType := 0; 1510 Result.DatAddr := 0; 1511 Result.opened := False; 1512 end; 1513 1514 1502 1515 1503 1516 -
oup/current/Main.dfm
r86 r87 202 202 end 203 203 end 204 end 205 object menu_conns: TTBSubmenuItem 206 Caption = 'Connections' 207 Enabled = False 204 208 end 205 209 object menu_About: TTBItem -
oup/current/Main.pas
r86 r87 75 75 tb_opendb: TTBItem; 76 76 Images_Close: TImageList; 77 menu_conns: TTBSubmenuItem; 77 78 procedure UpdateConLists; 78 79 procedure LoadFile(typedb: Boolean); … … 103 104 procedure menu_view_statusbarClick(Sender: TObject); 104 105 procedure menu_view_toolbarClick(Sender: TObject); 106 procedure menu_conns_itemClick(Sender: TObject); 105 107 procedure MDITabDrawTab(Control: TCustomTabControl; TabIndex: Integer; 106 108 const Rect: TRect; Active: Boolean); … … 166 168 end; 167 169 UpdateStatBar; 170 UpdateConLists; 168 171 end; 169 172 … … 226 229 pt.Y := Y; 227 230 tabIndex := MDITab.GetTabAtPos(pt); 231 hint := ''; 228 232 229 233 if tabIndex >= 0 then … … 231 235 if MDITab.MDIChildren[tabIndex] is TForm_ToolTemplate then 232 236 begin 233 hint := 'Window: ' + MDITab.MDIChildren[tabIndex].Caption + #13+#10 + 234 'Selected File: '; 237 if TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).Connection <> nil then 238 hint := 'Connection: ' + 239 ExtractFileName(TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).Connection.FileName) + #13+#10 240 else 241 hint := 'Connection: none' + #13+#10; 235 242 if TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).SelectedFile.ID >= 0 then 236 hint := hint + TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).SelectedFile.FileName 243 hint := hint + 'Selected File: ' + 244 TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).SelectedFile.FileName 237 245 else 238 hint := hint + ' None';246 hint := hint + 'Selected File: none'; 239 247 end 240 248 else … … 320 328 begin 321 329 Self.Caption := 'Oni Un/Packer ' + version; 322 statbar.Panels.Items[0].Text := ' Nothing loaded';323 statbar.Panels.Items[1].Text := ' Files: -';324 statbar.Panels.Items[2].Text := ' Extensions: -';330 statbar.Panels.Items[0].Text := ''; 331 statbar.Panels.Items[1].Text := 'Connections: -'; 332 statbar.Panels.Items[2].Text := ''; 325 333 ActivateTools(False); 326 334 end; 335 menu_conns.Enabled := Length(DataConnections) > 0; 327 336 end; 328 337 … … 363 372 364 373 374 procedure TForm_Main.menu_conns_itemClick(Sender: TObject); 375 var 376 name: String; 377 i: Integer; 378 begin 379 name := TTBItem(Sender).Caption; 380 if MessageBox(Handle, PChar('Do you really want to close data-connection to' +#13+#10+ 381 name + '?'), PChar('Close?'), MB_YESNO + MB_ICONQUESTION) = ID_YES then 382 begin 383 for i := 0 to High(DataConnections) do 384 if ExtractFileName(DataConnections[i].FileName) = name then 385 begin 386 CloseDataConnection(DataConnections[i]); 387 Break; 388 end; 389 end; 390 UpdateConLists; 391 end; 392 393 365 394 procedure TForm_Main.UpdateConLists; 366 395 var 367 396 i: Integer; 368 begin 369 for i := 0 to MDITab.MDIChildCount - 1 do 370 if MDITab.MDIChildren[i] is TForm_ToolTemplate then 371 TForm_ToolTemplate(MDITab.MDIChildren[i]).UpdateList; 397 entry: TTBItem; 398 begin 399 if MDITab.MDIChildCount > 0 then 400 for i := 0 to MDITab.MDIChildCount - 1 do 401 if MDITab.MDIChildren[i] is TForm_ToolTemplate then 402 TForm_ToolTemplate(MDITab.MDIChildren[i]).UpdateList; 403 404 menu_conns.Clear; 405 if Length(DataConnections) > 0 then 406 begin 407 for i := 0 to High(DataConnections) do 408 begin 409 entry := TTBItem.Create(menu_conns); 410 entry.Caption := ExtractFileName(DataConnections[i].FileName); 411 entry.Name := 'menu_conn_' + IntToStr(i); 412 entry.OnClick := menu_conns_itemClick; 413 menu_conns.Add(entry); 414 entry := nil; 415 end; 416 end; 372 417 end; 373 418 -
oup/current/Tools/BinEdit.dfm
r61 r87 4 4 OnCloseQuery = FormCloseQuery 5 5 OnKeyUp = FormKeyUp 6 ExplicitWidth = 5007 ExplicitHeight = 4508 6 PixelsPerInch = 96 9 7 TextHeight = 13 8 inherited panel_files: TPanel 9 inherited filelist: TListBox 10 ExplicitTop = 153 11 ExplicitHeight = 270 12 end 13 end 10 14 inherited content: TPanel 11 15 object Splitter2: TSplitter -
oup/current/Tools/BinEdit.pas
r75 r87 57 57 procedure value_viewer_contextPopup(Sender: TObject); 58 58 private 59 fileid: LongWord;59 fileid: Integer; 60 60 public 61 61 end; … … 291 291 if VST.RootNodeCount = 0 then 292 292 begin 293 structs := LoadStructureDefinition( fileid);293 structs := LoadStructureDefinition(Connection, fileid); 294 294 if structs.Data then 295 295 begin -
oup/current/Tools/Preview.dfm
r46 r87 3 3 PixelsPerInch = 96 4 4 TextHeight = 13 5 inherited panel_files: TPanel 6 inherited filelist: TListBox 7 ExplicitTop = 153 8 ExplicitHeight = 270 9 end 10 end 5 11 inherited content: TPanel 6 12 object lbl_notpossible: TLabel -
oup/current/Tools/Preview.pas
r86 r87 32 32 bitmaps: array of TBitmap; 33 33 actualimg: Byte; 34 _fileid: LongWord;34 _fileid: Integer; 35 35 public 36 36 end; … … 55 55 begin 56 56 _fileid := fileinfo.ID; 57 lbl_notpossible.Visible := False; 58 Self.img.Visible := True; 59 Self.timer.Enabled := False; 60 Self.panel_buttons.Visible := False; 61 ext := fileinfo.Extension; 62 if (ext = 'PSpc') or (ext = 'TXMB') or (ext = 'TXMP') then 63 PreviewImage 64 else if ext = 'TXAN' then 65 PreviewTXAN 66 else 67 begin 68 Self.lbl_notpossible.Visible := True; 57 if _fileid >= 0 then 58 begin 59 lbl_notpossible.Visible := False; 60 Self.img.Visible := True; 61 Self.timer.Enabled := False; 62 Self.panel_buttons.Visible := False; 63 ext := fileinfo.Extension; 64 if (ext = 'PSpc') or (ext = 'TXMB') or (ext = 'TXMP') then 65 PreviewImage 66 else if ext = 'TXAN' then 67 PreviewTXAN 68 else 69 begin 70 Self.lbl_notpossible.Visible := True; 71 Self.img.Visible := False; 72 end; 73 end 74 else 75 begin 69 76 Self.img.Visible := False; 77 lbl_notpossible.Visible := False; 78 Self.timer.Enabled := False; 79 Self.panel_buttons.Visible := False; 70 80 end; 71 81 end; -
oup/current/Tools/Template.pas
r86 r87 102 102 begin 103 103 oldcon := combo_connection.Items.Strings[combo_connection.ItemIndex]; 104 combo_connection.ItemIndex := -1; 104 105 combo_connection.Items.Clear; 105 for i := 0 to High(DataConnections) do 106 begin 107 level := DataConnections[i].LevelInfo.LevelNumber; 108 fn := ExtractFileName(DataConnections[i].FileName); 109 if DataConnections[i].Backend = ODB_Dat then 110 datatype := 'ONI-.dat: ' 111 else if DataConnections[i].Backend = ODB_ADB then 112 datatype := 'OUP-DB: ' 113 else 114 datatype := 'Unknown: '; 115 boxstring := datatype + fn + ' (Level: ' + IntToStr(level) + ')'; 116 combo_connection.Items.Add(boxstring); 117 if oldcon = boxstring then 118 combo_connection.ItemIndex := combo_connection.Items.Count - 1; 106 if Length(DataConnections) > 0 then 107 begin 108 for i := 0 to High(DataConnections) do 109 begin 110 level := DataConnections[i].LevelInfo.LevelNumber; 111 fn := ExtractFileName(DataConnections[i].FileName); 112 if DataConnections[i].Backend = ODB_Dat then 113 datatype := 'ONI-.dat: ' 114 else if DataConnections[i].Backend = ODB_ADB then 115 datatype := 'OUP-DB: ' 116 else 117 datatype := 'Unknown: '; 118 boxstring := datatype + fn + ' (Level: ' + IntToStr(level) + ')'; 119 combo_connection.Items.Add(boxstring); 120 if oldcon = boxstring then 121 combo_connection.ItemIndex := combo_connection.Items.Count - 1; 122 end; 123 if combo_connection.ItemIndex = -1 then 124 begin 125 combo_connection.ItemIndex := 0; 126 combo_connectionChange(Self); 127 end; 128 end 129 else 130 begin 131 FConnection := nil; 132 filelist.Items.Clear; 133 combo_extension.Items.Clear; 134 combo_connectionChange(Self); 135 FSelectedFile := GetEmptyFileInfo; 136 if Assigned(FOnNewFileSelected) then 137 FOnNewFileSelected(FSelectedFile); 119 138 end; 120 139 end; … … 127 146 begin 128 147 combo_connection.Items.Clear; 129 for i := 0 to High(DataConnections) do 130 begin 131 level := DataConnections[i].LevelInfo.LevelNumber; 132 fn := ExtractFileName(DataConnections[i].FileName); 133 if DataConnections[i].Backend = ODB_Dat then 134 datatype := 'ONI-.dat: ' 135 else if DataConnections[i].Backend = ODB_ADB then 136 datatype := 'OUP-DB: ' 137 else 138 datatype := 'Unknown: '; 139 combo_connection.Items.Add(datatype + fn + ' (Level: ' + IntToStr(level) + ')'); 140 end; 141 FConnection := DataConnections[0]; 142 combo_connection.ItemIndex := 0; 143 combo_connectionChange(Self); 148 if Length(DataConnections) > 0 then 149 begin 150 for i := 0 to High(DataConnections) do 151 begin 152 level := DataConnections[i].LevelInfo.LevelNumber; 153 fn := ExtractFileName(DataConnections[i].FileName); 154 if DataConnections[i].Backend = ODB_Dat then 155 datatype := 'ONI-.dat: ' 156 else if DataConnections[i].Backend = ODB_ADB then 157 datatype := 'OUP-DB: ' 158 else 159 datatype := 'Unknown: '; 160 combo_connection.Items.Add(datatype + fn + ' (Level: ' + IntToStr(level) + ')'); 161 end; 162 FConnection := DataConnections[0]; 163 combo_connection.ItemIndex := 0; 164 combo_connectionChange(Self); 165 end 166 else 167 begin 168 FConnection := nil; 169 filelist.Items.Clear; 170 combo_extension.Items.Clear; 171 combo_connectionChange(Self); 172 end; 144 173 end; 145 174 … … 150 179 begin 151 180 combo_extension.Items.Clear; 152 combo_extension.Items.Add('_All files_ (' +153 IntToStr(FConnection.GetFilesCount) + ')');154 exts := FConnection.GetExtensionsList;155 for i := 0 to High(exts) do156 if Length(FAllowedExts) > 0 then157 begin158 if Pos(MidStr(exts[i],1,4),FAllowedExts) > 0 then181 if FConnection <> nil then 182 begin 183 combo_extension.Items.Add('_All files_ (' + 184 IntToStr(FConnection.GetFilesCount) + ')'); 185 exts := FConnection.GetExtensionsList; 186 for i := 0 to High(exts) do 187 if Length(FAllowedExts) > 0 then 159 188 begin 189 if Pos(MidStr(exts[i],1,4), FAllowedExts) > 0 then 190 begin 191 combo_extension.Items.Add(exts[i]); 192 end; 193 end else 160 194 combo_extension.Items.Add(exts[i]); 161 end; 162 end else 163 combo_extension.Items.Add(exts[i]); 164 combo_extension.ItemIndex := 0; 165 combo_extensionClick(Self); 195 combo_extension.ItemIndex := 0; 196 combo_extensionClick(Self); 197 end; 166 198 end; 167 199 … … 177 209 i: LongWord; 178 210 begin 179 Extension := MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex], 1, 4); 180 no_zero_bytes := not check_zerobyte.Checked; 181 pattern := ''; 182 if check_filtername.Checked then 183 pattern := edit_filtername.Text; 184 if Extension = '_All' then 185 if Length(FAllowedExts) > 0 then 186 Extension := FAllowedExts 187 else 188 Extension := ''; 189 190 files := FConnection.GetFilesList(extension, pattern, no_zero_bytes, FSortBy); 191 192 filelist.Visible := False; 193 filelist.Items.Clear; 194 if Length(files) > 0 then 195 for i := 0 to High(files) do 196 filelist.Items.Add(files[i]); 197 filelist.Visible := True; 211 if FConnection <> nil then 212 begin 213 Extension := MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex], 1, 4); 214 no_zero_bytes := not check_zerobyte.Checked; 215 pattern := ''; 216 if check_filtername.Checked then 217 pattern := edit_filtername.Text; 218 if Extension = '_All' then 219 if Length(FAllowedExts) > 0 then 220 Extension := FAllowedExts 221 else 222 Extension := ''; 223 224 files := FConnection.GetFilesList(extension, pattern, no_zero_bytes, FSortBy); 225 226 filelist.Visible := False; 227 filelist.Items.Clear; 228 if Length(files) > 0 then 229 for i := 0 to High(files) do 230 filelist.Items.Add(files[i]); 231 filelist.Visible := True; 232 end; 198 233 end; 199 234 … … 296 331 inherited; 297 332 RecreateList; 298 FConnection := nil; 299 FSelectedFile.ID := -1; 300 FSelectedFile.FileName := ''; 301 FSelectedFile.FileNameHex := ''; 333 FSelectedFile := GetEmptyFileInfo; 302 334 if Length(ToolList) > 0 then 303 335 begin
Note:
See TracChangeset
for help on using the changeset viewer.