ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Tools/BinEdit.pas
(Generate patch)

Comparing oup/current/Tools/BinEdit.pas (file contents):
Revision 111 by alloc, Wed Feb 21 03:28:48 2007 UTC vs.
Revision 174 by alloc, Wed May 2 15:16:00 2007 UTC

# Line 139 | Line 139 | end;
139   procedure TForm_BinEdit.LoadDat(_fileid: Integer);
140   var
141    mem:  TMemoryStream;
142  Data: TByteData;
142   begin
143    if ConID <> -1 then
144    begin
# Line 182 | Line 181 | function TForm_BinEdit.GetValue(datatype
181   var
182    Data: TByteData;
183    i:    Word;
184 +  tempi: Integer;
185    floatformat: TFormatSettings;
186   begin
187    floatformat.DecimalSeparator := '.';
# Line 217 | Line 217 | begin
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:
# Line 307 | Line 316 | begin
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;
# Line 458 | Line 467 | begin
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
# Line 748 | Line 759 | begin
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
# Line 793 | Line 804 | begin
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  
# Line 824 | Line 835 | begin
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)