Changeset 92


Ignore:
Timestamp:
Jan 16, 2007, 12:35:04 AM (15 years ago)
Author:
alloc
Message:

Rev86 was first after multi-cons

Location:
oup/current
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • oup/current/Code/DataStructures.pas

    r87 r92  
    136136      connection.LoadDatFilePart(fileid, $20 + i * 4, 4, @link);
    137137      Result[i].raw_addr := link;
    138       Result[i].raw_size := 0{????????????????????????????????};
     138      Result[i].raw_size := 32;
    139139      Result[i].loc_sep  := False;
    140140    end;
     
    198198  Result[0].raw_addr   := link;
    199199  Result[0].raw_size   := datasize;
    200   Result[0].loc_sep    := OniDataConnection.OSisMac;
     200  Result[0].loc_sep    := connection.OSisMac;
    201201end;
    202202
     
    245245    TOniDataDat(connection).LoadRawOffset(False,
    246246      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]);
    248248    k := 0;
    249249    for j := 0 to 1024 do
     
    595595begin
    596596  Raws := '';
    597   //  InsertRawListHandler('AGDB',True,AGDB);
     597  InsertRawListHandler('AGDB',False,AGDB);
    598598  InsertRawListHandler('AKVA', True, AKVA);
    599599  InsertRawListHandler('BINA', True, BINA);
  • oup/current/Code/OniDataClass.pas

    r87 r92  
    136136  end;
    137137
    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
    146139
    147140const
     
    151144
    152145var
    153 //  OniDataConnection: TOniData;
    154146  DataConnections: array of TOniData;
    155   OniDataConnection: TOniData;
    156147
    157148function CreateDataConnection(filename: String; backend: Integer): TOniData;
     149function ConnectionExists(filename: String): TOniData;
    158150procedure CloseDataConnection(connection: TOniData);
    159151function GetEmptyFileInfo: TFileInfo;
     
    213205  Result.raw_addr := 0;
    214206  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;
    225220    end;
    226221  end;
     
    14661461
    14671462
     1463function ConnectionExists(filename: String): TOniData;
     1464var
     1465  i: Integer;
     1466begin
     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;
     1475end;
    14681476
    14691477
     
    15131521
    15141522
    1515 
    1516 
    1517 constructor TOniDataEmpty.Create(OLDBFilename: String; var Result: Boolean);
    1518 var
    1519   i, j:  Byte;
    1520   temps: String;
    1521 begin
    1522   ShowMessage('OLD');
    1523 end;
    1524 
    1525 procedure TOniDataEmpty.Close;
    1526 begin
    1527   ShowMessage('OLD');
    1528 end;
    1529 
    15301523end.
  • oup/current/Code/OniImgClass.pas

    r86 r92  
    439439      txmpimg.DataType  := [DT_Decoded32];
    440440      txmpimg.Depth     := 32;
    441       txmpimg.WriteToBMP('D:\' + IntToStr(i) + '.bmp');
     441      txmpimg.WriteToBMP('M:\' + IntToStr(i) + '.bmp');
    442442    end;
    443443  end;
  • oup/current/Helper_LevelDB.pas

    r86 r92  
    5959  Stream_Body, Stream_Names: TMemoryStream;
    6060  Stream_Dat, Stream_Raw, Stream_Sep: TFileStream;
     61  OniDataConnection: TOniData;
    6162
    6263
     
    107108  timeformat.LongTimeFormat := 'hh:nn:ss';
    108109  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
    109125
    110126  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
    13unit OneInst;
    2 
    34interface
    4 
    55uses
    66  Windows, Messages;
     
    2222  { Der Text den diese Variable hat sollte bei jedem neuen Programm geändert }
    2323  { 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;
    2525  MutexHandle: THandle = 0;
    2626
  • oup/current/Main.pas

    r87 r92  
    77  Dialogs, StdCtrls, StrUtils, Clipbrd, ExtCtrls, ComCtrls, Menus, Grids,
    88  MPHexEditor, ToolWin, ImgList, Tabs,
    9   MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI,
     9  MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI, OneInst,
    1010  Data, Functions, DataStructures, OniDataClass, Exporters,
    1111  Helper_LevelDB, Settings, Template,
     
    8989    procedure menu_windows_nextClick(Sender: TObject);
    9090    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;
    9292    procedure menu_windows_closeallClick(Sender: TObject);
    9393    procedure menu_windows_cascadeClick(Sender: TObject);
     
    116116    procedure MDITabMouseMove(Sender: TObject; Shift: TShiftState; X,
    117117      Y: Integer);
    118   private
     118
     119    procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA;
    119120  public
     121    procedure DefaultHandler(var Message); override;
     122  public
    120123  end;
    121124
     
    126129
    127130{$R *.dfm}
     131
     132
     133
     134{ Eine zweite Instanz hat uns ihre Kommandozeilenparameter geschickt }
     135procedure TForm_Main.WMCopyData(var Msg: TWMCopyData);
     136var
     137  strings: TStringList;
     138begin
     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;
     169end;
     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{----------------------------------------------------------------------------}
     178procedure TForm_Main.DefaultHandler(var Message);
     179begin
     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;
     186end;
    128187
    129188
     
    388447      end;
    389448  end;
     449  UpdateStatBar;
    390450  UpdateConLists;
    391451end;
     
    482542procedure TForm_Main.menu_createdbClick(Sender: TObject);
    483543begin
    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{
    497546  opend.Filter     := 'Oni-Dat-Files|*.dat';
    498547  saved.Filter     := 'OUP-Level-DB (*.oldb)|*.oldb';
     
    501550    if saved.Execute then
    502551      Form_LevelDB.CreateDatabase(opend.FileName, saved.FileName);
    503 }end;
     552}
     553end;
    504554
    505555
     
    508558procedure TForm_Main.menu_createlvlClick(Sender: TObject);
    509559begin
    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{
    523562  opend.Filter     := 'OUP-Level-DB (*.oldb)|*.oldb';
    524563  saved.Filter     := 'Oni-Dat-Files|*.dat';
     
    527566    if saved.Execute then
    528567      Form_LevelDB.CreateLevel(opend.FileName, saved.FileName);
    529 }end;
     568}
     569end;
    530570
    531571 {#################################}
     
    534574procedure TForm_Main.menu_previewClick(Sender: TObject);
    535575begin
    536   open_child('preview', -1);
     576  open_child('preview', nil, -1);
    537577end;
    538578
     
    540580procedure TForm_Main.menu_txmpreplaceClick(Sender: TObject);
    541581begin
    542   open_child('txmpreplace', -1);
     582  open_child('txmpreplace', nil, -1);
    543583end;
    544584
     
    546586procedure TForm_Main.menu_bineditClick(Sender: TObject);
    547587begin
    548   open_child('binedit', -1);
     588  open_child('binedit', nil, -1);
    549589end;
    550590
     
    552592procedure TForm_Main.menu_raweditClick(Sender: TObject);
    553593begin
    554   open_child('rawedit', -1);
     594  open_child('rawedit', nil, -1);
    555595end;
    556596
     
    558598procedure TForm_Main.menu_extractorClick(Sender: TObject);
    559599begin
    560   open_child('extractor', -1);
     600  open_child('extractor', nil, -1);
    561601end;
    562602
     
    570610procedure TForm_Main.menu_filecompareClick(Sender: TObject);
    571611begin
    572   open_child('compare', -1);
     612  open_child('compare', nil, -1);
    573613end;
    574614
     
    666706
    667707
    668 function TForm_Main.open_child(window_context: String; fileid: Integer): TForm_ToolTemplate;
     708function TForm_Main.open_child(window_context: String; connection: TOniData; fileid: Integer): TForm_ToolTemplate;
    669709var
    670710  toolform:    TForm_ToolTemplate;
     
    722762    MDITab.AddTab(TForm(toolform), iconindex);
    723763    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;
    726768    Result := toolform;
    727769  end;
  • oup/current/OniUnPacker.bdsproj

    r88 r92  
    178178                </Language> 
    179179   
    180    
    181    
    182180    <Excluded_Packages>
    183181      <Excluded_Packages Name="d:\programme\borland\bds\3.0\Bin\dbwebxprt.bpl">Borland Web Wizard Package</Excluded_Packages>
  • oup/current/OniUnPacker.dpr

    r88 r92  
    22
    33uses
    4   Forms, Windows,
     4  Forms,
    55  Main in 'Main.pas' {Form_Main},
    66  Data in 'Data.pas',
     
    88  Helper_ValueEdit in 'Helper_ValueEdit.pas' {Form_ValueEdit},
    99  Settings in 'Settings.pas' {Form_Settings},
    10   FTypeReg in 'FTypeReg.pas',
    1110  Functions in 'Code\Functions.pas',
    1211  Exporters in 'Code\Exporters.pas',
     
    2019  RawEdit in 'Tools\RawEdit.pas' {Form_ToolTemplate4},
    2120  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';
    2324
    2425{$R *.res}
    2526{$R ExtraIcos.res}
    26 const
    27   MutexName = 'Oni Un/Packer';
    28 var
    29   hMutex: THandle;
    3027
    3128begin
    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;
    4836end.
  • oup/current/Tools/BinEdit.dfm

    r87 r92  
    44  OnCloseQuery = FormCloseQuery
    55  OnKeyUp = FormKeyUp
     6  ExplicitWidth = 500
     7  ExplicitHeight = 450
    68  PixelsPerInch = 96
    79  TextHeight = 13
    8   inherited panel_files: TPanel
    9     inherited filelist: TListBox
    10       ExplicitTop = 153
    11       ExplicitHeight = 270
    12     end
    13   end
    1410  inherited content: TPanel
    1511    object Splitter2: TSplitter
     
    9389      Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColSizing]
    9490      PopupMenu = value_viewer_context
     91      ScrollBars = ssVertical
    9592      TabOrder = 1
    9693      OnDblClick = value_viewerDblClick
     
    194191  object value_viewer_context: TPopupMenu [3]
    195192    AutoHotkeys = maManual
     193    AutoLineReduction = maManual
    196194    OnPopup = value_viewer_contextPopup
    197195    Left = 280
  • oup/current/Tools/BinEdit.pas

    r87 r92  
    3232    procedure hexChange(Sender: TObject);
    3333
    34     procedure LoadDat(_fileid: LongWord);
     34    procedure LoadDat(_fileid: Integer);
    3535    function Save: Boolean;
    3636    function GetValue(datatype: Word; offset: LongWord): String;
     
    5757    procedure value_viewer_contextPopup(Sender: TObject);
    5858  private
     59    con: TOniData;
    5960    fileid: Integer;
    6061  public
     
    9394  value_viewer.RowCount := 8;
    9495  value_viewer.FixedRows := 1;
     96  value_viewer.FixedCols := 1;
    9597  value_viewer.Cells[0, 0] := 'Type';
    9698  value_viewer.Cells[1, 0] := 'Value';
     
    102104  value_viewer.Cells[0, 6] := 'String';
    103105  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;
    106108//  hex.Height := content.Height - 215;
    107109  //
     
    135137
    136138
    137 procedure TForm_BinEdit.LoadDat(_fileid: LongWord);
     139procedure TForm_BinEdit.LoadDat(_fileid: Integer);
    138140var
    139141  mem:  TMemoryStream;
    140142  Data: Tdata;
    141143begin
    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;
    164177  end
    165178  else
    166179  begin
     180    fileid := _fileid;
     181    con := nil;
     182    Self.ClearStructViewer;
    167183    ClearValues;
    168184    hex.DataSize := 0;
     
    226242      Result := IntToBin(hex.Data[offset]);
    227243    11:
    228       Result := '0x' + IntToHex(OniDataConnection.GetRawInfo(fileid, offset).raw_addr, 8);
     244      Result := '0x' + IntToHex(con.GetRawInfo(fileid, offset).raw_addr, 8);
    229245    12:
    230246      Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 +
     
    291307  if VST.RootNodeCount = 0 then
    292308  begin
    293     structs := LoadStructureDefinition(Connection, fileid);
     309    structs := LoadStructureDefinition(con, fileid);
    294310    if structs.Data then
    295311    begin
     
    501517begin
    502518  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...'),
    504520      MB_YESNOCANCEL) of
    505521    idYes:
     
    511527      mem.Read(Data[0], mem.Size);
    512528      mem.Free;
    513       OniDataConnection.UpdateDatFile(fileid, Data);
     529      con.UpdateDatFile(fileid, Data);
    514530      hex.Modified := False;
    515531      for i := 0 to hex.Datasize - 1 do
     
    762778      if nodedata.DataType = 11 then
    763779      begin
    764         if OniDataConnection.GetRawInfo(fileid, nodedata.offset).raw_size > 0 then
    765           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);
    766782      end;
    767783      if nodedata.DataType = 12 then
    768784      begin
    769         if (StrToInt(nodedata.Value) < OniDataConnection.GetFilesCount) and
     785        if (StrToInt(nodedata.Value) < con.GetFilesCount) and
    770786          (StrToInt(nodedata.Value) > 0) and
    771787          (StrToInt(nodedata.Value) <> fileid) then
    772788        begin
    773           if OniDataConnection.GetFileInfo(StrToInt(nodedata.Value)).Size > 0 then
    774             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))
    775791          else
    776792            ShowMessage('Linked filed is a zero-byte-file');
     
    779795      if (nodedata.DataType >= 100) and (nodedata.DataType <= 300) then
    780796      begin
    781         form := Form_Main.open_child('binedit', -1);
     797        form := Form_Main.open_child('binedit', Connection, -1);
    782798        if Assigned(form) then
    783799          form.SetFileFilters(nodedata.Value, '', False);
  • oup/current/Tools/Extractor.dfm

    r86 r92  
    2222      Width = 333
    2323      Height = 338
    24       ExplicitTop = 153
    2524      ExplicitWidth = 333
    2625      ExplicitHeight = 338
     
    2928      Width = 333
    3029      ExplicitWidth = 333
     30      inherited Bevel1: TBevel
     31        Width = 327
     32        ExplicitWidth = 327
     33      end
    3134      inherited combo_extension: TComboBox
    3235        Width = 325
     
    3942        Width = 325
    4043        ExplicitWidth = 325
     44      end
     45      inherited combo_connection: TComboBox
     46        Width = 263
     47        ExplicitWidth = 263
    4148      end
    4249    end
  • oup/current/Tools/Extractor.pas

    r86 r92  
    105105    if (selonly and filelist.Selected[i]) or not selonly then
    106106    begin
    107       fileid := OniDataConnection.ExtractFileID(filelist.Items.Strings[i]);
     107      fileid := Connection.ExtractFileID(filelist.Items.Strings[i]);
    108108      filename := GetWinFilename(filelist.Items.Strings[i]);
    109109      if check_dat.Checked then
  • oup/current/Tools/RawEdit.dfm

    r75 r92  
    2323    end
    2424    inherited filelist: TListBox
    25       Height = 76
    26       ExplicitHeight = 76
     25      Height = 52
     26      ExplicitHeight = 52
    2727    end
    2828    object panel_imexport: TPanel
     
    7979  end
    8080  inherited content: TPanel
    81     OnResize = panel_contentResize
    8281    object Splitter2: TSplitter
    8382      Left = 0
     
    152151      ParentFont = False
    153152      PopupMenu = value_viewer_context
     153      ScrollBars = ssVertical
    154154      TabOrder = 1
    155155      OnDblClick = value_viewerDblClick
  • oup/current/Tools/RawEdit.pas

    r75 r92  
    3939    procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    4040
    41     procedure panel_contentResize(Sender: TObject);
    42 
    4341    function GetValue(datatype: Word; offset: LongWord): String;
    4442    procedure ClearValues;
     
    5856    fileid:     Integer;
    5957    dat_offset: LongWord;
    60     fileid_opened, dat_offset_opened: LongWord;
     58    fileid_opened, dat_offset_opened: Integer;
    6159  public
    6260  end;
     
    7472  i: Integer;
    7573begin
    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;
    8699    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;
    92100  end;
    93101end;
     
    109117    for i := 0 to filelist.Count - 1 do
    110118    begin
    111       if OniDataConnection.ExtractFileID(filelist.Items.Strings[i]) = raw_info.src_id then
     119      if Connection.ExtractFileID(filelist.Items.Strings[i]) = raw_info.src_id then
    112120      begin
    113121        filelist.ItemIndex := i;
     
    126134  end;
    127135  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]);
    129137  if Length(Data) > 0 then
    130138  begin
     
    158166  dat_offset := StrToInt('$' + MidStr(
    159167    list_offset.Items.Strings[list_offset.ItemIndex], 3, 8));
    160   LoadRaw(OniDataConnection.GetRawInfo(fileid, dat_offset));
     168  LoadRaw(Connection.GetRawInfo(fileid, dat_offset));
    161169end;
    162170
     
    391399}
    392400  value_viewer.FixedRows := 1;
     401  value_viewer.FixedCols := 1;
    393402  value_viewer.Cells[0, 0] := 'Type';
    394403  value_viewer.Cells[1, 0] := 'Value';
     
    400409  value_viewer.Cells[0, 6] := 'String';
    401410  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;
    403413  //
    404414  value_viewer.Font.Charset := AppSettings.CharSet;
     
    416426begin
    417427  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...'),
    419429      MB_YESNOCANCEL) of
    420430    idYes:
     
    426436      mem.Read(Data[0], mem.Size);
    427437      mem.Free;
    428       OniDataConnection.UpdateRawFile(fileid_opened, dat_offset_opened,
     438      Connection.UpdateRawFile(fileid_opened, dat_offset_opened,
    429439        Length(Data), @Data[0]);
    430440      hex.Modified := False;
     
    452462      CanClose := False;
    453463  end;
    454 end;
    455 
    456 
    457 
    458 
    459 procedure TForm_RawEdit.panel_contentResize(Sender: TObject);
    460 begin
    461   if fileid >= 0 then
    462     value_viewer.ColWidths[1] := value_viewer.Width - value_viewer.ColWidths[0] - 50;
    463464end;
    464465
     
    546547  fs: TFileStream;
    547548begin
    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 +
    550551    '|All files|*.*';
    551   saved.DefaultExt := OniDataConnection.GetFileInfo(fileid).Extension;
     552  saved.DefaultExt := Connection.GetFileInfo(fileid).Extension;
    552553  if saved.Execute then
    553554  begin
     
    566567  fs:   TFileStream;
    567568begin
    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 +
    570571    '|All files|*.*';
    571572  if opend.Execute then
  • oup/current/Tools/Template.dfm

    r86 r92  
    5252      OnClick = listClick
    5353      OnMouseDown = listMouseDown
    54       ExplicitTop = 129
    55       ExplicitHeight = 294
    5654    end
    5755    object panel_extension: TPanel
  • oup/current/Tools/Template.pas

    r87 r92  
    4444    procedure RecreateExtList;
    4545    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);
    4848    procedure check_filternameClick(Sender: TObject);
    4949    procedure check_zerobyteClick(Sender: TObject);
     
    285285  id := FConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]);
    286286  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);
    288288end;
    289289
     
    415415
    416416
    417 procedure TForm_ToolTemplate.SelectFileID(id: Integer);
    418 var
    419   i: Integer;
    420 begin
     417procedure TForm_ToolTemplate.SelectFileID(connection: TOniData; id: Integer);
     418var
     419  i: Integer;
     420  name: String;
     421  nstart, nend: Integer;
     422begin
     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
    421437  filelist.ItemIndex := -1;
    422438  if filelist.Items.Count > 0 then
     
    430446end;
    431447
    432 procedure TForm_ToolTemplate.SelectFileName(filename: String);
    433 var
    434   i: Integer;
    435 begin
     448procedure TForm_ToolTemplate.SelectFileName(connection: TOniData; filename: String);
     449var
     450  i: Integer;
     451  name: String;
     452  nstart, nend: Integer;
     453begin
     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
    436468  filelist.ItemIndex := -1;
    437469  if filelist.Items.Count > 0 then
  • oup/current/Tools/TxmpReplace.dfm

    r86 r92  
    11inherited Form_TxmpReplace: TForm_TxmpReplace
    22  Caption = 'TxmpReplace'
    3   ExplicitWidth = 320
    4   ExplicitHeight = 240
    53  PixelsPerInch = 96
    64  TextHeight = 13
     
    3735      Height = 146
    3836      Align = alTop
    39       ExplicitTop = 153
    4037      ExplicitHeight = 146
    4138    end
  • oup/current/Tools/TxmpReplace.pas

    r86 r92  
    5252begin
    5353  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);
    5757  check_fading.Checked := (fadingbyte and $01) > 0;
    5858  check_transparency.Checked := (depthbyte and $04) > 0;
     
    103103  if filelist.ItemIndex >= 0 then
    104104  begin
    105     OniDataConnection.LoadDatFilePart(fileid, $88, 1, @oldfading);
    106     if OniDataConnection.OSisMac then
    107       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)
    108108    else
    109       OniDataConnection.LoadDatFilePart(fileid, $9C, 4, @old_rawaddr);
     109      Connection.LoadDatFilePart(fileid, $9C, 4, @old_rawaddr);
    110110
    111111    if (OniImage_Old.Width <> OniImage_New.Width) or
     
    138138    newsize := OniImage_New.GetImageDataSize(check_fading.Checked);
    139139
    140     if (newsize > old_size) and (OniDataConnection.Backend = ODB_Dat) then
    141       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)
    143143    else
    144144    begin
    145145      new_rawaddr := old_rawaddr;
    146       OniDataConnection.UpdateRawFile(fileid, $9C, Length(tempd), tempd);
     146      Connection.UpdateRawFile(fileid, $9C, Length(tempd), tempd);
    147147    end;
    148148
     
    150150    if check_fading.Checked then
    151151      datbyte := datbyte or $01;
    152     OniDataConnection.UpdateDatFilePart(fileid, $88, 1, @datbyte);
     152    Connection.UpdateDatFilePart(fileid, $88, 1, @datbyte);
    153153    datbyte := $10;
    154154    if check_transparency.Checked then
    155155      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);
    159159    datbyte := $08;
    160     OniDataConnection.UpdateDatFilePart(fileid, $90, 1, @datbyte);
    161     if OniDataConnection.OSisMac then
    162       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)
    163163    else
    164       OniDataConnection.UpdateDatFilePart(fileid, $9C, 4, @new_rawaddr);
     164      Connection.UpdateDatFilePart(fileid, $9C, 4, @new_rawaddr);
    165165
    166166    ShowMessage('TXMP-image replaced');
Note: See TracChangeset for help on using the changeset viewer.