| 1 | 
   | 
 unit RawEdit; | 
 
 
 
 
 
 
 
 
 | 2 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 3 | 
   | 
 interface | 
 
 
 
 
 
 
 
 
 | 4 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 5 | 
   | 
 uses | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 6 | 
   | 
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | 
 
 
 
 
 
 
 
 
 
 
 
 | 7 | 
 < | 
   Dialogs, Template, StdCtrls, ExtCtrls, Menus, Grids, Wrapgrid, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 8 | 
 < | 
   MPHexEditor, Clipbrd, StrUtils, TypeDefs, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 7 | 
 < | 
   Data, Functions, DatStructureLoader, ConnectionManager, Buttons; | 
 
 
 
 
 
 
 
 
 
 | 7 | 
 > | 
   Dialogs, _TemplateFileList, Menus, StdCtrls, ExtCtrls, Buttons, ComCtrls, | 
 
 
 
 
 
 | 8 | 
 > | 
   TypeDefs, Grids, Wrapgrid, MPHexEditor; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 9 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 10 | 
   | 
 type | 
 
 
 
 
 
 
 
 
 
 
 
 | 11 | 
 < | 
   TForm_RawEdit = class(TForm_ToolTemplate) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 11 | 
 < | 
     Splitter4: TSplitter; | 
 
 
 
 
 
 
 
 
 
 | 11 | 
 > | 
   TForm_RawEdit = class(TForm_TemplateFileList) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 12 | 
   | 
     panel_imexport: TPanel; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 13 | 
   | 
     btn_export: TButton; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 14 | 
   | 
     btn_import: TButton; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 15 | 
   | 
     GroupBox1: TGroupBox; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 16 | 
   | 
     list_offset: TListBox; | 
 
 
 
 
 
 
 
 
 | 17 | 
 + | 
     Splitter4: TSplitter; | 
 
 
 
 
 
 
 
 
 | 18 | 
 + | 
     opend: TOpenDialog; | 
 
 
 
 
 
 
 
 
 | 19 | 
 + | 
     saved: TSaveDialog; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 20 | 
   | 
     hex: TMPHexEditor; | 
 
 
 
 
 
 
 
 
 
 | 18 | 
 – | 
     Splitter2: TSplitter; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 21 | 
   | 
     value_viewer: TWrapGrid; | 
 
 
 
 
 
 
 
 
 | 22 | 
 + | 
     Splitter2: TSplitter; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 23 | 
   | 
     value_viewer_context: TPopupMenu; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 24 | 
   | 
     value_viewer_context_copy: TMenuItem; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 25 | 
   | 
     value_viewer_context_copyasdec: TMenuItem; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 27 | 
   | 
     value_viewer_context_copyasbitset: TMenuItem; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 28 | 
   | 
     value_viewer_context_copyasstring: TMenuItem; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 29 | 
   | 
     value_viewer_context_copyashex: TMenuItem; | 
 
 
 
 
 
 
 
 
 
 | 27 | 
 – | 
     opend: TOpenDialog; | 
 
 
 
 
 
 
 
 
 
 | 28 | 
 – | 
     saved: TSaveDialog; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 30 | 
   | 
     procedure list_offsetClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 31 | 
   | 
     procedure NewFile(fileinfo: TFileInfo); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 32 | 
   | 
     procedure LoadRaw(raw_info: TRawDataInfo); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 39 | 
   | 
     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 40 | 
   | 
     procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 41 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 42 | 
 < | 
     function GetValue(datatype: Word; offset: LongWord): String; | 
 
 
 
 
 
 
 
 
 
 | 42 | 
 > | 
     function GetValue(datatype: Word; offset: Integer): String; | 
 
 
 
 
 
 
 
 
 
 
 
 | 43 | 
   | 
     procedure ClearValues; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 44 | 
   | 
     procedure WriteValues; | 
 
 
 
 
 
 
 
 
 
 
 
 | 45 | 
 < | 
     procedure SetNewValue(datatype: Word; offset: LongWord; Value: String); | 
 
 
 
 
 
 
 
 
 
 | 45 | 
 > | 
     procedure SetNewValue(datatype: Word; offset: Integer; Value: String); | 
 
 
 
 
 
 
 
 
 
 
 
 | 46 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 47 | 
   | 
     procedure value_viewerDblClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 48 | 
   | 
     procedure value_viewer_context_copyClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 54 | 
   | 
     procedure hexSelectionChanged(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 55 | 
   | 
     procedure hexChange(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 56 | 
   | 
   private | 
 
 
 
 
 
 
 
 
 
 
 
 | 57 | 
 < | 
     ConID, fileid, datoffset: Integer; | 
 
 
 
 
 
 
 
 
 
 | 57 | 
 > | 
     fileid, datoffset: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 58 | 
   | 
   public | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 59 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 60 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 60 | 
 – | 
 var | 
 
 
 
 
 
 
 
 
 
 | 61 | 
 – | 
   Form_RawEdit: TForm_RawEdit; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 61 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 62 | 
   | 
 implementation | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 63 | 
   | 
 {$R *.dfm} | 
 
 
 
 
 
 
 
 
 
 
 
 | 64 | 
 < | 
 uses Main, ValueEdit, RawList; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 64 | 
 > | 
 uses | 
 
 
 
 
 
 | 65 | 
 > | 
   _TemplateFile, ValueEdit, ConnectionManager, StrUtils, Functions, RawList, | 
 
 
 
 
 
 | 66 | 
 > | 
   Data, Clipbrd; | 
 
 
 
 
 
 
 
 
 
 
 
 | 67 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 68 | 
   | 
 procedure TForm_RawEdit.NewFile(fileinfo: TFileInfo); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 69 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 101 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 102 | 
   | 
 procedure TForm_RawEdit.LoadRaw(raw_info: TRawDataInfo); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 103 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 | 104 | 
 < | 
   i:    LongWord; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 104 | 
 < | 
   mem: TMemoryStream; | 
 
 
 
 
 
 
 
 
 
 | 104 | 
 > | 
   i:    Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 105 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 106 | 
   | 
   if hex.Modified then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 107 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 110 | 
   | 
       Exit; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 111 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 112 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 | 113 | 
 < | 
   if list_offset.Count = 0 then | 
 
 
 
 
 
 
 
 
 
 | 113 | 
 > | 
   for i := 0 to filelist.Count - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 | 114 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 115 | 
 < | 
     for i := 0 to filelist.Count - 1 do | 
 
 
 
 
 
 
 
 
 
 | 115 | 
 > | 
     if ConManager.Connection[ConnectionID].ExtractFileIDOfName(filelist.Items.Strings[i]) = Raw_Info.SrcID then | 
 
 
 
 
 
 
 
 
 
 
 
 | 116 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 117 | 
 < | 
       if ConManager.Connection[ConID].ExtractFileIDOfName(filelist.Items.Strings[i]) = Raw_Info.SrcID then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 118 | 
 < | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 119 | 
 < | 
         filelist.ItemIndex := i; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 120 | 
 < | 
         listClick(Self); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 121 | 
 < | 
         Break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 122 | 
 < | 
       end; | 
 
 
 
 
 
 
 
 
 
 | 117 | 
 > | 
       filelist.ItemIndex := i; | 
 
 
 
 
 
 | 118 | 
 > | 
       listClick(Self); | 
 
 
 
 
 
 | 119 | 
 > | 
       Break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 120 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 | 121 | 
 < | 
     for i := 0 to list_offset.Count - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 121 | 
 > | 
   end; | 
 
 
 
 
 
 | 122 | 
 > | 
   for i := 0 to list_offset.Count - 1 do | 
 
 
 
 
 
 | 123 | 
 > | 
   begin | 
 
 
 
 
 
 | 124 | 
 > | 
     if MidStr(list_offset.Items.Strings[i], 3, 8) = IntToHex(raw_info.SrcOffset, 8) then | 
 
 
 
 
 
 
 
 
 
 
 
 | 125 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 126 | 
 < | 
       if MidStr(list_offset.Items.Strings[i], 3, 8) = IntToHex(raw_info.SrcOffset, 8) then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 127 | 
 < | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 128 | 
 < | 
         list_offset.ItemIndex := i; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 129 | 
 < | 
         Break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 130 | 
 < | 
       end; | 
 
 
 
 
 
 
 
 
 
 | 126 | 
 > | 
       list_offset.ItemIndex := i; | 
 
 
 
 
 
 | 127 | 
 > | 
       list_offsetClick(Self); | 
 
 
 
 
 
 | 128 | 
 > | 
       Break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 129 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 130 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 | 133 | 
 – | 
   mem := nil; | 
 
 
 
 
 
 
 
 
 
 | 134 | 
 – | 
   ConManager.Connection[ConID].LoadRawFile(raw_info.SrcID, raw_info.SrcOffset, TStream(mem)); | 
 
 
 
 
 
 
 
 
 
 | 135 | 
 – | 
   hex.LoadFromStream(mem); | 
 
 
 
 
 
 
 
 
 
 | 136 | 
 – | 
   ClearValues; | 
 
 
 
 
 
 
 
 
 
 | 137 | 
 – | 
   hexSelectionChanged(Self); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 131 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 132 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 133 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 136 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 137 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 138 | 
   | 
 procedure TForm_RawEdit.list_offsetClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 | 139 | 
 + | 
 var | 
 
 
 
 
 
 
 
 
 | 140 | 
 + | 
   mem: TMemoryStream; | 
 
 
 
 
 
 
 
 
 | 141 | 
 + | 
   rawinfo: TRawDataInfo; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 142 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 | 147 | 
 – | 
   ClearValues; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 143 | 
   | 
   datoffset := StrToInt('$' + MidStr( | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 144 | 
   | 
     list_offset.Items.Strings[list_offset.ItemIndex], 3, 8)); | 
 
 
 
 
 
 
 
 
 
 
 
 | 145 | 
 < | 
   LoadRaw(ConManager.Connection[ConID].GetRawInfo(fileid, datoffset)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 145 | 
 > | 
  | 
 
 
 
 
 
 | 146 | 
 > | 
   rawinfo := ConManager.Connection[ConnectionID].GetRawInfo(fileid, datoffset); | 
 
 
 
 
 
 | 147 | 
 > | 
  | 
 
 
 
 
 
 | 148 | 
 > | 
   if rawinfo.RawSize > 0 then | 
 
 
 
 
 
 | 149 | 
 > | 
   begin | 
 
 
 
 
 
 | 150 | 
 > | 
     mem := nil; | 
 
 
 
 
 
 | 151 | 
 > | 
     ConManager.Connection[ConnectionID].LoadRawFile(rawinfo.SrcID, rawinfo.SrcOffset, TStream(mem)); | 
 
 
 
 
 
 | 152 | 
 > | 
     hex.LoadFromStream(mem); | 
 
 
 
 
 
 | 153 | 
 > | 
     ClearValues; | 
 
 
 
 
 
 | 154 | 
 > | 
     hexSelectionChanged(Self); | 
 
 
 
 
 
 | 155 | 
 > | 
   end | 
 
 
 
 
 
 | 156 | 
 > | 
   else | 
 
 
 
 
 
 | 157 | 
 > | 
   begin | 
 
 
 
 
 
 | 158 | 
 > | 
     hex.DataSize := 0; | 
 
 
 
 
 
 | 159 | 
 > | 
     ClearValues; | 
 
 
 
 
 
 | 160 | 
 > | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 | 161 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 162 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 163 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 164 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 165 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 166 | 
 < | 
 function TForm_RawEdit.GetValue(datatype: Word; offset: LongWord): String; | 
 
 
 
 
 
 
 
 
 
 | 166 | 
 > | 
 function TForm_RawEdit.GetValue(datatype: Word; offset: Integer): String; | 
 
 
 
 
 
 
 
 
 
 
 
 | 167 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 168 | 
   | 
   Data: TByteData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 169 | 
   | 
   i:    Word; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 237 | 
   | 
   i, j:  Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 238 | 
   | 
   Data:  TByteData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 239 | 
   | 
   str:   String; | 
 
 
 
 
 
 
 
 
 
 
 
 | 240 | 
 < | 
   Value: LongWord; | 
 
 
 
 
 
 
 
 
 
 | 240 | 
 > | 
   Value: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 241 | 
   | 
   floatformat: TFormatSettings; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 242 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 243 | 
   | 
   floatformat.DecimalSeparator := '.'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 320 | 
   | 
       str := ''; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 321 | 
   | 
       if hex.SelCount = 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 322 | 
   | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 323 | 
 < | 
         while (hex.Data[hex.SelStart + j] > 0) and ((hex.SelStart + j) < hex.DataSize) do | 
 
 
 
 
 
 
 
 
 
 | 323 | 
 > | 
         while (hex.SelStart + j) < hex.DataSize do | 
 
 
 
 
 
 
 
 
 
 
 
 | 324 | 
   | 
         begin | 
 
 
 
 
 
 
 
 
 | 325 | 
 + | 
           if hex.Data[hex.SelStart + j] = 0 then | 
 
 
 
 
 
 
 
 
 | 326 | 
 + | 
             Break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 327 | 
   | 
           if hex.Data[hex.selstart + j] >= 32 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 328 | 
   | 
             str := str + Char(hex.Data[hex.SelStart + j]) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 329 | 
   | 
           else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 351 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 352 | 
   | 
 procedure TForm_RawEdit.FormCreate(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 353 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 | 354 | 
 < | 
   i:     LongWord; | 
 
 
 
 
 
 
 
 
 
 | 354 | 
 > | 
   i:     Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 355 | 
   | 
   exts: String; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 356 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 357 | 
   | 
   inherited; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 399 | 
   | 
 function TForm_RawEdit.Save: Boolean; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 400 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 401 | 
   | 
   mem:  TMemoryStream; | 
 
 
 
 
 
 
 
 
 
 
 
 | 402 | 
 < | 
   i:    LongWord; | 
 
 
 
 
 
 
 
 
 
 | 402 | 
 > | 
   i:    Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 403 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 404 | 
   | 
   case MessageBox(Self.Handle, PChar('Save changes to .raw-part of file ' + | 
 
 
 
 
 
 
 
 
 
 
 
 | 405 | 
 < | 
       ConManager.Connection[ConID].GetFileInfo(fileid).Name + '?'), PChar('Data changed...'), | 
 
 
 
 
 
 
 
 
 
 | 405 | 
 > | 
       ConManager.Connection[ConnectionID].GetFileInfo(fileid).Name + '?'), PChar('Data changed...'), | 
 
 
 
 
 
 
 
 
 
 
 
 | 406 | 
   | 
       MB_YESNOCANCEL) of | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 407 | 
   | 
     idYes: | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 408 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 409 | 
   | 
       mem := TMemoryStream.Create; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 410 | 
   | 
       hex.SaveToStream(mem); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 411 | 
   | 
       mem.Seek(0, soFromBeginning); | 
 
 
 
 
 
 
 
 
 
 
 
 | 412 | 
 < | 
       ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, mem); | 
 
 
 
 
 
 
 
 
 
 | 412 | 
 > | 
       ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, mem); | 
 
 
 
 
 
 
 
 
 
 
 
 | 413 | 
   | 
       mem.Free; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 414 | 
   | 
       hex.Modified := False; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 415 | 
   | 
       for i := 0 to hex.Datasize - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 517 | 
   | 
   fs: TFileStream; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 518 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 519 | 
   | 
   saved.Filter     := 'Files of matching extension (*.' + | 
 
 
 
 
 
 
 
 
 
 
 
 | 520 | 
 < | 
     ConManager.Connection[ConID].GetFileInfo(fileid).Extension + ')|*.' + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 521 | 
 < | 
     ConManager.Connection[ConID].GetFileInfo(fileid).Extension + | 
 
 
 
 
 
 
 
 
 
 | 520 | 
 > | 
     ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + ')|*.' + | 
 
 
 
 
 
 | 521 | 
 > | 
     ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + | 
 
 
 
 
 
 
 
 
 
 
 
 | 522 | 
   | 
     '|All files|*.*'; | 
 
 
 
 
 
 
 
 
 
 
 
 | 523 | 
 < | 
   saved.DefaultExt := ConManager.Connection[ConID].GetFileInfo(fileid).Extension; | 
 
 
 
 
 
 
 
 
 
 | 523 | 
 > | 
   saved.DefaultExt := ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension; | 
 
 
 
 
 
 
 
 
 
 
 
 | 524 | 
   | 
   if saved.Execute then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 525 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 526 | 
   | 
     fs := TFileStream.Create(saved.FileName, fmCreate); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 536 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 537 | 
   | 
 //  Data: Tdata; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 538 | 
   | 
   fs:   TFileStream; | 
 
 
 
 
 
 
 
 
 
 | 527 | 
 – | 
   data: TByteData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 539 | 
   | 
   i: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 540 | 
   | 
   rawinfo: TRawDataInfo; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 541 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 542 | 
   | 
   opend.Filter := 'Files of matching extension (*.' + | 
 
 
 
 
 
 
 
 
 
 
 
 | 543 | 
 < | 
     ConManager.Connection[ConID].GetFileInfo(fileid).Extension + ')|*.' + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 544 | 
 < | 
     ConManager.Connection[ConID].GetFileInfo(fileid).Extension + | 
 
 
 
 
 
 
 
 
 
 | 543 | 
 > | 
     ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + ')|*.' + | 
 
 
 
 
 
 | 544 | 
 > | 
     ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + | 
 
 
 
 
 
 
 
 
 
 
 
 | 545 | 
   | 
     '|All files|*.*'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 546 | 
   | 
   if opend.Execute then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 547 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 548 | 
   | 
     fs := TFileStream.Create(opend.FileName, fmOpenRead); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 549 | 
   | 
     if fs.Size <> hex.DataSize then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 550 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 551 | 
 < | 
       if (not (CR_ResizeRaw in ConManager.Connection[ConID].ChangeRights)) and (not (CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights)) then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 551 | 
 > | 
       if | 
 
 
 
 
 
 | 552 | 
 > | 
         (not (CR_ResizeRaw in ConManager.Connection[ConnectionID].ChangeRights)) | 
 
 
 
 
 
 | 553 | 
 > | 
         and (not (CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights)) | 
 
 
 
 
 
 | 554 | 
 > | 
         then | 
 
 
 
 
 
 
 
 
 
 
 
 | 555 | 
   | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 556 | 
   | 
         ShowMessage('Can''t import ' + ExtractFilename(importd.FileName) + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 557 | 
   | 
             ', file has to have same size as file in .raw with this backend.' + CrLf + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 571 | 
   | 
           Exit; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 572 | 
   | 
         end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 573 | 
   | 
       end; | 
 
 
 
 
 
 
 
 
 
 
 
 | 574 | 
 < | 
       rawinfo := ConManager.Connection[ConID].GetRawInfo(fileid, datoffset); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 575 | 
 < | 
       if CR_ResizeRaw in ConManager.Connection[ConID].ChangeRights then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 576 | 
 < | 
         ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, fs) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 577 | 
 < | 
       else if CR_AppendRaw in ConManager.Connection[ConID].ChangeRights then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 578 | 
 < | 
         i := ConManager.Connection[ConID].AppendRawFile(rawinfo.LocSep, fs); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 579 | 
 < | 
         ConManager.Connection[ConID].UpdateDatFilePart(fileid, datoffset, 4, @i); | 
 
 
 
 
 
 
 
 
 
 | 574 | 
 > | 
       rawinfo := ConManager.Connection[ConnectionID].GetRawInfo(fileid, datoffset); | 
 
 
 
 
 
 | 575 | 
 > | 
       if CR_ResizeRaw in ConManager.Connection[ConnectionID].ChangeRights then | 
 
 
 
 
 
 | 576 | 
 > | 
         ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, fs) | 
 
 
 
 
 
 | 577 | 
 > | 
       else if CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights then | 
 
 
 
 
 
 | 578 | 
 > | 
         i := ConManager.Connection[ConnectionID].AppendRawFile(rawinfo.LocSep, fs); | 
 
 
 
 
 
 | 579 | 
 > | 
         ConManager.Connection[ConnectionID].UpdateDatFilePart(fileid, datoffset, 4, @i); | 
 
 
 
 
 
 
 
 
 
 
 
 | 580 | 
   | 
     end else begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 581 | 
 < | 
       ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, fs); | 
 
 
 
 
 
 
 
 
 
 | 581 | 
 > | 
       ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, fs); | 
 
 
 
 
 
 
 
 
 
 
 
 | 582 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 583 | 
   | 
     fs.Seek(0, soFromBeginning); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 584 | 
   | 
     hex.LoadFromStream(fs); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 648 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 649 | 
   | 
 //  i:     Byte; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 650 | 
   | 
   Name:  String; | 
 
 
 
 
 
 
 
 
 
 
 
 | 651 | 
 < | 
   Value: LongWord; | 
 
 
 
 
 
 
 
 
 
 | 651 | 
 > | 
   Value: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 652 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 653 | 
   | 
   Name := TMenuItem(Sender).Name; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 654 | 
   | 
   if Pos('asstring', Name) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 707 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 708 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 709 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 710 | 
 < | 
 procedure TForm_RawEdit.SetNewValue(datatype: Word; offset: LongWord; Value: String); | 
 
 
 
 
 
 
 
 
 
 | 710 | 
 > | 
 procedure TForm_RawEdit.SetNewValue(datatype: Word; offset: Integer; Value: String); | 
 
 
 
 
 
 
 
 
 
 
 
 | 711 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 712 | 
   | 
   Data: TByteData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 713 | 
   | 
   value_int: LongWord; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 774 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 775 | 
   | 
 procedure TForm_RawEdit.value_viewerDblClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 776 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 | 777 | 
 < | 
   offset:     LongWord; | 
 
 
 
 
 
 
 
 
 
 | 777 | 
 > | 
   offset:     Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 778 | 
   | 
   datatype:   Word; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 779 | 
   | 
   objectname: String; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 780 | 
   | 
   Value:      String; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 820 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 821 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 822 | 
   | 
   AddToolListEntry('rawedit', 'Binary .raw-Editor', ''); | 
 
 
 
 
 
 
 
 
 
 
 
 | 823 | 
 < | 
 end. | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 823 | 
 > | 
 end. | 
 
 
 
 
 
 | 824 | 
 > | 
  | 
 
 
 
 
 
 | 825 | 
 > | 
  |