diff options
author | 2022-02-27 11:08:29 -0500 | |
---|---|---|
committer | 2022-02-27 11:11:44 -0500 | |
commit | 8c20f22955762c85870bdc2ae972018a6acc4258 (patch) | |
tree | a6d3b49a646ccd311932385717e74b8e2bfcafa0 /src/devices/machine/ds1994.cpp | |
parent | 300206e308c2c5f9ad8898fb62f1873be682df5a (diff) |
Use ioprocs classes instead of emu_file for device_nvram_interface's load and save methods, and have these return false on I/O errors
Diffstat (limited to 'src/devices/machine/ds1994.cpp')
-rw-r--r-- | src/devices/machine/ds1994.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/devices/machine/ds1994.cpp b/src/devices/machine/ds1994.cpp index 2d16d3eed54..d6dacf90815 100644 --- a/src/devices/machine/ds1994.cpp +++ b/src/devices/machine/ds1994.cpp @@ -15,8 +15,6 @@ #include "emu.h" #include "machine/ds1994.h" -#include "fileio.h" - #include <ctime> #define VERBOSE_LEVEL 0 @@ -753,13 +751,15 @@ void ds1994_device::nvram_default() // .nv file //------------------------------------------------- -void ds1994_device::nvram_read(emu_file &file) +bool ds1994_device::nvram_read(util::read_stream &file) { - file.read(m_rom, ROM_SIZE); - file.read(m_ram, SPD_SIZE); - file.read(m_sram, DATA_SIZE); - file.read(m_rtc, RTC_SIZE); - file.read(m_regs, REGS_SIZE); + size_t actual; + bool result = !file.read(m_rom, ROM_SIZE, actual) && actual == ROM_SIZE; + result = result && !file.read(m_ram, SPD_SIZE, actual) && actual == SPD_SIZE; + result = result && !file.read(m_sram, DATA_SIZE, actual) && actual == DATA_SIZE; + result = result && !file.read(m_rtc, RTC_SIZE, actual) && actual == RTC_SIZE; + result = result && !file.read(m_regs, REGS_SIZE, actual) && actual == REGS_SIZE; + return result; } //------------------------------------------------- @@ -767,11 +767,13 @@ void ds1994_device::nvram_read(emu_file &file) // .nv file //------------------------------------------------- -void ds1994_device::nvram_write(emu_file &file) +bool ds1994_device::nvram_write(util::write_stream &file) { - file.write(m_rom, ROM_SIZE); - file.write(m_ram, SPD_SIZE); - file.write(m_sram, DATA_SIZE); - file.write(m_rtc, RTC_SIZE); - file.write(m_regs, REGS_SIZE); + size_t actual; + bool result = !file.write(m_rom, ROM_SIZE, actual) && actual == ROM_SIZE; + result = result && !file.write(m_ram, SPD_SIZE, actual) && actual == SPD_SIZE; + result = result && !file.write(m_sram, DATA_SIZE, actual) && actual == DATA_SIZE; + result = result && !file.write(m_rtc, RTC_SIZE, actual) && actual == RTC_SIZE; + result = result && !file.write(m_regs, REGS_SIZE, actual) && actual == REGS_SIZE; + return result; } |