summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2018-05-18 13:08:54 +0300
committer Curt Coder <curtcoder@mail.com>2018-05-18 13:09:00 +0300
commit4d3566cfa7b6fcfcb8b89beb44798924ddbfc627 (patch)
tree4ca6755ba2131fd330628c53abe4547d132e5fac
parentaf1b9542ce959a2b35a785446a758e8dad4cf79b (diff)
WARNING emu.h recompile!
debugger: Show save state items in alphabetical order in the debugger view. [Curt Coder]
-rw-r--r--src/emu/debug/dvmemory.cpp29
-rw-r--r--src/emu/save.cpp22
-rw-r--r--src/emu/save.h1
3 files changed, 44 insertions, 8 deletions
diff --git a/src/emu/debug/dvmemory.cpp b/src/emu/debug/dvmemory.cpp
index da116e6c711..f87f372c3dc 100644
--- a/src/emu/debug/dvmemory.cpp
+++ b/src/emu/debug/dvmemory.cpp
@@ -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)));
}
}
diff --git a/src/emu/save.cpp b/src/emu/save.cpp
index 767aadb5ad9..33aaf60e725 100644
--- a/src/emu/save.cpp
+++ b/src/emu/save.cpp
@@ -108,6 +108,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
//-------------------------------------------------
diff --git a/src/emu/save.h b/src/emu/save.h
index baf18258d09..f72a27af21c 100644
--- a/src/emu/save.h
+++ b/src/emu/save.h
@@ -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);