diff options
Diffstat (limited to 'src/devices/bus/psx/analogue.cpp')
-rw-r--r-- | src/devices/bus/psx/analogue.cpp | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/devices/bus/psx/analogue.cpp b/src/devices/bus/psx/analogue.cpp index cea69c2f930..aa181ddf9dc 100644 --- a/src/devices/bus/psx/analogue.cpp +++ b/src/devices/bus/psx/analogue.cpp @@ -3,37 +3,35 @@ #include "emu.h" #include "analogue.h" -const device_type PSX_ANALOG_JOYSTICK = device_creator<psx_analog_joystick_device>; -const device_type PSX_DUALSHOCK = device_creator<psx_dualshock_device>; +DEFINE_DEVICE_TYPE(PSX_DUALSHOCK, psx_dualshock_device, "psx_dualshock_pad", "Playstation Dualshock Pad") +DEFINE_DEVICE_TYPE(PSX_ANALOG_JOYSTICK, psx_analog_joystick_device, "psx_analog_joystick", "Playstation Analog Joystick") -psx_analog_controller_device::psx_analog_controller_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) : - device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_psx_controller_interface(mconfig, *this), - m_type(), - m_confmode(false), - m_analogmode(false), - m_analoglock(false), - m_temp(0), - m_cmd(0), - m_pad0(*this, "PSXPAD0"), - m_pad1(*this, "PSXPAD1"), - m_rstickx(*this, "PSXRSTICKX"), - m_rsticky(*this, "PSXRSTICKY"), - m_lstickx(*this, "PSXLSTICKX"), - m_lsticky(*this, "PSXLSTICKY") +psx_analog_controller_device::psx_analog_controller_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, model mod) : + device_t(mconfig, type, tag, owner, clock), + device_psx_controller_interface(mconfig, *this), + m_model(mod), + m_confmode(false), + m_analogmode(false), + m_analoglock(false), + m_temp(0), + m_cmd(0), + m_pad0(*this, "PSXPAD0"), + m_pad1(*this, "PSXPAD1"), + m_rstickx(*this, "PSXRSTICKX"), + m_rsticky(*this, "PSXRSTICKY"), + m_lstickx(*this, "PSXLSTICKX"), + m_lsticky(*this, "PSXLSTICKY") { } psx_dualshock_device::psx_dualshock_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - psx_analog_controller_device(mconfig, PSX_DUALSHOCK, "Playstation Dualshock Pad", tag, owner, clock, "psx_dualshock_pad", __FILE__) + psx_analog_controller_device(mconfig, PSX_DUALSHOCK, tag, owner, clock, model::DUALSHOCK) { - m_type = DUALSHOCK; } psx_analog_joystick_device::psx_analog_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - psx_analog_controller_device(mconfig, PSX_ANALOG_JOYSTICK, "Playstation Analog Joystick", tag, owner, clock, "psx_analog_joystick", __FILE__) + psx_analog_controller_device(mconfig, PSX_ANALOG_JOYSTICK, tag, owner, clock, model::JOYSTICK) { - m_type = JOYSTICK; } void psx_analog_controller_device::device_reset() @@ -52,7 +50,7 @@ uint8_t psx_analog_controller_device::pad_data(int count, bool analog) { case 2: data = m_pad0->read(); - if(!analog || (m_type == JOYSTICK)) + if (!analog || (m_model == model::JOYSTICK)) data |= 6; // l3/r3 break; case 3: @@ -169,7 +167,7 @@ bool psx_analog_controller_device::get_pad(int count, uint8_t *odata, uint8_t id switch(count) { case 0: - if(m_type == JOYSTICK) + if(m_model == model::JOYSTICK) *odata = 0x53; else *odata = 0x73; |