summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author etabeta <52487@rommac-52487-1.station>2021-04-04 07:15:44 +0200
committer etabeta <52487@rommac-52487-1.station>2021-04-04 07:15:44 +0200
commit586238dbf7ac572bddcaf6c93d5e804300309ebd (patch)
tree605d60e765efcf92a3fd12c641192d34c2de0431
parent029f7fdf878f237d591a91a1c6f9b033c5cb7aa2 (diff)
options: simplified the statename/snapname logic for naming after image devices (e.g. %d_cart or %d_flop1) while allowing for more general non-alphanumeric separators, so that for instance %d_cart_%i correctly produces a name with the software name, followed by an underscore and an index, rather than failing to be recognized and defaulting back to %g/%i.
-rw-r--r--src/emu/machine.cpp15
-rw-r--r--src/emu/video.cpp16
2 files changed, 4 insertions, 27 deletions
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp
index f17f6c47d49..510b763b523 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -534,21 +534,10 @@ std::string running_machine::get_statename(const char *option) const
int name_found = 0;
// find length of the device name
- int end1 = statename_str.find('/', pos + 3);
- int end2 = statename_str.find('%', pos + 3);
- int end;
-
- if ((end1 != -1) && (end2 != -1))
- end = std::min(end1, end2);
- else if (end1 != -1)
- end = end1;
- else if (end2 != -1)
- end = end2;
- else
+ int end = statename_str.find_first_not_of("abcdefghijklmnopqrstuvwxyz1234567890", pos + 3);
+ if (end == -1)
end = statename_str.length();
- if (end - pos < 3)
- fatalerror("Something very wrong is going on!!!\n");
// copy the device name to an std::string
std::string devname_str;
diff --git a/src/emu/video.cpp b/src/emu/video.cpp
index 2501cd4966d..db7406a8474 100644
--- a/src/emu/video.cpp
+++ b/src/emu/video.cpp
@@ -1127,22 +1127,10 @@ osd_file::error video_manager::open_next(emu_file &file, const char *extension,
int name_found = 0;
// find length of the device name
- int end1 = snapstr.find('/', pos + 3);
- int end2 = snapstr.find('%', pos + 3);
- int end;
-
- if ((end1 != -1) && (end2 != -1))
- end = std::min(end1, end2);
- else if (end1 != -1)
- end = end1;
- else if (end2 != -1)
- end = end2;
- else
+ int end = snapstr.find_first_not_of("abcdefghijklmnopqrstuvwxyz1234567890", pos + 3);
+ if (end == -1)
end = snapstr.length();
- if (end - pos < 3)
- fatalerror("Something very wrong is going on!!!\n");
-
// copy the device name to an std::string
std::string snapdevname;
snapdevname.assign(snapstr.substr(pos + 3, end - pos - 3));