diff --git a/dump_df_globals.rb b/dump_df_globals.rb index 1a18d2b..c32f4f7 100644 --- a/dump_df_globals.rb +++ b/dump_df_globals.rb @@ -225,6 +225,9 @@ def dfhack_names(n) off = table_start + elems*bits/8 global = {} +if extended + global_size = {} +end global[off] = 'global_table' while true @@ -239,6 +242,10 @@ def dfhack_names(n) break if ptr_str == 0 name = dasm.decode_strz(ptr_str) global[ptr_var] = name + if extended + global_size[ptr_var] = size + $stderr.puts "#{name} #{size}\n" + end end ptr_prev = 0 @@ -253,10 +260,14 @@ def dfhack_names(n) case dump_fmt when 'xml' if not dump_size - out << "" + out << "" else - size = ptr_prev > 0 ? (ptr_prev-ptr_var) : 0 - out << "" + if extended + size = global_size[ptr_var] || 0 + else + size = ptr_prev > 0 ? (ptr_prev-ptr_var) : 0 + end + out << "" ptr_prev = ptr_var end when 'idc'