diff options
Diffstat (limited to 'src/devices/imagedev/snapquik.h')
-rw-r--r-- | src/devices/imagedev/snapquik.h | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/src/devices/imagedev/snapquik.h b/src/devices/imagedev/snapquik.h index bb3d9f1f1c3..7e12778a3b0 100644 --- a/src/devices/imagedev/snapquik.h +++ b/src/devices/imagedev/snapquik.h @@ -8,19 +8,22 @@ *********************************************************************/ -#ifndef MAME_DEVICES_IMAGEDEV_SNAPQUIK_H -#define MAME_DEVICES_IMAGEDEV_SNAPQUIK_H +#ifndef MAME_IMAGEDEV_SNAPQUIK_H +#define MAME_IMAGEDEV_SNAPQUIK_H #pragma once -#include "softlist_dev.h" +#include <string> +#include <system_error> +#include <utility> + // ======================> snapshot_image_device 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<std::pair<std::error_condition, std::string> (snapshot_image_device &)> load_delegate; // construction/destruction snapshot_image_device(const machine_config &mconfig, const char *tag, device_t *owner, const char* extensions, attotime delay = attotime::zero) @@ -34,31 +37,41 @@ public: void set_interface(const char *interface) { m_interface = interface; } - // image-level overrides - virtual image_init_result call_load() override; - virtual const software_list_loader &get_software_list_loader() const override { return image_software_list_loader::instance(); } - virtual iodevice_t image_type() const override { return IO_SNAPSHOT; } + // device_image_interface implementation + virtual std::pair<std::error_condition, std::string> call_load() override; - virtual bool is_readable() const override { return 1; } - virtual bool is_writeable() const override { return 0; } - virtual bool is_creatable() const override { return 0; } - virtual bool must_be_loaded() const override { return 0; } - virtual bool is_reset_on_load() const override { return 0; } - virtual const char *image_interface() const override { return m_interface; } - virtual const char *file_extensions() const override { return m_file_extensions; } + virtual bool is_readable() const noexcept override { return true; } + virtual bool is_writeable() const noexcept override { return false; } + virtual bool is_creatable() const noexcept override { return false; } + virtual bool is_reset_on_load() const noexcept override { return false; } + virtual const char *image_interface() const noexcept override { return m_interface; } + virtual const char *file_extensions() const noexcept override { return m_file_extensions; } + virtual const char *image_type_name() const noexcept override { return "snapshot"; } + virtual const char *image_brief_type_name() const noexcept override { return "dump"; } void set_extensions(const char *ext) { m_file_extensions = ext; } void set_delay(attotime delay) { m_delay = delay; } - template <typename... T> void set_load_callback(T &&... args) { m_load = load_delegate(std::forward<T>(args)...); } + template <typename... T> void set_load_callback(T &&... args) { m_load.set(std::forward<T>(args)...); } + + template <typename Format, typename... Params> void message(Format &&fmt, Params &&...args) + { + // format the message + show_message(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...)); + } protected: snapshot_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); // device-level overrides - virtual void device_start() override; + virtual void device_start() override ATTR_COLD; + + // device_image_interface implementation + virtual const software_list_loader &get_software_list_loader() const override; TIMER_CALLBACK_MEMBER(process_snapshot_or_quickload); + void show_message(util::format_argument_pack<char> const &args); + load_delegate m_load; /* loading function */ const char * m_file_extensions; /* file extensions */ const char * m_interface; @@ -83,7 +96,8 @@ public: } quickload_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0U); - virtual iodevice_t image_type() const override { return IO_QUICKLOAD; } + virtual const char *image_type_name() const noexcept override { return "quickload"; } + virtual const char *image_brief_type_name() const noexcept override { return "quik"; } }; // device type definition @@ -92,10 +106,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) std::pair<std::error_condition, std::string> _name(snapshot_image_device &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) std::pair<std::error_condition, std::string> _name(snapshot_image_device &image) #define DECLARE_QUICKLOAD_LOAD_MEMBER(_name) QUICKLOAD_LOAD_MEMBER(_name) -#endif // MAME_DEVICES_IMAGEDEV_SNAPQUIK_H +#endif // MAME_IMAGEDEV_SNAPQUIK_H |