--- VisualSwapcodes/Unit1.pas 2007/02/20 16:23:27 98 +++ VisualSwapcodes/Unit1.pas 2007/02/20 16:34:20 99 @@ -103,27 +103,7 @@ begin else if datas = 'SWAPC_2BYTE' then current_list.AddElem('SWAPC_2BYTE', 2) else if datas = 'SWAPC_1BYTE' then - current_list.AddElem('SWAPC_1BYTE', 1) - else if datas = 'SWAPC_FIXARR_S' then - begin - ReadLn(descfile, line); - if Pos('h', line) > 0 then - datas := MidStr(line, Pos('db ', line) + 3, Pos('h', line) - (Pos('db ', line) + 3) ) - else - datas := MidStr(line, Pos('db ', line) + 3, Length(Line) - (Pos('db ', line) + 3) ); - i := current_list.AddArray('SWAPC_FIXARR_S', StrToInt('$'+datas)); - current_list := TSwapList(current_list.Child(i)); - end else if datas = 'SWAPC_VARARR_S' then - begin - ReadLn(descfile, line); - i := current_list.AddArray('SWAPC_VARARR_S', 0); - current_list := TSwapList(current_list.Child(i)); - end else if datas = 'SWAPC_TMPL_PTR' then - begin - ReadLn(descfile, line); - datas := MidStr(line, Pos('dd ', line) + 4, 4); - current_list.AddElem('SWAPC_TMPL_PTR: ' + datas, 4); - end; + current_list.AddElem('SWAPC_1BYTE', 1); end; if Pos('gTemplate_', line) = 1 then begin @@ -169,7 +149,15 @@ begin end else if datas = 'SWAPC_VARARR_S' then begin ReadLn(descfile, line); - i := current_list.AddArray('SWAPC_VARARR_S', 0); + datas := MidStr(line, Pos(' d', line) + 4, Length(line) - (Pos(' d', line) + 3)); + if datas = 'SWAPC_8BYTE' then + i := current_list.AddArray('SWAPC_VARARR_S', 8) + else if datas = 'SWAPC_4BYTE' then + i := current_list.AddArray('SWAPC_VARARR_S', 4) + else if datas = 'SWAPC_2BYTE' then + i := current_list.AddArray('SWAPC_VARARR_S', 2) + else if datas = 'SWAPC_1BYTE' then + i := current_list.AddArray('SWAPC_VARARR_S', 1); current_list := TSwapList(current_list.Child(i)); end else if datas = 'SWAPC_VARARR_E' then begin @@ -222,7 +210,10 @@ end; function TSwapList.CloseArray: TSwapList; begin - Self.size := Self.size * Self.count; + if Self.name = 'SWAPC_FIXARR_S' then + Self.size := Self.size * Self.count + else + Self.size := Self.count; Result := Self.parent; end; @@ -238,9 +229,8 @@ var Data: TNodeData; node: PVirtualNode; name: String; - address: Integer; - procedure AddChilds(parent: PVirtualNode; SwapList: TSwapList); + procedure AddChilds(parent: PVirtualNode; SwapList: TSwapList; address: Integer); var i: Integer; begin @@ -251,11 +241,10 @@ var data.TypeName := SwapList.Child(i).name; data.Size := SwapList.Child(i).size; data.Address := address; - if parent = nil then - address := address + data.Size; + address := address + data.Size; node := AddVSTEntry(VST, parent, data); if SwapList.Child(i) is TSwapList then - AddChilds(node, TSwapList(SwapList.Child(i))); + AddChilds(node, TSwapList(SwapList.Child(i)), address); end; end; end; @@ -264,8 +253,6 @@ begin VST.Clear; VST.BeginUpdate; - address := 0; - name := list.Items.Strings[list.ItemIndex]; for i := 0 to High(Types) do if Types[i].name = name then @@ -273,7 +260,7 @@ begin if i < Length(Types) then begin - AddChilds(nil, Types[i].SwapList); + AddChilds(nil, Types[i].SwapList, 0); end; VST.EndUpdate;