Changeset 92 for oup/current/Tools
- Timestamp:
- Jan 16, 2007, 12:35:04 AM (18 years ago)
- Location:
- oup/current/Tools
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/Tools/BinEdit.dfm
r87 r92 4 4 OnCloseQuery = FormCloseQuery 5 5 OnKeyUp = FormKeyUp 6 ExplicitWidth = 500 7 ExplicitHeight = 450 6 8 PixelsPerInch = 96 7 9 TextHeight = 13 8 inherited panel_files: TPanel9 inherited filelist: TListBox10 ExplicitTop = 15311 ExplicitHeight = 27012 end13 end14 10 inherited content: TPanel 15 11 object Splitter2: TSplitter … … 93 89 Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColSizing] 94 90 PopupMenu = value_viewer_context 91 ScrollBars = ssVertical 95 92 TabOrder = 1 96 93 OnDblClick = value_viewerDblClick … … 194 191 object value_viewer_context: TPopupMenu [3] 195 192 AutoHotkeys = maManual 193 AutoLineReduction = maManual 196 194 OnPopup = value_viewer_contextPopup 197 195 Left = 280 -
oup/current/Tools/BinEdit.pas
r87 r92 32 32 procedure hexChange(Sender: TObject); 33 33 34 procedure LoadDat(_fileid: LongWord);34 procedure LoadDat(_fileid: Integer); 35 35 function Save: Boolean; 36 36 function GetValue(datatype: Word; offset: LongWord): String; … … 57 57 procedure value_viewer_contextPopup(Sender: TObject); 58 58 private 59 con: TOniData; 59 60 fileid: Integer; 60 61 public … … 93 94 value_viewer.RowCount := 8; 94 95 value_viewer.FixedRows := 1; 96 value_viewer.FixedCols := 1; 95 97 value_viewer.Cells[0, 0] := 'Type'; 96 98 value_viewer.Cells[1, 0] := 'Value'; … … 102 104 value_viewer.Cells[0, 6] := 'String'; 103 105 value_viewer.Cells[0, 7] := 'Selected length'; 104 // value_viewer.ColWidths[0] := 100;105 // value_viewer.ColWidths[1] := value_viewer.Width - 150;106 value_viewer.ColWidths[0] := 120; 107 value_viewer.ColWidths[1] := 1000; 106 108 // hex.Height := content.Height - 215; 107 109 // … … 135 137 136 138 137 procedure TForm_BinEdit.LoadDat(_fileid: LongWord);139 procedure TForm_BinEdit.LoadDat(_fileid: Integer); 138 140 var 139 141 mem: TMemoryStream; 140 142 Data: Tdata; 141 143 begin 142 if hex.Modified then 143 begin 144 if not Save then 145 begin 146 Self.SelectFileID(fileid); 147 Exit; 148 end; 149 end; 150 fileid := _fileid; 151 if OniDataConnection.ExtractFileID( 152 filelist.Items.Strings[filelist.ItemIndex]) <> fileid then 153 Self.SelectFileID(fileid); 154 Self.ClearStructViewer; 155 Data := OniDataConnection.LoadDatFile(fileid); 156 if Length(Data) > 0 then 157 begin 158 mem := TMemoryStream.Create; 159 mem.Write(Data[0], Length(Data)); 160 mem.Seek(0, soFromBeginning); 161 hex.LoadFromStream(mem); 162 mem.Free; 163 WriteStructureInfos; 144 if con <> nil then 145 begin 146 if hex.Modified then 147 begin 148 if not Save then 149 begin 150 Self.SelectFileID(Connection, fileid); 151 Exit; 152 end; 153 end; 154 end; 155 if _fileid >= 0 then 156 begin 157 fileid := _fileid; 158 con := Connection; 159 if con.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]) <> fileid then 160 Self.SelectFileID(Connection, fileid); 161 Self.ClearStructViewer; 162 Data := con.LoadDatFile(fileid); 163 if Length(Data) > 0 then 164 begin 165 mem := TMemoryStream.Create; 166 mem.Write(Data[0], Length(Data)); 167 mem.Seek(0, soFromBeginning); 168 hex.LoadFromStream(mem); 169 mem.Free; 170 WriteStructureInfos; 171 end 172 else 173 begin 174 ClearValues; 175 hex.DataSize := 0; 176 end; 164 177 end 165 178 else 166 179 begin 180 fileid := _fileid; 181 con := nil; 182 Self.ClearStructViewer; 167 183 ClearValues; 168 184 hex.DataSize := 0; … … 226 242 Result := IntToBin(hex.Data[offset]); 227 243 11: 228 Result := '0x' + IntToHex( OniDataConnection.GetRawInfo(fileid, offset).raw_addr, 8);244 Result := '0x' + IntToHex(con.GetRawInfo(fileid, offset).raw_addr, 8); 229 245 12: 230 246 Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 + … … 291 307 if VST.RootNodeCount = 0 then 292 308 begin 293 structs := LoadStructureDefinition( Connection, fileid);309 structs := LoadStructureDefinition(con, fileid); 294 310 if structs.Data then 295 311 begin … … 501 517 begin 502 518 case MessageBox(Self.Handle, PChar('Save changes to file ' + 503 OniDataConnection.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'),519 con.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'), 504 520 MB_YESNOCANCEL) of 505 521 idYes: … … 511 527 mem.Read(Data[0], mem.Size); 512 528 mem.Free; 513 OniDataConnection.UpdateDatFile(fileid, Data);529 con.UpdateDatFile(fileid, Data); 514 530 hex.Modified := False; 515 531 for i := 0 to hex.Datasize - 1 do … … 762 778 if nodedata.DataType = 11 then 763 779 begin 764 if OniDataConnection.GetRawInfo(fileid, nodedata.offset).raw_size > 0 then765 Form_Main.open_child('rawedit', fileid);780 if con.GetRawInfo(fileid, nodedata.offset).raw_size > 0 then 781 Form_Main.open_child('rawedit', Connection, fileid); 766 782 end; 767 783 if nodedata.DataType = 12 then 768 784 begin 769 if (StrToInt(nodedata.Value) < OniDataConnection.GetFilesCount) and785 if (StrToInt(nodedata.Value) < con.GetFilesCount) and 770 786 (StrToInt(nodedata.Value) > 0) and 771 787 (StrToInt(nodedata.Value) <> fileid) then 772 788 begin 773 if OniDataConnection.GetFileInfo(StrToInt(nodedata.Value)).Size > 0 then774 Form_Main.open_child('binedit', StrToInt(nodedata.Value))789 if con.GetFileInfo(StrToInt(nodedata.Value)).Size > 0 then 790 Form_Main.open_child('binedit', Connection, StrToInt(nodedata.Value)) 775 791 else 776 792 ShowMessage('Linked filed is a zero-byte-file'); … … 779 795 if (nodedata.DataType >= 100) and (nodedata.DataType <= 300) then 780 796 begin 781 form := Form_Main.open_child('binedit', -1);797 form := Form_Main.open_child('binedit', Connection, -1); 782 798 if Assigned(form) then 783 799 form.SetFileFilters(nodedata.Value, '', False); -
oup/current/Tools/Extractor.dfm
r86 r92 22 22 Width = 333 23 23 Height = 338 24 ExplicitTop = 15325 24 ExplicitWidth = 333 26 25 ExplicitHeight = 338 … … 29 28 Width = 333 30 29 ExplicitWidth = 333 30 inherited Bevel1: TBevel 31 Width = 327 32 ExplicitWidth = 327 33 end 31 34 inherited combo_extension: TComboBox 32 35 Width = 325 … … 39 42 Width = 325 40 43 ExplicitWidth = 325 44 end 45 inherited combo_connection: TComboBox 46 Width = 263 47 ExplicitWidth = 263 41 48 end 42 49 end -
oup/current/Tools/Extractor.pas
r86 r92 105 105 if (selonly and filelist.Selected[i]) or not selonly then 106 106 begin 107 fileid := OniDataConnection.ExtractFileID(filelist.Items.Strings[i]);107 fileid := Connection.ExtractFileID(filelist.Items.Strings[i]); 108 108 filename := GetWinFilename(filelist.Items.Strings[i]); 109 109 if check_dat.Checked then -
oup/current/Tools/RawEdit.dfm
r75 r92 23 23 end 24 24 inherited filelist: TListBox 25 Height = 7626 ExplicitHeight = 7625 Height = 52 26 ExplicitHeight = 52 27 27 end 28 28 object panel_imexport: TPanel … … 79 79 end 80 80 inherited content: TPanel 81 OnResize = panel_contentResize82 81 object Splitter2: TSplitter 83 82 Left = 0 … … 152 151 ParentFont = False 153 152 PopupMenu = value_viewer_context 153 ScrollBars = ssVertical 154 154 TabOrder = 1 155 155 OnDblClick = value_viewerDblClick -
oup/current/Tools/RawEdit.pas
r75 r92 39 39 procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 40 40 41 procedure panel_contentResize(Sender: TObject);42 43 41 function GetValue(datatype: Word; offset: LongWord): String; 44 42 procedure ClearValues; … … 58 56 fileid: Integer; 59 57 dat_offset: LongWord; 60 fileid_opened, dat_offset_opened: LongWord;58 fileid_opened, dat_offset_opened: Integer; 61 59 public 62 60 end; … … 74 72 i: Integer; 75 73 begin 76 if hex.Modified then 77 if not Save then 78 Exit; 79 ClearValues; 80 hex.DataSize := 0; 81 fileid := fileinfo.ID; 82 list_offset.Enabled := False; 83 if fileinfo.size > 0 then 84 begin 85 offsets := OniDataConnection.GetRawList(fileid); 74 if fileinfo.ID >= 0 then 75 begin 76 if hex.Modified then 77 if not Save then 78 Exit; 79 ClearValues; 80 hex.DataSize := 0; 81 fileid := fileinfo.ID; 82 list_offset.Enabled := False; 83 if fileinfo.size > 0 then 84 begin 85 offsets := Connection.GetRawList(fileid); 86 list_offset.Items.Clear; 87 if Length(offsets) > 0 then 88 for i := 0 to High(offsets) do 89 list_offset.Items.Add('0x' + IntToHex(offsets[i].src_offset, 8) + 90 ', ' + IntToStr(offsets[i].raw_size) + ' bytes'); 91 list_offset.Enabled := True; 92 end; 93 end 94 else 95 begin 96 ClearValues; 97 hex.DataSize := 0; 98 fileid := -1; 86 99 list_offset.Items.Clear; 87 if Length(offsets) > 0 then88 for i := 0 to High(offsets) do89 list_offset.Items.Add('0x' + IntToHex(offsets[i].src_offset, 8) +90 ', ' + IntToStr(offsets[i].raw_size) + ' bytes');91 list_offset.Enabled := True;92 100 end; 93 101 end; … … 109 117 for i := 0 to filelist.Count - 1 do 110 118 begin 111 if OniDataConnection.ExtractFileID(filelist.Items.Strings[i]) = raw_info.src_id then119 if Connection.ExtractFileID(filelist.Items.Strings[i]) = raw_info.src_id then 112 120 begin 113 121 filelist.ItemIndex := i; … … 126 134 end; 127 135 SetLength(Data, raw_info.raw_size); 128 OniDataConnection.LoadRawFile(raw_info.src_id, raw_info.src_offset, @Data[0]);136 Connection.LoadRawFile(raw_info.src_id, raw_info.src_offset, @Data[0]); 129 137 if Length(Data) > 0 then 130 138 begin … … 158 166 dat_offset := StrToInt('$' + MidStr( 159 167 list_offset.Items.Strings[list_offset.ItemIndex], 3, 8)); 160 LoadRaw( OniDataConnection.GetRawInfo(fileid, dat_offset));168 LoadRaw(Connection.GetRawInfo(fileid, dat_offset)); 161 169 end; 162 170 … … 391 399 } 392 400 value_viewer.FixedRows := 1; 401 value_viewer.FixedCols := 1; 393 402 value_viewer.Cells[0, 0] := 'Type'; 394 403 value_viewer.Cells[1, 0] := 'Value'; … … 400 409 value_viewer.Cells[0, 6] := 'String'; 401 410 value_viewer.Cells[0, 7] := 'Selected length'; 402 value_viewer.ColWidths[0] := 100; 411 value_viewer.ColWidths[0] := 125; 412 value_viewer.ColWidths[1] := 1000; 403 413 // 404 414 value_viewer.Font.Charset := AppSettings.CharSet; … … 416 426 begin 417 427 case MessageBox(Self.Handle, PChar('Save changes to .raw-part of file ' + 418 OniDataConnection.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'),428 Connection.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'), 419 429 MB_YESNOCANCEL) of 420 430 idYes: … … 426 436 mem.Read(Data[0], mem.Size); 427 437 mem.Free; 428 OniDataConnection.UpdateRawFile(fileid_opened, dat_offset_opened,438 Connection.UpdateRawFile(fileid_opened, dat_offset_opened, 429 439 Length(Data), @Data[0]); 430 440 hex.Modified := False; … … 452 462 CanClose := False; 453 463 end; 454 end;455 456 457 458 459 procedure TForm_RawEdit.panel_contentResize(Sender: TObject);460 begin461 if fileid >= 0 then462 value_viewer.ColWidths[1] := value_viewer.Width - value_viewer.ColWidths[0] - 50;463 464 end; 464 465 … … 546 547 fs: TFileStream; 547 548 begin 548 saved.Filter := 'Files of matching extension (*.' + OniDataConnection.GetFileInfo(549 fileid).Extension + ')|*.' + OniDataConnection.GetFileInfo(fileid).Extension +549 saved.Filter := 'Files of matching extension (*.' + Connection.GetFileInfo( 550 fileid).Extension + ')|*.' + Connection.GetFileInfo(fileid).Extension + 550 551 '|All files|*.*'; 551 saved.DefaultExt := OniDataConnection.GetFileInfo(fileid).Extension;552 saved.DefaultExt := Connection.GetFileInfo(fileid).Extension; 552 553 if saved.Execute then 553 554 begin … … 566 567 fs: TFileStream; 567 568 begin 568 opend.Filter := 'Files of matching extension (*.' + OniDataConnection.GetFileInfo(569 fileid).Extension + ')|*.' + OniDataConnection.GetFileInfo(fileid).Extension +569 opend.Filter := 'Files of matching extension (*.' + Connection.GetFileInfo( 570 fileid).Extension + ')|*.' + Connection.GetFileInfo(fileid).Extension + 570 571 '|All files|*.*'; 571 572 if opend.Execute then -
oup/current/Tools/Template.dfm
r86 r92 52 52 OnClick = listClick 53 53 OnMouseDown = listMouseDown 54 ExplicitTop = 12955 ExplicitHeight = 29456 54 end 57 55 object panel_extension: TPanel -
oup/current/Tools/Template.pas
r87 r92 44 44 procedure RecreateExtList; 45 45 procedure LoadFileNames; 46 procedure SelectFileName( filename: String);47 procedure SelectFileID( id: Integer);46 procedure SelectFileName(connection: TOniData; filename: String); 47 procedure SelectFileID(connection: TOniData; id: Integer); 48 48 procedure check_filternameClick(Sender: TObject); 49 49 procedure check_zerobyteClick(Sender: TObject); … … 285 285 id := FConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]); 286 286 context := MidStr(sender_name, Pos('_', sender_name) + 1, Length(sender_name) - Pos('_', sender_name)); 287 Form_Main.open_child(context, id);287 Form_Main.open_child(context, FConnection, id); 288 288 end; 289 289 … … 415 415 416 416 417 procedure TForm_ToolTemplate.SelectFileID(id: Integer); 418 var 419 i: Integer; 420 begin 417 procedure TForm_ToolTemplate.SelectFileID(connection: TOniData; id: Integer); 418 var 419 i: Integer; 420 name: String; 421 nstart, nend: Integer; 422 begin 423 for i := 0 to combo_connection.Items.Count - 1 do 424 begin 425 name := combo_connection.Items.Strings[i]; 426 nstart := Pos(' ', name) + 1; 427 nend := Pos('(', name) - 1; 428 name := MidStr(name, nstart, nend - nstart); 429 430 if ExtractFileName(connection.FileName) = name then 431 begin 432 combo_connection.ItemIndex := i; 433 combo_connectionChange(Self); 434 end; 435 end; 436 421 437 filelist.ItemIndex := -1; 422 438 if filelist.Items.Count > 0 then … … 430 446 end; 431 447 432 procedure TForm_ToolTemplate.SelectFileName(filename: String); 433 var 434 i: Integer; 435 begin 448 procedure TForm_ToolTemplate.SelectFileName(connection: TOniData; filename: String); 449 var 450 i: Integer; 451 name: String; 452 nstart, nend: Integer; 453 begin 454 for i := 0 to combo_connection.Items.Count - 1 do 455 begin 456 name := combo_connection.Items.Strings[i]; 457 nstart := Pos(' ', name) + 1; 458 nend := Pos('(', name) - 1; 459 name := MidStr(name, nstart, nend - nstart); 460 461 if ExtractFileName(connection.FileName) = name then 462 begin 463 combo_connection.ItemIndex := i; 464 combo_connectionChange(Self); 465 end; 466 end; 467 436 468 filelist.ItemIndex := -1; 437 469 if filelist.Items.Count > 0 then -
oup/current/Tools/TxmpReplace.dfm
r86 r92 1 1 inherited Form_TxmpReplace: TForm_TxmpReplace 2 2 Caption = 'TxmpReplace' 3 ExplicitWidth = 3204 ExplicitHeight = 2405 3 PixelsPerInch = 96 6 4 TextHeight = 13 … … 37 35 Height = 146 38 36 Align = alTop 39 ExplicitTop = 15340 37 ExplicitHeight = 146 41 38 end -
oup/current/Tools/TxmpReplace.pas
r86 r92 52 52 begin 53 53 fileid := fileinfo.ID; 54 OniDataConnection.LoadDatFilePart(fileid, $88, SizeOf(fadingbyte), @fadingbyte);55 OniDataConnection.LoadDatFilePart(fileid, $89, SizeOf(depthbyte), @depthbyte);56 OniDataConnection.LoadDatFilePart(fileid, $90, SizeOf(storebyte), @storebyte);54 Connection.LoadDatFilePart(fileid, $88, SizeOf(fadingbyte), @fadingbyte); 55 Connection.LoadDatFilePart(fileid, $89, SizeOf(depthbyte), @depthbyte); 56 Connection.LoadDatFilePart(fileid, $90, SizeOf(storebyte), @storebyte); 57 57 check_fading.Checked := (fadingbyte and $01) > 0; 58 58 check_transparency.Checked := (depthbyte and $04) > 0; … … 103 103 if filelist.ItemIndex >= 0 then 104 104 begin 105 OniDataConnection.LoadDatFilePart(fileid, $88, 1, @oldfading);106 if OniDataConnection.OSisMac then107 OniDataConnection.UpdateDatFilePart(fileid, $A0, 4, @old_rawaddr)105 Connection.LoadDatFilePart(fileid, $88, 1, @oldfading); 106 if Connection.OSisMac then 107 Connection.UpdateDatFilePart(fileid, $A0, 4, @old_rawaddr) 108 108 else 109 OniDataConnection.LoadDatFilePart(fileid, $9C, 4, @old_rawaddr);109 Connection.LoadDatFilePart(fileid, $9C, 4, @old_rawaddr); 110 110 111 111 if (OniImage_Old.Width <> OniImage_New.Width) or … … 138 138 newsize := OniImage_New.GetImageDataSize(check_fading.Checked); 139 139 140 if (newsize > old_size) and ( OniDataConnection.Backend = ODB_Dat) then141 new_rawaddr := OniDataConnection.AppendRawFile(142 OniDataConnection.OSisMac, Length(tempd), tempd)140 if (newsize > old_size) and (Connection.Backend = ODB_Dat) then 141 new_rawaddr := Connection.AppendRawFile( 142 Connection.OSisMac, Length(tempd), tempd) 143 143 else 144 144 begin 145 145 new_rawaddr := old_rawaddr; 146 OniDataConnection.UpdateRawFile(fileid, $9C, Length(tempd), tempd);146 Connection.UpdateRawFile(fileid, $9C, Length(tempd), tempd); 147 147 end; 148 148 … … 150 150 if check_fading.Checked then 151 151 datbyte := datbyte or $01; 152 OniDataConnection.UpdateDatFilePart(fileid, $88, 1, @datbyte);152 Connection.UpdateDatFilePart(fileid, $88, 1, @datbyte); 153 153 datbyte := $10; 154 154 if check_transparency.Checked then 155 155 datbyte := datbyte or $04; 156 OniDataConnection.UpdateDatFilePart(fileid, $89, 1, @datbyte);157 OniDataConnection.UpdateDatFilePart(fileid, $8C, 2, @OniImage_New.Width);158 OniDataConnection.UpdateDatFilePart(fileid, $8E, 2, @OniImage_New.Height);156 Connection.UpdateDatFilePart(fileid, $89, 1, @datbyte); 157 Connection.UpdateDatFilePart(fileid, $8C, 2, @OniImage_New.Width); 158 Connection.UpdateDatFilePart(fileid, $8E, 2, @OniImage_New.Height); 159 159 datbyte := $08; 160 OniDataConnection.UpdateDatFilePart(fileid, $90, 1, @datbyte);161 if OniDataConnection.OSisMac then162 OniDataConnection.UpdateDatFilePart(fileid, $A0, 4, @new_rawaddr)160 Connection.UpdateDatFilePart(fileid, $90, 1, @datbyte); 161 if Connection.OSisMac then 162 Connection.UpdateDatFilePart(fileid, $A0, 4, @new_rawaddr) 163 163 else 164 OniDataConnection.UpdateDatFilePart(fileid, $9C, 4, @new_rawaddr);164 Connection.UpdateDatFilePart(fileid, $9C, 4, @new_rawaddr); 165 165 166 166 ShowMessage('TXMP-image replaced');
Note:
See TracChangeset
for help on using the changeset viewer.