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 113 by alloc, Sun Feb 25 17:20:22 2007 UTC vs.
Revision 204 by alloc, Sun May 27 20:03:41 2007 UTC

# Line 21 | Line 21 | type
21      value_viewer_context_copyasstring: TMenuItem;
22      value_viewer_context_copyashex: TMenuItem;
23      VTHPopup: TVTHeaderPopupMenu;
24 +    panel_imexport: TPanel;
25 +    btn_export: TButton;
26 +    btn_import: TButton;
27      procedure FormCreate(Sender: TObject);
28      procedure NewFile(fileinfo: TFileInfo);
29  
# Line 58 | Line 61 | type
61    private
62      fileid: Integer;
63      ConID: Integer;
64 +    rawlist: TRawDataList;
65    public
66    end;
67  
# Line 66 | Line 70 | var
70  
71   implementation
72  
73 < uses ValueEdit, Main, Functions, DatStructureLoader{, RawEdit};
73 > uses ValueEdit, Main, Functions, DatStructureLoader, RawEdit;
74   {$R *.dfm}
75  
76   type
# Line 160 | Line 164 | begin
164      Self.ClearStructViewer;
165      mem := nil;
166      ConManager.Connection[ConID].LoadDatFile(fileid, TStream(mem));
167 +    rawlist := ConManager.Connection[ConID].GetRawList(fileid);
168      hex.LoadFromStream(mem);
169      mem.Free;
170      ClearValues;
# Line 172 | Line 177 | begin
177      Self.ClearStructViewer;
178      ClearValues;
179      hex.DataSize := 0;
180 +    SetLength(rawlist, 0);
181    end;
182   end;
183  
# Line 180 | Line 186 | end;
186   function TForm_BinEdit.GetValue(datatype: Word; offset: Integer): String;
187   var
188    Data: TByteData;
189 <  i:    Word;
184 <  tempi: Integer;
189 >  i:    Integer;
190    floatformat: TFormatSettings;
191   begin
192    floatformat.DecimalSeparator := '.';
# Line 218 | Line 223 | begin
223        Result := IntToBin(hex.Data[offset]);
224      11:
225      begin
226 <      tempi := ConManager.Connection[ConID].GetRawInfo(fileid, offset).RawAddr;
227 <      if tempi >= 0 then
228 <        Result := '0x' + IntToHex(tempi, 8)
229 <      else
230 <        Result := 'unused';
226 >      if Length(rawlist) > 0 then
227 >      begin
228 >        for i := 0 to High(rawlist) do
229 >          if rawlist[i].SrcOffset = offset then
230 >          begin
231 >            if rawlist[i].RawAddr > 0 then
232 >              Result := '0x' + IntToHex(rawlist[i].RawAddr, 8)
233 >            else
234 >              Result := 'unused';
235 >            Break;
236 >          end;
237 >        if i > High(rawlist) then
238 >          Result := 'unused';
239 >      end;
240      end;
241      12:
242        if hex.Data[offset] = 1 then
# Line 467 | Line 481 | begin
481        str := '';
482        if hex.SelCount = 0 then
483        begin
484 <        while (hex.Data[hex.SelStart + j] > 0) and ((hex.SelStart + j) < hex.DataSize) do
484 >        while (hex.SelStart + j) < hex.DataSize do
485          begin
486 +          if hex.Data[hex.SelStart + j] = 0 then
487 +            Break;
488            if hex.Data[hex.selstart + j] >= 32 then
489              str := str + Char(hex.Data[hex.SelStart + j])
490            else
# Line 742 | Line 758 | procedure TForm_BinEdit.VSTDblClick(Send
758   var
759    node: PVirtualNode;
760    nodedata: PNodeData;
761 +  rawinfo: TRawDataInfo;
762    form: TForm_ToolTemplate;
763   begin
764    if VST.FocusedColumn = 3 then
# Line 759 | Line 776 | begin
776      begin
777        if (nodedata.DataType = 11) and (nodedata.Value <> 'unused') then
778        begin
779 <        if ConManager.Connection[ConID].GetRawInfo(fileid, nodedata.offset).RawSize > 0 then
780 <          Form_Main.open_child('rawedit', ConID, fileid);
779 >        rawinfo := ConManager.Connection[ConID].GetRawInfo(fileid, nodedata.offset);
780 >        if rawinfo.RawSize > 0 then
781 >        begin
782 >          form := nil;
783 >          form := Form_Main.open_child('rawedit', ConID, fileid);
784 >          if Assigned(form) then
785 >            TForm_RawEdit(form).LoadRaw(rawinfo);
786 >        end;
787        end;
788        if (nodedata.DataType = 12) and (nodedata.Value <> 'no link') then
789        begin

Diff Legend

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