clifront.cpp: Changed -listbios to work more like -listslots, showing all BIOS options in a system.

This commit is contained in:
Vas Crabb 2023-04-10 06:34:35 +10:00
parent bdf8aebac2
commit b06dae9201
3 changed files with 117 additions and 83 deletions

View File

@ -396,25 +396,6 @@ overwritten.
000-lo.lo 131072 CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a)
sfix.sfix 131072 CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3)
.. _mame-commandline-listbios:
**-listbios** [*<pattern>*...]
Displays a list of alternate ROM BIOSes for supported systems/devices that
match the specified pattern(s). If no patterns are specified, the results
will include *all* supported systems and devices.
Example:
.. code-block:: bash
mame -listbios 3do
4 BIOSes available for driver "3do".
Name: Description:
panafz10 "Panasonic FZ-10 R.E.A.L. 3DO Interactive Multiplayer"
goldstar "Goldstar 3DO Interactive Multiplayer v1.01m"
panafz1 "Panasonic FZ-1 R.E.A.L. 3DO Interactive Multiplayer"
sanyotry "Sanyo TRY 3DO Interactive Multiplayer"
.. _mame-commandline-listsamples:
**-listsamples** [<*pattern*>]
@ -476,10 +457,10 @@ overwritten.
sets taken from unknown boards. On exit, the errorlevel is returned as one
of the following:
* 0: means all files were identified
* 7: means all files were identified except for 1 or more "non-ROM" files
* 8: means some files were identified
* 9: means no files were identified
* 0: means all files were identified
* 7: means all files were identified except for 1 or more "non-ROM" files
* 8: means some files were identified
* 9: means no files were identified
Example:
.. code-block:: bash
@ -554,6 +535,32 @@ overwritten.
joy Apple II analog joysticks
paddles Apple II paddles
.. _mame-commandline-listbios:
**-listbios** [*<pattern>*]
Show available BIOS options for a system (if available). BIOS options may
be available for the system or any devices selected as slot options.
If no pattern is specified, the results will include *all* supported
systems.
Example:
.. code-block:: bash
mamed -listbios apple2 -sl2 grapplus -sl4 videoterm
BIOS options for system Apple ][ (apple2):
default Original Monitor
autostart Autostart Monitor
BIOS options for device Orange Micro Grappler+ Printer Interface (-sl2 grapplus):
v30 ROM 3.0
v32 ROM 3.2
BIOS options for device Videx Videoterm 80 Column Display (-sl4 videoterm):
v24_60hz Firmware v2.4 (60 Hz)
v24_50hz Firmware v2.4 (50 Hz)
.. _mame-commandline-listmedia:
**-listmedia** / **-lm** [<*pattern*>]
@ -3299,17 +3306,17 @@ Core Input Options
map. Below is an example map for an 8-way joystick that matches the
picture shown above:
+-------------+--------------------------------------------------------+
| | 777888999 | |
| | 777888999 | | Note that the numeric digits correspond to the keys |
| | 777888999 | | on a numeric keypad. So '7' maps to up+left, '4' maps|
| | 444555666 | | to left, '5' maps to neutral, etc. In addition to the|
| | 444555666 | | numeric values, you can specify the character 's', |
| | 444555666 | | which means "sticky". Sticky map positions will keep|
| | 111222333 | | the output the same as the last non-sticky input sent|
| | 111222333 | | to the system. |
| | 111222333 | |
+-------------+--------------------------------------------------------+
+-------------+--------------------------------------------------------+
| | 777888999 | |
| | 777888999 | | Note that the numeric digits correspond to the keys |
| | 777888999 | | on a numeric keypad. So '7' maps to up+left, '4' maps|
| | 444555666 | | to left, '5' maps to neutral, etc. In addition to the|
| | 444555666 | | numeric values, you can specify the character 's', |
| | 444555666 | | which means "sticky". Sticky map positions will keep|
| | 111222333 | | the output the same as the last non-sticky input sent|
| | 111222333 | | to the system. |
| | 111222333 | |
+-------------+--------------------------------------------------------+
To specify the map for this parameter, you can specify a string of rows
separated by a '.' (which indicates the end of a row), like so:
@ -3358,17 +3365,17 @@ Core Input Options
This map would look somewhat like:
+-------------+---------------------------------------------------------+
| | s8888888s | |
| | 4s88888s6 | | For this mapping, we have a wide range for the |
| | 44s888s66 | | cardinal directions on 8, 4, 6, and 2. We have sticky|
| | 444555666 | | on the meeting points between those cardinal |
| | 444555666 | | directions where the appropriate direction isn't |
| | 444555666 | | going to be completely obvious. |
| | 44s222s66 | |
| | 4s22222s6 | |
| | s2222222s | |
+-------------+---------------------------------------------------------+
+-------------+---------------------------------------------------------+
| | s8888888s | |
| | 4s88888s6 | | For this mapping, we have a wide range for the |
| | 44s888s66 | | cardinal directions on 8, 4, 6, and 2. We have sticky|
| | 444555666 | | on the meeting points between those cardinal |
| | 444555666 | | directions where the appropriate direction isn't |
| | 444555666 | | going to be completely obvious. |
| | 44s222s66 | |
| | 4s22222s6 | |
| | s2222222s | |
+-------------+---------------------------------------------------------+
To specify the map for this parameter, you can specify a string of rows
separated by a '.' (which indicates the end of a row), like so:

View File

@ -1085,8 +1085,9 @@ image_option &emu_options::image_option(const std::string &device_name)
void emu_options::command_argument_processed()
{
// some command line arguments require that the system name be set, so we can get slot options
// FIXME: having this here is a massively leaky abstraction
if (command_arguments().size() == 1 && !core_iswildstr(command_arguments()[0]) &&
(command() == "listdevices" || (command() == "listslots") || (command() == "listmedia") || (command() == "listsoftware")))
(command() == "listdevices" || (command() == "listslots") || (command() == "listbios") || (command() == "listmedia") || (command() == "listsoftware")))
{
set_system_name(command_arguments()[0]);
}

View File

@ -112,13 +112,13 @@ const options_entry cli_option_entries[] =
{ CLICOMMAND_LISTBROTHERS ";lb", "0", core_options::option_type::COMMAND, "show \"brothers\", or other drivers from same sourcefile" },
{ CLICOMMAND_LISTCRC, "0", core_options::option_type::COMMAND, "CRC-32s" },
{ CLICOMMAND_LISTROMS ";lr", "0", core_options::option_type::COMMAND, "list required ROMs for a driver" },
{ CLICOMMAND_LISTBIOS, "0", core_options::option_type::COMMAND, "list alternate BIOSes for a driver" },
{ CLICOMMAND_LISTSAMPLES, "0", core_options::option_type::COMMAND, "list optional samples for a driver" },
{ CLICOMMAND_VERIFYROMS, "0", core_options::option_type::COMMAND, "report romsets that have problems" },
{ CLICOMMAND_VERIFYSAMPLES, "0", core_options::option_type::COMMAND, "report samplesets that have problems" },
{ CLICOMMAND_ROMIDENT, "0", core_options::option_type::COMMAND, "compare files with known MAME ROMs" },
{ CLICOMMAND_LISTDEVICES ";ld", "0", core_options::option_type::COMMAND, "list available devices" },
{ CLICOMMAND_LISTDEVICES ";ld", "0", core_options::option_type::COMMAND, "list devices in a system" },
{ CLICOMMAND_LISTSLOTS ";lslot", "0", core_options::option_type::COMMAND, "list available slots and slot devices" },
{ CLICOMMAND_LISTBIOS, "0", core_options::option_type::COMMAND, "list BIOS options for a system" },
{ CLICOMMAND_LISTMEDIA ";lm", "0", core_options::option_type::COMMAND, "list available media for the system" },
{ CLICOMMAND_LISTSOFTWARE ";lsoft", "0", core_options::option_type::COMMAND, "list known software for the system" },
{ CLICOMMAND_VERIFYSOFTWARE ";vsoft", "0", core_options::option_type::COMMAND, "verify known software for the system" },
@ -660,44 +660,65 @@ void cli_frontend::listroms(const std::vector<std::string> &args)
//-------------------------------------------------
// listbios - output the list of BIOSes referenced
// listbios - output the BIOS options for a system
// by matching systems/devices
//-------------------------------------------------
void cli_frontend::listbios(const std::vector<std::string> &args)
{
apply_device_action(
args,
[] (device_t &root, char const *type, bool first)
const char *gamename = args.empty() ? nullptr : args[0].c_str();
// determine which drivers to output; return an error if none found
driver_enumerator drivlist(m_options, gamename);
if (drivlist.count() == 0)
throw emu_fatalerror(EMU_ERR_NO_SUCH_SYSTEM, "No matching systems found for '%s'", gamename);
// iterate over drivers
bool firstsystem = true;
std::vector<std::pair<std::string, std::string> > bioses;
while (drivlist.next())
{
device_t &root = drivlist.config()->root_device();
if (firstsystem)
firstsystem = false;
else
printf("\n");
// print system BIOS options if there are any
bool firstbios = true;
for (const romload::system_bios &bios : romload::system_bioses(root.rom_region()))
{
if (firstbios)
{
// space between items
if (!first)
osd_printf_info("\n");
printf("BIOS options for system %s (%s):\n", root.name(), root.shortname());
firstbios = false;
}
printf(" %-16s %s\n", bios.get_name(), bios.get_description());
}
if (firstbios)
printf("No BIOS options for system %s (%s)\n", root.name(), root.shortname());
// gather BIOS names and descriptions for one device only
std::vector<std::pair<std::string, std::string>> bioses;
for (const romload::system_bios &bios : romload::system_bioses(root.rom_region()))
{
int bios_index = bios.get_value() - 1;
if (bios_index >= 0)
{
if (bioses.size() < bios_index)
bioses.resize(bios_index);
bioses.emplace(bioses.begin() + bios_index, bios.get_name(), bios.get_description());
}
}
// iterate over slots
for (const device_slot_interface &slot : slot_interface_enumerator(root))
{
// ignore fixed or empty slots
device_t *const card = slot.get_card_device();
if (slot.fixed() || !card || !card->rom_region())
continue;
// print results
if (bioses.empty())
osd_printf_info("No BIOSes available for %s \"%s\".\n", type, root.shortname());
else
// print card BIOS options if there are any
bool firstcard = true;
for (const romload::system_bios &bios : romload::system_bioses(card->rom_region()))
{
if (firstcard)
{
osd_printf_info("%d BIOS%s available for %s \"%s\".\n", bioses.size(), bioses.size() != 1 ? "es" : "", type, root.shortname());
osd_printf_info("Name: Description:\n");
for (const auto &desc : bioses)
osd_printf_info("%-17s \"%s\"\n", desc.first, desc.second);
printf("\n BIOS options for device %s (-%s %s):\n", card->name(), slot.device().tag() + 1, card->basetag());
firstcard = false;
}
});
printf(" %-16s %s\n", bios.get_name(), bios.get_description());
}
}
}
}
@ -828,7 +849,7 @@ void cli_frontend::listdevices(const std::vector<std::string> &args)
//-------------------------------------------------
// listslots - output the list of slot devices
// referenced by a given game or set of games
// present in a system or set of systems
//-------------------------------------------------
void cli_frontend::listslots(const std::vector<std::string> &args)
@ -847,11 +868,12 @@ void cli_frontend::listslots(const std::vector<std::string> &args)
// iterate over drivers
while (drivlist.next())
{
// iterate
// iterate over slots
bool first = true;
for (const device_slot_interface &slot : slot_interface_enumerator(drivlist.config()->root_device()))
{
if (slot.fixed()) continue;
if (slot.fixed())
continue;
// build a list of user-selectable options
std::vector<device_slot_interface::slot_option const *> option_list;
@ -860,9 +882,13 @@ void cli_frontend::listslots(const std::vector<std::string> &args)
option_list.push_back(option.second.get());
// sort them by name
std::sort(option_list.begin(), option_list.end(), [](device_slot_interface::slot_option const *opt1, device_slot_interface::slot_option const *opt2) {
return strcmp(opt1->name(), opt2->name()) < 0;
});
std::sort(
option_list.begin(),
option_list.end(),
[] (device_slot_interface::slot_option const *opt1, device_slot_interface::slot_option const *opt2)
{
return strcmp(opt1->name(), opt2->name()) < 0;
});
// output the line, up to the list of extensions
@ -1689,8 +1715,8 @@ const cli_frontend::info_command_struct *cli_frontend::find_command(const std::s
{ CLICOMMAND_LISTCRC, 0, -1, &cli_frontend::listcrc, "[system name]" },
{ CLICOMMAND_LISTDEVICES, 0, 1, &cli_frontend::listdevices, "[system name]" },
{ CLICOMMAND_LISTSLOTS, 0, 1, &cli_frontend::listslots, "[system name]" },
{ CLICOMMAND_LISTBIOS, 0, 1, &cli_frontend::listbios, "[system name]" },
{ CLICOMMAND_LISTROMS, 0, -1, &cli_frontend::listroms, "[pattern] ..." },
{ CLICOMMAND_LISTBIOS, 0, -1, &cli_frontend::listbios, "[pattern] ..." },
{ CLICOMMAND_LISTSAMPLES, 0, 1, &cli_frontend::listsamples, "[system name]" },
{ CLICOMMAND_VERIFYROMS, 0, -1, &cli_frontend::verifyroms, "[pattern] ..." },
{ CLICOMMAND_VERIFYSAMPLES, 0, 1, &cli_frontend::verifysamples, "[system name|*]" },