--- oup/current/Tools/BinEdit.pas 2007/02/21 03:28:48 111 +++ oup/current/Tools/BinEdit.pas 2007/05/02 15:16:00 174 @@ -139,7 +139,6 @@ end; procedure TForm_BinEdit.LoadDat(_fileid: Integer); var mem: TMemoryStream; - Data: TByteData; begin if ConID <> -1 then begin @@ -182,6 +181,7 @@ function TForm_BinEdit.GetValue(datatype var Data: TByteData; i: Word; + tempi: Integer; floatformat: TFormatSettings; begin floatformat.DecimalSeparator := '.'; @@ -217,10 +217,19 @@ begin 10: Result := IntToBin(hex.Data[offset]); 11: - Result := '0x' + IntToHex(ConManager.Connection[ConID].GetRawInfo(fileid, offset).RawAddr, 8); + begin + tempi := ConManager.Connection[ConID].GetRawInfo(fileid, offset).RawAddr; + if tempi >= 0 then + Result := '0x' + IntToHex(tempi, 8) + else + Result := 'unused'; + end; 12: - Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 + - hex.Data[offset + 3] * 256 * 256, 5, '0'); + if hex.Data[offset] = 1 then + Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 + + hex.Data[offset + 3] * 256 * 256, 5, '0') + else + Result := 'no link'; 13: Result := IntToStr(hex.Data[offset]); 14: @@ -307,8 +316,8 @@ begin begin if Pos('#', SubName) > 0 then begin - Data.Offset := HexToLong(MidStr(SubName, Pos('#', SubName) + 1, 8)); - Data.Value := + Data.Offset := StrToInt('$'+MidStr(SubName, Pos('#', SubName) + 1, 8)); + Data.Value := '$' + MidStr(SubName, PosEx('#', SubName, Pos('#', SubName) + 1) + 1, 8); Data.Caption := MidStr(SubName, 1, Pos('#', SubName) - 1); Data.Description := SubDesc; @@ -458,8 +467,10 @@ begin str := ''; if hex.SelCount = 0 then begin - while (hex.Data[hex.SelStart + j] > 0) and ((hex.SelStart + j) < hex.DataSize) do + while (hex.SelStart + j) < hex.DataSize do begin + if hex.Data[hex.SelStart + j] = 0 then + Break; if hex.Data[hex.selstart + j] >= 32 then str := str + Char(hex.Data[hex.SelStart + j]) else @@ -748,12 +759,12 @@ begin end else begin - if nodedata.DataType = 11 then + if (nodedata.DataType = 11) and (nodedata.Value <> 'unused') then begin if ConManager.Connection[ConID].GetRawInfo(fileid, nodedata.offset).RawSize > 0 then Form_Main.open_child('rawedit', ConID, fileid); end; - if nodedata.DataType = 12 then + if (nodedata.DataType = 12) and (nodedata.Value <> 'no link') then begin if (StrToInt(nodedata.Value) < ConManager.Connection[ConID].GetFileCount) and (StrToInt(nodedata.Value) > 0) and @@ -793,7 +804,7 @@ begin else begin hex.SelStart := Data.Offset; - hex.SelEnd := Data.Offset + HexToLong(Data.Value) - 1; + hex.SelEnd := Data.Offset + StrToInt(Data.Value) - 1; end; end; @@ -824,7 +835,7 @@ begin if Data.DataType > 0 then CellText := Data.Value //GetValue(data.DataType, data.Offset) else if Length(Data.Value) > 0 then - CellText := IntToStr(HexToLong(Data.Value)) + ' Bytes'; + CellText := IntToStr(StrToInt(Data.Value)) + ' Bytes'; 4: CellText := Data.Description; end;