summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2009-12-23 16:37:09 +0000
committer Aaron Giles <aaron@aarongiles.com>2009-12-23 16:37:09 +0000
commit680184085a7241c66b1eeb8db989c7f37c661700 (patch)
tree449a7e7519b49109cb8fb00f1d1a6002417fe550
parentcaf41f8f3976975b4bce3d3093624305dccde5e2 (diff)
Added "new" command -listdevices (or -ld) to list the devices attached
to a driver. I notice that MESS has a command with the same name; hopefully the behaviors can be combined eventually.
-rw-r--r--src/emu/clifront.c69
-rw-r--r--src/emu/clifront.h2
2 files changed, 65 insertions, 6 deletions
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index dfb04248dc1..37355ab0b42 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -93,9 +93,7 @@ static const options_entry cli_options[] =
{ "verifyroms", "0", OPTION_COMMAND, "report romsets that have problems" },
{ "verifysamples", "0", OPTION_COMMAND, "report samplesets that have problems" },
{ "romident", "0", OPTION_COMMAND, "compare files with known MAME roms" },
-#ifdef MESS
- { "listdevices", "0", OPTION_COMMAND, "list available devices" },
-#endif
+ { "listdevices;ld", "0", OPTION_COMMAND, "list available devices" },
{ NULL }
};
@@ -243,9 +241,7 @@ static int execute_commands(core_options *options, const char *exename, const ga
{ CLIOPTION_LISTCLONES, cli_info_listclones },
{ CLIOPTION_LISTBROTHERS, cli_info_listbrothers },
{ CLIOPTION_LISTCRC, cli_info_listcrc },
-#ifdef MESS
- { CLIOPTION_LISTDEVICES, info_listdevices },
-#endif
+ { CLIOPTION_LISTDEVICES, cli_info_listdevices },
{ CLIOPTION_LISTROMS, cli_info_listroms },
{ CLIOPTION_LISTSAMPLES, cli_info_listsamples },
{ CLIOPTION_VERIFYROMS, info_verifyroms },
@@ -639,6 +635,67 @@ int cli_info_listsamples(core_options *options, const char *gamename)
/*-------------------------------------------------
+ cli_info_listdevices - output the list of
+ devices referenced by a given game or set of
+ games
+-------------------------------------------------*/
+
+int cli_info_listdevices(core_options *options, const char *gamename)
+{
+ int count = 0;
+ int drvindex;
+
+ /* since we expand the machine driver, we need to set things up */
+ init_resource_tracking();
+
+ /* iterate over drivers */
+ for (drvindex = 0; drivers[drvindex] != NULL; drvindex++)
+ if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0)
+ {
+ machine_config *config = machine_config_alloc(drivers[drvindex]->machine_config);
+ const device_config *device;
+
+ if (count != 0)
+ printf("\n");
+ printf("Driver %s (%s):\n", drivers[drvindex]->name, drivers[drvindex]->description);
+
+ /* iterate through devices */
+ for (device = config->devicelist.head; device != NULL; device = device->next)
+ {
+ switch (device->devclass)
+ {
+ case DEVICE_CLASS_AUDIO: printf(" Audio: "); break;
+ case DEVICE_CLASS_VIDEO: printf(" Video: "); break;
+ case DEVICE_CLASS_CPU_CHIP: printf(" CPU: "); break;
+ case DEVICE_CLASS_SOUND_CHIP: printf(" Sound: "); break;
+ case DEVICE_CLASS_TIMER: printf(" Timer: "); break;
+ default: printf(" Other: "); break;
+ }
+ printf("%s ('%s')", device_get_name(device), device->tag);
+ if (device->clock >= 1000000000)
+ printf(" @ %d.%02d GHz\n", device->clock / 1000000000, (device->clock / 10000000) % 100);
+ else if (device->clock >= 1000000)
+ printf(" @ %d.%02d MHz\n", device->clock / 1000000, (device->clock / 10000) % 100);
+ else if (device->clock >= 1000)
+ printf(" @ %d.%02d kHz\n", device->clock / 1000, (device->clock / 10) % 100);
+ else if (device->clock > 0)
+ printf(" @ %d Hz\n", device->clock);
+ else
+ printf("\n");
+ }
+
+ count++;
+ machine_config_free(config);
+ }
+
+ /* clean up our tracked resources */
+ exit_resource_tracking();
+
+ return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME;
+}
+
+
+/*-------------------------------------------------
info_verifyroms - verify the ROM sets of
one or more games
-------------------------------------------------*/
diff --git a/src/emu/clifront.h b/src/emu/clifront.h
index e9784e91e00..877cadf36ec 100644
--- a/src/emu/clifront.h
+++ b/src/emu/clifront.h
@@ -33,6 +33,7 @@
#define CLIOPTION_LISTDEVICES "listdevices"
#define CLIOPTION_LISTROMS "listroms"
#define CLIOPTION_LISTSAMPLES "listsamples"
+#define CLIOPTION_LISTDEVICES "listdevices"
#define CLIOPTION_VERIFYROMS "verifyroms"
#define CLIOPTION_VERIFYSAMPLES "verifysamples"
#define CLIOPTION_ROMIDENT "romident"
@@ -54,5 +55,6 @@ int cli_info_listbrothers(core_options *options, const char *gamename);
int cli_info_listcrc(core_options *options, const char *gamename);
int cli_info_listroms(core_options *options, const char *gamename);
int cli_info_listsamples(core_options *options, const char *gamename);
+int cli_info_listdevices(core_options *options, const char *gamename);
#endif /* __CLIFRONT_H__ */