mirror of
https://github.com/holub/mame
synced 2025-07-01 16:19:38 +03:00
Restored ability of for image devices to report specific error messages.
Restores ability to give specific/detailed messages removed in
6f7e4141ea
while pandering to obsession
with single return value.
Moved responsibility for displaying the error message in the UI to the
caller rather than device_image_interface, and made
device_image_interface always log the error along with the full path and
error condition content.
Gave several image devices more detailed error messages. Added some
FIXME comments for apparent bugs.
This commit is contained in:
parent
9bda81283d
commit
2b424f5a80
@ -332,7 +332,7 @@ static const char *a78_get_slot(int type)
|
||||
return "a78_rom";
|
||||
}
|
||||
|
||||
std::error_condition a78_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> a78_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -368,8 +368,8 @@ std::error_condition a78_cart_slot_device::call_load()
|
||||
char head[128];
|
||||
fread(head, 128);
|
||||
|
||||
std::error_condition err = verify_header(head);
|
||||
if (err)
|
||||
auto err = verify_header(head);
|
||||
if (err.first)
|
||||
return err;
|
||||
|
||||
len = (head[49] << 24) | (head[50] << 16) | (head[51] << 8) | head[52];
|
||||
@ -464,7 +464,7 @@ std::error_condition a78_cart_slot_device::call_load()
|
||||
|
||||
//printf("Type: %s\n", a78_get_slot(m_type));
|
||||
}
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
@ -485,18 +485,15 @@ void a78_cart_slot_device::call_unload()
|
||||
has an admissible header
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition a78_cart_slot_device::verify_header(const char *header)
|
||||
std::pair<std::error_condition, std::string> a78_cart_slot_device::verify_header(const char *header)
|
||||
{
|
||||
const char *magic = "ATARI7800";
|
||||
|
||||
if (strncmp(magic, header + 1, 9))
|
||||
{
|
||||
osd_printf_error("%s: Not a valid A7800 image\n", basename());
|
||||
return image_error::INVALIDIMAGE;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDIMAGE, "Not a valid A7800 image");
|
||||
|
||||
logerror("returning ID_OK\n");
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
virtual ~a78_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
@ -129,7 +129,7 @@ private:
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
|
||||
std::error_condition verify_header(const char *header);
|
||||
std::pair<std::error_condition, std::string> verify_header(const char *header);
|
||||
int validate_header(int head, bool log) const;
|
||||
void internal_header_logging(uint8_t *header, uint32_t len);
|
||||
|
||||
|
@ -224,7 +224,7 @@ static const char *a800_get_slot(int type)
|
||||
return "a800_8k";
|
||||
}
|
||||
|
||||
std::error_condition a800_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> a800_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -285,7 +285,7 @@ std::error_condition a800_cart_slot_device::call_load()
|
||||
|
||||
logerror("%s loaded cartridge '%s' size %dK\n", machine().system().name, filename(), len/1024);
|
||||
}
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
virtual ~a800_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -137,16 +137,13 @@ void acorn_8k_device::device_reset()
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
std::error_condition acorn_8k_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
std::pair<std::error_condition, std::string> acorn_8k_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
{
|
||||
uint32_t const size = slot->common_get_size("rom");
|
||||
|
||||
// socket accepts 2K and 4K ROM only
|
||||
if (size != 0x0800 && size != 0x1000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid size: Only 2K/4K is supported\n", image.basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 2K/4K is supported");
|
||||
|
||||
slot->rom_alloc(0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
slot->common_load_rom(slot->get_rom_base(), size, "rom");
|
||||
@ -155,5 +152,5 @@ std::error_condition acorn_8k_device::load_rom(device_image_interface &image, ge
|
||||
uint8_t *rom = slot->get_rom_base();
|
||||
if (size <= 0x0800) memcpy(rom + 0x0800, rom, 0x0800);
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ protected:
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
private:
|
||||
std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom0_load) { return load_rom(image, m_rom[0]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[1]); }
|
||||
|
||||
|
@ -77,7 +77,7 @@ void adam_expansion_slot_device::device_start()
|
||||
// call_load -
|
||||
//-------------------------------------------------
|
||||
|
||||
std::error_condition adam_expansion_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> adam_expansion_slot_device::call_load()
|
||||
{
|
||||
if (m_card)
|
||||
{
|
||||
@ -93,7 +93,7 @@ std::error_condition adam_expansion_slot_device::call_load()
|
||||
}
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "adam_rom"; }
|
||||
|
@ -144,17 +144,14 @@ static const char *apf_get_slot(int type)
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition apf_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> apf_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||
|
||||
if (size > 0x3800)
|
||||
{
|
||||
osd_printf_error("%s: Image extends beyond the expected size for an APF cart\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Image exceeds the expected size for an APF cartridge (14K)");
|
||||
|
||||
m_cart->rom_alloc(size);
|
||||
|
||||
@ -188,7 +185,7 @@ std::error_condition apf_cart_slot_device::call_load()
|
||||
//printf("Type: %s\n", apf_get_slot(m_type));
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
virtual ~apf_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override {}
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -83,17 +83,14 @@ void aquarius_cartridge_slot_device::device_start()
|
||||
// call_load
|
||||
//-------------------------------------------------
|
||||
|
||||
std::error_condition aquarius_cartridge_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> aquarius_cartridge_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||
|
||||
if (size % 0x1000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid ROM size\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Invalid ROM size (must be a multiple of 4K)");
|
||||
|
||||
m_cart->rom_alloc(size);
|
||||
|
||||
@ -103,7 +100,7 @@ std::error_condition aquarius_cartridge_slot_device::call_load()
|
||||
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
auto nmi_handler() { return m_nmi_handler.bind(); }
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "aquarius_cart"; }
|
||||
|
@ -133,7 +133,7 @@ static const char *arcadia_get_slot(int type)
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition arcadia_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> arcadia_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -195,7 +195,7 @@ std::error_condition arcadia_cart_slot_device::call_load()
|
||||
//printf("Type: %s\n", arcadia_get_slot(m_type));
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
virtual ~arcadia_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override {}
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -134,7 +134,7 @@ static const char *astrocade_get_slot(int type)
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition astrocade_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> astrocade_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -165,7 +165,7 @@ std::error_condition astrocade_cart_slot_device::call_load()
|
||||
//printf("Type: %s\n", astrocade_get_slot(m_type));
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
virtual ~astrocade_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override {}
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -328,9 +328,8 @@ QUICKLOAD_LOAD_MEMBER(bbc_datacentre_device::quickload_cb)
|
||||
}
|
||||
else
|
||||
{
|
||||
osd_printf_error("%s: Invalid filetype, must be SSD, DSD, or IMG\n", image.basename());
|
||||
return image_error::INVALIDIMAGE;
|
||||
return std::make_pair(image_error::INVALIDIMAGE, "Unsupported file type, must be SSD, DSD, or IMG");
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
@ -114,17 +114,14 @@ void bbc_romslot_device::device_start()
|
||||
// call load
|
||||
//-------------------------------------------------
|
||||
|
||||
std::error_condition bbc_romslot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> bbc_romslot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||
|
||||
if (size % 0x2000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid ROM size\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Invalid ROM size (must be a multiple of 8K)");
|
||||
|
||||
m_cart->rom_alloc(size, tag());
|
||||
|
||||
@ -142,7 +139,7 @@ std::error_condition bbc_romslot_device::call_load()
|
||||
m_cart->nvram_alloc(get_software_region_length("nvram"));
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -30,7 +30,7 @@ class bbc_romslot_device : public device_t,
|
||||
{
|
||||
public:
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return false; }
|
||||
|
@ -101,7 +101,7 @@ void c64_expansion_slot_device::device_reset()
|
||||
// call_load -
|
||||
//-------------------------------------------------
|
||||
|
||||
std::error_condition c64_expansion_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> c64_expansion_slot_device::call_load()
|
||||
{
|
||||
if (m_card)
|
||||
{
|
||||
@ -190,13 +190,10 @@ std::error_condition c64_expansion_slot_device::call_load()
|
||||
}
|
||||
|
||||
if ((m_card->m_roml_size & (m_card->m_roml_size - 1)) || (m_card->m_romh_size & (m_card->m_romh_size - 1)))
|
||||
{
|
||||
osd_printf_error("%s: ROM size must be power of 2\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "ROM size must be power of 2");
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@ protected:
|
||||
virtual void device_reset() override;
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "c64_cart,vic10_cart"; }
|
||||
|
@ -83,7 +83,7 @@ void cbm2_expansion_slot_device::device_start()
|
||||
// call_load -
|
||||
//-------------------------------------------------
|
||||
|
||||
std::error_condition cbm2_expansion_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> cbm2_expansion_slot_device::call_load()
|
||||
{
|
||||
if (m_card)
|
||||
{
|
||||
@ -115,7 +115,7 @@ std::error_condition cbm2_expansion_slot_device::call_load()
|
||||
}
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "cbm2_cart"; }
|
||||
|
@ -180,15 +180,12 @@ DEVICE_IMAGE_LOAD_MEMBER( cgenie_fdc_device::socket_load )
|
||||
uint32_t const size = m_socket->common_get_size("rom");
|
||||
|
||||
if (size > 0x1000)
|
||||
{
|
||||
osd_printf_error("%s: Unsupported ROM size\n", image.basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Unsupported ROM size (must be no more than 4K)");
|
||||
|
||||
m_socket->rom_alloc(0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
m_socket->common_load_rom(m_socket->get_rom_base(), size, "rom");
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( cgenie_fdc_device::intrq_w )
|
||||
|
@ -146,7 +146,7 @@ static const char *chanf_get_slot(int type)
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition channelf_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> channelf_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -182,7 +182,7 @@ std::error_condition channelf_cart_slot_device::call_load()
|
||||
//printf("Type: %s\n", chanf_get_slot(m_type));
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
virtual ~channelf_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override { }
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -574,7 +574,7 @@ static std::error_condition read_coco_rpk(std::unique_ptr<util::random_read> &&s
|
||||
// call_load
|
||||
//-------------------------------------------------
|
||||
|
||||
std::error_condition cococart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> cococart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -596,7 +596,7 @@ std::error_condition cococart_slot_device::call_load()
|
||||
if (!err)
|
||||
err = read_coco_rpk(std::move(proxy), base, cart_length, read_length);
|
||||
if (err)
|
||||
return err;
|
||||
return std::make_pair(err, std::string());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -611,7 +611,7 @@ std::error_condition cococart_slot_device::call_load()
|
||||
read_length += len;
|
||||
}
|
||||
}
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
virtual void device_start() override;
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "coco_cart"; }
|
||||
|
@ -76,7 +76,7 @@ void colecovision_cartridge_slot_device::device_start()
|
||||
// call_load -
|
||||
//-------------------------------------------------
|
||||
|
||||
std::error_condition colecovision_cartridge_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> colecovision_cartridge_slot_device::call_load()
|
||||
{
|
||||
if (m_card)
|
||||
{
|
||||
@ -94,7 +94,7 @@ std::error_condition colecovision_cartridge_slot_device::call_load()
|
||||
}
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "coleco_cart"; }
|
||||
|
@ -101,7 +101,7 @@ void cpc_rom_image_device::device_start()
|
||||
/*-------------------------------------------------
|
||||
DEVICE_IMAGE_LOAD( rom )
|
||||
-------------------------------------------------*/
|
||||
std::error_condition cpc_rom_image_device::call_load()
|
||||
std::pair<std::error_condition, std::string> cpc_rom_image_device::call_load()
|
||||
{
|
||||
uint64_t const size = length();
|
||||
|
||||
@ -116,7 +116,7 @@ std::error_condition cpc_rom_image_device::call_load()
|
||||
fread(m_base, 16384);
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
virtual ~cpc_rom_image_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -137,17 +137,14 @@ static const char *crvision_get_slot(int type)
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition crvision_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> crvision_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||
|
||||
if (size > 0x4800)
|
||||
{
|
||||
osd_printf_error("%s: Image extends beyond the expected size for an APF cart\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Image exceeds the expected size for a CreatiVision cartridge (18K)");
|
||||
|
||||
m_cart->rom_alloc(size);
|
||||
|
||||
@ -195,7 +192,7 @@ std::error_condition crvision_cart_slot_device::call_load()
|
||||
logerror("Type: %s\n", crvision_get_slot(m_type));
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
virtual ~crvision_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override { }
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -127,7 +127,7 @@ static const char *ekara_get_slot(int type)
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition ekara_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> ekara_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -156,7 +156,7 @@ std::error_condition ekara_cart_slot_device::call_load()
|
||||
}
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
virtual ~ekara_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override {}
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -154,16 +154,13 @@ void electron_ap5_device::write(offs_t offset, uint8_t data, int infc, int infd,
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
std::error_condition electron_ap5_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
std::pair<std::error_condition, std::string> electron_ap5_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
{
|
||||
uint32_t const size = slot->common_get_size("rom");
|
||||
|
||||
// socket accepts 8K and 16K ROM only
|
||||
if (size != 0x2000 && size != 0x4000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
|
||||
|
||||
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
slot->common_load_rom(slot->get_rom_base(), size, "rom");
|
||||
@ -173,5 +170,5 @@ std::error_condition electron_ap5_device::load_rom(device_image_interface &image
|
||||
if (size <= 0x2000)
|
||||
memcpy(crt + 0x2000, crt, 0x2000);
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ protected:
|
||||
virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
|
||||
|
||||
private:
|
||||
std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_romslot[0]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_romslot[1]); }
|
||||
|
||||
|
@ -140,16 +140,13 @@ void electron_romp144_device::write(offs_t offset, uint8_t data, int infc, int i
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
std::error_condition electron_romp144_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
std::pair<std::error_condition, std::string> electron_romp144_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
{
|
||||
uint32_t const size = slot->common_get_size("rom");
|
||||
|
||||
// socket accepts 8K and 16K ROM only
|
||||
if (size != 0x2000 && size != 0x4000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
|
||||
|
||||
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
slot->common_load_rom(slot->get_rom_base(), size, "rom");
|
||||
@ -159,5 +156,5 @@ std::error_condition electron_romp144_device::load_rom(device_image_interface &i
|
||||
if (size <= 0x2000)
|
||||
memcpy(crt + 0x2000, crt, 0x2000);
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ protected:
|
||||
virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
|
||||
|
||||
private:
|
||||
std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom0) { return load_rom(image, m_romslot[0]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1) { return load_rom(image, m_romslot[1]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2) { return load_rom(image, m_romslot[2]); }
|
||||
|
@ -122,7 +122,7 @@ void electron_cartslot_device::device_start()
|
||||
// call load
|
||||
//-------------------------------------------------
|
||||
|
||||
std::error_condition electron_cartslot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> electron_cartslot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -131,10 +131,7 @@ std::error_condition electron_cartslot_device::call_load()
|
||||
uint32_t const size = length();
|
||||
|
||||
if (size % 0x2000)
|
||||
{
|
||||
osd_printf_error("%s: Unsupported cartridge size\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be a multiple of 8K)");
|
||||
|
||||
m_cart->rom_alloc(size, tag());
|
||||
fread(m_cart->get_rom_base(), size);
|
||||
@ -151,10 +148,7 @@ std::error_condition electron_cartslot_device::call_load()
|
||||
uint32_t nvramsize = get_software_region_length("nvram");
|
||||
|
||||
if ((upsize % 0x2000) || (losize % 0x2000) || (romsize % 0x2000))
|
||||
{
|
||||
osd_printf_error("%s: Unsupported cartridge size\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Unsupported ROM size (must be a multiple of 8K)");
|
||||
|
||||
// load standard 2x16K ROM cartridges
|
||||
if (losize != 0 || upsize != 0)
|
||||
@ -197,7 +191,7 @@ std::error_condition electron_cartslot_device::call_load()
|
||||
}
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
auto nmi_handler() { return m_nmi_handler.bind(); }
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
|
||||
virtual bool is_writeable() const noexcept override { return true; }
|
||||
|
@ -490,16 +490,13 @@ void electron_ap6_device::expbus_w(offs_t offset, uint8_t data)
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
std::error_condition electron_ap6_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
std::pair<std::error_condition, std::string> electron_ap6_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
{
|
||||
uint32_t const size = slot->common_get_size("rom");
|
||||
|
||||
// socket accepts 8K and 16K ROM only
|
||||
if (size != 0x2000 && size != 0x4000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
|
||||
|
||||
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
slot->common_load_rom(slot->get_rom_base(), size, "rom");
|
||||
@ -509,5 +506,5 @@ std::error_condition electron_ap6_device::load_rom(device_image_interface &image
|
||||
if (size <= 0x2000)
|
||||
memcpy(crt + 0x2000, crt, 0x2000);
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ protected:
|
||||
virtual void expbus_w(offs_t offset, uint8_t data) override;
|
||||
|
||||
private:
|
||||
std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
|
||||
|
@ -224,16 +224,13 @@ void electron_plus2_device::expbus_w(offs_t offset, uint8_t data)
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
std::error_condition electron_plus2_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
std::pair<std::error_condition, std::string> electron_plus2_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
{
|
||||
uint32_t const size = slot->common_get_size("rom");
|
||||
|
||||
// socket accepts 8K and 16K ROM only
|
||||
if (size != 0x2000 && size != 0x4000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
|
||||
|
||||
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
slot->common_load_rom(slot->get_rom_base(), size, "rom");
|
||||
@ -243,5 +240,5 @@ std::error_condition electron_plus2_device::load_rom(device_image_interface &ima
|
||||
if (size <= 0x2000)
|
||||
memcpy(crt + 0x2000, crt, 0x2000);
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ protected:
|
||||
virtual void expbus_w(offs_t offset, uint8_t data) override;
|
||||
|
||||
private:
|
||||
std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
|
||||
|
@ -178,16 +178,13 @@ void electron_rombox_device::expbus_w(offs_t offset, uint8_t data)
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
std::error_condition electron_rombox_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
std::pair<std::error_condition, std::string> electron_rombox_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
{
|
||||
uint32_t const size = slot->common_get_size("rom");
|
||||
|
||||
// socket accepts 8K and 16K ROM only
|
||||
if (size != 0x2000 && size != 0x4000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
|
||||
|
||||
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
slot->common_load_rom(slot->get_rom_base(), size, "rom");
|
||||
@ -197,5 +194,5 @@ std::error_condition electron_rombox_device::load_rom(device_image_interface &im
|
||||
if (size <= 0x2000)
|
||||
memcpy(crt + 0x2000, crt, 0x2000);
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ protected:
|
||||
virtual void expbus_w(offs_t offset, uint8_t data) override;
|
||||
|
||||
private:
|
||||
std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
|
||||
|
@ -321,16 +321,13 @@ void electron_romboxp_device::expbus_w(offs_t offset, uint8_t data)
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
std::error_condition electron_romboxp_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
std::pair<std::error_condition, std::string> electron_romboxp_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
{
|
||||
uint32_t const size = slot->common_get_size("rom");
|
||||
|
||||
// socket accepts 8K and 16K ROM only
|
||||
if (size != 0x2000 && size != 0x4000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
|
||||
|
||||
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
slot->common_load_rom(slot->get_rom_base(), size, "rom");
|
||||
@ -340,5 +337,5 @@ std::error_condition electron_romboxp_device::load_rom(device_image_interface &i
|
||||
if (size <= 0x2000)
|
||||
memcpy(crt + 0x2000, crt, 0x2000);
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ protected:
|
||||
virtual void expbus_w(offs_t offset, uint8_t data) override;
|
||||
|
||||
private:
|
||||
std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
|
||||
|
@ -167,16 +167,13 @@ void electron_sidewndr_device::expbus_w(offs_t offset, uint8_t data)
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
std::error_condition electron_sidewndr_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
std::pair<std::error_condition, std::string> electron_sidewndr_device::load_rom(device_image_interface &image, generic_slot_device *slot)
|
||||
{
|
||||
uint32_t const size = slot->common_get_size("rom");
|
||||
|
||||
// socket accepts 8K and 16K ROM only
|
||||
if (size != 0x2000 && size != 0x4000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
|
||||
|
||||
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
slot->common_load_rom(slot->get_rom_base(), size, "rom");
|
||||
@ -186,5 +183,5 @@ std::error_condition electron_sidewndr_device::load_rom(device_image_interface &
|
||||
if (size <= 0x2000)
|
||||
memcpy(crt + 0x2000, crt, 0x2000);
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ protected:
|
||||
virtual void expbus_w(offs_t offset, uint8_t data) override;
|
||||
|
||||
private:
|
||||
std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
|
||||
|
@ -125,17 +125,14 @@ static const char *gamate_get_slot(int type)
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition gamate_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> gamate_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
uint32_t const len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||
|
||||
if (len > 0x8'0000)
|
||||
{
|
||||
osd_printf_error("%s: Unsupported cartridge size\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no more than 512K)");
|
||||
|
||||
m_cart->rom_alloc(len);
|
||||
|
||||
@ -160,7 +157,7 @@ std::error_condition gamate_cart_slot_device::call_load()
|
||||
}
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
virtual ~gamate_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override { }
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -1121,7 +1121,7 @@ void gb_cart_slot_device::device_reset_after_children()
|
||||
}
|
||||
|
||||
|
||||
std::error_condition gb_cart_slot_device::load_image_file(util::random_read &file)
|
||||
std::pair<std::error_condition, std::string> gb_cart_slot_device::load_image_file(util::random_read &file)
|
||||
{
|
||||
using namespace bus::gameboy;
|
||||
|
||||
@ -1138,19 +1138,10 @@ std::error_condition gb_cart_slot_device::load_image_file(util::random_read &fil
|
||||
// try reading the GBX footer into temporary space before more checks
|
||||
std::unique_ptr<u8 []> const footer(new (std::nothrow) u8 [gbxtrailer.size]);
|
||||
if (!footer)
|
||||
{
|
||||
osd_printf_error("%s: Error allocating memory to read GBX file footer\n", basename());
|
||||
return std::errc::not_enough_memory;
|
||||
}
|
||||
return std::make_pair(std::errc::not_enough_memory, "Error allocating memory to read GBX file footer");
|
||||
std::error_condition const err = file.read_at(len - gbxtrailer.size, footer.get(), gbxtrailer.size, actual);
|
||||
if (err || (gbxtrailer.size != actual))
|
||||
{
|
||||
osd_printf_error("%s: Error reading GBX file footer\n", basename());
|
||||
if (err)
|
||||
return err;
|
||||
else
|
||||
return std::errc::io_error;
|
||||
}
|
||||
return std::make_pair(err ? err : std::errc::io_error, "Error reading GBX file footer");
|
||||
if (1 != gbxtrailer.ver_maj)
|
||||
{
|
||||
// some unsupported GBX version - assume footer immediately follows ROM
|
||||
@ -1252,13 +1243,7 @@ std::error_condition gb_cart_slot_device::load_image_file(util::random_read &fil
|
||||
memory_region *const romregion = machine().memory().region_alloc(subtag("rom"), len, 1, ENDIANNESS_LITTLE);
|
||||
std::error_condition const err = file.read_at(offset, romregion->base(), len, actual);
|
||||
if (err || (len != actual))
|
||||
{
|
||||
osd_printf_error("%s: Error reading ROM data from cartridge file\n", basename());
|
||||
if (err)
|
||||
return err;
|
||||
else
|
||||
return std::errc::io_error;
|
||||
}
|
||||
return std::make_pair(err ? err : std::errc::io_error, "Error reading ROM data from cartridge file");
|
||||
|
||||
// allocate cartridge RAM based on header if necessary
|
||||
if (proberam)
|
||||
@ -1272,7 +1257,7 @@ std::error_condition gb_cart_slot_device::load_image_file(util::random_read &fil
|
||||
}
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,7 +76,7 @@ protected:
|
||||
virtual void device_reset_after_children() override ATTR_COLD;
|
||||
|
||||
// gb_cart_slot_device_base implementation
|
||||
virtual std::error_condition load_image_file(util::random_read &file) override ATTR_COLD;
|
||||
virtual std::pair<std::error_condition, std::string> load_image_file(util::random_read &file) override ATTR_COLD;
|
||||
|
||||
void allocate_cart_ram(u8 const *basepage) ATTR_COLD;
|
||||
};
|
||||
|
@ -116,7 +116,7 @@ std::string megaduck_cart_slot_device::get_default_card_software(get_default_car
|
||||
}
|
||||
|
||||
|
||||
std::error_condition megaduck_cart_slot_device::load_image_file(util::random_read &file)
|
||||
std::pair<std::error_condition, std::string> megaduck_cart_slot_device::load_image_file(util::random_read &file)
|
||||
{
|
||||
auto const len = length();
|
||||
size_t actual;
|
||||
@ -127,16 +127,10 @@ std::error_condition megaduck_cart_slot_device::load_image_file(util::random_rea
|
||||
memory_region *const romregion = machine().memory().region_alloc(subtag("rom"), len, 1, ENDIANNESS_LITTLE);
|
||||
std::error_condition const err = file.read_at(0, romregion->base(), len, actual);
|
||||
if (err || (len != actual))
|
||||
{
|
||||
osd_printf_error("%s: Error reading cartridge file\n", basename());
|
||||
if (err)
|
||||
return err;
|
||||
else
|
||||
return std::errc::io_error;
|
||||
}
|
||||
std::make_pair(err ? err : std::errc::io_error, "Error reading cartridge file");
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
|
||||
protected:
|
||||
// gb_cart_slot_device_base implementation
|
||||
virtual std::error_condition load_image_file(util::random_read &file) override ATTR_COLD;
|
||||
virtual std::pair<std::error_condition, std::string> load_image_file(util::random_read &file) override ATTR_COLD;
|
||||
};
|
||||
|
||||
|
||||
|
@ -47,27 +47,27 @@ void gb_cart_slot_device_base::device_start()
|
||||
}
|
||||
|
||||
|
||||
std::error_condition gb_cart_slot_device_base::call_load()
|
||||
std::pair<std::error_condition, std::string> gb_cart_slot_device_base::call_load()
|
||||
{
|
||||
if (!m_cart)
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
|
||||
std::error_condition result;
|
||||
std::string message;
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
result = load_image_file(image_core_file());
|
||||
std::tie(result, message) = load_image_file(image_core_file());
|
||||
if (result)
|
||||
return result;
|
||||
return std::make_pair(result, message);
|
||||
}
|
||||
std::string message;
|
||||
|
||||
result = m_cart->load(message);
|
||||
if (result)
|
||||
{
|
||||
if (result == image_error::BADSOFTWARE && !loaded_through_softlist())
|
||||
result = image_error::INVALIDIMAGE;
|
||||
osd_printf_error("%s: %s\n", basename(), message);
|
||||
}
|
||||
return result;
|
||||
return std::make_pair(result, message);
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
template <typename... T> void set_space(T &&... args) { m_space.set_tag(std::forward<T>(args)...); }
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override ATTR_COLD;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override ATTR_COLD;
|
||||
virtual void call_unload() override ATTR_COLD;
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
||||
@ -48,7 +48,7 @@ protected:
|
||||
// device_t implementation
|
||||
virtual void device_start() override ATTR_COLD;
|
||||
|
||||
virtual std::error_condition load_image_file(util::random_read &file) = 0;
|
||||
virtual std::pair<std::error_condition, std::string> load_image_file(util::random_read &file) = 0;
|
||||
|
||||
address_space &cart_space() noexcept { return *m_space; }
|
||||
|
||||
|
@ -617,16 +617,13 @@ static const char *gba_get_slot(int type)
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition gba_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> gba_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
uint32_t const size = loaded_through_softlist() ? get_software_region_length("rom") : length();
|
||||
if (size > 0x400'0000)
|
||||
{
|
||||
osd_printf_error("%s: Attempted loading a cart larger than 64MB\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Cartridges larger than 64MB are not supported");
|
||||
|
||||
m_cart->rom_alloc(size, tag());
|
||||
uint8_t *const ROM = (uint8_t *)m_cart->get_rom_base();
|
||||
@ -683,7 +680,7 @@ std::error_condition gba_cart_slot_device::call_load()
|
||||
battery_load(m_cart->get_nvram_base(), m_cart->get_nvram_size(), 0x00);
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
virtual ~gba_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -160,24 +160,25 @@ void generic_slot_device::device_start()
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition generic_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> generic_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
if (!m_cart)
|
||||
{
|
||||
if (!m_device_image_load.isnull())
|
||||
return m_device_image_load(*this);
|
||||
else
|
||||
{
|
||||
u32 len = common_get_size("rom");
|
||||
|
||||
rom_alloc(len, m_width, m_endianness);
|
||||
common_load_rom(get_rom_base(), len, "rom");
|
||||
|
||||
return std::error_condition();
|
||||
}
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
else if (!m_device_image_load.isnull())
|
||||
{
|
||||
return m_device_image_load(*this);
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 const len = common_get_size("rom");
|
||||
|
||||
return std::error_condition();
|
||||
rom_alloc(len, m_width, m_endianness);
|
||||
common_load_rom(get_rom_base(), len, "rom");
|
||||
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define DEVICE_IMAGE_LOAD_MEMBER(_name) std::error_condition _name(device_image_interface &image)
|
||||
#define DEVICE_IMAGE_LOAD_MEMBER(_name) std::pair<std::error_condition, std::string> _name(device_image_interface &image)
|
||||
#define DECLARE_DEVICE_IMAGE_LOAD_MEMBER(_name) DEVICE_IMAGE_LOAD_MEMBER(_name)
|
||||
|
||||
#define DEVICE_IMAGE_UNLOAD_MEMBER(_name) void _name(device_image_interface &image)
|
||||
@ -149,7 +149,7 @@ class generic_slot_device : public device_t,
|
||||
public device_single_card_slot_interface<device_generic_cart_interface>
|
||||
{
|
||||
public:
|
||||
typedef device_delegate<std::error_condition (device_image_interface &)> load_delegate;
|
||||
typedef device_delegate<std::pair<std::error_condition, std::string> (device_image_interface &)> load_delegate;
|
||||
typedef device_delegate<void (device_image_interface &)> unload_delegate;
|
||||
|
||||
virtual ~generic_slot_device();
|
||||
@ -164,7 +164,7 @@ public:
|
||||
void set_endian(endianness_t end) { m_endianness = end; }
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual char const *image_interface() const noexcept override { return m_interface; }
|
||||
|
@ -168,7 +168,7 @@ class imm4_22_device
|
||||
public:
|
||||
imm4_22_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
|
||||
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
|
||||
virtual bool is_readable() const noexcept override { return true; }
|
||||
@ -222,18 +222,22 @@ imm4_22_device::imm4_22_device(machine_config const &mconfig, char const *tag, d
|
||||
}
|
||||
|
||||
|
||||
std::error_condition imm4_22_device::call_load()
|
||||
std::pair<std::error_condition, std::string> imm4_22_device::call_load()
|
||||
{
|
||||
if ((length() > 1024U) || (length() % 256U))
|
||||
return image_error::INVALIDLENGTH;
|
||||
{
|
||||
return std::make_pair(
|
||||
image_error::INVALIDLENGTH,
|
||||
"Invalid PROM image size (must be a multiple of 256 bytes no larger than 1K)");
|
||||
}
|
||||
|
||||
allocate();
|
||||
if (fread(m_prom.get(), length()) != length())
|
||||
return image_error::UNSPECIFIED;
|
||||
return std::make_pair(image_error::UNSPECIFIED, "Error reading file");
|
||||
|
||||
map_prom();
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
void imm4_22_device::call_unload()
|
||||
|
@ -97,7 +97,7 @@ class imm6_26_device
|
||||
public:
|
||||
imm6_26_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
|
||||
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
|
||||
virtual bool is_readable() const noexcept override { return true; }
|
||||
@ -128,20 +128,24 @@ imm6_26_device::imm6_26_device(machine_config const &mconfig, char const *tag, d
|
||||
}
|
||||
|
||||
|
||||
std::error_condition imm6_26_device::call_load()
|
||||
std::pair<std::error_condition, std::string> imm6_26_device::call_load()
|
||||
{
|
||||
if ((length() > 4096U) || (length() % 256U))
|
||||
return image_error::INVALIDLENGTH;
|
||||
{
|
||||
return std::make_pair(
|
||||
image_error::INVALIDLENGTH,
|
||||
"Invalid PROM image size (must be a multiple of 256 bytes no larger than 4K)");
|
||||
}
|
||||
|
||||
unmap();
|
||||
allocate();
|
||||
if (fread(m_data.get(), length()) != length())
|
||||
return image_error::UNSPECIFIED;
|
||||
return std::make_pair(image_error::UNSPECIFIED, "Error reading file");
|
||||
|
||||
// FIXME: gimme a cookie!
|
||||
rom_space().install_rom(0x1000U, offs_t(0x1000U + length()), m_data.get());
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
void imm6_26_device::call_unload()
|
||||
|
@ -28,7 +28,7 @@ class imm4_90_device
|
||||
public:
|
||||
imm4_90_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
|
||||
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
|
||||
virtual char const *file_extensions() const noexcept override { return "bnpf,hex,lst,txt"; }
|
||||
@ -65,13 +65,13 @@ imm4_90_device::imm4_90_device(machine_config const &mconfig, char const *tag, d
|
||||
}
|
||||
|
||||
|
||||
std::error_condition imm4_90_device::call_load()
|
||||
std::pair<std::error_condition, std::string> imm4_90_device::call_load()
|
||||
{
|
||||
m_step_timer->reset();
|
||||
m_data = 0x00U;
|
||||
m_ready = false;
|
||||
m_stepping = false;
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
void imm4_90_device::call_unload()
|
||||
|
@ -376,12 +376,12 @@ std::error_condition intv_cart_slot_device::load_fullpath()
|
||||
}
|
||||
}
|
||||
|
||||
std::error_condition intv_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> intv_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
if (!loaded_through_softlist())
|
||||
return load_fullpath();
|
||||
return std::make_pair(load_fullpath(), std::string());
|
||||
else
|
||||
{
|
||||
uint16_t offset[] = { 0x400, 0x2000, 0x4000, 0x4800, 0x5000, 0x6000, 0x7000, 0x8000, 0x8800, 0x9000, 0xa000, 0xb000, 0xc000, 0xd000, 0xe000, 0xf000};
|
||||
@ -424,11 +424,11 @@ std::error_condition intv_cart_slot_device::call_load()
|
||||
m_cart->ram_alloc(get_software_region_length("ram"));
|
||||
|
||||
//printf("Type: %s\n", intv_get_slot(m_type));
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
virtual ~intv_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override {}
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -155,30 +155,28 @@ void iq151cart_slot_device::video_update(bitmap_ind16 &bitmap, const rectangle &
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition iq151cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> iq151cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
uint8_t *const cart_base = m_cart->get_cart_base();
|
||||
if (cart_base)
|
||||
if (!cart_base)
|
||||
return std::make_pair(image_error::INTERNAL, std::string());
|
||||
|
||||
offs_t read_length;
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
offs_t read_length;
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
read_length = length();
|
||||
fread(m_cart->get_cart_base(), read_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
read_length = get_software_region_length("rom");
|
||||
memcpy(m_cart->get_cart_base(), get_software_region("rom"), read_length);
|
||||
}
|
||||
read_length = length();
|
||||
fread(m_cart->get_cart_base(), read_length);
|
||||
}
|
||||
else
|
||||
return image_error::INTERNAL;
|
||||
{
|
||||
read_length = get_software_region_length("rom");
|
||||
memcpy(m_cart->get_cart_base(), get_software_region("rom"), read_length);
|
||||
}
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
auto out_drq_callback() { return m_out_drq_cb.bind(); }
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "iq151_cart"; }
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
virtual const char *image_type_name() const noexcept override { return "winchester"; }
|
||||
virtual const char *image_brief_type_name() const noexcept override { return "disk"; }
|
||||
|
||||
virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
|
||||
virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
|
||||
|
||||
protected:
|
||||
// device_t implementation
|
||||
@ -1469,7 +1469,7 @@ void omti_disk_image_device::device_reset()
|
||||
disk image create callback
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition omti_disk_image_device::call_create(int format_type, util::option_resolution *format_options)
|
||||
std::pair<std::error_condition, std::string> omti_disk_image_device::call_create(int format_type, util::option_resolution *format_options)
|
||||
{
|
||||
logerror("device_create_omti_disk: creating OMTI Disk with %d blocks\n", m_sector_count);
|
||||
|
||||
@ -1479,8 +1479,8 @@ std::error_condition omti_disk_image_device::call_create(int format_type, util::
|
||||
for (int x = 0; x < m_sector_count; x++)
|
||||
{
|
||||
if (fwrite(sectordata, OMTI_DISK_SECTOR_SIZE) < OMTI_DISK_SECTOR_SIZE)
|
||||
return image_error::UNSPECIFIED;
|
||||
return std::make_pair(image_error::UNSPECIFIED, std::string());
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
@ -1295,19 +1295,19 @@ void sc499_ctape_image_device::write_block(int block_num, uint8_t *ptr)
|
||||
memcpy(&m_ctape_data[block_num * SC499_CTAPE_BLOCK_SIZE], ptr, SC499_CTAPE_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
std::error_condition sc499_ctape_image_device::call_load()
|
||||
std::pair<std::error_condition, std::string> sc499_ctape_image_device::call_load()
|
||||
{
|
||||
try
|
||||
{
|
||||
auto const size = length();
|
||||
m_ctape_data.resize(size);
|
||||
if (!fseek(0, SEEK_SET) && (fread(m_ctape_data.data(), size) == size))
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
return image_error::UNSPECIFIED;
|
||||
return std::make_pair(image_error::UNSPECIFIED, std::string());
|
||||
}
|
||||
|
||||
void sc499_ctape_image_device::call_unload()
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
sc499_ctape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
|
||||
virtual bool support_command_line_image_creation() const noexcept override { return true; }
|
||||
|
@ -125,7 +125,7 @@ static const char *jakks_gamekey_get_slot(int type)
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition jakks_gamekey_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> jakks_gamekey_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -154,7 +154,7 @@ std::error_condition jakks_gamekey_slot_device::call_load()
|
||||
}
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
virtual ~jakks_gamekey_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override { }
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -316,7 +316,7 @@ kccart_slot_device::~kccart_slot_device()
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition kccart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> kccart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -336,10 +336,10 @@ std::error_condition kccart_slot_device::call_load()
|
||||
}
|
||||
}
|
||||
else
|
||||
return image_error::INTERNAL;
|
||||
return std::make_pair(image_error::INTERNAL, std::string());
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
|
@ -111,7 +111,7 @@ public:
|
||||
virtual ~kccart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "kc_cart"; }
|
||||
|
@ -145,7 +145,7 @@ static const char *m5_get_slot(int type)
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition m5_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> m5_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -165,10 +165,7 @@ std::error_condition m5_cart_slot_device::call_load()
|
||||
uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||
|
||||
if (size > 0x5000 && m_type == M5_STD)
|
||||
{
|
||||
osd_printf_error("%s: Image extends beyond the expected size for an M5 cart\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Image file exceeds the expected size for an M5 cart (20K)");
|
||||
|
||||
m_cart->rom_alloc(size, tag());
|
||||
|
||||
@ -182,11 +179,10 @@ std::error_condition m5_cart_slot_device::call_load()
|
||||
if (get_software_region("ram"))
|
||||
m_cart->ram_alloc(get_software_region_length("ram"));
|
||||
|
||||
|
||||
//printf("Type: %s\n", m5_get_slot(m_type));
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
virtual ~m5_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override { }
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -88,23 +88,21 @@ void mc10cart_slot_device::set_nmi_line(int state)
|
||||
// call_load
|
||||
//-------------------------------------------------
|
||||
|
||||
std::error_condition mc10cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> mc10cart_slot_device::call_load()
|
||||
{
|
||||
if (!m_cart)
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
|
||||
memory_region *romregion(loaded_through_softlist() ? memregion("rom") : nullptr);
|
||||
if (loaded_through_softlist() && !romregion)
|
||||
{
|
||||
osd_printf_error("%s: Software list item has no 'rom' data area\n", basename());
|
||||
return image_error::BADSOFTWARE;
|
||||
}
|
||||
return std::make_pair(image_error::BADSOFTWARE, "Software list item has no 'rom' data area");
|
||||
|
||||
u32 const len(loaded_through_softlist() ? romregion->bytes() : length());
|
||||
if (len > m_cart->max_rom_length())
|
||||
{
|
||||
osd_printf_error("%s: Unsupported cartridge size\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
return std::make_pair(
|
||||
image_error::INVALIDLENGTH,
|
||||
util::string_format("Unsupported cartridge size (must be no more than %u bytes)", m_cart->max_rom_length()));
|
||||
}
|
||||
|
||||
if (!loaded_through_softlist())
|
||||
@ -113,10 +111,7 @@ std::error_condition mc10cart_slot_device::call_load()
|
||||
romregion = machine().memory().region_alloc(subtag("rom"), len, 1, ENDIANNESS_BIG);
|
||||
u32 const cnt(fread(romregion->base(), len));
|
||||
if (cnt != len)
|
||||
{
|
||||
osd_printf_error("%s: Error reading cartridge file\n", basename());
|
||||
return image_error::UNSPECIFIED;
|
||||
}
|
||||
return std::make_pair(image_error::UNSPECIFIED, "Error reading cartridge file");
|
||||
}
|
||||
|
||||
return m_cart->load();
|
||||
@ -189,9 +184,9 @@ int device_mc10cart_interface::max_rom_length() const
|
||||
load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition device_mc10cart_interface::load()
|
||||
std::pair<std::error_condition, std::string> device_mc10cart_interface::load()
|
||||
{
|
||||
return image_error::UNSUPPORTED;
|
||||
return std::make_pair(image_error::UNSUPPORTED, std::string());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -28,7 +28,6 @@ class mc10cart_slot_device final : public device_t,
|
||||
public device_cartrom_image_interface
|
||||
{
|
||||
public:
|
||||
|
||||
// construction/destruction
|
||||
template <typename T>
|
||||
mc10cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, T &&opts, const char *dflt)
|
||||
@ -50,7 +49,7 @@ public:
|
||||
address_space &memspace() const { return *m_memspace; }
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "mc10_cart"; }
|
||||
@ -84,7 +83,7 @@ public:
|
||||
virtual ~device_mc10cart_interface();
|
||||
|
||||
virtual int max_rom_length() const;
|
||||
virtual std::error_condition load();
|
||||
virtual std::pair<std::error_condition, std::string> load();
|
||||
|
||||
protected:
|
||||
void raise_cart_nmi() { m_owning_slot->set_nmi_line(ASSERT_LINE); }
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
// construction/destruction
|
||||
mc10_pak_mcx128_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
// device-level overrides
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_post_load() override;
|
||||
|
@ -53,17 +53,17 @@ void mc10_pak_device::device_start()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// load - install rom region
|
||||
// load - install ROM region
|
||||
//-------------------------------------------------
|
||||
|
||||
std::error_condition mc10_pak_device::load()
|
||||
std::pair<std::error_condition, std::string> mc10_pak_device::load()
|
||||
{
|
||||
// if the host has supplied a ROM space, install it
|
||||
memory_region *const romregion(memregion("^rom"));
|
||||
if (romregion)
|
||||
owning_slot().memspace().install_rom(0x5000, 0x5000 + romregion->bytes(), romregion->base());
|
||||
else
|
||||
return image_error::INTERNAL;
|
||||
if (!romregion)
|
||||
return std::make_pair(image_error::BADSOFTWARE, "Software item lacks 'rom' data area");
|
||||
|
||||
return std::error_condition();
|
||||
// if the host has supplied a ROM space, install it
|
||||
owning_slot().memspace().install_rom(0x5000, 0x5000 + romregion->bytes(), romregion->base());
|
||||
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
mc10_pak_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
virtual int max_rom_length() const override;
|
||||
virtual std::error_condition load() override;
|
||||
virtual std::pair<std::error_condition, std::string> load() override;
|
||||
|
||||
protected:
|
||||
mc10_pak_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
|
||||
|
@ -34,7 +34,7 @@ namespace
|
||||
mc10_pak_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
private:
|
||||
memory_share_creator<u8> m_share;
|
||||
|
@ -309,7 +309,7 @@ static const char *md_get_slot(int type)
|
||||
-------------------------------------------------*/
|
||||
|
||||
|
||||
std::error_condition base_md_cart_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> base_md_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
@ -344,10 +344,10 @@ std::error_condition 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 std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -157,7 +157,7 @@ public:
|
||||
virtual ~base_md_cart_slot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
|
@ -62,23 +62,17 @@ void mononcol_cartslot_device::device_start()
|
||||
call load
|
||||
-------------------------------------------------*/
|
||||
|
||||
std::error_condition mononcol_cartslot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> mononcol_cartslot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
memory_region *romregion(loaded_through_softlist() ? memregion("rom") : nullptr);
|
||||
if (loaded_through_softlist() && !romregion)
|
||||
{
|
||||
osd_printf_error("%s: Software list item has no 'rom' data area\n", basename());
|
||||
return image_error::BADSOFTWARE;
|
||||
}
|
||||
return std::make_pair(image_error::BADSOFTWARE, "Software list item has no 'rom' data area");
|
||||
|
||||
const u32 len = loaded_through_softlist() ? get_software_region_length("rom") : length();
|
||||
if (!len || ((len - 1) & len))
|
||||
{
|
||||
osd_printf_error("%s: Cartridge ROM size is not a power of 2\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Cartridge ROM size is not a power of 2");
|
||||
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
@ -86,15 +80,12 @@ std::error_condition mononcol_cartslot_device::call_load()
|
||||
romregion = machine().memory().region_alloc(subtag("rom"), len, 4, ENDIANNESS_LITTLE);
|
||||
const u32 cnt = fread(romregion->base(), len);
|
||||
if (cnt != len)
|
||||
{
|
||||
osd_printf_error("%s: Error reading cartridge file\n", basename());
|
||||
return image_error::UNSPECIFIED;
|
||||
}
|
||||
return std::make_pair(image_error::UNSPECIFIED, "Error reading cartridge file");
|
||||
}
|
||||
|
||||
m_cart->set_spi_region(romregion->base(), romregion->bytes());
|
||||
}
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
virtual ~mononcol_cartslot_device();
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual char const *image_interface() const noexcept override { return "monon_color_cart"; }
|
||||
virtual char const *file_extensions() const noexcept override { return "bin"; }
|
||||
|
@ -40,46 +40,34 @@ void msx_cart_beepack_device::device_add_mconfig(machine_config &config)
|
||||
SOFTWARE_LIST(config, "bee_card_list").set_original("msx1_bee_card");
|
||||
}
|
||||
|
||||
std::error_condition msx_cart_beepack_device::call_load()
|
||||
std::pair<std::error_condition, std::string> msx_cart_beepack_device::call_load()
|
||||
{
|
||||
if (m_beecard)
|
||||
{
|
||||
if (loaded_through_softlist())
|
||||
{
|
||||
u32 length = get_software_region_length("rom");
|
||||
u32 const length = get_software_region_length("rom");
|
||||
// Only 16KB or 32KB images are supported
|
||||
if (length != 0x4000 && length != 0x8000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid file size for a bee card\n", basename());
|
||||
return image_error::BADSOFTWARE;
|
||||
}
|
||||
return std::make_pair(image_error::BADSOFTWARE, "Invalid file size for a bee card (must be 16K or 32K)");
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 length = this->length();
|
||||
u32 const length = this->length();
|
||||
// Only 16KB or 32KB images are supported
|
||||
if (length != 0x4000 && length != 0x8000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid file size for a bee card\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::BADSOFTWARE, "Invalid file size for a bee card (must be 16K or 32K)");
|
||||
|
||||
memory_region *const romregion = machine().memory().region_alloc(subtag("rom"), length, 1, ENDIANNESS_LITTLE);
|
||||
if (fread(romregion->base(), length) != length)
|
||||
{
|
||||
osd_printf_error("%s: Unable to fully read file\n", basename());
|
||||
return image_error::UNSPECIFIED;
|
||||
}
|
||||
return std::make_pair(image_error::UNSPECIFIED, "Unable to fully read file");
|
||||
}
|
||||
|
||||
std::string message;
|
||||
std::error_condition result = m_beecard->initialize_cartridge(message);
|
||||
if (result)
|
||||
osd_printf_error("%s: %s\n", basename(), message);
|
||||
|
||||
return result;
|
||||
return std::make_pair(result, message);
|
||||
}
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
std::string msx_cart_beepack_device::get_default_card_software(get_default_card_software_hook &hook) const
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
msx_cart_beepack_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "bee_card"; }
|
||||
virtual const char *file_extensions() const noexcept override { return "bin,rom"; }
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "cartridge.h"
|
||||
|
||||
#include "arc.h"
|
||||
#include "ascii.h"
|
||||
#include "beepack.h"
|
||||
@ -30,8 +31,8 @@
|
||||
#include "slotexpander.h"
|
||||
#include "slotoptions.h"
|
||||
#include "softcard.h"
|
||||
#include "superloderunner.h"
|
||||
#include "super_swangi.h"
|
||||
#include "superloderunner.h"
|
||||
#include "yamaha_ucn01.h"
|
||||
|
||||
#include "bus/msx/slot/cartridge.h"
|
||||
|
@ -40,7 +40,7 @@ void msx_cart_softcard_device::device_add_mconfig(machine_config &config)
|
||||
SOFTWARE_LIST(config, "softcard_list").set_original("msx_softcard");
|
||||
}
|
||||
|
||||
std::error_condition msx_cart_softcard_device::call_load()
|
||||
std::pair<std::error_condition, std::string> msx_cart_softcard_device::call_load()
|
||||
{
|
||||
if (m_softcard)
|
||||
{
|
||||
@ -49,37 +49,25 @@ std::error_condition msx_cart_softcard_device::call_load()
|
||||
u32 const length = get_software_region_length("rom");
|
||||
// Only 32KB images are supported
|
||||
if (length != 0x8000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid file size for a softcard\n", basename());
|
||||
return image_error::BADSOFTWARE;
|
||||
}
|
||||
return std::pair(image_error::BADSOFTWARE, "Invalid file size for a softcard (must be 32K)");
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 const length = this->length();
|
||||
// Only 32KB images are supported
|
||||
if (length != 0x8000)
|
||||
{
|
||||
osd_printf_error("%s: Invalid file size for a softcard\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::pair(image_error::BADSOFTWARE, "Invalid file size for a softcard (must be 32K)");
|
||||
|
||||
memory_region *const romregion = machine().memory().region_alloc(subtag("rom"), length, 1, ENDIANNESS_LITTLE);
|
||||
if (fread(romregion->base(), length) != length)
|
||||
{
|
||||
osd_printf_error("%s: Unable to fully read file\n", basename());
|
||||
return image_error::UNSPECIFIED;
|
||||
}
|
||||
return std::make_pair(image_error::UNSPECIFIED, "Unable to fully read file");
|
||||
}
|
||||
|
||||
std::string message;
|
||||
std::error_condition result = m_softcard->initialize_cartridge(message);
|
||||
if (result)
|
||||
osd_printf_error("%s: %s\n", basename(), message);
|
||||
|
||||
return result;
|
||||
return std::make_pair(result, message);
|
||||
}
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
std::string msx_cart_softcard_device::get_default_card_software(get_default_card_software_hook &hook) const
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
msx_cart_softcard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "softcard"; }
|
||||
virtual const char *file_extensions() const noexcept override { return "bin,rom"; }
|
||||
|
@ -32,13 +32,13 @@ void msx_slot_cartridge_base_device::device_start()
|
||||
}
|
||||
|
||||
|
||||
std::error_condition msx_slot_cartridge_base_device::call_load()
|
||||
std::pair<std::error_condition, std::string> msx_slot_cartridge_base_device::call_load()
|
||||
{
|
||||
if (m_cartridge)
|
||||
{
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
u32 length = this->length();
|
||||
u32 const length = this->length();
|
||||
|
||||
// determine how much space to allocate
|
||||
u32 length_aligned = 0x10000;
|
||||
@ -59,26 +59,18 @@ std::error_condition msx_slot_cartridge_base_device::call_load()
|
||||
|
||||
memory_region *const romregion = machine().memory().region_alloc(subtag("rom"), length_aligned, 1, ENDIANNESS_LITTLE);
|
||||
if (fread(romregion->base(), length) != length)
|
||||
{
|
||||
osd_printf_error("%s: Unable to fully read file\n", basename());
|
||||
return image_error::UNSPECIFIED;
|
||||
}
|
||||
return std::make_pair(image_error::UNSPECIFIED, "Unable to fully read file");
|
||||
}
|
||||
|
||||
std::string message;
|
||||
std::error_condition result = m_cartridge->initialize_cartridge(message);
|
||||
if (result)
|
||||
{
|
||||
osd_printf_error("%s: %s\n", basename(), message);
|
||||
return result;
|
||||
}
|
||||
return std::make_pair(result, message);
|
||||
|
||||
if (m_cartridge->cart_sram_region())
|
||||
{
|
||||
battery_load(m_cartridge->cart_sram_region()->base(), m_cartridge->cart_sram_region()->bytes(), 0x00);
|
||||
}
|
||||
}
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,7 +51,7 @@ class msx_slot_cartridge_base_device : public device_t
|
||||
public:
|
||||
auto irq_handler() { return m_irq_handler.bind(); }
|
||||
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
virtual void call_unload() override;
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "msx_cart"; }
|
||||
|
@ -89,17 +89,14 @@ void mtx_exp_slot_device::device_start()
|
||||
// call_load
|
||||
//-------------------------------------------------
|
||||
|
||||
std::error_condition mtx_exp_slot_device::call_load()
|
||||
std::pair<std::error_condition, std::string> mtx_exp_slot_device::call_load()
|
||||
{
|
||||
if (m_card)
|
||||
{
|
||||
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||
|
||||
if (size % 0x2000)
|
||||
{
|
||||
osd_printf_error("%s: Unsupported cartridge size\n", basename());
|
||||
return image_error::INVALIDLENGTH;
|
||||
}
|
||||
return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be a multiple of 8K)");
|
||||
|
||||
m_card->rom_alloc(size, tag());
|
||||
|
||||
@ -109,7 +106,7 @@ std::error_condition mtx_exp_slot_device::call_load()
|
||||
memcpy(m_card->get_rom_base(), get_software_region("rom"), size);
|
||||
}
|
||||
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
// device_image_interface implementation
|
||||
virtual std::error_condition call_load() override;
|
||||
virtual std::pair<std::error_condition, std::string> call_load() override;
|
||||
|
||||
virtual bool is_reset_on_load() const noexcept override { return true; }
|
||||
virtual const char *image_interface() const noexcept override { return "mtx_cart"; }
|
||||
|
@ -211,12 +211,12 @@ void network_adapter::postload()
|
||||
}
|
||||
}
|
||||
|
||||
std::error_condition network_adapter::call_load()
|
||||
std::pair<std::error_condition, std::string> network_adapter::call_load()
|
||||
{
|
||||
if (is_filetype("pak")) {
|
||||
return std::error_condition();
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
}
|
||||
return image_error::INVALIDIMAGE;
|
||||
return std::make_pair(image_error::INVALIDIMAGE, std::string());
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user