| 58 |
|
private |
| 59 |
|
fileid: Integer; |
| 60 |
|
ConID: Integer; |
| 61 |
+ |
rawlist: TRawDataList; |
| 62 |
|
public |
| 63 |
|
end; |
| 64 |
|
|
| 67 |
|
|
| 68 |
|
implementation |
| 69 |
|
|
| 70 |
< |
uses ValueEdit, Main, Functions, DatStructureLoader{, RawEdit}; |
| 70 |
> |
uses ValueEdit, Main, Functions, DatStructureLoader, RawEdit; |
| 71 |
|
{$R *.dfm} |
| 72 |
|
|
| 73 |
|
type |
| 140 |
|
procedure TForm_BinEdit.LoadDat(_fileid: Integer); |
| 141 |
|
var |
| 142 |
|
mem: TMemoryStream; |
| 142 |
– |
Data: TByteData; |
| 143 |
|
begin |
| 144 |
|
if ConID <> -1 then |
| 145 |
|
begin |
| 161 |
|
Self.ClearStructViewer; |
| 162 |
|
mem := nil; |
| 163 |
|
ConManager.Connection[ConID].LoadDatFile(fileid, TStream(mem)); |
| 164 |
+ |
rawlist := ConManager.Connection[ConID].GetRawList(fileid); |
| 165 |
|
hex.LoadFromStream(mem); |
| 166 |
|
mem.Free; |
| 167 |
|
ClearValues; |
| 174 |
|
Self.ClearStructViewer; |
| 175 |
|
ClearValues; |
| 176 |
|
hex.DataSize := 0; |
| 177 |
+ |
SetLength(rawlist, 0); |
| 178 |
|
end; |
| 179 |
|
end; |
| 180 |
|
|
| 183 |
|
function TForm_BinEdit.GetValue(datatype: Word; offset: Integer): String; |
| 184 |
|
var |
| 185 |
|
Data: TByteData; |
| 186 |
< |
i: Word; |
| 186 |
> |
i: Integer; |
| 187 |
> |
tempi: Integer; |
| 188 |
|
floatformat: TFormatSettings; |
| 189 |
|
begin |
| 190 |
|
floatformat.DecimalSeparator := '.'; |
| 220 |
|
10: |
| 221 |
|
Result := IntToBin(hex.Data[offset]); |
| 222 |
|
11: |
| 223 |
< |
Result := '0x' + IntToHex(ConManager.Connection[ConID].GetRawInfo(fileid, offset).RawAddr, 8); |
| 223 |
> |
begin |
| 224 |
> |
if Length(rawlist) > 0 then |
| 225 |
> |
for i := 0 to High(rawlist) do |
| 226 |
> |
if rawlist[i].SrcOffset = offset then |
| 227 |
> |
begin |
| 228 |
> |
if rawlist[i].RawAddr > 0 then |
| 229 |
> |
Result := '0x' + IntToHex(rawlist[i].RawAddr, 8) |
| 230 |
> |
else |
| 231 |
> |
Result := 'unused'; |
| 232 |
> |
Break; |
| 233 |
> |
end; |
| 234 |
> |
end; |
| 235 |
|
12: |
| 236 |
< |
Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 + |
| 237 |
< |
hex.Data[offset + 3] * 256 * 256, 5, '0'); |
| 236 |
> |
if hex.Data[offset] = 1 then |
| 237 |
> |
Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 + |
| 238 |
> |
hex.Data[offset + 3] * 256 * 256, 5, '0') |
| 239 |
> |
else |
| 240 |
> |
Result := 'no link'; |
| 241 |
|
13: |
| 242 |
|
Result := IntToStr(hex.Data[offset]); |
| 243 |
|
14: |
| 324 |
|
begin |
| 325 |
|
if Pos('#', SubName) > 0 then |
| 326 |
|
begin |
| 327 |
< |
Data.Offset := HexToLong(MidStr(SubName, Pos('#', SubName) + 1, 8)); |
| 328 |
< |
Data.Value := |
| 327 |
> |
Data.Offset := StrToInt('$'+MidStr(SubName, Pos('#', SubName) + 1, 8)); |
| 328 |
> |
Data.Value := '$' + |
| 329 |
|
MidStr(SubName, PosEx('#', SubName, Pos('#', SubName) + 1) + 1, 8); |
| 330 |
|
Data.Caption := MidStr(SubName, 1, Pos('#', SubName) - 1); |
| 331 |
|
Data.Description := SubDesc; |
| 475 |
|
str := ''; |
| 476 |
|
if hex.SelCount = 0 then |
| 477 |
|
begin |
| 478 |
< |
while (hex.Data[hex.SelStart + j] > 0) and ((hex.SelStart + j) < hex.DataSize) do |
| 478 |
> |
while (hex.SelStart + j) < hex.DataSize do |
| 479 |
|
begin |
| 480 |
+ |
if hex.Data[hex.SelStart + j] = 0 then |
| 481 |
+ |
Break; |
| 482 |
|
if hex.Data[hex.selstart + j] >= 32 then |
| 483 |
|
str := str + Char(hex.Data[hex.SelStart + j]) |
| 484 |
|
else |
| 752 |
|
var |
| 753 |
|
node: PVirtualNode; |
| 754 |
|
nodedata: PNodeData; |
| 755 |
+ |
rawinfo: TRawDataInfo; |
| 756 |
|
form: TForm_ToolTemplate; |
| 757 |
|
begin |
| 758 |
|
if VST.FocusedColumn = 3 then |
| 768 |
|
end |
| 769 |
|
else |
| 770 |
|
begin |
| 771 |
< |
if nodedata.DataType = 11 then |
| 771 |
> |
if (nodedata.DataType = 11) and (nodedata.Value <> 'unused') then |
| 772 |
|
begin |
| 773 |
< |
if ConManager.Connection[ConID].GetRawInfo(fileid, nodedata.offset).RawSize > 0 then |
| 774 |
< |
Form_Main.open_child('rawedit', ConID, fileid); |
| 773 |
> |
rawinfo := ConManager.Connection[ConID].GetRawInfo(fileid, nodedata.offset); |
| 774 |
> |
if rawinfo.RawSize > 0 then |
| 775 |
> |
begin |
| 776 |
> |
form := nil; |
| 777 |
> |
form := Form_Main.open_child('rawedit', ConID, fileid); |
| 778 |
> |
if Assigned(form) then |
| 779 |
> |
TForm_RawEdit(form).LoadRaw(rawinfo); |
| 780 |
> |
end; |
| 781 |
|
end; |
| 782 |
< |
if nodedata.DataType = 12 then |
| 782 |
> |
if (nodedata.DataType = 12) and (nodedata.Value <> 'no link') then |
| 783 |
|
begin |
| 784 |
|
if (StrToInt(nodedata.Value) < ConManager.Connection[ConID].GetFileCount) and |
| 785 |
|
(StrToInt(nodedata.Value) > 0) and |
| 819 |
|
else |
| 820 |
|
begin |
| 821 |
|
hex.SelStart := Data.Offset; |
| 822 |
< |
hex.SelEnd := Data.Offset + HexToLong(Data.Value) - 1; |
| 822 |
> |
hex.SelEnd := Data.Offset + StrToInt(Data.Value) - 1; |
| 823 |
|
end; |
| 824 |
|
end; |
| 825 |
|
|
| 850 |
|
if Data.DataType > 0 then |
| 851 |
|
CellText := Data.Value //GetValue(data.DataType, data.Offset) |
| 852 |
|
else if Length(Data.Value) > 0 then |
| 853 |
< |
CellText := IntToStr(HexToLong(Data.Value)) + ' Bytes'; |
| 853 |
> |
CellText := IntToStr(StrToInt(Data.Value)) + ' Bytes'; |
| 854 |
|
4: |
| 855 |
|
CellText := Data.Description; |
| 856 |
|
end; |