summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame
diff options
context:
space:
mode:
author npwoods <npwoods@mess.org>2019-08-13 10:58:04 -0400
committer npwoods <npwoods@mess.org>2019-08-13 10:58:04 -0400
commit9f0d29158f1f8439062b813659f58a7e7e0ddfa6 (patch)
tree30679625fa8a18fb282c2efc42982c6d99ad6e79 /src/frontend/mame
parent2d49a9e45b0d183557962a9d27cd133156bacffc (diff)
Ensuring that devices emitted by -listxml are sorted
This is primarily to make the output be deterministic.
Diffstat (limited to 'src/frontend/mame')
-rw-r--r--src/frontend/mame/info.cpp10
-rw-r--r--src/frontend/mame/info.h8
2 files changed, 17 insertions, 1 deletions
diff --git a/src/frontend/mame/info.cpp b/src/frontend/mame/info.cpp
index 18ee054769a..af16254a99a 100644
--- a/src/frontend/mame/info.cpp
+++ b/src/frontend/mame/info.cpp
@@ -1951,3 +1951,13 @@ const char *info_xml_creator::get_merge_name(driver_enumerator &drivlist, const
return nullptr;
}
+
+
+//-------------------------------------------------
+// device_type_compare::operator()
+//-------------------------------------------------
+
+bool info_xml_creator::device_type_compare::operator()(const std::add_pointer_t<device_type> &lhs, const std::add_pointer_t<device_type> &rhs) const
+{
+ return strcmp(lhs->shortname(), rhs->shortname()) < 0;
+}
diff --git a/src/frontend/mame/info.h b/src/frontend/mame/info.h
index 9fc50a6af98..610e576e7f3 100644
--- a/src/frontend/mame/info.h
+++ b/src/frontend/mame/info.h
@@ -39,7 +39,13 @@ public:
void output(std::ostream &out, const std::function<bool(const char *shortname, bool &done)> &filter = { }, bool include_devices = true);
private:
- typedef std::unordered_set<std::add_pointer_t<device_type> > device_type_set;
+ class device_type_compare
+ {
+ public:
+ bool operator()(const std::add_pointer_t<device_type> &lhs, const std::add_pointer_t<device_type> &rhs) const;
+ };
+
+ typedef std::set<std::add_pointer_t<device_type>, device_type_compare> device_type_set;
// internal helper
void output_header(std::ostream &out);