src/mess/climess.c
| r6963 | r6964 | |
| 36 | 36 | "See config.txt and windows.txt for usage instructions.\n"); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | | |
| 39 | /* New listmedia is below - left this here just in case.. */ |
| 40 | #if 0 |
| 40 | 41 | /*------------------------------------------------- |
| 41 | 42 | info_listdevices - list all devices in MESS |
| 42 | 43 | -------------------------------------------------*/ |
| r6963 | r6964 | |
| 99 | 100 | exit_resource_tracking(); |
| 100 | 101 | return 0; |
| 101 | 102 | } |
| 103 | #endif |
| 102 | 104 | |
| 103 | 105 | |
| 106 | /*------------------------------------------------- |
| 107 | cli_info_listdevices - output the list of |
| 108 | devices referenced by a given game or set of |
| 109 | games |
| 110 | -------------------------------------------------*/ |
| 104 | 111 | |
| 112 | int info_listdevices(core_options *options, const char *gamename) |
| 113 | { |
| 114 | int count = 0, devcount; |
| 115 | int drvindex; |
| 116 | machine_config *config; |
| 117 | const device_config *dev; |
| 118 | image_device_info info; |
| 119 | const char *src; |
| 120 | const char *driver_name; |
| 121 | const char *name; |
| 122 | const char *shortname; |
| 123 | char paren_shortname[16]; |
| 124 | |
| 125 | /* since we expand the machine driver, we need to set things up */ |
| 126 | init_resource_tracking(); |
| 127 | |
| 128 | printf(" SYSTEM DEVICE NAME (brief) IMAGE FILE EXTENSIONS SUPPORTED \n"); |
| 129 | printf("---------- -------------------- ------------------------------------\n"); |
| 130 | |
| 131 | /* iterate over drivers */ |
| 132 | for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) |
| 133 | if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) |
| 134 | { |
| 135 | /* allocate the machine config */ |
| 136 | config = machine_config_alloc(drivers[drvindex]->machine_config); |
| 137 | |
| 138 | driver_name = drivers[drvindex]->name; |
| 139 | |
| 140 | devcount = 0; |
| 141 | |
| 142 | for (dev = image_device_first(config); dev != NULL; dev = image_device_next(dev)) |
| 143 | { |
| 144 | info = image_device_getinfo(config, dev); |
| 145 | |
| 146 | src = info.file_extensions; |
| 147 | name = info.instance_name; |
| 148 | shortname = info.brief_instance_name; |
| 149 | |
| 150 | sprintf(paren_shortname, "(%s)", shortname); |
| 151 | |
| 152 | printf("%-13s%-12s%-8s ", driver_name, name, paren_shortname); |
| 153 | driver_name = " "; |
| 154 | |
| 155 | while (src && *src) |
| 156 | { |
| 157 | printf(".%-5s", src); |
| 158 | src += strlen(src) + 1; |
| 159 | devcount++; |
| 160 | } |
| 161 | printf("\n"); |
| 162 | } |
| 163 | if (!devcount) |
| 164 | printf("%-13s(none)\n",driver_name); |
| 165 | |
| 166 | count++; |
| 167 | machine_config_free(config); |
| 168 | } |
| 169 | |
| 170 | /* clean up our tracked resources */ |
| 171 | exit_resource_tracking(); |
| 172 | |
| 173 | if (!count) |
| 174 | printf("There are no Computers or Consoles named %s\n", gamename); |
| 175 | |
| 176 | return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; |
| 177 | } |