ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/VisualSwapcodes/Unit1.pas
(Generate patch)

Comparing VisualSwapcodes/Unit1.pas (file contents):
Revision 98 by alloc, Tue Feb 20 16:23:27 2007 UTC vs.
Revision 99 by alloc, Tue Feb 20 16:34:20 2007 UTC

# Line 103 | Line 103 | begin
103          else if datas = 'SWAPC_2BYTE' then
104            current_list.AddElem('SWAPC_2BYTE', 2)
105          else if datas = 'SWAPC_1BYTE' then
106 <          current_list.AddElem('SWAPC_1BYTE', 1)
107 <        else if datas = 'SWAPC_FIXARR_S' then
108 <        begin
109 <          ReadLn(descfile, line);
110 <          if Pos('h', line) > 0 then
111 <            datas := MidStr(line, Pos('db ', line) + 3, Pos('h', line) - (Pos('db ', line) + 3) )
112 <          else
113 <            datas := MidStr(line, Pos('db ', line) + 3, Length(Line) - (Pos('db ', line) + 3) );
114 <          i := current_list.AddArray('SWAPC_FIXARR_S', StrToInt('$'+datas));
115 <          current_list := TSwapList(current_list.Child(i));
116 <        end else if datas = 'SWAPC_VARARR_S' then
117 <        begin
118 <          ReadLn(descfile, line);
119 <          i := current_list.AddArray('SWAPC_VARARR_S', 0);
120 <          current_list := TSwapList(current_list.Child(i));
121 <        end else if datas = 'SWAPC_TMPL_PTR' then
122 <        begin
123 <          ReadLn(descfile, line);
124 <          datas := MidStr(line, Pos('dd ', line) + 4, 4);
125 <          current_list.AddElem('SWAPC_TMPL_PTR: ' + datas, 4);
126 <        end;
106 >          current_list.AddElem('SWAPC_1BYTE', 1);
107        end;
108        if Pos('gTemplate_', line) = 1 then
109        begin
# Line 169 | Line 149 | begin
149        end else if datas = 'SWAPC_VARARR_S' then
150        begin
151          ReadLn(descfile, line);
152 <        i := current_list.AddArray('SWAPC_VARARR_S', 0);
152 >        datas := MidStr(line, Pos(' d', line) + 4, Length(line) - (Pos(' d', line) + 3));
153 >        if datas = 'SWAPC_8BYTE' then
154 >          i := current_list.AddArray('SWAPC_VARARR_S', 8)
155 >        else if datas = 'SWAPC_4BYTE' then
156 >          i := current_list.AddArray('SWAPC_VARARR_S', 4)
157 >        else if datas = 'SWAPC_2BYTE' then
158 >          i := current_list.AddArray('SWAPC_VARARR_S', 2)
159 >        else if datas = 'SWAPC_1BYTE' then
160 >          i := current_list.AddArray('SWAPC_VARARR_S', 1);
161          current_list := TSwapList(current_list.Child(i));
162        end else if datas = 'SWAPC_VARARR_E' then
163        begin
# Line 222 | Line 210 | end;
210  
211   function TSwapList.CloseArray: TSwapList;
212   begin
213 <  Self.size := Self.size * Self.count;
213 >  if Self.name = 'SWAPC_FIXARR_S' then
214 >    Self.size := Self.size * Self.count
215 >  else
216 >    Self.size := Self.count;
217    Result := Self.parent;
218   end;
219  
# Line 238 | Line 229 | var
229    Data:    TNodeData;
230    node:    PVirtualNode;
231    name:    String;
241  address: Integer;
232  
233 <  procedure AddChilds(parent: PVirtualNode; SwapList: TSwapList);
233 >  procedure AddChilds(parent: PVirtualNode; SwapList: TSwapList; address: Integer);
234    var
235      i: Integer;
236    begin
# Line 251 | Line 241 | var
241          data.TypeName := SwapList.Child(i).name;
242          data.Size := SwapList.Child(i).size;
243          data.Address := address;
244 <        if parent = nil then
255 <          address := address + data.Size;
244 >        address := address + data.Size;
245          node := AddVSTEntry(VST, parent, data);
246          if SwapList.Child(i) is TSwapList then
247 <          AddChilds(node, TSwapList(SwapList.Child(i)));
247 >          AddChilds(node, TSwapList(SwapList.Child(i)), address);
248        end;
249      end;
250    end;
# Line 264 | Line 253 | begin
253    VST.Clear;
254    VST.BeginUpdate;
255  
267  address := 0;
268
256    name := list.Items.Strings[list.ItemIndex];
257    for i := 0 to High(Types) do
258      if Types[i].name = name then
# Line 273 | Line 260 | begin
260  
261    if i < Length(Types) then
262    begin
263 <    AddChilds(nil, Types[i].SwapList);
263 >    AddChilds(nil, Types[i].SwapList, 0);
264    end;
265  
266    VST.EndUpdate;

Diff Legend

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