--- oup/current/Tools/BinEdit.pas 2007/02/25 17:20:22 113 +++ oup/current/Tools/BinEdit.pas 2007/05/12 13:22:11 177 @@ -58,6 +58,7 @@ type private fileid: Integer; ConID: Integer; + rawlist: TRawDataList; public end; @@ -66,7 +67,7 @@ var implementation -uses ValueEdit, Main, Functions, DatStructureLoader{, RawEdit}; +uses ValueEdit, Main, Functions, DatStructureLoader, RawEdit; {$R *.dfm} type @@ -160,6 +161,7 @@ begin Self.ClearStructViewer; mem := nil; ConManager.Connection[ConID].LoadDatFile(fileid, TStream(mem)); + rawlist := ConManager.Connection[ConID].GetRawList(fileid); hex.LoadFromStream(mem); mem.Free; ClearValues; @@ -172,6 +174,7 @@ begin Self.ClearStructViewer; ClearValues; hex.DataSize := 0; + SetLength(rawlist, 0); end; end; @@ -180,7 +183,7 @@ end; function TForm_BinEdit.GetValue(datatype: Word; offset: Integer): String; var Data: TByteData; - i: Word; + i: Integer; tempi: Integer; floatformat: TFormatSettings; begin @@ -218,11 +221,16 @@ begin Result := IntToBin(hex.Data[offset]); 11: begin - tempi := ConManager.Connection[ConID].GetRawInfo(fileid, offset).RawAddr; - if tempi >= 0 then - Result := '0x' + IntToHex(tempi, 8) - else - Result := 'unused'; + if Length(rawlist) > 0 then + for i := 0 to High(rawlist) do + if rawlist[i].SrcOffset = offset then + begin + if rawlist[i].RawAddr > 0 then + Result := '0x' + IntToHex(rawlist[i].RawAddr, 8) + else + Result := 'unused'; + Break; + end; end; 12: if hex.Data[offset] = 1 then @@ -467,8 +475,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 @@ -742,6 +752,7 @@ procedure TForm_BinEdit.VSTDblClick(Send var node: PVirtualNode; nodedata: PNodeData; + rawinfo: TRawDataInfo; form: TForm_ToolTemplate; begin if VST.FocusedColumn = 3 then @@ -759,8 +770,14 @@ begin begin 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); + rawinfo := ConManager.Connection[ConID].GetRawInfo(fileid, nodedata.offset); + if rawinfo.RawSize > 0 then + begin + form := nil; + form := Form_Main.open_child('rawedit', ConID, fileid); + if Assigned(form) then + TForm_RawEdit(form).LoadRaw(rawinfo); + end; end; if (nodedata.DataType = 12) and (nodedata.Value <> 'no link') then begin