static void InitDriversInfo(void) { int ndriver; int num_speakers = 0; int total = driver_list::total(); const game_driver *gamedrv = NULL; struct DriversInfo *gameinfo = NULL; const rom_entry *region, *rom; for (ndriver = 0; ndriver < total; ndriver++) { gamedrv = &driver_list::driver(ndriver); gameinfo = &drivers_info[ndriver]; machine_config config(*gamedrv, MameUIGlobal()); gameinfo->isClone = (GetParentRomSetIndex(gamedrv) != -1); gameinfo->isBroken = (gamedrv->flags & MACHINE_NOT_WORKING) ? true : false; gameinfo->isHarddisk = FALSE; gameinfo->isVertical = (gamedrv->flags & ORIENTATION_SWAP_XY) ? TRUE : FALSE; device_iterator deviter(config.root_device()); for (device_t *device = deviter.first(); device; device = deviter.next()) for (region = rom_first_region(*device); region; region = rom_next_region(region)) if (ROMREGION_ISDISKDATA(region)) gameinfo->isHarddisk = TRUE; gameinfo->hasOptionalBIOS = FALSE; if (gamedrv->rom) for (rom = gamedrv->rom; !ROMENTRY_ISEND(rom); rom++) if (ROMENTRY_ISSYSTEM_BIOS(rom)) gameinfo->hasOptionalBIOS = TRUE; num_speakers = numberOfSpeakers(&config); gameinfo->isStereo = (num_speakers > 1); gameinfo->screenCount = numberOfScreens(&config); gameinfo->isVector = isDriverVector(&config); gameinfo->usesRoms = FALSE; for (device_t *device = deviter.first(); device; device = deviter.next()) for (region = rom_first_region(*device); region; region = rom_next_region(region)) for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) gameinfo->usesRoms = TRUE; gameinfo->usesSamples = FALSE; samples_device_iterator iter(config.root_device()); if (iter.first()) gameinfo->usesSamples = TRUE; gameinfo->usesTrackball = FALSE; gameinfo->usesLightGun = FALSE; if (gamedrv->ipt) { ioport_port *port; ioport_list portlist; std::string errors; device_iterator iter(config.root_device()); for (device_t *cfg = iter.first(); cfg; cfg = iter.next()) if (cfg->input_ports()) portlist.append(*cfg, errors); for (port = portlist.first(); port; port = port->next()) { ioport_field *field; for (field = port->first_field(); field; field = field->next()) { UINT32 type; type = field->type(); if (type == IPT_END) break; if (type == IPT_DIAL || type == IPT_PADDLE || type == IPT_TRACKBALL_X || type == IPT_TRACKBALL_Y || type == IPT_AD_STICK_X || type == IPT_AD_STICK_Y) gameinfo->usesTrackball = TRUE; if (type == IPT_LIGHTGUN_X || type == IPT_LIGHTGUN_Y) gameinfo->usesLightGun = TRUE; if (type == IPT_MOUSE_X || type == IPT_MOUSE_Y) gameinfo->usesMouse = TRUE; } } } } SetDriversInfo(); }
static struct DriversInfo* GetDriversInfo(int driver_index) { if (drivers_info == NULL) { int ndriver; drivers_info = (DriversInfo*)malloc(sizeof(struct DriversInfo) * GetNumGames()); for (ndriver = 0; ndriver < GetNumGames(); ndriver++) { const game_driver *gamedrv = drivers[ndriver]; struct DriversInfo *gameinfo = &drivers_info[ndriver]; const rom_entry *region, *rom; machine_config *config; const rom_source *source; int num_speakers; /* Allocate machine config */ config = global_alloc(machine_config(gamedrv->machine_config)); gameinfo->isClone = (GetParentRomSetIndex(gamedrv) != -1); gameinfo->isBroken = ((gamedrv->flags & GAME_NOT_WORKING) != 0); gameinfo->supportsSaveState = ((gamedrv->flags & GAME_SUPPORTS_SAVE) != 0); gameinfo->isHarddisk = FALSE; gameinfo->isVertical = (gamedrv->flags & ORIENTATION_SWAP_XY) ? TRUE : FALSE; for (source = rom_first_source(gamedrv, config); source != NULL; source = rom_next_source(gamedrv, config, source)) { for (region = rom_first_region(gamedrv, source); region; region = rom_next_region(region)) { if (ROMREGION_ISDISKDATA(region)) gameinfo->isHarddisk = TRUE; } } gameinfo->hasOptionalBIOS = FALSE; if (gamedrv->rom != NULL) { for (rom = gamedrv->rom; !ROMENTRY_ISEND(rom); rom++) { if (ROMENTRY_ISSYSTEM_BIOS(rom)) { gameinfo->hasOptionalBIOS = TRUE; break; } } } num_speakers = numberOfSpeakers(config); gameinfo->isStereo = (num_speakers > 1); gameinfo->screenCount = numberOfScreens(config); gameinfo->isVector = isDriverVector(config); // ((drv.video_attributes & VIDEO_TYPE_VECTOR) != 0); gameinfo->usesRoms = FALSE; for (source = rom_first_source(gamedrv, config); source != NULL; source = rom_next_source(gamedrv, config, source)) { for (region = rom_first_region(gamedrv, source); region; region = rom_next_region(region)) { for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { gameinfo->usesRoms = TRUE; break; } } } gameinfo->usesSamples = FALSE; { const device_config_sound_interface *sound; const char * const * samplenames = NULL; for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound)) { if (sound->devconfig().type() == SOUND_SAMPLES) { const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config(); samplenames = intf->samplenames; if (samplenames != 0 && samplenames[0] != 0) { gameinfo->usesSamples = TRUE; break; } } } } gameinfo->numPlayers = 0; gameinfo->numButtons = 0; memset(gameinfo->usesController, 0, sizeof gameinfo->usesController); gameinfo->parentIndex = -1; if (gameinfo->isClone) { int i; for (i = 0; i < GetNumGames(); i++) { if (GetParentRomSetIndex(gamedrv) == i) { gameinfo->parentIndex = i; break; } } } gameinfo->biosIndex = -1; if (DriverIsBios(ndriver)) gameinfo->biosIndex = ndriver; else if (gameinfo->hasOptionalBIOS) { int parentIndex; if (gameinfo->isClone) parentIndex = gameinfo->parentIndex; else parentIndex = ndriver; while (1) { parentIndex = GetGameNameIndex(drivers[parentIndex]->parent); if (parentIndex == -1) { dprintf("bios for %s is not found", drivers[ndriver]->name); break; } if (DriverIsBios(parentIndex)) { gameinfo->biosIndex = parentIndex; break; } } } /* Free the structure */ global_free(config); gameinfo->usesTrackball = FALSE; gameinfo->usesLightGun = FALSE; if (gamedrv->ipt != NULL) { const input_port_config *port; ioport_list portlist; input_port_list_init(portlist, gamedrv->ipt, NULL, 0, FALSE); for (port = portlist.first(); port != NULL; port = port->next()) { const input_field_config *field; for (field = port->fieldlist; field != NULL; field = field->next) { UINT32 type; type = field->type; if (type == IPT_END) break; if (type == IPT_DIAL || type == IPT_PADDLE || type == IPT_TRACKBALL_X || type == IPT_TRACKBALL_Y || type == IPT_AD_STICK_X || type == IPT_AD_STICK_Y) gameinfo->usesTrackball = TRUE; if (type == IPT_LIGHTGUN_X || type == IPT_LIGHTGUN_Y) gameinfo->usesLightGun = TRUE; if (type == IPT_MOUSE_X || type == IPT_MOUSE_Y) gameinfo->usesMouse = TRUE; } } } } UpdateController(); } return &drivers_info[driver_index]; }
static struct DriversInfo* GetDriversInfo(int driver_index) { if (drivers_info == NULL) { int ndriver; drivers_info = (DriversInfo*)malloc(sizeof(struct DriversInfo) * driver_list_get_count(drivers)); for (ndriver = 0; ndriver < driver_list_get_count(drivers); ndriver++) { const game_driver *gamedrv = drivers[ndriver]; struct DriversInfo *gameinfo = &drivers_info[ndriver]; const rom_entry *region, *rom; windows_options pCurrentOpts; load_options(pCurrentOpts, OPTIONS_GLOBAL, driver_index); machine_config config(*gamedrv,pCurrentOpts); const rom_source *source; int num_speakers; gameinfo->isClone = (GetParentRomSetIndex(gamedrv) != -1); gameinfo->isBroken = ((gamedrv->flags & GAME_NOT_WORKING) != 0); gameinfo->supportsSaveState = ((gamedrv->flags & GAME_SUPPORTS_SAVE) != 0); gameinfo->isHarddisk = FALSE; gameinfo->isVertical = (gamedrv->flags & ORIENTATION_SWAP_XY) ? TRUE : FALSE; for (source = rom_first_source(config); source != NULL; source = rom_next_source(*source)) { for (region = rom_first_region(*source); region; region = rom_next_region(region)) { if (ROMREGION_ISDISKDATA(region)) gameinfo->isHarddisk = TRUE; } } gameinfo->hasOptionalBIOS = FALSE; if (gamedrv->rom != NULL) { for (rom = gamedrv->rom; !ROMENTRY_ISEND(rom); rom++) { if (ROMENTRY_ISSYSTEM_BIOS(rom)) { gameinfo->hasOptionalBIOS = TRUE; break; } } } num_speakers = numberOfSpeakers(&config); gameinfo->isStereo = (num_speakers > 1); gameinfo->screenCount = numberOfScreens(&config); gameinfo->isVector = isDriverVector(&config); // ((drv.video_attributes & VIDEO_TYPE_VECTOR) != 0); gameinfo->usesRoms = FALSE; for (source = rom_first_source(config); source != NULL; source = rom_next_source(*source)) { for (region = rom_first_region(*source); region; region = rom_next_region(region)) { for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { gameinfo->usesRoms = TRUE; break; } } } gameinfo->usesSamples = FALSE; { const device_config_sound_interface *sound = NULL; const char * const * samplenames = NULL; for (bool gotone = config.m_devicelist.first(sound); gotone; gotone = sound->next(sound)) { if (sound->devconfig().type() == SAMPLES) { const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config(); samplenames = intf->samplenames; if (samplenames != 0 && samplenames[0] != 0) { gameinfo->usesSamples = TRUE; break; } } } } gameinfo->usesTrackball = FALSE; gameinfo->usesLightGun = FALSE; if (gamedrv->ipt != NULL) { const input_port_config *port; ioport_list portlist; input_port_list_init(portlist, gamedrv->ipt, NULL, 0, FALSE, NULL); for (device_config *cfg = config.m_devicelist.first(); cfg != NULL; cfg = cfg->next()) { if (cfg->input_ports()!=NULL) { input_port_list_init(portlist, cfg->input_ports(), NULL, 0, FALSE, cfg); } } for (port = portlist.first(); port != NULL; port = port->next()) { const input_field_config *field; for (field = port->fieldlist; field != NULL; field = field->next) { UINT32 type; type = field->type; if (type == IPT_END) break; if (type == IPT_DIAL || type == IPT_PADDLE || type == IPT_TRACKBALL_X || type == IPT_TRACKBALL_Y || type == IPT_AD_STICK_X || type == IPT_AD_STICK_Y) gameinfo->usesTrackball = TRUE; if (type == IPT_LIGHTGUN_X || type == IPT_LIGHTGUN_Y) gameinfo->usesLightGun = TRUE; if (type == IPT_MOUSE_X || type == IPT_MOUSE_Y) gameinfo->usesMouse = TRUE; } } } } } return &drivers_info[driver_index]; }
static struct DriversInfo* GetDriversInfo(int driver_index) { if (drivers_info == NULL) { UINT16 ndriver; drivers_info = (DriversInfo*)malloc(sizeof(struct DriversInfo) * GetNumGames()); for (ndriver = 0; ndriver < GetNumGames(); ndriver++) { const game_driver *gamedrv = &driver_list::driver(ndriver); struct DriversInfo *gameinfo = &drivers_info[ndriver]; const rom_entry *region, *rom; machine_config config(*gamedrv, MameUIGlobal()); const rom_source *source; int num_speakers; gameinfo->isClone = (GetParentRomSetIndex(gamedrv) != -1); gameinfo->isBroken = ((gamedrv->flags & GAME_NOT_WORKING) != 0); gameinfo->supportsSaveState = ((gamedrv->flags & GAME_SUPPORTS_SAVE) != 0); gameinfo->isHarddisk = FALSE; gameinfo->isVertical = (gamedrv->flags & ORIENTATION_SWAP_XY) ? TRUE : FALSE; for (source = rom_first_source(config); source != NULL; source = rom_next_source(*source)) for (region = rom_first_region(*source); region; region = rom_next_region(region)) if (ROMREGION_ISDISKDATA(region)) gameinfo->isHarddisk = TRUE; gameinfo->hasOptionalBIOS = FALSE; if (gamedrv->rom != NULL) for (rom = gamedrv->rom; !ROMENTRY_ISEND(rom); rom++) if (ROMENTRY_ISSYSTEM_BIOS(rom)) { gameinfo->hasOptionalBIOS = TRUE; break; } num_speakers = numberOfSpeakers(&config); gameinfo->isStereo = (num_speakers > 1); gameinfo->screenCount = numberOfScreens(&config); gameinfo->isVector = isDriverVector(&config); // ((drv.video_attributes & VIDEO_TYPE_VECTOR) != 0); gameinfo->usesRoms = FALSE; for (source = rom_first_source(config); source != NULL; source = rom_next_source(*source)) for (region = rom_first_region(*source); region; region = rom_next_region(region)) for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { gameinfo->usesRoms = TRUE; break; } gameinfo->usesSamples = FALSE; samples_device_iterator iter(config.root_device()); if (iter.first() != NULL) gameinfo->usesSamples = TRUE; gameinfo->numPlayers = 0; gameinfo->numButtons = 0; memset(gameinfo->usesController, 0, sizeof gameinfo->usesController); gameinfo->parentIndex = -1; if (gameinfo->isClone) { int i; for (i = 0; i < GetNumGames(); i++) { if (GetParentRomSetIndex(gamedrv) == i) { gameinfo->parentIndex = i; break; } } } gameinfo->biosIndex = -1; if (DriverIsBios(ndriver)) gameinfo->biosIndex = ndriver; else if (gameinfo->hasOptionalBIOS) { int parentIndex; if (gameinfo->isClone) parentIndex = gameinfo->parentIndex; else parentIndex = ndriver; while (1) { parentIndex = GetGameNameIndex(driver_list::driver(parentIndex).parent); if (parentIndex == -1) { dprintf("bios for %s is not found", driver_list::driver(ndriver).name); break; } if (DriverIsBios(parentIndex)) { gameinfo->biosIndex = parentIndex; break; } } } gameinfo->usesTrackball = FALSE; gameinfo->usesLightGun = FALSE; if (gamedrv->ipt != NULL) { input_port_config *port; ioport_list portlist; astring errors; device_iterator iter(config.root_device()); for (device_t *device = iter.first(); device != NULL; device = iter.next()) if (device->input_ports()!=NULL) input_port_list_init(*device, portlist, errors); for (port = portlist.first(); port != NULL; port = port->next()) { const input_field_config *field; for (field = port->first_field(); field != NULL; field = field->next()) { UINT32 type; type = field->type; if (type == IPT_END) break; if (type == IPT_DIAL || type == IPT_PADDLE || type == IPT_TRACKBALL_X || type == IPT_TRACKBALL_Y || type == IPT_AD_STICK_X || type == IPT_AD_STICK_Y) gameinfo->usesTrackball = TRUE; if (type == IPT_LIGHTGUN_X || type == IPT_LIGHTGUN_Y) gameinfo->usesLightGun = TRUE; if (type == IPT_MOUSE_X || type == IPT_MOUSE_Y) gameinfo->usesMouse = TRUE; } } } } UpdateController(); } return &drivers_info[driver_index]; }