| 1 | UNIT Unit8_binedit; | 
 
 
 
 
 | 2 | INTERFACE | 
 
 
 
 
 | 3 | USES | 
 
 
 
 
 | 4 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | 
 
 
 
 
 | 5 | Dialogs, Wrapgrid, StdCtrls, Grids, StrUtils, MPHexEditor, ExtCtrls, Clipbrd, | 
 
 
 
 
 | 6 | Unit3_data, Unit2_functions, Unit9_data_structures, Unit4_exporters, Menus, Math, | 
 
 
 
 
 | 7 | VirtualTrees, VTHeaderPopup; | 
 
 
 
 
 | 8 |  | 
 
 
 
 
 | 9 | TYPE | 
 
 
 
 
 | 10 | TForm8 = Class(TForm) | 
 
 
 
 
 | 11 | Splitter1: TSplitter; | 
 
 
 
 
 | 12 | panel_data: TPanel; | 
 
 
 
 
 | 13 | hex: TMPHexEditor; | 
 
 
 
 
 | 14 | Splitter2: TSplitter; | 
 
 
 
 
 | 15 | panel_files: TPanel; | 
 
 
 
 
 | 16 | list: TListBox; | 
 
 
 
 
 | 17 | panel_extension: TPanel; | 
 
 
 
 
 | 18 | lbl_filter: TLabel; | 
 
 
 
 
 | 19 | combo_extension: TComboBox; | 
 
 
 
 
 | 20 | Bevel1: TBevel; | 
 
 
 
 
 | 21 | panel_imexport: TPanel; | 
 
 
 
 
 | 22 | btn_export: TButton; | 
 
 
 
 
 | 23 | btn_import: TButton; | 
 
 
 
 
 | 24 | opend: TOpenDialog; | 
 
 
 
 
 | 25 | saved: TSaveDialog; | 
 
 
 
 
 | 26 | value_viewer: TWrapGrid; | 
 
 
 
 
 | 27 | Splitter3: TSplitter; | 
 
 
 
 
 | 28 | value_viewer_context: TPopupMenu; | 
 
 
 
 
 | 29 | value_viewer_context_copy: TMenuItem; | 
 
 
 
 
 | 30 | value_viewer_context_copyashex: TMenuItem; | 
 
 
 
 
 | 31 | value_viewer_context_copyasdec: TMenuItem; | 
 
 
 
 
 | 32 | value_viewer_context_copyasfloat: TMenuItem; | 
 
 
 
 
 | 33 | value_viewer_context_copyasbitset: TMenuItem; | 
 
 
 
 
 | 34 | value_viewer_context_copyasstring: TMenuItem; | 
 
 
 
 
 | 35 | check_zerobyte: TCheckBox; | 
 
 
 
 
 | 36 | edit_filtername: TEdit; | 
 
 
 
 
 | 37 | check_filtername: TCheckBox; | 
 
 
 
 
 | 38 | VST: TVirtualStringTree; | 
 
 
 
 
 | 39 | VTHPopup: TVTHeaderPopupMenu; | 
 
 
 
 
 | 40 | procedure VSTDblClick(Sender: TObject); | 
 
 
 
 
 | 41 | procedure VSTNewText(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 | 42 | Column: TColumnIndex; NewText: WideString); | 
 
 
 
 
 | 43 | procedure VTHPopupColumnChange(const Sender: TBaseVirtualTree; | 
 
 
 
 
 | 44 | const Column: TColumnIndex; Visible: Boolean); | 
 
 
 
 
 | 45 | procedure VSTHeaderDragged(Sender: TVTHeader; Column: TColumnIndex; | 
 
 
 
 
 | 46 | OldPosition: Integer); | 
 
 
 
 
 | 47 | procedure VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 | 48 | Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString); | 
 
 
 
 
 | 49 | procedure hexKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); | 
 
 
 
 
 | 50 | PROCEDURE LoadDat(_fileid:LongWord); | 
 
 
 
 
 | 51 | PROCEDURE LoadFileNames; | 
 
 
 
 
 | 52 | PROCEDURE check_filternameClick(Sender: TObject); | 
 
 
 
 
 | 53 | PROCEDURE check_zerobyteClick(Sender: TObject); | 
 
 
 
 
 | 54 | PROCEDURE combo_extensionClick(Sender: TObject); | 
 
 
 
 
 | 55 | PROCEDURE panel_extensionResize(Sender: TObject); | 
 
 
 
 
 | 56 | PROCEDURE listClick(Sender: TObject); | 
 
 
 
 
 | 57 | PROCEDURE Recreatelist; | 
 
 
 
 
 | 58 |  | 
 
 
 
 
 | 59 | PROCEDURE FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); | 
 
 
 
 
 | 60 | PROCEDURE value_viewerDblClick(Sender: TObject); | 
 
 
 
 
 | 61 | PROCEDURE structsDblClick(Sender: TObject); | 
 
 
 
 
 | 62 | PROCEDURE value_viewer_context_copyClick(Sender: TObject); | 
 
 
 
 
 | 63 | PROCEDURE value_viewerMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); | 
 
 
 
 
 | 64 | PROCEDURE value_viewer_contextPopup(Sender: TObject); | 
 
 
 
 
 | 65 | PROCEDURE FormActivate(Sender: TObject); | 
 
 
 
 
 | 66 | PROCEDURE btn_importClick(Sender: TObject); | 
 
 
 
 
 | 67 | PROCEDURE btn_exportClick(Sender: TObject); | 
 
 
 
 
 | 68 | PROCEDURE panel_imexportResize(Sender: TObject); | 
 
 
 
 
 | 69 | FUNCTION Save:Boolean; | 
 
 
 
 
 | 70 | PROCEDURE FormClose(Sender: TObject; var Action: TCloseAction); | 
 
 
 
 
 | 71 | FUNCTION GetValue(datatype:Word; offset:LongWord):String; | 
 
 
 
 
 | 72 | PROCEDURE WriteStructureInfos; //(structinfoid:Integer); | 
 
 
 
 
 | 73 | PROCEDURE hexSelectionChanged(Sender: TObject); | 
 
 
 
 
 | 74 | PROCEDURE hexChange(Sender: TObject); | 
 
 
 
 
 | 75 | PROCEDURE panel_dataResize(Sender: TObject); | 
 
 
 
 
 | 76 | PROCEDURE structsClick(Sender: TObject); | 
 
 
 
 
 | 77 | PROCEDURE FormResize(Sender: TObject); | 
 
 
 
 
 | 78 | PROCEDURE ClearStructViewer; | 
 
 
 
 
 | 79 | PROCEDURE FormCloseQuery(Sender: TObject; var CanClose: Boolean); | 
 
 
 
 
 | 80 | PROCEDURE FormCreate(Sender: TObject); | 
 
 
 
 
 | 81 | PROCEDURE ClearValues; | 
 
 
 
 
 | 82 | PROCEDURE WriteValues; | 
 
 
 
 
 | 83 | PROCEDURE SetNewValue(datatype:Word; offset:LongWord; value:String); | 
 
 
 
 
 | 84 | PRIVATE | 
 
 
 
 
 | 85 | PUBLIC | 
 
 
 
 
 | 86 | END; | 
 
 
 
 
 | 87 |  | 
 
 
 
 
 | 88 | VAR | 
 
 
 
 
 | 89 | Form8: TForm8; | 
 
 
 
 
 | 90 |  | 
 
 
 
 
 | 91 | IMPLEMENTATION | 
 
 
 
 
 | 92 | {$R *.dfm} | 
 
 
 
 
 | 93 | USES Unit1_main, Unit12_ValueEdit, Unit13_rawedit; | 
 
 
 
 
 | 94 | VAR | 
 
 
 
 
 | 95 | fileid:LongWord; | 
 
 
 
 
 | 96 |  | 
 
 
 
 
 | 97 | TYPE | 
 
 
 
 
 | 98 | PNodeData = ^TNodeData; | 
 
 
 
 
 | 99 | TNodeData = record | 
 
 
 
 
 | 100 | Caption:String; | 
 
 
 
 
 | 101 | Offset:LongInt; | 
 
 
 
 
 | 102 | DataType:Word; | 
 
 
 
 
 | 103 | Value:String; | 
 
 
 
 
 | 104 | Description:String; | 
 
 
 
 
 | 105 | end; | 
 
 
 
 
 | 106 |  | 
 
 
 
 
 | 107 |  | 
 
 
 
 
 | 108 | function AddVSTEntry(AVST:TCustomVirtualStringTree; ANode:PVirtualNode; ARecord:TNodeData):PVirtualNode; | 
 
 
 
 
 | 109 | var | 
 
 
 
 
 | 110 | data:PNodeData; | 
 
 
 
 
 | 111 | begin | 
 
 
 
 
 | 112 | Result:=AVST.AddChild(ANode); | 
 
 
 
 
 | 113 | data:=AVST.GetNodeData(Result); | 
 
 
 
 
 | 114 | AVST.ValidateNode(Result,False); | 
 
 
 
 
 | 115 | data^:=ARecord; | 
 
 
 
 
 | 116 | end; | 
 
 
 
 
 | 117 |  | 
 
 
 
 
 | 118 |  | 
 
 
 
 
 | 119 |  | 
 
 
 
 
 | 120 | PROCEDURE TForm8.LoadDat(_fileid:LongWord); | 
 
 
 
 
 | 121 | VAR | 
 
 
 
 
 | 122 | i:LongWord; | 
 
 
 
 
 | 123 | mem:TMemoryStream; | 
 
 
 
 
 | 124 | data:Tdata; | 
 
 
 
 
 | 125 | BEGIN | 
 
 
 
 
 | 126 | IF hex.Modified THEN BEGIN | 
 
 
 
 
 | 127 | IF NOT Save THEN BEGIN | 
 
 
 
 
 | 128 | FOR i:=0 TO list.Count-1 DO BEGIN | 
 
 
 
 
 | 129 | IF GetFileIDByName(list.Items.Strings[i])=fileid THEN BEGIN | 
 
 
 
 
 | 130 | list.ItemIndex:=i; | 
 
 
 
 
 | 131 | Exit; | 
 
 
 
 
 | 132 | END; | 
 
 
 
 
 | 133 | END; | 
 
 
 
 
 | 134 | END; | 
 
 
 
 
 | 135 | END; | 
 
 
 
 
 | 136 | fileid:=_fileid; | 
 
 
 
 
 | 137 | FOR i:=0 TO list.Count-1 DO | 
 
 
 
 
 | 138 | IF GetFileIDByName(list.Items.Strings[i])=fileid THEN | 
 
 
 
 
 | 139 | list.ItemIndex:=i; | 
 
 
 
 
 | 140 | Self.ClearStructViewer; | 
 
 
 
 
 | 141 | data:=LoadDatFile(fileid); | 
 
 
 
 
 | 142 | IF Length(data)>0 THEN BEGIN | 
 
 
 
 
 | 143 | mem:=TMemoryStream.Create; | 
 
 
 
 
 | 144 | mem.Write(data[0],Length(data)); | 
 
 
 
 
 | 145 | mem.Seek(0,soFromBeginning); | 
 
 
 
 
 | 146 | hex.LoadFromStream(mem); | 
 
 
 
 
 | 147 | mem.Free; | 
 
 
 
 
 | 148 | WriteStructureInfos; //(GetStructureInfoId(GetFileInfo(fileid).Extension)); | 
 
 
 
 
 | 149 | END ELSE BEGIN | 
 
 
 
 
 | 150 | ClearValues; | 
 
 
 
 
 | 151 | hex.DataSize:=0; | 
 
 
 
 
 | 152 | END; | 
 
 
 
 
 | 153 | END; | 
 
 
 
 
 | 154 |  | 
 
 
 
 
 | 155 | PROCEDURE TForm8.Recreatelist; | 
 
 
 
 
 | 156 | VAR | 
 
 
 
 
 | 157 | i:LongWord; | 
 
 
 
 
 | 158 | exts:TStringList; | 
 
 
 
 
 | 159 | BEGIN | 
 
 
 
 
 | 160 | combo_extension.Items.Clear; | 
 
 
 
 
 | 161 | combo_extension.Items.Add('_All files_ ('+IntToStr(GetFilesCount)+')'); | 
 
 
 
 
 | 162 | exts:=GetExtensionsList; | 
 
 
 
 
 | 163 | FOR i:=0 TO High(exts) DO | 
 
 
 
 
 | 164 | combo_extension.Items.Add(exts[i]); | 
 
 
 
 
 | 165 | combo_extension.ItemIndex:=0; | 
 
 
 
 
 | 166 | combo_extensionClick(Self); | 
 
 
 
 
 | 167 | END; | 
 
 
 
 
 | 168 |  | 
 
 
 
 
 | 169 | PROCEDURE TForm8.LoadFileNames; | 
 
 
 
 
 | 170 | VAR | 
 
 
 
 
 | 171 | Extension:String[4]; | 
 
 
 
 
 | 172 | no_zero_bytes:Boolean; | 
 
 
 
 
 | 173 | pattern:String; | 
 
 
 
 
 | 174 | files:TStringList; | 
 
 
 
 
 | 175 | i:LongWord; | 
 
 
 
 
 | 176 | BEGIN | 
 
 
 
 
 | 177 | Extension:=MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex],1,4); | 
 
 
 
 
 | 178 | no_zero_bytes:=NOT check_zerobyte.Checked; | 
 
 
 
 
 | 179 | pattern:=''; | 
 
 
 
 
 | 180 | IF check_filtername.Checked THEN pattern:=edit_filtername.Text; | 
 
 
 
 
 | 181 | IF Extension='_All' THEN Extension:=''; | 
 
 
 
 
 | 182 |  | 
 
 
 
 
 | 183 | files:=GetFilesList(extension,pattern,no_zero_bytes); | 
 
 
 
 
 | 184 | list.Items.Clear; | 
 
 
 
 
 | 185 | IF Length(files)>0 THEN | 
 
 
 
 
 | 186 | FOR i:=0 TO High(files) DO | 
 
 
 
 
 | 187 | list.Items.Add(files[i]); | 
 
 
 
 
 | 188 | END; | 
 
 
 
 
 | 189 |  | 
 
 
 
 
 | 190 | PROCEDURE TForm8.panel_extensionResize(Sender: TObject); | 
 
 
 
 
 | 191 | BEGIN | 
 
 
 
 
 | 192 | combo_extension.Width:=panel_extension.Width-5; | 
 
 
 
 
 | 193 | edit_filtername.Width:=panel_extension.Width-5; | 
 
 
 
 
 | 194 | END; | 
 
 
 
 
 | 195 |  | 
 
 
 
 
 | 196 | PROCEDURE TForm8.combo_extensionClick(Sender: TObject); | 
 
 
 
 
 | 197 | BEGIN | 
 
 
 
 
 | 198 | LoadFileNames; | 
 
 
 
 
 | 199 | END; | 
 
 
 
 
 | 200 |  | 
 
 
 
 
 | 201 | PROCEDURE TForm8.check_zerobyteClick(Sender: TObject); | 
 
 
 
 
 | 202 | VAR | 
 
 
 
 
 | 203 | i:Byte; | 
 
 
 
 
 | 204 | BEGIN | 
 
 
 
 
 | 205 | LoadFileNames; | 
 
 
 
 
 | 206 | END; | 
 
 
 
 
 | 207 |  | 
 
 
 
 
 | 208 | PROCEDURE TForm8.check_filternameClick(Sender: TObject); | 
 
 
 
 
 | 209 | BEGIN | 
 
 
 
 
 | 210 | edit_filtername.Enabled:=NOT check_filtername.Checked; | 
 
 
 
 
 | 211 | LoadFileNames; | 
 
 
 
 
 | 212 | END; | 
 
 
 
 
 | 213 |  | 
 
 
 
 
 | 214 | PROCEDURE TForm8.listClick(Sender: TObject); | 
 
 
 
 
 | 215 | VAR | 
 
 
 
 
 | 216 | mem:TMemoryStream; | 
 
 
 
 
 | 217 | data:Tdata; | 
 
 
 
 
 | 218 | i:LongWord; | 
 
 
 
 
 | 219 | BEGIN | 
 
 
 
 
 | 220 | LoadDat(GetFileIDByName(list.Items.Strings[list.ItemIndex])); | 
 
 
 
 
 | 221 | {    IF hex.Modified THEN BEGIN | 
 
 
 
 
 | 222 | IF NOT Save THEN BEGIN | 
 
 
 
 
 | 223 | FOR i:=0 TO list.Count-1 DO BEGIN | 
 
 
 
 
 | 224 | IF GetFileIDByName(list.Items.Strings[list.ItemIndex])=fileid THEN BEGIN | 
 
 
 
 
 | 225 | list.ItemIndex:=i; | 
 
 
 
 
 | 226 | Exit; | 
 
 
 
 
 | 227 | END; | 
 
 
 
 
 | 228 | END; | 
 
 
 
 
 | 229 | END; | 
 
 
 
 
 | 230 | END; | 
 
 
 
 
 | 231 | Self.ClearStructViewer; | 
 
 
 
 
 | 232 | fileid:=GetFileIDByName(list.Items.Strings[list.ItemIndex]); | 
 
 
 
 
 | 233 | data:=LoadDatFile(fileid); | 
 
 
 
 
 | 234 | IF Length(data)>0 THEN BEGIN | 
 
 
 
 
 | 235 | mem:=TMemoryStream.Create; | 
 
 
 
 
 | 236 | mem.Write(data[0],Length(data)); | 
 
 
 
 
 | 237 | mem.Seek(0,soFromBeginning); | 
 
 
 
 
 | 238 | hex.LoadFromStream(mem); | 
 
 
 
 
 | 239 | mem.Free; | 
 
 
 
 
 | 240 | WriteStructureInfos(GetStructureInfoId(GetFileInfo(fileid).Extension)); | 
 
 
 
 
 | 241 | END ELSE BEGIN | 
 
 
 
 
 | 242 | ClearValues; | 
 
 
 
 
 | 243 | hex.DataSize:=0; | 
 
 
 
 
 | 244 | END; | 
 
 
 
 
 | 245 | }  END; | 
 
 
 
 
 | 246 |  | 
 
 
 
 
 | 247 |  | 
 
 
 
 
 | 248 |  | 
 
 
 
 
 | 249 |  | 
 
 
 
 
 | 250 | FUNCTION IntToBin(value:Byte):String; | 
 
 
 
 
 | 251 | VAR i:Byte; | 
 
 
 
 
 | 252 | BEGIN | 
 
 
 
 
 | 253 | Result:=''; | 
 
 
 
 
 | 254 | FOR i:=7 DOWNTO 0 DO BEGIN | 
 
 
 
 
 | 255 | Result:=Result+IntToStr((value SHR i) AND $01); | 
 
 
 
 
 | 256 | END; | 
 
 
 
 
 | 257 | END; | 
 
 
 
 
 | 258 |  | 
 
 
 
 
 | 259 | FUNCTION TForm8.GetValue(datatype:Word; offset:LongWord):String; | 
 
 
 
 
 | 260 | VAR | 
 
 
 
 
 | 261 | data:Tdata; | 
 
 
 
 
 | 262 | i:Word; | 
 
 
 
 
 | 263 | BEGIN | 
 
 
 
 
 | 264 | CASE datatype OF | 
 
 
 
 
 | 265 | 1: Result:=IntToStr(hex.data[offset]); | 
 
 
 
 
 | 266 | 2: Result:=IntToStr(hex.data[offset]+hex.data[offset+1]*256); | 
 
 
 
 
 | 267 | 3: Result:=IntToStr(hex.data[offset]+hex.data[offset+1]*256+hex.data[offset+2]*256*256); | 
 
 
 
 
 | 268 | 4: Result:=IntToStr(hex.data[offset]+hex.data[offset+1]*256+hex.data[offset+2]*256*256+hex.data[offset+3]*256*256*256); | 
 
 
 
 
 | 269 | 5: Result:='0x'+IntToHex(hex.data[offset],2); | 
 
 
 
 
 | 270 | 6: Result:='0x'+IntToHex(hex.data[offset]+hex.data[offset+1]*256,4); | 
 
 
 
 
 | 271 | 7: Result:='0x'+IntToHex(hex.data[offset]+hex.data[offset+1]*256+hex.data[offset+2]*256*256,6); | 
 
 
 
 
 | 272 | 8: Result:='0x'+IntToHex(hex.data[offset]+hex.data[offset+1]*256+hex.data[offset+2]*256*256+hex.data[offset+3]*256*256*256,8); | 
 
 
 
 
 | 273 | 9: BEGIN | 
 
 
 
 
 | 274 | SetLength(data,4); | 
 
 
 
 
 | 275 | data[0]:=hex.data[offset]; | 
 
 
 
 
 | 276 | data[1]:=hex.data[offset+1]; | 
 
 
 
 
 | 277 | data[2]:=hex.data[offset+2]; | 
 
 
 
 
 | 278 | data[3]:=hex.data[offset+3]; | 
 
 
 
 
 | 279 | Result:=FloatToStr(Decode_Float(data)); | 
 
 
 
 
 | 280 | END; | 
 
 
 
 
 | 281 | 10: Result:=IntToBin(hex.data[offset]); | 
 
 
 
 
 | 282 | 11: Result:='0x'+IntToHex(GetRawInfo(fileid,offset).raw_addr,8); | 
 
 
 
 
 | 283 | 12: Result:=FormatNumber(hex.data[offset+1]+hex.data[offset+2]*256+hex.data[offset+3]*256*256,5,'0'); | 
 
 
 
 
 | 284 | 13: Result:=IntToStr(hex.data[offset]); | 
 
 
 
 
 | 285 | 14: Result:=IntToStr(hex.data[offset]+hex.data[offset+1]*256); | 
 
 
 
 
 | 286 | 15: Result:=IntToStr(hex.data[offset]+hex.data[offset+1]*256+hex.data[offset+2]*256*256); | 
 
 
 
 
 | 287 | 16: Result:=IntToStr(hex.data[offset]+hex.data[offset+1]*256+hex.data[offset+2]*256*256+hex.data[offset+3]*256*256*256); | 
 
 
 
 
 | 288 | 1000..9999: BEGIN | 
 
 
 
 
 | 289 | Result:=''; | 
 
 
 
 
 | 290 | FOR i:=1 TO datatype-1000 DO BEGIN | 
 
 
 
 
 | 291 | IF hex.Data[offset+i-1]>=32 THEN | 
 
 
 
 
 | 292 | Result:=Result+Chr(hex.Data[offset+i-1]) | 
 
 
 
 
 | 293 | ELSE | 
 
 
 
 
 | 294 | Result:=Result+'.'; | 
 
 
 
 
 | 295 | END; | 
 
 
 
 
 | 296 | END; | 
 
 
 
 
 | 297 | 10000..65535: BEGIN | 
 
 
 
 
 | 298 | Result:=''; | 
 
 
 
 
 | 299 | FOR i:=1 TO datatype-10000 DO BEGIN | 
 
 
 
 
 | 300 | IF hex.Data[offset+i-1]>=32 THEN | 
 
 
 
 
 | 301 | Result:=Result+Chr(hex.Data[offset+i-1]) | 
 
 
 
 
 | 302 | ELSE | 
 
 
 
 
 | 303 | Result:=Result+'.'; | 
 
 
 
 
 | 304 | END; | 
 
 
 
 
 | 305 | END; | 
 
 
 
 
 | 306 | END; | 
 
 
 
 
 | 307 | END; | 
 
 
 
 
 | 308 |  | 
 
 
 
 
 | 309 | PROCEDURE TForm8.WriteStructureInfos;//(structinfoid:Integer); | 
 
 
 
 
 | 310 | VAR | 
 
 
 
 
 | 311 | i,j:LongWord; | 
 
 
 
 
 | 312 | pdata: PNodeData; | 
 
 
 
 
 | 313 | data: TNodeData; | 
 
 
 
 
 | 314 | node: PVirtualNode; | 
 
 
 
 
 | 315 | structs: TStructDef; | 
 
 
 
 
 | 316 | BEGIN | 
 
 
 
 
 | 317 | VST.BeginUpdate; | 
 
 
 
 
 | 318 | IF VST.RootNodeCount=0 THEN BEGIN | 
 
 
 
 
 | 319 | structs:=LoadStructureDefinition(fileid); | 
 
 
 
 
 | 320 | IF structs.data THEN BEGIN | 
 
 
 
 
 | 321 | IF Length(structs.Global)>0 THEN BEGIN | 
 
 
 
 
 | 322 | FOR i:=0 TO High(structs.Global) DO BEGIN | 
 
 
 
 
 | 323 | data.Caption:=structs.Global[i].name; | 
 
 
 
 
 | 324 | data.Offset:=structs.Global[i].offset; | 
 
 
 
 
 | 325 | data.DataType:=structs.Global[i].datatype; | 
 
 
 
 
 | 326 | data.Value:=GetValue(structs.Global[i].datatype, structs.Global[i].offset); | 
 
 
 
 
 | 327 | data.Description:=structs.Global[i].description; | 
 
 
 
 
 | 328 | AddVSTEntry(VST, nil, data); | 
 
 
 
 
 | 329 | END; | 
 
 
 
 
 | 330 | END; | 
 
 
 
 
 | 331 | IF Length(structs.Subs)>0 THEN BEGIN | 
 
 
 
 
 | 332 | FOR i:=0 TO High(structs.Subs) DO BEGIN | 
 
 
 
 
 | 333 | WITH structs.Subs[i] DO BEGIN | 
 
 
 
 
 | 334 | IF Length(Entries)>0 THEN BEGIN | 
 
 
 
 
 | 335 | data.Caption:=SubName; | 
 
 
 
 
 | 336 | data.Offset:=0; | 
 
 
 
 
 | 337 | data.DataType:=0; | 
 
 
 
 
 | 338 | data.Value:=''; | 
 
 
 
 
 | 339 | data.Description:=''; | 
 
 
 
 
 | 340 | node:=AddVSTEntry(VST, nil, data); | 
 
 
 
 
 | 341 | FOR j:=0 TO High(Entries) DO BEGIN | 
 
 
 
 
 | 342 | data.Caption:=Entries[j].name; | 
 
 
 
 
 | 343 | data.Offset:=Entries[j].offset; | 
 
 
 
 
 | 344 | data.DataType:=Entries[j].datatype; | 
 
 
 
 
 | 345 | data.Value:=GetValue(Entries[j].datatype, Entries[j].offset); | 
 
 
 
 
 | 346 | data.Description:=Entries[j].description; | 
 
 
 
 
 | 347 | AddVSTEntry(VST, node, data); | 
 
 
 
 
 | 348 | END; | 
 
 
 
 
 | 349 | END; | 
 
 
 
 
 | 350 | END; | 
 
 
 
 
 | 351 | END; | 
 
 
 
 
 | 352 | END; | 
 
 
 
 
 | 353 | END; | 
 
 
 
 
 | 354 | END ELSE BEGIN | 
 
 
 
 
 | 355 | Node:=VST.GetFirst; | 
 
 
 
 
 | 356 | WHILE Assigned(Node) DO BEGIN | 
 
 
 
 
 | 357 | pdata:=VST.GetNodeData(Node); | 
 
 
 
 
 | 358 | pdata.Value:=GetValue(pdata.Datatype, pdata.Offset); | 
 
 
 
 
 | 359 | Node:=VST.GetNext(Node); | 
 
 
 
 
 | 360 | END; | 
 
 
 
 
 | 361 | END; | 
 
 
 
 
 | 362 | VST.EndUpdate; | 
 
 
 
 
 | 363 |  | 
 
 
 
 
 | 364 | {    VST.BeginUpdate; | 
 
 
 
 
 | 365 | IF VST.RootNodeCount=0 THEN BEGIN | 
 
 
 
 
 | 366 | IF structinfoid>=0 THEN BEGIN | 
 
 
 
 
 | 367 | WITH structure_infos[structinfoid] DO BEGIN | 
 
 
 
 
 | 368 | FOR i:=1 TO Length(entries) DO BEGIN | 
 
 
 
 
 | 369 | data.Caption:=entries[i-1].name; | 
 
 
 
 
 | 370 | data.Offset:=entries[i-1].offset; | 
 
 
 
 
 | 371 | data.DataType:=entries[i-1].datatype; | 
 
 
 
 
 | 372 | data.Value:=GetValue(entries[i-1].datatype, entries[i-1].offset); | 
 
 
 
 
 | 373 | data.Description:=entries[i-1].description; | 
 
 
 
 
 | 374 | AddVSTEntry(VST, nil, data); | 
 
 
 
 
 | 375 | END; | 
 
 
 
 
 | 376 | END; | 
 
 
 
 
 | 377 | END; | 
 
 
 
 
 | 378 | END ELSE BEGIN | 
 
 
 
 
 | 379 | IF structinfoid>=0 THEN BEGIN | 
 
 
 
 
 | 380 | WITH structure_infos[structinfoid] DO BEGIN | 
 
 
 
 
 | 381 | FOR i:=1 TO Length(entries) DO BEGIN | 
 
 
 
 
 | 382 | Node:=VST.GetFirst; | 
 
 
 
 
 | 383 | WHILE Assigned(Node) DO BEGIN | 
 
 
 
 
 | 384 | pdata:=VST.GetNodeData(Node); | 
 
 
 
 
 | 385 | pdata.Value:=GetValue(pdata.Datatype, pdata.Offset); | 
 
 
 
 
 | 386 | Node:=VST.GetNext(Node); | 
 
 
 
 
 | 387 | END; | 
 
 
 
 
 | 388 | END; | 
 
 
 
 
 | 389 | END; | 
 
 
 
 
 | 390 | END; | 
 
 
 
 
 | 391 | END; | 
 
 
 
 
 | 392 | VST.EndUpdate; | 
 
 
 
 
 | 393 | }  END; | 
 
 
 
 
 | 394 |  | 
 
 
 
 
 | 395 | PROCEDURE TForm8.ClearValues; | 
 
 
 
 
 | 396 | VAR | 
 
 
 
 
 | 397 | i:Byte; | 
 
 
 
 
 | 398 | BEGIN | 
 
 
 
 
 | 399 | FOR i:=1 TO value_viewer.RowCount-1 DO BEGIN | 
 
 
 
 
 | 400 | value_viewer.Cells[1,i]:=''; | 
 
 
 
 
 | 401 | END; | 
 
 
 
 
 | 402 | END; | 
 
 
 
 
 | 403 |  | 
 
 
 
 
 | 404 | PROCEDURE TForm8.WriteValues; | 
 
 
 
 
 | 405 | VAR | 
 
 
 
 
 | 406 | i,j:Byte; | 
 
 
 
 
 | 407 | data:Tdata; | 
 
 
 
 
 | 408 | str:String; | 
 
 
 
 
 | 409 | value:LongWord; | 
 
 
 
 
 | 410 | BEGIN | 
 
 
 
 
 | 411 | FOR i:=1 TO value_viewer.RowCount-1 DO BEGIN | 
 
 
 
 
 | 412 | IF value_viewer.Cells[0,i]='1 byte, unsigned' THEN BEGIN | 
 
 
 
 
 | 413 | IF ((hex.SelCount=1) OR (hex.SelCount=0)) AND NOT ((hex.SelStart+1)>hex.DataSize) THEN BEGIN | 
 
 
 
 
 | 414 | value:=hex.Data[hex.SelStart]; | 
 
 
 
 
 | 415 | value_viewer.Cells[1,i]:=IntToStr( value )+' / 0x'+IntToHex( value , 2 ); | 
 
 
 
 
 | 416 | END ELSE | 
 
 
 
 
 | 417 | value_viewer.Cells[1,i]:=''; | 
 
 
 
 
 | 418 | END; | 
 
 
 
 
 | 419 | IF value_viewer.Cells[0,i]='2 bytes, unsigned' THEN BEGIN | 
 
 
 
 
 | 420 | IF ((hex.SelCount=2) OR (hex.SelCount=0)) AND NOT ((hex.SelStart+2)>hex.DataSize) THEN BEGIN | 
 
 
 
 
 | 421 | value:=hex.Data[hex.SelStart] + hex.Data[hex.SelStart+1]*256; | 
 
 
 
 
 | 422 | value_viewer.Cells[1,i]:=IntToStr( value )+' / 0x'+IntToHex( value , 4 ); | 
 
 
 
 
 | 423 | END ELSE | 
 
 
 
 
 | 424 | value_viewer.Cells[1,i]:=''; | 
 
 
 
 
 | 425 | END; | 
 
 
 
 
 | 426 | IF value_viewer.Cells[0,i]='4 bytes, unsigned' THEN BEGIN | 
 
 
 
 
 | 427 | IF ((hex.SelCount=4) OR (hex.SelCount=0)) AND NOT ((hex.SelStart+4)>hex.DataSize) THEN BEGIN | 
 
 
 
 
 | 428 | value:=hex.Data[hex.SelStart]+hex.Data[hex.SelStart+1]*256+hex.Data[hex.SelStart+2]*256*256+hex.Data[hex.SelStart+3]*256*256*256; | 
 
 
 
 
 | 429 | value_viewer.Cells[1,i]:=IntToStr( value )+' / 0x'+IntToHex( value , 8 ); | 
 
 
 
 
 | 430 | END ELSE | 
 
 
 
 
 | 431 | value_viewer.Cells[1,i]:=''; | 
 
 
 
 
 | 432 | END; | 
 
 
 
 
 | 433 | IF value_viewer.Cells[0,i]='Bitset' THEN BEGIN | 
 
 
 
 
 | 434 | IF (hex.SelCount<=8) THEN BEGIN | 
 
 
 
 
 | 435 | IF hex.SelCount=0 THEN BEGIN | 
 
 
 
 
 | 436 | SetLength(data,1); | 
 
 
 
 
 | 437 | data[0]:=hex.Data[hex.SelStart]; | 
 
 
 
 
 | 438 | END ELSE BEGIN | 
 
 
 
 
 | 439 | SetLength(data,hex.SelCount); | 
 
 
 
 
 | 440 | FOR j:=0 TO hex.SelCount-1 DO | 
 
 
 
 
 | 441 | data[j]:=hex.Data[hex.SelStart+j]; | 
 
 
 
 
 | 442 | END; | 
 
 
 
 
 | 443 | value_viewer.Cells[1,i]:=DataToBin(data); | 
 
 
 
 
 | 444 | END ELSE | 
 
 
 
 
 | 445 | value_viewer.Cells[1,i]:=''; | 
 
 
 
 
 | 446 | END; | 
 
 
 
 
 | 447 | IF value_viewer.Cells[0,i]='Float' THEN BEGIN | 
 
 
 
 
 | 448 | IF ((hex.SelCount=4) OR (hex.SelCount=0)) AND NOT ((hex.SelStart+4)>hex.DataSize) THEN BEGIN | 
 
 
 
 
 | 449 | SetLength(data,4); | 
 
 
 
 
 | 450 | FOR j:=0 TO 3 DO | 
 
 
 
 
 | 451 | data[j]:=hex.Data[hex.SelStart+j]; | 
 
 
 
 
 | 452 | value_viewer.Cells[1,i]:=FloatToStr(Decode_Float(data)); | 
 
 
 
 
 | 453 | END ELSE | 
 
 
 
 
 | 454 | value_viewer.Cells[1,i]:=''; | 
 
 
 
 
 | 455 | END; | 
 
 
 
 
 | 456 | IF value_viewer.Cells[0,i]='Selected length' THEN BEGIN | 
 
 
 
 
 | 457 | value_viewer.Cells[1,i]:=IntToStr(hex.SelCount)+' bytes'; | 
 
 
 
 
 | 458 | END; | 
 
 
 
 
 | 459 | IF value_viewer.Cells[0,i]='String' THEN BEGIN | 
 
 
 
 
 | 460 | j:=0; | 
 
 
 
 
 | 461 | str:=''; | 
 
 
 
 
 | 462 | IF hex.SelCount=0 THEN BEGIN | 
 
 
 
 
 | 463 | {          WHILE (hex.Data[hex.SelStart+j]>0) AND ((hex.SelStart+j)<hex.DataSize) DO BEGIN | 
 
 
 
 
 | 464 | IF hex.Data[hex.selstart+j]>=32 THEN | 
 
 
 
 
 | 465 | str:=str+Char(hex.Data[hex.SelStart+j]) | 
 
 
 
 
 | 466 | ELSE | 
 
 
 
 
 | 467 | str:=str+'.'; | 
 
 
 
 
 | 468 | Inc(j); | 
 
 
 
 
 | 469 | END; | 
 
 
 
 
 | 470 | }        END ELSE BEGIN | 
 
 
 
 
 | 471 | FOR j:=1 TO hex.SelCount DO | 
 
 
 
 
 | 472 | str:=str+Char(hex.Data[hex.SelStart+j-1]); | 
 
 
 
 
 | 473 | END; | 
 
 
 
 
 | 474 | value_viewer.Cells[1,i]:=str; | 
 
 
 
 
 | 475 | END; | 
 
 
 
 
 | 476 | END; | 
 
 
 
 
 | 477 | END; | 
 
 
 
 
 | 478 |  | 
 
 
 
 
 | 479 | PROCEDURE TForm8.FormCreate(Sender: TObject); | 
 
 
 
 
 | 480 | BEGIN | 
 
 
 
 
 | 481 | Self.Caption:=''; | 
 
 
 
 
 | 482 | fileid:=0; | 
 
 
 
 
 | 483 | VST.NodeDataSize:=SizeOf(TNodeData); | 
 
 
 
 
 | 484 | value_viewer.ColCount:=2; | 
 
 
 
 
 | 485 | value_viewer.RowCount:=8; | 
 
 
 
 
 | 486 | value_viewer.FixedRows:=1; | 
 
 
 
 
 | 487 | value_viewer.Cells[0,0]:='Type'; | 
 
 
 
 
 | 488 | value_viewer.Cells[1,0]:='Value'; | 
 
 
 
 
 | 489 | value_viewer.Cells[0,1]:='1 byte, unsigned'; | 
 
 
 
 
 | 490 | value_viewer.Cells[0,2]:='2 bytes, unsigned'; | 
 
 
 
 
 | 491 | value_viewer.Cells[0,3]:='4 bytes, unsigned'; | 
 
 
 
 
 | 492 | value_viewer.Cells[0,4]:='Bitset'; | 
 
 
 
 
 | 493 | value_viewer.Cells[0,5]:='Float'; | 
 
 
 
 
 | 494 | value_viewer.Cells[0,6]:='String'; | 
 
 
 
 
 | 495 | value_viewer.Cells[0,7]:='Selected length'; | 
 
 
 
 
 | 496 | value_viewer.ColWidths[0]:=100; | 
 
 
 
 
 | 497 | hex.Height:=panel_data.Height-215; | 
 
 
 
 
 | 498 | Self.panel_dataResize(Self); | 
 
 
 
 
 | 499 | END; | 
 
 
 
 
 | 500 |  | 
 
 
 
 
 | 501 | FUNCTION TForm8.Save:Boolean; | 
 
 
 
 
 | 502 | VAR | 
 
 
 
 
 | 503 | mem:TMemoryStream; | 
 
 
 
 
 | 504 | data:Tdata; | 
 
 
 
 
 | 505 | i:LongWord; | 
 
 
 
 
 | 506 | BEGIN | 
 
 
 
 
 | 507 | CASE MessageBox(Self.Handle,PChar('Save changes to file '+GetFileInfo(fileid).FileName+'?'),PChar('Data changed...'),MB_YESNOCANCEL) OF | 
 
 
 
 
 | 508 | IDYES: BEGIN | 
 
 
 
 
 | 509 | mem:=TMemoryStream.Create; | 
 
 
 
 
 | 510 | hex.SaveToStream(mem); | 
 
 
 
 
 | 511 | mem.Seek(0,soFromBeginning); | 
 
 
 
 
 | 512 | SetLength(data,mem.Size); | 
 
 
 
 
 | 513 | mem.Read(data[0],mem.Size); | 
 
 
 
 
 | 514 | mem.Free; | 
 
 
 
 
 | 515 | UpdateDatFile(fileid,data); | 
 
 
 
 
 | 516 | hex.Modified:=False; | 
 
 
 
 
 | 517 | FOR i:=0 TO hex.Datasize-1 DO hex.ByteChanged[i]:=False; | 
 
 
 
 
 | 518 | Result:=True; | 
 
 
 
 
 | 519 | END; | 
 
 
 
 
 | 520 | IDNO: Result:=True; | 
 
 
 
 
 | 521 | IDCANCEL: BEGIN | 
 
 
 
 
 | 522 | Result:=False; | 
 
 
 
 
 | 523 | END; | 
 
 
 
 
 | 524 | END; | 
 
 
 
 
 | 525 | END; | 
 
 
 
 
 | 526 |  | 
 
 
 
 
 | 527 | PROCEDURE TForm8.FormCloseQuery(Sender: TObject; var CanClose: Boolean); | 
 
 
 
 
 | 528 | BEGIN | 
 
 
 
 
 | 529 | IF hex.Modified THEN BEGIN | 
 
 
 
 
 | 530 | IF NOT Save THEN CanClose:=False; | 
 
 
 
 
 | 531 | END; | 
 
 
 
 
 | 532 | END; | 
 
 
 
 
 | 533 |  | 
 
 
 
 
 | 534 | PROCEDURE TForm8.ClearStructViewer; | 
 
 
 
 
 | 535 | BEGIN | 
 
 
 
 
 | 536 | VST.Clear; | 
 
 
 
 
 | 537 | END; | 
 
 
 
 
 | 538 |  | 
 
 
 
 
 | 539 | PROCEDURE TForm8.FormResize(Sender: TObject); | 
 
 
 
 
 | 540 | BEGIN | 
 
 
 
 
 | 541 | IF Self.Width>=650 THEN BEGIN | 
 
 
 
 
 | 542 | END ELSE Self.Width:=650; | 
 
 
 
 
 | 543 | IF Self.Height>=450 THEN BEGIN | 
 
 
 
 
 | 544 | END ELSE Self.Height:=450; | 
 
 
 
 
 | 545 | END; | 
 
 
 
 
 | 546 |  | 
 
 
 
 
 | 547 | PROCEDURE TForm8.structsClick(Sender: TObject); | 
 
 
 
 
 | 548 | VAR | 
 
 
 
 
 | 549 | offset:LongWord; | 
 
 
 
 
 | 550 | length:Byte; | 
 
 
 
 
 | 551 | BEGIN | 
 
 
 
 
 | 552 | {    IF structs.Row>0 THEN BEGIN | 
 
 
 
 
 | 553 | offset:=structure_infos[GetStructureInfoId(GetFileInfo(fileid).extension)].entries[structs.Row-1].offset; | 
 
 
 
 
 | 554 | length:=GetTypeDataLength(structure_infos[GetStructureInfoId(GetFileInfo(fileid).extension)].entries[structs.Row-1].datatype); | 
 
 
 
 
 | 555 | hex.SelStart:=offset; | 
 
 
 
 
 | 556 | hex.SelEnd:=offset+length-1; | 
 
 
 
 
 | 557 | END; | 
 
 
 
 
 | 558 | }  END; | 
 
 
 
 
 | 559 |  | 
 
 
 
 
 | 560 | PROCEDURE TForm8.panel_dataResize(Sender: TObject); | 
 
 
 
 
 | 561 | BEGIN | 
 
 
 
 
 | 562 | {    structs.ColWidths[4]:=structs.Width-structs.ColWidths[0]-structs.ColWidths[1]-structs.ColWidths[2]-structs.ColWidths[3]-28; | 
 
 
 
 
 | 563 | value_viewer.ColWidths[1]:=value_viewer.Width-value_viewer.ColWidths[0]-28; | 
 
 
 
 
 | 564 | }  END; | 
 
 
 
 
 | 565 |  | 
 
 
 
 
 | 566 | PROCEDURE TForm8.hexChange(Sender: TObject); | 
 
 
 
 
 | 567 | BEGIN | 
 
 
 
 
 | 568 | ClearValues; | 
 
 
 
 
 | 569 | IF hex.DataSize>0 THEN BEGIN | 
 
 
 
 
 | 570 | //      WriteStructureInfos(GetStructureInfoId(GetFileInfo(fileid).Extension)); | 
 
 
 
 
 | 571 | WriteValues; | 
 
 
 
 
 | 572 | END; | 
 
 
 
 
 | 573 | END; | 
 
 
 
 
 | 574 |  | 
 
 
 
 
 | 575 | PROCEDURE TForm8.hexKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); | 
 
 
 
 
 | 576 | VAR | 
 
 
 
 
 | 577 | temps: String; | 
 
 
 
 
 | 578 | BEGIN | 
 
 
 
 
 | 579 | IF (Shift=[ssCtrl]) AND (Key=Ord('C')) THEN BEGIN | 
 
 
 
 
 | 580 | IF hex.SelCount>0 THEN BEGIN | 
 
 
 
 
 | 581 | IF hex.InCharField THEN | 
 
 
 
 
 | 582 | Clipboard.AsText:=hex.SelectionAsText | 
 
 
 
 
 | 583 | ELSE | 
 
 
 
 
 | 584 | Clipboard.AsText:=hex.SelectionAsHex; | 
 
 
 
 
 | 585 | END; | 
 
 
 
 
 | 586 | END; | 
 
 
 
 
 | 587 | IF (Shift=[ssCtrl]) AND (Key=Ord('V')) THEN BEGIN | 
 
 
 
 
 | 588 | {      temps:=Clipboard.AsText; | 
 
 
 
 
 | 589 | IF hex.SelStart+Length(temps)>hex.DataSize THEN | 
 
 
 
 
 | 590 | SetLength(temps, hex.DataSize-hex.SelStart); | 
 
 
 
 
 | 591 | hex.Sel | 
 
 
 
 
 | 592 | hex.SelCount:=Length(temps); | 
 
 
 
 
 | 593 | hex.ReplaceSelection(temps,Length(temps)); | 
 
 
 
 
 | 594 | }    END; | 
 
 
 
 
 | 595 | END; | 
 
 
 
 
 | 596 |  | 
 
 
 
 
 | 597 | PROCEDURE TForm8.hexSelectionChanged(Sender: TObject); | 
 
 
 
 
 | 598 | VAR | 
 
 
 
 
 | 599 | selstart:Integer; | 
 
 
 
 
 | 600 | i,j:Word; | 
 
 
 
 
 | 601 | BEGIN | 
 
 
 
 
 | 602 | {    FOR i:=1 TO structs.RowCount-1 DO BEGIN | 
 
 
 
 
 | 603 | FOR j:=0 TO structs.ColCount-1 DO BEGIN | 
 
 
 
 
 | 604 | structs.CellColors[j,i]:=clWhite; | 
 
 
 
 
 | 605 | structs.CellFontColors[j,i]:=clBlack; | 
 
 
 
 
 | 606 | END; | 
 
 
 
 
 | 607 | END; | 
 
 
 
 
 | 608 | IF hex.DataSize>0 THEN BEGIN | 
 
 
 
 
 | 609 | selstart:=hex.SelStart; | 
 
 
 
 
 | 610 | IF GetStructureInfoId(GetFileInfo(fileid).Extension)>=0 THEN BEGIN | 
 
 
 
 
 | 611 | WITH structure_infos[GetStructureInfoId(GetFileInfo(fileid).Extension)] DO BEGIN | 
 
 
 
 
 | 612 | FOR i:=0 TO High(entries) DO BEGIN | 
 
 
 
 
 | 613 | IF ((selstart-entries[i].offset)<GetTypeDataLength(entries[i].datatype)) AND ((selstart-entries[i].offset)>=0) THEN BEGIN | 
 
 
 
 
 | 614 | FOR j:=0 TO structs.ColCount-1 DO BEGIN | 
 
 
 
 
 | 615 | structs.CellColors[j,i+1]:=clBlue; | 
 
 
 
 
 | 616 | structs.CellFontColors[j,i+1]:=clWhite; | 
 
 
 
 
 | 617 | END; | 
 
 
 
 
 | 618 | structs.Row:=i+1; | 
 
 
 
 
 | 619 | END; | 
 
 
 
 
 | 620 | END; | 
 
 
 
 
 | 621 | END; | 
 
 
 
 
 | 622 | END; | 
 
 
 
 
 | 623 | WriteValues; | 
 
 
 
 
 | 624 | END; | 
 
 
 
 
 | 625 | }  END; | 
 
 
 
 
 | 626 |  | 
 
 
 
 
 | 627 | PROCEDURE TForm8.FormClose(Sender: TObject; var Action: TCloseAction); | 
 
 
 
 
 | 628 | BEGIN | 
 
 
 
 
 | 629 | Action:=caFree; | 
 
 
 
 
 | 630 | Form1.close_window(Self.Name); | 
 
 
 
 
 | 631 | END; | 
 
 
 
 
 | 632 |  | 
 
 
 
 
 | 633 | PROCEDURE TForm8.panel_imexportResize(Sender: TObject); | 
 
 
 
 
 | 634 | BEGIN | 
 
 
 
 
 | 635 | btn_import.Width:=panel_imexport.Width-8; | 
 
 
 
 
 | 636 | btn_export.Width:=panel_imexport.Width-8; | 
 
 
 
 
 | 637 | END; | 
 
 
 
 
 | 638 |  | 
 
 
 
 
 | 639 | PROCEDURE TForm8.btn_exportClick(Sender: TObject); | 
 
 
 
 
 | 640 | BEGIN | 
 
 
 
 
 | 641 | saved.Filter:='Files of matching extension (*.'+GetFileInfo(fileid).Extension+')|*.'+dat_files[fileid].Extension+'|All files|*.*'; | 
 
 
 
 
 | 642 | saved.DefaultExt:=GetFileInfo(fileid).Extension; | 
 
 
 
 
 | 643 | IF saved.Execute THEN BEGIN | 
 
 
 
 
 | 644 | ExportDatFile(fileid,saved.FileName); | 
 
 
 
 
 | 645 | END; | 
 
 
 
 
 | 646 | END; | 
 
 
 
 
 | 647 |  | 
 
 
 
 
 | 648 | PROCEDURE TForm8.btn_importClick(Sender: TObject); | 
 
 
 
 
 | 649 | VAR | 
 
 
 
 
 | 650 | data:Tdata; | 
 
 
 
 
 | 651 | fs:TFileStream; | 
 
 
 
 
 | 652 | BEGIN | 
 
 
 
 
 | 653 | opend.Filter:='Files of matching extension (*.'+GetFileInfo(fileid).Extension+')|*.'+dat_files[fileid].Extension+'|All files|*.*'; | 
 
 
 
 
 | 654 | IF opend.Execute THEN BEGIN | 
 
 
 
 
 | 655 | fs:=TFileStream.Create(opend.FileName,fmOpenRead); | 
 
 
 
 
 | 656 | IF fs.Size<>hex.DataSize THEN BEGIN | 
 
 
 
 
 | 657 | ShowMessage('Can''t import '+ExtractFilename(opend.FileName)+ | 
 
 
 
 
 | 658 | ', file has to have same size as file in .dat.'+CrLf+ | 
 
 
 
 
 | 659 | 'Size of file in .dat: '+FormatFileSize(hex.datasize)+CrLf+ | 
 
 
 
 
 | 660 | 'Size of chosen file: '+FormatFileSize(fs.Size)); | 
 
 
 
 
 | 661 | END ELSE BEGIN | 
 
 
 
 
 | 662 | hex.LoadFromStream(fs); | 
 
 
 
 
 | 663 | hex.Modified:=True; | 
 
 
 
 
 | 664 | END; | 
 
 
 
 
 | 665 | fs.Free; | 
 
 
 
 
 | 666 | END; | 
 
 
 
 
 | 667 | END; | 
 
 
 
 
 | 668 |  | 
 
 
 
 
 | 669 | PROCEDURE TForm8.FormActivate(Sender: TObject); | 
 
 
 
 
 | 670 | BEGIN | 
 
 
 
 
 | 671 | Form1.SetActiveWindow(Self.Name); | 
 
 
 
 
 | 672 | END; | 
 
 
 
 
 | 673 |  | 
 
 
 
 
 | 674 | PROCEDURE TForm8.value_viewer_contextPopup(Sender: TObject); | 
 
 
 
 
 | 675 | VAR | 
 
 
 
 
 | 676 | i:Byte; | 
 
 
 
 
 | 677 | BEGIN | 
 
 
 
 
 | 678 | FOR i:=0 TO value_viewer_context.Items.Count-1 DO | 
 
 
 
 
 | 679 | value_viewer_context.Items.Items[i].Visible:=False; | 
 
 
 
 
 | 680 | WITH value_viewer DO BEGIN | 
 
 
 
 
 | 681 | IF (Col=1) AND (Row>0) AND (Length(Cells[Col,Row])>0) THEN BEGIN | 
 
 
 
 
 | 682 | IF Pos(' byte',Cells[0,Row])=2 THEN BEGIN | 
 
 
 
 
 | 683 | value_viewer_context.Items.Find('Copy to &clipboard').Visible:=True; | 
 
 
 
 
 | 684 | value_viewer_context.Items.Find('Copy to clipboard (as &dec)').Visible:=True; | 
 
 
 
 
 | 685 | value_viewer_context.Items.Find('Copy to clipboard (as &hex)').Visible:=True; | 
 
 
 
 
 | 686 | END; | 
 
 
 
 
 | 687 | IF Pos('Float',Cells[0,Row])=1 THEN | 
 
 
 
 
 | 688 | value_viewer_context.Items.Find('Copy to clipboard (as &float)').Visible:=True; | 
 
 
 
 
 | 689 | IF Pos('Bitset',Cells[0,Row])=1 THEN | 
 
 
 
 
 | 690 | value_viewer_context.Items.Find('Copy to clipboard (as &bitset)').Visible:=True; | 
 
 
 
 
 | 691 | IF Pos('String',Cells[0,Row])=1 THEN | 
 
 
 
 
 | 692 | value_viewer_context.Items.Find('Copy to clipboard (as &string)').Visible:=True; | 
 
 
 
 
 | 693 | IF Pos('Selected length',Cells[0,Row])=1 THEN | 
 
 
 
 
 | 694 | value_viewer_context.Items.Find('Copy to &clipboard').Visible:=True; | 
 
 
 
 
 | 695 | END; | 
 
 
 
 
 | 696 | END; | 
 
 
 
 
 | 697 | END; | 
 
 
 
 
 | 698 |  | 
 
 
 
 
 | 699 | PROCEDURE TForm8.value_viewerMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); | 
 
 
 
 
 | 700 | VAR | 
 
 
 
 
 | 701 | ACol,ARow:Integer; | 
 
 
 
 
 | 702 | BEGIN | 
 
 
 
 
 | 703 | IF Button=mbRight THEN BEGIN | 
 
 
 
 
 | 704 | value_viewer.MouseToCell(x,y,ACol,ARow); | 
 
 
 
 
 | 705 | IF ARow>0 THEN BEGIN | 
 
 
 
 
 | 706 | value_viewer.Col:=ACol; | 
 
 
 
 
 | 707 | value_viewer.Row:=ARow; | 
 
 
 
 
 | 708 | END; | 
 
 
 
 
 | 709 | END; | 
 
 
 
 
 | 710 | END; | 
 
 
 
 
 | 711 |  | 
 
 
 
 
 | 712 | PROCEDURE TForm8.value_viewer_context_copyClick(Sender: TObject); | 
 
 
 
 
 | 713 | VAR | 
 
 
 
 
 | 714 | i:Byte; | 
 
 
 
 
 | 715 | name:String; | 
 
 
 
 
 | 716 | value:LongWord; | 
 
 
 
 
 | 717 | BEGIN | 
 
 
 
 
 | 718 | name:=TMenuItem(Sender).Name; | 
 
 
 
 
 | 719 | IF Pos('asstring',name)>0 THEN BEGIN | 
 
 
 
 
 | 720 | Clipboard.AsText:=value_viewer.Cells[value_viewer.Col,value_viewer.Row]; | 
 
 
 
 
 | 721 | END ELSE | 
 
 
 
 
 | 722 | IF Pos('asfloat',name)>0 THEN BEGIN | 
 
 
 
 
 | 723 | Clipboard.AsText:=value_viewer.Cells[value_viewer.Col,value_viewer.Row]; | 
 
 
 
 
 | 724 | END ELSE | 
 
 
 
 
 | 725 | IF Pos('asbitset',name)>0 THEN BEGIN | 
 
 
 
 
 | 726 | Clipboard.AsText:=value_viewer.Cells[value_viewer.Col,value_viewer.Row]; | 
 
 
 
 
 | 727 | END ELSE | 
 
 
 
 
 | 728 | IF (Pos('ashex',name)>0) OR (Pos('asdec',name)>0) THEN BEGIN | 
 
 
 
 
 | 729 | IF value_viewer.Cells[0,value_viewer.Row]='1 byte, unsigned' THEN BEGIN | 
 
 
 
 
 | 730 | IF ((hex.SelCount=1) OR (hex.SelCount=0)) AND NOT ((hex.SelStart+1)>hex.DataSize) THEN | 
 
 
 
 
 | 731 | value:=hex.Data[hex.SelStart]; | 
 
 
 
 
 | 732 | END; | 
 
 
 
 
 | 733 | IF value_viewer.Cells[0,value_viewer.Row]='2 bytes, unsigned' THEN BEGIN | 
 
 
 
 
 | 734 | IF ((hex.SelCount=2) OR (hex.SelCount=0)) AND NOT ((hex.SelStart+2)>hex.DataSize) THEN | 
 
 
 
 
 | 735 | value:=hex.Data[hex.SelStart] + hex.Data[hex.SelStart+1]*256; | 
 
 
 
 
 | 736 | END; | 
 
 
 
 
 | 737 | IF value_viewer.Cells[0,value_viewer.Row]='4 bytes, unsigned' THEN BEGIN | 
 
 
 
 
 | 738 | IF ((hex.SelCount=4) OR (hex.SelCount=0)) AND NOT ((hex.SelStart+4)>hex.DataSize) THEN | 
 
 
 
 
 | 739 | value:=hex.Data[hex.SelStart]+hex.Data[hex.SelStart+1]*256+hex.Data[hex.SelStart+2]*256*256+hex.Data[hex.SelStart+3]*256*256*256; | 
 
 
 
 
 | 740 | END; | 
 
 
 
 
 | 741 | IF Pos('asdec',name)>0 THEN BEGIN | 
 
 
 
 
 | 742 | Clipboard.AsText:=IntToStr(value); | 
 
 
 
 
 | 743 | END ELSE BEGIN | 
 
 
 
 
 | 744 | IF value_viewer.Cells[0,value_viewer.Row]='1 byte, unsigned' THEN | 
 
 
 
 
 | 745 | Clipboard.AsText:='0x'+IntToHex(value,2); | 
 
 
 
 
 | 746 | IF value_viewer.Cells[0,value_viewer.Row]='2 bytes, unsigned' THEN | 
 
 
 
 
 | 747 | Clipboard.AsText:='0x'+IntToHex(value,4); | 
 
 
 
 
 | 748 | IF value_viewer.Cells[0,value_viewer.Row]='4 bytes, unsigned' THEN | 
 
 
 
 
 | 749 | Clipboard.AsText:='0x'+IntToHex(value,8); | 
 
 
 
 
 | 750 | END; | 
 
 
 
 
 | 751 | END ELSE BEGIN | 
 
 
 
 
 | 752 | Clipboard.AsText:=value_viewer.Cells[value_viewer.Col,value_viewer.Row]; | 
 
 
 
 
 | 753 | END; | 
 
 
 
 
 | 754 | END; | 
 
 
 
 
 | 755 |  | 
 
 
 
 
 | 756 | procedure TForm8.VSTDblClick(Sender: TObject); | 
 
 
 
 
 | 757 | var | 
 
 
 
 
 | 758 | node:PVirtualNode; | 
 
 
 
 
 | 759 | nodedata:PNodeData; | 
 
 
 
 
 | 760 | begin | 
 
 
 
 
 | 761 | if VST.FocusedColumn=3 then begin | 
 
 
 
 
 | 762 | node:=VST.FocusedNode; | 
 
 
 
 
 | 763 | nodedata:=VST.GetNodeData(node); | 
 
 
 
 
 | 764 |  | 
 
 
 
 
 | 765 | IF NOT (nodedata.datatype IN [11,12]) THEN BEGIN | 
 
 
 
 
 | 766 | Form12.MakeVarInput(nodedata.Caption,nodedata.offset,nodedata.datatype,nodedata.value,Self); | 
 
 
 
 
 | 767 | END ELSE BEGIN | 
 
 
 
 
 | 768 | IF nodedata.DataType=11 THEN BEGIN | 
 
 
 
 
 | 769 | IF GetRawInfo(fileid,nodedata.offset).raw_size>0 THEN BEGIN | 
 
 
 
 
 | 770 | IF Form1.open_child('rawedit') THEN BEGIN | 
 
 
 
 
 | 771 | TForm13(Form1.ActiveMDIChild).LoadRaw(GetRawInfo(fileid,nodedata.offset)); | 
 
 
 
 
 | 772 | END; | 
 
 
 
 
 | 773 | END; | 
 
 
 
 
 | 774 | END; | 
 
 
 
 
 | 775 | IF nodedata.DataType=12 THEN BEGIN | 
 
 
 
 
 | 776 | IF (StrToInt(nodedata.Value)<GetFilesCount) AND | 
 
 
 
 
 | 777 | (StrToInt(nodedata.Value)>0) AND | 
 
 
 
 
 | 778 | (StrToInt(nodedata.Value)<>fileid) THEN BEGIN | 
 
 
 
 
 | 779 | IF GetFileInfo(StrToInt(nodedata.Value)).Size>0 THEN BEGIN | 
 
 
 
 
 | 780 | IF Form1.open_child('binedit') THEN BEGIN | 
 
 
 
 
 | 781 | TForm8(Form1.ActiveMDIChild).LoadDat(StrToInt(nodedata.Value)); | 
 
 
 
 
 | 782 | END; | 
 
 
 
 
 | 783 | END ELSE BEGIN | 
 
 
 
 
 | 784 | ShowMessage('Linked filed is a zero-byte-file'); | 
 
 
 
 
 | 785 | END; | 
 
 
 
 
 | 786 | END; | 
 
 
 
 
 | 787 | END; | 
 
 
 
 
 | 788 | END; | 
 
 
 
 
 | 789 |  | 
 
 
 
 
 | 790 | end; | 
 
 
 
 
 | 791 | end; | 
 
 
 
 
 | 792 |  | 
 
 
 
 
 | 793 | procedure TForm8.VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 | 794 | Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString); | 
 
 
 
 
 | 795 | var | 
 
 
 
 
 | 796 | data:PNodeData; | 
 
 
 
 
 | 797 | begin | 
 
 
 
 
 | 798 | data := Sender.GetNodeData(Node); | 
 
 
 
 
 | 799 | CellText := ''; | 
 
 
 
 
 | 800 | if TextType = ttNormal then begin | 
 
 
 
 
 | 801 | case Column of | 
 
 
 
 
 | 802 | 0: CellText := data.Caption; | 
 
 
 
 
 | 803 | 1: | 
 
 
 
 
 | 804 | if data.DataType>0 then | 
 
 
 
 
 | 805 | CellText := '0x'+IntToHex(data.Offset,8); | 
 
 
 
 
 | 806 | 2: | 
 
 
 
 
 | 807 | if data.DataType>0 then | 
 
 
 
 
 | 808 | CellText := GetDataType(data.DataType); | 
 
 
 
 
 | 809 | 3: | 
 
 
 
 
 | 810 | CellText := GetValue(data.DataType, data.Offset); | 
 
 
 
 
 | 811 | 4: | 
 
 
 
 
 | 812 | CellText := data.Description; | 
 
 
 
 
 | 813 | end; | 
 
 
 
 
 | 814 | end; | 
 
 
 
 
 | 815 | end; | 
 
 
 
 
 | 816 |  | 
 
 
 
 
 | 817 | procedure TForm8.VSTHeaderDragged(Sender: TVTHeader; Column: TColumnIndex; | 
 
 
 
 
 | 818 | OldPosition: Integer); | 
 
 
 
 
 | 819 | begin | 
 
 
 
 
 | 820 | if Sender.Columns.Items[column].Position<1 then | 
 
 
 
 
 | 821 | Sender.Columns.Items[column].Position:=OldPosition; | 
 
 
 
 
 | 822 | end; | 
 
 
 
 
 | 823 |  | 
 
 
 
 
 | 824 | procedure TForm8.VSTNewText(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 | 825 | Column: TColumnIndex; NewText: WideString); | 
 
 
 
 
 | 826 | var | 
 
 
 
 
 | 827 | Data: PNodeData; | 
 
 
 
 
 | 828 | begin | 
 
 
 
 
 | 829 | data:=Sender.GetNodeData(Node); | 
 
 
 
 
 | 830 | {    case column of | 
 
 
 
 
 | 831 | 3: data.Value:=Text; | 
 
 
 
 
 | 832 | end; | 
 
 
 
 
 | 833 | }  end; | 
 
 
 
 
 | 834 |  | 
 
 
 
 
 | 835 | procedure TForm8.VTHPopupColumnChange(const Sender: TBaseVirtualTree; | 
 
 
 
 
 | 836 | const Column: TColumnIndex; Visible: Boolean); | 
 
 
 
 
 | 837 | begin | 
 
 
 
 
 | 838 | if column=0 then | 
 
 
 
 
 | 839 | TVirtualStringTree(Sender).Header.Columns.Items[column].Options:=TVirtualStringTree(Sender).Header.Columns.Items[column].Options+[coVisible]; | 
 
 
 
 
 | 840 | end; | 
 
 
 
 
 | 841 |  | 
 
 
 
 
 | 842 | PROCEDURE TForm8.structsDblClick(Sender: TObject); | 
 
 
 
 
 | 843 | VAR | 
 
 
 
 
 | 844 | offset:LongWord; | 
 
 
 
 
 | 845 | datatype:Word; | 
 
 
 
 
 | 846 | objectname:String; | 
 
 
 
 
 | 847 | value:String; | 
 
 
 
 
 | 848 | BEGIN | 
 
 
 
 
 | 849 | (*    IF (structs.Row>0) AND (structs.Cells[structs.Col,0]='Value') THEN BEGIN | 
 
 
 
 
 | 850 | offset:=structure_infos[GetStructureInfoId(GetFileInfo(fileid).extension)].entries[structs.Row-1].offset; | 
 
 
 
 
 | 851 | datatype:=structure_infos[GetStructureInfoId(GetFileInfo(fileid).extension)].entries[structs.Row-1].datatype; | 
 
 
 
 
 | 852 | IF datatype<>11 THEN BEGIN | 
 
 
 
 
 | 853 | objectname:=structure_infos[GetStructureInfoId(GetFileInfo(fileid).extension)].entries[structs.Row-1].name; | 
 
 
 
 
 | 854 | value:=GetValue(datatype,offset); | 
 
 
 
 
 | 855 | Form12.MakeVarInput(objectname,offset,datatype,value,Self); | 
 
 
 
 
 | 856 | END ELSE BEGIN | 
 
 
 
 
 | 857 | IF GetRawInfo(fileid,offset).raw_size>0 THEN BEGIN | 
 
 
 
 
 | 858 | //edit_filtername.Text:=IntToStr(GetRawInfo(fileid,offset).raw_size); | 
 
 
 
 
 | 859 | IF Form1.open_child('rawedit') THEN BEGIN | 
 
 
 
 
 | 860 | TForm13(Form1.ActiveMDIChild).LoadRaw(GetRawInfo(fileid,offset)); | 
 
 
 
 
 | 861 | END; | 
 
 
 
 
 | 862 | END; | 
 
 
 
 
 | 863 | {LOAD RAW-EDITOR} | 
 
 
 
 
 | 864 | END; | 
 
 
 
 
 | 865 | END; | 
 
 
 
 
 | 866 | *)  END; | 
 
 
 
 
 | 867 |  | 
 
 
 
 
 | 868 | PROCEDURE TForm8.SetNewValue(datatype:Word; offset:LongWord; value:String); | 
 
 
 
 
 | 869 | VAR | 
 
 
 
 
 | 870 | data:Tdata; | 
 
 
 
 
 | 871 | value_int:LongWord; | 
 
 
 
 
 | 872 | value_float:Single; | 
 
 
 
 
 | 873 | i:Word; | 
 
 
 
 
 | 874 | BEGIN | 
 
 
 
 
 | 875 | CASE datatype OF | 
 
 
 
 
 | 876 | 1..4: BEGIN | 
 
 
 
 
 | 877 | value_int:=StrToInt(value); | 
 
 
 
 
 | 878 | SetLength(data,datatype); | 
 
 
 
 
 | 879 | FOR i:=0 TO datatype-1 DO BEGIN | 
 
 
 
 
 | 880 | data[i]:=value_int MOD 256; | 
 
 
 
 
 | 881 | value_int:=value_int DIV 256; | 
 
 
 
 
 | 882 | END; | 
 
 
 
 
 | 883 | END; | 
 
 
 
 
 | 884 | 5..8: BEGIN | 
 
 
 
 
 | 885 | value_int:=StrToInt('$'+value); | 
 
 
 
 
 | 886 | SetLength(data,datatype-4); | 
 
 
 
 
 | 887 | FOR i:=0 TO datatype-5 DO BEGIN | 
 
 
 
 
 | 888 | data[i]:=value_int MOD 256; | 
 
 
 
 
 | 889 | value_int:=value_int DIV 256; | 
 
 
 
 
 | 890 | END; | 
 
 
 
 
 | 891 | END; | 
 
 
 
 
 | 892 | 9:    BEGIN | 
 
 
 
 
 | 893 | value_float:=StrToFloat(value); | 
 
 
 
 
 | 894 | data:=Encode_Float(value_float); | 
 
 
 
 
 | 895 | END; | 
 
 
 
 
 | 896 | 10:   BEGIN | 
 
 
 
 
 | 897 | value_int:=BinToInt(value); | 
 
 
 
 
 | 898 | SetLength(data,1); | 
 
 
 
 
 | 899 | data[0]:=value_int; | 
 
 
 
 
 | 900 | END; | 
 
 
 
 
 | 901 | 10000..65535: BEGIN | 
 
 
 
 
 | 902 | SetLength(data,datatype-10000); | 
 
 
 
 
 | 903 | FOR i:=1 TO datatype-10000 DO BEGIN | 
 
 
 
 
 | 904 | IF i<=Length(value) THEN | 
 
 
 
 
 | 905 | data[i-1]:=Ord(value[i]) | 
 
 
 
 
 | 906 | ELSE | 
 
 
 
 
 | 907 | data[i-1]:=0; | 
 
 
 
 
 | 908 | END; | 
 
 
 
 
 | 909 | END; | 
 
 
 
 
 | 910 | END; | 
 
 
 
 
 | 911 | FOR i:=0 TO High(data) DO BEGIN | 
 
 
 
 
 | 912 | IF hex.Data[offset+i]<>data[i] THEN hex.ByteChanged[offset+i]:=True; | 
 
 
 
 
 | 913 | hex.Data[offset+i]:=data[i]; | 
 
 
 
 
 | 914 | END; | 
 
 
 
 
 | 915 | hex.Modified:=True; | 
 
 
 
 
 | 916 | hexChange(Self); | 
 
 
 
 
 | 917 | hex.Repaint; | 
 
 
 
 
 | 918 | END; | 
 
 
 
 
 | 919 |  | 
 
 
 
 
 | 920 | PROCEDURE TForm8.value_viewerDblClick(Sender: TObject); | 
 
 
 
 
 | 921 | VAR | 
 
 
 
 
 | 922 | offset:LongWord; | 
 
 
 
 
 | 923 | datatype:Word; | 
 
 
 
 
 | 924 | objectname:String; | 
 
 
 
 
 | 925 | value:String; | 
 
 
 
 
 | 926 | BEGIN | 
 
 
 
 
 | 927 | IF (value_viewer.Col=1) AND (Length(value_viewer.Cells[1,value_viewer.Row])>0) THEN BEGIN | 
 
 
 
 
 | 928 | offset:=hex.SelStart; | 
 
 
 
 
 | 929 | IF value_viewer.Cells[0,value_viewer.Row]='1 byte, unsigned' THEN | 
 
 
 
 
 | 930 | datatype:=1; | 
 
 
 
 
 | 931 | IF value_viewer.Cells[0,value_viewer.Row]='2 bytes, unsigned' THEN | 
 
 
 
 
 | 932 | datatype:=2; | 
 
 
 
 
 | 933 | IF value_viewer.Cells[0,value_viewer.Row]='4 bytes, unsigned' THEN | 
 
 
 
 
 | 934 | datatype:=4; | 
 
 
 
 
 | 935 | IF value_viewer.Cells[0,value_viewer.Row]='Bitset' THEN | 
 
 
 
 
 | 936 | datatype:=10; | 
 
 
 
 
 | 937 | IF value_viewer.Cells[0,value_viewer.Row]='Float' THEN | 
 
 
 
 
 | 938 | datatype:=9; | 
 
 
 
 
 | 939 | IF value_viewer.Cells[0,value_viewer.Row]='Selected length' THEN | 
 
 
 
 
 | 940 | Exit; | 
 
 
 
 
 | 941 | IF value_viewer.Cells[0,value_viewer.Row]='String' THEN BEGIN | 
 
 
 
 
 | 942 | IF hex.SelCount>0 THEN | 
 
 
 
 
 | 943 | datatype:=10000+hex.SelCount | 
 
 
 
 
 | 944 | ELSE | 
 
 
 
 
 | 945 | datatype:=10000+Length(value_viewer.Cells[1,value_viewer.Row]); | 
 
 
 
 
 | 946 | END; | 
 
 
 
 
 | 947 | objectname:=''; | 
 
 
 
 
 | 948 | value:=GetValue(datatype,offset); | 
 
 
 
 
 | 949 | Form12.MakeVarInput(objectname,offset,datatype,value,Self); | 
 
 
 
 
 | 950 | END; | 
 
 
 
 
 | 951 | END; | 
 
 
 
 
 | 952 |  | 
 
 
 
 
 | 953 | PROCEDURE TForm8.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); | 
 
 
 
 
 | 954 | BEGIN | 
 
 
 
 
 | 955 | IF (Shift=[ssCtrl]) AND (Key=83) THEN | 
 
 
 
 
 | 956 | IF hex.Modified THEN | 
 
 
 
 
 | 957 | IF NOT Save THEN | 
 
 
 
 
 | 958 | Exit; | 
 
 
 
 
 | 959 | END; | 
 
 
 
 
 | 960 |  | 
 
 
 
 
 | 961 |  | 
 
 
 
 
 | 962 | END. |