From 74ca2733d06ae8a93501bc80ac5907b61a0c0299 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Fri, 18 May 2018 20:45:39 +1000 Subject: try this for size - emu.h no net change (nw) --- src/emu/debug/dvmemory.cpp | 21 +++++++++------------ src/emu/save.cpp | 22 ---------------------- src/emu/save.h | 1 - 3 files changed, 9 insertions(+), 35 deletions(-) diff --git a/src/emu/debug/dvmemory.cpp b/src/emu/debug/dvmemory.cpp index f87f372c3dc..33efa5edba8 100644 --- a/src/emu/debug/dvmemory.cpp +++ b/src/emu/debug/dvmemory.cpp @@ -14,7 +14,9 @@ #include "debugcpu.h" #include "debugger.h" +#include #include +#include //************************************************************************** @@ -154,8 +156,8 @@ void debug_view_memory::enumerate_sources() } // finally add all global array symbols in alphabetical order - std::vector itemnames; - itemnames.resize(machine().save().registration_count()); + std::vector > itemnames; + itemnames.reserve(machine().save().registration_count()); for (int itemnum = 0; itemnum < machine().save().registration_count(); itemnum++) { @@ -163,25 +165,20 @@ void debug_view_memory::enumerate_sources() void *base; std::string name_string(machine().save().indexed_item(itemnum, base, valsize, valcount)); - itemnames[itemnum] = name_string; + itemnames.emplace_back(std::move(name_string), base, valsize, valcount); } - std::sort(itemnames.begin(), itemnames.end()); + std::sort(itemnames.begin(), itemnames.end(), [] (auto const &x, auto const &y) { return std::get<0>(x) < std::get<0>(y); }); - for (int itemnum = 0; itemnum < machine().save().registration_count(); itemnum++) + for (auto const &item : itemnames) { - name = itemnames[itemnum]; - const char *itemname = name.c_str(); + const char *itemname = std::get<0>(item).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)) { - 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))); + m_source_list.append(*global_alloc(debug_view_memory_source(itemname, std::get<1>(item), std::get<2>(item), std::get<3>(item)))); } } diff --git a/src/emu/save.cpp b/src/emu/save.cpp index 33aaf60e725..767aadb5ad9 100644 --- a/src/emu/save.cpp +++ b/src/emu/save.cpp @@ -107,28 +107,6 @@ 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 f72a27af21c..baf18258d09 100644 --- a/src/emu/save.h +++ b/src/emu/save.h @@ -106,7 +106,6 @@ 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); -- cgit v1.2.3