Changeset 92 for oup/current
- Timestamp:
- Jan 16, 2007, 12:35:04 AM (18 years ago)
- Location:
- oup/current
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/Code/DataStructures.pas
r87 r92 136 136 connection.LoadDatFilePart(fileid, $20 + i * 4, 4, @link); 137 137 Result[i].raw_addr := link; 138 Result[i].raw_size := 0{????????????????????????????????};138 Result[i].raw_size := 32; 139 139 Result[i].loc_sep := False; 140 140 end; … … 198 198 Result[0].raw_addr := link; 199 199 Result[0].raw_size := datasize; 200 Result[0].loc_sep := OniDataConnection.OSisMac;200 Result[0].loc_sep := connection.OSisMac; 201 201 end; 202 202 … … 245 245 TOniDataDat(connection).LoadRawOffset(False, 246 246 baselink, lastlink + 1024, Data); 247 // OniDataConnection.LoadRawFile(fileid,$1C,baselink,lastlink+1024,False,@data[0]);247 // connection.LoadRawFile(fileid,$1C,baselink,lastlink+1024,False,@data[0]); 248 248 k := 0; 249 249 for j := 0 to 1024 do … … 595 595 begin 596 596 Raws := ''; 597 // InsertRawListHandler('AGDB',True,AGDB);597 InsertRawListHandler('AGDB',False,AGDB); 598 598 InsertRawListHandler('AKVA', True, AKVA); 599 599 InsertRawListHandler('BINA', True, BINA); -
oup/current/Code/OniDataClass.pas
r87 r92 136 136 end; 137 137 138 TOniDataEmpty = class(TOniData) 139 private 140 protected 141 public 142 constructor Create(OLDBFilename: String; var Result: Boolean); override; 143 procedure Close; override; 144 published 145 end; 138 146 139 147 140 const … … 151 144 152 145 var 153 // OniDataConnection: TOniData;154 146 DataConnections: array of TOniData; 155 OniDataConnection: TOniData;156 147 157 148 function CreateDataConnection(filename: String; backend: Integer): TOniData; 149 function ConnectionExists(filename: String): TOniData; 158 150 procedure CloseDataConnection(connection: TOniData); 159 151 function GetEmptyFileInfo: TFileInfo; … … 213 205 Result.raw_addr := 0; 214 206 Result.raw_size := 0; 215 for i := 0 to High(raw_list) do 216 begin 217 if raw_list[i].src_offset = dat_offset then 218 begin 219 Result.src_id := fileid; 220 Result.src_offset := raw_list[i].src_offset; 221 Result.raw_addr := raw_list[i].raw_addr; 222 Result.raw_size := raw_list[i].raw_size; 223 Result.loc_sep := raw_list[i].loc_sep; 224 Break; 207 if Length(raw_list) > 0 then 208 begin 209 for i := 0 to High(raw_list) do 210 begin 211 if raw_list[i].src_offset = dat_offset then 212 begin 213 Result.src_id := fileid; 214 Result.src_offset := raw_list[i].src_offset; 215 Result.raw_addr := raw_list[i].raw_addr; 216 Result.raw_size := raw_list[i].raw_size; 217 Result.loc_sep := raw_list[i].loc_sep; 218 Break; 219 end; 225 220 end; 226 221 end; … … 1466 1461 1467 1462 1463 function ConnectionExists(filename: String): TOniData; 1464 var 1465 i: Integer; 1466 begin 1467 Result := nil; 1468 if Length(DataConnections) > 0 then 1469 for i := 0 to High(DataConnections) do 1470 if DataConnections[i].FFileName = filename then 1471 begin 1472 Result := DataConnections[i]; 1473 Exit; 1474 end; 1475 end; 1468 1476 1469 1477 … … 1513 1521 1514 1522 1515 1516 1517 constructor TOniDataEmpty.Create(OLDBFilename: String; var Result: Boolean);1518 var1519 i, j: Byte;1520 temps: String;1521 begin1522 ShowMessage('OLD');1523 end;1524 1525 procedure TOniDataEmpty.Close;1526 begin1527 ShowMessage('OLD');1528 end;1529 1530 1523 end. -
oup/current/Code/OniImgClass.pas
r86 r92 439 439 txmpimg.DataType := [DT_Decoded32]; 440 440 txmpimg.Depth := 32; 441 txmpimg.WriteToBMP(' D:\' + IntToStr(i) + '.bmp');441 txmpimg.WriteToBMP('M:\' + IntToStr(i) + '.bmp'); 442 442 end; 443 443 end; -
oup/current/Helper_LevelDB.pas
r86 r92 59 59 Stream_Body, Stream_Names: TMemoryStream; 60 60 Stream_Dat, Stream_Raw, Stream_Sep: TFileStream; 61 OniDataConnection: TOniData; 61 62 62 63 … … 107 108 timeformat.LongTimeFormat := 'hh:nn:ss'; 108 109 timeformat.TimeSeparator := ':'; 110 111 connection := ConnectionExists(target); 112 if connection <> nil then 113 begin 114 ShowMessage('Destination-file is opened, close it in order to proceed conversion?'); 115 Exit; 116 end; 117 118 connection := ConnectionExists(source); 119 if connection <> nil then 120 begin 121 ShowMessage('Source-file is opened, close it in order to proceed conversion?'); 122 Exit; 123 end; 124 109 125 110 126 if CreateDataConnection(Source, ODB_ADB) = nil then -
oup/current/ImportedStuff/OneInst.pas
r88 r92 1 { Downloaded from: http://www.michael-puff.de/Developer/Delphi/Importe/Nico/oneinst.zip } 2 1 3 unit OneInst; 2 3 4 interface 4 5 5 uses 6 6 Windows, Messages; … … 22 22 { Der Text den diese Variable hat sollte bei jedem neuen Programm geändert } 23 23 { werden und möglichst eindeutig (und nicht zu kurz) sein. } 24 UniqueName: array [0..MAX_PATH] of Char = ' EindeutigerNameFuerDasProgramm'#0;24 UniqueName: array [0..MAX_PATH] of Char = 'Oni Un/Packer'#0; 25 25 MutexHandle: THandle = 0; 26 26 -
oup/current/Main.pas
r87 r92 7 7 Dialogs, StdCtrls, StrUtils, Clipbrd, ExtCtrls, ComCtrls, Menus, Grids, 8 8 MPHexEditor, ToolWin, ImgList, Tabs, 9 MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI, 9 MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI, OneInst, 10 10 Data, Functions, DataStructures, OniDataClass, Exporters, 11 11 Helper_LevelDB, Settings, Template, … … 89 89 procedure menu_windows_nextClick(Sender: TObject); 90 90 procedure menu_windows_tileClick(Sender: TObject); 91 function open_child(window_context: String; fileid: Integer): TForm_ToolTemplate;91 function open_child(window_context: String; connection: TOniData; fileid: Integer): TForm_ToolTemplate; 92 92 procedure menu_windows_closeallClick(Sender: TObject); 93 93 procedure menu_windows_cascadeClick(Sender: TObject); … … 116 116 procedure MDITabMouseMove(Sender: TObject; Shift: TShiftState; X, 117 117 Y: Integer); 118 private 118 119 procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA; 119 120 public 121 procedure DefaultHandler(var Message); override; 122 public 120 123 end; 121 124 … … 126 129 127 130 {$R *.dfm} 131 132 133 134 { Eine zweite Instanz hat uns ihre Kommandozeilenparameter geschickt } 135 procedure TForm_Main.WMCopyData(var Msg: TWMCopyData); 136 var 137 strings: TStringList; 138 begin 139 if (Msg.CopyDataStruct.dwData = SecondInstMsgId) and (SecondInstMsgId <> 0) then 140 begin 141 Application.BringToFront; 142 143 strings := TStringList.Create; 144 strings.Text := ParamBlobToStr(Msg.CopyDataStruct.lpData); 145 if strings.Count = 2 then 146 begin 147 if strings.Strings[0] = 'opf' then 148 begin 149 ShowMessage('Load OPF-File: ' + ParamStr(2)); 150 end 151 else if strings.Strings[0] = 'oldb' then 152 begin 153 if CreateDataConnection(strings.Strings[1], ODB_ADB) = nil then 154 ShowMessage('Error while loading the file:' + CrLf + 155 strings.Strings[1] + CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?'); 156 end 157 else if strings.Strings[0] = 'dat' then 158 begin 159 if CreateDataConnection(strings.Strings[1], ODB_Dat) = nil then 160 ShowMessage('Error while loading the file:' + CrLf + 161 strings.Strings[1] + CrLf + 'Perhaps not an Oni-.dat-file?'); 162 end; 163 UpdateStatBar; 164 UpdateConLists; 165 end; 166 end 167 else 168 inherited; 169 end; 170 171 {----------------------------------------------------------------------------} 172 { Wir überschreiben den DefaultHandler, der alle Nachrichten zuerst bekommt, } 173 { damit wir auf die Nachricht mit der ID SecondInstMsgId reagieren können. } 174 { (Dies ist notwendig, da wir jetzt noch nicht wissen welchen Wert } 175 { die ID haben wird, weswegen wir keine statische Message-Prozedure, } 176 { so wie bei WM_COPYDATA, schreiben können.) } 177 {----------------------------------------------------------------------------} 178 procedure TForm_Main.DefaultHandler(var Message); 179 begin 180 if TMessage(Message).Msg = SecondInstMsgId then 181 { Eine zweite Instanz hat uns nach dem Handle gefragt } 182 { Es wird in die Message-Queue des Threads gepostet. } 183 PostThreadMessage(TMessage(Message).WParam, SecondInstMsgId, Handle, 0) 184 else 185 inherited; 186 end; 128 187 129 188 … … 388 447 end; 389 448 end; 449 UpdateStatBar; 390 450 UpdateConLists; 391 451 end; … … 482 542 procedure TForm_Main.menu_createdbClick(Sender: TObject); 483 543 begin 484 { if Assigned(OniDataConnection) then 485 if MessageBox(Self.Handle, PChar('You have currently opened a level-file. ' + 486 'Do you want to close it to continue?'), PChar('Close file?'), 487 MB_YESNO + MB_ICONQUESTION) = ID_NO then 488 Exit 489 else begin 490 if TryCloseAll then 491 begin 492 CloseDataConnection; 493 UpdateStatBar; 494 end else 495 Exit; 496 end; 544 ShowMessage('Not yet usable'); 545 { 497 546 opend.Filter := 'Oni-Dat-Files|*.dat'; 498 547 saved.Filter := 'OUP-Level-DB (*.oldb)|*.oldb'; … … 501 550 if saved.Execute then 502 551 Form_LevelDB.CreateDatabase(opend.FileName, saved.FileName); 503 }end; 552 } 553 end; 504 554 505 555 … … 508 558 procedure TForm_Main.menu_createlvlClick(Sender: TObject); 509 559 begin 510 { if Assigned(OniDataConnection) then 511 if MessageBox(Self.Handle, PChar('You have currently opened a level-file. ' + 512 'Do you want to close it to continue?'), PChar('Close file?'), 513 MB_YESNO + MB_ICONQUESTION) = ID_NO then 514 Exit 515 else begin 516 if TryCloseAll then 517 begin 518 CloseDataConnection; 519 UpdateStatBar; 520 end else 521 Exit; 522 end; 560 ShowMessage('Not yet usable'); 561 { 523 562 opend.Filter := 'OUP-Level-DB (*.oldb)|*.oldb'; 524 563 saved.Filter := 'Oni-Dat-Files|*.dat'; … … 527 566 if saved.Execute then 528 567 Form_LevelDB.CreateLevel(opend.FileName, saved.FileName); 529 }end; 568 } 569 end; 530 570 531 571 {#################################} … … 534 574 procedure TForm_Main.menu_previewClick(Sender: TObject); 535 575 begin 536 open_child('preview', -1);576 open_child('preview', nil, -1); 537 577 end; 538 578 … … 540 580 procedure TForm_Main.menu_txmpreplaceClick(Sender: TObject); 541 581 begin 542 open_child('txmpreplace', -1);582 open_child('txmpreplace', nil, -1); 543 583 end; 544 584 … … 546 586 procedure TForm_Main.menu_bineditClick(Sender: TObject); 547 587 begin 548 open_child('binedit', -1);588 open_child('binedit', nil, -1); 549 589 end; 550 590 … … 552 592 procedure TForm_Main.menu_raweditClick(Sender: TObject); 553 593 begin 554 open_child('rawedit', -1);594 open_child('rawedit', nil, -1); 555 595 end; 556 596 … … 558 598 procedure TForm_Main.menu_extractorClick(Sender: TObject); 559 599 begin 560 open_child('extractor', -1);600 open_child('extractor', nil, -1); 561 601 end; 562 602 … … 570 610 procedure TForm_Main.menu_filecompareClick(Sender: TObject); 571 611 begin 572 open_child('compare', -1);612 open_child('compare', nil, -1); 573 613 end; 574 614 … … 666 706 667 707 668 function TForm_Main.open_child(window_context: String; fileid: Integer): TForm_ToolTemplate;708 function TForm_Main.open_child(window_context: String; connection: TOniData; fileid: Integer): TForm_ToolTemplate; 669 709 var 670 710 toolform: TForm_ToolTemplate; … … 722 762 MDITab.AddTab(TForm(toolform), iconindex); 723 763 toolform.Caption := AnsiReplaceStr(toolform.Caption, ' ', ''); 724 if fileid > -1 then 725 toolform.SelectFileID(fileid); 764 if (fileid > -1) and (connection <> nil) then 765 begin 766 toolform.SelectFileID(connection, fileid); 767 end; 726 768 Result := toolform; 727 769 end; -
oup/current/OniUnPacker.bdsproj
r88 r92 178 178 </Language> 179 179 180 181 182 180 <Excluded_Packages> 183 181 <Excluded_Packages Name="d:\programme\borland\bds\3.0\Bin\dbwebxprt.bpl">Borland Web Wizard Package</Excluded_Packages> -
oup/current/OniUnPacker.dpr
r88 r92 2 2 3 3 uses 4 Forms, Windows,4 Forms, 5 5 Main in 'Main.pas' {Form_Main}, 6 6 Data in 'Data.pas', … … 8 8 Helper_ValueEdit in 'Helper_ValueEdit.pas' {Form_ValueEdit}, 9 9 Settings in 'Settings.pas' {Form_Settings}, 10 FTypeReg in 'FTypeReg.pas',11 10 Functions in 'Code\Functions.pas', 12 11 Exporters in 'Code\Exporters.pas', … … 20 19 RawEdit in 'Tools\RawEdit.pas' {Form_ToolTemplate4}, 21 20 TxmpReplace in 'Tools\TxmpReplace.pas' {Form_ToolTemplate5}, 22 FolderBrowser in 'Code\FolderBrowser.pas'; 21 FTypeReg in 'ImportedStuff\FTypeReg.pas', 22 FolderBrowser in 'ImportedStuff\FolderBrowser.pas', 23 OneInst in 'ImportedStuff\OneInst.pas'; 23 24 24 25 {$R *.res} 25 26 {$R ExtraIcos.res} 26 const27 MutexName = 'Oni Un/Packer';28 var29 hMutex: THandle;30 27 31 28 begin 32 hMutex := CreateMutex(nil, True, MutexName); 33 if (hMutex = 0) or (GetLastError = ERROR_ALREADY_EXISTS) then 34 begin 35 PostMessage(HWND_BROADCAST, 0, 0, 0); 36 end 37 else 38 begin 39 Application.Initialize; 40 Application.Title := 'Oni Un/Packer'; 41 Application.CreateForm(TForm_Main, Form_Main); 42 Application.CreateForm(TForm_LevelDB, Form_LevelDB); 43 Application.CreateForm(TForm_ValueEdit, Form_ValueEdit); 44 Application.CreateForm(TForm_Settings, Form_Settings); 45 Application.Run; 46 end; 47 CloseHandle(hMutex); 29 Application.Initialize; 30 Application.Title := 'Oni Un/Packer'; 31 Application.CreateForm(TForm_Main, Form_Main); 32 Application.CreateForm(TForm_LevelDB, Form_LevelDB); 33 Application.CreateForm(TForm_ValueEdit, Form_ValueEdit); 34 Application.CreateForm(TForm_Settings, Form_Settings); 35 Application.Run; 48 36 end. -
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.