Index: oup/current/FileClasses/TXMP.pas
===================================================================
--- oup/current/FileClasses/TXMP.pas	(revision 231)
+++ oup/current/FileClasses/TXMP.pas	(revision 232)
@@ -10,4 +10,5 @@
     public
       procedure InitDataFields; override;
+      procedure InitEditor; override;
   end;
 
@@ -15,5 +16,6 @@
 
 uses
-  ConnectionManager, Math, Classes, TypeDefs, _DataTypes;
+  ConnectionManager, Math, Classes, TypeDefs, _DataTypes, ExtCtrls, StdCtrls, 
+  Controls, Forms;
 
 { TFile_TXMP }
@@ -106,4 +108,32 @@
 
 
+procedure TFile_TXMP.InitEditor;
+var
+  group: TGroupBox;
+  splitter: TSplitter;
+begin
+  inherited;
+  FEditor := TFrame.Create(nil);
+  group := TGroupBox.Create(FEditor);
+  group.Align := alTop;
+  group.Height := 150;
+  group.Caption := '1. ';
+  group.Parent := FEditor;
+
+  splitter := TSplitter.Create(FEditor);
+  splitter.Align := alTop;
+  splitter.Top := group.Height + 10;
+  splitter.AutoSnap := False;
+  splitter.MinSize := 100;
+  splitter.Beveled := True;
+  splitter.Height := 8;
+  splitter.Parent := FEditor;
+
+  group := TGroupBox.Create(FEditor);
+  group.Align := alClient;
+  group.Caption := '2. ';
+  group.Parent := FEditor;
+end;
+
 end.
 
Index: oup/current/FileClasses/_FileTypes.pas
===================================================================
--- oup/current/FileClasses/_FileTypes.pas	(revision 231)
+++ oup/current/FileClasses/_FileTypes.pas	(revision 232)
@@ -34,4 +34,5 @@
       function GetRawPartByIndex(ID: Integer): TRawDataInfo;
       function GetChildCount: Integer;
+      function GetRawCount: Integer;
     public
       constructor Create(ConnectionID, FileID: Integer); virtual;
@@ -58,4 +59,5 @@
       property FieldByIndex[ID: Integer]: TDataField read GetFieldByIndex;
 
+      property RawCount: Integer read GetRawCount;
       property RawPartByOffset[Offset: Integer]: TRawDataInfo read GetRawPartByOffset;
       property RawPartByIndex[ID: Integer]: TRawDataInfo read GetRawPartByIndex;
@@ -177,8 +179,36 @@
 end;
 
+function TFile.GetRawCount: Integer;
+var
+  i: Integer;
+begin
+  Result := Length(FRawParts);
+  if Result > 0 then
+  begin
+    Result := 0;
+    for i := 0 to High(FRawParts) do
+      if FRawParts[i].RawSize > 0 then
+        Inc(Result);
+  end;
+end;
+
 function TFile.GetRawPartByIndex(ID: Integer): TRawDataInfo;
-begin
-  if ID < Length(FRawParts) then
-    Result := FRawParts[ID]
+var
+  i: Integer;
+  valids: Integer;
+begin
+  if ID < GetRawCount then
+  begin
+    valids := 0;
+    i := 0;
+    repeat
+      if FRawParts[i].RawSize > 0 then
+      begin
+        Inc(valids);
+      end;
+      Inc(i);
+    until valids > ID;
+    Result := FRawParts[i - 1];
+  end
   else
     with Result do
Index: oup/current/Tools/MetaEditor.dfm
===================================================================
--- oup/current/Tools/MetaEditor.dfm	(revision 231)
+++ oup/current/Tools/MetaEditor.dfm	(revision 232)
@@ -1,8 +1,12 @@
 inherited Form_Meta: TForm_Meta
   Caption = 'Form_Meta'
+  ClientHeight = 449
   OnCreate = FormCreate
+  ExplicitWidth = 606
+  ExplicitHeight = 476
   PixelsPerInch = 96
   TextHeight = 13
   inherited panel_basecontent: TPanel
+    Height = 424
     ExplicitLeft = 0
     ExplicitTop = 25
@@ -10,19 +14,21 @@
     ExplicitHeight = 532
     object splitter: TSplitter
-      Left = 502
+      Left = 190
       Top = 0
       Width = 8
-      Height = 532
+      Height = 424
       Align = alRight
       AutoSnap = False
       Beveled = True
       MinSize = 200
-      ExplicitLeft = 353
+      ExplicitLeft = 287
+      ExplicitTop = 16
+      ExplicitHeight = 532
     end
     object VST: TVirtualStringTree
       Left = 0
       Top = 0
-      Width = 502
-      Height = 532
+      Width = 190
+      Height = 424
       Align = alClient
       AnimationDuration = 0
@@ -42,4 +48,6 @@
       OnPaintText = VSTPaintText
       OnInitChildren = VSTInitChildren
+      ExplicitWidth = 502
+      ExplicitHeight = 532
       Columns = <
         item
@@ -61,13 +69,213 @@
         end>
     end
-    object Panel2: TPanel
-      Left = 510
+    object rightPages: TPageControl
+      Left = 198
       Top = 0
-      Width = 88
-      Height = 532
+      Width = 400
+      Height = 424
+      ActivePage = tab_hex
       Align = alRight
-      BevelOuter = bvNone
-      Caption = 'Panel2'
       TabOrder = 1
+      object tab_meta: TTabSheet
+        Caption = 'Meta Edit'
+        ImageIndex = 1
+        ExplicitWidth = 192
+        ExplicitHeight = 504
+      end
+      object tab_hex: TTabSheet
+        Caption = 'Binary Edit'
+        ExplicitWidth = 192
+        ExplicitHeight = 504
+        object splitter_hex_1: TSplitter
+          Left = 0
+          Top = 100
+          Width = 392
+          Height = 8
+          Cursor = crVSplit
+          Align = alTop
+          AutoSnap = False
+          Beveled = True
+          MinSize = 40
+          ExplicitTop = 209
+          ExplicitWidth = 192
+        end
+        object splitter_hex_2: TSplitter
+          Left = 0
+          Top = 250
+          Width = 392
+          Height = 8
+          Cursor = crVSplit
+          Align = alBottom
+          AutoSnap = False
+          Beveled = True
+          MinSize = 40
+          ExplicitTop = 300
+          ExplicitWidth = 192
+        end
+        object panel_hex_actions: TPanel
+          Left = 0
+          Top = 355
+          Width = 392
+          Height = 41
+          Align = alBottom
+          BevelOuter = bvNone
+          Caption = 'panel_hex_actions'
+          TabOrder = 0
+          ExplicitLeft = 3
+          ExplicitTop = 354
+          ExplicitWidth = 192
+        end
+        object hex: TMPHexEditor
+          Left = 0
+          Top = 0
+          Width = 392
+          Height = 100
+          Cursor = crIBeam
+          Align = alTop
+          Font.Charset = DEFAULT_CHARSET
+          Font.Color = clWindowText
+          Font.Height = -16
+          Font.Name = 'Courier'
+          Font.Style = []
+          ParentFont = False
+          TabOrder = 1
+          BytesPerRow = 16
+          Translation = tkASCII
+          OffsetFormat = '6!10:0x|'
+          Colors.Background = clWindow
+          Colors.ChangedBackground = clWindow
+          Colors.ChangedText = clRed
+          Colors.CursorFrame = clNavy
+          Colors.Offset = clBlack
+          Colors.OddColumn = clBlue
+          Colors.EvenColumn = clNavy
+          Colors.CurrentOffsetBackground = clBtnShadow
+          Colors.OffsetBackground = clBtnFace
+          Colors.CurrentOffset = clBtnHighlight
+          Colors.Grid = clBtnFace
+          Colors.NonFocusCursorFrame = clAqua
+          Colors.ActiveFieldBackground = clWindow
+          FocusFrame = True
+          NoSizeChange = True
+          AllowInsertMode = False
+          DrawGridLines = False
+          Version = 'december 06, 2006; '#169' markus stephany, vcl[at]mirkes[dot]de'
+          ShowPositionIfNotFocused = True
+          ExplicitWidth = 192
+        end
+        object value_viewer: TWrapGrid
+          Left = 0
+          Top = 108
+          Width = 392
+          Height = 142
+          Align = alClient
+          ColCount = 1
+          DefaultColWidth = 80
+          DefaultRowHeight = 18
+          FixedCols = 0
+          RowCount = 8
+          FixedRows = 0
+          Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColSizing]
+          ScrollBars = ssVertical
+          TabOrder = 2
+          ExplicitTop = 363
+          ExplicitWidth = 192
+          ExplicitHeight = 0
+        end
+        object structviewer: TVirtualStringTree
+          Left = 0
+          Top = 258
+          Width = 392
+          Height = 97
+          Align = alBottom
+          AnimationDuration = 0
+          AutoExpandDelay = 300
+          BiDiMode = bdLeftToRight
+          Colors.UnfocusedSelectionColor = clGradientActiveCaption
+          Colors.UnfocusedSelectionBorderColor = clGradientActiveCaption
+          Ctl3D = True
+          DragOperations = []
+          DrawSelectionMode = smBlendedRectangle
+          EditDelay = 200
+          Font.Charset = DEFAULT_CHARSET
+          Font.Color = clWindowText
+          Font.Height = -11
+          Font.Name = 'Tahoma'
+          Font.Style = []
+          Header.AutoSizeIndex = 0
+          Header.Font.Charset = DEFAULT_CHARSET
+          Header.Font.Color = clWindowText
+          Header.Font.Height = -11
+          Header.Font.Name = 'Tahoma'
+          Header.Font.Style = []
+          Header.Options = [hoColumnResize, hoDblClickResize, hoDrag, hoVisible]
+          Header.Style = hsFlatButtons
+          HintAnimation = hatNone
+          HintMode = hmTooltip
+          Indent = 14
+          ParentBiDiMode = False
+          ParentCtl3D = False
+          ParentFont = False
+          ParentShowHint = False
+          ShowHint = True
+          TabOrder = 3
+          TreeOptions.MiscOptions = [toAcceptOLEDrop, toCheckSupport, toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
+          TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowHorzGridLines, toShowRoot, toShowTreeLines, toShowVertGridLines, toUseBlendedImages]
+          TreeOptions.SelectionOptions = [toExtendedFocus, toFullRowSelect, toRightClickSelect]
+          OnFocusChanged = VSTFocusChanged
+          OnGetText = VSTGetText
+          ExplicitLeft = -6
+          ExplicitTop = 161
+          ExplicitWidth = 192
+          Columns = <
+            item
+              MaxWidth = 300
+              MinWidth = 100
+              Options = [coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible]
+              Position = 0
+              Spacing = 20
+              Width = 150
+              WideText = 'Name'
+              WideHint = 'Name of the item.'
+            end
+            item
+              MaxWidth = 110
+              MinWidth = 80
+              Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible]
+              Position = 1
+              Spacing = 20
+              Width = 85
+              WideText = 'Offset'
+              WideHint = 'Offset of the data-item.'
+            end
+            item
+              MaxWidth = 110
+              MinWidth = 75
+              Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible]
+              Position = 2
+              Width = 75
+              WideText = 'Type'
+              WideHint = 'Data type of the item.'
+            end
+            item
+              MaxWidth = 250
+              MinWidth = 80
+              Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible]
+              Position = 3
+              Width = 100
+              WideText = 'Value'
+              WideHint = 'Value of the item.'
+            end
+            item
+              MaxWidth = 400
+              MinWidth = 80
+              Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible]
+              Position = 4
+              Width = 400
+              WideText = 'Description'
+            end>
+          WideDefaultText = ''
+        end
+      end
     end
   end
Index: oup/current/Tools/MetaEditor.pas
===================================================================
--- oup/current/Tools/MetaEditor.pas	(revision 231)
+++ oup/current/Tools/MetaEditor.pas	(revision 232)
@@ -5,11 +5,20 @@
 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
-  Dialogs, _BaseTemplate, ExtCtrls, VirtualTrees, StdCtrls;
+  Dialogs, _BaseTemplate, ExtCtrls, VirtualTrees, StdCtrls, ComCtrls, Grids,
+  MPHexEditor, Wrapgrid;
 
 type
   TForm_Meta = class(TForm_BaseTemplate)
     VST: TVirtualStringTree;
-    Panel2: TPanel;
     splitter: TSplitter;
+    rightPages: TPageControl;
+    tab_hex: TTabSheet;
+    tab_meta: TTabSheet;
+    panel_hex_actions: TPanel;
+    hex: TMPHexEditor;
+    splitter_hex_1: TSplitter;
+    value_viewer: TWrapGrid;
+    splitter_hex_2: TSplitter;
+    structviewer: TVirtualStringTree;
     procedure FormCreate(Sender: TObject);
     procedure VSTInitChildren(Sender: TBaseVirtualTree; Node: PVirtualNode;
@@ -34,5 +43,5 @@
 implementation
 {$R *.dfm}
-uses _MetaManager, _MetaTypes, ConnectionManager, Data;
+uses _MetaManager, _MetaTypes, ConnectionManager, Data, _FileTypes;
 
 type
@@ -61,19 +70,17 @@
   node: PVirtualNode;
   Meta: TMetaManager;
+  root: TExtensions;
 begin
   if ID >= 0 then
   begin
+    //VST
     VST.Clear;
     VST.BeginUpdate;
-    Meta := ConManager.Connection[ID].MetaData;
-    for i := 0 to Meta.FileCount - 1 do
-    begin
-      if Assigned(Meta.FileById[i]) then
-      begin
-        data.Field := Meta.FileById[i];
-        node := AddVSTEntry(VST, nil, data);
-        if Meta.FileById[i].ChildCount > 0 then
-          VST.HasChildren[node] := True;
-      end;
+    root := ConManager.Connection[FConnectionID].MetaData.Root;
+    for i := 0 to High(root) do
+    begin
+      data.Field := root[i];
+      node := AddVSTEntry(VST, nil, data);
+      VST.HasChildren[node] := True;
     end;
     VST.EndUpdate;
@@ -93,13 +100,40 @@
 begin
   data := Sender.GetNodeData(node);
-  Meta := ConManager.Connection[ID].MetaData;
-  for i := 0 to TFile(data.Field).ChildCount - 1 do
-  begin
-    id := TFile(data.Field).LinkByIndex[i].DestID;
-    Meta.InitFile(id);
-    newdata.Field := Meta.FileById[id];
-    newnode := AddVSTEntry(TCustomVirtualStringTree(Sender), Node, newdata);
-    if Meta.FileById[id].ChildCount > 0 then
-      Sender.HasChildren[newnode] := True;
+  Meta := ConManager.Connection[ConnectionID].MetaData;
+  if data.Field is TFile then
+  begin
+    if TFile(data.Field).ChildCount > 0 then
+    begin
+      for i := 0 to TFile(data.Field).ChildCount - 1 do
+      begin
+        id := TFile(data.Field).LinkByIndex[i].DestID;
+        Meta.InitFile(id);
+        newdata.Field := Meta.FileById[id];
+        newnode := AddVSTEntry(TCustomVirtualStringTree(Sender), Node, newdata);
+        if Meta.FileById[id].ChildCount > 0 then
+          Sender.HasChildren[newnode] := True;
+      end;
+    end;
+    if TFile(data.Field).RawCount > 0 then
+    begin
+      for i := 0 to TFile(data.Field).RawCount - 1 do
+      begin
+//        Exit;
+      end;
+    end;
+  end;
+  if data.Field is TExtension then
+  begin
+    if TExtension(data.Field).FileCount = 0 then
+      TExtension(data.Field).InitList;
+    for i := 0 to TExtension(data.Field).FileCount - 1 do
+    begin
+      id := TExtension(data.Field).Files[i];
+      Meta.InitFile(id);
+      newdata.Field := Meta.FileById[id];
+      newnode := AddVSTEntry(TCustomVirtualStringTree(Sender), Node, newdata);
+      if Meta.FileById[id].ChildCount > 0 then
+        Sender.HasChildren[newnode] := True;
+    end;
   end;
   ChildCount := Sender.ChildCount[Node];
@@ -118,5 +152,6 @@
     if Assigned(TFile(data.Field).Editor) then
     begin
-      panel2.InsertControl(TFile(data.Field).Editor);
+      TFile(data.Field).Editor.Align := alClient;
+      tab_meta.InsertControl(TFile(data.Field).Editor);
       TFile(data.Field).Opened := True;
     end;
@@ -148,7 +183,7 @@
       if TFile(data.Field).Opened then
       begin
-        if panel2.ControlCount > 0 then
-          for i := 0 to panel2.ControlCount - 1 do
-            panel2.RemoveControl(panel2.Controls[i]);
+        if tab_meta.ControlCount > 0 then
+          for i := 0 to tab_meta.ControlCount - 1 do
+            tab_meta.RemoveControl(tab_meta.Controls[i]);
         TFile(data.Field).Opened := False;
       end;
@@ -176,4 +211,6 @@
               CellText := 'Unnamed';
           end;
+          if Data.Field is TExtension then
+            CellText := TExtension(Data.Field).Ext;
         end;
       1:
Index: oup/current/Tools/TxmpReplace.dfm
===================================================================
--- oup/current/Tools/TxmpReplace.dfm	(revision 231)
+++ oup/current/Tools/TxmpReplace.dfm	(revision 232)
@@ -1,29 +1,29 @@
 inherited Form_TxmpReplace: TForm_TxmpReplace
   Caption = 'Form_TxmpReplace'
-  ClientHeight = 573
+  ClientHeight = 438
   OnCreate = FormCreate
-  ExplicitHeight = 600
+  ExplicitHeight = 465
   PixelsPerInch = 96
   TextHeight = 13
   inherited panel_basecontent: TPanel
-    Height = 548
+    Height = 413
+    ExplicitHeight = 548
     inherited splitter_content: TSplitter
-      Height = 548
+      Height = 413
       OnMoved = Splitter1Moved
+      ExplicitHeight = 548
     end
     inherited panel_files: TPanel
-      Height = 548
+      Height = 413
+      ExplicitHeight = 548
       inherited FilePages: TPageControl
-        Height = 547
+        Height = 412
         Constraints.MinHeight = 250
-        ExplicitHeight = 280
+        ExplicitHeight = 547
         inherited tab_files: TTabSheet
-          inherited panel_extension: TPanel
-            inherited edit_filtername: TEdit
-              ExplicitWidth = 189
-            end
-          end
+          ExplicitHeight = 467
           inherited filelist: TListBox
-            Height = 394
+            Height = 259
+            ExplicitHeight = 342
           end
         end
@@ -32,13 +32,18 @@
           ExplicitTop = 24
           ExplicitWidth = 190
-          ExplicitHeight = 424
+          ExplicitHeight = 519
+          inherited filelist_meta: TVirtualStringTree
+            Height = 384
+            ExplicitHeight = 519
+          end
         end
       end
     end
     inherited panel_content: TPanel
-      Height = 548
+      Height = 413
+      ExplicitHeight = 548
       object Splitter1: TSplitter
         Left = 0
-        Top = 220
+        Top = 200
         Width = 390
         Height = 8
@@ -53,5 +58,5 @@
       object group_options: TGroupBox
         Left = 0
-        Top = 469
+        Top = 334
         Width = 390
         Height = 79
@@ -60,6 +65,5 @@
         Enabled = False
         TabOrder = 0
-        ExplicitTop = 441
-        ExplicitWidth = 492
+        ExplicitTop = 469
         object btn_replace: TButton
           Left = 4
@@ -89,9 +93,9 @@
         end
       end
-      object GroupBox1: TGroupBox
+      object group_txmp: TGroupBox
         Left = 0
         Top = 0
         Width = 390
-        Height = 220
+        Height = 200
         Align = alTop
         Caption = '1. Select a TXMP to be replaced'
@@ -101,5 +105,5 @@
           Top = 15
           Width = 386
-          Height = 173
+          Height = 153
           Align = alClient
           ExplicitLeft = 0
@@ -110,5 +114,5 @@
         object panel_txmppreview: TPanel
           Left = 2
-          Top = 188
+          Top = 168
           Width = 386
           Height = 30
@@ -116,7 +120,5 @@
           BevelOuter = bvNone
           TabOrder = 0
-          ExplicitLeft = 0
-          ExplicitTop = 411
-          ExplicitWidth = 200
+          ExplicitTop = 188
           object btn_save: TButton
             Left = 2
@@ -132,14 +134,13 @@
       object group_bmpselect: TGroupBox
         Left = 0
-        Top = 228
+        Top = 208
         Width = 390
-        Height = 241
+        Height = 126
         Align = alClient
         Caption = '2. Open BMP to replace with'
         Enabled = False
         TabOrder = 2
-        ExplicitTop = 0
-        ExplicitWidth = 283
-        ExplicitHeight = 441
+        ExplicitLeft = -2
+        ExplicitTop = 206
         object image_bmppreview: TImage
           AlignWithMargins = True
@@ -147,5 +148,5 @@
           Top = 48
           Width = 380
-          Height = 188
+          Height = 73
           Align = alClient
           ExplicitLeft = 2
@@ -184,10 +185,10 @@
     Options = [ofOverwritePrompt, ofHideReadOnly, ofPathMustExist, ofEnableSizing]
     Left = 352
-    Top = 212
+    Top = 196
   end
   object opend: TOpenDialog
     Options = [ofPathMustExist, ofFileMustExist, ofEnableSizing]
     Left = 352
-    Top = 264
+    Top = 248
   end
 end
Index: oup/current/Tools/TxmpReplace.pas
===================================================================
--- oup/current/Tools/TxmpReplace.pas	(revision 231)
+++ oup/current/Tools/TxmpReplace.pas	(revision 232)
@@ -6,5 +6,5 @@
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, _TemplateFileList, Menus, StdCtrls, Buttons, ComCtrls, ExtCtrls,
-  OniImgClass, TypeDefs;
+  OniImgClass, TypeDefs, VirtualTrees;
 
 type
@@ -14,5 +14,5 @@
     check_transparency: TCheckBox;
     check_fading: TCheckBox;
-    GroupBox1: TGroupBox;
+    group_txmp: TGroupBox;
     Splitter1: TSplitter;
     group_bmpselect: TGroupBox;
