diff options
author | Vas Crabb <cuavas@users.noreply.github.com> | 2021-08-22 09:06:15 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-22 09:06:15 +1000 |
commit | e8bbea1fc6e94e14768509d322f6c624403ffb36 (patch) | |
tree | 74dd1606a900d83de8aecff17a6737af4113308d /src/mame | |
parent | e319bde5fc3696d7f48f62b15b6366c4377fe5d1 (diff) |
formats, osd, util: Started refactoring file I/O stuff. (#8456)
Added more modern generic I/O interfaces with implementation backed by stdio, osd_file and core_file, replacing io_generic. Also replaced core_file's build-in zlib compression with a filter.
unzip.cpp, un7z.cpp: Added option to supply abstract I/O interface rather than filename.
Converted osd_file, core_file, archive_file, chd_file and device_image_interface to use std::error_condition rather than their own error enums.
Allow mounting TI-99 RPK from inside archives.
Diffstat (limited to 'src/mame')
66 files changed, 154 insertions, 153 deletions
diff --git a/src/mame/drivers/aim65.cpp b/src/mame/drivers/aim65.cpp index 94870fd4f11..703c35146cb 100644 --- a/src/mame/drivers/aim65.cpp +++ b/src/mame/drivers/aim65.cpp @@ -184,7 +184,7 @@ image_init_result aim65_state::load_cart(device_image_interface &image, generic_ if (size > 0x1000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported ROM size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported ROM size"); return image_init_result::FAIL; } @@ -193,7 +193,7 @@ image_init_result aim65_state::load_cart(device_image_interface &image, generic_ std::string errmsg = string_format( "Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension", slot_tag, slot_tag); - image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str()); + image.seterror(image_error::INVALIDIMAGE, errmsg.c_str()); return image_init_result::FAIL; } diff --git a/src/mame/drivers/alphatro.cpp b/src/mame/drivers/alphatro.cpp index e07c89a1f3f..d6ec5f4bc9d 100644 --- a/src/mame/drivers/alphatro.cpp +++ b/src/mame/drivers/alphatro.cpp @@ -702,7 +702,7 @@ image_init_result alphatro_state::load_cart(device_image_interface &image, gener if ((size != 0x4000) && (size != 0x2000)) { - image.seterror(IMAGE_ERROR_UNSUPPORTED, "Invalid size, must be 8 or 16 K" ); + image.seterror(image_error::INVALIDIMAGE, "Invalid size, must be 8 or 16 K" ); return image_init_result::FAIL; } diff --git a/src/mame/drivers/atom.cpp b/src/mame/drivers/atom.cpp index d5cf875810b..d703f967a70 100644 --- a/src/mame/drivers/atom.cpp +++ b/src/mame/drivers/atom.cpp @@ -683,7 +683,7 @@ image_init_result atom_state::load_cart(device_image_interface &image, generic_s if (size > 0x1000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported ROM size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported ROM size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/beta.cpp b/src/mame/drivers/beta.cpp index 4639ec0fcde..0e543f91230 100644 --- a/src/mame/drivers/beta.cpp +++ b/src/mame/drivers/beta.cpp @@ -297,7 +297,7 @@ DEVICE_IMAGE_LOAD_MEMBER(beta_state::load_beta_eprom) if (size != 0x800) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/binbug.cpp b/src/mame/drivers/binbug.cpp index 1bcba2984a0..3855bc393aa 100644 --- a/src/mame/drivers/binbug.cpp +++ b/src/mame/drivers/binbug.cpp @@ -189,12 +189,12 @@ QUICKLOAD_LOAD_MEMBER(binbug_state::quickload_cb) quick_length = image.length(); if (quick_length < 0x0444) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.seterror(image_error::INVALIDIMAGE, "File too short"); image.message(" File too short"); } else if (quick_length > 0x8000) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.seterror(image_error::INVALIDIMAGE, "File too long"); image.message(" File too long"); } else @@ -203,12 +203,12 @@ QUICKLOAD_LOAD_MEMBER(binbug_state::quickload_cb) read_ = image.fread( &quick_data[0], quick_length); if (read_ != quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.seterror(image_error::INVALIDIMAGE, "Cannot read the file"); image.message(" Cannot read the file"); } else if (quick_data[0] != 0xc4) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.seterror(image_error::INVALIDIMAGE, "Invalid header"); image.message(" Invalid header"); } else @@ -217,7 +217,7 @@ QUICKLOAD_LOAD_MEMBER(binbug_state::quickload_cb) if (exec_addr >= quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.seterror(image_error::INVALIDIMAGE, "Exec address beyond end of file"); image.message(" Exec address beyond end of file"); } else diff --git a/src/mame/drivers/cc40.cpp b/src/mame/drivers/cc40.cpp index 3766231c469..6e737b9b134 100644 --- a/src/mame/drivers/cc40.cpp +++ b/src/mame/drivers/cc40.cpp @@ -196,7 +196,7 @@ DEVICE_IMAGE_LOAD_MEMBER(cc40_state::cart_load) // max size is 4*32KB if (size > 0x20000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); + image.seterror(image_error::INVALIDIMAGE, "Invalid file size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/cd2650.cpp b/src/mame/drivers/cd2650.cpp index 01760a14fbd..cf8203a25fd 100644 --- a/src/mame/drivers/cd2650.cpp +++ b/src/mame/drivers/cd2650.cpp @@ -259,13 +259,13 @@ QUICKLOAD_LOAD_MEMBER(cd2650_state::quickload_cb) int quick_length = image.length(); if (quick_length < 0x1500) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.seterror(image_error::INVALIDIMAGE, "File too short"); image.message(" File too short"); } else if (quick_length > 0x8000) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.seterror(image_error::INVALIDIMAGE, "File too long"); image.message(" File too long"); } else @@ -274,13 +274,13 @@ QUICKLOAD_LOAD_MEMBER(cd2650_state::quickload_cb) int read_ = image.fread( &quick_data[0], quick_length); if (read_ != quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.seterror(image_error::INVALIDIMAGE, "Cannot read the file"); image.message(" Cannot read the file"); } else if (quick_data[0] != 0x40) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.seterror(image_error::INVALIDIMAGE, "Invalid header"); image.message(" Invalid header"); } else @@ -289,7 +289,7 @@ QUICKLOAD_LOAD_MEMBER(cd2650_state::quickload_cb) if (exec_addr >= quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.seterror(image_error::INVALIDIMAGE, "Exec address beyond end of file"); image.message(" Exec address beyond end of file"); } else diff --git a/src/mame/drivers/d6800.cpp b/src/mame/drivers/d6800.cpp index ca08bcbc118..1bffd36f07a 100644 --- a/src/mame/drivers/d6800.cpp +++ b/src/mame/drivers/d6800.cpp @@ -346,7 +346,7 @@ QUICKLOAD_LOAD_MEMBER(d6800_state::quickload_cb) u32 quick_length = image.length(); if (quick_length > 0xe00) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File exceeds 3584 bytes"); + image.seterror(image_error::INVALIDIMAGE, "File exceeds 3584 bytes"); image.message(" File exceeds 3584 bytes"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/elan_eu3a05.cpp b/src/mame/drivers/elan_eu3a05.cpp index 29abd9ff08d..f4327818657 100644 --- a/src/mame/drivers/elan_eu3a05.cpp +++ b/src/mame/drivers/elan_eu3a05.cpp @@ -360,7 +360,7 @@ DEVICE_IMAGE_LOAD_MEMBER(elan_eu3a05_buzztime_state::cart_load) if (size != 0x200000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/eti660.cpp b/src/mame/drivers/eti660.cpp index 379cdb2d55b..5ffea04f6d2 100644 --- a/src/mame/drivers/eti660.cpp +++ b/src/mame/drivers/eti660.cpp @@ -325,7 +325,7 @@ QUICKLOAD_LOAD_MEMBER(eti660_state::quickload_cb) read_ = image.fread( &quick_data[0], quick_length); if (read_ != quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.seterror(image_error::INVALIDIMAGE, "Cannot read the file"); image.message(" Cannot read the file"); } else diff --git a/src/mame/drivers/force68k.cpp b/src/mame/drivers/force68k.cpp index 47e7fe73f48..03d594ca831 100644 --- a/src/mame/drivers/force68k.cpp +++ b/src/mame/drivers/force68k.cpp @@ -514,7 +514,7 @@ image_init_result force68k_state::force68k_load_cart(device_image_interface &ima if (size > 0x20000) // Max 128Kb { LOG("Cartridge size exceeding max size (128Kb): %d\n", size); - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cartridge size exceeding max size (128Kb)"); + image.seterror(image_error::INVALIDIMAGE, "Cartridge size exceeding max size (128Kb)"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/gameking.cpp b/src/mame/drivers/gameking.cpp index 8d398756c38..737445f5928 100644 --- a/src/mame/drivers/gameking.cpp +++ b/src/mame/drivers/gameking.cpp @@ -261,7 +261,7 @@ DEVICE_IMAGE_LOAD_MEMBER(gameking_state::cart_load) if (size > 0x100000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 8493a40b9a5..82e2eeb6042 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -2391,7 +2391,7 @@ DEVICE_IMAGE_LOAD_MEMBER(quizwizc_state::cart_load) { if (!image.loaded_through_softlist()) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Can only load through softwarelist"); + image.seterror(image_error::UNSUPPORTED, "Can only load through softwarelist"); return image_init_result::FAIL; } @@ -2579,7 +2579,7 @@ DEVICE_IMAGE_LOAD_MEMBER(tc4_state::cart_load) { if (!image.loaded_through_softlist()) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Can only load through softwarelist"); + image.seterror(image_error::UNSUPPORTED, "Can only load through softwarelist"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/homelab.cpp b/src/mame/drivers/homelab.cpp index 3de88cb8ee7..8516773a6b2 100644 --- a/src/mame/drivers/homelab.cpp +++ b/src/mame/drivers/homelab.cpp @@ -683,7 +683,7 @@ QUICKLOAD_LOAD_MEMBER(homelab_state::quickload_cb) u8 ch = image.fgetc(); if (ch != 0xA5) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.seterror(image_error::INVALIDIMAGE, "Invalid header"); image.message(" Invalid header"); return image_init_result::FAIL; } @@ -692,7 +692,7 @@ QUICKLOAD_LOAD_MEMBER(homelab_state::quickload_cb) { if (i >= (std::size(pgmname) - 1)) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File name too long"); + image.seterror(image_error::INVALIDIMAGE, "File name too long"); image.message(" File name too long"); return image_init_result::FAIL; } @@ -706,7 +706,7 @@ QUICKLOAD_LOAD_MEMBER(homelab_state::quickload_cb) if (image.fread(args, sizeof(args)) != sizeof(args)) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file size"); + image.seterror(image_error::INVALIDIMAGE, "Unexpected EOF while getting file size"); image.message(" Unexpected EOF while getting file size"); return image_init_result::FAIL; } @@ -717,7 +717,7 @@ QUICKLOAD_LOAD_MEMBER(homelab_state::quickload_cb) if (quick_end > 0x7fff) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too large"); + image.seterror(image_error::INVALIDIMAGE, "File too large"); image.message(" File too large"); return image_init_result::FAIL; } @@ -732,7 +732,7 @@ QUICKLOAD_LOAD_MEMBER(homelab_state::quickload_cb) { char message[512]; snprintf(message, std::size(message), "%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); - image.seterror(IMAGE_ERROR_INVALIDIMAGE, message); + image.seterror(image_error::INVALIDIMAGE, message); image.message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); return image_init_result::FAIL; } diff --git a/src/mame/drivers/hx20.cpp b/src/mame/drivers/hx20.cpp index b877e8f86a7..708a7126bf1 100644 --- a/src/mame/drivers/hx20.cpp +++ b/src/mame/drivers/hx20.cpp @@ -835,7 +835,7 @@ DEVICE_IMAGE_LOAD_MEMBER(hx20_state::optrom_load) if (size != 0x2000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported ROM size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported ROM size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/ibmpcjr.cpp b/src/mame/drivers/ibmpcjr.cpp index 05d6714ac0a..38bf2f19424 100644 --- a/src/mame/drivers/ibmpcjr.cpp +++ b/src/mame/drivers/ibmpcjr.cpp @@ -467,7 +467,7 @@ image_init_result pcjr_state::load_cart(device_image_interface &image, generic_s header_size = 0x200; break; default: - image.seterror(IMAGE_ERROR_UNSUPPORTED, "Invalid header size" ); + image.seterror(image_error::INVALIDIMAGE, "Invalid header size"); return image_init_result::FAIL; } if (size - header_size == 0xa000) diff --git a/src/mame/drivers/instruct.cpp b/src/mame/drivers/instruct.cpp index 1f14360e37e..fd3f3b9622b 100644 --- a/src/mame/drivers/instruct.cpp +++ b/src/mame/drivers/instruct.cpp @@ -356,13 +356,13 @@ QUICKLOAD_LOAD_MEMBER(instruct_state::quickload_cb) quick_length = image.length(); if (quick_length < 0x0100) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.seterror(image_error::INVALIDIMAGE, "File too short"); image.message(" File too short"); } else if (quick_length > 0x8000) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.seterror(image_error::INVALIDIMAGE, "File too long"); image.message(" File too long"); } else @@ -371,12 +371,12 @@ QUICKLOAD_LOAD_MEMBER(instruct_state::quickload_cb) read_ = image.fread( &quick_data[0], quick_length); if (read_ != quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.seterror(image_error::INVALIDIMAGE, "Cannot read the file"); image.message(" Cannot read the file"); } else if (quick_data[0] != 0xc5) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.seterror(image_error::INVALIDIMAGE, "Invalid header"); image.message(" Invalid header"); } else @@ -385,7 +385,7 @@ QUICKLOAD_LOAD_MEMBER(instruct_state::quickload_cb) if (exec_addr >= quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.seterror(image_error::INVALIDIMAGE, "Exec address beyond end of file"); image.message(" Exec address beyond end of file"); } else diff --git a/src/mame/drivers/jtc.cpp b/src/mame/drivers/jtc.cpp index 506d620658d..9cfda169f3a 100644 --- a/src/mame/drivers/jtc.cpp +++ b/src/mame/drivers/jtc.cpp @@ -597,22 +597,22 @@ QUICKLOAD_LOAD_MEMBER(jtc_state::quickload_cb) { if (quick_length < 0x0088) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.seterror(image_error::INVALIDIMAGE, "File too short"); image.message(" File too short"); } else if (quick_length > 0x8000) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.seterror(image_error::INVALIDIMAGE, "File too long"); image.message(" File too long"); } else { quick_data.resize(quick_length+1); - u16 read_ = image.fread( &quick_data[0], quick_length); + u16 read_ = image.fread(&quick_data[0], quick_length); if (read_ != quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.seterror(image_error::INVALIDIMAGE, "Cannot read the file"); image.message(" Cannot read the file"); } else @@ -621,7 +621,7 @@ QUICKLOAD_LOAD_MEMBER(jtc_state::quickload_cb) quick_length = quick_data[0x14] * 256 + quick_data[0x13] - quick_addr + 0x81; if (image.length() != quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid file header"); + image.seterror(image_error::INVALIDIMAGE, "Invalid file header"); image.message(" Invalid file header"); } else @@ -643,7 +643,7 @@ QUICKLOAD_LOAD_MEMBER(jtc_state::quickload_cb) quick_addr = 0xe000; if (quick_length > 0x8000) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.seterror(image_error::INVALIDIMAGE, "File too long"); image.message(" File too long"); } else @@ -652,7 +652,7 @@ QUICKLOAD_LOAD_MEMBER(jtc_state::quickload_cb) u16 read_ = image.fread( &quick_data[0], quick_length); if (read_ != quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.seterror(image_error::INVALIDIMAGE, "Cannot read the file"); image.message(" Cannot read the file"); } else diff --git a/src/mame/drivers/jupace.cpp b/src/mame/drivers/jupace.cpp index 05fd4f0a850..a822f1448da 100644 --- a/src/mame/drivers/jupace.cpp +++ b/src/mame/drivers/jupace.cpp @@ -179,7 +179,7 @@ SNAPSHOT_LOAD_MEMBER(ace_state::snapshot_cb) if (m_ram->size() < 16*1024) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "At least 16KB RAM expansion required"); + image.seterror(image_error::INVALIDIMAGE, "At least 16KB RAM expansion required"); image.message("At least 16KB RAM expansion required"); return image_init_result::FAIL; } @@ -216,7 +216,7 @@ SNAPSHOT_LOAD_MEMBER(ace_state::snapshot_cb) if (!done) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "EOF marker not found"); + image.seterror(image_error::INVALIDIMAGE, "EOF marker not found"); image.message("EOF marker not found"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/ldplayer.cpp b/src/mame/drivers/ldplayer.cpp index e0d92cf5997..9afb99f9332 100644 --- a/src/mame/drivers/ldplayer.cpp +++ b/src/mame/drivers/ldplayer.cpp @@ -185,15 +185,15 @@ chd_file *ldplayer_state::get_disc() { // open the file itself via our search path emu_file image_file(machine().options().media_path(), OPEN_FLAG_READ); - osd_file::error filerr = image_file.open(dir->name); - if (filerr == osd_file::error::NONE) + std::error_condition filerr = image_file.open(dir->name); + if (!filerr) { std::string fullpath(image_file.fullpath()); image_file.close(); // try to open the CHD - if (machine().rom_load().set_disk_handle("laserdisc", fullpath.c_str()) == CHDERR_NONE) + if (!machine().rom_load().set_disk_handle("laserdisc", fullpath.c_str())) { m_filename.assign(dir->name); found = true; @@ -204,7 +204,8 @@ chd_file *ldplayer_state::get_disc() } // if we failed, pop a message and exit - if (found == false) { + if (!found) + { machine().ui().popup_time(10, "No valid image file found!\n"); return nullptr; } diff --git a/src/mame/drivers/lynx.cpp b/src/mame/drivers/lynx.cpp index 2d1c00e9dfc..68a5e89ebc8 100644 --- a/src/mame/drivers/lynx.cpp +++ b/src/mame/drivers/lynx.cpp @@ -170,7 +170,7 @@ QUICKLOAD_LOAD_MEMBER(lynx_state::quickload_cb) /* Check the image */ if (lynx_verify_cart((char*)header, LYNX_QUICKLOAD) != image_verify_result::PASS) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Not a valid Lynx file"); + image.seterror(image_error::INVALIDIMAGE, "Not a valid Lynx file"); return image_init_result::FAIL; } @@ -182,7 +182,7 @@ QUICKLOAD_LOAD_MEMBER(lynx_state::quickload_cb) if (image.fread( &data[0], length) != length) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid length in file header"); + image.seterror(image_error::INVALIDIMAGE, "Invalid length in file header"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/m68705prg.cpp b/src/mame/drivers/m68705prg.cpp index 0bd877b0cf2..5bb9359813c 100644 --- a/src/mame/drivers/m68705prg.cpp +++ b/src/mame/drivers/m68705prg.cpp @@ -67,7 +67,7 @@ protected: auto const actual(m_eprom_image->common_get_size("rom")); if (desired > actual) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported EPROM size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported EPROM size"); return image_init_result::FAIL; } else @@ -84,7 +84,7 @@ protected: auto const actual(m_mcu_image->common_get_size("rom")); if (desired != actual) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Incorrect internal MCU EPROM size"); + image.seterror(image_error::INVALIDIMAGE, "Incorrect internal MCU EPROM size"); return image_init_result::FAIL; } else diff --git a/src/mame/drivers/microvsn.cpp b/src/mame/drivers/microvsn.cpp index 4447ded8659..9d830012994 100644 --- a/src/mame/drivers/microvsn.cpp +++ b/src/mame/drivers/microvsn.cpp @@ -188,7 +188,7 @@ DEVICE_IMAGE_LOAD_MEMBER(microvision_state::cart_load) if (size != 0x400 && size != 0x800) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid ROM file size"); + image.seterror(image_error::INVALIDIMAGE, "Invalid ROM file size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/myvision.cpp b/src/mame/drivers/myvision.cpp index 801f2611239..4005ca42bcd 100644 --- a/src/mame/drivers/myvision.cpp +++ b/src/mame/drivers/myvision.cpp @@ -158,7 +158,7 @@ DEVICE_IMAGE_LOAD_MEMBER( myvision_state::cart_load ) if (size != 0x4000 && size != 0x6000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/nascom1.cpp b/src/mame/drivers/nascom1.cpp index 6f14e852191..040b84d54f1 100644 --- a/src/mame/drivers/nascom1.cpp +++ b/src/mame/drivers/nascom1.cpp @@ -367,7 +367,7 @@ SNAPSHOT_LOAD_MEMBER(nascom_state::snapshot_cb) } else { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported file format"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported file format"); return image_init_result::FAIL; } dummy = 0x00; @@ -392,7 +392,7 @@ image_init_result nascom2_state::load_cart(device_image_interface &image, generi { if (slot->length() > 0x1000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported file size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported file size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/ngp.cpp b/src/mame/drivers/ngp.cpp index c0e8e51e98d..4e045d22d9c 100644 --- a/src/mame/drivers/ngp.cpp +++ b/src/mame/drivers/ngp.cpp @@ -754,7 +754,7 @@ DEVICE_IMAGE_LOAD_MEMBER(ngp_state::load_ngp_cart) if (size != 0x8000 && size != 0x80000 && size != 0x100000 && size != 0x200000 && size != 0x400000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/pegasus.cpp b/src/mame/drivers/pegasus.cpp index 55eae153890..a8bd6934e77 100644 --- a/src/mame/drivers/pegasus.cpp +++ b/src/mame/drivers/pegasus.cpp @@ -427,7 +427,7 @@ image_init_result pegasus_state::load_cart(device_image_interface &image, generi if (size > 0x1000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } @@ -443,7 +443,7 @@ image_init_result pegasus_state::load_cart(device_image_interface &image, generi std::string errmsg = string_format( "Attempted to load a file that does not work in this socket.\n" "Please check \"Usage\" field in the software list for the correct socket(s) to use."); - image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str()); + image.seterror(image_error::INVALIDIMAGE, errmsg.c_str()); return image_init_result::FAIL; } } diff --git a/src/mame/drivers/phunsy.cpp b/src/mame/drivers/phunsy.cpp index fc5c5776fa5..25a260c9c5f 100644 --- a/src/mame/drivers/phunsy.cpp +++ b/src/mame/drivers/phunsy.cpp @@ -291,7 +291,7 @@ QUICKLOAD_LOAD_MEMBER(phunsy_state::quickload_cb) int quick_length = image.length(); if (quick_length > 0x4000) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.seterror(image_error::INVALIDIMAGE, "File too long"); image.message(" File too long"); } else diff --git a/src/mame/drivers/pipbug.cpp b/src/mame/drivers/pipbug.cpp index dee8696c1b1..a7214dbb094 100644 --- a/src/mame/drivers/pipbug.cpp +++ b/src/mame/drivers/pipbug.cpp @@ -160,12 +160,12 @@ QUICKLOAD_LOAD_MEMBER(pipbug_state::quickload_cb) quick_length = image.length(); if (quick_length < 0x0444) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.seterror(image_error::INVALIDIMAGE, "File too short"); image.message(" File too short"); } else if (quick_length > 0x8000) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.seterror(image_error::INVALIDIMAGE, "File too long"); image.message(" File too long"); } else @@ -174,12 +174,12 @@ QUICKLOAD_LOAD_MEMBER(pipbug_state::quickload_cb) read_ = image.fread( &quick_data[0], quick_length); if (read_ != quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.seterror(image_error::INVALIDIMAGE, "Cannot read the file"); image.message(" Cannot read the file"); } else if (quick_data[0] != 0xc4) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.seterror(image_error::INVALIDIMAGE, "Invalid header"); image.message(" Invalid header"); } else @@ -188,7 +188,7 @@ QUICKLOAD_LOAD_MEMBER(pipbug_state::quickload_cb) if (exec_addr >= quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.seterror(image_error::INVALIDIMAGE, "Exec address beyond end of file"); image.message(" Exec address beyond end of file"); } else diff --git a/src/mame/drivers/pokemini.cpp b/src/mame/drivers/pokemini.cpp index d99f74beb14..297b491228b 100644 --- a/src/mame/drivers/pokemini.cpp +++ b/src/mame/drivers/pokemini.cpp @@ -1516,14 +1516,14 @@ DEVICE_IMAGE_LOAD_MEMBER( pokemini_state::cart_load ) /* Verify that the image is big enough */ if (size <= 0x2100) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid ROM image: ROM image is too small"); + image.seterror(image_error::INVALIDIMAGE, "Invalid ROM image: ROM image is too small"); return image_init_result::FAIL; } /* Verify that the image is not too big */ if (size > 0x1fffff) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid ROM image: ROM image is too big"); + image.seterror(image_error::INVALIDIMAGE, "Invalid ROM image: ROM image is too big"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/pv1000.cpp b/src/mame/drivers/pv1000.cpp index 63b19c16975..f3dcef31f94 100644 --- a/src/mame/drivers/pv1000.cpp +++ b/src/mame/drivers/pv1000.cpp @@ -307,7 +307,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pv1000_state::cart_load ) if (size != 0x2000 && size != 0x4000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/pv2000.cpp b/src/mame/drivers/pv2000.cpp index d3080bfffc3..eefb89a8b02 100644 --- a/src/mame/drivers/pv2000.cpp +++ b/src/mame/drivers/pv2000.cpp @@ -373,7 +373,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pv2000_state::cart_load ) if (size != 0x2000 && size != 0x4000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/ravens.cpp b/src/mame/drivers/ravens.cpp index a557347644a..41171b74b79 100644 --- a/src/mame/drivers/ravens.cpp +++ b/src/mame/drivers/ravens.cpp @@ -322,12 +322,12 @@ QUICKLOAD_LOAD_MEMBER(ravens_base::quickload_cb) quick_length = image.length(); if (quick_length < 0x0900) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.seterror(image_error::INVALIDIMAGE, "File too short"); image.message(" File too short"); } else if (quick_length > 0x8000) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.seterror(image_error::INVALIDIMAGE, "File too long"); image.message(" File too long"); } else @@ -336,12 +336,12 @@ QUICKLOAD_LOAD_MEMBER(ravens_base::quickload_cb) read_ = image.fread( &quick_data[0], quick_length); if (read_ != quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.seterror(image_error::INVALIDIMAGE, "Cannot read the file"); image.message(" Cannot read the file"); } else if (quick_data[0] != 0xc6) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.seterror(image_error::INVALIDIMAGE, "Invalid header"); image.message(" Invalid header"); } else @@ -350,7 +350,7 @@ QUICKLOAD_LOAD_MEMBER(ravens_base::quickload_cb) if (exec_addr >= quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.seterror(image_error::INVALIDIMAGE, "Exec address beyond end of file"); image.message(" Exec address beyond end of file"); } else diff --git a/src/mame/drivers/roland_cm32p.cpp b/src/mame/drivers/roland_cm32p.cpp index e26027acef2..cefe4efe729 100644 --- a/src/mame/drivers/roland_cm32p.cpp +++ b/src/mame/drivers/roland_cm32p.cpp @@ -398,7 +398,7 @@ DEVICE_IMAGE_LOAD_MEMBER(cm32p_state::card_load) uint32_t size = pcmcard->common_get_size("rom"); if (size > 0x080000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size: Only up to 512K is supported"); + image.seterror(image_error::INVALIDIMAGE, "Invalid size: Only up to 512K is supported"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/rx78.cpp b/src/mame/drivers/rx78.cpp index b7b3075130a..77696012e17 100644 --- a/src/mame/drivers/rx78.cpp +++ b/src/mame/drivers/rx78.cpp @@ -489,7 +489,7 @@ DEVICE_IMAGE_LOAD_MEMBER( rx78_state::cart_load ) if (size != 0x2000 && size != 0x4000 && size != 0x8000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/sag.cpp b/src/mame/drivers/sag.cpp index 9a530c24bfd..8799ba83bb8 100644 --- a/src/mame/drivers/sag.cpp +++ b/src/mame/drivers/sag.cpp @@ -112,7 +112,7 @@ DEVICE_IMAGE_LOAD_MEMBER(sag_state::cart_load) if (size != 0x1000 && size != 0x1100 && size != 0x2000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid ROM file size"); + image.seterror(image_error::INVALIDIMAGE, "Invalid ROM file size"); return image_init_result::FAIL; } @@ -125,7 +125,7 @@ DEVICE_IMAGE_LOAD_MEMBER(sag_state::cart_load) // TMS1670 MCU if (!image.loaded_through_softlist()) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Can only load TMS1670 type through softwarelist"); + image.seterror(image_error::INVALIDIMAGE, "Can only load TMS1670 type through softwarelist"); return image_init_result::FAIL; } @@ -136,7 +136,7 @@ DEVICE_IMAGE_LOAD_MEMBER(sag_state::cart_load) size = image.get_software_region_length("rom:mpla"); if (size != 867) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid MPLA file size"); + image.seterror(image_error::INVALIDIMAGE, "Invalid MPLA file size"); return image_init_result::FAIL; } memcpy(memregion("tms1k_cpu:mpla")->base(), image.get_software_region("rom:mpla"), size); @@ -144,7 +144,7 @@ DEVICE_IMAGE_LOAD_MEMBER(sag_state::cart_load) size = image.get_software_region_length("rom:opla"); if (size != 557) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid OPLA file size"); + image.seterror(image_error::INVALIDIMAGE, "Invalid OPLA file size"); return image_init_result::FAIL; } memcpy(memregion("tms1k_cpu:opla")->base(), image.get_software_region("rom:opla"), size); diff --git a/src/mame/drivers/spg2xx_ican.cpp b/src/mame/drivers/spg2xx_ican.cpp index 0398e13935e..d346c9ad549 100644 --- a/src/mame/drivers/spg2xx_ican.cpp +++ b/src/mame/drivers/spg2xx_ican.cpp @@ -430,7 +430,7 @@ DEVICE_IMAGE_LOAD_MEMBER(icanguit_state::cart_load_icanguit) if (size < 0x800000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/spg2xx_smarttv.cpp b/src/mame/drivers/spg2xx_smarttv.cpp index 27f042d8a7a..bc315ae4a43 100644 --- a/src/mame/drivers/spg2xx_smarttv.cpp +++ b/src/mame/drivers/spg2xx_smarttv.cpp @@ -193,7 +193,7 @@ DEVICE_IMAGE_LOAD_MEMBER(smarttv_state::cart_load_smarttv) if (size > 0x800000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/spg2xx_telestory.cpp b/src/mame/drivers/spg2xx_telestory.cpp index 972cf1206fb..b8a0dd24411 100644 --- a/src/mame/drivers/spg2xx_telestory.cpp +++ b/src/mame/drivers/spg2xx_telestory.cpp @@ -257,7 +257,7 @@ DEVICE_IMAGE_LOAD_MEMBER(telestory_state::cart_load_telestory) if (size > 0x800000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/spg2xx_tvgogo.cpp b/src/mame/drivers/spg2xx_tvgogo.cpp index df0bc746d07..b1bf613e7d0 100644 --- a/src/mame/drivers/spg2xx_tvgogo.cpp +++ b/src/mame/drivers/spg2xx_tvgogo.cpp @@ -210,7 +210,7 @@ DEVICE_IMAGE_LOAD_MEMBER(tvgogo_state::cart_load_tvgogo) if (size > 0x800000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/spg2xx_vii.cpp b/src/mame/drivers/spg2xx_vii.cpp index ab86e434895..9ed30031233 100644 --- a/src/mame/drivers/spg2xx_vii.cpp +++ b/src/mame/drivers/spg2xx_vii.cpp @@ -153,7 +153,7 @@ DEVICE_IMAGE_LOAD_MEMBER(vii_state::cart_load_vii) if (size < 0x800000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/squale.cpp b/src/mame/drivers/squale.cpp index e0b7dce8e0b..018f9a12903 100644 --- a/src/mame/drivers/squale.cpp +++ b/src/mame/drivers/squale.cpp @@ -629,7 +629,7 @@ DEVICE_IMAGE_LOAD_MEMBER( squale_state::cart_load ) if ( ! size || size > 0x10000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/studio2.cpp b/src/mame/drivers/studio2.cpp index 44278fe4780..f51c62a7d79 100644 --- a/src/mame/drivers/studio2.cpp +++ b/src/mame/drivers/studio2.cpp @@ -604,7 +604,7 @@ DEVICE_IMAGE_LOAD_MEMBER( studio2_state::cart_load ) if (image.length() < 0x200) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid ROM file"); + image.seterror(image_error::INVALIDIMAGE, "Invalid ROM file"); return image_init_result::FAIL; } @@ -613,14 +613,14 @@ DEVICE_IMAGE_LOAD_MEMBER( studio2_state::cart_load ) // validate if (strncmp((const char *)header, "RCA2", 4)) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Not an .ST2 file"); + image.seterror(image_error::INVALIDIMAGE, "Not an .ST2 file"); return image_init_result::FAIL; } blocks = header[4]; if ((blocks < 2) || (blocks > 11)) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid .ST2 file"); + image.seterror(image_error::INVALIDIMAGE, "Invalid .ST2 file"); return image_init_result::FAIL; } @@ -654,7 +654,7 @@ DEVICE_IMAGE_LOAD_MEMBER( studio2_state::cart_load ) size = image.length(); if (size > 0x400) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } else diff --git a/src/mame/drivers/supracan.cpp b/src/mame/drivers/supracan.cpp index 9090c1c59de..524cfa70056 100644 --- a/src/mame/drivers/supracan.cpp +++ b/src/mame/drivers/supracan.cpp @@ -1922,7 +1922,7 @@ DEVICE_IMAGE_LOAD_MEMBER(supracan_state::cart_load) if (size > 0x400000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/sv8000.cpp b/src/mame/drivers/sv8000.cpp index d671302c563..5302f27a27e 100644 --- a/src/mame/drivers/sv8000.cpp +++ b/src/mame/drivers/sv8000.cpp @@ -207,7 +207,7 @@ DEVICE_IMAGE_LOAD_MEMBER( sv8000_state::cart_load ) if (size != 0x1000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Incorrect or not support cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Incorrect or not support cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/svision.cpp b/src/mame/drivers/svision.cpp index ce3e08c94b1..52cf9b295b7 100644 --- a/src/mame/drivers/svision.cpp +++ b/src/mame/drivers/svision.cpp @@ -449,7 +449,7 @@ DEVICE_IMAGE_LOAD_MEMBER( svision_state::cart_load ) if (size > 0x80000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/ti74.cpp b/src/mame/drivers/ti74.cpp index 3047da4e1b1..7d034c30ef1 100644 --- a/src/mame/drivers/ti74.cpp +++ b/src/mame/drivers/ti74.cpp @@ -148,7 +148,7 @@ DEVICE_IMAGE_LOAD_MEMBER(ti74_state::cart_load) // max size is 32KB if (size > 0x8000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); + image.seterror(image_error::INVALIDIMAGE, "Invalid file size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/timex.cpp b/src/mame/drivers/timex.cpp index a5bb629ca0f..70b3bfb824f 100644 --- a/src/mame/drivers/timex.cpp +++ b/src/mame/drivers/timex.cpp @@ -608,12 +608,12 @@ DEVICE_IMAGE_LOAD_MEMBER( ts2068_state::cart_load ) if (size % 0x2000 != 9) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "File corrupted"); + image.seterror(image_error::INVALIDIMAGE, "File corrupted"); return image_init_result::FAIL; } if (!image.loaded_through_softlist()) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Loading from softlist is not supported yet"); + image.seterror(image_error::UNSUPPORTED, "Loading from softlist is not supported yet"); return image_init_result::FAIL; } @@ -628,7 +628,7 @@ DEVICE_IMAGE_LOAD_MEMBER( ts2068_state::cart_load ) if (chunks_in_file * 0x2000 + 0x09 != size) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "File corrupted"); + image.seterror(image_error::INVALIDIMAGE, "File corrupted"); return image_init_result::FAIL; } @@ -652,7 +652,7 @@ DEVICE_IMAGE_LOAD_MEMBER( ts2068_state::cart_load ) break; default: - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cart type not supported"); + image.seterror(image_error::INVALIDIMAGE, "Cart type not supported"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index 707690af65a..b858d0e60c5 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -551,7 +551,7 @@ DEVICE_IMAGE_LOAD_MEMBER(tispeak_state::cart_load) if (size > m_cart_max_size) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); + image.seterror(image_error::INVALIDIMAGE, "Invalid file size"); return image_init_result::FAIL; } diff --git a/src/mame/drivers/vc4000.cpp b/src/mame/drivers/vc4000.cpp index b3c8427ed8d..bace6ae8ab2 100644 --- a/src/mame/drivers/vc4000.cpp +++ b/src/mame/drivers/vc4000.cpp @@ -410,7 +410,7 @@ QUICKLOAD_LOAD_MEMBER(vc4000_state::quickload_cb) read_ = image.fread( &quick_data[0], quick_length); if (read_ != quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.seterror(image_error::INVALIDIMAGE, "Cannot read the file"); image.message(" Cannot read the file"); } else @@ -419,7 +419,7 @@ QUICKLOAD_LOAD_MEMBER(vc4000_state::quickload_cb) { if (quick_data[0] != 2) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.seterror(image_error::INVALIDIMAGE, "Invalid header"); image.message(" Invalid header"); } else @@ -429,13 +429,13 @@ QUICKLOAD_LOAD_MEMBER(vc4000_state::quickload_cb) if (quick_length < 0x5) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.seterror(image_error::INVALIDIMAGE, "File too short"); image.message(" File too short"); } else if ((quick_length + quick_addr - 5) > 0x1600) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.seterror(image_error::INVALIDIMAGE, "File too long"); image.message(" File too long"); } else @@ -460,7 +460,7 @@ QUICKLOAD_LOAD_MEMBER(vc4000_state::quickload_cb) { if (quick_data[0] != 0) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.seterror(image_error::INVALIDIMAGE, "Invalid header"); image.message(" Invalid header"); } else @@ -469,19 +469,19 @@ QUICKLOAD_LOAD_MEMBER(vc4000_state::quickload_cb) if (exec_addr >= quick_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.seterror(image_error::INVALIDIMAGE, "Exec address beyond end of file"); image.message(" Exec address beyond end of file"); } else if (quick_length < 0x904) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.seterror(image_error::INVALIDIMAGE, "File too short"); image.message(" File too short"); } else if (quick_length > 0x2000) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.seterror(image_error::INVALIDIMAGE, "File too long"); image.message(" File too long"); } else diff --git a/src/mame/drivers/vtech1.cpp b/src/mame/drivers/vtech1.cpp index 101f3b4a214..029c7417461 100644 --- a/src/mame/drivers/vtech1.cpp +++ b/src/mame/drivers/vtech1.cpp @@ -184,7 +184,7 @@ SNAPSHOT_LOAD_MEMBER(vtech1_base_state::snapshot_cb) // verify if (space.read_byte(addr) != to_write) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Insufficient RAM to load snapshot"); + image.seterror(image_error::INVALIDIMAGE, "Insufficient RAM to load snapshot"); image.message("Insufficient RAM to load snapshot (%d bytes needed) [%s]", size, pgmname); return image_init_result::FAIL; @@ -214,7 +214,7 @@ SNAPSHOT_LOAD_MEMBER(vtech1_base_state::snapshot_cb) break; default: - image.seterror(IMAGE_ERROR_UNSUPPORTED, "Snapshot format not supported."); + image.seterror(image_error::INVALIDIMAGE, "Snapshot format not supported."); image.message("Snapshot format not supported."); return image_init_result::FAIL; } diff --git a/src/mame/drivers/x07.cpp b/src/mame/drivers/x07.cpp index f103a68e766..dcd9bb93ea1 100644 --- a/src/mame/drivers/x07.cpp +++ b/src/mame/drivers/x07.cpp @@ -1063,7 +1063,7 @@ DEVICE_IMAGE_LOAD_MEMBER( x07_state::card_load ) if (strcmp(card_type, "xp140")) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported card type"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported card type"); return image_init_result::FAIL; } } diff --git a/src/mame/drivers/z1013.cpp b/src/mame/drivers/z1013.cpp index dd938204e1a..4cb97de983e 100644 --- a/src/mame/drivers/z1013.cpp +++ b/src/mame/drivers/z1013.cpp @@ -380,7 +380,7 @@ SNAPSHOT_LOAD_MEMBER(z1013_state::snapshot_cb) { } else { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Not a Z1013 image"); + image.seterror(image_error::INVALIDIMAGE, "Not a Z1013 image"); image.message(" Not a Z1013 image"); return image_init_result::FAIL; } @@ -392,7 +392,7 @@ SNAPSHOT_LOAD_MEMBER(z1013_state::snapshot_cb) m_maincpu->set_state_int(Z80_PC, runaddr); else { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Loaded but cannot run"); + image.seterror(image_error::INVALIDIMAGE, "Loaded but cannot run"); image.message(" Loaded but cannot run"); } diff --git a/src/mame/machine/amstrad.cpp b/src/mame/machine/amstrad.cpp index c8b37acd746..f32b13830c1 100644 --- a/src/mame/machine/amstrad.cpp +++ b/src/mame/machine/amstrad.cpp @@ -3315,7 +3315,7 @@ DEVICE_IMAGE_LOAD_MEMBER(amstrad_state::amstrad_plus_cartridge) logerror("IMG: raw CPC+ cartridge file\n"); if (size % 0x4000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Attempt to load a raw binary with some block smaller than 16kB in size"); + image.seterror(image_error::INVALIDIMAGE, "Attempt to load a raw binary with some block smaller than 16kB in size"); return image_init_result::FAIL; } else @@ -3346,7 +3346,7 @@ DEVICE_IMAGE_LOAD_MEMBER(amstrad_state::amstrad_plus_cartridge) // Is RIFF format (*.cpr) if (strncmp((char*)(header + 8), "AMS!", 4) != 0) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Not an Amstrad CPC cartridge image (despite RIFF header)"); + image.seterror(image_error::INVALIDIMAGE, "Not an Amstrad CPC cartridge image (despite RIFF header)"); return image_init_result::FAIL; } diff --git a/src/mame/machine/electron.cpp b/src/mame/machine/electron.cpp index ac6b9df4dc4..464f4f7a0da 100644 --- a/src/mame/machine/electron.cpp +++ b/src/mame/machine/electron.cpp @@ -654,7 +654,7 @@ image_init_result electronsp_state::load_rom(device_image_interface &image, gene // socket accepts 8K and 16K ROM only if (size != 0x2000 && size != 0x4000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size: Only 8K/16K is supported"); + image.seterror(image_error::INVALIDIMAGE, "Invalid size: Only 8K/16K is supported"); return image_init_result::FAIL; } diff --git a/src/mame/machine/gamecom.cpp b/src/mame/machine/gamecom.cpp index 94ce240f443..727f4f8e8ab 100644 --- a/src/mame/machine/gamecom.cpp +++ b/src/mame/machine/gamecom.cpp @@ -627,7 +627,7 @@ image_init_result gamecom_state::common_load(device_image_interface &image, gene if (size != 0x008000 && size != 0x040000 && size != 0x080000 && size != 0x100000 && size != 0x1c0000 && size != 0x200000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } diff --git a/src/mame/machine/m1comm.cpp b/src/mame/machine/m1comm.cpp index e43d5251845..64e763e41f7 100644 --- a/src/mame/machine/m1comm.cpp +++ b/src/mame/machine/m1comm.cpp @@ -560,7 +560,7 @@ int m1comm_device::read_frame(int dataSize) // try to read a message std::uint32_t recv = 0; - osd_file::error filerr = m_line_rx->read(m_buffer0, 0, dataSize, recv); + std::error_condition filerr = m_line_rx->read(m_buffer0, 0, dataSize, recv); if (recv > 0) { // check if message complete @@ -581,14 +581,14 @@ int m1comm_device::read_frame(int dataSize) togo -= recv; offset += recv; } - else if (filerr == osd_file::error::NONE && recv == 0) + else if (!filerr && recv == 0) { togo = 0; } } } } - else if (filerr == osd_file::error::NONE && recv == 0) + else if (!filerr && recv == 0) { if (m_linkalive == 0x01) { @@ -619,11 +619,11 @@ void m1comm_device::send_frame(int dataSize){ if (!m_line_tx) return; - osd_file::error filerr; + std::error_condition filerr; std::uint32_t written; filerr = m_line_tx->write(&m_buffer0, 0, dataSize, written); - if (filerr != osd_file::error::NONE) + if (filerr) { if (m_linkalive == 0x01) { diff --git a/src/mame/machine/m2comm.cpp b/src/mame/machine/m2comm.cpp index 4008cd9fd3f..dd25325f6f6 100644 --- a/src/mame/machine/m2comm.cpp +++ b/src/mame/machine/m2comm.cpp @@ -632,7 +632,7 @@ int m2comm_device::read_frame(int dataSize) // try to read a message std::uint32_t recv = 0; - osd_file::error filerr = m_line_rx->read(m_buffer0, 0, dataSize, recv); + std::error_condition filerr = m_line_rx->read(m_buffer0, 0, dataSize, recv); if (recv > 0) { // check if message complete @@ -653,14 +653,14 @@ int m2comm_device::read_frame(int dataSize) togo -= recv; offset += recv; } - else if (filerr == osd_file::error::NONE && recv == 0) + else if (!filerr && recv == 0) { togo = 0; } } } } - else if (filerr == osd_file::error::NONE && recv == 0) + else if (!filerr && recv == 0) { if (m_linkalive == 0x01) { @@ -687,11 +687,11 @@ void m2comm_device::send_frame(int dataSize){ if (!m_line_tx) return; - osd_file::error filerr; + std::error_condition filerr; std::uint32_t written; filerr = m_line_tx->write(&m_buffer0, 0, dataSize, written); - if (filerr != osd_file::error::NONE) + if (filerr) { if (m_linkalive == 0x01) { diff --git a/src/mame/machine/mbee.cpp b/src/mame/machine/mbee.cpp index a70c470c445..c6a9ec55763 100644 --- a/src/mame/machine/mbee.cpp +++ b/src/mame/machine/mbee.cpp @@ -731,7 +731,7 @@ image_init_result mbee_state::load_cart(device_image_interface &image, generic_s // "mbp" roms if ((size == 0) || (size > 0x4000)) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported ROM size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported ROM size"); return image_init_result::FAIL; } @@ -744,7 +744,7 @@ image_init_result mbee_state::load_cart(device_image_interface &image, generic_s logerror ("Rom header = %02X %02X %02X\n", slot->read_rom(0), slot->read_rom(1), slot->read_rom(2)); if ((slot->read_rom(0) != 0xc3) || ((slot->read_rom(2) & 0xe0) != 0xc0)) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Not a PAK rom"); + image.seterror(image_error::INVALIDIMAGE, "Not a PAK rom"); slot->call_unload(); return image_init_result::FAIL; } @@ -754,7 +754,7 @@ image_init_result mbee_state::load_cart(device_image_interface &image, generic_s // "mbn" roms if ((size == 0) || (size > 0x2000)) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported ROM size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported ROM size"); return image_init_result::FAIL; } m_pak_extended[pak_index] = (size > 0x1000) ? true : false; @@ -768,7 +768,7 @@ image_init_result mbee_state::load_cart(device_image_interface &image, generic_s { if ((slot->read_rom(0) != 0xc3) || ((slot->read_rom(2) & 0xf0) != 0xe0)) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Not a NET rom"); + image.seterror(image_error::INVALIDIMAGE, "Not a NET rom"); slot->call_unload(); return image_init_result::FAIL; } diff --git a/src/mame/machine/mtx.cpp b/src/mame/machine/mtx.cpp index 8c0c086aab0..3cccaa3d7bf 100644 --- a/src/mame/machine/mtx.cpp +++ b/src/mame/machine/mtx.cpp @@ -397,7 +397,7 @@ DEVICE_IMAGE_LOAD_MEMBER( mtx_state::extrom_load ) if (size > 0x80000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported rom size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported rom size"); return image_init_result::FAIL; } @@ -417,7 +417,7 @@ DEVICE_IMAGE_LOAD_MEMBER( mtx_state::rompak_load ) if (size > 0x2000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(image_error::INVALIDIMAGE, "Unsupported cartridge size"); return image_init_result::FAIL; } @@ -441,7 +441,7 @@ SNAPSHOT_LOAD_MEMBER(mtx_state::snapshot_cb) // verify first byte if (data[0] != 0xff) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, nullptr); + image.seterror(image_error::INVALIDIMAGE, nullptr); return image_init_result::FAIL; } @@ -488,7 +488,7 @@ QUICKLOAD_LOAD_MEMBER(mtx_state::quickload_cb) if (image.length() < 4) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.seterror(image_error::INVALIDIMAGE, "File too short"); return image_init_result::FAIL; } @@ -497,13 +497,13 @@ QUICKLOAD_LOAD_MEMBER(mtx_state::quickload_cb) if (image.length() < code_length) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.seterror(image_error::INVALIDIMAGE, "File too short"); return image_init_result::FAIL; } if (code_base < 0x4000 || (code_base + code_length) >= 0x10000) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid code base and length"); + image.seterror(image_error::INVALIDIMAGE, "Invalid code base and length"); return image_init_result::FAIL; } diff --git a/src/mame/machine/s32comm.cpp b/src/mame/machine/s32comm.cpp index b53448b46d3..420b7d54471 100644 --- a/src/mame/machine/s32comm.cpp +++ b/src/mame/machine/s32comm.cpp @@ -266,7 +266,7 @@ int s32comm_device::read_frame(int dataSize) // try to read a message std::uint32_t recv = 0; - osd_file::error filerr = m_line_rx->read(m_buffer0, 0, dataSize, recv); + std::error_condition filerr = m_line_rx->read(m_buffer0, 0, dataSize, recv); if (recv > 0) { // check if message complete @@ -287,14 +287,14 @@ int s32comm_device::read_frame(int dataSize) togo -= recv; offset += recv; } - else if (filerr == osd_file::error::NONE && recv == 0) + else if (!filerr && recv == 0) { togo = 0; } } } } - else if (filerr == osd_file::error::NONE && recv == 0) + else if (!filerr && recv == 0) { if (m_linkalive == 0x01) { @@ -322,11 +322,11 @@ void s32comm_device::send_frame(int dataSize){ if (!m_line_tx) return; - osd_file::error filerr; + std::error_condition filerr; std::uint32_t written; filerr = m_line_tx->write(&m_buffer0, 0, dataSize, written); - if (filerr != osd_file::error::NONE) + if (filerr) { if (m_linkalive == 0x01) { diff --git a/src/mame/machine/sorcerer.cpp b/src/mame/machine/sorcerer.cpp index d4eac2ac17d..84a696c1040 100644 --- a/src/mame/machine/sorcerer.cpp +++ b/src/mame/machine/sorcerer.cpp @@ -600,7 +600,7 @@ QUICKLOAD_LOAD_MEMBER(sorcerer_state::quickload_cb) // check size if (image.length() != 0x1001c) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Snapshot must be 65564 bytes"); + image.seterror(image_error::INVALIDIMAGE, "Snapshot must be 65564 bytes"); image.message("Snapshot must be 65564 bytes"); return image_init_result::FAIL; } diff --git a/src/mame/machine/thomson.cpp b/src/mame/machine/thomson.cpp index 16afac21ceb..f8201ded8da 100644 --- a/src/mame/machine/thomson.cpp +++ b/src/mame/machine/thomson.cpp @@ -281,7 +281,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::to7_cartridge ) m_thom_cart_nb_banks = 4; else { - image.seterror(IMAGE_ERROR_UNSUPPORTED, string_format("Invalid cartridge size %u", size).c_str()); + image.seterror(image_error::INVALIDIMAGE, string_format("Invalid cartridge size %u", size).c_str()); return image_init_result::FAIL; } @@ -289,7 +289,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::to7_cartridge ) { if ( image.fread( pos, size ) != size ) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Read error"); + image.seterror(image_error::INVALIDIMAGE, "Read error"); return image_init_result::FAIL; } } @@ -1389,7 +1389,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::mo5_cartridge ) m_thom_cart_nb_banks = 4; else { - image.seterror(IMAGE_ERROR_UNSUPPORTED, string_format("Invalid cartridge size %d", size).c_str()); + image.seterror(image_error::INVALIDIMAGE, string_format("Invalid cartridge size %d", size).c_str()); return image_init_result::FAIL; } @@ -1397,7 +1397,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::mo5_cartridge ) { if ( image.fread(pos, size ) != size ) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Read error"); + image.seterror(image_error::INVALIDIMAGE, "Read error"); return image_init_result::FAIL; } } diff --git a/src/mame/machine/vtech2.cpp b/src/mame/machine/vtech2.cpp index 3ac1e62ce3f..0e8a2bea126 100644 --- a/src/mame/machine/vtech2.cpp +++ b/src/mame/machine/vtech2.cpp @@ -54,7 +54,7 @@ DEVICE_IMAGE_LOAD_MEMBER( vtech2_state::cart_load ) if (m_cart_size > 0x10000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cartridge bigger than 64k"); + image.seterror(image_error::INVALIDIMAGE, "Cartridge bigger than 64k"); m_cart_size = 0; return image_init_result::FAIL; } diff --git a/src/mame/machine/z80bin.cpp b/src/mame/machine/z80bin.cpp index ba24d545d1f..c14cf196819 100644 --- a/src/mame/machine/z80bin.cpp +++ b/src/mame/machine/z80bin.cpp @@ -23,7 +23,7 @@ image_init_result z80bin_load_file(device_image_interface &image, address_space { if (ch == EOF) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file name"); + image.seterror(image_error::INVALIDIMAGE, "Unexpected EOF while getting file name"); image.message(" Unexpected EOF while getting file name"); return image_init_result::FAIL; } @@ -32,7 +32,7 @@ image_init_result z80bin_load_file(device_image_interface &image, address_space { if (i >= (std::size(pgmname) - 1)) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File name too long"); + image.seterror(image_error::INVALIDIMAGE, "File name too long"); image.message(" File name too long"); return image_init_result::FAIL; } @@ -46,7 +46,7 @@ image_init_result z80bin_load_file(device_image_interface &image, address_space if (image.fread(args, sizeof(args)) != sizeof(args)) { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file size"); + image.seterror(image_error::INVALIDIMAGE, "Unexpected EOF while getting file size"); image.message(" Unexpected EOF while getting file size"); return image_init_result::FAIL; } @@ -66,7 +66,7 @@ image_init_result z80bin_load_file(device_image_interface &image, address_space if (image.fread(&data, 1) != 1) { snprintf(message, std::size(message), "%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); - image.seterror(IMAGE_ERROR_INVALIDIMAGE, message); + image.seterror(image_error::INVALIDIMAGE, message); image.message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); return image_init_result::FAIL; } diff --git a/src/mame/video/midtunit.cpp b/src/mame/video/midtunit.cpp index 4a74af2b188..7301e883fb6 100644 --- a/src/mame/video/midtunit.cpp +++ b/src/mame/video/midtunit.cpp @@ -902,7 +902,7 @@ void midtunit_video_device::log_bitmap(int command, int bpp, bool Skip) char name_buf[256]; snprintf(name_buf, 255, "0x%08x.png", raw_offset); auto const filerr = file.open(name_buf); - if (filerr != osd_file::error::NONE) + if (filerr) { return; } @@ -1029,7 +1029,7 @@ void midtunit_video_device::log_bitmap(int command, int bpp, bool Skip) snprintf(name_buf, 255, "0x%08x.json", raw_offset); auto const jsonerr = json.open(name_buf); - if (jsonerr != osd_file::error::NONE) + if (jsonerr) { return; } |