mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-15 19:28:43 +12:00
Do not rely on cellPadInit in native ui
This commit is contained in:
parent
2e7e2bb07e
commit
8cbaa8627c
13 changed files with 160 additions and 146 deletions
|
@ -35,16 +35,13 @@ error_code cellPadInit(u32 max_connect)
|
|||
{
|
||||
sys_io.warning("cellPadInit(max_connect=%d)", max_connect);
|
||||
|
||||
auto handler = fxm::get<pad_thread>();
|
||||
|
||||
if (handler)
|
||||
if (fxm::check<pad_t>())
|
||||
return CELL_PAD_ERROR_ALREADY_INITIALIZED;
|
||||
|
||||
if (max_connect == 0 || max_connect > CELL_MAX_PADS)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
handler = fxm::import<pad_thread>(Emu.GetCallbacks().get_pad_handler);
|
||||
handler->Init(std::min(max_connect, (u32)CELL_PAD_MAX_PORT_NUM));
|
||||
fxm::make<pad_t>(std::min(max_connect, (u32)CELL_PAD_MAX_PORT_NUM));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -53,7 +50,7 @@ error_code cellPadEnd()
|
|||
{
|
||||
sys_io.notice("cellPadEnd()");
|
||||
|
||||
if (!fxm::remove<pad_thread>())
|
||||
if (!fxm::remove<pad_t>())
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -63,17 +60,19 @@ error_code cellPadClearBuf(u32 port_no)
|
|||
{
|
||||
sys_io.trace("cellPadClearBuf(port_no=%d)", port_no);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (port_no >= CELL_MAX_PADS)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= config->max_connect)
|
||||
return CELL_PAD_ERROR_NO_DEVICE;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
|
@ -103,20 +102,23 @@ error_code cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
|
|||
{
|
||||
sys_io.trace("cellPadGetData(port_no=%d, data=*0x%x)", port_no, data);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (port_no >= CELL_MAX_PADS || !data)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= config->max_connect)
|
||||
return CELL_PAD_ERROR_NO_DEVICE;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
const auto setting = config->port_setting[port_no];
|
||||
|
||||
if (!(pad->m_port_status & CELL_PAD_STATUS_CONNECTED))
|
||||
return CELL_PAD_ERROR_NO_DEVICE;
|
||||
|
@ -237,7 +239,7 @@ error_code cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
|
|||
}
|
||||
}
|
||||
|
||||
if (pad->m_port_setting & CELL_PAD_SETTING_SENSOR_ON)
|
||||
if (setting & CELL_PAD_SETTING_SENSOR_ON)
|
||||
{
|
||||
for (const AnalogSensor& sensor : pad->m_sensors)
|
||||
{
|
||||
|
@ -269,7 +271,7 @@ error_code cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
|
|||
btnChanged = true;
|
||||
}
|
||||
|
||||
if (pad->m_port_setting & CELL_PAD_SETTING_SENSOR_ON)
|
||||
if (setting & CELL_PAD_SETTING_SENSOR_ON)
|
||||
{
|
||||
// report back new data every ~10 ms even if the input doesn't change
|
||||
// this is observed behaviour when using a Dualshock 3 controller
|
||||
|
@ -289,7 +291,7 @@ error_code cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
|
|||
else if (btnChanged || pad->m_buffer_cleared)
|
||||
{
|
||||
// only give back valid data if a controller state changed
|
||||
data->len = (pad->m_port_setting & CELL_PAD_SETTING_PRESS_ON) ? CELL_PAD_LEN_CHANGE_PRESS_ON : CELL_PAD_LEN_CHANGE_DEFAULT;
|
||||
data->len = (setting & CELL_PAD_SETTING_PRESS_ON) ? CELL_PAD_LEN_CHANGE_PRESS_ON : CELL_PAD_LEN_CHANGE_DEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -313,7 +315,7 @@ error_code cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
|
|||
data->button[CELL_PAD_BTN_OFFSET_ANALOG_LEFT_X] = pad->m_analog_left_x;
|
||||
data->button[CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y] = pad->m_analog_left_y;
|
||||
|
||||
if (pad->m_port_setting & CELL_PAD_SETTING_PRESS_ON)
|
||||
if (setting & CELL_PAD_SETTING_PRESS_ON)
|
||||
{
|
||||
data->button[CELL_PAD_BTN_OFFSET_PRESS_RIGHT] = pad->m_press_right;
|
||||
data->button[CELL_PAD_BTN_OFFSET_PRESS_LEFT] = pad->m_press_left;
|
||||
|
@ -351,11 +353,13 @@ error_code cellPadPeriphGetInfo(vm::ptr<CellPadPeriphInfo> info)
|
|||
{
|
||||
sys_io.trace("cellPadPeriphGetInfo(info=*0x%x)", info);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (!info)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
|
@ -363,7 +367,7 @@ error_code cellPadPeriphGetInfo(vm::ptr<CellPadPeriphInfo> info)
|
|||
|
||||
std::memset(info.get_ptr(), 0, sizeof(CellPadPeriphInfo));
|
||||
|
||||
info->max_connect = rinfo.max_connect;
|
||||
info->max_connect = config->max_connect;
|
||||
info->now_connect = rinfo.now_connect;
|
||||
info->system_info = rinfo.system_info;
|
||||
|
||||
|
@ -372,12 +376,12 @@ error_code cellPadPeriphGetInfo(vm::ptr<CellPadPeriphInfo> info)
|
|||
// TODO: Support other types of controllers
|
||||
for (u32 i = 0; i < CELL_PAD_MAX_PORT_NUM; ++i)
|
||||
{
|
||||
if (i >= pads.size())
|
||||
if (i >= config->max_connect)
|
||||
break;
|
||||
|
||||
info->port_status[i] = pads[i]->m_port_status;
|
||||
pads[i]->m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES;
|
||||
info->port_setting[i] = pads[i]->m_port_setting;
|
||||
info->port_setting[i] = config->port_setting[i];
|
||||
info->device_capability[i] = pads[i]->m_device_capability;
|
||||
info->device_type[i] = pads[i]->m_device_type;
|
||||
info->pclass_type[i] = CELL_PAD_PCLASS_TYPE_STANDARD;
|
||||
|
@ -390,18 +394,21 @@ error_code cellPadPeriphGetInfo(vm::ptr<CellPadPeriphInfo> info)
|
|||
error_code cellPadPeriphGetData(u32 port_no, vm::ptr<CellPadPeriphData> data)
|
||||
{
|
||||
sys_io.trace("cellPadPeriphGetData(port_no=%d, data=*0x%x)", port_no, data);
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
|
||||
if (!handler)
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
// port_no can only be 0-6 in this function
|
||||
if (port_no >= CELL_PAD_MAX_PORT_NUM || !data)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= config->max_connect)
|
||||
return CELL_PAD_ERROR_NO_DEVICE;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
|
@ -420,17 +427,19 @@ error_code cellPadGetRawData(u32 port_no, vm::ptr<CellPadData> data)
|
|||
{
|
||||
sys_io.todo("cellPadGetRawData(port_no=%d, data=*0x%x)", port_no, data);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (port_no >= CELL_MAX_PADS || !data)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= config->max_connect)
|
||||
return CELL_PAD_ERROR_NO_DEVICE;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
|
@ -447,17 +456,19 @@ error_code cellPadGetDataExtra(u32 port_no, vm::ptr<u32> device_type, vm::ptr<Ce
|
|||
{
|
||||
sys_io.trace("cellPadGetDataExtra(port_no=%d, device_type=*0x%x, data=*0x%x)", port_no, device_type, data);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (port_no >= CELL_MAX_PADS || !data)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= config->max_connect)
|
||||
return CELL_PAD_ERROR_NO_DEVICE;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
|
@ -484,17 +495,19 @@ error_code cellPadSetActDirect(u32 port_no, vm::ptr<CellPadActParam> param)
|
|||
{
|
||||
sys_io.trace("cellPadSetActDirect(port_no=%d, param=*0x%x)", port_no, param);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (port_no >= CELL_MAX_PADS || !param)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= config->max_connect)
|
||||
return CELL_PAD_ERROR_NO_DEVICE;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
|
@ -520,18 +533,20 @@ error_code cellPadGetInfo(vm::ptr<CellPadInfo> info)
|
|||
{
|
||||
sys_io.trace("cellPadGetInfo(info=*0x%x)", info);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (!info)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
std::memset(info.get_ptr(), 0, sizeof(CellPadInfo));
|
||||
|
||||
const PadInfo& rinfo = handler->GetInfo();
|
||||
info->max_connect = rinfo.max_connect;
|
||||
info->max_connect = config->max_connect;
|
||||
info->now_connect = rinfo.now_connect;
|
||||
info->system_info = rinfo.system_info;
|
||||
|
||||
|
@ -539,7 +554,7 @@ error_code cellPadGetInfo(vm::ptr<CellPadInfo> info)
|
|||
|
||||
for (u32 i = 0; i < CELL_MAX_PADS; ++i)
|
||||
{
|
||||
if (i >= pads.size())
|
||||
if (i >= config->max_connect)
|
||||
break;
|
||||
|
||||
info->status[i] = pads[i]->m_port_status;
|
||||
|
@ -555,18 +570,20 @@ error_code cellPadGetInfo2(vm::ptr<CellPadInfo2> info)
|
|||
{
|
||||
sys_io.trace("cellPadGetInfo2(info=*0x%x)", info);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (!info)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
std::memset(info.get_ptr(), 0, sizeof(CellPadInfo2));
|
||||
|
||||
const PadInfo& rinfo = handler->GetInfo();
|
||||
info->max_connect = rinfo.max_connect;
|
||||
info->max_connect = config->max_connect;
|
||||
info->now_connect = rinfo.now_connect;
|
||||
info->system_info = rinfo.system_info;
|
||||
|
||||
|
@ -574,12 +591,12 @@ error_code cellPadGetInfo2(vm::ptr<CellPadInfo2> info)
|
|||
|
||||
for (u32 i = 0; i < CELL_PAD_MAX_PORT_NUM; ++i)
|
||||
{
|
||||
if (i >= pads.size())
|
||||
if (i >= config->max_connect)
|
||||
break;
|
||||
|
||||
info->port_status[i] = pads[i]->m_port_status;
|
||||
pads[i]->m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES;
|
||||
info->port_setting[i] = pads[i]->m_port_setting;
|
||||
info->port_setting[i] = config->port_setting[i];
|
||||
info->device_capability[i] = pads[i]->m_device_capability;
|
||||
info->device_type[i] = pads[i]->m_device_type;
|
||||
}
|
||||
|
@ -591,17 +608,19 @@ error_code cellPadGetCapabilityInfo(u32 port_no, vm::ptr<CellPadCapabilityInfo>
|
|||
{
|
||||
sys_io.trace("cellPadGetCapabilityInfo(port_no=%d, data_addr:=0x%x)", port_no, info.addr());
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (port_no >= CELL_MAX_PADS || !info)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= config->max_connect)
|
||||
return CELL_PAD_ERROR_NO_DEVICE;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
|
@ -619,23 +638,21 @@ error_code cellPadSetPortSetting(u32 port_no, u32 port_setting)
|
|||
{
|
||||
sys_io.trace("cellPadSetPortSetting(port_no=%d, port_setting=0x%x)", port_no, port_setting);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (port_no >= CELL_MAX_PADS)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
// CELL_PAD_ERROR_NO_DEVICE is not returned in this case.
|
||||
// TODO: Set the setting regardless
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= CELL_PAD_MAX_PORT_NUM)
|
||||
return CELL_OK;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
pad->m_port_setting = port_setting;
|
||||
config->port_setting[port_no] = port_setting;
|
||||
|
||||
// can also return CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD
|
||||
|
||||
|
@ -646,17 +663,19 @@ s32 cellPadInfoPressMode(u32 port_no)
|
|||
{
|
||||
sys_io.trace("cellPadInfoPressMode(port_no=%d)", port_no);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (port_no >= CELL_MAX_PADS)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= config->max_connect)
|
||||
return CELL_PAD_ERROR_NO_DEVICE;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
|
@ -671,17 +690,19 @@ s32 cellPadInfoSensorMode(u32 port_no)
|
|||
{
|
||||
sys_io.trace("cellPadInfoSensorMode(port_no=%d)", port_no);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (port_no >= CELL_MAX_PADS)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= config->max_connect)
|
||||
return CELL_PAD_ERROR_NO_DEVICE;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
|
@ -696,19 +717,20 @@ error_code cellPadSetPressMode(u32 port_no, u32 mode)
|
|||
{
|
||||
sys_io.trace("cellPadSetPressMode(port_no=%d, mode=%d)", port_no, mode);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
if (port_no >= CELL_MAX_PADS)
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (port_no >= CELL_PAD_MAX_PORT_NUM)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
// CELL_PAD_ERROR_NO_DEVICE is not returned in this case.
|
||||
// TODO: Set the setting regardless
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= CELL_PAD_MAX_PORT_NUM)
|
||||
return CELL_OK;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
|
@ -718,9 +740,9 @@ error_code cellPadSetPressMode(u32 port_no, u32 mode)
|
|||
return CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD;
|
||||
|
||||
if (mode)
|
||||
pad->m_port_setting |= CELL_PAD_SETTING_PRESS_ON;
|
||||
config->port_setting[port_no] |= CELL_PAD_SETTING_PRESS_ON;
|
||||
else
|
||||
pad->m_port_setting &= ~CELL_PAD_SETTING_PRESS_ON;
|
||||
config->port_setting[port_no] &= ~CELL_PAD_SETTING_PRESS_ON;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -729,19 +751,20 @@ error_code cellPadSetSensorMode(u32 port_no, u32 mode)
|
|||
{
|
||||
sys_io.trace("cellPadSetSensorMode(port_no=%d, mode=%d)", port_no, mode);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
const auto config = fxm::get<pad_t>();
|
||||
|
||||
if (!handler)
|
||||
if (!config)
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (port_no >= CELL_MAX_PADS)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
// CELL_PAD_ERROR_NO_DEVICE is not returned in this case.
|
||||
// TODO: Set the setting regardless
|
||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
||||
if (port_no >= CELL_PAD_MAX_PORT_NUM)
|
||||
return CELL_OK;
|
||||
|
||||
const auto pad = pads[port_no];
|
||||
|
@ -751,9 +774,9 @@ error_code cellPadSetSensorMode(u32 port_no, u32 mode)
|
|||
return CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD;
|
||||
|
||||
if (mode)
|
||||
pad->m_port_setting |= CELL_PAD_SETTING_SENSOR_ON;
|
||||
config->port_setting[port_no] |= CELL_PAD_SETTING_SENSOR_ON;
|
||||
else
|
||||
pad->m_port_setting &= ~CELL_PAD_SETTING_SENSOR_ON;
|
||||
config->port_setting[port_no] &= ~CELL_PAD_SETTING_SENSOR_ON;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -762,11 +785,11 @@ error_code cellPadLddRegisterController()
|
|||
{
|
||||
sys_io.todo("cellPadLddRegisterController()");
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
|
||||
if (!handler)
|
||||
if (!fxm::check<pad_t>())
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
// can return CELL_PAD_ERROR_TOO_MANY_DEVICES
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -776,11 +799,11 @@ error_code cellPadLddDataInsert(s32 handle, vm::ptr<CellPadData> data)
|
|||
{
|
||||
sys_io.todo("cellPadLddDataInsert(handle=%d, data=*0x%x)", handle, data);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
|
||||
if (!handler)
|
||||
if (!fxm::check<pad_t>())
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (handle < 0 || !data) // data == NULL stalls on decr
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
|
@ -793,11 +816,11 @@ error_code cellPadLddGetPortNo(s32 handle)
|
|||
{
|
||||
sys_io.todo("cellPadLddGetPortNo(handle=%d)", handle);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
|
||||
if (!handler)
|
||||
if (!fxm::check<pad_t>())
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (handle < 0)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
|
@ -808,11 +831,11 @@ error_code cellPadLddUnregisterController(s32 handle)
|
|||
{
|
||||
sys_io.todo("cellPadLddUnregisterController(handle=%d)", handle);
|
||||
|
||||
const auto handler = fxm::get<pad_thread>();
|
||||
|
||||
if (!handler)
|
||||
if (!fxm::check<pad_t>())
|
||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||
|
||||
const auto handler = pad::get_current_handler();
|
||||
|
||||
if (handle < 0)
|
||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue