diff options
Diffstat (limited to 'src/emu/dinvram.h')
-rw-r--r-- | src/emu/dinvram.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/emu/dinvram.h b/src/emu/dinvram.h index fb02a9c6e14..0efcc9d1054 100644 --- a/src/emu/dinvram.h +++ b/src/emu/dinvram.h @@ -30,21 +30,28 @@ class device_nvram_interface : public device_interface { public: // construction/destruction - device_nvram_interface(const machine_config &mconfig, device_t &device); + device_nvram_interface(const machine_config &mconfig, device_t &device, bool backup_enabled = true); virtual ~device_nvram_interface(); + // configuration + void nvram_enable_backup(bool enabled) { assert(!device().started()); m_backup_enabled = enabled; } + // 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_can_save() { return nvram_can_write(); } + bool nvram_load(util::read_stream &file) { return nvram_read(file); } + bool nvram_save(util::write_stream &file) { return nvram_write(file); } + bool nvram_backup_enabled() const noexcept { return m_backup_enabled; } + bool nvram_can_save() const { return m_backup_enabled && 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_can_write() { return true; } + virtual bool nvram_read(util::read_stream &file) = 0; + virtual bool nvram_write(util::write_stream &file) = 0; + virtual bool nvram_can_write() const { return true; } + +private: + bool m_backup_enabled; }; // iterator |