WARNING emu.h recompile!

debugger: Show save state items in alphabetical order in the debugger view. [Curt Coder]
This commit is contained in:
Curt Coder 2018-05-18 13:08:54 +03:00
parent af1b9542ce
commit 4d3566cfa7
3 changed files with 44 additions and 8 deletions

View File

@ -153,22 +153,35 @@ void debug_view_memory::enumerate_sources()
m_source_list.append(*global_alloc(debug_view_memory_source(name.c_str(), *region.second.get())));
}
// finally add all global array symbols
for (int itemnum = 0; itemnum < 10000; itemnum++)
// finally add all global array symbols in alphabetical order
std::vector<std::string> itemnames;
itemnames.resize(machine().save().registration_count());
for (int itemnum = 0; itemnum < machine().save().registration_count(); itemnum++)
{
// stop when we run out of items
u32 valsize, valcount;
void *base;
const char *itemname = machine().save().indexed_item(itemnum, base, valsize, valcount);
if (itemname == nullptr)
break;
std::string name_string(machine().save().indexed_item(itemnum, base, valsize, valcount));
itemnames[itemnum] = name_string;
}
std::sort(itemnames.begin(), itemnames.end());
for (int itemnum = 0; itemnum < machine().save().registration_count(); itemnum++)
{
name = itemnames[itemnum];
const char *itemname = name.c_str();
// add pretty much anything that's not a timer (we may wish to cull other items later)
// also, don't trim the front of the name, it's important to know which VIA6522 we're looking at, e.g.
if (strncmp(itemname, "timer/", 6))
{
name.assign(itemname);
m_source_list.append(*global_alloc(debug_view_memory_source(name.c_str(), base, valsize, valcount)));
u32 valsize, valcount;
void *base;
machine().save().named_item(name, base, valsize, valcount);
m_source_list.append(*global_alloc(debug_view_memory_source(itemname, base, valsize, valcount)));
}
}

View File

@ -107,6 +107,28 @@ const char *save_manager::indexed_item(int index, void *&base, u32 &valsize, u32
}
//-------------------------------------------------
// named_item - return an item with the given
// name
//-------------------------------------------------
void save_manager::named_item(std::string name, void *&base, u32 &valsize, u32 &valcount) const
{
for (auto it = m_entry_list.begin(); it != m_entry_list.end(); ++it)
{
if (it->get()->m_name.compare(name) == 0)
{
state_entry *entry = it->get();
base = entry->m_data;
valsize = entry->m_typesize;
valcount = entry->m_typecount;
break;
}
}
}
//-------------------------------------------------
// register_presave - register a pre-save
// function callback

View File

@ -106,6 +106,7 @@ public:
// registration control
void allow_registration(bool allowed = true);
const char *indexed_item(int index, void *&base, u32 &valsize, u32 &valcount) const;
void named_item(std::string name, void *&base, u32 &valsize, u32 &valcount) const;
// function registration
void register_presave(save_prepost_delegate func);