diff options
Diffstat (limited to 'src/devices/bus/megadrive/md_slot.cpp')
-rw-r--r-- | src/devices/bus/megadrive/md_slot.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/devices/bus/megadrive/md_slot.cpp b/src/devices/bus/megadrive/md_slot.cpp index 47069101a44..a7b4d2a20ac 100644 --- a/src/devices/bus/megadrive/md_slot.cpp +++ b/src/devices/bus/megadrive/md_slot.cpp @@ -82,11 +82,11 @@ device_md_cart_interface::~device_md_cart_interface() // rom_alloc - alloc the space for the cart //------------------------------------------------- -void device_md_cart_interface::rom_alloc(size_t size, const char *tag) +void device_md_cart_interface::rom_alloc(size_t size) { if (m_rom == nullptr) { - m_rom = (uint16_t *)device().machine().memory().region_alloc(std::string(tag).append(MDSLOT_ROM_REGION_TAG).c_str(), size, 2, ENDIANNESS_BIG)->base(); + m_rom = (uint16_t *)device().machine().memory().region_alloc(device().subtag("^cart:rom"), size, 2, ENDIANNESS_BIG)->base(); m_rom_size = size; } } @@ -161,10 +161,9 @@ uint32_t device_md_cart_interface::get_padded_size(uint32_t size) //------------------------------------------------- base_md_cart_slot_device::base_md_cart_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock), - device_image_interface(mconfig, *this), + device_cartrom_image_interface(mconfig, *this), device_single_card_slot_interface<device_md_cart_interface>(mconfig, *this), - m_type(SEGA_STD), m_cart(nullptr), - m_must_be_loaded(1) + m_type(SEGA_STD), m_cart(nullptr) { } @@ -310,12 +309,12 @@ static const char *md_get_slot(int type) -------------------------------------------------*/ -image_init_result base_md_cart_slot_device::call_load() +std::pair<std::error_condition, std::string> base_md_cart_slot_device::call_load() { if (m_cart) { m_type = SEGA_STD; - image_init_result res; + std::error_condition res; // STEP 1: load the file image and keep a copy for later banking // STEP 2: identify the cart type @@ -327,7 +326,7 @@ image_init_result base_md_cart_slot_device::call_load() //printf("cart type: %d\n", m_type); - if (res == image_init_result::PASS) + if (!res) { //speed-up rom access from SVP add-on, if present if (m_type == SEGA_SVP) @@ -345,14 +344,14 @@ image_init_result base_md_cart_slot_device::call_load() file_logging((uint8_t *)m_cart->get_rom_base(), m_cart->get_rom_size(), m_cart->get_nvram_size()); } - return res; + return std::make_pair(res, std::string()); } - return image_init_result::PASS; + return std::make_pair(std::error_condition(), std::string()); } -image_init_result base_md_cart_slot_device::load_list() +std::error_condition base_md_cart_slot_device::load_list() { uint16_t *ROM; uint32_t length = get_software_region_length("rom"); @@ -361,7 +360,7 @@ image_init_result base_md_cart_slot_device::load_list() // if cart size is not (2^n * 64K), the system will see anyway that size so we need to alloc a bit more space length = m_cart->get_padded_size(length); - m_cart->rom_alloc(length, tag()); + m_cart->rom_alloc(length); ROM = m_cart->get_rom_base(); memcpy((uint8_t *)ROM, get_software_region("rom"), get_software_region_length("rom")); @@ -378,7 +377,7 @@ image_init_result base_md_cart_slot_device::load_list() if (m_type != SSF2 && m_type != PSOLAR && m_type != CM_2IN1) m_cart->rom_map_setup(length); - return image_init_result::PASS; + return std::error_condition(); } @@ -454,7 +453,7 @@ static int genesis_is_SMD(unsigned char *buf, unsigned int len) * softlist *************************************/ -image_init_result base_md_cart_slot_device::load_nonlist() +std::error_condition base_md_cart_slot_device::load_nonlist() { unsigned char *ROM; bool is_smd, is_md; @@ -473,8 +472,8 @@ image_init_result base_md_cart_slot_device::load_nonlist() // if cart size is not (2^n * 64K), the system will see anyway that size so we need to alloc a bit more space len = m_cart->get_padded_size(tmplen - offset); - // this contains an hack for SSF2: its current bankswitch code needs larger rom space to work - m_cart->rom_alloc((len == 0x500000) ? 0x900000 : len, tag()); + // this contains an hack for SSF2: its current bankswitch code needs larger ROM space to work + m_cart->rom_alloc((len == 0x500000) ? 0x900000 : len); // STEP 3: copy the game data in the appropriate way ROM = (unsigned char *)m_cart->get_rom_base(); @@ -534,7 +533,7 @@ image_init_result base_md_cart_slot_device::load_nonlist() } #endif - return image_init_result::PASS; + return std::error_condition(); } /*------------------------------------------------- @@ -910,8 +909,7 @@ std::string base_md_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 + util::read(*hook.image_file(), &rom[0], len); // FIXME: check error return or read returning short uint32_t const offset = genesis_is_SMD(&rom[0x200], len - 0x200) ? 0x200 : 0; @@ -921,7 +919,9 @@ std::string base_md_cart_slot_device::get_default_card_software(get_default_card return std::string(slot_string); } else + { return software_get_default_slot("rom"); + } } @@ -1081,10 +1081,10 @@ void base_md_cart_slot_device::file_logging(uint8_t *ROM8, uint32_t rom_len, uin } logerror("Checksum: %X\n", checksum); logerror(" - Calculated Checksum: %X\n", csum); - logerror("Supported I/O Devices: %.16s\n%s", io, ctrl.c_str()); + logerror("Supported I/O Devices: %.16s\n%s", io, ctrl); logerror("Modem: %.12s\n", modem); logerror("Memo: %.40s\n", memo); - logerror("Country: %.16s\n%s", country, reg.c_str()); + logerror("Country: %.16s\n%s", country, reg); logerror("ROM Start: 0x%.8X\n", rom_start); logerror("ROM End: 0x%.8X\n", rom_end); logerror("RAM Start: 0x%.8X\n", ram_start); |