diff --git a/src/devices/bus/a7800/a78_slot.cpp b/src/devices/bus/a7800/a78_slot.cpp index 2f407adb3743f..1af02ee3bda78 100644 --- a/src/devices/bus/a7800/a78_slot.cpp +++ b/src/devices/bus/a7800/a78_slot.cpp @@ -565,7 +565,7 @@ std::string a78_cart_slot_device::get_default_card_software(get_default_card_sof return std::string(slot_string); } else - return software_get_default_slot("a78_rom"); + return software_get_default_slot(hook.image_name(), "a78_rom"); } diff --git a/src/devices/bus/a800/a800_slot.cpp b/src/devices/bus/a800/a800_slot.cpp index dfda1e42429f1..d5de0fdd625ec 100644 --- a/src/devices/bus/a800/a800_slot.cpp +++ b/src/devices/bus/a800/a800_slot.cpp @@ -683,7 +683,7 @@ std::string a800_cart_slot_device::get_default_card_software(get_default_card_so return std::string(slot_string); } - return software_get_default_slot(is_xegs ? "xegs" : "a800_8k"); + return software_get_default_slot(hook.image_name(), is_xegs ? "xegs" : "a800_8k"); } @@ -716,7 +716,7 @@ std::string a5200_cart_slot_device::get_default_card_software(get_default_card_s return std::string(slot_string); } - return software_get_default_slot("a5200_rom"); + return software_get_default_slot(hook.image_name(), "a5200_rom"); } diff --git a/src/devices/bus/adam/exp.cpp b/src/devices/bus/adam/exp.cpp index 33b950a177616..27ba71ef836df 100644 --- a/src/devices/bus/adam/exp.cpp +++ b/src/devices/bus/adam/exp.cpp @@ -107,7 +107,7 @@ std::pair adam_expansion_slot_device::call_lo std::string adam_expansion_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("standard"); + return software_get_default_slot(hook.image_name(), "standard"); } diff --git a/src/devices/bus/apf/slot.cpp b/src/devices/bus/apf/slot.cpp index 2c5c3edb7f7e7..58061175821d9 100644 --- a/src/devices/bus/apf/slot.cpp +++ b/src/devices/bus/apf/slot.cpp @@ -214,7 +214,7 @@ std::string apf_cart_slot_device::get_default_card_software(get_default_card_sof return std::string(slot_string); } - return software_get_default_slot("std"); + return software_get_default_slot(hook.image_name(), "std"); } /*------------------------------------------------- diff --git a/src/devices/bus/aquarius/slot.cpp b/src/devices/bus/aquarius/slot.cpp index aa3863963c61c..25d5b70399f43 100644 --- a/src/devices/bus/aquarius/slot.cpp +++ b/src/devices/bus/aquarius/slot.cpp @@ -129,7 +129,7 @@ std::string aquarius_cartridge_slot_device::get_default_card_software(get_defaul return std::string(slot_string); } else - return software_get_default_slot("rom"); + return software_get_default_slot(hook.image_name(), "rom"); } //------------------------------------------------- diff --git a/src/devices/bus/arcadia/slot.cpp b/src/devices/bus/arcadia/slot.cpp index 5390ca91bf449..3fada4fa51c44 100644 --- a/src/devices/bus/arcadia/slot.cpp +++ b/src/devices/bus/arcadia/slot.cpp @@ -205,7 +205,7 @@ std::pair arcadia_cart_slot_device::call_load std::string arcadia_cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("std"); + return software_get_default_slot(hook.image_name(), "std"); } /*------------------------------------------------- diff --git a/src/devices/bus/astrocde/slot.cpp b/src/devices/bus/astrocde/slot.cpp index 3cc5ba6e8f518..464a4cefa6222 100644 --- a/src/devices/bus/astrocde/slot.cpp +++ b/src/devices/bus/astrocde/slot.cpp @@ -193,7 +193,7 @@ std::string astrocade_cart_slot_device::get_default_card_software(get_default_ca return std::string(slot_string); } - return software_get_default_slot("rom"); + return software_get_default_slot(hook.image_name(), "rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/bbc/rom/slot.cpp b/src/devices/bus/bbc/rom/slot.cpp index 744d9ea968184..683b76dc7be3f 100644 --- a/src/devices/bus/bbc/rom/slot.cpp +++ b/src/devices/bus/bbc/rom/slot.cpp @@ -163,7 +163,7 @@ void bbc_romslot_device::call_unload() std::string bbc_romslot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("rom"); + return software_get_default_slot(hook.image_name(), "rom"); } diff --git a/src/devices/bus/c64/exp.cpp b/src/devices/bus/c64/exp.cpp index 7a53fadbf14c2..1f9a99632f462 100644 --- a/src/devices/bus/c64/exp.cpp +++ b/src/devices/bus/c64/exp.cpp @@ -224,7 +224,7 @@ std::string c64_expansion_slot_device::get_default_card_software(get_default_car return cbm_crt_get_card(*hook.image_file()); } - return software_get_default_slot("standard"); + return software_get_default_slot(hook.image_name(), "standard"); } diff --git a/src/devices/bus/casloopy/slot.cpp b/src/devices/bus/casloopy/slot.cpp index e1490496e2177..f4c6eec5f2192 100644 --- a/src/devices/bus/casloopy/slot.cpp +++ b/src/devices/bus/casloopy/slot.cpp @@ -145,5 +145,5 @@ void casloopy_cart_slot_device::call_unload() std::string casloopy_cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("std"); + return software_get_default_slot(hook.image_name(), "std"); } diff --git a/src/devices/bus/cbm2/exp.cpp b/src/devices/bus/cbm2/exp.cpp index 187c98ef5aa7a..31c8711189d97 100644 --- a/src/devices/bus/cbm2/exp.cpp +++ b/src/devices/bus/cbm2/exp.cpp @@ -140,7 +140,7 @@ std::pair cbm2_expansion_slot_device::call_lo std::string cbm2_expansion_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("standard"); + return software_get_default_slot(hook.image_name(), "standard"); } diff --git a/src/devices/bus/chanf/slot.cpp b/src/devices/bus/chanf/slot.cpp index 6092103eb1d41..ea71b09382e91 100644 --- a/src/devices/bus/chanf/slot.cpp +++ b/src/devices/bus/chanf/slot.cpp @@ -209,7 +209,7 @@ std::string channelf_cart_slot_device::get_default_card_software(get_default_car return std::string(slot_string); } - return software_get_default_slot("chess"); + return software_get_default_slot(hook.image_name(), "chess"); } /*------------------------------------------------- diff --git a/src/devices/bus/coco/cococart.cpp b/src/devices/bus/coco/cococart.cpp index 59ebce1852db2..70972757151eb 100644 --- a/src/devices/bus/coco/cococart.cpp +++ b/src/devices/bus/coco/cococart.cpp @@ -636,7 +636,7 @@ std::string cococart_slot_device::get_default_card_software(get_default_card_sof } // lookup the default slot - return software_get_default_slot(coco_rpk_cardslottypes[pcb_type]); + return software_get_default_slot(hook.image_name(), coco_rpk_cardslottypes[pcb_type]); } diff --git a/src/devices/bus/coleco/cartridge/exp.cpp b/src/devices/bus/coleco/cartridge/exp.cpp index 3b5d35b9b4990..2cfeea8e1dea3 100644 --- a/src/devices/bus/coleco/cartridge/exp.cpp +++ b/src/devices/bus/coleco/cartridge/exp.cpp @@ -113,13 +113,13 @@ std::string colecovision_cartridge_slot_device::get_default_card_software(get_de hook.image_file()->length(length); // FIXME: check error return if (length == 0x100000 || length == 0x200000) - return software_get_default_slot("xin1"); + return software_get_default_slot(hook.image_name(), "xin1"); if (length > 0x8000) // Assume roms longer than 32K are megacarts. - return software_get_default_slot("megacart"); + return software_get_default_slot(hook.image_name(), "megacart"); } - return software_get_default_slot("standard"); + return software_get_default_slot(hook.image_name(), "standard"); } diff --git a/src/devices/bus/crvision/slot.cpp b/src/devices/bus/crvision/slot.cpp index 0b28124eb5b0a..b4bcac7d33284 100644 --- a/src/devices/bus/crvision/slot.cpp +++ b/src/devices/bus/crvision/slot.cpp @@ -240,7 +240,7 @@ std::string crvision_cart_slot_device::get_default_card_software(get_default_car return std::string(slot_string); } - return software_get_default_slot("crv_rom4k"); + return software_get_default_slot(hook.image_name(), "crv_rom4k"); } /*------------------------------------------------- diff --git a/src/devices/bus/ekara/slot.cpp b/src/devices/bus/ekara/slot.cpp index 33f4e087fa43e..372df637314c5 100644 --- a/src/devices/bus/ekara/slot.cpp +++ b/src/devices/bus/ekara/slot.cpp @@ -195,7 +195,7 @@ std::string ekara_cart_slot_device::get_default_card_software(get_default_card_s return std::string(slot_string); } - return software_get_default_slot("plain"); + return software_get_default_slot(hook.image_name(), "plain"); } /*------------------------------------------------- diff --git a/src/devices/bus/electron/cart/slot.cpp b/src/devices/bus/electron/cart/slot.cpp index 76ea4a63cdc05..22794e12c54ff 100644 --- a/src/devices/bus/electron/cart/slot.cpp +++ b/src/devices/bus/electron/cart/slot.cpp @@ -208,7 +208,7 @@ void electron_cartslot_device::call_unload() std::string electron_cartslot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("std"); + return software_get_default_slot(hook.image_name(), "std"); } diff --git a/src/devices/bus/gamate/slot.cpp b/src/devices/bus/gamate/slot.cpp index b627aee6d3e0e..d028860821c91 100644 --- a/src/devices/bus/gamate/slot.cpp +++ b/src/devices/bus/gamate/slot.cpp @@ -211,7 +211,7 @@ std::string gamate_cart_slot_device::get_default_card_software(get_default_card_ return std::string(slot_string); } - return software_get_default_slot("plain"); + return software_get_default_slot(hook.image_name(), "plain"); } /*------------------------------------------------- diff --git a/src/devices/bus/gameboy/gbslot.cpp b/src/devices/bus/gameboy/gbslot.cpp index 0f183b66cb153..dd873e1b2b2ab 100644 --- a/src/devices/bus/gameboy/gbslot.cpp +++ b/src/devices/bus/gameboy/gbslot.cpp @@ -1043,7 +1043,7 @@ std::string gb_cart_slot_device::get_default_card_software(get_default_card_soft } // this will return the explicit setting for a software list item - return software_get_default_slot(slotoptions::GB_STD); + return software_get_default_slot(hook.image_name(), slotoptions::GB_STD); } diff --git a/src/devices/bus/gameboy/mdslot.cpp b/src/devices/bus/gameboy/mdslot.cpp index a14ad8067f110..78f6e0c038b75 100644 --- a/src/devices/bus/gameboy/mdslot.cpp +++ b/src/devices/bus/gameboy/mdslot.cpp @@ -60,7 +60,7 @@ std::string megaduck_cart_slot_device::get_default_card_software(get_default_car else { // loading from software list - try to find matching software part - std::string const image_name(mconfig().options().image_option(instance_name()).value()); + std::string const image_name(machine().options().image_option(instance_name()).value()); software_part const *const part(!image_name.empty() ? find_software_item(image_name, true) : nullptr); if (part) { diff --git a/src/devices/bus/gba/gba_slot.cpp b/src/devices/bus/gba/gba_slot.cpp index e36c7a2650de8..266e15c9628cf 100644 --- a/src/devices/bus/gba/gba_slot.cpp +++ b/src/devices/bus/gba/gba_slot.cpp @@ -891,7 +891,7 @@ std::string gba_cart_slot_device::get_default_card_software(get_default_card_sof return std::string(slot_string); } - return software_get_default_slot("gba_rom"); + return software_get_default_slot(hook.image_name(), "gba_rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/generic/slot.cpp b/src/devices/bus/generic/slot.cpp index f2e86809a661f..445949d68ba4b 100644 --- a/src/devices/bus/generic/slot.cpp +++ b/src/devices/bus/generic/slot.cpp @@ -207,7 +207,7 @@ void generic_slot_device::call_unload() std::string generic_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot(m_default_card); + return software_get_default_slot(hook.image_name(), m_default_card); } diff --git a/src/devices/bus/intv/slot.cpp b/src/devices/bus/intv/slot.cpp index 2d905d273ae38..2649f3afd91dc 100644 --- a/src/devices/bus/intv/slot.cpp +++ b/src/devices/bus/intv/slot.cpp @@ -480,7 +480,7 @@ std::string intv_cart_slot_device::get_default_card_software(get_default_card_so return std::string(slot_string); } - return software_get_default_slot("intv_rom"); + return software_get_default_slot(hook.image_name(), "intv_rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/iq151/iq151.cpp b/src/devices/bus/iq151/iq151.cpp index aa729cefce323..7dbd98c6ab499 100644 --- a/src/devices/bus/iq151/iq151.cpp +++ b/src/devices/bus/iq151/iq151.cpp @@ -176,5 +176,5 @@ std::pair iq151cart_slot_device::call_load() std::string iq151cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("basic6"); + return software_get_default_slot(hook.image_name(), "basic6"); } diff --git a/src/devices/bus/jakks_gamekey/slot.cpp b/src/devices/bus/jakks_gamekey/slot.cpp index 7da3904f32cef..2d736c3aa7b1f 100644 --- a/src/devices/bus/jakks_gamekey/slot.cpp +++ b/src/devices/bus/jakks_gamekey/slot.cpp @@ -193,7 +193,7 @@ std::string jakks_gamekey_slot_device::get_default_card_software(get_default_car return std::string(slot_string); } - return software_get_default_slot("plain"); + return software_get_default_slot(hook.image_name(), "plain"); } /*------------------------------------------------- diff --git a/src/devices/bus/kc/kc.cpp b/src/devices/bus/kc/kc.cpp index feed0c8995e26..6f2372a704a87 100644 --- a/src/devices/bus/kc/kc.cpp +++ b/src/devices/bus/kc/kc.cpp @@ -343,5 +343,5 @@ std::pair kccart_slot_device::call_load() std::string kccart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("standard"); + return software_get_default_slot(hook.image_name(), "standard"); } diff --git a/src/devices/bus/m5/slot.cpp b/src/devices/bus/m5/slot.cpp index 1be35e6d99703..1f110c51f61b0 100644 --- a/src/devices/bus/m5/slot.cpp +++ b/src/devices/bus/m5/slot.cpp @@ -208,7 +208,7 @@ std::string m5_cart_slot_device::get_default_card_software(get_default_card_soft return result; } - return software_get_default_slot("std"); + return software_get_default_slot(hook.image_name(), "std"); } /*------------------------------------------------- diff --git a/src/devices/bus/mc10/mc10_cart.cpp b/src/devices/bus/mc10/mc10_cart.cpp index d87f34dcea279..9f584a262fe1f 100644 --- a/src/devices/bus/mc10/mc10_cart.cpp +++ b/src/devices/bus/mc10/mc10_cart.cpp @@ -127,7 +127,7 @@ std::pair mc10cart_slot_device::call_load() std::string mc10cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("pak"); + return software_get_default_slot(hook.image_name(), "pak"); } //************************************************************************** diff --git a/src/devices/bus/megadrive/cart/slot.cpp b/src/devices/bus/megadrive/cart/slot.cpp index 6c2d41f26e6db..2aef4f9b3c02c 100644 --- a/src/devices/bus/megadrive/cart/slot.cpp +++ b/src/devices/bus/megadrive/cart/slot.cpp @@ -217,7 +217,7 @@ std::string megadrive_cart_slot_device::get_default_card_software(get_default_ca } else { - return software_get_default_slot(slotoptions::MD_STD); + return software_get_default_slot(hook.image_name(), slotoptions::MD_STD); } } diff --git a/src/devices/bus/megadrive/md_slot.cpp b/src/devices/bus/megadrive/md_slot.cpp index bff49a48097cc..f6f92e4e09880 100644 --- a/src/devices/bus/megadrive/md_slot.cpp +++ b/src/devices/bus/megadrive/md_slot.cpp @@ -920,7 +920,7 @@ std::string base_md_cart_slot_device::get_default_card_software(get_default_card } else { - return software_get_default_slot("rom"); + return software_get_default_slot(hook.image_name(), "rom"); } } diff --git a/src/devices/bus/mononcol/slot.cpp b/src/devices/bus/mononcol/slot.cpp index 4a8015b54fd93..a2dcafb786f74 100644 --- a/src/devices/bus/mononcol/slot.cpp +++ b/src/devices/bus/mononcol/slot.cpp @@ -96,5 +96,5 @@ std::pair mononcol_cartslot_device::call_load std::string mononcol_cartslot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("rom"); + return software_get_default_slot(hook.image_name(), "rom"); } diff --git a/src/devices/bus/msx/cart/beepack.cpp b/src/devices/bus/msx/cart/beepack.cpp index 50623621e62bd..98c82b86cd662 100644 --- a/src/devices/bus/msx/cart/beepack.cpp +++ b/src/devices/bus/msx/cart/beepack.cpp @@ -72,7 +72,7 @@ std::pair msx_cart_beepack_device::call_load( std::string msx_cart_beepack_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("nomapper"); + return software_get_default_slot(hook.image_name(), "nomapper"); } diff --git a/src/devices/bus/msx/cart/cartridge.cpp b/src/devices/bus/msx/cart/cartridge.cpp index f452bd45ac2b9..12cddaaff709a 100644 --- a/src/devices/bus/msx/cart/cartridge.cpp +++ b/src/devices/bus/msx/cart/cartridge.cpp @@ -180,7 +180,7 @@ std::string msx_slot_cartridge_device::get_default_card_software(get_default_car } return std::string(get_cart_type(&rom[0], length)); } - return software_get_default_slot(bus::msx::cart::slotoptions::NOMAPPER); + return software_get_default_slot(hook.image_name(), bus::msx::cart::slotoptions::NOMAPPER); } diff --git a/src/devices/bus/msx/cart/softcard.cpp b/src/devices/bus/msx/cart/softcard.cpp index 5a42f004ead8b..1a6f6f27fb22e 100644 --- a/src/devices/bus/msx/cart/softcard.cpp +++ b/src/devices/bus/msx/cart/softcard.cpp @@ -72,7 +72,7 @@ std::pair msx_cart_softcard_device::call_load std::string msx_cart_softcard_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("nomapper"); + return software_get_default_slot(hook.image_name(), "nomapper"); } diff --git a/src/devices/bus/msx/minicart/minicart.cpp b/src/devices/bus/msx/minicart/minicart.cpp index 3f7c8bf53e619..6ec3555e5819e 100644 --- a/src/devices/bus/msx/minicart/minicart.cpp +++ b/src/devices/bus/msx/minicart/minicart.cpp @@ -31,5 +31,5 @@ void msx_slot_yamaha_minicart_device::device_start() std::string msx_slot_yamaha_minicart_device::get_default_card_software(get_default_card_software_hook &hook) const { using namespace bus::msx::minicart::slotoptions; - return software_get_default_slot(NOMAPPER); + return software_get_default_slot(hook.image_name(), NOMAPPER); } diff --git a/src/devices/bus/msx/module/module.cpp b/src/devices/bus/msx/module/module.cpp index b716d5478e593..e419cf3a26f73 100644 --- a/src/devices/bus/msx/module/module.cpp +++ b/src/devices/bus/msx/module/module.cpp @@ -37,5 +37,5 @@ void msx_slot_yamaha_expansion_device::device_start() std::string msx_slot_yamaha_expansion_device::get_default_card_software(get_default_card_software_hook &hook) const { using namespace bus::msx::module; - return software_get_default_slot(slotoptions::SFG01); + return software_get_default_slot(hook.image_name(), slotoptions::SFG01); } diff --git a/src/devices/bus/mtx/exp.cpp b/src/devices/bus/mtx/exp.cpp index 3a8a5f64801b5..24638ba433fd2 100644 --- a/src/devices/bus/mtx/exp.cpp +++ b/src/devices/bus/mtx/exp.cpp @@ -117,10 +117,10 @@ std::string mtx_exp_slot_device::get_default_card_software(get_default_card_soft hook.image_file()->length(len); // FIXME: check error return if (len == 0x80000) - return software_get_default_slot("magrom"); + return software_get_default_slot(hook.image_name(), "magrom"); } - return software_get_default_slot("rompak"); + return software_get_default_slot(hook.image_name(), "rompak"); } diff --git a/src/devices/bus/neogeo/slot.cpp b/src/devices/bus/neogeo/slot.cpp index ce8fd3acf6eea..a1b1adbe9fe4f 100644 --- a/src/devices/bus/neogeo/slot.cpp +++ b/src/devices/bus/neogeo/slot.cpp @@ -324,7 +324,7 @@ void neogeo_cart_slot_device::call_unload() std::string neogeo_cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("rom"); + return software_get_default_slot(hook.image_name(), "rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/nes/aladdin.cpp b/src/devices/bus/nes/aladdin.cpp index add680fbfed28..b99977c4e3b5b 100644 --- a/src/devices/bus/nes/aladdin.cpp +++ b/src/devices/bus/nes/aladdin.cpp @@ -158,7 +158,7 @@ std::string nes_aladdin_slot_device::get_default_card_software(get_default_card_ return std::string(slot_string); } - return software_get_default_slot("algn"); + return software_get_default_slot(hook.image_name(), "algn"); } diff --git a/src/devices/bus/nes/datach.cpp b/src/devices/bus/nes/datach.cpp index 32e7400c7265e..8ddbab88863d6 100644 --- a/src/devices/bus/nes/datach.cpp +++ b/src/devices/bus/nes/datach.cpp @@ -139,7 +139,7 @@ std::pair nes_datach_slot_device::call_load() std::string nes_datach_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { // any way to detect the game with X24C01? - return software_get_default_slot("datach_rom"); + return software_get_default_slot(hook.image_name(), "datach_rom"); } diff --git a/src/devices/bus/nes/karastudio.cpp b/src/devices/bus/nes/karastudio.cpp index 0cca5acbe11eb..bf9c8239bfd4e 100644 --- a/src/devices/bus/nes/karastudio.cpp +++ b/src/devices/bus/nes/karastudio.cpp @@ -127,7 +127,7 @@ std::pair nes_kstudio_slot_device::call_load( std::string nes_kstudio_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("ks_exp"); + return software_get_default_slot(hook.image_name(), "ks_exp"); } diff --git a/src/devices/bus/nes/nes_slot.cpp b/src/devices/bus/nes/nes_slot.cpp index d7df07d769330..a3eb29a5889b8 100644 --- a/src/devices/bus/nes/nes_slot.cpp +++ b/src/devices/bus/nes/nes_slot.cpp @@ -810,7 +810,7 @@ std::string nes_cart_slot_device::get_default_card_software(get_default_card_sof return std::string(slot_string); } else - return software_get_default_slot("nrom"); + return software_get_default_slot(hook.image_name(), "nrom"); } diff --git a/src/devices/bus/nes/sunsoft_dcs.cpp b/src/devices/bus/nes/sunsoft_dcs.cpp index 188f0a83b322e..da30d18ea87a8 100644 --- a/src/devices/bus/nes/sunsoft_dcs.cpp +++ b/src/devices/bus/nes/sunsoft_dcs.cpp @@ -106,7 +106,7 @@ std::pair nes_ntb_slot_device::call_load() std::string nes_ntb_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("ntbrom"); + return software_get_default_slot(hook.image_name(), "ntbrom"); } //----------------------------------------------- diff --git a/src/devices/bus/odyssey2/slot.cpp b/src/devices/bus/odyssey2/slot.cpp index a5090c41f4a53..52ba06e4d3e4f 100644 --- a/src/devices/bus/odyssey2/slot.cpp +++ b/src/devices/bus/odyssey2/slot.cpp @@ -193,7 +193,7 @@ std::string o2_cart_slot_device::get_default_card_software(get_default_card_soft return std::string(slot_string); } - return software_get_default_slot("o2_rom"); + return software_get_default_slot(hook.image_name(), "o2_rom"); } diff --git a/src/devices/bus/pce/pce_slot.cpp b/src/devices/bus/pce/pce_slot.cpp index 2a6d3dd32909e..25fc0fa58b411 100644 --- a/src/devices/bus/pce/pce_slot.cpp +++ b/src/devices/bus/pce/pce_slot.cpp @@ -334,5 +334,5 @@ std::string pce_cart_slot_device::get_default_card_software(get_default_card_sof return std::string(slot_string); } - return software_get_default_slot("rom"); + return software_get_default_slot(hook.image_name(), "rom"); } diff --git a/src/devices/bus/plus4/exp.cpp b/src/devices/bus/plus4/exp.cpp index b475875145c66..878e0936544da 100644 --- a/src/devices/bus/plus4/exp.cpp +++ b/src/devices/bus/plus4/exp.cpp @@ -126,7 +126,7 @@ std::pair plus4_expansion_slot_device::call_l std::string plus4_expansion_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("standard"); + return software_get_default_slot(hook.image_name(), "standard"); } diff --git a/src/devices/bus/pofo/ccm.cpp b/src/devices/bus/pofo/ccm.cpp index d2b60021f1dca..6eb9b0051ce15 100644 --- a/src/devices/bus/pofo/ccm.cpp +++ b/src/devices/bus/pofo/ccm.cpp @@ -110,7 +110,7 @@ const software_list_loader &portfolio_memory_card_slot_device::get_software_list std::string portfolio_memory_card_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("rom"); + return software_get_default_slot(hook.image_name(), "rom"); } diff --git a/src/devices/bus/ql/rom.cpp b/src/devices/bus/ql/rom.cpp index ab0e3c1e76506..693595dfe730f 100644 --- a/src/devices/bus/ql/rom.cpp +++ b/src/devices/bus/ql/rom.cpp @@ -117,7 +117,7 @@ std::pair ql_rom_cartridge_slot_device::call_ std::string ql_rom_cartridge_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("standard"); + return software_get_default_slot(hook.image_name(), "standard"); } diff --git a/src/devices/bus/saturn/sat_slot.cpp b/src/devices/bus/saturn/sat_slot.cpp index 34a329b47ef76..c9ad52e60a159 100644 --- a/src/devices/bus/saturn/sat_slot.cpp +++ b/src/devices/bus/saturn/sat_slot.cpp @@ -190,7 +190,7 @@ void sat_cart_slot_device::call_unload() std::string sat_cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("rom"); + return software_get_default_slot(hook.image_name(), "rom"); } diff --git a/src/devices/bus/scv/slot.cpp b/src/devices/bus/scv/slot.cpp index fe813fa141d9e..15504374e8a2d 100644 --- a/src/devices/bus/scv/slot.cpp +++ b/src/devices/bus/scv/slot.cpp @@ -207,7 +207,7 @@ std::string scv_cart_slot_device::get_default_card_software(get_default_card_sof return std::string(slot_string); } - return software_get_default_slot(slot_list[0].slot_option); + return software_get_default_slot(hook.image_name(), slot_list[0].slot_option); } diff --git a/src/devices/bus/sdk85/memexp.cpp b/src/devices/bus/sdk85/memexp.cpp index 58a05e2fc888d..94b8a2fbd16d4 100644 --- a/src/devices/bus/sdk85/memexp.cpp +++ b/src/devices/bus/sdk85/memexp.cpp @@ -42,7 +42,7 @@ std::pair sdk85_romexp_device::call_load() std::string sdk85_romexp_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("i8755"); + return software_get_default_slot(hook.image_name(), "i8755"); } void sdk85_romexp_device::device_start() diff --git a/src/devices/bus/sega8/sega8_slot.cpp b/src/devices/bus/sega8/sega8_slot.cpp index d30b5c4e86963..c469473a03f3f 100644 --- a/src/devices/bus/sega8/sega8_slot.cpp +++ b/src/devices/bus/sega8/sega8_slot.cpp @@ -681,7 +681,7 @@ std::string sega8_cart_slot_device::get_default_card_software(get_default_card_s return std::string(slot_string); } - return software_get_default_slot("rom"); + return software_get_default_slot(hook.image_name(), "rom"); } diff --git a/src/devices/bus/segaai/segaai_slot.cpp b/src/devices/bus/segaai/segaai_slot.cpp index c7e10d59c5462..5b517a7efee59 100644 --- a/src/devices/bus/segaai/segaai_slot.cpp +++ b/src/devices/bus/segaai/segaai_slot.cpp @@ -83,7 +83,7 @@ std::string segaai_card_slot_device::get_default_card_software(get_default_card_ return std::string(length == 0x40000 ? ROM_256 : ROM_128); } - return software_get_default_slot(ROM_128); + return software_get_default_slot(hook.image_name(), ROM_128); } diff --git a/src/devices/bus/snes/snes_slot.cpp b/src/devices/bus/snes/snes_slot.cpp index d447c390bd205..d0b8cf468707c 100644 --- a/src/devices/bus/snes/snes_slot.cpp +++ b/src/devices/bus/snes/snes_slot.cpp @@ -1092,7 +1092,7 @@ std::string base_sns_cart_slot_device::get_default_card_software(get_default_car return std::string(slot_string); } - return software_get_default_slot("lorom"); + return software_get_default_slot(hook.image_name(), "lorom"); } diff --git a/src/devices/bus/supracan/slot.cpp b/src/devices/bus/supracan/slot.cpp index 19f10c449f6b4..4400a019b4a5b 100644 --- a/src/devices/bus/supracan/slot.cpp +++ b/src/devices/bus/supracan/slot.cpp @@ -112,5 +112,5 @@ void superacan_cart_slot_device::call_unload() std::string superacan_cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("std"); + return software_get_default_slot(hook.image_name(), "std"); } diff --git a/src/devices/bus/vboy/slot.cpp b/src/devices/bus/vboy/slot.cpp index 9b9cf4e88eae1..cfc810f133ac0 100644 --- a/src/devices/bus/vboy/slot.cpp +++ b/src/devices/bus/vboy/slot.cpp @@ -127,7 +127,7 @@ std::string vboy_cart_slot_device::get_default_card_software(get_default_card_so } else { - std::string const image_name(mconfig().options().image_option(instance_name()).value()); + auto image_name = hook.image_name(); software_part const *const part(!image_name.empty() ? find_software_item(image_name, true) : nullptr); if (part) { diff --git a/src/devices/bus/vc4000/slot.cpp b/src/devices/bus/vc4000/slot.cpp index ac0d7ce2de79c..fe29e80c5e9a9 100644 --- a/src/devices/bus/vc4000/slot.cpp +++ b/src/devices/bus/vc4000/slot.cpp @@ -238,7 +238,7 @@ std::string vc4000_cart_slot_device::get_default_card_software(get_default_card_ return std::string(slot_string); } - return software_get_default_slot("std"); + return software_get_default_slot(hook.image_name(), "std"); } /*------------------------------------------------- diff --git a/src/devices/bus/vcs/vcs_slot.cpp b/src/devices/bus/vcs/vcs_slot.cpp index 344071724e9d1..a13c68d752cdc 100644 --- a/src/devices/bus/vcs/vcs_slot.cpp +++ b/src/devices/bus/vcs/vcs_slot.cpp @@ -782,5 +782,5 @@ std::string vcs_cart_slot_device::get_default_card_software(get_default_card_sof return std::string(slot_string); } else - return software_get_default_slot("a26_2k_4k"); + return software_get_default_slot(hook.image_name(), "a26_2k_4k"); } diff --git a/src/devices/bus/vectrex/slot.cpp b/src/devices/bus/vectrex/slot.cpp index 2b5ebd481a1e7..b02aa5df03515 100644 --- a/src/devices/bus/vectrex/slot.cpp +++ b/src/devices/bus/vectrex/slot.cpp @@ -209,7 +209,7 @@ std::string vectrex_cart_slot_device::get_default_card_software(get_default_card return std::string(slot_string); } - return software_get_default_slot("vec_rom"); + return software_get_default_slot(hook.image_name(), "vec_rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/vic10/exp.cpp b/src/devices/bus/vic10/exp.cpp index 2e050b40cc397..8318280be2755 100644 --- a/src/devices/bus/vic10/exp.cpp +++ b/src/devices/bus/vic10/exp.cpp @@ -164,7 +164,7 @@ std::string vic10_expansion_slot_device::get_default_card_software(get_default_c return cbm_crt_get_card(*hook.image_file()); } - return software_get_default_slot("standard"); + return software_get_default_slot(hook.image_name(), "standard"); } diff --git a/src/devices/bus/vic20/exp.cpp b/src/devices/bus/vic20/exp.cpp index c635db5c35c12..c8b4aa5029cf0 100644 --- a/src/devices/bus/vic20/exp.cpp +++ b/src/devices/bus/vic20/exp.cpp @@ -251,7 +251,7 @@ std::pair vic20_expansion_slot_device::call_l std::string vic20_expansion_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("standard"); + return software_get_default_slot(hook.image_name(), "standard"); } diff --git a/src/devices/bus/vidbrain/exp.cpp b/src/devices/bus/vidbrain/exp.cpp index 4423ae3a385b4..75211657768aa 100644 --- a/src/devices/bus/vidbrain/exp.cpp +++ b/src/devices/bus/vidbrain/exp.cpp @@ -132,7 +132,7 @@ std::pair videobrain_expansion_slot_device::c std::string videobrain_expansion_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("standard"); + return software_get_default_slot(hook.image_name(), "standard"); } diff --git a/src/devices/bus/vsmile/vsmile_slot.cpp b/src/devices/bus/vsmile/vsmile_slot.cpp index 1e743c5f393c5..392aec4e0ffe5 100644 --- a/src/devices/bus/vsmile/vsmile_slot.cpp +++ b/src/devices/bus/vsmile/vsmile_slot.cpp @@ -190,7 +190,7 @@ void vsmile_cart_slot_device::call_unload() std::string vsmile_cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - return software_get_default_slot("vsmile_rom"); + return software_get_default_slot(hook.image_name(), "vsmile_rom"); } diff --git a/src/devices/bus/wswan/slot.cpp b/src/devices/bus/wswan/slot.cpp index 31edbc6d97141..cb7b0522b3791 100644 --- a/src/devices/bus/wswan/slot.cpp +++ b/src/devices/bus/wswan/slot.cpp @@ -299,7 +299,7 @@ std::string ws_cart_slot_device::get_default_card_software(get_default_card_soft return std::string(slot_string); } - return software_get_default_slot("ws_rom"); + return software_get_default_slot(hook.image_name(), "ws_rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/z88/z88.cpp b/src/devices/bus/z88/z88.cpp index fe77274a8ed42..363fe4836c5d0 100644 --- a/src/devices/bus/z88/z88.cpp +++ b/src/devices/bus/z88/z88.cpp @@ -169,7 +169,7 @@ std::string z88cart_slot_device::get_default_card_software(get_default_card_soft fatalerror("%s: %s:%d %s\n", tag(), err.category().name(), err.value(), err.message()); } - return software_get_default_slot("128krom"); + return software_get_default_slot(hook.image_name(), "128krom"); } diff --git a/src/devices/cpu/sh/sh2.cpp b/src/devices/cpu/sh/sh2.cpp index ae8acd76ee417..d772cccb26186 100644 --- a/src/devices/cpu/sh/sh2.cpp +++ b/src/devices/cpu/sh/sh2.cpp @@ -31,11 +31,12 @@ sh2_device::sh2_device(const machine_config &mconfig, device_type type, const ch , m_drcfe(nullptr) { m_cpu_type = cpu_type; - m_isdrc = allow_drc(); } void sh2_device::device_start() { + m_isdrc = allow_drc(); + sh_common_execution::device_start(); m_decrypted_program = has_space(AS_OPCODES) ? &space(AS_OPCODES) : &space(AS_PROGRAM); diff --git a/src/devices/machine/mb89374.cpp b/src/devices/machine/mb89374.cpp index a2dacb9c47b06..047bdb0a245b5 100644 --- a/src/devices/machine/mb89374.cpp +++ b/src/devices/machine/mb89374.cpp @@ -105,29 +105,30 @@ mb89374_device::mb89374_device( const machine_config &mconfig, const char *tag, m_icount(0), m_out_irq_cb(*this), m_out_po_cb(*this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------ + +void mb89374_device::device_start() { // prepare localhost "filename" m_localhost[0] = 0; strcat(m_localhost, "socket."); - strcat(m_localhost, mconfig.options().comm_localhost()); + strcat(m_localhost, machine().options().comm_localhost()); strcat(m_localhost, ":"); - strcat(m_localhost, mconfig.options().comm_localport()); + strcat(m_localhost, machine().options().comm_localport()); // prepare remotehost "filename" m_remotehost[0] = 0; strcat(m_remotehost, "socket."); - strcat(m_remotehost, mconfig.options().comm_remotehost()); + strcat(m_remotehost, machine().options().comm_remotehost()); strcat(m_remotehost, ":"); - strcat(m_remotehost, mconfig.options().comm_remoteport()); -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------ + strcat(m_remotehost, machine().options().comm_remoteport()); -void mb89374_device::device_start() -{ // set our instruction counter set_icountptr(m_icount); diff --git a/src/emu/devcpu.cpp b/src/emu/devcpu.cpp index 616a501f43840..dc4ee1259670f 100644 --- a/src/emu/devcpu.cpp +++ b/src/emu/devcpu.cpp @@ -49,7 +49,7 @@ cpu_device::~cpu_device() bool cpu_device::allow_drc() const { - return mconfig().options().drc() && !m_force_no_drc; + return machine().options().drc() && !m_force_no_drc; } diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index 59d1523a6b1ca..52e394a5c9695 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -1299,11 +1299,10 @@ std::error_condition device_image_interface::load_software_part(std::string_view // software_get_default_slot //------------------------------------------------- -std::string device_image_interface::software_get_default_slot(std::string_view default_card_slot) const +std::string device_image_interface::software_get_default_slot(std::string_view image_name, std::string_view default_card_slot) const { std::string result; - const std::string &image_name(device().mconfig().options().image_option(instance_name()).value()); if (!image_name.empty()) { result.assign(default_card_slot); diff --git a/src/emu/diimage.h b/src/emu/diimage.h index aa9c991c95596..695fcbb2f1018 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -240,7 +240,7 @@ class device_image_interface : public device_interface std::error_condition image_checkhash(); const software_part *find_software_item(std::string_view identifier, bool restrict_to_interface, software_list_device **device = nullptr) const; - std::string software_get_default_slot(std::string_view default_card_slot) const; + std::string software_get_default_slot(std::string_view image_name, std::string_view default_card_slot) const; void add_format(std::unique_ptr &&format); void add_format(std::string &&name, std::string &&description, std::string &&extensions, std::string &&optspec); diff --git a/src/emu/dislot.cpp b/src/emu/dislot.cpp index 43d2ed96cdd52..fe5a992410304 100644 --- a/src/emu/dislot.cpp +++ b/src/emu/dislot.cpp @@ -143,8 +143,9 @@ const device_slot_interface::slot_option *device_slot_interface::option(const ch } -get_default_card_software_hook::get_default_card_software_hook(const std::string &path, std::function &&get_hashfile_extrainfo) - : m_get_hashfile_extrainfo(std::move(get_hashfile_extrainfo)) +get_default_card_software_hook::get_default_card_software_hook(std::string path, std::function &&get_hashfile_extrainfo) + : m_image_name(std::move(path)) + , m_get_hashfile_extrainfo(std::move(get_hashfile_extrainfo)) , m_called_get_hashfile_extrainfo(false) , m_has_hash_extrainfo(false) { diff --git a/src/emu/dislot.h b/src/emu/dislot.h index f6e1f86fcb344..f20f2cec76e46 100644 --- a/src/emu/dislot.h +++ b/src/emu/dislot.h @@ -17,7 +17,10 @@ class get_default_card_software_hook { // goofy "hook" to pass to device_slot_interface::get_default_card_software public: - get_default_card_software_hook(const std::string &path, std::function &&get_hashfile_extrainfo); + get_default_card_software_hook(std::string path, std::function &&get_hashfile_extrainfo); + + // image name from options - needed by software_get_default_slot() + std::string_view image_name() const { return m_image_name; } // accesses the image file to be scrutinized by get_default_card_software(); is // nullptr in the case of images loaded by software list @@ -30,6 +33,7 @@ class get_default_card_software_hook bool hashfile_extrainfo(std::string &extrainfo); private: + const std::string m_image_name; util::core_file::ptr m_image_file; std::string m_file_type; std::function m_get_hashfile_extrainfo; diff --git a/src/emu/drivenum.cpp b/src/emu/drivenum.cpp index 84158749189eb..fc479631a1d75 100644 --- a/src/emu/drivenum.cpp +++ b/src/emu/drivenum.cpp @@ -125,7 +125,10 @@ std::shared_ptr const &driver_enumerator::config(std::size_t ind // if we don't have it cached, add it std::shared_ptr &config = m_config[index]; if (!config) - config = std::make_shared(*s_drivers_sorted[index], options); + { + config = std::make_shared(*s_drivers_sorted[index]); + config->add_slot_options(options); + } return config; } diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 834710c9eb0f8..dfe0c353840c6 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -560,7 +560,8 @@ bool emu_options::add_and_remove_slot_options() if (m_system) { // create the configuration - machine_config config(*m_system, *this); + machine_config config(*m_system); + config.add_slot_options(*this); for (const device_slot_interface &slot : slot_interface_enumerator(config.root_device())) { @@ -656,7 +657,8 @@ bool emu_options::add_and_remove_image_options() if (m_system) { // create the configuration - machine_config config(*m_system, *this); + machine_config config(*m_system); + config.add_slot_options(*this); // iterate through all image devices for (device_image_interface &image : image_interface_enumerator(config.root_device())) @@ -736,7 +738,8 @@ void emu_options::reevaluate_default_card_software() do { // set up the machine_config - machine_config config(*m_system, *this); + machine_config config(*m_system); + config.add_slot_options(*this); found = false; // iterate through all slot devices @@ -811,7 +814,11 @@ std::string emu_options::get_default_card_software(device_slot_interface &slot) } // create the hook - get_default_card_software_hook hook(image_path, std::move(get_hashfile_extrainfo)); + get_default_card_software_hook hook(std::move(image_path), std::move(get_hashfile_extrainfo)); + + // ensure the software lists are parsed + for (software_list_device &swlistdev : software_list_device_enumerator(slot.device().mconfig().root_device())) + swlistdev.parse_if_necessary(*this); // and invoke the slot's implementation of get_default_card_software() return slot.get_default_card_software(hook); @@ -896,7 +903,8 @@ emu_options::software_options emu_options::evaluate_initial_softlist_options(con throw options_error_exception("Cannot specify software without specifying system"); // and set up a configuration - machine_config config(*m_system, *this); + machine_config config(*m_system); + config.add_slot_options(*this); software_list_device_enumerator iter(config.root_device()); if (iter.count() == 0) throw emu_fatalerror(EMU_ERR_FATALERROR, "Error: unknown option: %s\n", software_identifier); @@ -932,6 +940,7 @@ emu_options::software_options emu_options::evaluate_initial_softlist_options(con { if (list_name.empty() || (list_name == swlistdev.list_name())) { + swlistdev.parse_if_necessary(*this); const software_info *swinfo = swlistdev.find(software_name); if (swinfo != nullptr) { diff --git a/src/emu/hashfile.cpp b/src/emu/hashfile.cpp index 8436ad339fb78..3ed484d2ad267 100644 --- a/src/emu/hashfile.cpp +++ b/src/emu/hashfile.cpp @@ -90,14 +90,11 @@ bool hashfile_extrainfo(const char *hash_path, const game_driver &driver, const } - bool hashfile_extrainfo(device_image_interface &image, std::string &result) { return hashfile_extrainfo( - image.device().mconfig().options().hash_path(), + image.device().machine().options().hash_path(), image.device().mconfig().gamedrv(), image.hash(), result); } - - diff --git a/src/emu/image.cpp b/src/emu/image.cpp index 780d882efe336..ac24510527390 100644 --- a/src/emu/image.cpp +++ b/src/emu/image.cpp @@ -17,6 +17,7 @@ #include "fileio.h" #include "main.h" #include "softlist.h" +#include "softlist_dev.h" // lib/util #include "corestr.h" @@ -37,6 +38,10 @@ image_manager::image_manager(running_machine &machine) : m_machine(machine) { + // ensure the software lists are parsed + for (software_list_device &swlistdev : software_list_device_enumerator(machine.root_device())) + swlistdev.parse_if_necessary(machine.options()); + // make sure that any required devices have been allocated for (device_image_interface &image : image_interface_enumerator(machine.root_device())) { diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index a77140dba164d..a5363e6046fdf 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -72,7 +72,7 @@ running_machine::running_machine(const machine_config &_config, machine_manager , m_soft_reset_timer(nullptr) , m_rand_seed(0x9d14abd7) , m_basename(_config.gamedrv().name) - , m_sample_rate(_config.options().sample_rate()) + , m_sample_rate(manager.options().sample_rate()) , m_saveload_schedule(saveload_schedule::NONE) , m_saveload_schedule_time(attotime::zero) , m_saveload_searchpath(nullptr) @@ -1099,6 +1099,16 @@ void running_machine::postload_all_devices() } +//------------------------------------------------- +// options - convenience accessor for emu_options +//------------------------------------------------- + +emu_options &running_machine::options() const +{ + return manager().options(); +} + + /*************************************************************************** NVRAM MANAGEMENT ***************************************************************************/ diff --git a/src/emu/machine.h b/src/emu/machine.h index 7b4efec70da0e..ccb4528309b9e 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -155,7 +155,7 @@ class running_machine bool side_effects_disabled() const { return m_side_effects_disabled != 0; } // additional helpers - emu_options &options() const { return m_config.options(); } + emu_options& options() const; attotime time() const noexcept { return m_scheduler.time(); } bool scheduled_event_pending() const { return m_exit_pending || m_hard_reset_pending; } bool allow_logging() const { return !m_logerror_list.empty(); } diff --git a/src/emu/mconfig.cpp b/src/emu/mconfig.cpp index ba88b6c289dfb..049003c56a248 100644 --- a/src/emu/mconfig.cpp +++ b/src/emu/mconfig.cpp @@ -38,9 +38,8 @@ class machine_config::current_device_stack // machine_config - constructor //------------------------------------------------- -machine_config::machine_config(const game_driver &gamedrv, emu_options &options) +machine_config::machine_config(const game_driver &gamedrv) : m_gamedrv(gamedrv) - , m_options(options) , m_root_device() , m_default_layouts([] (char const *a, char const *b) { return 0 > std::strcmp(a, b); }) , m_current_device(nullptr) @@ -49,7 +48,25 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options) { // add the root device device_add("root", gamedrv.type, 0); +} + +//------------------------------------------------- +// ~machine_config - destructor +//------------------------------------------------- + +machine_config::~machine_config() +{ +} + + +//------------------------------------------------- +// add_slot_options - adds slot options to this +// configuration as specified by these emu_options +//------------------------------------------------- + +void machine_config::add_slot_options(emu_options &options) +{ // intialize slot devices - make sure that any required devices have been allocated for (device_slot_interface &slot : slot_interface_enumerator(root_device())) { @@ -99,23 +116,29 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options) new_dev->set_input_default(input_device_defaults); } else - throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval, owner.tag()+1); + throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval, owner.tag() + 1); } } - // then notify all devices that their configuration is complete - for (device_t &device : device_enumerator(root_device())) - if (!device.configured()) - device.config_complete(); + // we've added slot options; complete the configuration + complete(); } //------------------------------------------------- -// ~machine_config - destructor +// complete - completes the configuration of slot +// options +// +// it is only necessary to call this when one is +// not adding slot options! //------------------------------------------------- -machine_config::~machine_config() +void machine_config::complete() { + // then notify all devices that their configuration is complete + for (device_t &device : device_enumerator(root_device())) + if (!device.configured()) + device.config_complete(); } diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h index c6cacde581f4d..30bc7c4cc991a 100644 --- a/src/emu/mconfig.h +++ b/src/emu/mconfig.h @@ -101,19 +101,24 @@ class machine_config }; // construction/destruction - machine_config(const game_driver &gamedrv, emu_options &options); + machine_config(const game_driver &gamedrv); ~machine_config(); // getters const game_driver &gamedrv() const { return m_gamedrv; } device_t &root_device() const { assert(m_root_device); return *m_root_device; } device_t ¤t_device() const { assert(m_current_device); return *m_current_device; } - emu_options &options() const { return m_options; } device_t *device(const char *tag) const { return root_device().subdevice(tag); } template DeviceClass *device(const char *tag) const { return downcast(device(tag)); } attotime maximum_quantum(attotime const &default_quantum) const; device_execute_interface *perfect_quantum_device() const; + /// \brief Adds slot options to this configuration + void add_slot_options(emu_options &options); + + /// \brief Indicates that option configuration is complete + void complete(); + /// \brief Apply visitor to internal layouts /// /// Calls the supplied visitor for each device with an internal @@ -227,6 +232,8 @@ class machine_config device_t *device_remove(const char *tag); private: + machine_config(const game_driver &gamedrv, emu_options *options); + class current_device_stack; typedef std::map default_layout_map; typedef std::map maximum_quantum_map; @@ -241,7 +248,6 @@ class machine_config // internal state game_driver const & m_gamedrv; - emu_options & m_options; std::unique_ptr m_root_device; default_layout_map m_default_layouts; device_t * m_current_device; diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index f1f642812e392..8d04de24e76ab 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -103,7 +103,8 @@ auto next_parent_device(device_t const &device, emu_options &options) } else { - machine_config config(GAME_NAME(___empty), options); + machine_config config(GAME_NAME(___empty)); + config.add_slot_options(options); machine_config::token const tok(config.begin_configuration(config.root_device())); roms = config.device_add("_tmp", *type, 0)->rom_region_vector(); config.device_remove("_tmp"); diff --git a/src/emu/softlist_dev.cpp b/src/emu/softlist_dev.cpp index b65f5f2830039..1b2eeba301d98 100644 --- a/src/emu/softlist_dev.cpp +++ b/src/emu/softlist_dev.cpp @@ -275,10 +275,11 @@ const software_info *software_list_device::find(std::string_view look_for) //------------------------------------------------- -// parse - parse our softlist file +// parse_if_necessary - parse our softlist file if +// it has not been parsed yet //------------------------------------------------- -void software_list_device::parse() +void software_list_device::parse_if_necessary(const emu_options &options) { // skip if done if (m_parsed) @@ -288,7 +289,7 @@ void software_list_device::parse() m_errors.clear(); // attempt to open the file - emu_file file(mconfig().options().hash_path(), OPEN_FLAG_READ); + emu_file file(options.hash_path(), OPEN_FLAG_READ); const std::error_condition filerr = file.open(m_list_name + ".xml"); m_filename = file.filename(); if (!filerr) diff --git a/src/emu/softlist_dev.h b/src/emu/softlist_dev.h index 41c92b4f3c06d..3b0c2461d62cd 100644 --- a/src/emu/softlist_dev.h +++ b/src/emu/softlist_dev.h @@ -114,13 +114,14 @@ class software_list_device : public device_t bool is_compatible() const { return softlist_type::COMPATIBLE_SYSTEM == m_list_type; } const char *filter() const { return m_filter; } - // getters that may trigger a parse - const std::string &description() { if (!m_parsed) parse(); return m_description; } - bool valid() { if (!m_parsed) parse(); return !m_infolist.empty(); } - const char *errors_string() { if (!m_parsed) parse(); return m_errors.c_str(); } - const std::list &get_info() { if (!m_parsed) parse(); return m_infolist; } + // getters that require the software list be parsed + const std::string &description() { assert(m_parsed); return m_description; } + bool valid() { assert(m_parsed); return !m_infolist.empty(); } + const char *errors_string() { assert(m_parsed); return m_errors.c_str(); } + const std::list &get_info() { assert(m_parsed); return m_infolist; } // operations + void parse_if_necessary(const emu_options &options); const software_info *find(std::string_view look_for); void find_approx_matches(std::string_view name, int matches, const software_info **list, const char *interface); void release(); @@ -139,7 +140,6 @@ class software_list_device : public device_t private: // internal helpers - void parse(); void internal_validity_check(validity_checker &valid) ATTR_COLD; // configuration state diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index c2e9ac2344368..955feeab23be1 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -1994,7 +1994,8 @@ void validity_checker::validate_one(const game_driver &driver) // wrap in try/catch to catch fatalerrors try { - machine_config config(driver, m_blank_options); + machine_config config(driver); + config.add_slot_options(m_blank_options); validate_driver(config.root_device()); validate_roms(config.root_device()); validate_inputs(config.root_device()); @@ -2801,7 +2802,8 @@ void validity_checker::validate_device_types() m_verbose_text.clear(); std::unordered_map > device_name_map, device_shortname_map; - machine_config config(GAME_NAME(___empty), m_drivlist.options()); + machine_config config(GAME_NAME(___empty)); + config.add_slot_options(m_drivlist.options()); machine_config::token const tok(config.begin_configuration(config.root_device())); for (device_type type : registered_device_types) { diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp index da9900ff680c3..801b41a521839 100644 --- a/src/frontend/mame/clifront.cpp +++ b/src/frontend/mame/clifront.cpp @@ -1017,7 +1017,8 @@ void cli_frontend::verifyroms(const std::vector &args) if (iswild || !matchcount) { - machine_config config(GAME_NAME(___empty), m_options); + machine_config config(GAME_NAME(___empty)); + config.add_slot_options(m_options); machine_config::token const tok(config.begin_configuration(config.root_device())); for (device_type type : registered_device_types) { @@ -1659,7 +1660,8 @@ template void cli_frontend::apply_action(const std::vec template void cli_frontend::apply_device_action(const std::vector &args, T &&action) { - machine_config config(GAME_NAME(___empty), m_options); + machine_config config(GAME_NAME(___empty)); + config.add_slot_options(m_options); machine_config::token const tok(config.begin_configuration(config.root_device())); apply_action( args, diff --git a/src/frontend/mame/infoxml.cpp b/src/frontend/mame/infoxml.cpp index 750808403a518..99e530592e8c2 100644 --- a/src/frontend/mame/infoxml.cpp +++ b/src/frontend/mame/infoxml.cpp @@ -693,7 +693,8 @@ void output_one(std::ostream &out, driver_enumerator &drivlist, const game_drive { using util::xml::normalize_string; - machine_config config(driver, drivlist.options()); + machine_config config(driver); + config.complete(); device_enumerator iter(config.root_device()); // allocate input ports and build overall emulation status @@ -919,7 +920,8 @@ void output_devices(std::ostream &out, emu_options &lookup_options, device_type_ auto task_proc = [&active_task_count, &lookup_options, batch = std::move(batch), collect_devices = bool(filter)] { // use a single machine configuration and stream for a batch of devices - machine_config config(GAME_NAME(___empty), lookup_options); + machine_config config(GAME_NAME(___empty)); + config.add_slot_options(lookup_options); prepared_info result; std::ostringstream stream; stream.imbue(std::locale::classic()); diff --git a/src/frontend/mame/mame.cpp b/src/frontend/mame/mame.cpp index d732392a5c990..b5e069253998d 100644 --- a/src/frontend/mame/mame.cpp +++ b/src/frontend/mame/mame.cpp @@ -277,7 +277,8 @@ int mame_machine_manager::execute() } // create the machine configuration - machine_config config(*system, m_options); + machine_config config(*system); + config.add_slot_options(m_options); // create the machine structure and driver running_machine machine(config, *this); diff --git a/src/frontend/mame/mameopts.cpp b/src/frontend/mame/mameopts.cpp index cd754fcb0f37d..66611472f4ee2 100644 --- a/src/frontend/mame/mameopts.cpp +++ b/src/frontend/mame/mameopts.cpp @@ -58,7 +58,8 @@ void mame_options::parse_standard_inis(emu_options &options, std::ostream &error else parse_one_ini(options, "horizont", OPTION_PRIORITY_ORIENTATION_INI, &error_stream); - machine_config config(*cursystem, options); + machine_config config(*cursystem); + config.add_slot_options(options); for (const screen_device &device : screen_device_enumerator(config.root_device())) { // parse "raster.ini" for raster games diff --git a/src/frontend/mame/media_ident.cpp b/src/frontend/mame/media_ident.cpp index d09858198eaa1..36e28e2d8ec46 100644 --- a/src/frontend/mame/media_ident.cpp +++ b/src/frontend/mame/media_ident.cpp @@ -385,7 +385,8 @@ void media_identifier::match_hashes(std::vector &info) match_device(m_drivlist.config()->root_device()); // iterator over registered device types - machine_config config(GAME_NAME(___empty), m_drivlist.options()); + machine_config config(GAME_NAME(___empty)); + config.add_slot_options(m_drivlist.options()); machine_config::token const tok(config.begin_configuration(config.root_device())); for (device_type type : registered_device_types) { diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp index 5af866846c13e..8a5326ab6251a 100644 --- a/src/frontend/mame/ui/selmenu.cpp +++ b/src/frontend/mame/ui/selmenu.cpp @@ -708,7 +708,8 @@ menu_select_launch::system_flags const &menu_select_launch::get_system_flags(gam // aggregate flags emu_options clean_options; - machine_config const mconfig(driver, clean_options); + machine_config mconfig(driver); + mconfig.add_slot_options(clean_options); return m_flags.emplace(&driver, machine_static_info(ui().options(), mconfig)).first->second; } diff --git a/src/frontend/mame/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp index 4e9a16bb196b7..8926bcd72718d 100644 --- a/src/frontend/mame/ui/selsoft.cpp +++ b/src/frontend/mame/ui/selsoft.cpp @@ -94,7 +94,8 @@ class menu_select_software::machine_data // add start empty item m_swinfo.emplace_back(*menu.m_system.driver); - machine_config config(*menu.m_system.driver, menu.machine().options()); + machine_config config(*menu.m_system.driver); + config.add_slot_options(menu.machine().options()); // see if any media devices require an image to be loaded m_has_empty_start = true; diff --git a/src/frontend/mame/ui/simpleselgame.cpp b/src/frontend/mame/ui/simpleselgame.cpp index 1034a368f1b4b..abdbf2db8b11f 100644 --- a/src/frontend/mame/ui/simpleselgame.cpp +++ b/src/frontend/mame/ui/simpleselgame.cpp @@ -352,7 +352,10 @@ void simple_menu_select_game::custom_render(uint32_t flags, void *selectedref, f if (driver != m_cached_driver) { emu_options clean_options; - machine_static_info const info(ui().options(), machine_config(*driver, clean_options)); + machine_config config(*driver); + config.add_slot_options(clean_options); + + machine_static_info const info(ui().options(), std::move(config)); m_cached_driver = driver; m_cached_machine_flags = info.machine_flags(); m_cached_emulation_flags = info.emulation_flags(); diff --git a/src/frontend/mame/ui/slotopt.cpp b/src/frontend/mame/ui/slotopt.cpp index 10fbeed03c6ec..e33f66264dc1a 100644 --- a/src/frontend/mame/ui/slotopt.cpp +++ b/src/frontend/mame/ui/slotopt.cpp @@ -175,7 +175,8 @@ void menu_slot_devices::populate() { // we need to keep our own copy of the machine_config because we // can change this out from under the caller - m_config = std::make_unique(machine().system(), machine().options()); + m_config = std::make_unique(machine().system()); + m_config->add_slot_options(machine().options()); // cycle through all devices for this system for (device_slot_interface &slot : slot_interface_enumerator(m_config->root_device())) diff --git a/src/mame/capcom/cps2comm.cpp b/src/mame/capcom/cps2comm.cpp index 95701ef264ddc..03f3179ef2702 100644 --- a/src/mame/capcom/cps2comm.cpp +++ b/src/mame/capcom/cps2comm.cpp @@ -773,7 +773,7 @@ void cps2_comm_device::start_comm() if (!BIT(m_config->read(), 0)) return; - auto const &opts = mconfig().options(); + auto const &opts = machine().options(); std::error_code err; std::istringstream parsestr; parsestr.imbue(std::locale::classic()); diff --git a/src/mame/sega/m1comm.cpp b/src/mame/sega/m1comm.cpp index 0b690e8d3e803..eb34cfcc6c8ae 100644 --- a/src/mame/sega/m1comm.cpp +++ b/src/mame/sega/m1comm.cpp @@ -146,33 +146,33 @@ m1comm_device::m1comm_device(const machine_config &mconfig, const char *tag, dev m_dma(*this, "commdma"), m_dlc(*this, "commdlc") { +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void m1comm_device::device_start() +{ #ifdef M1COMM_SIMULATION // prepare localhost "filename" m_localhost[0] = 0; strcat(m_localhost, "socket."); - strcat(m_localhost, mconfig.options().comm_localhost()); + strcat(m_localhost, machine().options().comm_localhost()); strcat(m_localhost, ":"); - strcat(m_localhost, mconfig.options().comm_localport()); + strcat(m_localhost, machine().options().comm_localport()); // prepare remotehost "filename" m_remotehost[0] = 0; strcat(m_remotehost, "socket."); - strcat(m_remotehost, mconfig.options().comm_remotehost()); + strcat(m_remotehost, machine().options().comm_remotehost()); strcat(m_remotehost, ":"); - strcat(m_remotehost, mconfig.options().comm_remoteport()); + strcat(m_remotehost, machine().options().comm_remoteport()); - m_framesync = mconfig.options().comm_framesync() ? 0x01 : 0x00; + m_framesync = machine().options().comm_framesync() ? 0x01 : 0x00; #endif } -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void m1comm_device::device_start() -{ -} - //------------------------------------------------- // device_reset - device-specific reset //------------------------------------------------- diff --git a/src/mame/sega/m2comm.cpp b/src/mame/sega/m2comm.cpp index f590e0d3edbfd..9742eb8836127 100644 --- a/src/mame/sega/m2comm.cpp +++ b/src/mame/sega/m2comm.cpp @@ -196,34 +196,34 @@ void m2comm_device::device_add_mconfig(machine_config &config) m2comm_device::m2comm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, M2COMM, tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void m2comm_device::device_start() { // prepare localhost "filename" m_localhost[0] = 0; strcat(m_localhost, "socket."); - strcat(m_localhost, mconfig.options().comm_localhost()); + strcat(m_localhost, machine().options().comm_localhost()); strcat(m_localhost, ":"); - strcat(m_localhost, mconfig.options().comm_localport()); + strcat(m_localhost, machine().options().comm_localport()); // prepare remotehost "filename" m_remotehost[0] = 0; strcat(m_remotehost, "socket."); - strcat(m_remotehost, mconfig.options().comm_remotehost()); + strcat(m_remotehost, machine().options().comm_remotehost()); strcat(m_remotehost, ":"); - strcat(m_remotehost, mconfig.options().comm_remoteport()); + strcat(m_remotehost, machine().options().comm_remoteport()); - m_framesync = mconfig.options().comm_framesync() ? 0x01 : 0x00; + m_framesync = machine().options().comm_framesync() ? 0x01 : 0x00; m_frameoffset = 0x1c0; // default } -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void m2comm_device::device_start() -{ -} - //------------------------------------------------- // device_reset - device-specific reset //------------------------------------------------- diff --git a/src/mame/sega/m3comm.cpp b/src/mame/sega/m3comm.cpp index 96300210c42f1..bda3a743b822b 100644 --- a/src/mame/sega/m3comm.cpp +++ b/src/mame/sega/m3comm.cpp @@ -141,28 +141,29 @@ m3comm_device::m3comm_device(const machine_config &mconfig, const char *tag, dev m_68k_ram(*this, "m68k_ram"), m_commcpu(*this, M68K_TAG), m_ram(*this, RAM_TAG) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void m3comm_device::device_start() { // prepare localhost "filename" m_localhost[0] = 0; strcat(m_localhost, "socket."); - strcat(m_localhost, mconfig.options().comm_localhost()); + strcat(m_localhost, machine().options().comm_localhost()); strcat(m_localhost, ":"); - strcat(m_localhost, mconfig.options().comm_localport()); + strcat(m_localhost, machine().options().comm_localport()); // prepare remotehost "filename" m_remotehost[0] = 0; strcat(m_remotehost, "socket."); - strcat(m_remotehost, mconfig.options().comm_remotehost()); + strcat(m_remotehost, machine().options().comm_remotehost()); strcat(m_remotehost, ":"); - strcat(m_remotehost, mconfig.options().comm_remoteport()); -} + strcat(m_remotehost, machine().options().comm_remoteport()); -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void m3comm_device::device_start() -{ m_timer = timer_alloc(FUNC(m3comm_device::trigger_irq5), this); m_timer->adjust(attotime::from_usec(10000)); } diff --git a/src/mame/sega/s32comm.cpp b/src/mame/sega/s32comm.cpp index 667b6c50541e7..42ca9976464ef 100644 --- a/src/mame/sega/s32comm.cpp +++ b/src/mame/sega/s32comm.cpp @@ -98,32 +98,32 @@ void s32comm_device::device_add_mconfig(machine_config &config) s32comm_device::s32comm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, S32COMM, tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void s32comm_device::device_start() { std::fill(std::begin(m_shared), std::end(m_shared), 0); // prepare localhost "filename" m_localhost[0] = 0; strcat(m_localhost, "socket."); - strcat(m_localhost, mconfig.options().comm_localhost()); + strcat(m_localhost, machine().options().comm_localhost()); strcat(m_localhost, ":"); - strcat(m_localhost, mconfig.options().comm_localport()); + strcat(m_localhost, machine().options().comm_localport()); // prepare remotehost "filename" m_remotehost[0] = 0; strcat(m_remotehost, "socket."); - strcat(m_remotehost, mconfig.options().comm_remotehost()); + strcat(m_remotehost, machine().options().comm_remotehost()); strcat(m_remotehost, ":"); - strcat(m_remotehost, mconfig.options().comm_remoteport()); + strcat(m_remotehost, machine().options().comm_remoteport()); - m_framesync = mconfig.options().comm_framesync() ? 0x01 : 0x00; -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void s32comm_device::device_start() -{ + m_framesync = machine().options().comm_framesync() ? 0x01 : 0x00; } //-------------------------------------------------