summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2021-01-05 15:03:38 -0500
committer AJR <ajrhacker@users.noreply.github.com>2021-01-05 15:04:11 -0500
commitb75fade787cac00a6377052f40ecf0c84b9d4ceb (patch)
tree6cc32f7a78531ac03fed78a15ab8656b9c9700fc
parent17f0286d737f33a7b92aeeb1891865fb896487bc (diff)
Simplify snapshot/quickload callback parameters; remove some uses of auto_alloc_array
-rw-r--r--src/devices/imagedev/snapquik.cpp2
-rw-r--r--src/devices/imagedev/snapquik.h6
-rw-r--r--src/mame/drivers/abc80.cpp4
-rw-r--r--src/mame/drivers/abc80x.cpp4
-rw-r--r--src/mame/drivers/altos5.cpp3
-rw-r--r--src/mame/drivers/aussiebyte.cpp3
-rw-r--r--src/mame/drivers/c128.cpp2
-rw-r--r--src/mame/drivers/c64.cpp2
-rw-r--r--src/mame/drivers/cbm2.cpp4
-rw-r--r--src/mame/drivers/dmv.cpp3
-rw-r--r--src/mame/drivers/einstein.cpp3
-rw-r--r--src/mame/drivers/iris3130.cpp4
-rw-r--r--src/mame/drivers/jaguar.cpp4
-rw-r--r--src/mame/drivers/pet.cpp2
-rw-r--r--src/mame/drivers/plus4.cpp2
-rw-r--r--src/mame/drivers/psx.cpp4
-rw-r--r--src/mame/drivers/qx10.cpp3
-rw-r--r--src/mame/drivers/smc777.cpp3
-rw-r--r--src/mame/drivers/vgmplay.cpp6
-rw-r--r--src/mame/drivers/vic20.cpp2
-rw-r--r--src/mame/drivers/vtech1.cpp2
-rw-r--r--src/mame/drivers/xerox820.cpp3
-rw-r--r--src/mame/drivers/z1013.cpp6
-rw-r--r--src/mame/includes/jaguar.h2
-rw-r--r--src/mame/machine/amstrad.cpp8
-rw-r--r--src/mame/machine/cbm_snqk.cpp15
-rw-r--r--src/mame/machine/cbm_snqk.h2
-rw-r--r--src/mame/machine/galaxy.cpp9
-rw-r--r--src/mame/machine/kaypro.cpp3
-rw-r--r--src/mame/machine/lviv.cpp2
-rw-r--r--src/mame/machine/mbee.cpp3
-rw-r--r--src/mame/machine/microtan.cpp10
-rw-r--r--src/mame/machine/mtx.cpp6
-rw-r--r--src/mame/machine/poly88.cpp7
-rw-r--r--src/mame/machine/primo.cpp7
-rw-r--r--src/mame/machine/sorcerer.cpp4
-rw-r--r--src/mame/machine/spec_snqk.cpp28
-rw-r--r--src/mame/machine/super80.cpp2
-rw-r--r--src/mame/machine/ti85.cpp8
-rw-r--r--src/mame/machine/z80bin.cpp38
-rw-r--r--src/mame/machine/z80bin.h2
41 files changed, 119 insertions, 114 deletions
diff --git a/src/devices/imagedev/snapquik.cpp b/src/devices/imagedev/snapquik.cpp
index 4cc0e8b6491..4ac355f6cf4 100644
--- a/src/devices/imagedev/snapquik.cpp
+++ b/src/devices/imagedev/snapquik.cpp
@@ -48,7 +48,7 @@ snapshot_image_device::~snapshot_image_device()
TIMER_CALLBACK_MEMBER(snapshot_image_device::process_snapshot_or_quickload)
{
/* invoke the load */
- m_load(*this, filetype().c_str(), length());
+ m_load(*this);
}
//-------------------------------------------------
diff --git a/src/devices/imagedev/snapquik.h b/src/devices/imagedev/snapquik.h
index 0566e63752b..c51e464ed7e 100644
--- a/src/devices/imagedev/snapquik.h
+++ b/src/devices/imagedev/snapquik.h
@@ -20,7 +20,7 @@ class snapshot_image_device : public device_t,
public device_image_interface
{
public:
- typedef device_delegate<image_init_result (device_image_interface &, const char *, int)> load_delegate;
+ typedef device_delegate<image_init_result (device_image_interface &)> load_delegate;
// construction/destruction
snapshot_image_device(const machine_config &mconfig, const char *tag, device_t *owner, const char* extensions, attotime delay = attotime::zero)
@@ -94,10 +94,10 @@ DECLARE_DEVICE_TYPE(QUICKLOAD, quickload_image_device)
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
-#define SNAPSHOT_LOAD_MEMBER(_name) image_init_result _name(device_image_interface &image, const char *file_type, int snapshot_size)
+#define SNAPSHOT_LOAD_MEMBER(_name) image_init_result _name(device_image_interface &image)
#define DECLARE_SNAPSHOT_LOAD_MEMBER(_name) SNAPSHOT_LOAD_MEMBER(_name)
-#define QUICKLOAD_LOAD_MEMBER(_name) image_init_result _name(device_image_interface &image, const char *file_type, int quickload_size)
+#define QUICKLOAD_LOAD_MEMBER(_name) image_init_result _name(device_image_interface &image)
#define DECLARE_QUICKLOAD_LOAD_MEMBER(_name) QUICKLOAD_LOAD_MEMBER(_name)
#endif // MAME_DEVICES_IMAGEDEV_SNAPQUIK_H
diff --git a/src/mame/drivers/abc80.cpp b/src/mame/drivers/abc80.cpp
index c63a7c329d2..7272538c429 100644
--- a/src/mame/drivers/abc80.cpp
+++ b/src/mame/drivers/abc80.cpp
@@ -462,8 +462,8 @@ QUICKLOAD_LOAD_MEMBER(abc80_state::quickload_cb)
offs_t address = space.read_byte(BOFA + 1) << 8 | space.read_byte(BOFA);
if (LOG) logerror("BOFA %04x\n",address);
- std::vector<u8> data;
- data.resize(quickload_size);
+ int quickload_size = image.length();
+ std::vector<u8> data(quickload_size);
image.fread(&data[0], quickload_size);
for (int i = 1; i < quickload_size; i++)
space.write_byte(address++, data[i]);
diff --git a/src/mame/drivers/abc80x.cpp b/src/mame/drivers/abc80x.cpp
index dcac4e7164b..d61631795f6 100644
--- a/src/mame/drivers/abc80x.cpp
+++ b/src/mame/drivers/abc80x.cpp
@@ -971,8 +971,8 @@ QUICKLOAD_LOAD_MEMBER(abc800_state::quickload_cb)
{
address_space &space = m_maincpu->space(AS_PROGRAM);
- std::vector<uint8_t> data;
- data.resize(quickload_size);
+ size_t quickload_size = image.length();
+ std::vector<uint8_t> data(quickload_size);
image.fread(&data[0], quickload_size);
uint8_t prstat = data[2];
diff --git a/src/mame/drivers/altos5.cpp b/src/mame/drivers/altos5.cpp
index fdd74c31a5b..91b39ef75c5 100644
--- a/src/mame/drivers/altos5.cpp
+++ b/src/mame/drivers/altos5.cpp
@@ -301,7 +301,7 @@ QUICKLOAD_LOAD_MEMBER(altos5_state::quickload_cb)
{
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
- if (quickload_size >= 0xfd00)
+ if (image.length() >= 0xfd00)
return image_init_result::FAIL;
setup_banks(2);
@@ -314,6 +314,7 @@ QUICKLOAD_LOAD_MEMBER(altos5_state::quickload_cb)
}
/* Load image to the TPA (Transient Program Area) */
+ uint16_t quickload_size = image.length();
for (uint16_t i = 0; i < quickload_size; i++)
{
uint8_t data;
diff --git a/src/mame/drivers/aussiebyte.cpp b/src/mame/drivers/aussiebyte.cpp
index f0b1502e1c9..e40b7cef423 100644
--- a/src/mame/drivers/aussiebyte.cpp
+++ b/src/mame/drivers/aussiebyte.cpp
@@ -406,7 +406,7 @@ QUICKLOAD_LOAD_MEMBER(aussiebyte_state::quickload_cb)
{
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
- if (quickload_size >= 0xfd00)
+ if (image.length() >= 0xfd00)
return image_init_result::FAIL;
/* RAM must be banked in */
@@ -423,6 +423,7 @@ QUICKLOAD_LOAD_MEMBER(aussiebyte_state::quickload_cb)
}
/* Load image to the TPA (Transient Program Area) */
+ u16 quickload_size = image.length();
for (u16 i = 0; i < quickload_size; i++)
{
u8 data;
diff --git a/src/mame/drivers/c128.cpp b/src/mame/drivers/c128.cpp
index 220740ba0d8..41022765674 100644
--- a/src/mame/drivers/c128.cpp
+++ b/src/mame/drivers/c128.cpp
@@ -275,7 +275,7 @@ enum
QUICKLOAD_LOAD_MEMBER(c128_state::quickload_c128)
{
- return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress);
+ return general_cbm_loadsnap(image, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress);
}
diff --git a/src/mame/drivers/c64.cpp b/src/mame/drivers/c64.cpp
index 9083442a636..dbaa50254f7 100644
--- a/src/mame/drivers/c64.cpp
+++ b/src/mame/drivers/c64.cpp
@@ -423,7 +423,7 @@ enum
QUICKLOAD_LOAD_MEMBER(c64_state::quickload_c64)
{
- return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress);
+ return general_cbm_loadsnap(image, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress);
}
diff --git a/src/mame/drivers/cbm2.cpp b/src/mame/drivers/cbm2.cpp
index 75d408303bf..f9f45d9e660 100644
--- a/src/mame/drivers/cbm2.cpp
+++ b/src/mame/drivers/cbm2.cpp
@@ -342,12 +342,12 @@ static void cbmb_quick_sethiaddress(address_space &space, uint16_t hiaddress)
QUICKLOAD_LOAD_MEMBER(cbm2_state::quickload_cbmb)
{
- return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0x10000, cbmb_quick_sethiaddress);
+ return general_cbm_loadsnap(image, m_maincpu->space(AS_PROGRAM), 0x10000, cbmb_quick_sethiaddress);
}
QUICKLOAD_LOAD_MEMBER(p500_state::quickload_p500)
{
- return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbmb_quick_sethiaddress);
+ return general_cbm_loadsnap(image, m_maincpu->space(AS_PROGRAM), 0, cbmb_quick_sethiaddress);
}
//**************************************************************************
diff --git a/src/mame/drivers/dmv.cpp b/src/mame/drivers/dmv.cpp
index ba0a6881739..99d6860ed85 100644
--- a/src/mame/drivers/dmv.cpp
+++ b/src/mame/drivers/dmv.cpp
@@ -400,10 +400,11 @@ QUICKLOAD_LOAD_MEMBER(dmv_state::quickload_cb)
if ((m_ram->base()[0] != 0xc3) || (m_ram->base()[5] != 0xc3))
return image_init_result::FAIL;
- if (quickload_size >= 0xfd00)
+ if (image.length() >= 0xfd00)
return image_init_result::FAIL;
/* Load image to the TPA (Transient Program Area) */
+ uint16_t quickload_size = image.length();
for (uint16_t i = 0; i < quickload_size; i++)
{
uint8_t data;
diff --git a/src/mame/drivers/einstein.cpp b/src/mame/drivers/einstein.cpp
index 34d3543a652..64e77ca0f7e 100644
--- a/src/mame/drivers/einstein.cpp
+++ b/src/mame/drivers/einstein.cpp
@@ -829,7 +829,7 @@ QUICKLOAD_LOAD_MEMBER(einstein_state::quickload_cb)
{
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
- if (quickload_size >= 0xfd00)
+ if (image.length() >= 0xfd00)
return image_init_result::FAIL;
/* disable rom */
@@ -837,6 +837,7 @@ QUICKLOAD_LOAD_MEMBER(einstein_state::quickload_cb)
m_bank1->set_entry(m_rom_enabled);
/* load image */
+ uint16_t quickload_size = image.length();
for (uint16_t i = 0; i < quickload_size; i++)
{
uint8_t data;
diff --git a/src/mame/drivers/iris3130.cpp b/src/mame/drivers/iris3130.cpp
index fdd4ce77e6e..38597e2d106 100644
--- a/src/mame/drivers/iris3130.cpp
+++ b/src/mame/drivers/iris3130.cpp
@@ -214,9 +214,9 @@ private:
QUICKLOAD_LOAD_MEMBER(iris3000_state::load_romboard)
{
- m_file_data.resize(quickload_size);
+ m_file_data.resize(image.length());
- if (!quickload_size || image.fread(&m_file_data[0], quickload_size) != quickload_size)
+ if (image.length() == 0 || image.fread(&m_file_data[0], image.length()) != image.length())
{
m_file_data.clear();
return image_init_result::FAIL;
diff --git a/src/mame/drivers/jaguar.cpp b/src/mame/drivers/jaguar.cpp
index 97b0387a115..f31d60b76b7 100644
--- a/src/mame/drivers/jaguar.cpp
+++ b/src/mame/drivers/jaguar.cpp
@@ -1908,12 +1908,12 @@ void jaguarcd_state::init_jaguarcd()
save_item(NAME(m_joystick_data));
}
-image_init_result jaguar_state::quickload_cb(device_image_interface &image, const char *file_type, int quickload_size)
+image_init_result jaguar_state::quickload_cb(device_image_interface &image)
{
offs_t quickload_begin = 0x4000, start = quickload_begin, skip = 0;
memset(m_shared_ram, 0, 0x200000);
- quickload_size = std::min(quickload_size, int(0x200000 - quickload_begin));
+ offs_t quickload_size = std::min(offs_t(image.length()), 0x200000 - quickload_begin);
image.fread( &memregion("maincpu")->base()[quickload_begin], quickload_size);
diff --git a/src/mame/drivers/pet.cpp b/src/mame/drivers/pet.cpp
index 02b868c0cbf..f411209ca49 100644
--- a/src/mame/drivers/pet.cpp
+++ b/src/mame/drivers/pet.cpp
@@ -469,7 +469,7 @@ static void cbm_pet_quick_sethiaddress( address_space &space, uint16_t hiaddress
QUICKLOAD_LOAD_MEMBER(pet_state::quickload_pet)
{
- return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_pet_quick_sethiaddress);
+ return general_cbm_loadsnap(image, m_maincpu->space(AS_PROGRAM), 0, cbm_pet_quick_sethiaddress);
}
diff --git a/src/mame/drivers/plus4.cpp b/src/mame/drivers/plus4.cpp
index d10e12e4b7d..75ee574eb33 100644
--- a/src/mame/drivers/plus4.cpp
+++ b/src/mame/drivers/plus4.cpp
@@ -191,7 +191,7 @@ private:
QUICKLOAD_LOAD_MEMBER(plus4_state::quickload_c16)
{
- return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress);
+ return general_cbm_loadsnap(image, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress);
}
//**************************************************************************
diff --git a/src/mame/drivers/psx.cpp b/src/mame/drivers/psx.cpp
index 1c766e85f32..4ca19326c7e 100644
--- a/src/mame/drivers/psx.cpp
+++ b/src/mame/drivers/psx.cpp
@@ -477,9 +477,9 @@ void psx1_state::parallel_w(offs_t offset, uint16_t data)
QUICKLOAD_LOAD_MEMBER(psx1_state::quickload_exe)
{
- m_exe_buffer.resize(quickload_size);
+ m_exe_buffer.resize(image.length());
- if (image.fread(reinterpret_cast<void *>(&m_exe_buffer[0]), quickload_size) != quickload_size)
+ if (image.fread(reinterpret_cast<void *>(&m_exe_buffer[0]), image.length()) != image.length())
{
m_exe_buffer.resize(0);
return image_init_result::FAIL;
diff --git a/src/mame/drivers/qx10.cpp b/src/mame/drivers/qx10.cpp
index a1ac1e0557f..479bfd81922 100644
--- a/src/mame/drivers/qx10.cpp
+++ b/src/mame/drivers/qx10.cpp
@@ -329,7 +329,7 @@ QUICKLOAD_LOAD_MEMBER(qx10_state::quickload_cb)
{
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
- if (quickload_size >= 0xfd00)
+ if (image.length() >= 0xfd00)
return image_init_result::FAIL;
/* The right RAM bank must be active */
@@ -344,6 +344,7 @@ QUICKLOAD_LOAD_MEMBER(qx10_state::quickload_cb)
}
/* Load image to the TPA (Transient Program Area) */
+ uint16_t quickload_size = image.length();
for (uint16_t i = 0; i < quickload_size; i++)
{
uint8_t data;
diff --git a/src/mame/drivers/smc777.cpp b/src/mame/drivers/smc777.cpp
index 980990dc82d..4e4ca0da1fe 100644
--- a/src/mame/drivers/smc777.cpp
+++ b/src/mame/drivers/smc777.cpp
@@ -408,7 +408,7 @@ QUICKLOAD_LOAD_MEMBER(smc777_state::quickload_cb)
{
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
- if (quickload_size >= 0xfd00)
+ if (image.length() >= 0xfd00)
return image_init_result::FAIL;
/* The right RAM bank must be active */
@@ -421,6 +421,7 @@ QUICKLOAD_LOAD_MEMBER(smc777_state::quickload_cb)
}
/* Load image to the TPA (Transient Program Area) */
+ uint16_t quickload_size = image.length();
for (uint16_t i = 0; i < quickload_size; i++)
{
uint8_t data;
diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp
index 467fef9d43c..be239001f9e 100644
--- a/src/mame/drivers/vgmplay.cpp
+++ b/src/mame/drivers/vgmplay.cpp
@@ -2712,10 +2712,10 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state::load_file)
{
m_vgmplay->stop();
- m_file_data.resize(quickload_size);
+ m_file_data.resize(image.length());
- if (!quickload_size ||
- image.fread(&m_file_data[0], quickload_size) != quickload_size)
+ if (image.length() == 0 ||
+ image.fread(&m_file_data[0], image.length()) != image.length())
{
m_file_data.clear();
return image_init_result::FAIL;
diff --git a/src/mame/drivers/vic20.cpp b/src/mame/drivers/vic20.cpp
index 6a4f4115112..2e37027a7d6 100644
--- a/src/mame/drivers/vic20.cpp
+++ b/src/mame/drivers/vic20.cpp
@@ -164,7 +164,7 @@ private:
QUICKLOAD_LOAD_MEMBER(vic20_state::quickload_vc20)
{
- return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress);
+ return general_cbm_loadsnap(image, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress);
}
//**************************************************************************
diff --git a/src/mame/drivers/vtech1.cpp b/src/mame/drivers/vtech1.cpp
index 5d0d2b19207..55abef9afa5 100644
--- a/src/mame/drivers/vtech1.cpp
+++ b/src/mame/drivers/vtech1.cpp
@@ -171,7 +171,7 @@ SNAPSHOT_LOAD_MEMBER(vtech1_base_state::snapshot_cb)
// get start and end addresses
uint16_t start = pick_integer_le(header, 22, 2);
- uint16_t end = start + snapshot_size - sizeof(header);
+ uint16_t end = start + image.length() - sizeof(header);
uint16_t size = end - start;
// write it to ram
diff --git a/src/mame/drivers/xerox820.cpp b/src/mame/drivers/xerox820.cpp
index ff6d6bee9e8..ddb5e51fb49 100644
--- a/src/mame/drivers/xerox820.cpp
+++ b/src/mame/drivers/xerox820.cpp
@@ -410,7 +410,7 @@ QUICKLOAD_LOAD_MEMBER(xerox820_state::quickload_cb)
{
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
- if (quickload_size >= 0xfd00)
+ if (image.length() >= 0xfd00)
return image_init_result::FAIL;
bankswitch(0);
@@ -423,6 +423,7 @@ QUICKLOAD_LOAD_MEMBER(xerox820_state::quickload_cb)
}
/* Load image to the TPA (Transient Program Area) */
+ uint16_t quickload_size = image.length();
for (uint16_t i = 0; i < quickload_size; i++)
{
uint8_t data;
diff --git a/src/mame/drivers/z1013.cpp b/src/mame/drivers/z1013.cpp
index 363738abfc9..5ed7c9d9bee 100644
--- a/src/mame/drivers/z1013.cpp
+++ b/src/mame/drivers/z1013.cpp
@@ -331,10 +331,10 @@ SNAPSHOT_LOAD_MEMBER(z1013_state::snapshot_cb)
0020 up - Program to load
*/
- uint8_t* data= auto_alloc_array(machine(), uint8_t, snapshot_size);
+ std::vector<uint8_t> data(image.length());
uint16_t startaddr,endaddr,runaddr;
- image.fread( data, snapshot_size);
+ image.fread(&data[0], image.length());
startaddr = data[0] + data[1]*256;
endaddr = data[2] + data[3]*256;
@@ -350,7 +350,7 @@ SNAPSHOT_LOAD_MEMBER(z1013_state::snapshot_cb)
}
memcpy (m_maincpu->space(AS_PROGRAM).get_read_ptr(startaddr),
- data+0x20, endaddr - startaddr + 1);
+ &data[0x20], endaddr - startaddr + 1);
if (runaddr)
m_maincpu->set_state_int(Z80_PC, runaddr);
diff --git a/src/mame/includes/jaguar.h b/src/mame/includes/jaguar.h
index f5eed8b8051..99a3807d626 100644
--- a/src/mame/includes/jaguar.h
+++ b/src/mame/includes/jaguar.h
@@ -266,7 +266,7 @@ private:
DECLARE_WRITE_LINE_MEMBER( dsp_cpu_int );
DECLARE_WRITE_LINE_MEMBER( external_int );
- image_init_result quickload_cb(device_image_interface &image, const char *file_type, int quickload_size);
+ image_init_result quickload_cb(device_image_interface &image);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( cart_load );
void cpu_space_map(address_map &map);
void dsp_map(address_map &map);
diff --git a/src/mame/machine/amstrad.cpp b/src/mame/machine/amstrad.cpp
index 7a6ba398b73..3457be3348b 100644
--- a/src/mame/machine/amstrad.cpp
+++ b/src/mame/machine/amstrad.cpp
@@ -3257,16 +3257,14 @@ MACHINE_RESET_MEMBER(amstrad_state,aleste)
/* load snapshot */
SNAPSHOT_LOAD_MEMBER(amstrad_state::snapshot_cb)
{
- std::vector<uint8_t> snapshot;
-
/* get file size */
- if (snapshot_size < 8)
+ if (image.length() < 8)
return image_init_result::FAIL;
- snapshot.resize(snapshot_size);
+ std::vector<uint8_t> snapshot(image.length());
/* read whole file */
- image.fread(&snapshot[0], snapshot_size);
+ image.fread(&snapshot[0], image.length());
if (memcmp(&snapshot[0], "MV - SNA", 8))
{
diff --git a/src/mame/machine/cbm_snqk.cpp b/src/mame/machine/cbm_snqk.cpp
index ceb4ab67315..4d11b6597bb 100644
--- a/src/mame/machine/cbm_snqk.cpp
+++ b/src/mame/machine/cbm_snqk.cpp
@@ -24,8 +24,8 @@
* 0x001c data */
-image_init_result general_cbm_loadsnap( device_image_interface &image, const char *file_type, int snapshot_size,
- address_space &space, offs_t offset, void (*cbm_sethiaddress)(address_space &space, uint16_t hiaddress) )
+image_init_result general_cbm_loadsnap( device_image_interface &image, address_space &space, offs_t offset,
+ void (*cbm_sethiaddress)(address_space &space, uint16_t hiaddress) )
{
char buffer[7];
std::vector<uint8_t> data;
@@ -33,14 +33,13 @@ image_init_result general_cbm_loadsnap( device_image_interface &image, const cha
uint16_t address = 0;
int i;
- if (!file_type)
- goto error;
+ int snapshot_size = image.length();
- if (!core_stricmp(file_type, "prg"))
+ if (image.is_filetype("prg"))
{
/* prg files */
}
- else if (!core_stricmp(file_type, "p00"))
+ else if (image.is_filetype("p00"))
{
/* p00 files */
if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer))
@@ -50,7 +49,7 @@ image_init_result general_cbm_loadsnap( device_image_interface &image, const cha
image.fseek(26, SEEK_SET);
snapshot_size -= 26;
}
- else if (!core_stricmp(file_type, "t64"))
+ else if (image.is_filetype("t64"))
{
/* t64 files - for GB64 Single T64s loading to x0801 - header is always the same size */
if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer))
@@ -67,7 +66,7 @@ image_init_result general_cbm_loadsnap( device_image_interface &image, const cha
image.fread( &address, 2);
address = little_endianize_int16(address);
- if (!core_stricmp(file_type, "t64"))
+ if (image.is_filetype("t64"))
address = 2049;
snapshot_size -= 2;
diff --git a/src/mame/machine/cbm_snqk.h b/src/mame/machine/cbm_snqk.h
index 32c9a597743..b53bbc5fb1d 100644
--- a/src/mame/machine/cbm_snqk.h
+++ b/src/mame/machine/cbm_snqk.h
@@ -17,8 +17,6 @@
image_init_result general_cbm_loadsnap(
device_image_interface &image,
- const char *file_type,
- int snapshot_size,
address_space &space,
offs_t offset,
void (*cbm_sethiaddress)(address_space &space, uint16_t hiaddress));
diff --git a/src/mame/machine/galaxy.cpp b/src/mame/machine/galaxy.cpp
index 269cd14cbb3..987915bf2f9 100644
--- a/src/mame/machine/galaxy.cpp
+++ b/src/mame/machine/galaxy.cpp
@@ -117,21 +117,20 @@ void galaxy_state::setup_snapshot(const uint8_t * data, uint32_t size)
SNAPSHOT_LOAD_MEMBER(galaxy_state::snapshot_cb)
{
- uint8_t* snapshot_data;
-
+ uint32_t snapshot_size = image.length();
switch (snapshot_size)
{
case GALAXY_SNAPSHOT_V1_SIZE:
case GALAXY_SNAPSHOT_V2_SIZE:
- snapshot_data = auto_alloc_array(machine(), uint8_t, snapshot_size);
break;
default:
return image_init_result::FAIL;
}
- image.fread( snapshot_data, snapshot_size);
+ std::vector<uint8_t> snapshot_data(snapshot_size);
+ image.fread(&snapshot_data[0], snapshot_size);
- setup_snapshot(snapshot_data, snapshot_size);
+ setup_snapshot(&snapshot_data[0], snapshot_size);
return image_init_result::PASS;
}
diff --git a/src/mame/machine/kaypro.cpp b/src/mame/machine/kaypro.cpp
index 7826f6fb85d..70239ecbbc1 100644
--- a/src/mame/machine/kaypro.cpp
+++ b/src/mame/machine/kaypro.cpp
@@ -273,10 +273,11 @@ QUICKLOAD_LOAD_MEMBER(kaypro_state::quickload_cb)
if ((prog_space.read_byte(0) != 0xc3) || (prog_space.read_byte(5) != 0xc3))
return image_init_result::FAIL;
- if (quickload_size >= 0xfd00)
+ if (image.length() >= 0xfd00)
return image_init_result::FAIL;
/* Load image to the TPA (Transient Program Area) */
+ u16 quickload_size = image.length();
for (u16 i = 0; i < quickload_size; i++)
{
u8 data;
diff --git a/src/mame/machine/lviv.cpp b/src/mame/machine/lviv.cpp
index 94d7bccdbc9..81930081fbc 100644
--- a/src/mame/machine/lviv.cpp
+++ b/src/mame/machine/lviv.cpp
@@ -297,7 +297,7 @@ SNAPSHOT_LOAD_MEMBER(lviv_state::snapshot_cb)
image.fread(&snapshot_data[0], LVIV_SNAPSHOT_SIZE);
- if (verify_snapshot(&snapshot_data[0], snapshot_size) != image_verify_result::PASS)
+ if (verify_snapshot(&snapshot_data[0], image.length()) != image_verify_result::PASS)
{
return image_init_result::FAIL;
}
diff --git a/src/mame/machine/mbee.cpp b/src/mame/machine/mbee.cpp
index 4cb48449136..c478e908dbf 100644
--- a/src/mame/machine/mbee.cpp
+++ b/src/mame/machine/mbee.cpp
@@ -583,6 +583,7 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_bee)
uint16_t i, j;
uint8_t data, sw = m_io_config->read() & 1; /* reading the config switch: 1 = autorun */
+ size_t quickload_size = image.length();
if (image.is_filetype("mwb"))
{
/* mwb files - standard basic files */
@@ -677,7 +678,7 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_bin)
address_space &space = m_maincpu->space(AS_PROGRAM);
/* load the binary into memory */
- if (z80bin_load_file(&image, space, file_type, &execute_address, &start_addr, &end_addr) != image_init_result::PASS)
+ if (z80bin_load_file(image, space, execute_address, start_addr, end_addr) != image_init_result::PASS)
return image_init_result::FAIL;
/* is this file executable? */
diff --git a/src/mame/machine/microtan.cpp b/src/mame/machine/microtan.cpp
index fa68bcdecc3..b71982061f5 100644
--- a/src/mame/machine/microtan.cpp
+++ b/src/mame/machine/microtan.cpp
@@ -671,10 +671,10 @@ SNAPSHOT_LOAD_MEMBER(microtan_state::snapshot_cb)
if (!snapshot_buff)
return image_init_result::FAIL;
- if (verify_snapshot(snapshot_buff, snapshot_size) != image_verify_result::PASS)
+ if (verify_snapshot(snapshot_buff, image.length()) != image_verify_result::PASS)
return image_init_result::FAIL;
- snapshot_copy(snapshot_buff, snapshot_size);
+ snapshot_copy(snapshot_buff, image.length());
return image_init_result::PASS;
}
@@ -682,12 +682,12 @@ QUICKLOAD_LOAD_MEMBER(microtan_state::quickload_cb)
{
int snapshot_size = 8263; /* magic size */
std::vector<uint8_t> snapshot_buff(snapshot_size, 0);
- std::vector<char> buff(quickload_size + 1);
+ std::vector<char> buff(image.length() + 1);
image_init_result rc;
- image.fread(&buff[0], quickload_size);
+ image.fread(&buff[0], image.length());
- buff[quickload_size] = '\0';
+ buff[image.length()] = '\0';
if (buff[0] == ':')
rc = parse_intel_hex(&snapshot_buff[0], &buff[0]);
diff --git a/src/mame/machine/mtx.cpp b/src/mame/machine/mtx.cpp
index 55349bc4202..8c0c086aab0 100644
--- a/src/mame/machine/mtx.cpp
+++ b/src/mame/machine/mtx.cpp
@@ -468,7 +468,7 @@ SNAPSHOT_LOAD_MEMBER(mtx_state::snapshot_cb)
}
// write actual image data
- uint16_t data_size = snapshot_size - 18 - system_variables_size;
+ uint16_t data_size = image.length() - 18 - system_variables_size;
for (int i = 0; i < data_size; i++)
program.write_byte(0x4000 + i, data[18 + system_variables_size + i]);
@@ -486,7 +486,7 @@ QUICKLOAD_LOAD_MEMBER(mtx_state::quickload_cb)
address_space &program = m_maincpu->space(AS_PROGRAM);
uint8_t *data = (uint8_t*)image.ptr();
- if (quickload_size < 4)
+ if (image.length() < 4)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short");
return image_init_result::FAIL;
@@ -495,7 +495,7 @@ QUICKLOAD_LOAD_MEMBER(mtx_state::quickload_cb)
uint16_t code_base = pick_integer_le(data, 0, 2);
uint16_t code_length = pick_integer_le(data, 2, 2);
- if (quickload_size < code_length)
+ if (image.length() < code_length)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short");
return image_init_result::FAIL;
diff --git a/src/mame/machine/poly88.cpp b/src/mame/machine/poly88.cpp
index e1f772400d4..06fba3a2849 100644
--- a/src/mame/machine/poly88.cpp
+++ b/src/mame/machine/poly88.cpp
@@ -240,7 +240,7 @@ void poly88_state::intr_w(uint8_t data)
SNAPSHOT_LOAD_MEMBER(poly88_state::snapshot_cb)
{
address_space &space = m_maincpu->space(AS_PROGRAM);
- uint8_t* data= auto_alloc_array(machine(), uint8_t, snapshot_size);
+ int snapshot_size = image.length();
uint16_t recordNum;
uint16_t recordLen;
uint16_t address;
@@ -251,7 +251,8 @@ SNAPSHOT_LOAD_MEMBER(poly88_state::snapshot_cb)
int i = 0;
int theend = 0;
- image.fread( data, snapshot_size);
+ std::vector<uint8_t> data(snapshot_size);
+ image.fread(&data[0], snapshot_size);
while (pos<snapshot_size) {
for(i=0;i<9;i++) {
@@ -260,7 +261,7 @@ SNAPSHOT_LOAD_MEMBER(poly88_state::snapshot_cb)
pos+=8;
name[8] = 0;
-
+ // FIXME: this risks buffer overruns
recordNum = data[pos]+ data[pos+1]*256; pos+=2;
recordLen = data[pos]; pos++;
if (recordLen==0) recordLen=0x100;
diff --git a/src/mame/machine/primo.cpp b/src/mame/machine/primo.cpp
index 41047fd6196..59b74aa8161 100644
--- a/src/mame/machine/primo.cpp
+++ b/src/mame/machine/primo.cpp
@@ -283,9 +283,9 @@ void primo_state::setup_pss (uint8_t* snapshot_data, uint32_t snapshot_size)
SNAPSHOT_LOAD_MEMBER(primo_state::snapshot_cb)
{
- std::vector<uint8_t> snapshot_data(snapshot_size);
+ std::vector<uint8_t> snapshot_data(image.length());
- if (image.fread(&snapshot_data[0], snapshot_size) != snapshot_size)
+ if (image.fread(&snapshot_data[0], image.length()) != image.length())
{
return image_init_result::FAIL;
}
@@ -295,7 +295,7 @@ SNAPSHOT_LOAD_MEMBER(primo_state::snapshot_cb)
return image_init_result::FAIL;
}
- setup_pss(&snapshot_data[0], snapshot_size);
+ setup_pss(&snapshot_data[0], image.length());
return image_init_result::PASS;
}
@@ -322,6 +322,7 @@ void primo_state::setup_pp(uint8_t* quickload_data, uint32_t quickload_size)
QUICKLOAD_LOAD_MEMBER(primo_state::quickload_cb)
{
+ size_t quickload_size = image.length();
std::vector<uint8_t> quickload_data(quickload_size);
if (image.fread(&quickload_data[0], quickload_size) != quickload_size)
diff --git a/src/mame/machine/sorcerer.cpp b/src/mame/machine/sorcerer.cpp
index 7f14dd60246..0d5f0d4ecee 100644
--- a/src/mame/machine/sorcerer.cpp
+++ b/src/mame/machine/sorcerer.cpp
@@ -539,7 +539,7 @@ SNAPSHOT_LOAD_MEMBER(sorcerer_state::snapshot_cb)
unsigned char s_byte;
/* check size */
- if (snapshot_size != 0x1001c)
+ if (image.length() != 0x1001c)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Snapshot must be 65564 bytes");
image.message("Snapshot must be 65564 bytes");
@@ -591,7 +591,7 @@ QUICKLOAD_LOAD_MEMBER(sorcerer_state::quickload_cb)
address_space &space = m_maincpu->space(AS_PROGRAM);
/* load the binary into memory */
- if (z80bin_load_file(&image, space, file_type, &execute_address, &start_address, &end_address) != image_init_result::PASS)
+ if (z80bin_load_file(image, space, execute_address, start_address, end_address) != image_init_result::PASS)
return image_init_result::FAIL;
/* is this file executable? */
diff --git a/src/mame/machine/spec_snqk.cpp b/src/mame/machine/spec_snqk.cpp
index 1b419a08c5f..f5b4dc5f3c0 100644
--- a/src/mame/machine/spec_snqk.cpp
+++ b/src/mame/machine/spec_snqk.cpp
@@ -110,11 +110,12 @@ void spectrum_state::page_basicrom()
SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
{
+ size_t snapshot_size = image.length();
std::vector<uint8_t> snapshot_data(snapshot_size);
image.fread(&snapshot_data[0], snapshot_size);
- if (!core_stricmp(file_type, "sna"))
+ if (image.is_filetype("sna"))
{
if ((snapshot_size != SNA48_SIZE) && (snapshot_size != SNA128_SIZE_1) && (snapshot_size != SNA128_SIZE_2))
{
@@ -123,7 +124,7 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
}
setup_sna(&snapshot_data[0], snapshot_size);
}
- else if (!core_stricmp(file_type, "sp"))
+ else if (image.is_filetype("sp"))
{
if ((snapshot_data[0] != 'S' && snapshot_data[1] != 'P') && (snapshot_size != SP_NEW_SIZE_16K && snapshot_size != SP_NEW_SIZE_48K))
{
@@ -135,7 +136,7 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
}
setup_sp(&snapshot_data[0], snapshot_size);
}
- else if (!core_stricmp(file_type, "ach"))
+ else if (image.is_filetype("ach"))
{
if (snapshot_size != ACH_SIZE)
{
@@ -144,7 +145,7 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
}
setup_ach(&snapshot_data[0], snapshot_size);
}
- else if (!core_stricmp(file_type, "prg"))
+ else if (image.is_filetype("prg"))
{
if (snapshot_size != PRG_SIZE)
{
@@ -153,7 +154,7 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
}
setup_prg(&snapshot_data[0], snapshot_size);
}
- else if (!core_stricmp(file_type, "plusd"))
+ else if (image.is_filetype("plusd"))
{
if ((snapshot_size != PLUSD48_SIZE) && (snapshot_size != PLUSD128_SIZE))
{
@@ -162,7 +163,7 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
}
setup_plusd(&snapshot_data[0], snapshot_size);
}
- else if (!core_stricmp(file_type, "sem"))
+ else if (image.is_filetype("sem"))
{
if (snapshot_data[0] != 0x05 && snapshot_data[1] != 'S' && \
snapshot_data[2] != 'P' && snapshot_data[3] != 'E' && \
@@ -176,7 +177,7 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
}
setup_sem(&snapshot_data[0], snapshot_size);
}
- else if (!core_stricmp(file_type, "sit"))
+ else if (image.is_filetype("sit"))
{
if (snapshot_size != SIT_SIZE)
{
@@ -185,7 +186,7 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
}
setup_sit(&snapshot_data[0], snapshot_size);
}
- else if (!core_stricmp(file_type, "zx"))
+ else if (image.is_filetype("zx"))
{
if (snapshot_size != ZX_SIZE)
{
@@ -194,7 +195,7 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
}
setup_zx(&snapshot_data[0], snapshot_size);
}
- else if (!core_stricmp(file_type, "snp"))
+ else if (image.is_filetype("snp"))
{
if (snapshot_size != SNP_SIZE)
{
@@ -203,7 +204,7 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
}
setup_snp(&snapshot_data[0], snapshot_size);
}
- else if (!core_stricmp(file_type, "snx"))
+ else if (image.is_filetype("snx"))
{
if (snapshot_data[0] != 'X' && snapshot_data[1] != 'S' && \
snapshot_data[2] != 'N' && snapshot_data[3] != 'A')
@@ -213,7 +214,7 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
}
setup_snx(&snapshot_data[0], snapshot_size);
}
- else if (!core_stricmp(file_type, "frz"))
+ else if (image.is_filetype("frz"))
{
if (snapshot_size != FRZ_SIZE)
{
@@ -2417,11 +2418,12 @@ void spectrum_state::setup_z80(uint8_t *snapdata, uint32_t snapsize)
QUICKLOAD_LOAD_MEMBER(spectrum_state::quickload_cb)
{
+ size_t quickload_size = image.length();
std::vector<uint8_t> quickload_data(quickload_size);
image.fread(&quickload_data[0], quickload_size);
- if (!core_stricmp(file_type, "scr"))
+ if (image.is_filetype("scr"))
{
if ((quickload_size != SCR_SIZE) && (quickload_size != SCR_BITMAP))
{
@@ -2430,7 +2432,7 @@ QUICKLOAD_LOAD_MEMBER(spectrum_state::quickload_cb)
}
setup_scr(&quickload_data[0], quickload_size);
}
- else if (!core_stricmp(file_type, "raw"))
+ else if (image.is_filetype("raw"))
{
if (quickload_size != RAW_SIZE)
{
diff --git a/src/mame/machine/super80.cpp b/src/mame/machine/super80.cpp
index 6296d292027..525451ebbcf 100644
--- a/src/mame/machine/super80.cpp
+++ b/src/mame/machine/super80.cpp
@@ -267,7 +267,7 @@ QUICKLOAD_LOAD_MEMBER(super80_state::quickload_cb)
uint16_t exec_addr, start_addr, end_addr;
// load the binary into memory
- if (z80bin_load_file(&image, m_maincpu->space(AS_PROGRAM), file_type, &exec_addr, &start_addr, &end_addr) != image_init_result::PASS)
+ if (z80bin_load_file(image, m_maincpu->space(AS_PROGRAM), exec_addr, start_addr, end_addr) != image_init_result::PASS)
return image_init_result::FAIL;
// is this file executable?
diff --git a/src/mame/machine/ti85.cpp b/src/mame/machine/ti85.cpp
index 60d52b15f5b..d3c3bb93636 100644
--- a/src/mame/machine/ti85.cpp
+++ b/src/mame/machine/ti85.cpp
@@ -1219,7 +1219,6 @@ void ti85_state::ti86_setup_snapshot (uint8_t * data)
SNAPSHOT_LOAD_MEMBER(ti85_state::snapshot_cb)
{
int expected_snapshot_size = 0;
- std::vector<uint8_t> ti8x_snapshot_data;
if (!strncmp(machine().system().name, "ti85", 4))
expected_snapshot_size = TI85_SNAPSHOT_SIZE;
@@ -1228,15 +1227,14 @@ SNAPSHOT_LOAD_MEMBER(ti85_state::snapshot_cb)
logerror("Snapshot loading\n");
- if (snapshot_size != expected_snapshot_size)
+ if (image.length() != expected_snapshot_size)
{
logerror ("Incomplete snapshot file\n");
return image_init_result::FAIL;
}
- ti8x_snapshot_data.resize(snapshot_size);
-
- image.fread( &ti8x_snapshot_data[0], snapshot_size);
+ std::vector<uint8_t> ti8x_snapshot_data(image.length());
+ image.fread( &ti8x_snapshot_data[0], image.length());
if (!strncmp(machine().system().name, "ti85", 4))
ti85_setup_snapshot(&ti8x_snapshot_data[0]);
diff --git a/src/mame/machine/z80bin.cpp b/src/mame/machine/z80bin.cpp
index 5da1dafe9f7..9fdf4183e1a 100644
--- a/src/mame/machine/z80bin.cpp
+++ b/src/mame/machine/z80bin.cpp
@@ -8,7 +8,7 @@
memory
-------------------------------------------------*/
-image_init_result z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, uint16_t *exec_addr, uint16_t *start_addr, uint16_t *end_addr)
+image_init_result z80bin_load_file(device_image_interface &image, address_space &space, uint16_t &exec_addr, uint16_t &start_addr, uint16_t &end_addr)
{
int ch;
uint16_t args[3];
@@ -17,14 +17,14 @@ image_init_result z80bin_load_file(device_image_interface *image, address_space
char pgmname[256];
char message[512];
- image->fseek(7, SEEK_SET);
+ image.fseek(7, SEEK_SET);
- while((ch = image->fgetc()) != 0x1A)
+ while((ch = image.fgetc()) != 0x1A)
{
if (ch == EOF)
{
- image->seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file name");
- image->message(" 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,8 +32,8 @@ image_init_result z80bin_load_file(device_image_interface *image, address_space
{
if (i >= (ARRAY_LENGTH(pgmname) - 1))
{
- image->seterror(IMAGE_ERROR_INVALIDIMAGE, "File name too long");
- image->message(" File name too long");
+ image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File name too long");
+ image.message(" File name too long");
return image_init_result::FAIL;
}
@@ -44,30 +44,30 @@ image_init_result z80bin_load_file(device_image_interface *image, address_space
pgmname[i] = '\0'; /* terminate string with a null */
- if (image->fread(args, sizeof(args)) != sizeof(args))
+ if (image.fread(args, sizeof(args)) != sizeof(args))
{
- image->seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file size");
- image->message(" 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;
}
- exec_addr[0] = little_endianize_int16(args[0]);
- start_addr[0] = little_endianize_int16(args[1]);
- end_addr[0] = little_endianize_int16(args[2]);
+ exec_addr = little_endianize_int16(args[0]);
+ start_addr = little_endianize_int16(args[1]);
+ end_addr = little_endianize_int16(args[2]);
- size = (end_addr[0] - start_addr[0] + 1) & 0xffff;
+ size = (end_addr - start_addr + 1) & 0xffff;
/* display a message about the loaded quickload */
- image->message(" %s\nsize=%04X : start=%04X : end=%04X : exec=%04X",pgmname,size,start_addr[0],end_addr[0],exec_addr[0]);
+ image.message(" %s\nsize=%04X : start=%04X : end=%04X : exec=%04X",pgmname,size,start_addr,end_addr,exec_addr);
for (i = 0; i < size; i++)
{
- j = (start_addr[0] + i) & 0xffff;
- if (image->fread(&data, 1) != 1)
+ j = (start_addr + i) & 0xffff;
+ if (image.fread(&data, 1) != 1)
{
snprintf(message, ARRAY_LENGTH(message), "%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j);
- image->seterror(IMAGE_ERROR_INVALIDIMAGE, message);
- image->message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j);
+ image.seterror(IMAGE_ERROR_INVALIDIMAGE, message);
+ image.message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j);
return image_init_result::FAIL;
}
space.write_byte(j, data);
diff --git a/src/mame/machine/z80bin.h b/src/mame/machine/z80bin.h
index 904b89c9325..ecadaae549d 100644
--- a/src/mame/machine/z80bin.h
+++ b/src/mame/machine/z80bin.h
@@ -13,6 +13,6 @@
#pragma once
-image_init_result z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, uint16_t *exec_addr, uint16_t *start_addr, uint16_t *end_addr);
+image_init_result z80bin_load_file(device_image_interface &image, address_space &space, uint16_t &exec_addr, uint16_t &start_addr, uint16_t &end_addr);
#endif // MAME_MACHINE_Z80BIN_H