src/mess/image.c
| r2491 | r2492 | |
| 458 | 458 | |
| 459 | 459 | image_device_info image_device_getinfo(const machine_config *config, const device_config *device) |
| 460 | 460 | { |
| 461 | const device_config *this_device; |
| 461 | 462 | image_device_info info; |
| 463 | int found; |
| 462 | 464 | |
| 463 | 465 | /* sanity checks */ |
| 464 | 466 | assert((device->machine == NULL) || (device->machine->config == config)); |
| 467 | if (device->machine == NULL) |
| 468 | { |
| 469 | found = FALSE; |
| 470 | for (this_device = image_device_first(config); this_device != NULL; this_device = image_device_next(this_device)) |
| 471 | { |
| 472 | if (this_device == device) |
| 473 | found = TRUE; |
| 474 | } |
| 475 | assert(found); |
| 476 | } |
| 465 | 477 | |
| 466 | 478 | /* clear return value */ |
| 467 | 479 | memset(&info, 0, sizeof(info)); |
src/mess/osd/winui/messui.c
| r2491 | r2492 | |
| 481 | 481 | // Places the specified image in the specified slot; nID = -1 means don't matter |
| 482 | 482 | static void MessSpecifyImage(int drvindex, const device_config *device, LPCSTR pszFilename) |
| 483 | 483 | { |
| 484 | | machine_config *config; |
| 485 | 484 | const char *s; |
| 486 | 485 | |
| 487 | 486 | if (LOG_SOFTWARE) |
| 488 | 487 | dprintf("MessSpecifyImage(): device=%p pszFilename='%s'\n", device, pszFilename); |
| 489 | 488 | |
| 490 | | // allocate the machine config |
| 491 | | config = machine_config_alloc_with_mess_devices(drivers[drvindex]); |
| 492 | | |
| 493 | 489 | // if device is NULL, this is a special case; try to find existing image |
| 494 | 490 | if (device == NULL) |
| 495 | 491 | { |
| 496 | | for (device = image_device_first(config); device != NULL; device = image_device_next(device)) |
| 492 | for (device = image_device_first(config->mconfig); device != NULL; device = image_device_next(device)) |
| 497 | 493 | { |
| 498 | | s = GetSelectedSoftware(drvindex, config, device); |
| 494 | s = GetSelectedSoftware(drvindex, config->mconfig, device); |
| 499 | 495 | if ((s != NULL) && !mame_stricmp(s, pszFilename)) |
| 500 | 496 | break; |
| 501 | 497 | } |
| r2491 | r2492 | |
| 513 | 509 | |
| 514 | 510 | if (file_extension != NULL) |
| 515 | 511 | { |
| 516 | | for (device = image_device_first(config); device != NULL; device = image_device_next(device)) |
| 512 | for (device = image_device_first(config->mconfig); device != NULL; device = image_device_next(device)) |
| 517 | 513 | { |
| 518 | | s = GetSelectedSoftware(drvindex, config, device); |
| 514 | s = GetSelectedSoftware(drvindex, config->mconfig, device); |
| 519 | 515 | if (is_null_or_empty(s) && image_device_uses_file_extension(device, file_extension)) |
| 520 | 516 | break; |
| 521 | 517 | } |
| r2491 | r2492 | |
| 525 | 521 | if (device != NULL) |
| 526 | 522 | { |
| 527 | 523 | // place the image |
| 528 | | InternalSetSelectedSoftware(drvindex, config, device, pszFilename); |
| 524 | InternalSetSelectedSoftware(drvindex, config->mconfig, device, pszFilename); |
| 529 | 525 | } |
| 530 | 526 | else |
| 531 | 527 | { |
| r2491 | r2492 | |
| 533 | 529 | if (LOG_SOFTWARE) |
| 534 | 530 | dprintf("MessSpecifyImage(): Failed to place image '%s'\n", pszFilename); |
| 535 | 531 | } |
| 536 | | |
| 537 | | machine_config_free(config); |
| 538 | 532 | } |
| 539 | 533 | |
| 540 | 534 | |