path: root/src/mame/drivers/mpu4mdm.cpp
diff options
authorGravatarGravatar Vas Crabb <>2018-03-18 06:34:43 +1100
committerGravatarGravatar Vas Crabb <>2018-03-18 06:34:43 +1100
commitffd19cda0fc58d335d3cb8293bd8e09fd9a6fcd2 (patch)
tree619eef2a688ca0f64bc545368ae46068e332f981 /src/mame/drivers/mpu4mdm.cpp
parent7d7d3c5c45789d2bc1f8bef5b695fe6672f69a85 (diff)
Restrict ROM labels to a filesystem- and shell-safe subset of printable
ASCII. This has not been done unilaterally - I have the support of @galibert, @Tafoid, and @rb6502 to do something about the current free-for-all. The trouble with the ROM label field in MAME is that it serves multiple competing purposes: it's supposed to identify the device in the original system, and also act as a filename when searching for media image files to load. It also has to appear in listings of needed/missing files (e.g. in cases where the image _isn't_ found). To identify the original device, the ROM label field in MAME often contains text derived from some combination of one or more of the text on a label if present, the silkscreen on an IC package, the location on the circuit board, and the device designation. There's no standard for the order in which these appear and how they're separated. Some people add arbitrary filename extensions and other annotations. There are practical limitations on what can appear in the string, given it's used as a filename: * Path/name length limits. * Restrictions on characters that can appear in a filename. * Practicality of using the filename in a command-line environment. * Ambiguity when describing a filename. Filesystems themselves typically restrict characters in filenames: * Windows defines MAX_PATH as 260 characters - longer paths are difficult to use with Win32 APIs and don't work properly in Windows Explorer * Most filesystems don't allow ^@ or the path separator in names. * Windows doesn't allow C0 control characters or <>:"/\|?* characters in filenames. * Filesystems may have collation, e.g. FAT16 is case-folding, NTFS and HFS+ are case-preserving but case-insensitive, while EXT and XFS are case-sensitive. * Filesystems may perform Unicode normalisation, e.g. NTFS forces NFC, HFS+ forces NFD, while ZFS stores filenames as supplied at creation, but may be configured to apply normalisation when testing equality. Shells use various ASCII characters for special purposes: * C0 control characters for line editing and control (e.g. ^C to cancel a line, ^V for control charecter escape, ^R for history search). * The "'\ chracaters for quoting/escaping. * The ><| characters for redirection. * The *?[] characters for pattern matching. * The ${}~ characters for variable substitution/sequence expansion. * The ! or ^ characters for history substitution. * The ()` characters for controlling subshells. * The %& characters for job control. * The ; character as a command separator. * The # character for comments. There's also the issue of whether users across a range of locales will be able to type/display characters. We still don't have good support for Unicode console output on Windows (std::wcout doesn't seem to work properly), many users don't install C/J/K fonts, and many users aren't comfortable entering text in unfamiliar languages. This means we're limited to printable ASCII for practical purposes. The practical limitations mean the subset of "safe" characters is limited to ASCII digits, either uppercase or lowercase English Latin (but not both due to collation behaving differently across systems), and the +,-.=_ punctuation chracters. We've decided on lowercase, digits, and safe punctuation. In addition to this, spaces are allowed, as they can be quoted/escaped easily enough if no other special characters are used. There have been some arguments that allowing uppercase is "more accurate", but in practical terms it doesn't add much value. A string in a C++ program can't represent layout, relative size of text, colour and shape of the label, text font, graphics, and many other details. It also does nothing to address labels with text outside the English Latin alphabet (e.g. labels with Chinese ideographs). Besides missing information, the lack of hard and fast rules means you need to intuit what a label string in MAME is trying to represent. There is simply no substitute for photographs. There wasn't even any consistency in case within individual machine sets. For example, several games in vigilant.cpp had inconsistent case for "ic" vs "IC" in designation suffixes, and ibm6850.cpp had inconsistent case for filename extensions withing a set. There were sets that used uppercase for text from the label but not from the part number/PCB location, and vice versa. It was a huge mess. There's some merit to the idea of allowing a wider variety of characters in the label strings in the source, and mapping to a more restricted set when searching for files. However it creates more issues than it solves. It would require a change to the XML output to provide both the label and filename, and a corresponding change to external ROM management tools. It would be impractical to do for software lists, because it would require ROM management tools to implement the exact same mapping algorithm as MAME. But that aside, actually doing useful mapping would be impractical. What would you do with C/J/K ideographs, like the chip labelled 東方不敗 (Dongfang Bubai)? There's no intuitive way to do the mapping wtihout incluing something like Unihan data, which would add a lot of bloat. Even the, without a language hint the Romanisation would be less than ideal in many cases (using Chinese reading for Japanese text and vice versa). There's still the messy issue of filesystem collation to deal with. We do allow full Unicode in comments in the source. If you want to provide a more detailed description of a ROM label, that's the place for it. You've got more characters available, and the possibility of using mulitple lines. There are too many other competing requirements on the label field in the ROM definitions.
Diffstat (limited to 'src/mame/drivers/mpu4mdm.cpp')
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mame/drivers/mpu4mdm.cpp b/src/mame/drivers/mpu4mdm.cpp
index 893d34dd8f1..e30798a8a77 100644
--- a/src/mame/drivers/mpu4mdm.cpp
+++ b/src/mame/drivers/mpu4mdm.cpp
@@ -25,7 +25,7 @@ ROM_END
ROM_START( m4nud2p )
ROM_REGION( 0x10000, "maincpu", 0 )
- ROM_LOAD( "classic 2p nudger v0-1 (27512)", 0x0000, 0x010000, CRC(9c22f5f8) SHA1(5391f5d5b3a0861b93702e476d9635ff304a02a2) )
+ ROM_LOAD( "classic 2p nudger v0-1,27512", 0x0000, 0x010000, CRC(9c22f5f8) SHA1(5391f5d5b3a0861b93702e476d9635ff304a02a2) )
ROM_REGION( 0x080000, "msm6376", 0 )
ROM_LOAD( "ctnsnd.hex", 0x0000, 0x080000, CRC(150a4513) SHA1(97147e11b49d18225c527d8a0926118a83ee906c)) // == 2p Unlimited?
@@ -399,7 +399,7 @@ ROM_END
ROM_START( m4ewshft )
ROM_REGION( 0x80000, "maincpu", 0 )
- ROM_LOAD( "each_way_shifter(mdm)_v1-0.bin", 0x0000, 0x010000, CRC(506b6cf0) SHA1(870e356b9785e51c5be5d6bc6af9ea7640b51ee8) )
+ ROM_LOAD( "each_way_shifter=mdm=_v1-0.bin", 0x0000, 0x010000, CRC(506b6cf0) SHA1(870e356b9785e51c5be5d6bc6af9ea7640b51ee8) )
ROM_REGION( 0x200000, "msm6376", ROMREGION_ERASE00 )
ROM_LOAD( "each_way_shifter-snd1.bin", 0x000000, 0x080000, CRC(b21f9b09) SHA1(69ac3ca2874fc3aebd34dd225a195ad1c0305d00) )