removed runtime ioport lookups [smf]

This commit is contained in:
smf- 2013-01-24 17:31:17 +00:00
parent ba61a286f3
commit 27343419f0
4 changed files with 30 additions and 12 deletions

View File

@ -4,7 +4,13 @@ const device_type PSX_ANALOG_CONTROLLER = &device_creator<psx_analog_controller_
psx_analog_controller_device::psx_analog_controller_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, PSX_ANALOG_CONTROLLER, "Playstation Analog Controller", tag, owner, clock),
device_psx_controller_interface(mconfig, *this)
device_psx_controller_interface(mconfig, *this),
m_pad0(*this, "PSXPAD0"),
m_pad1(*this, "PSXPAD1"),
m_rstickx(*this, "PSXRSTICKX"),
m_rsticky(*this, "PSXRSTICKY"),
m_lstickx(*this, "PSXLSTICKX"),
m_lsticky(*this, "PSXLSTICKY")
{
}
@ -23,24 +29,24 @@ UINT8 psx_analog_controller_device::pad_data(int count, bool analog)
switch(count)
{
case 2:
data = ioport("PSXPAD0")->read();
data = m_pad0->read();
if(!analog)
data |= 6;
data |= 6; // l3/r3
break;
case 3:
data = ioport("PSXPAD1")->read();
data = m_pad1->read();
break;
case 4:
data = ioport("PSXRSTICKX")->read();
data = m_rstickx->read();
break;
case 5:
data = ioport("PSXRSTICKY")->read();
data = m_rsticky->read();
break;
case 6:
data = ioport("PSXLSTICKX")->read();
data = m_lstickx->read();
break;
case 7:
data = ioport("PSXLSTICKY")->read();
data = m_lsticky->read();
break;
}
return data;
@ -236,5 +242,5 @@ ioport_constructor psx_analog_controller_device::device_input_ports() const
INPUT_CHANGED_MEMBER(psx_analog_controller_device::change_mode)
{
if(!m_analoglock)
m_analogmode = ioport("PSXMISC")->read();
m_analogmode = newval;
}

View File

@ -27,6 +27,13 @@ private:
UINT8 m_temp;
UINT8 m_cmd;
required_ioport m_pad0;
required_ioport m_pad1;
required_ioport m_rstickx;
required_ioport m_rsticky;
required_ioport m_lstickx;
required_ioport m_lsticky;
};
#endif /* PSXANALOG_H_ */

View File

@ -141,7 +141,9 @@ const device_type PSX_STANDARD_CONTROLLER = &device_creator<psx_standard_control
psx_standard_controller_device::psx_standard_controller_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, PSX_STANDARD_CONTROLLER, "Playstation Standard Controller", tag, owner, clock),
device_psx_controller_interface(mconfig, *this)
device_psx_controller_interface(mconfig, *this),
m_pad0(*this,"PSXPAD0"),
m_pad1(*this,"PSXPAD1")
{
}
@ -158,10 +160,10 @@ bool psx_standard_controller_device::get_pad(int count, UINT8 *odata, UINT8 idat
*odata = 0x5a;
break;
case 2:
*odata = ioport("PSXPAD0")->read();
*odata = m_pad0->read();
break;
case 3:
*odata = ioport("PSXPAD1")->read();
*odata = m_pad1->read();
break;
case 4:
return false;

View File

@ -73,6 +73,9 @@ protected:
virtual void device_config_complete() { m_shortname = "psx_standard_controller"; }
private:
virtual bool get_pad(int count, UINT8 *odata, UINT8 idata);
required_ioport m_pad0;
required_ioport m_pad1;
};
class psxcontrollerports_device : public psxsiodev_device