// Verifies the ROM set while calling SetRomAuditResults int MameUIVerifyRomSet(int game) { audit_record *audit; int audit_records; int res; // perform the audit audit_records = audit_images(MameUIGlobal(), drivers[game], AUDIT_VALIDATE_FAST, &audit); res = ProcessAuditResults(game, audit, audit_records); if (audit_records > 0) global_free(audit); SetRomAuditResults(game, res); return res; }
// Verifies the Sample set while calling SetSampleAuditResults int MameUIVerifySampleSet(int game) { audit_record *audit; int audit_records; int res; // perform the audit audit_records = audit_samples(MameUIGlobal(), drivers[game], &audit); res = ProcessAuditResults(game, audit, audit_records); if (audit_records > 0) global_free(audit); SetSampleAuditResults(game, res); return res; }
static void MessSetupDevice(common_file_dialog_proc cfd, const device_image_interface *dev) { TCHAR filename[MAX_PATH]; mess_image_type imagetypes[256]; int drvindex = 0; HWND hwndList; char* utf8_filename; BOOL bResult = 0; std::string dst = GetSWDir(); // We only want the first path; throw out the rest size_t i = dst.find(';'); if (i > 0) dst.substr(0, i); wchar_t* t_s = ui_wstring_from_utf8(dst.c_str()); // begin_resource_tracking(); hwndList = GetDlgItem(GetMainWindow(), IDC_LIST); drvindex = Picker_GetSelectedItem(hwndList); // allocate the machine config machine_config config(driver_list::driver(drvindex),MameUIGlobal()); SetupImageTypes(&config, imagetypes, ARRAY_LENGTH(imagetypes), TRUE, dev); bResult = CommonFileImageDialog(t_s, cfd, filename, &config, imagetypes); free(t_s); CleanupImageTypes(imagetypes, ARRAY_LENGTH(imagetypes)); if (bResult) { utf8_filename = ui_utf8_from_wstring(filename); if( !utf8_filename ) return; // TODO - this should go against InternalSetSelectedSoftware() SoftwarePicker_AddFile(GetDlgItem(GetMainWindow(), IDC_SWLIST), utf8_filename, 0); free(utf8_filename); } }
int load_driver_mameinfo(const game_driver *drv, char *buffer, int bufsize, int filenum) { machine_config config(*drv, MameUIGlobal()); const game_driver *parent = NULL; char name[512]; int mameinfo = 0; int is_bios = 0; *buffer = 0; if (filenum) snprintf(filename, ARRAY_LENGTH(filename), "%s\\messinfo.dat", GetDatsDir()); else snprintf(filename, ARRAY_LENGTH(filename), "%s\\mameinfo.dat", GetDatsDir()); if (filenum) strcat(buffer, "\n**** MESSINFO: ****\n\n"); else strcat(buffer, "\n**** MAMEINFO: ****\n\n"); /* List the game info 'flags' */ if (drv->flags & MACHINE_NOT_WORKING) strcat(buffer, "THIS GAME DOESN'T WORK PROPERLY\n"); if (drv->flags & MACHINE_UNEMULATED_PROTECTION) strcat(buffer, "The game has protection which isn't fully emulated.\n"); if (drv->flags & MACHINE_IMPERFECT_GRAPHICS) strcat(buffer, "The video emulation isn't 100% accurate.\n"); if (drv->flags & MACHINE_WRONG_COLORS) strcat(buffer, "The colors are completely wrong.\n"); if (drv->flags & MACHINE_IMPERFECT_COLORS) strcat(buffer, "The colors aren't 100% accurate.\n"); if (drv->flags & MACHINE_NO_SOUND) strcat(buffer, "The game lacks sound.\n"); if (drv->flags & MACHINE_IMPERFECT_SOUND) strcat(buffer, "The sound emulation isn't 100% accurate.\n"); if (drv->flags & MACHINE_SUPPORTS_SAVE) strcat(buffer, "Save state support.\n"); if (drv->flags & MACHINE_MECHANICAL) strcat(buffer, "The game contains mechanical parts.\n"); strcat(buffer, "\n"); if (drv->flags & MACHINE_IS_BIOS_ROOT) is_bios = 1; /* try to open mameinfo datafile */ if (ParseOpen(filename)) { if (filenum) { /* create index if necessary */ if (mess_idx) mameinfo = 1; else mameinfo = (index_datafile (&mess_idx, 0) != 0); /* load informational text (append) */ if (mess_idx) { int len = strlen(buffer); int err = 0; const game_driver *gdrv; gdrv = drv; do { err = load_datafile_text(gdrv, buffer + len, bufsize - len, mess_idx, DATAFILE_TAG_MAME, 0, 1); int g = driver_list::clone(*gdrv); if (g!=-1) gdrv = &driver_list::driver(g); else gdrv = NULL; } while (err && gdrv); if (err) mameinfo = 0; } } else { /* create index if necessary */ if (mame_idx) mameinfo = 1; else mameinfo = (index_datafile (&mame_idx, 0) != 0); /* load informational text (append) */ if (mame_idx) { int len = strlen(buffer); int err = 0; const game_driver *gdrv; gdrv = drv; do { err = load_datafile_text(gdrv, buffer + len, bufsize - len, mame_idx, DATAFILE_TAG_MAME, 0, 1); int g = driver_list::clone(*gdrv); if (g!=-1) gdrv = &driver_list::driver(g); else gdrv = NULL; } while (err && gdrv); if (err) mameinfo = 0; } } ParseClose(); } /* GAME INFORMATIONS */ snprintf(name, ARRAY_LENGTH(name), "\nGAME: %s\n", drv->name); strcat(buffer, name); snprintf(name, ARRAY_LENGTH(name), "%s", drv->description); strcat(buffer, name); snprintf(name, ARRAY_LENGTH(name), " (%s %s)\n\nCPU:\n", drv->manufacturer, drv->year); strcat(buffer, name); /* iterate over CPUs */ execute_interface_iterator iter(config.root_device()); device_execute_interface *cpu = iter.first(); while (cpu) { if (cpu->device().clock() >= 1000000) snprintf(name, ARRAY_LENGTH(name), "%s %d.%06d MHz\n", cpu->device().name(), cpu->device().clock() / 1000000, cpu->device().clock() % 1000000); else snprintf(name, ARRAY_LENGTH(name), "%s %d.%03d kHz\n", cpu->device().name(), cpu->device().clock() / 1000, cpu->device().clock() % 1000); strcat(buffer, name); cpu = iter.next(); } strcat(buffer, "\nSOUND:\n"); int has_sound = 0; /* iterate over sound chips */ sound_interface_iterator sounditer(config.root_device()); const device_sound_interface *sound = sounditer.first(); while(sound) { int clock = 0; int count = 0; device_type sound_type_; char tmpname[1024]; snprintf(tmpname, ARRAY_LENGTH(tmpname), "%s", sound->device().name()); sound_type_ = sound->device().type(); clock = sound->device().clock(); has_sound = 1; count = 1; sound = sounditer.next(); /* Matching chips at the same clock are aggregated */ while (sound && sound->device().type() == sound_type_ && sound->device().clock() == clock) { count++; sound = sounditer.next(); } if (count > 1) { snprintf(name, ARRAY_LENGTH(name), "%dx ",count); strcat(buffer, name); } strcat(buffer, tmpname); if (clock) { if (clock >= 1000000) snprintf(name, ARRAY_LENGTH(name), " %d.%06d MHz", clock / 1000000, clock % 1000000); else snprintf(name, ARRAY_LENGTH(name), " %d.%03d kHz", clock / 1000, clock % 1000); strcat(buffer, name); } strcat(buffer, "\n"); } if (has_sound) { speaker_device_iterator iter(config.root_device()); int channels = iter.count(); if(channels == 1) snprintf(name, ARRAY_LENGTH(name), "%d Channel\n",channels); else snprintf(name, ARRAY_LENGTH(name), "%dx Channels\n",channels); strcat(buffer, name); } strcat(buffer, "\nVIDEO:\n"); screen_device_iterator screeniter(config.root_device()); const screen_device *screen = screeniter.first(); if (screen == nullptr) strcat(buffer, "Screenless\n"); else if (screen->screen_type() == SCREEN_TYPE_VECTOR) strcat(buffer,"Vector\n"); else { for (; screen != nullptr; screen = screeniter.next()) { if (drv->flags & ORIENTATION_SWAP_XY) snprintf(name, ARRAY_LENGTH(name), "%d x %d (V)", screen->visible_area().height(), screen->visible_area().width()); else snprintf(name, ARRAY_LENGTH(name), "%d x %d (H)", screen->visible_area().width(), screen->visible_area().height()); strcat(buffer, name); snprintf(name, ARRAY_LENGTH(name), " %f Hz", ATTOSECONDS_TO_HZ(screen->refresh_attoseconds())); strcat(buffer, name); strcat(buffer, "\n"); } } strcat(buffer, "\nROM REGION:\n"); int g = driver_list::clone(*drv); if (g!=-1) parent = &driver_list::driver(g); device_iterator deviter(config.root_device()); for (device_t *device = deviter.first(); device; device = deviter.next()) { for (const rom_entry *region = rom_first_region(*device); region != nullptr; region = rom_next_region(region)) { for (const rom_entry *rom = rom_first_file(region); rom != nullptr; rom = rom_next_file(rom)) { hash_collection hashes(ROM_GETHASHDATA(rom)); if (g!=-1) { machine_config pconfig(*parent, MameUIGlobal()); device_iterator deviter(pconfig.root_device()); for (device_t *device = deviter.first(); device != nullptr; device = deviter.next()) for (const rom_entry *pregion = rom_first_region(*device); pregion != nullptr; pregion = rom_next_region(pregion)) for (const rom_entry *prom = rom_first_file(pregion); prom != nullptr; prom = rom_next_file(prom)) { hash_collection phashes(ROM_GETHASHDATA(prom)); if (hashes == phashes) break; } } snprintf(name, ARRAY_LENGTH(name), "%-16s \t", ROM_GETNAME(rom)); strcat(buffer, name); snprintf(name, ARRAY_LENGTH(name), "%09d \t", rom_file_size(rom)); strcat(buffer, name); snprintf(name, ARRAY_LENGTH(name), "%-10s", ROMREGION_GETTAG(region)); strcat(buffer, name); strcat(buffer, "\n"); } } } samples_device_iterator samplesiter(config.root_device()); for (samples_device *device = samplesiter.first(); device != nullptr; device = samplesiter.next()) { samples_iterator sampiter(*device); if (sampiter.altbasename() != nullptr) { snprintf(name, ARRAY_LENGTH(name), "\nSAMPLES (%s):\n", sampiter.altbasename()); strcat(buffer, name); } std::unordered_set<std::string> already_printed; for (const char *samplename = sampiter.first(); samplename != nullptr; samplename = sampiter.next()) { // filter out duplicates if (!already_printed.insert(samplename).second) continue; // output the sample name snprintf(name, ARRAY_LENGTH(name), "%s.wav\n", samplename); strcat(buffer, name); } } if (!is_bios) { int g = driver_list::clone(*drv); if (g!=-1) drv = &driver_list::driver(g); strcat(buffer, "\nORIGINAL:\n"); strcat(buffer, drv->description); strcat(buffer, "\n\nCLONES:\n"); for (int i = 0; i < driver_list::total(); i++) { if (!strcmp (drv->name, driver_list::driver(i).parent)) { strcat(buffer, driver_list::driver(i).description); strcat(buffer, "\n"); } } } strcat(buffer, "\n"); return (mameinfo == 0); }
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(); }
void MyFillSoftwareList(int drvindex, BOOL bForce) { BOOL is_same = 0; HWND hwndSoftwarePicker; HWND hwndSoftwareList; HWND hwndSoftwareDevView; // do we have to do anything? if (!bForce) { if (s_config != NULL) is_same = (drvindex == s_config->driver_index); else is_same = (drvindex < 0); if (is_same) return; } // free the machine config, if necessary MySoftwareListClose(); // allocate the machine config, if necessary if (drvindex >= 0) s_config = software_config_alloc(drvindex); // locate key widgets hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST); hwndSoftwareList = GetDlgItem(GetMainWindow(), IDC_SOFTLIST); hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW); // set up the device view DevView_SetDriver(hwndSoftwareDevView, s_config); // set up the software picker SoftwarePicker_Clear(hwndSoftwarePicker); SoftwarePicker_SetDriver(hwndSoftwarePicker, s_config); // Get the game's software path int driver_index = drvindex; windows_options o; load_options(o, OPTIONS_GAME, driver_index); const char* paths = o.value(OPTION_SWPATH); if (paths && (paths[0] > 64)) {} else // search deeper when looking for software { // not specified in driver, try parent if it has one int nParentIndex = -1; if (DriverIsClone(driver_index) == TRUE) { nParentIndex = GetParentIndex(&driver_list::driver(driver_index)); if (nParentIndex >= 0) { load_options(o, OPTIONS_PARENT, nParentIndex); paths = o.value(OPTION_SWPATH); } } if (paths && (paths[0] > 64)) {} else { // still nothing, try for a system in the 'compat' field if (nParentIndex >= 0) driver_index = nParentIndex; // now recycle variable as a compat system number nParentIndex = GetCompatIndex(&driver_list::driver(driver_index)); if (nParentIndex >= 0) { load_options(o, OPTIONS_PARENT, nParentIndex); paths = o.value(OPTION_SWPATH); } } } // These are the only paths that matter AddSoftwarePickerDirs(hwndSoftwarePicker, paths, NULL); paths = 0; // set up the software picker SoftwareList_Clear(hwndSoftwareList); SoftwareList_SetDriver(hwndSoftwareList, s_config); /* allocate the machine config */ machine_config config(driver_list::driver(drvindex),MameUIGlobal()); for (software_list_device &swlistdev : software_list_device_iterator(config.root_device())) { for (const software_info &swinfo : swlistdev.get_info()) { const software_part &swpart = swinfo.parts().front(); // search for a device with the right interface for (device_image_interface &image : image_interface_iterator(config.root_device())) { const char *interface = image.image_interface(); if (interface) { if (swpart.matches_interface(interface)) { // Extract the Usage data from the "info" fields. const char* usage = NULL; for (const feature_list_item &flist : swinfo.other_info()) if (flist.name() == "usage") usage = flist.value().c_str(); // Now actually add the item SoftwareList_AddFile(hwndSoftwareList, swinfo.shortname().c_str(), swlistdev.list_name().c_str(), swinfo.longname().c_str(), swinfo.publisher().c_str(), swinfo.year().c_str(), usage, image.brief_instance_name()); break; } } } } } }
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]; }
static void UpdateController(void) { struct control_cache_t *cache; ioport_constructor last_ipt = NULL; BOOL flags[CONTROLLER_MAX]; int nGames = GetNumGames(); int b = 0; int p = 0; int i; cache = (control_cache_t *)malloc(sizeof (*cache) * nGames); if (cache == NULL) return; for (i = 0; i < nGames; i++) { cache[i].ipt = driver_list::driver(i).ipt; cache[i].num = i; } qsort(cache, nGames, sizeof (*cache), cmp_ipt); for (i = 0; i < nGames; i++) { struct DriversInfo *gameinfo = &drivers_info[cache[i].num]; if (!cache[i].ipt) continue; if (cache[i].ipt != last_ipt) { const input_port_config *port; ioport_list portlist; astring errors; int w = CONTROLLER_JOY8WAY; BOOL lr = FALSE; BOOL ud = FALSE; BOOL dual = FALSE; last_ipt = cache[i].ipt; memset(flags, 0, sizeof flags); b = 0; p = 0; machine_config config(driver_list::driver(i), MameUIGlobal()); 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()) { int n; if (p < field->player + 1) p = field->player + 1; n = field->type - IPT_BUTTON1 + 1; if (n >= 1 && n <= MAX_NORMAL_BUTTONS && n > b) { b = n; continue; } switch (field->type) { case IPT_JOYSTICKRIGHT_LEFT: case IPT_JOYSTICKRIGHT_RIGHT: case IPT_JOYSTICKLEFT_LEFT: case IPT_JOYSTICKLEFT_RIGHT: dual = TRUE; case IPT_JOYSTICK_LEFT: case IPT_JOYSTICK_RIGHT: lr = TRUE; if (field->way == 4) w = CONTROLLER_JOY4WAY; else if (field->way == 16) w = CONTROLLER_JOY16WAY; break; case IPT_JOYSTICKRIGHT_UP: case IPT_JOYSTICKRIGHT_DOWN: case IPT_JOYSTICKLEFT_UP: case IPT_JOYSTICKLEFT_DOWN: dual = TRUE; case IPT_JOYSTICK_UP: case IPT_JOYSTICK_DOWN: ud = TRUE; if (field->way == 4) w = CONTROLLER_JOY4WAY; else if (field->way == 16) w = CONTROLLER_JOY16WAY; break; case IPT_PADDLE: flags[CONTROLLER_PADDLE] = TRUE; break; case IPT_DIAL: flags[CONTROLLER_DIAL] = TRUE; break; case IPT_TRACKBALL_X: case IPT_TRACKBALL_Y: flags[CONTROLLER_TRACKBALL] = TRUE; break; case IPT_AD_STICK_X: case IPT_AD_STICK_Y: flags[CONTROLLER_ADSTICK] = TRUE; break; case IPT_LIGHTGUN_X: case IPT_LIGHTGUN_Y: flags[CONTROLLER_LIGHTGUN] = TRUE; break; case IPT_PEDAL: flags[CONTROLLER_PEDAL] = TRUE; break; } } } //input_port_list_deinit(&portlist); if (lr || ud) { if (lr && !ud) w = CONTROLLER_JOY2WAY; else if (!lr && ud) w = CONTROLLER_VJOY2WAY; if (dual) w += CONTROLLER_DOUBLEJOY2WAY - CONTROLLER_JOY2WAY; flags[w] = TRUE; } } gameinfo->numPlayers = p; gameinfo->numButtons = b; memcpy(gameinfo->usesController, flags, sizeof gameinfo->usesController); } free(cache); }