summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2017-12-01 12:01:38 -0500
committer AJR <ajrhacker@users.noreply.github.com>2017-12-01 12:01:47 -0500
commit81cee86b3527449ed7deb6c79d92a38ecdae1652 (patch)
tree624f58519e93cd4ca12cec6bfaa5fc45a6b3bc46 /src/frontend
parentf676e765089b783357b0340b01efdabcdec4bd5b (diff)
Fix -listdevices' misplacement of subdevices in some configurations
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/clifront.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp
index 91a4df81b3c..a219ec614c7 100644
--- a/src/frontend/mame/clifront.cpp
+++ b/src/frontend/mame/clifront.cpp
@@ -719,7 +719,15 @@ void cli_frontend::listdevices(const std::vector<std::string> &args)
// sort them by tag
std::sort(device_list.begin(), device_list.end(), [](device_t *dev1, device_t *dev2) {
- return strcmp(dev1->tag(), dev2->tag()) < 0;
+ // end of string < ':' < '0'
+ const char *tag1 = dev1->tag();
+ const char *tag2 = dev2->tag();
+ while (*tag1 == *tag2 && *tag1 != '\0' && *tag2 != '\0')
+ {
+ tag1++;
+ tag2++;
+ }
+ return (*tag1 == ':' ? ' ' : *tag1) < (*tag2 == ':' ? ' ' : *tag2);
});
// dump the results