summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-09-16 22:09:58 +1000
committer Vas Crabb <vas@vastheman.com>2022-09-16 22:23:34 +1000
commitc76cf754b3cb1a07f8d3ca585bb3a055d78f25be (patch)
tree833fa7b23f8a84a79fd052008a6ad7c3847b46da /src/emu
parent1aae44005b59aa712fb60f639ddbb9e8e5e7a357 (diff)
debugger/win: Added capability to save/restore window arrangement.
* Format is mostly compatible with the Cocoa debugger, besides reversed vertical positioning. * Made Qt debugger more compatible with configuration format used by Win32 and Cocoa debuggers. * emu/config.cpp: Preserve elements with no registered handlers in default and system configuation files.
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/bookkeeping.cpp2
-rw-r--r--src/emu/config.cpp66
-rw-r--r--src/emu/config.h9
-rw-r--r--src/emu/sound.cpp9
4 files changed, 76 insertions, 10 deletions
diff --git a/src/emu/bookkeeping.cpp b/src/emu/bookkeeping.cpp
index 4ae4c1ecf2b..9f3e414e03f 100644
--- a/src/emu/bookkeeping.cpp
+++ b/src/emu/bookkeeping.cpp
@@ -11,6 +11,8 @@
#include "emu.h"
#include "config.h"
+#include "xmlfile.h"
+
//**************************************************************************
// BOOKKEEPING MANAGER
diff --git a/src/emu/config.cpp b/src/emu/config.cpp
index be9eccc8f99..a7d1218abe0 100644
--- a/src/emu/config.cpp
+++ b/src/emu/config.cpp
@@ -15,19 +15,23 @@
#include "emuopts.h"
#include "fileio.h"
+#include "xmlfile.h"
+
#include <system_error>
#include <utility>
#define DEBUG_CONFIG 0
+
//**************************************************************************
// CONFIGURATION MANAGER
//**************************************************************************
-//-------------------------------------------------
-// configuration_manager - constructor
-//-------------------------------------------------
-
+/*************************************
+ *
+ * Construction/destruction
+ *
+ *************************************/
configuration_manager::configuration_manager(running_machine &machine) :
m_machine(machine),
@@ -35,6 +39,13 @@ configuration_manager::configuration_manager(running_machine &machine) :
{
}
+
+configuration_manager::~configuration_manager()
+{
+}
+
+
+
/*************************************
*
* Register to be involved in config
@@ -256,6 +267,12 @@ bool configuration_manager::load_xml(game_driver const &system, emu_file &file,
for (auto const &type : m_typelist)
type.second.load(which_type, level, systemnode->get_child(type.first.c_str()));
count++;
+
+ // save unhandled settings for default and system types
+ if (config_type::DEFAULT == which_type)
+ save_unhandled(m_unhandled_default, *systemnode);
+ else if (config_type::SYSTEM == which_type)
+ save_unhandled(m_unhandled_system, *systemnode);
}
// error if this isn't a valid match
@@ -302,9 +319,48 @@ bool configuration_manager::save_xml(emu_file &file, config_type which_type)
curnode->delete_node();
}
- // flush the file
+ // restore unhandled settings
+ if ((config_type::DEFAULT == which_type) && m_unhandled_default)
+ restore_unhandled(*m_unhandled_default, *systemnode);
+ else if ((config_type::SYSTEM == which_type) && m_unhandled_system)
+ restore_unhandled(*m_unhandled_system, *systemnode);
+
+ // write out the file
root->write(file);
// free and get out of here
return true;
}
+
+
+
+/*************************************
+ *
+ * Preserving unhandled settings
+ *
+ *************************************/
+
+void configuration_manager::save_unhandled(
+ std::unique_ptr<util::xml::file> &unhandled,
+ util::xml::data_node const &systemnode)
+{
+ for (util::xml::data_node const *curnode = systemnode.get_first_child(); curnode; curnode = curnode->get_next_sibling())
+ {
+ auto const handler = m_typelist.lower_bound(curnode->get_name());
+ if ((m_typelist.end() == handler) || (handler->first != curnode->get_name()))
+ {
+ if (!unhandled)
+ unhandled = util::xml::file::create();
+ curnode->copy_into(*unhandled);
+ }
+ }
+}
+
+
+void configuration_manager::restore_unhandled(
+ util::xml::file const &unhandled,
+ util::xml::data_node &systemnode)
+{
+ for (util::xml::data_node const *curnode = unhandled.get_first_child(); curnode; curnode = curnode->get_next_sibling())
+ curnode->copy_into(systemnode);
+}
diff --git a/src/emu/config.h b/src/emu/config.h
index 2ae05e0c32c..4d3dd4f3b75 100644
--- a/src/emu/config.h
+++ b/src/emu/config.h
@@ -13,9 +13,8 @@
#pragma once
-#include "xmlfile.h"
-
#include <map>
+#include <memory>
#include <string>
#include <string_view>
@@ -49,6 +48,7 @@ public:
// construction/destruction
configuration_manager(running_machine &machine);
+ ~configuration_manager();
void config_register(std::string_view name, load_delegate &&load, save_delegate &&save);
@@ -69,9 +69,14 @@ private:
bool load_xml(game_driver const &system, emu_file &file, config_type which_type);
bool save_xml(emu_file &file, config_type which_type);
+ void save_unhandled(std::unique_ptr<util::xml::file> &unhandled, util::xml::data_node const &systemnode);
+ void restore_unhandled(util::xml::file const &unhandled, util::xml::data_node &systemnode);
+
// internal state
running_machine &m_machine;
std::multimap<std::string, config_handler> m_typelist;
+ std::unique_ptr<util::xml::file> m_unhandled_default;
+ std::unique_ptr<util::xml::file> m_unhandled_system;
};
#endif // MAME_EMU_CONFIG_H
diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp
index b74ff652b65..a0293063f48 100644
--- a/src/emu/sound.cpp
+++ b/src/emu/sound.cpp
@@ -10,11 +10,14 @@
#include "emu.h"
-#include "speaker.h"
-#include "emuopts.h"
-#include "osdepend.h"
#include "config.h"
+#include "emuopts.h"
+#include "speaker.h"
+
#include "wavwrite.h"
+#include "xmlfile.h"
+
+#include "osdepend.h"
//**************************************************************************