From af35c8613f8fa3284688b8a334a3e75534401656 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 5 May 2011 15:18:47 +0000 Subject: [PATCH] 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 --- src/emu/clifront.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++ src/emu/clifront.h | 2 ++ 2 files changed, 54 insertions(+) diff --git a/src/emu/clifront.c b/src/emu/clifront.c index da8997460c9..57ef01ecde9 100644 --- a/src/emu/clifront.c +++ b/src/emu/clifront.c @@ -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 }, diff --git a/src/emu/clifront.h b/src/emu/clifront.h index c547d077095..8bec7f759e2 100644 --- a/src/emu/clifront.h +++ b/src/emu/clifront.h @@ -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 = "*");