Support for dynamic devices added to the core. [Miodrag Milanovic]

- Added slot and slot card interfaces
 - Added SLOT_INTERFACE macros in order to simplify device adding
 - Added new menu option "Slot Devices" and support to change device in runtime
 - Updated emuopts to support command setting of slot cards
 - Update clifront and added listslots option to display available slots and 
   device options for each one
This commit is contained in:
Miodrag Milanovic 2011-05-05 15:18:47 +00:00
parent 36c1f1f875
commit af35c8613f
2 changed files with 54 additions and 0 deletions

View File

@ -84,6 +84,7 @@ const options_entry cli_options::s_option_entries[] =
{ CLICOMMAND_VERIFYSAMPLES, "0", OPTION_COMMAND, "report samplesets that have problems" },
{ CLICOMMAND_ROMIDENT, "0", OPTION_COMMAND, "compare files with known MAME roms" },
{ CLICOMMAND_LISTDEVICES ";ld", "0", OPTION_COMMAND, "list available devices" },
{ CLICOMMAND_LISTSLOTS ";lslot", "0", OPTION_COMMAND, "list available slots and slot devices" },
{ CLICOMMAND_LISTMEDIA ";lm", "0", OPTION_COMMAND, "list available media for the system" },
{ CLICOMMAND_LISTSOFTWARE ";lsoft", "0", OPTION_COMMAND, "list known software for the system" },
@ -556,6 +557,56 @@ void cli_frontend::listdevices(const char *gamename)
}
//-------------------------------------------------
// listslots - output the list of slot devices
// referenced by a given game or set of games
//-------------------------------------------------
void cli_frontend::listslots(const char *gamename)
{
// determine which drivers to output; return an error if none found
driver_enumerator drivlist(m_options, gamename);
if (drivlist.count() == 0)
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename);
// print header
printf(" SYSTEM SLOT NAME SLOT OPTIONS SUPPORTED \n");
printf("---------- -------------------- ------------------------------------\n");
// iterate over drivers
while (drivlist.next())
{
// iterate
const device_slot_interface *slot = NULL;
bool first = true;
for (bool gotone = drivlist.config().devicelist().first(slot); gotone; gotone = slot->next(slot))
{
// output the line, up to the list of extensions
printf("%-13s%-20s ", first ? drivlist.driver().name : "", slot->device().tag());
// get the options and print them
const slot_interface* intf = slot->get_slot_interfaces();
for (int i = 0; intf[i].name != NULL; i++)
{
if (i==0) {
printf("%s\n", intf[i].name);
} else {
printf("%-33s %s\n", "",intf[i].name);
}
}
// end the line
printf("\n");
first = false;
}
// if we didn't get any at all, just print a none line
if (first)
printf("%-13s(none)\n", drivlist.driver().name);
}
}
//-------------------------------------------------
// listmedia - output the list of image devices
// referenced by a given game or set of games
@ -1169,6 +1220,7 @@ void cli_frontend::execute_commands(const char *exename)
{ CLICOMMAND_LISTBROTHERS, &cli_frontend::listbrothers },
{ CLICOMMAND_LISTCRC, &cli_frontend::listcrc },
{ CLICOMMAND_LISTDEVICES, &cli_frontend::listdevices },
{ CLICOMMAND_LISTSLOTS, &cli_frontend::listslots },
{ CLICOMMAND_LISTROMS, &cli_frontend::listroms },
{ CLICOMMAND_LISTSAMPLES, &cli_frontend::listsamples },
{ CLICOMMAND_VERIFYROMS, &cli_frontend::verifyroms },

View File

@ -71,6 +71,7 @@
#define CLICOMMAND_VERIFYSAMPLES "verifysamples"
#define CLICOMMAND_ROMIDENT "romident"
#define CLICOMMAND_LISTDEVICES "listdevices"
#define CLICOMMAND_LISTSLOTS "listslots"
#define CLICOMMAND_LISTMEDIA "listmedia" // needed by MESS
#define CLICOMMAND_LISTSOFTWARE "listsoftware"
@ -113,6 +114,7 @@ public:
void listroms(const char *gamename = "*");
void listsamples(const char *gamename = "*");
void listdevices(const char *gamename = "*");
void listslots(const char *gamename = "*");
void listmedia(const char *gamename = "*");
void verifyroms(const char *gamename = "*");
void verifysamples(const char *gamename = "*");