diff options
Diffstat (limited to 'src/emu/driver.h')
-rw-r--r-- | src/emu/driver.h | 82 |
1 files changed, 33 insertions, 49 deletions
diff --git a/src/emu/driver.h b/src/emu/driver.h index 4f6576aa737..ed7172d25ef 100644 --- a/src/emu/driver.h +++ b/src/emu/driver.h @@ -26,26 +26,22 @@ #define MCFG_MACHINE_START_OVERRIDE(_class, _func) \ driver_device::static_set_callback(config.root_device(), driver_device::CB_MACHINE_START, driver_callback_delegate(&_class::MACHINE_START_NAME(_func), this)); +#define MCFG_MACHINE_START_REMOVE() \ + driver_device::static_set_callback(config.root_device(), driver_device::CB_MACHINE_START, driver_callback_delegate()); + #define MCFG_MACHINE_RESET_OVERRIDE(_class, _func) \ driver_device::static_set_callback(config.root_device(), driver_device::CB_MACHINE_RESET, driver_callback_delegate(&_class::MACHINE_RESET_NAME(_func), this)); #define MCFG_MACHINE_RESET_REMOVE() \ driver_device::static_set_callback(config.root_device(), driver_device::CB_MACHINE_RESET, driver_callback_delegate()); -// core sound callbacks -#define MCFG_SOUND_START_OVERRIDE(_class, _func) \ - driver_device::static_set_callback(config.root_device(), driver_device::CB_SOUND_START, driver_callback_delegate(&_class::SOUND_START_NAME(_func), this)); - -#define MCFG_SOUND_RESET_OVERRIDE(_class, _func) \ - driver_device::static_set_callback(config.root_device(), driver_device::CB_SOUND_RESET, driver_callback_delegate(&_class::SOUND_RESET_NAME(_func), this)); - // core video callbacks #define MCFG_VIDEO_START_OVERRIDE(_class, _func) \ driver_device::static_set_callback(config.root_device(), driver_device::CB_VIDEO_START, driver_callback_delegate(&_class::VIDEO_START_NAME(_func), this)); -#define MCFG_VIDEO_RESET_OVERRIDE(_class, _func) \ - driver_device::static_set_callback(config.root_device(), driver_device::CB_VIDEO_RESET, driver_callback_delegate(&_class::VIDEO_RESET_NAME(_func), this)); +#define MCFG_VIDEO_START_REMOVE() \ + driver_device::static_set_callback(config.root_device(), driver_device::CB_VIDEO_START, driver_callback_delegate()); @@ -63,25 +59,11 @@ #define DECLARE_MACHINE_RESET(name) void MACHINE_RESET_NAME(name)() #define MACHINE_RESET_MEMBER(cls,name) void cls::MACHINE_RESET_NAME(name)() -#define SOUND_START_NAME(name) sound_start_##name -#define DECLARE_SOUND_START(name) void SOUND_START_NAME(name)() ATTR_COLD -#define SOUND_START_MEMBER(cls,name) void cls::SOUND_START_NAME(name)() - -#define SOUND_RESET_NAME(name) sound_reset_##name -#define SOUND_RESET_CALL_MEMBER(name) SOUND_RESET_NAME(name)() -#define DECLARE_SOUND_RESET(name) void SOUND_RESET_NAME(name)() -#define SOUND_RESET_MEMBER(cls,name) void cls::SOUND_RESET_NAME(name)() - #define VIDEO_START_NAME(name) video_start_##name #define VIDEO_START_CALL_MEMBER(name) VIDEO_START_NAME(name)() #define DECLARE_VIDEO_START(name) void VIDEO_START_NAME(name)() ATTR_COLD #define VIDEO_START_MEMBER(cls,name) void cls::VIDEO_START_NAME(name)() -#define VIDEO_RESET_NAME(name) video_reset_##name -#define VIDEO_RESET_CALL_MEMBER(name) VIDEO_RESET_NAME(name)() -#define DECLARE_VIDEO_RESET(name) void VIDEO_RESET_NAME(name)() -#define VIDEO_RESET_MEMBER(cls,name) void cls::VIDEO_RESET_NAME(name)() - //************************************************************************** @@ -92,9 +74,14 @@ typedef delegate<void ()> driver_callback_delegate; -// ======================> driver_device - -// base class for machine driver-specific devices +/// \brief Base class for system device classes +/// +/// System devices can be used as the root device of a system. +/// Indirection for metadata, input port definitons, initialisation +/// functions, ROM definitions, internal artwork and emulation status +/// flags is provided via the #game_driver structure. This allows +/// multiple systems to be be implemented using a single +/// system device class. class driver_device : public device_t { public: @@ -103,30 +90,26 @@ public: virtual ~driver_device(); // getters - const game_driver &system() const { assert(m_system != nullptr); return *m_system; } + const game_driver &system() const { return m_system; } // indexes into our generic callbacks enum callback_type { CB_MACHINE_START, CB_MACHINE_RESET, - CB_SOUND_START, - CB_SOUND_RESET, CB_VIDEO_START, - CB_VIDEO_RESET, CB_COUNT }; // inline configuration helpers - void set_game_driver(const game_driver &game); static void static_set_callback(device_t &device, callback_type type, driver_callback_delegate callback); - // dummy driver_init callback + /// \brief Empty system initialisation function + /// + /// Provided as a convenience for systems that have no additional + /// initialisation tasks. void empty_init(); - // memory helpers - address_space &generic_space() const { return machine().dummy_space(); } - // output heler output_manager &output() const { return machine().output(); } @@ -157,7 +140,7 @@ public: void irq7_line_hold(device_t &device); void irq7_line_assert(device_t &device); - virtual void driver_init(); + virtual std::vector<std::string> searchpath() const override; protected: // helpers called at startup @@ -173,31 +156,32 @@ protected: virtual void video_reset(); // device-level overrides - virtual const tiny_rom_entry *device_rom_region() const override; - virtual void device_add_mconfig(machine_config &config) override; - virtual ioport_constructor device_input_ports() const override; - virtual void device_start() override; + virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; + virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; + virtual ioport_constructor device_input_ports() const override ATTR_COLD; + virtual void device_start() override ATTR_COLD; virtual void device_reset_after_children() override; // generic video - void flip_screen_set(u32 on); - void flip_screen_x_set(u32 on); - void flip_screen_y_set(u32 on); - u32 flip_screen() const { return m_flip_screen_x; } - u32 flip_screen_x() const { return m_flip_screen_x; } - u32 flip_screen_y() const { return m_flip_screen_y; } + void flip_screen_set(int state); + void flip_screen_x_set(int state); + void flip_screen_y_set(int state); + u8 flip_screen() const { return m_flip_screen_x; } // & m_flip_screen_y? + u8 flip_screen_x() const { return m_flip_screen_x; } + u8 flip_screen_y() const { return m_flip_screen_y; } private: // helpers void updateflip(); // internal state - const game_driver *m_system; // pointer to the game driver + const game_driver &m_system; // reference to the system description + std::vector<std::string> m_searchpath; // media search path following parent/clone links driver_callback_delegate m_callbacks[CB_COUNT]; // start/reset callbacks // generic video - u8 m_flip_screen_x; - u8 m_flip_screen_y; + u8 m_flip_screen_x; + u8 m_flip_screen_y; }; |