diff options
Diffstat (limited to 'src/devices/bus/gamate/slot.cpp')
-rw-r--r-- | src/devices/bus/gamate/slot.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/devices/bus/gamate/slot.cpp b/src/devices/bus/gamate/slot.cpp index 869abf24f98..b627aee6d3e 100644 --- a/src/devices/bus/gamate/slot.cpp +++ b/src/devices/bus/gamate/slot.cpp @@ -38,11 +38,11 @@ device_gamate_cart_interface::~device_gamate_cart_interface() // rom_alloc - alloc the space for the cart //------------------------------------------------- -void device_gamate_cart_interface::rom_alloc(uint32_t size, const char *tag) +void device_gamate_cart_interface::rom_alloc(uint32_t size) { if (m_rom == nullptr) { - m_rom = device().machine().memory().region_alloc(std::string(tag).append(GAMATESLOT_ROM_REGION_TAG).c_str(), size, 1, ENDIANNESS_BIG)->base(); + m_rom = device().machine().memory().region_alloc(device().subtag("^cart:rom"), size, 1, ENDIANNESS_BIG)->base(); m_rom_size = size; } } @@ -56,7 +56,7 @@ void device_gamate_cart_interface::rom_alloc(uint32_t size, const char *tag) //------------------------------------------------- gamate_cart_slot_device::gamate_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, GAMATE_CART_SLOT, tag, owner, clock), - device_image_interface(mconfig, *this), + device_cartrom_image_interface(mconfig, *this), device_single_card_slot_interface(mconfig, *this), m_type(GAMATE_PLAIN), m_cart(nullptr) @@ -125,22 +125,18 @@ static const char *gamate_get_slot(int type) call load -------------------------------------------------*/ -image_init_result gamate_cart_slot_device::call_load() +std::pair<std::error_condition, std::string> gamate_cart_slot_device::call_load() { if (m_cart) { - uint8_t *ROM; - uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom"); + uint32_t const len = !loaded_through_softlist() ? length() : get_software_region_length("rom"); - if (len > 0x80000) - { - seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); - return image_init_result::FAIL; - } + if (len > 0x8'0000) + return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no more than 512K)"); - m_cart->rom_alloc(len, tag()); + m_cart->rom_alloc(len); - ROM = m_cart->get_rom_base(); + uint8_t *const ROM = m_cart->get_rom_base(); if (!loaded_through_softlist()) fread(ROM, len); @@ -159,11 +155,9 @@ image_init_result gamate_cart_slot_device::call_load() if (pcb_name) m_type = gamate_get_pcb_id(pcb_name); } - - return image_init_result::PASS; } - return image_init_result::PASS; + return std::make_pair(std::error_condition(), std::string()); } @@ -207,8 +201,7 @@ std::string gamate_cart_slot_device::get_default_card_software(get_default_card_ hook.image_file()->length(len); // FIXME: check error return, guard against excessively large files std::vector<uint8_t> rom(len); - size_t actual; - hook.image_file()->read(&rom[0], len, actual); // FIXME: check error return or read returning short + /*auto const [err, actual] =*/ read(*hook.image_file(), &rom[0], len); // FIXME: check error return or read returning short int const type = get_cart_type(&rom[0], len); char const *const slot_string = gamate_get_slot(type); |