--- oup/current/Tools/RawEdit.pas 2007/02/25 17:20:22 113 +++ oup/current/Tools/RawEdit.pas 2007/05/17 15:08:29 180 @@ -101,7 +101,6 @@ end; procedure TForm_RawEdit.LoadRaw(raw_info: TRawDataInfo); var i: Integer; - mem: TMemoryStream; begin if hex.Modified then begin @@ -110,31 +109,24 @@ begin Exit; end; end; - if list_offset.Count = 0 then + for i := 0 to filelist.Count - 1 do begin - for i := 0 to filelist.Count - 1 do + if ConManager.Connection[ConnectionID].ExtractFileIDOfName(filelist.Items.Strings[i]) = Raw_Info.SrcID then begin - if ConManager.Connection[ConnectionID].ExtractFileIDOfName(filelist.Items.Strings[i]) = Raw_Info.SrcID then - begin - filelist.ItemIndex := i; - listClick(Self); - Break; - end; + filelist.ItemIndex := i; + listClick(Self); + Break; end; - for i := 0 to list_offset.Count - 1 do + end; + for i := 0 to list_offset.Count - 1 do + begin + if MidStr(list_offset.Items.Strings[i], 3, 8) = IntToHex(raw_info.SrcOffset, 8) then begin - if MidStr(list_offset.Items.Strings[i], 3, 8) = IntToHex(raw_info.SrcOffset, 8) then - begin - list_offset.ItemIndex := i; - Break; - end; + list_offset.ItemIndex := i; + list_offsetClick(Self); + Break; end; end; - mem := nil; - ConManager.Connection[ConnectionID].LoadRawFile(raw_info.SrcID, raw_info.SrcOffset, TStream(mem)); - hex.LoadFromStream(mem); - ClearValues; - hexSelectionChanged(Self); end; @@ -143,11 +135,20 @@ end; procedure TForm_RawEdit.list_offsetClick(Sender: TObject); +var + mem: TMemoryStream; + rawinfo: TRawDataInfo; begin - ClearValues; datoffset := StrToInt('$' + MidStr( list_offset.Items.Strings[list_offset.ItemIndex], 3, 8)); - LoadRaw(ConManager.Connection[ConnectionID].GetRawInfo(fileid, datoffset)); + + rawinfo := ConManager.Connection[ConnectionID].GetRawInfo(fileid, datoffset); + + mem := nil; + ConManager.Connection[ConnectionID].LoadRawFile(rawinfo.SrcID, rawinfo.SrcOffset, TStream(mem)); + hex.LoadFromStream(mem); + ClearValues; + hexSelectionChanged(Self); end; @@ -310,8 +311,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 @@ -536,7 +539,10 @@ begin fs := TFileStream.Create(opend.FileName, fmOpenRead); if fs.Size <> hex.DataSize then begin - if (not (CR_ResizeRaw in ConManager.Connection[ConnectionID].ChangeRights)) and (not (CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights)) then + if + (not (CR_ResizeRaw in ConManager.Connection[ConnectionID].ChangeRights)) + and (not (CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights)) + then begin ShowMessage('Can''t import ' + ExtractFilename(importd.FileName) + ', file has to have same size as file in .raw with this backend.' + CrLf +