| 33 |
|
|
| 34 |
|
procedure LoadDat(_fileid: Integer); |
| 35 |
|
function Save: Boolean; |
| 36 |
< |
function GetValue(datatype: Word; offset: LongWord): String; |
| 37 |
< |
procedure SetNewValue(datatype: Word; offset: LongWord; Value: String); |
| 36 |
> |
function GetValue(datatype: Word; offset: Integer): String; |
| 37 |
> |
procedure SetNewValue(datatype: Word; offset: Integer; Value: String); |
| 38 |
|
|
| 39 |
|
procedure WriteStructureInfos; |
| 40 |
|
procedure ClearStructViewer; |
| 139 |
|
procedure TForm_BinEdit.LoadDat(_fileid: Integer); |
| 140 |
|
var |
| 141 |
|
mem: TMemoryStream; |
| 142 |
– |
Data: TByteData; |
| 142 |
|
begin |
| 143 |
|
if ConID <> -1 then |
| 144 |
|
begin |
| 177 |
|
|
| 178 |
|
|
| 179 |
|
|
| 180 |
< |
|
| 182 |
< |
function IntToBin(Value: Byte): String; |
| 183 |
< |
var |
| 184 |
< |
i: Byte; |
| 185 |
< |
begin |
| 186 |
< |
Result := ''; |
| 187 |
< |
for i := 7 downto 0 do |
| 188 |
< |
Result := Result + IntToStr((Value shr i) and $01); |
| 189 |
< |
end; |
| 190 |
< |
|
| 191 |
< |
|
| 192 |
< |
|
| 193 |
< |
|
| 194 |
< |
function TForm_BinEdit.GetValue(datatype: Word; offset: LongWord): String; |
| 180 |
> |
function TForm_BinEdit.GetValue(datatype: Word; offset: Integer): String; |
| 181 |
|
var |
| 182 |
|
Data: TByteData; |
| 183 |
|
i: Word; |
| 184 |
+ |
tempi: Integer; |
| 185 |
|
floatformat: TFormatSettings; |
| 186 |
|
begin |
| 187 |
|
floatformat.DecimalSeparator := '.'; |
| 217 |
|
10: |
| 218 |
|
Result := IntToBin(hex.Data[offset]); |
| 219 |
|
11: |
| 220 |
< |
Result := '0x' + IntToHex(ConManager.Connection[ConID].GetRawInfo(fileid, offset).RawAddr, 8); |
| 220 |
> |
begin |
| 221 |
> |
tempi := ConManager.Connection[ConID].GetRawInfo(fileid, offset).RawAddr; |
| 222 |
> |
if tempi >= 0 then |
| 223 |
> |
Result := '0x' + IntToHex(tempi, 8) |
| 224 |
> |
else |
| 225 |
> |
Result := 'unused'; |
| 226 |
> |
end; |
| 227 |
|
12: |
| 228 |
< |
Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 + |
| 229 |
< |
hex.Data[offset + 3] * 256 * 256, 5, '0'); |
| 228 |
> |
if hex.Data[offset] = 1 then |
| 229 |
> |
Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 + |
| 230 |
> |
hex.Data[offset + 3] * 256 * 256, 5, '0') |
| 231 |
> |
else |
| 232 |
> |
Result := 'no link'; |
| 233 |
|
13: |
| 234 |
|
Result := IntToStr(hex.Data[offset]); |
| 235 |
|
14: |
| 282 |
|
|
| 283 |
|
procedure TForm_BinEdit.WriteStructureInfos; |
| 284 |
|
var |
| 285 |
< |
i, j: LongWord; |
| 285 |
> |
i, j: Integer; |
| 286 |
|
pdata: PNodeData; |
| 287 |
|
Data: TNodeData; |
| 288 |
|
node: PVirtualNode; |
| 316 |
|
begin |
| 317 |
|
if Pos('#', SubName) > 0 then |
| 318 |
|
begin |
| 319 |
< |
Data.Offset := HexToLong(MidStr(SubName, Pos('#', SubName) + 1, 8)); |
| 320 |
< |
Data.Value := |
| 319 |
> |
Data.Offset := StrToInt('$'+MidStr(SubName, Pos('#', SubName) + 1, 8)); |
| 320 |
> |
Data.Value := '$' + |
| 321 |
|
MidStr(SubName, PosEx('#', SubName, Pos('#', SubName) + 1) + 1, 8); |
| 322 |
|
Data.Caption := MidStr(SubName, 1, Pos('#', SubName) - 1); |
| 323 |
|
Data.Description := SubDesc; |
| 384 |
|
i, j: Integer; |
| 385 |
|
Data: TByteData; |
| 386 |
|
str: String; |
| 387 |
< |
Value: LongWord; |
| 387 |
> |
Value: Integer; |
| 388 |
|
floatformat: TFormatSettings; |
| 389 |
|
begin |
| 390 |
|
floatformat.DecimalSeparator := '.'; |
| 467 |
|
str := ''; |
| 468 |
|
if hex.SelCount = 0 then |
| 469 |
|
begin |
| 470 |
< |
while (hex.Data[hex.SelStart + j] > 0) and ((hex.SelStart + j) < hex.DataSize) do |
| 470 |
> |
while (hex.SelStart + j) < hex.DataSize do |
| 471 |
|
begin |
| 472 |
+ |
if hex.Data[hex.SelStart + j] = 0 then |
| 473 |
+ |
Break; |
| 474 |
|
if hex.Data[hex.selstart + j] >= 32 then |
| 475 |
|
str := str + Char(hex.Data[hex.SelStart + j]) |
| 476 |
|
else |
| 499 |
|
function TForm_BinEdit.Save: Boolean; |
| 500 |
|
var |
| 501 |
|
mem: TMemoryStream; |
| 502 |
< |
i: LongWord; |
| 502 |
> |
i: Integer; |
| 503 |
|
begin |
| 504 |
|
case MessageBox(Self.Handle, PChar('Save changes to file ' + |
| 505 |
|
ConManager.Connection[ConID].GetFileInfo(fileid).Name + '?'), PChar('Data changed...'), |
| 681 |
|
procedure TForm_BinEdit.value_viewer_context_copyClick(Sender: TObject); |
| 682 |
|
var |
| 683 |
|
Name: String; |
| 684 |
< |
Value: LongWord; |
| 684 |
> |
Value: Integer; |
| 685 |
|
begin |
| 686 |
|
Name := TMenuItem(Sender).Name; |
| 687 |
|
if Pos('asstring', Name) > 0 then |
| 759 |
|
end |
| 760 |
|
else |
| 761 |
|
begin |
| 762 |
< |
if nodedata.DataType = 11 then |
| 762 |
> |
if (nodedata.DataType = 11) and (nodedata.Value <> 'unused') then |
| 763 |
|
begin |
| 764 |
|
if ConManager.Connection[ConID].GetRawInfo(fileid, nodedata.offset).RawSize > 0 then |
| 765 |
|
Form_Main.open_child('rawedit', ConID, fileid); |
| 766 |
|
end; |
| 767 |
< |
if nodedata.DataType = 12 then |
| 767 |
> |
if (nodedata.DataType = 12) and (nodedata.Value <> 'no link') then |
| 768 |
|
begin |
| 769 |
|
if (StrToInt(nodedata.Value) < ConManager.Connection[ConID].GetFileCount) and |
| 770 |
|
(StrToInt(nodedata.Value) > 0) and |
| 804 |
|
else |
| 805 |
|
begin |
| 806 |
|
hex.SelStart := Data.Offset; |
| 807 |
< |
hex.SelEnd := Data.Offset + HexToLong(Data.Value) - 1; |
| 807 |
> |
hex.SelEnd := Data.Offset + StrToInt(Data.Value) - 1; |
| 808 |
|
end; |
| 809 |
|
end; |
| 810 |
|
|
| 835 |
|
if Data.DataType > 0 then |
| 836 |
|
CellText := Data.Value //GetValue(data.DataType, data.Offset) |
| 837 |
|
else if Length(Data.Value) > 0 then |
| 838 |
< |
CellText := IntToStr(HexToLong(Data.Value)) + ' Bytes'; |
| 838 |
> |
CellText := IntToStr(StrToInt(Data.Value)) + ' Bytes'; |
| 839 |
|
4: |
| 840 |
|
CellText := Data.Description; |
| 841 |
|
end; |
| 866 |
|
|
| 867 |
|
|
| 868 |
|
|
| 869 |
< |
procedure TForm_BinEdit.SetNewValue(datatype: Word; offset: LongWord; Value: String); |
| 869 |
> |
procedure TForm_BinEdit.SetNewValue(datatype: Word; offset: Integer; Value: String); |
| 870 |
|
var |
| 871 |
|
Data: TByteData; |
| 872 |
|
value_int: LongWord; |
| 933 |
|
|
| 934 |
|
procedure TForm_BinEdit.value_viewerDblClick(Sender: TObject); |
| 935 |
|
var |
| 936 |
< |
offset: LongWord; |
| 936 |
> |
offset: Integer; |
| 937 |
|
datatype: Word; |
| 938 |
|
objectname: String; |
| 939 |
|
Value: String; |