diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2022-02-27 11:08:29 -0500 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2022-02-27 11:11:44 -0500 |
commit | 8c20f22955762c85870bdc2ae972018a6acc4258 (patch) | |
tree | a6d3b49a646ccd311932385717e74b8e2bfcafa0 /src/emu | |
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/emu')
-rw-r--r-- | src/emu/dinvram.h | 8 | ||||
-rw-r--r-- | src/emu/machine.cpp | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/emu/dinvram.h b/src/emu/dinvram.h index fb02a9c6e14..0549e183c6a 100644 --- a/src/emu/dinvram.h +++ b/src/emu/dinvram.h @@ -35,15 +35,15 @@ public: // public accessors... for now void nvram_reset() { nvram_default(); } - void nvram_load(emu_file &file) { nvram_read(file); } - void nvram_save(emu_file &file) { nvram_write(file); } + bool nvram_load(util::read_stream &file) { return nvram_read(file); } + bool nvram_save(util::write_stream &file) { return nvram_write(file); } bool nvram_can_save() { return nvram_can_write(); } protected: // derived class overrides virtual void nvram_default() = 0; - virtual void nvram_read(emu_file &file) = 0; - virtual void nvram_write(emu_file &file) = 0; + virtual bool nvram_read(util::read_stream &file) = 0; + virtual bool nvram_write(util::write_stream &file) = 0; virtual bool nvram_can_write() { return true; } }; diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index a5d30974f90..6613c5654bf 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -1135,8 +1135,8 @@ void running_machine::nvram_load() emu_file file(options().nvram_directory(), OPEN_FLAG_READ); if (!file.open(nvram_filename(nvram.device()))) { - // FIXME: don't swallow errors - nvram.nvram_load(file); + if (!nvram.nvram_load(file)) + osd_printf_error("Error reading NVRAM file %s\n", file.filename()); file.close(); } else @@ -1158,8 +1158,8 @@ void running_machine::nvram_save() emu_file file(options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (!file.open(nvram_filename(nvram.device()))) { - // FIXME: don't swallow errors - nvram.nvram_save(file); + if (!nvram.nvram_save(file)) + osd_printf_error("Error writing NVRAM file %s\n", file.filename()); file.close(); } } |