Changeset 45 for oup/current


Ignore:
Timestamp:
Dec 23, 2006, 1:03:50 AM (18 years ago)
Author:
alloc
Message:
 
Location:
oup/current
Files:
2 added
17 edited

Legend:

Unmodified
Added
Removed
  • oup/current/Code_DataStructures.pas

    r43 r45  
    5353implementation
    5454
    55 uses Code_Functions, Code_OniDataClass, Forms;
     55uses Code_Functions, Code_OniDataClass, Forms, Tool_Template;
    5656
    5757
     
    438438  RawListHandlers[High(RawListHandlers)].handler := handler;
    439439  Raws := Raws + ext;
     440  AddToolListEntry('rawedit', '', ext);
    440441end;
    441442
  • oup/current/Code_OniDataClass.pas

    r43 r45  
    283283  for i := 0 to Fdat_header.Files - 1 do
    284284  begin
     285    Fdat_files[i].ID := i;
    285286    Fdat_files[i].Extension := Fdat_filesmap[i].Extension;
    286287    Fdat_files[i].Extension := ReverseString(Fdat_files[i].Extension);
  • oup/current/Data.pas

    r43 r45  
    9494  end;
    9595
     96  TToolList = array of record
     97    context: String;
     98    name: String;
     99    exts: String;
     100  end;
     101
    96102var
    97103{
  • oup/current/Main.pas

    r43 r45  
    77  Dialogs, StdCtrls, StrUtils, Clipbrd, ExtCtrls, ComCtrls, Menus, Grids,
    88  MPHexEditor, ToolWin, ImgList, Tabs,
    9   Code_Functions, Data, Code_DataStructures,
    10   Helper_LevelDB, Code_Exporters, Settings,
    11   Tool_Preview, Tool_TxmpReplace, Tool_BinEdit, Tool_Extractor, Tool_RawEdit,
    12   Code_OniDataClass, MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI;
     9  MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI,
     10  Code_Functions, Data, Code_DataStructures, Code_OniDataClass,
     11  Helper_LevelDB, Code_Exporters, Settings, Tool_Template,
     12  Tool_BinEdit, Tool_Extractor, Tool_Preview, Tool_RawEdit, Tool_TxmpReplace;
    1313
    1414type
     
    7777    procedure menu_windows_nextClick(Sender: TObject);
    7878    procedure menu_windows_tileClick(Sender: TObject);
    79     function open_child(window_context: String): Boolean;
     79    function open_child(window_context: String; fileid: Integer): Boolean;
    8080    procedure menu_windows_closeallClick(Sender: TObject);
    8181    procedure menu_windows_cascadeClick(Sender: TObject);
     
    305305      ext := ExtractFileExt(opend.FileName);
    306306      if ext = '.dat' then
     307      begin
    307308        if not CreateDataConnection(opend.FileName, ODB_Dat) then
    308309          ShowMessage('Error while loading the file:' + CrLf + opend.FileName +
    309             CrLf + 'Perhaps not an Oni-.dat-file?')
    310       else if ext = '.oldb' then
     310            CrLf + 'Perhaps not an Oni-.dat-file?');
     311      end else if ext = '.oldb' then
     312      begin
    311313        if not CreateDataConnection(opend.FileName, ODB_ADB) then
    312314          ShowMessage('Error while loading the file:' + CrLf + opend.FileName +
    313             CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?')
    314       else
     315            CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?');
     316      end else
    315317        ShowMessage('Incompatible file');
    316318      AppSettings.DatPath := ExtractFilepath(opend.FileName);
     
    394396procedure TForm_Main.menu_previewClick(Sender: TObject);
    395397begin
    396   open_child('preview');
     398  open_child('preview', -1);
    397399end;
    398400
     
    400402procedure TForm_Main.menu_txmpreplaceClick(Sender: TObject);
    401403begin
    402   open_child('txmpreplace');
     404  open_child('txmpreplace', -1);
    403405end;
    404406
     
    406408procedure TForm_Main.menu_bineditClick(Sender: TObject);
    407409begin
    408   open_child('binedit');
     410  open_child('binedit', -1);
    409411end;
    410412
     
    412414procedure TForm_Main.menu_raweditClick(Sender: TObject);
    413415begin
    414   open_child('rawedit');
     416  open_child('rawedit', -1);
    415417end;
    416418
     
    418420procedure TForm_Main.menu_extractorClick(Sender: TObject);
    419421begin
    420   open_child('extractor');
     422  open_child('extractor', -1);
    421423end;
    422424
     
    424426procedure TForm_Main.menu_filecompareClick(Sender: TObject);
    425427begin
    426   open_child('compare');
     428  open_child('compare', -1);
    427429end;
    428430
     
    515517
    516518
    517 function TForm_Main.open_child(window_context: String): Boolean;
     519function TForm_Main.open_child(window_context: String; fileid: Integer): Boolean;
    518520var
    519   form:    TCustomForm;
     521  toolform: TForm_ToolTemplate;
    520522  i:       Integer;
    521523  tag:     Integer;
     
    534536  if window_context = 'binedit' then
    535537  begin
    536     form      := TForm_BinEdit.Create(Application);
    537     TForm_BinEdit(form).Recreatelist;
    538     form.Caption := 'Binary .dat-Editor ' + IntToStr(tag);
    539     iconindex := 0;
     538    toolform         := TForm_BinEdit.Create(Self);
     539    toolform.Caption := 'Binary .dat-Editor ' + IntToStr(tag);
     540    iconindex        := 0;
     541  end;
     542  if window_context = 'extractor' then
     543  begin
     544    toolform         := TForm_Extractor.Create(Self);
     545    toolform.Caption := 'Extractor ' + IntToStr(tag);
     546  end;
     547  if window_context = 'preview' then
     548  begin
     549    toolform         := TForm_Preview.Create(Self);
     550    toolform.Caption := 'Preview-Window ' + IntToStr(tag);
    540551  end;
    541552  if window_context = 'rawedit' then
    542553  begin
    543     form      := TForm_RawEdit.Create(Application);
    544     TForm_RawEdit(form).Recreatelist;
    545     form.Caption := 'Binary .raw-Editor ' + IntToStr(tag);
    546   end;
    547   if window_context = 'preview' then
    548   begin
    549     form      := TForm_Preview.Create(Application);
    550     TForm_Preview(form).Recreatelist;
    551     form.Caption := 'Preview-Window ' + IntToStr(tag);
     554    toolform         := TForm_RawEdit.Create(Self);
     555    toolform.Caption := 'Binary .raw-Editor ' + IntToStr(tag);
    552556  end;
    553557  if window_context = 'txmpreplace' then
    554558  begin
    555     form      := TForm_TxmpReplace.Create(Application);
    556     TForm_TxmpReplace(form).Recreatelist;
    557     form.Caption := 'TXMP Replacer ' + IntToStr(tag);
    558   end;
    559   if window_context = 'extractor' then
    560   begin
    561     form      := TForm_Extractor.Create(Application);
    562     TForm_Extractor(form).Recreatelist;
    563     form.Caption := 'Extractor ' + IntToStr(tag);
    564   end;
    565 
    566   form.Name := window_context + IntToStr(tag);
    567   form.Tag  := tag;
    568 
    569   MDITab.AddTab(TForm(form), iconindex);
     559    toolform         := TForm_TxmpReplace.Create(Application);
     560    toolform.Caption := 'TXMP Replacer ' + IntToStr(tag);
     561  end;
     562
     563  if Assigned(toolform) then
     564  begin
     565    toolform.Name    := window_context + IntToStr(tag);
     566    toolform.Tag     := tag;
     567    MDITab.AddTab(TForm(toolform), iconindex);
     568    if fileid > -1 then
     569      toolform.SelectFileID(fileid);
     570  end;
    570571end;
    571572
  • oup/current/OniUnPacker.dpr

    r43 r45  
    77  Data in 'Data.pas',
    88  Code_Exporters in 'Code_Exporters.pas',
    9   Tool_Preview in 'Tool_Preview.pas' {Form_Preview},
    109  Code_OniImgClass in 'Code_OniImgClass.pas',
    11   Tool_TxmpReplace in 'Tool_TxmpReplace.pas' {Form_TxmpReplace},
    12   Tool_BinEdit in 'Tool_BinEdit.pas' {Form_BinEdit},
    1310  Code_DataStructures in 'Code_DataStructures.pas',
    1411  Helper_LevelDB in 'Helper_LevelDB.pas' {Form_LevelDB},
    15   Tool_Extractor in 'Tool_Extractor.pas' {Form_Extractor},
    1612  Helper_ValueEdit in 'Helper_ValueEdit.pas' {Form_ValueEdit},
    17   Tool_RawEdit in 'Tool_RawEdit.pas' {Form_RawEdit},
    1813  Settings in 'Settings.pas' {Form_Settings},
    1914  ftypesAPI in 'TFileTypeRegistration\ftypesAPI.pas',
    20   Code_OniDataClass in 'Code_OniDataClass.pas';
     15  Code_OniDataClass in 'Code_OniDataClass.pas',
     16  Tool_Template in 'Tool_Template.pas' {Form_ToolTemplate},
     17  Tool_Preview in 'Tool_Preview.pas' {Form_Preview},
     18  Tool_BinEdit in 'Tool_BinEdit.pas' {Form_ToolTemplate2},
     19  Tool_Extractor in 'Tool_Extractor.pas' {Form_ToolTemplate3},
     20  Tool_RawEdit in 'Tool_RawEdit.pas' {Form_ToolTemplate4},
     21  Tool_TxmpReplace in 'Tool_TxmpReplace.pas' {Form_ToolTemplate5};
    2122
    2223{$R *.res}
  • oup/current/Tool_BinEdit.dfm

    r43 r45  
    1 object Form_BinEdit: TForm_BinEdit
    2   Left = 0
    3   Top = 0
    4   BorderIcons = [biSystemMenu, biMaximize]
    5   Caption = 'Binary .dat-Editor'
    6   ClientHeight = 555
    7   ClientWidth = 642
    8   Color = clBtnFace
    9   Font.Charset = DEFAULT_CHARSET
    10   Font.Color = clWindowText
    11   Font.Height = -11
    12   Font.Name = 'Tahoma'
    13   Font.Style = []
    14   FormStyle = fsMDIChild
    15   KeyPreview = True
    16   OldCreateOrder = False
    17   Visible = True
    18   WindowState = wsMaximized
    19   OnClose = FormClose
     1inherited Form_BinEdit: TForm_BinEdit
     2  Caption = 'BinEdit'
    203  OnCloseQuery = FormCloseQuery
    214  OnCreate = FormCreate
    225  OnKeyUp = FormKeyUp
    23   OnResize = FormResize
    246  PixelsPerInch = 96
    257  TextHeight = 13
    26   object Splitter1: TSplitter
    27     Left = 200
    28     Top = 0
    29     Width = 9
    30     Height = 555
    31     AutoSnap = False
    32     Beveled = True
    33     MinSize = 150
    34     ExplicitLeft = 150
    35     ExplicitHeight = 423
    36   end
    37   object panel_data: TPanel
    38     Left = 209
    39     Top = 0
    40     Width = 433
    41     Height = 555
    42     Align = alClient
    43     BevelOuter = bvNone
    44     TabOrder = 0
     8  inherited panel_files: TPanel
     9    inherited filelist: TListBox
     10      ExplicitHeight = 256
     11    end
     12  end
     13  inherited content: TPanel
    4514    object Splitter2: TSplitter
    4615      Left = 0
    4716      Top = 209
    48       Width = 433
     17      Width = 283
    4918      Height = 9
    5019      Cursor = crVSplit
     
    5322      Beveled = True
    5423      MinSize = 40
    55       ExplicitWidth = 483
     24      ExplicitWidth = 425
    5625    end
    5726    object Splitter3: TSplitter
    5827      Left = 0
    59       Top = 450
    60       Width = 433
     28      Top = 318
     29      Width = 283
    6130      Height = 8
    6231      Cursor = crVSplit
     
    6534      Beveled = True
    6635      MinSize = 40
    67       ExplicitTop = 375
    68       ExplicitWidth = 483
     36      ExplicitLeft = -9
     37      ExplicitTop = 430
     38      ExplicitWidth = 425
    6939    end
    7040    object hex: TMPHexEditor
    7141      Left = 0
    7242      Top = 0
    73       Width = 433
     43      Width = 283
    7444      Height = 209
    7545      Cursor = crIBeam
     
    11181      Left = 0
    11282      Top = 218
    113       Width = 433
    114       Height = 232
     83      Width = 283
     84      Height = 100
    11585      Align = alClient
    11686      ColCount = 1
     
    12898    object VST: TVirtualStringTree
    12999      Left = 0
    130       Top = 458
    131       Width = 433
     100      Top = 326
     101      Width = 283
    132102      Height = 97
    133103      Align = alBottom
     
    221191    end
    222192  end
    223   object panel_files: TPanel
    224     Left = 0
    225     Top = 0
    226     Width = 200
    227     Height = 555
    228     Align = alLeft
    229     BevelOuter = bvNone
    230     TabOrder = 1
    231     object Bevel1: TBevel
    232       Left = 0
    233       Top = 491
    234       Width = 200
    235       Height = 6
    236       Align = alBottom
    237       Style = bsRaised
    238       ExplicitTop = 359
    239       ExplicitWidth = 150
    240     end
    241     object list: TListBox
    242       Left = 0
    243       Top = 0
    244       Width = 200
    245       Height = 388
    246       Align = alClient
    247       ItemHeight = 13
    248       TabOrder = 0
    249       OnClick = listClick
    250       OnMouseDown = listMouseDown
    251     end
    252     object panel_extension: TPanel
    253       Left = 0
    254       Top = 388
    255       Width = 200
    256       Height = 103
    257       Align = alBottom
    258       BevelOuter = bvNone
    259       TabOrder = 1
    260       OnResize = panel_extensionResize
    261       object lbl_filter: TLabel
    262         Left = 2
    263         Top = 62
    264         Width = 100
    265         Height = 17
    266         AutoSize = False
    267         Caption = 'Filter by &extension:'
    268         FocusControl = combo_extension
    269       end
    270       object combo_extension: TComboBox
    271         Left = 2
    272         Top = 76
    273         Width = 145
    274         Height = 21
    275         Style = csDropDownList
    276         DropDownCount = 12
    277         Font.Charset = DEFAULT_CHARSET
    278         Font.Color = clWindowText
    279         Font.Height = -11
    280         Font.Name = 'Tahoma'
    281         Font.Style = []
    282         ItemHeight = 13
    283         ParentFont = False
    284         Sorted = True
    285         TabOrder = 3
    286         OnClick = combo_extensionClick
    287       end
    288       object check_zerobyte: TCheckBox
    289         Left = 2
    290         Top = 44
    291         Width = 130
    292         Height = 13
    293         Caption = 'Show &zero-byte files'
    294         TabOrder = 2
    295         OnClick = check_zerobyteClick
    296       end
    297       object edit_filtername: TEdit
    298         Left = 2
    299         Top = 20
    300         Width = 145
    301         Height = 18
    302         AutoSize = False
    303         TabOrder = 1
    304       end
    305       object check_filtername: TCheckBox
    306         Left = 2
    307         Top = 5
    308         Width = 130
    309         Height = 15
    310         Caption = 'Filter by file&name:'
    311         TabOrder = 0
    312         OnClick = check_filternameClick
    313       end
    314     end
    315     object panel_imexport: TPanel
    316       Left = 0
    317       Top = 497
    318       Width = 200
    319       Height = 58
    320       Align = alBottom
    321       BevelOuter = bvNone
    322       TabOrder = 2
    323       OnResize = panel_imexportResize
    324       object btn_export: TButton
    325         Left = 4
    326         Top = 4
    327         Width = 142
    328         Height = 25
    329         Caption = 'Export to file...'
    330         TabOrder = 0
    331         OnClick = btn_exportClick
    332       end
    333       object btn_import: TButton
    334         Left = 4
    335         Top = 32
    336         Width = 142
    337         Height = 25
    338         Caption = 'Import from file...'
    339         TabOrder = 1
    340         OnClick = btn_importClick
    341       end
    342     end
    343   end
    344   object opend: TOpenDialog
    345     Options = [ofPathMustExist, ofFileMustExist, ofEnableSizing]
    346     Left = 120
    347     Top = 392
    348   end
    349   object saved: TSaveDialog
    350     Options = [ofOverwritePrompt, ofPathMustExist, ofEnableSizing]
    351     Left = 120
    352     Top = 368
    353   end
    354   object value_viewer_context: TPopupMenu
     193  object value_viewer_context: TPopupMenu [3]
    355194    AutoHotkeys = maManual
    356195    OnPopup = value_viewer_contextPopup
    357     Left = 240
    358     Top = 248
     196    Left = 280
     197    Top = 232
    359198    object value_viewer_context_copy: TMenuItem
    360199      Caption = 'Copy to &clipboard'
     
    382221    end
    383222  end
    384   object VTHPopup: TVTHeaderPopupMenu
     223  object VTHPopup: TVTHeaderPopupMenu [4]
    385224    OnColumnChange = VTHPopupColumnChange
    386     Left = 200
    387     Top = 496
     225    Left = 272
     226    Top = 376
    388227  end
    389228end
  • oup/current/Tool_BinEdit.pas

    r43 r45  
    11unit Tool_BinEdit;
    2 
    32interface
    4 
    53uses
    64  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    7   Dialogs, Wrapgrid, StdCtrls, Grids, StrUtils, MPHexEditor, ExtCtrls, Clipbrd,
    8   Data, Code_Functions, Code_DataStructures, Code_Exporters, Code_OniDataClass,
    9   Menus, Math, VirtualTrees, VTHeaderPopup;
     5  Dialogs, Tool_Template, StdCtrls, ExtCtrls, VirtualTrees, Grids, Wrapgrid,
     6  MPHexEditor, VTHeaderPopup, Menus, StrUtils, Clipbrd,
     7  Data, Code_OniDataClass, Code_Functions, Code_DataStructures, Code_Exporters;
    108
    119type
    12   TForm_BinEdit = class(TForm)
    13     Splitter1: TSplitter;
    14     panel_data: TPanel;
    15     hex:      TMPHexEditor;
     10  TForm_BinEdit = class(TForm_ToolTemplate)
     11    hex: TMPHexEditor;
    1612    Splitter2: TSplitter;
    17     panel_files: TPanel;
    18     list:     TListBox;
    19     panel_extension: TPanel;
    20     lbl_filter: TLabel;
    21     combo_extension: TComboBox;
    22     Bevel1:   TBevel;
    23     panel_imexport: TPanel;
    24     btn_export: TButton;
    25     btn_import: TButton;
    26     opend:    TOpenDialog;
    27     saved:    TSaveDialog;
    2813    value_viewer: TWrapGrid;
     14    VST: TVirtualStringTree;
    2915    Splitter3: TSplitter;
    3016    value_viewer_context: TPopupMenu;
    3117    value_viewer_context_copy: TMenuItem;
    32     value_viewer_context_copyashex: TMenuItem;
    3318    value_viewer_context_copyasdec: TMenuItem;
    3419    value_viewer_context_copyasfloat: TMenuItem;
    3520    value_viewer_context_copyasbitset: TMenuItem;
    3621    value_viewer_context_copyasstring: TMenuItem;
    37     check_zerobyte: TCheckBox;
    38     edit_filtername: TEdit;
    39     check_filtername: TCheckBox;
    40     VST:      TVirtualStringTree;
     22    value_viewer_context_copyashex: TMenuItem;
    4123    VTHPopup: TVTHeaderPopupMenu;
     24    procedure FormCreate(Sender: TObject);
     25    procedure NewFile(fileinfo: TFileInfo);
     26
     27    procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
     28    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
     29
     30    procedure hexKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
     31    procedure hexSelectionChanged(Sender: TObject);
     32    procedure hexChange(Sender: TObject);
     33
     34    procedure LoadDat(_fileid: LongWord);
     35    function Save: Boolean;
     36    function GetValue(datatype: Word; offset: LongWord): String;
     37    procedure SetNewValue(datatype: Word; offset: LongWord; Value: String);
     38
     39    procedure WriteStructureInfos;
     40    procedure ClearStructViewer;
     41    procedure VSTDblClick(Sender: TObject);
    4242    procedure VSTFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode;
    4343      Column: TColumnIndex);
    44     procedure VSTDblClick(Sender: TObject);
    4544    procedure VTHPopupColumnChange(const Sender: TBaseVirtualTree;
    4645      const Column: TColumnIndex; Visible: Boolean);
     
    4948    procedure VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
    5049      Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString);
    51     procedure hexKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    52     procedure LoadDat(_fileid: LongWord);
    53     procedure LoadFileNames;
    54     procedure check_filternameClick(Sender: TObject);
    55     procedure check_zerobyteClick(Sender: TObject);
    56     procedure combo_extensionClick(Sender: TObject);
    57     procedure panel_extensionResize(Sender: TObject);
    58     procedure listClick(Sender: TObject);
    59     procedure Recreatelist;
    60 
    61     procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
     50
     51    procedure ClearValues;
     52    procedure WriteValues;
    6253    procedure value_viewerDblClick(Sender: TObject);
    6354    procedure value_viewer_context_copyClick(Sender: TObject);
     
    6556      Shift: TShiftState; X, Y: Integer);
    6657    procedure value_viewer_contextPopup(Sender: TObject);
    67     procedure btn_importClick(Sender: TObject);
    68     procedure btn_exportClick(Sender: TObject);
    69     procedure panel_imexportResize(Sender: TObject);
    70     function Save: Boolean;
    71     procedure FormClose(Sender: TObject; var Action: TCloseAction);
    72     function GetValue(datatype: Word; offset: LongWord): String;
    73     procedure WriteStructureInfos; //(structinfoid:Integer);
    74     procedure hexSelectionChanged(Sender: TObject);
    75     procedure hexChange(Sender: TObject);
    76     procedure FormResize(Sender: TObject);
    77     procedure ClearStructViewer;
    78     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    79     procedure FormCreate(Sender: TObject);
    80     procedure ClearValues;
    81     procedure WriteValues;
    82     procedure SetNewValue(datatype: Word; offset: LongWord; Value: String);
    83     procedure listMouseDown(Sender: TObject; Button: TMouseButton;
    84       Shift: TShiftState; X, Y: Integer);
    8558  private
    8659    fileid: LongWord;
     
    9366implementation
    9467
     68uses Helper_ValueEdit, Main, Tool_RawEdit;
    9569{$R *.dfm}
    96 
    97 uses Main, Helper_ValueEdit, Tool_Rawedit;
    9870
    9971type
     
    11082
    11183
     84procedure TForm_BinEdit.FormCreate(Sender: TObject);
     85begin
     86  inherited;
     87  Self.OnNewFileSelected := NewFile;
     88
     89  Self.Caption := '';
     90  fileid     := 0;
     91  VST.NodeDataSize := SizeOf(TNodeData);
     92  value_viewer.ColCount := 2;
     93  value_viewer.RowCount := 8;
     94  value_viewer.FixedRows := 1;
     95  value_viewer.Cells[0, 0] := 'Type';
     96  value_viewer.Cells[1, 0] := 'Value';
     97  value_viewer.Cells[0, 1] := '1 byte, unsigned';
     98  value_viewer.Cells[0, 2] := '2 bytes, unsigned';
     99  value_viewer.Cells[0, 3] := '4 bytes, unsigned';
     100  value_viewer.Cells[0, 4] := 'Bitset';
     101  value_viewer.Cells[0, 5] := 'Float';
     102  value_viewer.Cells[0, 6] := 'String';
     103  value_viewer.Cells[0, 7] := 'Selected length';
     104//  value_viewer.ColWidths[0] := 100;
     105//  value_viewer.ColWidths[1] := value_viewer.Width - 150;
     106//  hex.Height := content.Height - 215;
     107  //
     108  value_viewer.Font.Charset := AppSettings.CharSet;
     109  VST.Font.Charset := AppSettings.CharSet;
     110  hex.Translation := tkAsIs;
     111  hex.Font.Charset := AppSettings.CharSet;
     112  //
     113end;
     114
     115procedure TForm_BinEdit.NewFile(fileinfo: TFileInfo);
     116begin
     117  LoadDat(fileinfo.ID);
     118end;
     119
     120
     121
    112122
    113123function AddVSTEntry(AVST: TCustomVirtualStringTree; ANode: PVirtualNode;
     
    127137procedure TForm_BinEdit.LoadDat(_fileid: LongWord);
    128138var
    129   i:    LongWord;
    130139  mem:  TMemoryStream;
    131140  Data: Tdata;
     
    135144    if not Save then
    136145    begin
    137       for i := 0 to list.Count - 1 do
    138       begin
    139         if OniDataConnection.ExtractFileID(list.Items.Strings[i]) = fileid then
    140         begin
    141           list.ItemIndex := i;
    142           Exit;
    143         end;
    144       end;
     146      Self.SelectFileID(fileid);
     147      Exit;
    145148    end;
    146149  end;
    147150  fileid := _fileid;
    148   for i := 0 to list.Count - 1 do
    149     if OniDataConnection.ExtractFileID(list.Items.Strings[i]) = fileid then
    150     begin
    151       list.ItemIndex := i;
    152       Break;
    153     end;
     151  if OniDataConnection.ExtractFileID(
     152        filelist.Items.Strings[filelist.ItemIndex]) <> fileid then
     153    Self.SelectFileID(fileid);
    154154  Self.ClearStructViewer;
    155155  Data := OniDataConnection.LoadDatFile(fileid);
     
    172172
    173173
    174 
    175 procedure TForm_BinEdit.Recreatelist;
    176 var
    177   i:    LongWord;
    178   exts: TStringArray;
    179 begin
    180   combo_extension.Items.Clear;
    181   combo_extension.Items.Add('_All files_ (' + IntToStr(
    182     OniDataConnection.GetFilesCount) + ')');
    183   exts := OniDataConnection.GetExtensionsList;
    184   for i := 0 to High(exts) do
    185     combo_extension.Items.Add(exts[i]);
    186   combo_extension.ItemIndex := 0;
    187   combo_extensionClick(Self);
    188 end;
    189 
    190 
    191 
    192 
    193 procedure TForm_BinEdit.LoadFileNames;
    194 var
    195   Extension: String[4];
    196   no_zero_bytes: Boolean;
    197   pattern: String;
    198   files: TStringArray;
    199   i: LongWord;
    200 begin
    201   Extension := MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex], 1, 4);
    202   no_zero_bytes := not check_zerobyte.Checked;
    203   pattern := '';
    204   if check_filtername.Checked then
    205     pattern := edit_filtername.Text;
    206   if Extension = '_All' then
    207     Extension := '';
    208 
    209   files := OniDataConnection.GetFilesList(extension, pattern, no_zero_bytes);
    210   list.Items.Clear;
    211   if Length(files) > 0 then
    212     for i := 0 to High(files) do
    213       list.Items.Add(files[i]);
    214 end;
    215 
    216 
    217 
    218 
    219 procedure TForm_BinEdit.panel_extensionResize(Sender: TObject);
    220 begin
    221   combo_extension.Width := panel_extension.Width - 5;
    222   edit_filtername.Width := panel_extension.Width - 5;
    223 end;
    224 
    225 
    226 
    227 
    228 procedure TForm_BinEdit.combo_extensionClick(Sender: TObject);
    229 begin
    230   LoadFileNames;
    231 end;
    232 
    233 
    234 
    235 
    236 procedure TForm_BinEdit.check_zerobyteClick(Sender: TObject);
    237 begin
    238   LoadFileNames;
    239 end;
    240 
    241 
    242 
    243 
    244 procedure TForm_BinEdit.check_filternameClick(Sender: TObject);
    245 begin
    246   edit_filtername.Enabled := not check_filtername.Checked;
    247   LoadFileNames;
    248 end;
    249 
    250 
    251 
    252 
    253 procedure TForm_BinEdit.listClick(Sender: TObject);
    254 begin
    255   LoadDat(OniDataConnection.ExtractFileID(list.Items.Strings[list.ItemIndex]));
    256 end;
    257 
    258 
    259 
    260 
    261 procedure TForm_BinEdit.listMouseDown(Sender: TObject; Button: TMouseButton;
    262   Shift: TShiftState; X, Y: Integer);
    263 var
    264   pt: TPoint;
    265 begin
    266   pt.X := x;
    267   pt.Y := y;
    268   list.ItemIndex := list.ItemAtPos(pt, true);
    269   if list.ItemIndex > -1 then
    270     Self.listClick(Self);
    271 end;
    272174
    273175function IntToBin(Value: Byte): String;
     
    588490
    589491
    590 procedure TForm_BinEdit.FormCreate(Sender: TObject);
    591 begin
    592   Self.Caption := '';
    593   fileid     := 0;
    594   VST.NodeDataSize := SizeOf(TNodeData);
    595   value_viewer.ColCount := 2;
    596   value_viewer.RowCount := 8;
    597   value_viewer.FixedRows := 1;
    598   value_viewer.Cells[0, 0] := 'Type';
    599   value_viewer.Cells[1, 0] := 'Value';
    600   value_viewer.Cells[0, 1] := '1 byte, unsigned';
    601   value_viewer.Cells[0, 2] := '2 bytes, unsigned';
    602   value_viewer.Cells[0, 3] := '4 bytes, unsigned';
    603   value_viewer.Cells[0, 4] := 'Bitset';
    604   value_viewer.Cells[0, 5] := 'Float';
    605   value_viewer.Cells[0, 6] := 'String';
    606   value_viewer.Cells[0, 7] := 'Selected length';
    607   value_viewer.ColWidths[0] := 100;
    608   value_viewer.ColWidths[1] := value_viewer.Width - 150;
    609   hex.Height := panel_data.Height - 215;
    610   //
    611   value_viewer.Font.Charset := AppSettings.CharSet;
    612   VST.Font.Charset := AppSettings.CharSet;
    613   hex.Translation := tkAsIs;
    614   hex.Font.Charset := AppSettings.CharSet;
    615   //
    616 end;
    617 
    618 
    619 
    620 
    621492function TForm_BinEdit.Save: Boolean;
    622493var
     
    672543
    673544
    674 
    675 
    676 procedure TForm_BinEdit.FormResize(Sender: TObject);
    677 begin
    678   if Self.Width >= 650 then
    679   begin
    680   end
    681   else
    682     Self.Width := 650;
    683   if Self.Height >= 450 then
    684   begin
    685   end
    686   else
    687     Self.Height := 450;
    688 end;
    689545
    690546
     
    767623
    768624
    769 procedure TForm_BinEdit.FormClose(Sender: TObject; var Action: TCloseAction);
    770 begin
    771   Action := caFree;
    772 end;
    773 
    774 
    775 
    776 
    777 procedure TForm_BinEdit.panel_imexportResize(Sender: TObject);
    778 begin
    779   btn_import.Width := panel_imexport.Width - 8;
    780   btn_export.Width := panel_imexport.Width - 8;
    781 end;
    782 
    783 
    784 
    785 
    786 procedure TForm_BinEdit.btn_exportClick(Sender: TObject);
    787 begin
    788   saved.Filter     := 'Files of matching extension (*.' + OniDataConnection.GetFileInfo(
    789     fileid).Extension + ')|*.' + OniDataConnection.GetFileInfo(fileid).Extension +
    790     '|All files|*.*';
    791   saved.DefaultExt := OniDataConnection.GetFileInfo(fileid).Extension;
    792   if saved.Execute then
    793   begin
    794     ExportDatFile(fileid, saved.FileName);
    795   end;
    796 end;
    797 
    798 
    799 
    800 
    801 procedure TForm_BinEdit.btn_importClick(Sender: TObject);
    802 var
    803   fs: TFileStream;
    804 begin
    805   opend.Filter := 'Files of matching extension (*.' + OniDataConnection.GetFileInfo(
    806     fileid).Extension + ')|*.' + OniDataConnection.GetFileInfo(fileid).Extension +
    807     '|All files|*.*';
    808   if opend.Execute then
    809   begin
    810     fs := TFileStream.Create(opend.FileName, fmOpenRead);
    811     if fs.Size <> hex.DataSize then
    812     begin
    813       ShowMessage('Can''t import ' + ExtractFilename(opend.FileName) +
    814         ', file has to have same size as file in .dat.' + CrLf +
    815         'Size of file in .dat: ' + FormatFileSize(hex.datasize) + CrLf +
    816         'Size of chosen file: ' + FormatFileSize(fs.Size));
    817     end
    818     else
    819     begin
    820       hex.LoadFromStream(fs);
    821       hex.Modified := True;
    822     end;
    823     fs.Free;
    824   end;
    825 end;
    826 
    827 
    828 
    829 
    830625procedure TForm_BinEdit.value_viewer_contextPopup(Sender: TObject);
    831626var
     
    964759      begin
    965760        if OniDataConnection.GetRawInfo(fileid, nodedata.offset).raw_size > 0 then
    966         begin
    967           if Form_Main.open_child('rawedit') then
    968           begin
    969             TForm_RawEdit(Form_Main.ActiveMDIChild).LoadRaw(
    970               OniDataConnection.GetRawInfo(fileid, nodedata.offset));
    971           end;
    972         end;
     761          Form_Main.open_child('rawedit', fileid);
    973762      end;
    974763      if nodedata.DataType = 12 then
     
    979768        begin
    980769          if OniDataConnection.GetFileInfo(StrToInt(nodedata.Value)).Size > 0 then
    981           begin
    982             if Form_Main.open_child('binedit') then
    983             begin
    984               TForm_BinEdit(Form_Main.ActiveMDIChild).LoadDat(StrToInt(nodedata.Value));
    985             end;
    986           end
     770            Form_Main.open_child('binedit', StrToInt(nodedata.Value))
    987771          else
    988           begin
    989772            ShowMessage('Linked filed is a zero-byte-file');
    990           end;
    991773        end;
    992774      end;
    993775      if (nodedata.DataType >= 100) and (nodedata.DataType <= 300) then
    994776      begin
    995         if Form_Main.open_child('binedit') then
     777        if Form_Main.open_child('binedit', -1) then
    996778        begin
    997779          TForm_BinEdit(Form_Main.ActiveMDIChild).edit_filtername.Text := nodedata.Value;
     
    1196978
    1197979
     980begin
     981  AddToolListEntry('binedit', 'Binary .dat-Editor', '');
    1198982end.
  • oup/current/Tool_Extractor.dfm

    r43 r45  
    1 object Form_Extractor: TForm_Extractor
    2   Left = 0
    3   Top = 0
     1inherited Form_Extractor: TForm_Extractor
    42  Caption = 'Extractor'
    5   ClientHeight = 398
    6   ClientWidth = 526
    7   Color = clBtnFace
    8   Font.Charset = DEFAULT_CHARSET
    9   Font.Color = clWindowText
    10   Font.Height = -11
    11   Font.Name = 'Tahoma'
    12   Font.Style = []
    13   FormStyle = fsMDIChild
    14   OldCreateOrder = False
    15   Visible = True
    16   WindowState = wsMaximized
    17   OnClose = FormClose
    183  OnCreate = FormCreate
    19   OnResize = FormResize
     4  ExplicitWidth = 320
     5  ExplicitHeight = 240
    206  PixelsPerInch = 96
    217  TextHeight = 13
    22   object group_select: TGroupBox
    23     Left = 0
    24     Top = 0
    25     Width = 230
    26     Height = 398
     8  inherited Splitter1: TSplitter
     9    Left = 483
     10    Align = alRight
     11    Visible = False
     12    ExplicitLeft = 172
     13    ExplicitTop = -8
     14    ExplicitHeight = 423
     15  end
     16  inherited panel_files: TPanel
     17    Width = 184
    2718    Align = alClient
    28     Caption = '1. Select file(s)'
    29     TabOrder = 0
    30     ExplicitWidth = 191
    31     object panel_extension: TPanel
    32       Left = 2
    33       Top = 293
    34       Width = 226
    35       Height = 103
    36       Align = alBottom
    37       BevelOuter = bvNone
     19    ExplicitWidth = 184
     20    inherited filelist: TListBox
     21      Width = 184
     22      ExplicitWidth = 184
     23    end
     24    inherited panel_extension: TPanel
     25      Width = 184
     26      ExplicitWidth = 184
     27      inherited combo_extension: TComboBox
     28        Width = 176
     29        ExplicitWidth = 176
     30      end
     31      inherited edit_filtername: TEdit
     32        Width = 176
     33        ExplicitWidth = 176
     34      end
     35    end
     36  end
     37  inherited content: TPanel
     38    Left = 184
     39    Width = 299
     40    Align = alRight
     41    ExplicitLeft = 184
     42    ExplicitWidth = 299
     43    object group_extract: TGroupBox
     44      Left = 3
     45      Top = 0
     46      Width = 296
     47      Height = 423
     48      Align = alRight
     49      Caption = '2. Select extract-method'
    3850      TabOrder = 0
    39       OnResize = panel_extensionResize
    40       ExplicitWidth = 187
    41       object lbl_filter: TLabel
    42         Left = 2
    43         Top = 62
    44         Width = 100
    45         Height = 17
    46         AutoSize = False
    47         Caption = 'Filter by &extension:'
    48         FocusControl = combo_extension
    49       end
    50       object combo_extension: TComboBox
    51         Left = 2
    52         Top = 76
    53         Width = 145
    54         Height = 21
    55         Style = csDropDownList
    56         DropDownCount = 12
    57         Font.Charset = DEFAULT_CHARSET
    58         Font.Color = clWindowText
    59         Font.Height = -11
    60         Font.Name = 'Tahoma'
    61         Font.Style = []
    62         ItemHeight = 13
    63         ParentFont = False
    64         Sorted = True
    65         TabOrder = 3
    66         OnClick = combo_extensionClick
    67       end
    68       object check_zerobyte: TCheckBox
    69         Left = 2
    70         Top = 44
    71         Width = 130
    72         Height = 13
    73         Caption = 'Show &zero-byte files'
    74         TabOrder = 2
    75         OnClick = check_zerobyteClick
    76       end
    77       object edit_filtername: TEdit
    78         Left = 2
    79         Top = 20
    80         Width = 145
    81         Height = 18
    82         AutoSize = False
    83         TabOrder = 1
    84       end
    85       object check_filtername: TCheckBox
    86         Left = 2
    87         Top = 5
    88         Width = 130
    89         Height = 15
    90         Caption = 'Filter by file&name:'
    91         TabOrder = 0
    92         OnClick = check_filternameClick
    93       end
    94     end
    95     object list: TListBox
    96       Left = 2
    97       Top = 15
    98       Width = 226
    99       Height = 278
    100       Align = alClient
    101       ItemHeight = 13
    102       MultiSelect = True
    103       TabOrder = 1
    104       ExplicitWidth = 187
    105     end
    106   end
    107   object group_extract: TGroupBox
    108     Left = 230
    109     Top = 0
    110     Width = 296
    111     Height = 398
    112     Align = alRight
    113     Caption = '2. Select extract-method'
    114     TabOrder = 1
    115     ExplicitLeft = 191
    116     object group_singlefiles: TGroupBox
    117       Left = 8
    118       Top = 16
    119       Width = 281
    120       Height = 185
    121       Caption = 'Write data into single files'
    122       TabOrder = 0
    123       object btn_sel_dat: TButton
     51      object group_singlefiles: TGroupBox
     52        AlignWithMargins = True
    12453        Left = 8
    12554        Top = 16
    126         Width = 129
    127         Height = 49
    128         Caption = 'Selected files (dat contents only)'
     55        Width = 280
     56        Height = 185
     57        Margins.Left = 6
     58        Margins.Top = 1
     59        Margins.Right = 6
     60        Align = alTop
     61        Caption = 'Write data into single files'
    12962        TabOrder = 0
    130         WordWrap = True
    131         OnClick = Extract
    132       end
    133       object btn_sel_datraw: TButton
     63        object btn_sel_dat: TButton
     64          Left = 8
     65          Top = 16
     66          Width = 129
     67          Height = 49
     68          Caption = 'Selected files (dat contents only)'
     69          TabOrder = 0
     70          WordWrap = True
     71          OnClick = Extract
     72        end
     73        object btn_sel_datraw: TButton
     74          Left = 8
     75          Top = 72
     76          Width = 129
     77          Height = 49
     78          Caption = 'Selected files (dat+raw)'
     79          TabOrder = 1
     80          WordWrap = True
     81          OnClick = Extract
     82        end
     83        object btn_sel_datraw_convert: TButton
     84          Left = 8
     85          Top = 128
     86          Width = 129
     87          Height = 49
     88          Caption = 'Selected files (dat+raw) (with convert if possible)'
     89          TabOrder = 2
     90          WordWrap = True
     91          OnClick = Extract
     92        end
     93        object btn_all_dat: TButton
     94          Left = 144
     95          Top = 16
     96          Width = 129
     97          Height = 49
     98          Caption = 'All files in list (dat contents only)'
     99          TabOrder = 3
     100          WordWrap = True
     101          OnClick = Extract
     102        end
     103        object btn_all_datraw: TButton
     104          Left = 144
     105          Top = 72
     106          Width = 129
     107          Height = 49
     108          Caption = 'All files in list (dat+raw)'
     109          TabOrder = 4
     110          WordWrap = True
     111          OnClick = Extract
     112        end
     113        object btn_all_datraw_convert: TButton
     114          Left = 144
     115          Top = 128
     116          Width = 129
     117          Height = 49
     118          BiDiMode = bdLeftToRight
     119          Caption = 'All files in list (dat+raw) (with convert if possible)'
     120          ParentBiDiMode = False
     121          TabOrder = 5
     122          WordWrap = True
     123          OnClick = Extract
     124        end
     125      end
     126      object group_onefile: TGroupBox
     127        AlignWithMargins = True
    134128        Left = 8
    135         Top = 72
    136         Width = 129
    137         Height = 49
    138         Caption = 'Selected files (dat+raw)'
     129        Top = 205
     130        Width = 280
     131        Height = 73
     132        Margins.Left = 6
     133        Margins.Top = 1
     134        Margins.Right = 6
     135        Align = alTop
     136        Caption = 'Write data into one file'
    139137        TabOrder = 1
    140         WordWrap = True
    141         OnClick = Extract
    142       end
    143       object btn_sel_datraw_convert: TButton
     138        object btn_sel_files_toone: TButton
     139          Left = 8
     140          Top = 16
     141          Width = 129
     142          Height = 49
     143          Caption = 'Selected files (dat contents only)'
     144          TabOrder = 0
     145          WordWrap = True
     146          OnClick = Extract
     147        end
     148        object btn_all_files_toone: TButton
     149          Left = 144
     150          Top = 16
     151          Width = 129
     152          Height = 49
     153          Caption = 'All files in list (dat contents only)'
     154          TabOrder = 1
     155          WordWrap = True
     156          OnClick = Extract
     157        end
     158      end
     159      object group_progress: TGroupBox
     160        AlignWithMargins = True
    144161        Left = 8
    145         Top = 128
    146         Width = 129
    147         Height = 49
    148         Caption = 'Selected files (dat+raw) (with convert if possible)'
     162        Top = 282
     163        Width = 280
     164        Height = 132
     165        Margins.Left = 6
     166        Margins.Top = 1
     167        Margins.Right = 6
     168        Margins.Bottom = 7
     169        Align = alClient
     170        Caption = 'Progress ...'
    149171        TabOrder = 2
    150         WordWrap = True
    151         OnClick = Extract
    152       end
    153       object btn_all_dat: TButton
    154         Left = 144
    155         Top = 16
    156         Width = 129
    157         Height = 49
    158         Caption = 'All files in list (dat contents only)'
    159         TabOrder = 3
    160         WordWrap = True
    161         OnClick = Extract
    162       end
    163       object btn_all_datraw: TButton
    164         Left = 144
    165         Top = 72
    166         Width = 129
    167         Height = 49
    168         Caption = 'All files in list (dat+raw)'
    169         TabOrder = 4
    170         WordWrap = True
    171         OnClick = Extract
    172       end
    173       object btn_all_datraw_convert: TButton
    174         Left = 144
    175         Top = 128
    176         Width = 129
    177         Height = 49
    178         BiDiMode = bdLeftToRight
    179         Caption = 'All files in list (dat+raw) (with convert if possible)'
    180         ParentBiDiMode = False
    181         TabOrder = 5
    182         WordWrap = True
    183         OnClick = Extract
     172        Visible = False
     173        object lbl_progress: TLabel
     174          Left = 8
     175          Top = 40
     176          Width = 265
     177          Height = 17
     178          AutoSize = False
     179          Caption = 'Files done: 0/0'
     180        end
     181        object lbl_estimated: TLabel
     182          Left = 8
     183          Top = 56
     184          Width = 265
     185          Height = 17
     186          AutoSize = False
     187          Caption = 'Estimated finishing time: 00:00:00'
     188        end
     189        object progress: TProgressBar
     190          Left = 8
     191          Top = 16
     192          Width = 265
     193          Height = 17
     194          Smooth = True
     195          TabOrder = 0
     196        end
     197        object btn_abort: TButton
     198          Left = 8
     199          Top = 72
     200          Width = 97
     201          Height = 23
     202          Caption = 'Abort'
     203          Enabled = False
     204          TabOrder = 1
     205          OnClick = btn_abortClick
     206        end
    184207      end
    185208    end
    186     object group_onefile: TGroupBox
    187       Left = 8
    188       Top = 208
    189       Width = 281
    190       Height = 73
    191       Caption = 'Write data into one file'
    192       TabOrder = 1
    193       object btn_sel_files_toone: TButton
    194         Left = 8
    195         Top = 16
    196         Width = 129
    197         Height = 49
    198         Caption = 'Selected files (dat contents only)'
    199         TabOrder = 0
    200         WordWrap = True
    201         OnClick = Extract
    202       end
    203       object btn_all_files_toone: TButton
    204         Left = 144
    205         Top = 16
    206         Width = 129
    207         Height = 49
    208         Caption = 'All files in list (dat contents only)'
    209         TabOrder = 1
    210         WordWrap = True
    211         OnClick = Extract
    212       end
    213     end
    214     object group_progress: TGroupBox
    215       Left = 8
    216       Top = 288
    217       Width = 281
    218       Height = 105
    219       Caption = 'Progress ...'
    220       TabOrder = 2
    221       Visible = False
    222       object lbl_progress: TLabel
    223         Left = 8
    224         Top = 40
    225         Width = 265
    226         Height = 17
    227         AutoSize = False
    228         Caption = 'Files done: 0/0'
    229       end
    230       object lbl_estimated: TLabel
    231         Left = 8
    232         Top = 56
    233         Width = 265
    234         Height = 17
    235         AutoSize = False
    236         Caption = 'Estimated finishing time: 00:00:00'
    237       end
    238       object progress: TProgressBar
    239         Left = 8
    240         Top = 16
    241         Width = 265
    242         Height = 17
    243         Smooth = True
    244         TabOrder = 0
    245       end
    246       object btn_abort: TButton
    247         Left = 8
    248         Top = 72
    249         Width = 97
    250         Height = 23
    251         Caption = 'Abort'
    252         Enabled = False
    253         TabOrder = 1
    254       end
    255     end
    256   end
    257   object saved: TSaveDialog
     209  end
     210  object saved: TSaveDialog [3]
    258211    Left = 448
    259212    Top = 328
  • oup/current/Tool_Extractor.pas

    r43 r45  
    11unit Tool_Extractor;
    2 
    32interface
    4 
    53uses
    64  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    7   Dialogs, StdCtrls, ExtCtrls, StrUtils, ComCtrls;
     5  Dialogs, Tool_Template, StdCtrls, ExtCtrls, ComCtrls, Menus;
    86
    97type
    10   TForm_Extractor = class(TForm)
    11     group_select: TGroupBox;
     8  TForm_Extractor = class(TForm_ToolTemplate)
    129    group_extract: TGroupBox;
    1310    group_singlefiles: TGroupBox;
     
    1815    btn_all_datraw: TButton;
    1916    btn_all_datraw_convert: TButton;
    20     group_onefile: TGroupBox;
    2117    btn_sel_files_toone: TButton;
    2218    btn_all_files_toone: TButton;
     19    group_onefile: TGroupBox;
    2320    group_progress: TGroupBox;
    24     progress: TProgressBar;
    2521    lbl_progress: TLabel;
    2622    lbl_estimated: TLabel;
     23    progress: TProgressBar;
    2724    btn_abort: TButton;
    2825    saved: TSaveDialog;
    29     panel_extension: TPanel;
    30     lbl_filter: TLabel;
    31     combo_extension: TComboBox;
    32     check_zerobyte: TCheckBox;
    33     edit_filtername: TEdit;
    34     check_filtername: TCheckBox;
    35     list: TListBox;
    36     procedure LoadFileNames;
    37     procedure check_filternameClick(Sender: TObject);
    38     procedure check_zerobyteClick(Sender: TObject);
    39     procedure combo_extensionClick(Sender: TObject);
    40     procedure panel_extensionResize(Sender: TObject);
    41     procedure Recreatelist;
    42 
    4326    procedure FormCreate(Sender: TObject);
    44     procedure FormClose(Sender: TObject; var Action: TCloseAction);
    45     procedure FormResize(Sender: TObject);
    4627    procedure Extract(Sender: TObject);
     28    procedure btn_abortClick(Sender: TObject);
    4729  private
    4830  public
     
    5335
    5436implementation
    55 
    5637{$R *.dfm}
    57 
    5838uses Main, Code_Functions, Data, Code_OniDataClass;
    59 
    60 
    61 
    62 
    63 procedure TForm_Extractor.Recreatelist;
    64 var
    65   i:    LongWord;
    66   exts: TStringArray;
    67 begin
    68   combo_extension.Items.Clear;
    69   combo_extension.Items.Add('_All files_ (' + IntToStr(
    70     OniDataConnection.GetFilesCount) + ')');
    71   exts := OniDataConnection.GetExtensionsList;
    72   for i := 0 to High(exts) do
    73     combo_extension.Items.Add(exts[i]);
    74   combo_extension.ItemIndex := 0;
    75   combo_extensionClick(Self);
    76 end;
    77 
    78 
    79 
    80 
    81 procedure TForm_Extractor.LoadFileNames;
    82 var
    83   Extension: String[4];
    84   no_zero_bytes: Boolean;
    85   pattern: String;
    86   files: TStringArray;
    87   i: LongWord;
    88 begin
    89   Extension := MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex], 1, 4);
    90   no_zero_bytes := not check_zerobyte.Checked;
    91   pattern := '';
    92   if check_filtername.Checked then
    93     pattern := edit_filtername.Text;
    94   if Extension = '_All' then
    95     Extension := '';
    96 
    97   files := OniDataConnection.GetFilesList(extension, pattern, no_zero_bytes);
    98   list.Items.Clear;
    99   if Length(files) > 0 then
    100     for i := 0 to High(files) do
    101       list.Items.Add(files[i]);
    102 end;
    103 
    104 
    105 
    106 
    107 procedure TForm_Extractor.panel_extensionResize(Sender: TObject);
    108 begin
    109   combo_extension.Width := panel_extension.Width - 5;
    110   edit_filtername.Width := panel_extension.Width - 5;
    111 end;
    112 
    113 
    114 
    115 
    116 procedure TForm_Extractor.combo_extensionClick(Sender: TObject);
    117 begin
    118   LoadFileNames;
    119 end;
    120 
    121 
    122 
    123 
    124 procedure TForm_Extractor.check_zerobyteClick(Sender: TObject);
    125 var
    126   i: Byte;
    127 begin
    128   LoadFileNames;
    129 end;
    130 
    131 
    132 
    133 
    134 procedure TForm_Extractor.check_filternameClick(Sender: TObject);
    135 begin
    136   edit_filtername.Enabled := not check_filtername.Checked;
    137   LoadFileNames;
    138 end;
    139 
    140 
    141 
    142 
    143 procedure TForm_Extractor.FormResize(Sender: TObject);
    144 begin
    145   if Self.Width >= 450 then
    146   begin
    147   end
    148   else
    149     Self.Width := 450;
    150   if Self.Height >= 400 then
    151   begin
    152     group_progress.Height := group_extract.Height - 293;
    153   end
    154   else
    155     Self.Height := 400;
    156 end;
    157 
    158 
    159 
    160 
    161 procedure TForm_Extractor.FormClose(Sender: TObject; var Action: TCloseAction);
    162 begin
    163   Action := caFree;
    164 end;
    165 
    166 
    167 
    16839
    16940procedure TForm_Extractor.FormCreate(Sender: TObject);
    17041begin
     42  inherited;
     43  Self.AllowMultiSelect := True;
     44
    17145  btn_sel_dat.Caption    := 'Selected files' + CrLf + '(dat contents only)';
    17246  btn_sel_datraw.Caption := 'Selected files' + CrLf + '(dat+raw contents)';
     
    18155end;
    18256
    183 
    184 
     57procedure TForm_Extractor.btn_abortClick(Sender: TObject);
     58begin
     59  ShowMessage('X');
     60end;
    18561
    18662procedure TForm_Extractor.Extract(Sender: TObject);
     
    21389    begintime := Time;
    21490    group_progress.Visible := True;
    215     group_select.Enabled := False;
     91    panel_files.Enabled := False;
    21692    group_singlefiles.Enabled := False;
    21793    group_onefile.Enabled := False;
     
    230106        begin
    231107          group_progress.Visible    := False;
    232           group_select.Enabled      := True;
     108          panel_files.Enabled      := True;
    233109          group_singlefiles.Enabled := True;
    234110          group_onefile.Enabled     := True;
     
    242118    if sel_only then
    243119    begin
    244       files := list.SelCount;
     120      files := filelist.SelCount;
    245121      lbl_progress.Caption := 'Files done: 0/' + IntToStr(files);
    246122      progress.Max := files;
    247123      done  := 0;
    248       for i := 0 to list.Count - 1 do
     124      for i := 0 to filelist.Count - 1 do
    249125      begin
    250         if list.Selected[i] then
     126        if filelist.Selected[i] then
    251127        begin
    252128          if one_file then
    253129          begin
    254130            ExportFile(OniDataConnection.ExtractFileID(
    255               list.Items.Strings[list.ItemIndex]), ExtractFileName(saved.FileName),
     131              filelist.Items.Strings[filelist.ItemIndex]), ExtractFileName(saved.FileName),
    256132              settings, ExtractFileDir(saved.FileName));
    257133          end
     
    259135          begin
    260136            ExportFile(OniDataConnection.ExtractFileID(
    261               list.Items.Strings[list.ItemIndex]), list.Items.Strings[i], settings, 'D:');
     137              filelist.Items.Strings[filelist.ItemIndex]), filelist.Items.Strings[i], settings, 'D:');
    262138          end;
    263139          Inc(done);
     
    276152    else
    277153    begin
    278       files := list.Count;
     154      files := filelist.Count;
    279155      lbl_progress.Caption := 'Files done: 0/' + IntToStr(files);
    280156      progress.Max := files;
    281       for i := 0 to list.Count - 1 do
     157      for i := 0 to filelist.Count - 1 do
    282158      begin
    283159        if one_file then
    284160        begin
    285161          ExportFile(OniDataConnection.ExtractFileID(
    286             list.Items.Strings[list.ItemIndex]), ExtractFileName(saved.FileName),
     162            filelist.Items.Strings[filelist.ItemIndex]), ExtractFileName(saved.FileName),
    287163            settings, ExtractFileDir(saved.FileName));
    288164        end
     
    290166        begin
    291167          ExportFile(OniDataConnection.ExtractFileID(
    292             list.Items.Strings[list.ItemIndex]), list.Items.Strings[i], settings, 'D:');
     168            filelist.Items.Strings[filelist.ItemIndex]), filelist.Items.Strings[i], settings, 'D:');
    293169        end;
    294170        if ((i mod 10) = 0) and (i >= 50) then
     
    304180    end;
    305181    group_progress.Visible    := False;
    306     group_select.Enabled      := True;
     182    panel_files.Enabled      := True;
    307183    group_singlefiles.Enabled := True;
    308184    group_onefile.Enabled     := True;
     
    310186end;
    311187
     188begin
     189  AddToolListEntry('extractor', 'Extractor', '');
    312190end.
  • oup/current/Tool_Preview.dfm

    r43 r45  
    1 object Form_Preview: TForm_Preview
    2   Left = 0
    3   Top = 0
     1inherited Form_Preview: TForm_Preview
    42  Caption = 'Preview'
    5   ClientHeight = 473
    6   ClientWidth = 472
    7   Color = clBtnFace
    8   Font.Charset = DEFAULT_CHARSET
    9   Font.Color = clWindowText
    10   Font.Height = -11
    11   Font.Name = 'Tahoma'
    12   Font.Style = []
    13   FormStyle = fsMDIChild
    14   OldCreateOrder = False
    15   Visible = True
    16   WindowState = wsMaximized
    17   OnClose = FormClose
    183  OnCreate = FormCreate
    19   OnResize = FormResize
     4  ExplicitWidth = 320
     5  ExplicitHeight = 240
    206  PixelsPerInch = 96
    217  TextHeight = 13
    22   object Splitter1: TSplitter
    23     Left = 200
    24     Top = 0
    25     Width = 9
    26     Height = 473
    27     AutoSnap = False
    28     Beveled = True
    29     MinSize = 150
    30   end
    31   object panel_preview: TPanel
    32     Left = 209
    33     Top = 0
    34     Width = 263
    35     Height = 473
    36     Align = alClient
    37     BevelOuter = bvNone
    38     TabOrder = 0
    39     object img: TImage
    40       Left = 0
    41       Top = 20
    42       Width = 263
    43       Height = 453
    44       Align = alClient
    45       ExplicitWidth = 313
    46     end
     8  inherited content: TPanel
    479    object lbl_notpossible: TLabel
    4810      Left = 16
     
    6123      WordWrap = True
    6224    end
     25    object img: TImage
     26      Left = 0
     27      Top = 20
     28      Width = 283
     29      Height = 403
     30      Align = alClient
     31      ExplicitWidth = 313
     32      ExplicitHeight = 453
     33    end
    6334    object panel_buttons: TPanel
    6435      Left = 0
    6536      Top = 0
    66       Width = 263
     37      Width = 283
    6738      Height = 20
    6839      Align = alTop
     
    10273    end
    10374  end
    104   object panel_files: TPanel
    105     Left = 0
    106     Top = 0
    107     Width = 200
    108     Height = 473
    109     Align = alLeft
    110     BevelOuter = bvNone
    111     TabOrder = 1
    112     object list: TListBox
    113       Left = 0
    114       Top = 0
    115       Width = 200
    116       Height = 370
    117       Align = alClient
    118       ItemHeight = 13
    119       TabOrder = 0
    120       OnClick = listClick
    121       OnMouseDown = listMouseDown
    122     end
    123     object panel_extension: TPanel
    124       Left = 0
    125       Top = 370
    126       Width = 200
    127       Height = 103
    128       Align = alBottom
    129       BevelOuter = bvNone
    130       TabOrder = 1
    131       OnResize = panel_extensionResize
    132       object lbl_filter: TLabel
    133         Left = 2
    134         Top = 62
    135         Width = 100
    136         Height = 17
    137         AutoSize = False
    138         Caption = 'Filter by &extension:'
    139         FocusControl = combo_extension
    140       end
    141       object combo_extension: TComboBox
    142         Left = 2
    143         Top = 76
    144         Width = 145
    145         Height = 21
    146         Style = csDropDownList
    147         DropDownCount = 12
    148         Font.Charset = DEFAULT_CHARSET
    149         Font.Color = clWindowText
    150         Font.Height = -11
    151         Font.Name = 'Tahoma'
    152         Font.Style = []
    153         ItemHeight = 13
    154         ParentFont = False
    155         Sorted = True
    156         TabOrder = 3
    157         OnClick = combo_extensionClick
    158       end
    159       object check_zerobyte: TCheckBox
    160         Left = 2
    161         Top = 44
    162         Width = 130
    163         Height = 13
    164         Caption = 'Show &zero-byte files'
    165         TabOrder = 2
    166         OnClick = check_zerobyteClick
    167       end
    168       object edit_filtername: TEdit
    169         Left = 2
    170         Top = 20
    171         Width = 145
    172         Height = 18
    173         AutoSize = False
    174         TabOrder = 1
    175       end
    176       object check_filtername: TCheckBox
    177         Left = 2
    178         Top = 5
    179         Width = 130
    180         Height = 15
    181         Caption = 'Filter by file&name:'
    182         TabOrder = 0
    183         OnClick = check_filternameClick
    184       end
    185     end
    186   end
    187   object timer: TTimer
     75  object timer: TTimer [3]
    18876    Enabled = False
    18977    OnTimer = timerTimer
    190     Left = 144
    191     Top = 24
     78    Left = 400
     79    Top = 120
    19280  end
    19381end
  • oup/current/Tool_Preview.pas

    r43 r45  
    11unit Tool_Preview;
    2 
    32interface
    4 
    53uses
    64  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    7   Dialogs, Math, ExtCtrls, StdCtrls, StrUtils, Menus,
    8   Code_Functions, Data, Code_Exporters, Code_OniImgClass, Code_OniDataClass;
     5  Dialogs, StdCtrls, Tool_Template, ExtCtrls, Math, StrUtils,
     6  Code_OniDataClass, Code_OniImgClass, Data, Menus;
    97
    108type
    11   TForm_Preview = class(TForm)
    12     timer:   TTimer;
    13     panel_preview: TPanel;
    14     img:     TImage;
     9  TForm_Preview = class(TForm_ToolTemplate)
     10    lbl_notpossible: TLabel;
    1511    panel_buttons: TPanel;
    1612    btn_dec: TButton;
    1713    btn_startstop: TButton;
    1814    btn_inc: TButton;
    19     Splitter1: TSplitter;
    20     lbl_notpossible: TLabel;
    21     panel_files: TPanel;
    22     list:    TListBox;
    23     panel_extension: TPanel;
    24     lbl_filter: TLabel;
    25     combo_extension: TComboBox;
    26     check_zerobyte: TCheckBox;
    27     edit_filtername: TEdit;
    28     check_filtername: TCheckBox;
    29     procedure LoadFileNames;
    30     procedure check_filternameClick(Sender: TObject);
    31     procedure check_zerobyteClick(Sender: TObject);
    32     procedure combo_extensionClick(Sender: TObject);
    33     procedure panel_extensionResize(Sender: TObject);
    34     procedure listClick(Sender: TObject);
    35     procedure Recreatelist;
     15    img: TImage;
     16    timer: TTimer;
     17    procedure FormCreate(Sender: TObject);
     18    procedure NewFile(fileinfo: TFileInfo);
    3619
    3720    procedure PreviewImage;
     
    3922    procedure btn_incClick(Sender: TObject);
    4023    procedure btn_decClick(Sender: TObject);
    41     procedure FormResize(Sender: TObject);
    4224    procedure btn_startstopClick(Sender: TObject);
     25    procedure timerTimer(Sender: TObject);
    4326    procedure panel_buttonsResize(Sender: TObject);
    44     procedure timerTimer(Sender: TObject);
    45     procedure FormCreate(Sender: TObject);
    46     procedure FormClose(Sender: TObject; var Action: TCloseAction);
    4727
    4828    procedure DrawImage(index: Integer);
    4929    procedure SetBitmapCount(Count: Integer);
    5030    procedure LoadImage(fileid, index: Integer);
    51     procedure listMouseDown(Sender: TObject; Button: TMouseButton;
    52       Shift: TShiftState; X, Y: Integer);
    5331  private
    5432    bitmaps:   array of TBitmap;
     
    6240
    6341implementation
    64 
    6542{$R *.dfm}
    6643
    67 uses Main;
    68 
    69 
    70 
    71 
    72 procedure TForm_Preview.Recreatelist;
    73 var
    74   i:    LongWord;
    75   exts: TStringArray;
    76 begin
    77   combo_extension.Items.Clear;
    78   combo_extension.Items.Add('_All files_ (' +
    79     IntToStr(OniDataConnection.GetFilesCount) + ')');
    80   exts := OniDataConnection.GetExtensionsList;
    81   for i := 0 to High(exts) do
    82     combo_extension.Items.Add(exts[i]);
    83   combo_extension.ItemIndex := 0;
    84   combo_extensionClick(Self);
    85 end;
    86 
    87 
    88 
    89 
    90 procedure TForm_Preview.LoadFileNames;
    91 var
    92   Extension: String[4];
    93   no_zero_bytes: Boolean;
    94   pattern: String;
    95   files: TStringArray;
    96   i: LongWord;
    97 begin
    98   Extension := MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex], 1, 4);
    99   no_zero_bytes := not check_zerobyte.Checked;
    100   pattern := '';
    101   if check_filtername.Checked then
    102     pattern := edit_filtername.Text;
    103   if Extension = '_All' then
    104     Extension := '';
    105 
    106   files := OniDataConnection.GetFilesList(extension, pattern, no_zero_bytes);
    107   list.Items.Clear;
    108   if Length(files) > 0 then
    109     for i := 0 to High(files) do
    110       list.Items.Add(files[i]);
    111 end;
    112 
    113 
     44
     45procedure TForm_Preview.FormCreate(Sender: TObject);
     46begin
     47  inherited;
     48  Self.OnNewFileSelected := NewFile;
     49end;
     50
     51
     52procedure TForm_Preview.NewFile(fileinfo: TFileInfo);
     53var
     54  ext: String;
     55begin
     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;
     69    Self.img.Visible := False;
     70  end;
     71end;
    11472
    11573
     
    13492
    13593
    136 
    137 
    138 procedure TForm_Preview.combo_extensionClick(Sender: TObject);
    139 begin
    140   LoadFileNames;
    141 end;
    142 
    143 
    144 
    14594procedure TForm_Preview.DrawImage(index: Integer);
    14695begin
     
    153102
    154103
    155 
    156 
    157104procedure TForm_Preview.SetBitmapCount(Count: Integer);
    158105var
     
    175122
    176123
    177 
    178 
    179 procedure TForm_Preview.check_zerobyteClick(Sender: TObject);
    180 begin
    181   LoadFileNames;
    182 end;
    183 
    184 
    185 
    186 
    187 procedure TForm_Preview.check_filternameClick(Sender: TObject);
    188 begin
    189   edit_filtername.Enabled := not check_filtername.Checked;
    190   LoadFileNames;
    191 end;
    192 
    193 
    194 
    195 
    196 procedure TForm_Preview.listClick(Sender: TObject);
    197 var
    198   ext: String;
    199 begin
    200   _fileid := OniDataConnection.ExtractFileID(list.Items.Strings[list.ItemIndex]);
    201   lbl_notpossible.Visible := False;
    202   Self.img.Visible := True;
    203   Self.timer.Enabled := False;
    204   Self.panel_buttons.Visible := False;
    205   ext     := RightStr(list.Items.Strings[list.ItemIndex], 4);
    206   if (ext = 'PSpc') or (ext = 'TXMB') or (ext = 'TXMP') then
    207     PreviewImage
    208   else if ext = 'TXAN' then
    209     PreviewTXAN
    210   else
    211   begin
    212     Self.lbl_notpossible.Visible := True;
    213     Self.img.Visible := False;
    214   end;
    215 end;
    216 
    217 
    218 
    219 
    220 procedure TForm_Preview.listMouseDown(Sender: TObject; Button: TMouseButton;
    221   Shift: TShiftState; X, Y: Integer);
    222 var
    223   pt: TPoint;
    224 begin
    225   pt.X := x;
    226   pt.Y := y;
    227   list.ItemIndex := list.ItemAtPos(pt, true);
    228   if list.ItemIndex > -1 then
    229     Self.listClick(Self);
    230 end;
    231 
    232124procedure TForm_Preview.PreviewImage;
    233125begin
     
    236128  DrawImage(0);
    237129end;
    238 
    239 
    240130
    241131
     
    266156
    267157
    268 
    269 
    270158procedure TForm_Preview.timerTimer(Sender: TObject);
    271159begin
    272160  btn_incClick(Self);
    273161end;
    274 
    275 
    276162
    277163
     
    288174
    289175
    290 
    291 
    292176procedure TForm_Preview.btn_decClick(Sender: TObject);
    293177begin
     
    302186
    303187
    304 
    305 
    306188procedure TForm_Preview.btn_incClick(Sender: TObject);
    307189begin
     
    316198
    317199
    318 
    319 
    320200procedure TForm_Preview.panel_buttonsResize(Sender: TObject);
    321201begin
     
    325205
    326206
    327 
    328 
    329 procedure TForm_Preview.panel_extensionResize(Sender: TObject);
    330 begin
    331   combo_extension.Width := panel_extension.Width - 5;
    332   edit_filtername.Width := panel_extension.Width - 5;
    333 end;
    334 
    335 
    336 
    337 
    338 procedure TForm_Preview.FormResize(Sender: TObject);
    339 begin
    340   if Self.Width < 300 then
    341     Self.Width := 300;
    342   if Self.Height < 200 then
    343     Self.Height := 200;
    344 end;
    345 
    346 
    347 
    348 
    349 procedure TForm_Preview.FormCreate(Sender: TObject);
    350 begin
    351   SetLength(bitmaps, 0);
    352   Self.Width  := 260;
    353   Self.Height := 300;
    354 end;
    355 
    356 
    357 
    358 
    359 procedure TForm_Preview.FormClose(Sender: TObject; var Action: TCloseAction);
    360 begin
    361   Action := caFree;
    362 end;
    363 
     207begin
     208  AddToolListEntry('preview', 'Preview-Window', '');
    364209end.
  • oup/current/Tool_RawEdit.dfm

    r43 r45  
    1 object Form_RawEdit: TForm_RawEdit
    2   Left = 0
    3   Top = 0
    4   BorderIcons = [biSystemMenu, biMaximize]
    5   Caption = 'Binary .raw-Editor'
    6   ClientHeight = 640
    7   ClientWidth = 642
    8   Color = clBtnFace
    9   Font.Charset = DEFAULT_CHARSET
    10   Font.Color = clWindowText
    11   Font.Height = -11
    12   Font.Name = 'Tahoma'
    13   Font.Style = []
    14   FormStyle = fsMDIChild
    15   KeyPreview = True
    16   OldCreateOrder = False
    17   Visible = True
    18   WindowState = wsMaximized
    19   OnClose = FormClose
     1inherited Form_RawEdit: TForm_RawEdit
     2  Caption = 'RawEdit'
    203  OnCloseQuery = FormCloseQuery
    214  OnCreate = FormCreate
    225  OnKeyUp = FormKeyUp
    23   OnResize = FormResize
     6  ExplicitWidth = 320
     7  ExplicitHeight = 240
    248  PixelsPerInch = 96
    259  TextHeight = 13
    26   object Splitter1: TSplitter
    27     Left = 200
    28     Top = 0
    29     Width = 9
    30     Height = 640
    31     AutoSnap = False
    32     Beveled = True
    33     MinSize = 150
    34     ExplicitLeft = 150
     10  inherited panel_files: TPanel
     11    object Splitter4: TSplitter [0]
     12      Left = 0
     13      Top = 205
     14      Width = 200
     15      Height = 8
     16      Cursor = crVSplit
     17      Align = alBottom
     18      AutoSnap = False
     19      Beveled = True
     20      MinSize = 150
     21      ExplicitLeft = 3
     22      ExplicitTop = 89
     23    end
     24    inherited filelist: TListBox
     25      Height = 102
     26      ExplicitHeight = 102
     27    end
     28    object panel_imexport: TPanel
     29      Left = 0
     30      Top = 363
     31      Width = 200
     32      Height = 60
     33      Align = alBottom
     34      BevelOuter = bvNone
     35      TabOrder = 3
     36      DesignSize = (
     37        200
     38        60)
     39      object btn_export: TButton
     40        Left = 4
     41        Top = 4
     42        Width = 190
     43        Height = 25
     44        Anchors = [akLeft, akTop, akRight]
     45        Caption = 'Export to file...'
     46        TabOrder = 0
     47        OnClick = btn_exportClick
     48      end
     49      object btn_import: TButton
     50        Left = 4
     51        Top = 32
     52        Width = 190
     53        Height = 25
     54        Anchors = [akLeft, akTop, akRight]
     55        Caption = 'Import from file...'
     56        TabOrder = 1
     57        OnClick = btn_importClick
     58      end
     59    end
     60    object GroupBox1: TGroupBox
     61      Left = 0
     62      Top = 213
     63      Width = 200
     64      Height = 150
     65      Align = alBottom
     66      Caption = '2. Select .dat-link-offset'
     67      TabOrder = 2
     68      object list_offset: TListBox
     69        Left = 2
     70        Top = 15
     71        Width = 196
     72        Height = 133
     73        Align = alClient
     74        ItemHeight = 13
     75        TabOrder = 0
     76        OnClick = list_offsetClick
     77      end
     78    end
    3579  end
    36   object panel_data: TPanel
    37     Left = 209
    38     Top = 0
    39     Width = 433
    40     Height = 640
    41     Align = alClient
    42     BevelOuter = bvNone
    43     TabOrder = 0
    44     OnResize = panel_dataResize
     80  inherited content: TPanel
     81    OnResize = panel_contentResize
    4582    object Splitter2: TSplitter
    4683      Left = 0
    47       Top = 450
    48       Width = 433
     84      Top = 300
     85      Width = 283
    4986      Height = 9
    5087      Cursor = crVSplit
     
    5390      Beveled = True
    5491      MinSize = 40
    55       ExplicitTop = 209
    56       ExplicitWidth = 483
     92      ExplicitTop = 414
    5793    end
    5894    object hex: TMPHexEditor
    5995      Left = 0
    6096      Top = 0
    61       Width = 433
    62       Height = 450
     97      Width = 283
     98      Height = 300
    6399      Cursor = crIBeam
    64100      Align = alTop
     
    98134    object value_viewer: TWrapGrid
    99135      Left = 0
    100       Top = 459
    101       Width = 433
    102       Height = 181
     136      Top = 309
     137      Width = 283
     138      Height = 114
    103139      Align = alClient
    104140      ColCount = 1
     
    121157    end
    122158  end
    123   object panel_files: TPanel
    124     Left = 0
    125     Top = 0
    126     Width = 200
    127     Height = 640
    128     Align = alLeft
    129     BevelOuter = bvNone
    130     TabOrder = 1
    131     object Splitter4: TSplitter
    132       Left = 0
    133       Top = 442
    134       Width = 200
    135       Height = 9
    136       Cursor = crVSplit
    137       Align = alBottom
    138       AutoSnap = False
    139       Beveled = True
    140       MinSize = 150
    141       ExplicitWidth = 150
    142     end
    143     object panel_imexport: TPanel
    144       Left = 0
    145       Top = 580
    146       Width = 200
    147       Height = 60
    148       Align = alBottom
    149       BevelOuter = bvNone
    150       TabOrder = 0
    151       OnResize = panel_imexportResize
    152       object btn_export: TButton
    153         Left = 4
    154         Top = 4
    155         Width = 142
    156         Height = 25
    157         Caption = 'Export to file...'
    158         TabOrder = 0
    159         OnClick = btn_exportClick
    160       end
    161       object btn_import: TButton
    162         Left = 4
    163         Top = 32
    164         Width = 142
    165         Height = 25
    166         Caption = 'Import from file...'
    167         TabOrder = 1
    168         OnClick = btn_importClick
    169       end
    170     end
    171     object group_file: TGroupBox
    172       Left = 0
    173       Top = 0
    174       Width = 200
    175       Height = 442
    176       Align = alClient
    177       Caption = '1. Select file'
    178       TabOrder = 1
    179       object list: TListBox
    180         Left = 2
    181         Top = 15
    182         Width = 196
    183         Height = 337
    184         Align = alClient
    185         ItemHeight = 13
    186         TabOrder = 0
    187         OnClick = listClick
    188         OnMouseDown = listMouseDown
    189       end
    190       object panel_extension: TPanel
    191         Left = 2
    192         Top = 352
    193         Width = 196
    194         Height = 88
    195         Align = alBottom
    196         BevelOuter = bvNone
    197         TabOrder = 1
    198         OnResize = panel_extensionResize
    199         object lbl_filter: TLabel
    200           Left = 2
    201           Top = 46
    202           Width = 100
    203           Height = 17
    204           AutoSize = False
    205           Caption = 'Filter by &extension:'
    206           FocusControl = combo_extension
    207         end
    208         object combo_extension: TComboBox
    209           Left = 2
    210           Top = 60
    211           Width = 145
    212           Height = 21
    213           Style = csDropDownList
    214           DropDownCount = 12
    215           Font.Charset = DEFAULT_CHARSET
    216           Font.Color = clWindowText
    217           Font.Height = -11
    218           Font.Name = 'Tahoma'
    219           Font.Style = []
    220           ItemHeight = 13
    221           ParentFont = False
    222           Sorted = True
    223           TabOrder = 2
    224           OnClick = combo_extensionClick
    225         end
    226         object edit_filtername: TEdit
    227           Left = 2
    228           Top = 20
    229           Width = 145
    230           Height = 18
    231           AutoSize = False
    232           TabOrder = 1
    233         end
    234         object check_filtername: TCheckBox
    235           Left = 2
    236           Top = 5
    237           Width = 130
    238           Height = 15
    239           Caption = 'Filter by file&name:'
    240           TabOrder = 0
    241           OnClick = check_filternameClick
    242         end
    243       end
    244     end
    245     object GroupBox1: TGroupBox
    246       Left = 0
    247       Top = 451
    248       Width = 200
    249       Height = 129
    250       Align = alBottom
    251       Caption = '2. Select .dat-link-offset'
    252       TabOrder = 2
    253       object list_offset: TListBox
    254         Left = 2
    255         Top = 15
    256         Width = 196
    257         Height = 112
    258         Align = alClient
    259         ItemHeight = 13
    260         TabOrder = 0
    261         OnClick = list_offsetClick
    262       end
    263     end
    264   end
    265   object value_viewer_context: TPopupMenu
     159  object value_viewer_context: TPopupMenu [3]
    266160    AutoHotkeys = maManual
    267161    OnPopup = value_viewer_contextPopup
     
    293187    end
    294188  end
    295   object opend: TOpenDialog
     189  object opend: TOpenDialog [4]
    296190    Options = [ofPathMustExist, ofFileMustExist, ofEnableSizing]
    297     Left = 120
    298     Top = 584
     191    Left = 128
     192    Top = 256
    299193  end
    300   object saved: TSaveDialog
     194  object saved: TSaveDialog [5]
    301195    Options = [ofOverwritePrompt, ofPathMustExist, ofEnableSizing]
    302     Left = 120
    303     Top = 608
     196    Left = 128
     197    Top = 280
    304198  end
    305199end
  • oup/current/Tool_RawEdit.pas

    r43 r45  
    11unit Tool_RawEdit;
    2 
    32interface
    4 
    53uses
    64  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    7   Dialogs, Wrapgrid, StdCtrls, Grids, StrUtils, MPHexEditor, ExtCtrls, Clipbrd,
    8   Data, Code_Functions, Code_DataStructures, Code_Exporters, Code_OniDataClass,
    9   Menus, Math;
     5  Dialogs, Tool_Template, StdCtrls, ExtCtrls, Menus, Grids, Wrapgrid,
     6  MPHexEditor, Clipbrd, StrUtils,
     7  Data, Code_Functions, Code_DataStructures, Code_Exporters, Code_OniDataClass;
    108
    119type
    12   TForm_RawEdit = class(TForm)
    13     Splitter1: TSplitter;
    14     panel_data: TPanel;
    15     hex:   TMPHexEditor;
     10  TForm_RawEdit = class(TForm_ToolTemplate)
     11    Splitter4: TSplitter;
     12    panel_imexport: TPanel;
     13    btn_export: TButton;
     14    btn_import: TButton;
     15    GroupBox1: TGroupBox;
     16    list_offset: TListBox;
     17    hex: TMPHexEditor;
    1618    Splitter2: TSplitter;
    1719    value_viewer: TWrapGrid;
    1820    value_viewer_context: TPopupMenu;
    1921    value_viewer_context_copy: TMenuItem;
    20     value_viewer_context_copyashex: TMenuItem;
    2122    value_viewer_context_copyasdec: TMenuItem;
    2223    value_viewer_context_copyasfloat: TMenuItem;
    2324    value_viewer_context_copyasbitset: TMenuItem;
    2425    value_viewer_context_copyasstring: TMenuItem;
    25     panel_files: TPanel;
     26    value_viewer_context_copyashex: TMenuItem;
    2627    opend: TOpenDialog;
    2728    saved: TSaveDialog;
    28     panel_imexport: TPanel;
    29     btn_export: TButton;
    30     btn_import: TButton;
    31     group_file: TGroupBox;
    32     list:  TListBox;
    33     panel_extension: TPanel;
    34     lbl_filter: TLabel;
    35     combo_extension: TComboBox;
    36     edit_filtername: TEdit;
    37     check_filtername: TCheckBox;
    38     GroupBox1: TGroupBox;
    39     list_offset: TListBox;
    40     Splitter4: TSplitter;
    41     procedure hexKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    4229    procedure list_offsetClick(Sender: TObject);
     30    procedure NewFile(fileinfo: TFileInfo);
    4331    procedure LoadRaw(raw_info: TRawInfo);
    44     procedure LoadFileNames;
    45     procedure check_filternameClick(Sender: TObject);
    46     procedure combo_extensionClick(Sender: TObject);
    47     procedure panel_extensionResize(Sender: TObject);
    48     procedure listClick(Sender: TObject);
    49     procedure Recreatelist;
    50 
     32    function Save: Boolean;
     33
     34    procedure btn_importClick(Sender: TObject);
     35    procedure btn_exportClick(Sender: TObject);
     36
     37    procedure FormCreate(Sender: TObject);
     38    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    5139    procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
     40
     41    procedure panel_contentResize(Sender: TObject);
     42
     43    function GetValue(datatype: Word; offset: LongWord): String;
     44    procedure ClearValues;
     45    procedure WriteValues;
     46    procedure SetNewValue(datatype: Word; offset: LongWord; Value: String);
     47
    5248    procedure value_viewerDblClick(Sender: TObject);
    5349    procedure value_viewer_context_copyClick(Sender: TObject);
     
    5551      Shift: TShiftState; X, Y: Integer);
    5652    procedure value_viewer_contextPopup(Sender: TObject);
    57     procedure btn_importClick(Sender: TObject);
    58     procedure btn_exportClick(Sender: TObject);
    59     procedure panel_imexportResize(Sender: TObject);
    60     function Save: Boolean;
    61     procedure FormClose(Sender: TObject; var Action: TCloseAction);
    62     function GetValue(datatype: Word; offset: LongWord): String;
     53
     54    procedure hexKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    6355    procedure hexSelectionChanged(Sender: TObject);
    6456    procedure hexChange(Sender: TObject);
    65     procedure panel_dataResize(Sender: TObject);
    66     procedure FormResize(Sender: TObject);
    67     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    68     procedure FormCreate(Sender: TObject);
    69     procedure ClearValues;
    70     procedure WriteValues;
    71     procedure SetNewValue(datatype: Word; offset: LongWord; Value: String);
    72     procedure listMouseDown(Sender: TObject; Button: TMouseButton;
    73       Shift: TShiftState; X, Y: Integer);
    7457  private
    7558    fileid:     LongWord;
     
    8366
    8467implementation
    85 
    8668{$R *.dfm}
    87 
    8869uses Main, Helper_ValueEdit;
    8970
    90 
    91 
     71procedure TForm_RawEdit.NewFile(fileinfo: TFileInfo);
     72var
     73  offsets: TRawList;
     74  i: Integer;
     75begin
     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);
     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;
     93end;
    9294
    9395procedure TForm_RawEdit.LoadRaw(raw_info: TRawInfo);
     
    9597  i:    LongWord;
    9698  Data: Tdata;
    97   mem:  TMemoryStream;
    9899begin
    99100  if hex.Modified then
     
    106107  if list_offset.Count = 0 then
    107108  begin
    108     for i := 0 to list.Count - 1 do
    109     begin
    110       if OniDataConnection.ExtractFileID(list.Items.Strings[i]) = raw_info.src_id then
    111       begin
    112         list.ItemIndex := i;
     109    for i := 0 to filelist.Count - 1 do
     110    begin
     111      if OniDataConnection.ExtractFileID(filelist.Items.Strings[i]) = raw_info.src_id then
     112      begin
     113        filelist.ItemIndex := i;
    113114        listClick(Self);
    114115        Break;
     
    150151
    151152
    152 procedure TForm_RawEdit.Recreatelist;
    153 var
    154   i:     LongWord;
    155   exts:  TStringArray;
    156   Count: LongWord;
    157 begin
    158   combo_extension.Items.Clear;
    159   combo_extension.Items.Add('_All files_ ('{+IntToStr(dat_header.Files)} + ')');
    160   exts := OniDataConnection.GetExtensionsList;
    161   for i := 0 to High(RawListHandlers) do
    162   begin
    163     Count := Length(OniDataConnection.GetFilesList(RawListHandlers[i].Ext, '', True));
    164     combo_extension.Items.Add(RawListHandlers[i].ext + ' (' + IntToStr(Count) + ')');
    165   end;
    166   //    FOR i:=0 TO High(exts) DO
    167   //      combo_extension.Items.Add(exts[i]);
    168   combo_extension.ItemIndex := 0;
    169   combo_extensionClick(Self);
    170 end;
    171 
    172 
    173 
    174 
    175 procedure TForm_RawEdit.LoadFileNames;
    176 var
    177   Extension: String;
    178   no_zero_bytes: Boolean;
    179   pattern: String;
    180   files: TStringArray;
    181   i: LongWord;
    182 begin
    183   Extension := MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex], 1, 4);
    184   pattern   := '';
    185   if check_filtername.Checked then
    186     pattern := edit_filtername.Text;
    187   if Extension = '_All' then
    188   begin
    189     Extension := '';
    190     for i := 0 to High(RawListHandlers) do
    191     begin
    192       if Length(Extension) > 0 then
    193         Extension := Extension + ',';
    194       Extension := Extension + RawListHandlers[i].Ext;
    195     end;
    196   end;
    197 
    198   files := OniDataConnection.GetFilesList(extension, pattern, True);
    199   list.Items.Clear;
    200   if Length(files) > 0 then
    201     for i := 0 to High(files) do
    202       list.Items.Add(files[i]);
    203   list_offset.Items.Clear;
    204 end;
    205 
    206 
    207 
    208 
    209 procedure TForm_RawEdit.panel_extensionResize(Sender: TObject);
    210 begin
    211   combo_extension.Width := panel_extension.Width - 5;
    212   edit_filtername.Width := panel_extension.Width - 5;
    213 end;
    214 
    215 
    216 
    217 
    218 procedure TForm_RawEdit.combo_extensionClick(Sender: TObject);
    219 begin
    220   LoadFileNames;
    221 end;
    222 
    223 
    224 
    225 
    226 procedure TForm_RawEdit.check_filternameClick(Sender: TObject);
    227 begin
    228   edit_filtername.Enabled := not check_filtername.Checked;
    229   LoadFileNames;
    230 end;
    231 
    232 
    233 
    234 
    235 procedure TForm_RawEdit.listClick(Sender: TObject);
    236 var
    237   mem:  TMemoryStream;
    238   Data: Tdata;
    239   i:    LongWord;
    240   offsets: TRawList;
    241 begin
    242   if hex.Modified then
    243   begin
    244     if not Save then
    245     begin
    246       Exit;
    247     end;
    248   end;
    249   ClearValues;
    250   hex.DataSize := 0;
    251   fileid := OniDataConnection.ExtractFileID(list.Items.Strings[list.ItemIndex]);
    252   list_offset.Enabled := True;
    253   if OniDataConnection.GetFileInfo(fileid).size > 0 then
    254   begin
    255     offsets := OniDataConnection.GetRawList(fileid);
    256     list_offset.Items.Clear;
    257     if Length(offsets) > 0 then
    258     begin
    259       for i := 0 to High(offsets) do
    260       begin
    261         list_offset.Items.Add('0x' + IntToHex(offsets[i].src_offset, 8) +
    262           ', ' + IntToStr(offsets[i].raw_size) + ' bytes');
    263       end;
    264     end
    265     else
    266     begin
    267       list_offset.Enabled := False;
    268     end;
    269   end
    270   else
    271   begin
    272     list_offset.Enabled := False;
    273   end;
    274 end;
    275 
    276 
    277 
    278 
    279 procedure TForm_RawEdit.listMouseDown(Sender: TObject; Button: TMouseButton;
    280   Shift: TShiftState; X, Y: Integer);
    281 var
    282   pt: TPoint;
    283 begin
    284   pt.X := x;
    285   pt.Y := y;
    286   list.ItemIndex := list.ItemAtPos(pt, true);
    287   if list.ItemIndex > -1 then
    288     Self.listClick(Self);
    289 end;
     153
    290154
    291155procedure TForm_RawEdit.list_offsetClick(Sender: TObject);
     
    500364
    501365procedure TForm_RawEdit.FormCreate(Sender: TObject);
    502 begin
     366var
     367  i:     LongWord;
     368  exts: String;
     369begin
     370  inherited;
     371  Self.OnNewFileSelected := Self.NewFile;
     372
     373  exts := '';
     374  if Length(RawListHandlers) > 0 then
     375  begin
     376    for i := 0 to High(RawListHandlers) do
     377      if Length(exts) > 0 then
     378        exts := exts + ',' + RawListHandlers[i].Ext
     379      else
     380        exts := RawListHandlers[i].Ext;
     381  end;
     382  Self.AllowedExts := exts;
     383
    503384  Self.Caption := '';
    504385  fileid     := 0;
     
    516397  value_viewer.Cells[0, 7] := 'Selected length';
    517398  value_viewer.ColWidths[0] := 100;
    518   hex.Height := panel_data.Height - 190;
    519   Self.panel_dataResize(Self);
    520399  //
    521400  value_viewer.Font.Charset := AppSettings.CharSet;
     
    574453
    575454
    576 procedure TForm_RawEdit.FormResize(Sender: TObject);
    577 begin
    578   if Self.Width >= 650 then
    579   begin
    580   end
    581   else
    582     Self.Width := 650;
    583   if Self.Height >= 450 then
    584   begin
    585   end
    586   else
    587     Self.Height := 450;
    588 end;
    589 
    590 
    591 
    592 
    593 procedure TForm_RawEdit.panel_dataResize(Sender: TObject);
     455procedure TForm_RawEdit.panel_contentResize(Sender: TObject);
    594456begin
    595457  value_viewer.ColWidths[1] := value_viewer.Width - value_viewer.ColWidths[0] - 28;
     
    674536
    675537
    676 procedure TForm_RawEdit.FormClose(Sender: TObject; var Action: TCloseAction);
    677 begin
    678   Action := caFree;
    679 end;
    680 
    681 
    682 
    683 
    684 procedure TForm_RawEdit.panel_imexportResize(Sender: TObject);
    685 begin
    686   btn_import.Width := panel_imexport.Width - 8;
    687   btn_export.Width := panel_imexport.Width - 8;
    688 end;
    689 
    690 
    691 
    692538
    693539procedure TForm_RawEdit.btn_exportClick(Sender: TObject);
     
    966812end;
    967813
     814begin
     815  AddToolListEntry('rawedit', 'Binary .raw-Editor', '');
    968816end.
  • oup/current/Tool_TxmpReplace.dfm

    r43 r45  
    1 object Form_TxmpReplace: TForm_TxmpReplace
    2   Left = 0
    3   Top = 0
    4   BorderStyle = bsSingle
    5   Caption = 'TXMP Replacer'
    6   ClientHeight = 428
    7   ClientWidth = 394
    8   Color = clBtnFace
    9   Font.Charset = DEFAULT_CHARSET
    10   Font.Color = clWindowText
    11   Font.Height = -11
    12   Font.Name = 'Tahoma'
    13   Font.Style = []
    14   FormStyle = fsMDIChild
    15   OldCreateOrder = False
    16   Visible = True
    17   WindowState = wsMaximized
     1inherited Form_TxmpReplace: TForm_TxmpReplace
     2  Caption = 'TxmpReplace'
    183  OnClose = FormClose
    194  OnCreate = FormCreate
     5  ExplicitWidth = 320
     6  ExplicitHeight = 240
    207  PixelsPerInch = 96
    218  TextHeight = 13
    22   object panel_12: TPanel
    23     Left = 0
    24     Top = 0
    25     Width = 394
    26     Height = 349
    27     Align = alClient
    28     BevelOuter = bvNone
    29     TabOrder = 0
    30     object Splitter1: TSplitter
    31       Left = 280
    32       Top = 0
    33       Width = 8
    34       Height = 349
     9  inherited Splitter1: TSplitter
     10    Height = 344
     11    ExplicitHeight = 344
     12  end
     13  inherited panel_files: TPanel
     14    Height = 344
     15    ExplicitHeight = 344
     16    object image_txmppreview: TImage [0]
     17      Left = 0
     18      Top = 257
     19      Width = 200
     20      Height = 57
     21      Align = alClient
     22      ExplicitTop = 111
     23      ExplicitHeight = 211
     24    end
     25    object splitter_txmp: TSplitter [1]
     26      Left = 0
     27      Top = 249
     28      Width = 200
     29      Height = 8
     30      Cursor = crVSplit
     31      Align = alTop
    3532      AutoSnap = False
    3633      Beveled = True
    37       MinSize = 150
    38       ExplicitLeft = 200
     34      MinSize = 60
     35      ExplicitLeft = -6
     36      ExplicitTop = 314
    3937    end
    40     object group_txmpselect: TGroupBox
     38    inherited filelist: TListBox
     39      Height = 146
     40      Align = alTop
     41      ExplicitHeight = 146
     42    end
     43    inherited panel_extension: TPanel
     44      Visible = False
     45    end
     46    object panel_txmppreview: TPanel
     47      Left = 0
     48      Top = 314
     49      Width = 200
     50      Height = 30
     51      Align = alBottom
     52      BevelOuter = bvNone
     53      TabOrder = 2
     54      object btn_save: TButton
     55        Left = 2
     56        Top = 2
     57        Width = 111
     58        Height = 25
     59        Caption = 'Save TXMP-Picture'
     60        TabOrder = 0
     61        OnClick = btn_saveClick
     62      end
     63    end
     64  end
     65  inherited content: TPanel
     66    Height = 344
     67    ExplicitHeight = 344
     68    object group_bmpselect: TGroupBox
    4169      Left = 0
    4270      Top = 0
    43       Width = 280
    44       Height = 349
    45       Align = alLeft
    46       Caption = '1. Select TXMP to replace'
    47       TabOrder = 0
    48       object splitter_txmp: TSplitter
    49         Left = 2
    50         Top = 190
    51         Width = 276
    52         Height = 8
    53         Cursor = crVSplit
    54         Align = alTop
    55         AutoSnap = False
    56         Beveled = True
    57         MinSize = 60
    58         ExplicitWidth = 196
    59       end
    60       object image_txmppreview: TImage
    61         Left = 2
    62         Top = 198
    63         Width = 276
    64         Height = 119
    65         Align = alClient
    66         ExplicitWidth = 196
    67       end
    68       object list_txmp: TListBox
    69         Left = 2
    70         Top = 15
    71         Width = 276
    72         Height = 175
    73         Align = alTop
    74         ItemHeight = 13
    75         TabOrder = 0
    76         OnClick = list_txmpClick
    77         OnMouseDown = list_txmpMouseDown
    78       end
    79       object panel_txmppreview: TPanel
    80         Left = 2
    81         Top = 317
    82         Width = 276
    83         Height = 30
    84         Align = alBottom
    85         BevelOuter = bvNone
    86         TabOrder = 1
    87         object btn_save: TButton
    88           Left = 2
    89           Top = 2
    90           Width = 111
    91           Height = 25
    92           Caption = 'Save TXMP-Picture'
    93           TabOrder = 0
    94           OnClick = btn_saveClick
    95         end
    96       end
    97     end
    98     object group_bmpselect: TGroupBox
    99       Left = 288
    100       Top = 0
    101       Width = 106
    102       Height = 349
     71      Width = 283
     72      Height = 344
    10373      Align = alClient
    10474      Caption = '2. Open BMP to replace with'
    10575      Enabled = False
    106       TabOrder = 1
     76      TabOrder = 0
    10777      object image_bmppreview: TImage
    10878        Left = 2
    10979        Top = 45
    110         Width = 102
    111         Height = 302
     80        Width = 279
     81        Height = 297
    11282        Align = alClient
    11383        ExplicitWidth = 182
     84        ExplicitHeight = 302
    11485      end
    11586      object panel_load: TPanel
    11687        Left = 2
    11788        Top = 15
    118         Width = 102
     89        Width = 279
    11990        Height = 30
    12091        Align = alTop
     
    133104    end
    134105  end
    135   object group_options: TGroupBox
     106  object group_options: TGroupBox [3]
    136107    Left = 0
    137     Top = 349
    138     Width = 394
     108    Top = 344
     109    Width = 492
    139110    Height = 79
    140111    Align = alBottom
    141112    Caption = '3. Options && Replace'
    142113    Enabled = False
    143     TabOrder = 1
     114    TabOrder = 2
    144115    object btn_replace: TButton
    145116      Left = 4
     
    168139    end
    169140  end
    170   object opend: TOpenDialog
     141  object opend: TOpenDialog [4]
    171142    Filter = '24bit Bitmap (*.bmp)|*.bmp'
    172143    Options = [ofPathMustExist, ofFileMustExist, ofEnableSizing]
     
    174145    Top = 16
    175146  end
    176   object saved: TSaveDialog
     147  object saved: TSaveDialog [5]
    177148    DefaultExt = 'bmp'
    178149    Filter = 'Windows Bitmap (*.bmp)|*.bmp'
  • oup/current/Tool_TxmpReplace.pas

    r43 r45  
    11unit Tool_TxmpReplace;
    2 
    32interface
    4 
    53uses
    64  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    7   Dialogs, ExtCtrls, StdCtrls, StrUtils, Code_Functions, Data, Code_OniImgClass;
     5  Dialogs, Tool_Template, StdCtrls, ExtCtrls,
     6  Code_Functions, Data, Code_OniImgClass, Menus;
    87
    98type
    10   TForm_TxmpReplace = class(TForm)
    11     panel_12: TPanel;
    12     group_txmpselect: TGroupBox;
    13     splitter_txmp: TSplitter;
    14     list_txmp: TListBox;
    15     Splitter1: TSplitter;
    16     group_bmpselect: TGroupBox;
    17     panel_load: TPanel;
    18     btn_load: TButton;
    19     image_bmppreview: TImage;
    20     opend:    TOpenDialog;
     9  TForm_TxmpReplace = class(TForm_ToolTemplate)
    2110    group_options: TGroupBox;
    2211    btn_replace: TButton;
     
    2615    btn_save: TButton;
    2716    image_txmppreview: TImage;
    28     saved:    TSaveDialog;
     17    splitter_txmp: TSplitter;
     18    group_bmpselect: TGroupBox;
     19    image_bmppreview: TImage;
     20    panel_load: TPanel;
     21    btn_load: TButton;
     22    opend: TOpenDialog;
     23    saved: TSaveDialog;
     24    procedure SelectFile(fileinfo: TFileInfo);
    2925    procedure FormCreate(Sender: TObject);
     26    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    3027    procedure btn_saveClick(Sender: TObject);
    31     procedure FormClose(Sender: TObject; var Action: TCloseAction);
     28    procedure btn_loadClick(Sender: TObject);
    3229    procedure btn_replaceClick(Sender: TObject);
    33     procedure btn_loadClick(Sender: TObject);
    34     procedure list_txmpClick(Sender: TObject);
    35     procedure Recreatelist;
    36     procedure list_txmpMouseDown(Sender: TObject; Button: TMouseButton;
    37       Shift: TShiftState; X, Y: Integer);
    3830  private
    3931    OniImage_Old: TOniImage;
    4032    OniImage_New: TOniImage;
     33    fileid: Integer;
    4134  public
    4235  end;
     
    4639
    4740implementation
    48 
     41{$R *.dfm}
    4942uses Main, Code_OniDataClass;
    5043
    51 {$R *.dfm}
    52 
    53 
    54 
    55 procedure TForm_TxmpReplace.Recreatelist;
    56 var
    57   files: TStringArray;
    58   i:     LongWord;
    59 begin
    60   list_txmp.Items.Clear;
    61   files := OniDataConnection.GetFilesList('TXMP', '', True);
    62   if Length(files) > 0 then
    63     for i := 0 to High(files) do
    64       list_txmp.Items.Add(files[i]);
    65   group_bmpselect.Enabled := False;
    66   check_transparency.Checked := False;
    67   check_fading.Checked := False;
    68 end;
    69 
    70 
    71 
    72 
    73 procedure TForm_TxmpReplace.list_txmpClick(Sender: TObject);
    74 var
    75   id:   LongWord;
     44
     45
     46procedure TForm_TxmpReplace.SelectFile(fileinfo: TFileInfo);
     47var
    7648  Data: Tdata;
    7749  mem:  TMemoryStream;
    7850  fadingbyte, depthbyte, storebyte: Byte;
    7951begin
    80   id := OniDataConnection.ExtractFileID(list_txmp.Items.Strings[list_txmp.ItemIndex]);
    81   OniDataConnection.LoadDatFilePart(id, $88, SizeOf(fadingbyte), @fadingbyte);
    82   OniDataConnection.LoadDatFilePart(id, $89, SizeOf(depthbyte), @depthbyte);
    83   OniDataConnection.LoadDatFilePart(id, $90, SizeOf(storebyte), @storebyte);
     52  fileid := fileinfo.ID;
     53  OniDataConnection.LoadDatFilePart(fileid, $88, SizeOf(fadingbyte), @fadingbyte);
     54  OniDataConnection.LoadDatFilePart(fileid, $89, SizeOf(depthbyte), @depthbyte);
     55  OniDataConnection.LoadDatFilePart(fileid, $90, SizeOf(storebyte), @storebyte);
    8456  check_fading.Checked := (fadingbyte and $01) > 0;
    8557  check_transparency.Checked := (depthbyte and $04) > 0;
    8658
    87   OniImage_Old.LoadFromTXMP(id);
     59  OniImage_Old.LoadFromTXMP(fileid);
    8860  Data := OniImage_Old.GetAsBMP;
    8961  mem  := TMemoryStream.Create;
     
    9668end;
    9769
    98 
    99 
    100 
    101 procedure TForm_TxmpReplace.list_txmpMouseDown(Sender: TObject;
    102   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    103 var
    104   pt: TPoint;
    105 begin
    106   pt.X := x;
    107   pt.Y := y;
    108   list_txmp.ItemIndex := list_txmp.ItemAtPos(pt, true);
    109   if list_txmp.ItemIndex > -1 then
    110     Self.list_txmpClick(Self);
    111 end;
    11270
    11371procedure TForm_TxmpReplace.btn_loadClick(Sender: TObject);
     
    13492procedure TForm_TxmpReplace.btn_replaceClick(Sender: TObject);
    13593var
    136   id: LongWord;
    137 
    13894  oldsize, newsize: LongWord;
    13995  old_rawaddr, new_rawaddr: LongWord;
     
    14399  datbyte: Word;
    144100begin
    145   if list_txmp.ItemIndex >= 0 then
     101  if filelist.ItemIndex >= 0 then
    146102  begin
    147     id := OniDataConnection.ExtractFileID(list_txmp.Items.Strings[list_txmp.ItemIndex]);
    148     OniDataConnection.LoadDatFilePart(id, $88, 1, @oldfading);
     103    OniDataConnection.LoadDatFilePart(fileid, $88, 1, @oldfading);
    149104    if OniDataConnection.OSisMac then
    150       OniDataConnection.UpdateDatFilePart(id, $A0, 4, @old_rawaddr)
     105      OniDataConnection.UpdateDatFilePart(fileid, $A0, 4, @old_rawaddr)
    151106    else
    152       OniDataConnection.LoadDatFilePart(id, $9C, 4, @old_rawaddr);
     107      OniDataConnection.LoadDatFilePart(fileid, $9C, 4, @old_rawaddr);
    153108
    154109    if (OniImage_Old.Width <> OniImage_New.Width) or
     
    161116        IntToStr(OniImage_New.Width) + 'x' + IntToStr(OniImage_New.Height) + ')' + CrLf +
    162117        'Replace anyways?'),
    163         PChar(list_txmp.Items.Strings[list_txmp.ItemIndex]),
     118        PChar(filelist.Items.Strings[filelist.ItemIndex]),
    164119        MB_YESNO) = idNo then
    165120        Exit;
     
    190145    begin
    191146      new_rawaddr := old_rawaddr;
    192       OniDataConnection.UpdateRawFile(id, $9C, Length(tempd), tempd);
     147      OniDataConnection.UpdateRawFile(fileid, $9C, Length(tempd), tempd);
    193148    end;
    194149
     
    196151    if check_fading.Checked then
    197152      datbyte := datbyte or $01;
    198     OniDataConnection.UpdateDatFilePart(id, $88, 1, @datbyte);
     153    OniDataConnection.UpdateDatFilePart(fileid, $88, 1, @datbyte);
    199154    datbyte := $10;
    200155    if check_transparency.Checked then
    201156      datbyte := datbyte or $04;
    202     OniDataConnection.UpdateDatFilePart(id, $89, 1, @datbyte);
    203     OniDataConnection.UpdateDatFilePart(id, $8C, 2, @OniImage_New.Width);
    204     OniDataConnection.UpdateDatFilePart(id, $8E, 2, @OniImage_New.Height);
     157    OniDataConnection.UpdateDatFilePart(fileid, $89, 1, @datbyte);
     158    OniDataConnection.UpdateDatFilePart(fileid, $8C, 2, @OniImage_New.Width);
     159    OniDataConnection.UpdateDatFilePart(fileid, $8E, 2, @OniImage_New.Height);
    205160    datbyte := $08;
    206     OniDataConnection.UpdateDatFilePart(id, $90, 1, @datbyte);
     161    OniDataConnection.UpdateDatFilePart(fileid, $90, 1, @datbyte);
    207162    if OniDataConnection.OSisMac then
    208       OniDataConnection.UpdateDatFilePart(id, $A0, 4, @new_rawaddr)
     163      OniDataConnection.UpdateDatFilePart(fileid, $A0, 4, @new_rawaddr)
    209164    else
    210       OniDataConnection.UpdateDatFilePart(id, $9C, 4, @new_rawaddr);
     165      OniDataConnection.UpdateDatFilePart(fileid, $9C, 4, @new_rawaddr);
    211166
    212167    ShowMessage('TXMP-image replaced');
     
    221176  OniImage_Old.Free;
    222177  OniImage_New.Free;
    223   Action := caFree;
     178  inherited;
    224179end;
    225180
     
    229184procedure TForm_TxmpReplace.FormCreate(Sender: TObject);
    230185begin
     186  inherited;
    231187  OniImage_Old := TOniImage.Create;
    232188  OniImage_New := TOniImage.Create;
     189  Self.AllowedExts := 'TXMP';
     190  Self.OnNewFileSelected := SelectFile;
    233191end;
    234192
     
    242200end;
    243201
     202begin
     203  AddToolListEntry('txmpreplace', 'TXMP Replacer', 'TXMP');
    244204end.
  • oup/current/todo.txt

    r10 r45  
    1 -Types+Idents nicht in DB sondern Hardcoded, mit IDs für StructViewer
    2 -StructViewer: statt 12 für dat-links, neuer bereich für typed-dat-links
    3 
    4 
    5 -DB mit MAC-Files (andre offsets in dat für raw-links ...)
    6 -Faded repacking TXMP (???)
    71-DatLinks patchen
    82-Non32bit MipMapping (???)
     
    2216-Links: Wenn level0 dann OUP mit level0 laden?
    2317
     18-History:Geyser:14.04.06 15:11:45, 16.04.06 15:21:29
    2419-Patching: History Geyser 2006-04-30 - 04:07:00
    2520
    2621-Exports: FileExists => Abfrage
     22-Export etc: If dest-file exists zZt anhängen, stattdessen neuschreiben?!
     23-Export: dat+raw eines Files in eine datei
    2724
    2825-TOniImage: Statt Floor (bei farben) Round
     
    3229-DatEdit: Komplette .dat im Hex + Treeview der verschiedenen Parts etc
    3330
    34 -FileLists: Sort By ID, Name, Extension ...
    35 
    36 -Class für TForm mit FileList etc? (Form1_CreateContext mit dieser baseclass?)
    37 
    38 -FileNames: Form_***, Unit_***
    39 
    4031-Signed vs Unsigned
    4132
    4233-PNG statt/zusätzlich zu BMP
    4334
    44 -Noob-protection in Settings (Hex-Editing deaktiviert)
    4535-AppSettings: Erst initialisieren mit defaults, dann .ini lesen
    4636
    4737-Exporters (-> TOniImage etc)
    48 
    49 -Option: show files without first 8 bytes. special-struct-def-loading (substract 8 from every entry's offset)
    50 
    51 -Open über ein Menüpunkt: Decide upon Extension
    5238
    5339-Wiki etc: Links für benutzte Componenten
     
    5541-ProgHelp
    5642-Localization (eg: http://dybdahl.dk/dxgettext/)
    57 
    58 -Close File/DB: Menu geht nach rechts
     43-About
    5944
    6045-StructViewer: Strings bis 0x00, BitSets besser darstellen? (SSG: 18.04.06/10:52:58),
     
    7055-Dateityp-Name anzeigen (SUBT -> Subtitles etc)
    7156
    72 -DatOpen: Erst Childs schließen, dann OpenDialog, dnan alte .dat schließen?
    73 
    7457-IGSt: Bei DEAD: OUP hangs (ValueViewer:String?)
    75 
    76 -History:Geyser:14.04.06 15:11:45, 16.04.06 15:21:29
    7758
    7859-Bug bei SetNewValue mit String
     
    8061-Preview PSpc (!!!)
    8162-Preview: Models? 3D-Data?
    82 
    83 -Export etc: If dest-file exists zZt anhängen, stattdessen neuschreiben?!
    84 -Export: dat+raw eines Files in eine datei
    8563
    8664-Get files die bestimmten content haben (string etc)
     
    9270
    9371-Exporter: Checkboxes für was man im einzelnen will (zb Checkbox "in eine Datei ja/nein")
    94 
    95 -HELP
     72-Extrahier-Ordner-Option (mit Platzhalter für .dat-Name)
     73-Extractor: Wohin?
    9674
    9775-Hex: Paste
    98 
    99 -Datei von einem Tool in andrem Tool öffnen
    100 
    10176
    10277-Persist.dat editor
    10378
    10479
     80
    10581-SELECT [src_id],MIN(datfiles.[name]),SUM(rawmap.[size]) FROM rawmap INNER  JOIN datfiles ON datfiles.[id]=[src_id] GROUP BY [src_id] ORDER BY [src_id] ASC
    10682
    107 -Extrahier-Ordner-Option (mit Platzhalter für .dat-Name)
    108 
    109 -About
    11083
    11184-BinEdit: Zusatzfunktionen wie: Suche,
    112 -BinEdit: Bild/Menu/Button irgendwas zum speichern
    113 
    114 -Extractor: Wohin?
    11585
    11686-FileCompare: Ergebnis=Tabelle, jede Zeile eine differenz-addresse, spalten = werte an addr. für compared files
     
    12292-Löschen einer Datei auf die gelinkt wird: Liste der Links und sicherheitsfrage
    12393
    124 -Filebox-Context: Extract etc
    125 
    12694-STRG+C auf Dateilisten etc für kopieren des Namens
    12795
Note: See TracChangeset for help on using the changeset viewer.