mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 00:41:26 +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
|
@ -140,23 +140,16 @@ static bool check_gem_num(const u32 gem_num)
|
||||||
*/
|
*/
|
||||||
static bool map_to_ds3_input(const u32 port_no, be_t<u16>& digital_buttons, be_t<u16>& analog_t)
|
static bool map_to_ds3_input(const u32 port_no, be_t<u16>& digital_buttons, be_t<u16>& analog_t)
|
||||||
{
|
{
|
||||||
const auto handler = fxm::get<pad_thread>();
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (!handler)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const PadInfo& rinfo = handler->GetInfo();
|
const PadInfo& rinfo = handler->GetInfo();
|
||||||
|
|
||||||
if (port_no >= rinfo.max_connect || port_no >= rinfo.now_connect)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& pads = handler->GetPads();
|
auto& pads = handler->GetPads();
|
||||||
auto pad = pads[port_no];
|
auto pad = pads[port_no];
|
||||||
|
|
||||||
|
if (!(pad->m_port_status & CELL_PAD_STATUS_CONNECTED))
|
||||||
|
return false;
|
||||||
|
|
||||||
for (Button& button : pad->m_buttons)
|
for (Button& button : pad->m_buttons)
|
||||||
{
|
{
|
||||||
//here we check btns, and set pad accordingly,
|
//here we check btns, and set pad accordingly,
|
||||||
|
@ -240,30 +233,17 @@ static bool map_to_ds3_input(const u32 port_no, be_t<u16>& digital_buttons, be_t
|
||||||
*/
|
*/
|
||||||
static bool map_ext_to_ds3_input(const u32 port_no, CellGemExtPortData& ext)
|
static bool map_ext_to_ds3_input(const u32 port_no, CellGemExtPortData& ext)
|
||||||
{
|
{
|
||||||
const auto handler = fxm::get<pad_thread>();
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (!handler)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& pads = handler->GetPads();
|
auto& pads = handler->GetPads();
|
||||||
|
|
||||||
const PadInfo& rinfo = handler->GetInfo();
|
const PadInfo& rinfo = handler->GetInfo();
|
||||||
|
|
||||||
if (port_no >= rinfo.max_connect)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//We have a choice here of NO_DEVICE or READ_FAILED...lets try no device for now
|
|
||||||
if (port_no >= rinfo.now_connect)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto pad = pads[port_no];
|
auto pad = pads[port_no];
|
||||||
|
|
||||||
|
if (!(pad->m_port_status & CELL_PAD_STATUS_CONNECTED))
|
||||||
|
return false;
|
||||||
|
|
||||||
ext.status = 0; // CELL_GEM_EXT_CONNECTED | CELL_GEM_EXT_EXT0 | CELL_GEM_EXT_EXT1
|
ext.status = 0; // CELL_GEM_EXT_CONNECTED | CELL_GEM_EXT_EXT0 | CELL_GEM_EXT_EXT1
|
||||||
ext.analog_left_x = pad->m_analog_left_x;
|
ext.analog_left_x = pad->m_analog_left_x;
|
||||||
ext.analog_left_y = pad->m_analog_left_y;
|
ext.analog_left_y = pad->m_analog_left_y;
|
||||||
|
|
|
@ -35,16 +35,13 @@ error_code cellPadInit(u32 max_connect)
|
||||||
{
|
{
|
||||||
sys_io.warning("cellPadInit(max_connect=%d)", max_connect);
|
sys_io.warning("cellPadInit(max_connect=%d)", max_connect);
|
||||||
|
|
||||||
auto handler = fxm::get<pad_thread>();
|
if (fxm::check<pad_t>())
|
||||||
|
|
||||||
if (handler)
|
|
||||||
return CELL_PAD_ERROR_ALREADY_INITIALIZED;
|
return CELL_PAD_ERROR_ALREADY_INITIALIZED;
|
||||||
|
|
||||||
if (max_connect == 0 || max_connect > CELL_MAX_PADS)
|
if (max_connect == 0 || max_connect > CELL_MAX_PADS)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
handler = fxm::import<pad_thread>(Emu.GetCallbacks().get_pad_handler);
|
fxm::make<pad_t>(std::min(max_connect, (u32)CELL_PAD_MAX_PORT_NUM));
|
||||||
handler->Init(std::min(max_connect, (u32)CELL_PAD_MAX_PORT_NUM));
|
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +50,7 @@ error_code cellPadEnd()
|
||||||
{
|
{
|
||||||
sys_io.notice("cellPadEnd()");
|
sys_io.notice("cellPadEnd()");
|
||||||
|
|
||||||
if (!fxm::remove<pad_thread>())
|
if (!fxm::remove<pad_t>())
|
||||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
@ -63,17 +60,19 @@ error_code cellPadClearBuf(u32 port_no)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellPadClearBuf(port_no=%d)", 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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_PADS)
|
if (port_no >= CELL_MAX_PADS)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
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;
|
return CELL_PAD_ERROR_NO_DEVICE;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
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);
|
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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_PADS || !data)
|
if (port_no >= CELL_MAX_PADS || !data)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
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;
|
return CELL_PAD_ERROR_NO_DEVICE;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
const auto pad = pads[port_no];
|
||||||
|
const auto setting = config->port_setting[port_no];
|
||||||
|
|
||||||
if (!(pad->m_port_status & CELL_PAD_STATUS_CONNECTED))
|
if (!(pad->m_port_status & CELL_PAD_STATUS_CONNECTED))
|
||||||
return CELL_PAD_ERROR_NO_DEVICE;
|
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)
|
for (const AnalogSensor& sensor : pad->m_sensors)
|
||||||
{
|
{
|
||||||
|
@ -269,7 +271,7 @@ error_code cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
|
||||||
btnChanged = true;
|
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
|
// report back new data every ~10 ms even if the input doesn't change
|
||||||
// this is observed behaviour when using a Dualshock 3 controller
|
// 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)
|
else if (btnChanged || pad->m_buffer_cleared)
|
||||||
{
|
{
|
||||||
// only give back valid data if a controller state changed
|
// 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
|
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_X] = pad->m_analog_left_x;
|
||||||
data->button[CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y] = pad->m_analog_left_y;
|
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_RIGHT] = pad->m_press_right;
|
||||||
data->button[CELL_PAD_BTN_OFFSET_PRESS_LEFT] = pad->m_press_left;
|
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);
|
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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (!info)
|
if (!info)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
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));
|
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->now_connect = rinfo.now_connect;
|
||||||
info->system_info = rinfo.system_info;
|
info->system_info = rinfo.system_info;
|
||||||
|
|
||||||
|
@ -372,12 +376,12 @@ error_code cellPadPeriphGetInfo(vm::ptr<CellPadPeriphInfo> info)
|
||||||
// TODO: Support other types of controllers
|
// TODO: Support other types of controllers
|
||||||
for (u32 i = 0; i < CELL_PAD_MAX_PORT_NUM; ++i)
|
for (u32 i = 0; i < CELL_PAD_MAX_PORT_NUM; ++i)
|
||||||
{
|
{
|
||||||
if (i >= pads.size())
|
if (i >= config->max_connect)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
info->port_status[i] = pads[i]->m_port_status;
|
info->port_status[i] = pads[i]->m_port_status;
|
||||||
pads[i]->m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES;
|
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_capability[i] = pads[i]->m_device_capability;
|
||||||
info->device_type[i] = pads[i]->m_device_type;
|
info->device_type[i] = pads[i]->m_device_type;
|
||||||
info->pclass_type[i] = CELL_PAD_PCLASS_TYPE_STANDARD;
|
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)
|
error_code cellPadPeriphGetData(u32 port_no, vm::ptr<CellPadPeriphData> data)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellPadPeriphGetData(port_no=%d, data=*0x%x)", port_no, 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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
// port_no can only be 0-6 in this function
|
// port_no can only be 0-6 in this function
|
||||||
if (port_no >= CELL_PAD_MAX_PORT_NUM || !data)
|
if (port_no >= CELL_PAD_MAX_PORT_NUM || !data)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
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;
|
return CELL_PAD_ERROR_NO_DEVICE;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
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);
|
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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_PADS || !data)
|
if (port_no >= CELL_MAX_PADS || !data)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
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;
|
return CELL_PAD_ERROR_NO_DEVICE;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
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);
|
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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_PADS || !data)
|
if (port_no >= CELL_MAX_PADS || !data)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
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;
|
return CELL_PAD_ERROR_NO_DEVICE;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
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);
|
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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_PADS || !param)
|
if (port_no >= CELL_MAX_PADS || !param)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
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;
|
return CELL_PAD_ERROR_NO_DEVICE;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
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);
|
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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (!info)
|
if (!info)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
std::memset(info.get_ptr(), 0, sizeof(CellPadInfo));
|
std::memset(info.get_ptr(), 0, sizeof(CellPadInfo));
|
||||||
|
|
||||||
const PadInfo& rinfo = handler->GetInfo();
|
const PadInfo& rinfo = handler->GetInfo();
|
||||||
info->max_connect = rinfo.max_connect;
|
info->max_connect = config->max_connect;
|
||||||
info->now_connect = rinfo.now_connect;
|
info->now_connect = rinfo.now_connect;
|
||||||
info->system_info = rinfo.system_info;
|
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)
|
for (u32 i = 0; i < CELL_MAX_PADS; ++i)
|
||||||
{
|
{
|
||||||
if (i >= pads.size())
|
if (i >= config->max_connect)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
info->status[i] = pads[i]->m_port_status;
|
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);
|
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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (!info)
|
if (!info)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
std::memset(info.get_ptr(), 0, sizeof(CellPadInfo2));
|
std::memset(info.get_ptr(), 0, sizeof(CellPadInfo2));
|
||||||
|
|
||||||
const PadInfo& rinfo = handler->GetInfo();
|
const PadInfo& rinfo = handler->GetInfo();
|
||||||
info->max_connect = rinfo.max_connect;
|
info->max_connect = config->max_connect;
|
||||||
info->now_connect = rinfo.now_connect;
|
info->now_connect = rinfo.now_connect;
|
||||||
info->system_info = rinfo.system_info;
|
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)
|
for (u32 i = 0; i < CELL_PAD_MAX_PORT_NUM; ++i)
|
||||||
{
|
{
|
||||||
if (i >= pads.size())
|
if (i >= config->max_connect)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
info->port_status[i] = pads[i]->m_port_status;
|
info->port_status[i] = pads[i]->m_port_status;
|
||||||
pads[i]->m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES;
|
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_capability[i] = pads[i]->m_device_capability;
|
||||||
info->device_type[i] = pads[i]->m_device_type;
|
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());
|
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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_PADS || !info)
|
if (port_no >= CELL_MAX_PADS || !info)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
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;
|
return CELL_PAD_ERROR_NO_DEVICE;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
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);
|
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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_PADS)
|
if (port_no >= CELL_MAX_PADS)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
|
||||||
|
|
||||||
// CELL_PAD_ERROR_NO_DEVICE is not returned in this case.
|
// CELL_PAD_ERROR_NO_DEVICE is not returned in this case.
|
||||||
// TODO: Set the setting regardless
|
if (port_no >= CELL_PAD_MAX_PORT_NUM)
|
||||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
config->port_setting[port_no] = port_setting;
|
||||||
pad->m_port_setting = port_setting;
|
|
||||||
|
|
||||||
// can also return CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD
|
// 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);
|
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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_PADS)
|
if (port_no >= CELL_MAX_PADS)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
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;
|
return CELL_PAD_ERROR_NO_DEVICE;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
const auto pad = pads[port_no];
|
||||||
|
@ -671,17 +690,19 @@ s32 cellPadInfoSensorMode(u32 port_no)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellPadInfoSensorMode(port_no=%d)", 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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_PADS)
|
if (port_no >= CELL_MAX_PADS)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
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;
|
return CELL_PAD_ERROR_NO_DEVICE;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
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);
|
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;
|
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;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
const auto& pads = handler->GetPads();
|
||||||
|
|
||||||
// CELL_PAD_ERROR_NO_DEVICE is not returned in this case.
|
// CELL_PAD_ERROR_NO_DEVICE is not returned in this case.
|
||||||
// TODO: Set the setting regardless
|
if (port_no >= CELL_PAD_MAX_PORT_NUM)
|
||||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
const auto pad = pads[port_no];
|
||||||
|
@ -718,9 +740,9 @@ error_code cellPadSetPressMode(u32 port_no, u32 mode)
|
||||||
return CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD;
|
return CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD;
|
||||||
|
|
||||||
if (mode)
|
if (mode)
|
||||||
pad->m_port_setting |= CELL_PAD_SETTING_PRESS_ON;
|
config->port_setting[port_no] |= CELL_PAD_SETTING_PRESS_ON;
|
||||||
else
|
else
|
||||||
pad->m_port_setting &= ~CELL_PAD_SETTING_PRESS_ON;
|
config->port_setting[port_no] &= ~CELL_PAD_SETTING_PRESS_ON;
|
||||||
|
|
||||||
return CELL_OK;
|
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);
|
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;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_PADS)
|
if (port_no >= CELL_MAX_PADS)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
const auto& pads = handler->GetPads();
|
const auto& pads = handler->GetPads();
|
||||||
|
|
||||||
// CELL_PAD_ERROR_NO_DEVICE is not returned in this case.
|
// CELL_PAD_ERROR_NO_DEVICE is not returned in this case.
|
||||||
// TODO: Set the setting regardless
|
if (port_no >= CELL_PAD_MAX_PORT_NUM)
|
||||||
if (port_no >= pads.size() || port_no >= handler->GetInfo().max_connect)
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
|
||||||
const auto pad = pads[port_no];
|
const auto pad = pads[port_no];
|
||||||
|
@ -751,9 +774,9 @@ error_code cellPadSetSensorMode(u32 port_no, u32 mode)
|
||||||
return CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD;
|
return CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD;
|
||||||
|
|
||||||
if (mode)
|
if (mode)
|
||||||
pad->m_port_setting |= CELL_PAD_SETTING_SENSOR_ON;
|
config->port_setting[port_no] |= CELL_PAD_SETTING_SENSOR_ON;
|
||||||
else
|
else
|
||||||
pad->m_port_setting &= ~CELL_PAD_SETTING_SENSOR_ON;
|
config->port_setting[port_no] &= ~CELL_PAD_SETTING_SENSOR_ON;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
@ -762,11 +785,11 @@ error_code cellPadLddRegisterController()
|
||||||
{
|
{
|
||||||
sys_io.todo("cellPadLddRegisterController()");
|
sys_io.todo("cellPadLddRegisterController()");
|
||||||
|
|
||||||
const auto handler = fxm::get<pad_thread>();
|
if (!fxm::check<pad_t>())
|
||||||
|
|
||||||
if (!handler)
|
|
||||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
// can return CELL_PAD_ERROR_TOO_MANY_DEVICES
|
// can return CELL_PAD_ERROR_TOO_MANY_DEVICES
|
||||||
|
|
||||||
return CELL_OK;
|
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);
|
sys_io.todo("cellPadLddDataInsert(handle=%d, data=*0x%x)", handle, data);
|
||||||
|
|
||||||
const auto handler = fxm::get<pad_thread>();
|
if (!fxm::check<pad_t>())
|
||||||
|
|
||||||
if (!handler)
|
|
||||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (handle < 0 || !data) // data == NULL stalls on decr
|
if (handle < 0 || !data) // data == NULL stalls on decr
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
@ -793,11 +816,11 @@ error_code cellPadLddGetPortNo(s32 handle)
|
||||||
{
|
{
|
||||||
sys_io.todo("cellPadLddGetPortNo(handle=%d)", handle);
|
sys_io.todo("cellPadLddGetPortNo(handle=%d)", handle);
|
||||||
|
|
||||||
const auto handler = fxm::get<pad_thread>();
|
if (!fxm::check<pad_t>())
|
||||||
|
|
||||||
if (!handler)
|
|
||||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (handle < 0)
|
if (handle < 0)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
@ -808,11 +831,11 @@ error_code cellPadLddUnregisterController(s32 handle)
|
||||||
{
|
{
|
||||||
sys_io.todo("cellPadLddUnregisterController(handle=%d)", handle);
|
sys_io.todo("cellPadLddUnregisterController(handle=%d)", handle);
|
||||||
|
|
||||||
const auto handler = fxm::get<pad_thread>();
|
if (!fxm::check<pad_t>())
|
||||||
|
|
||||||
if (!handler)
|
|
||||||
return CELL_PAD_ERROR_UNINITIALIZED;
|
return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
const auto handler = pad::get_current_handler();
|
||||||
|
|
||||||
if (handle < 0)
|
if (handle < 0)
|
||||||
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "Emu/Io/PadHandler.h"
|
||||||
|
#include <array>
|
||||||
|
|
||||||
enum CellPadError : u32
|
enum CellPadError : u32
|
||||||
{
|
{
|
||||||
|
@ -92,4 +93,16 @@ struct CellPadActParam
|
||||||
{
|
{
|
||||||
u8 motor[CELL_PAD_ACTUATOR_MAX];
|
u8 motor[CELL_PAD_ACTUATOR_MAX];
|
||||||
u8 reserved[6];
|
u8 reserved[6];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct pad_t
|
||||||
|
{
|
||||||
|
u32 max_connect;
|
||||||
|
std::array<u32, CELL_PAD_MAX_PORT_NUM> port_setting;
|
||||||
|
|
||||||
|
pad_t(u32 max_connect)
|
||||||
|
: max_connect(max_connect)
|
||||||
|
{
|
||||||
|
port_setting.fill(CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -162,7 +162,6 @@ struct Pad
|
||||||
{
|
{
|
||||||
bool m_buffer_cleared;
|
bool m_buffer_cleared;
|
||||||
u32 m_port_status;
|
u32 m_port_status;
|
||||||
u32 m_port_setting;
|
|
||||||
u32 m_device_capability;
|
u32 m_device_capability;
|
||||||
u32 m_device_type;
|
u32 m_device_type;
|
||||||
|
|
||||||
|
@ -208,18 +207,16 @@ struct Pad
|
||||||
u16 m_sensor_z;
|
u16 m_sensor_z;
|
||||||
u16 m_sensor_g;
|
u16 m_sensor_g;
|
||||||
|
|
||||||
void Init(u32 port_status, u32 port_setting, u32 device_capability, u32 device_type)
|
void Init(u32 port_status, u32 device_capability, u32 device_type)
|
||||||
{
|
{
|
||||||
m_port_status = port_status;
|
m_port_status = port_status;
|
||||||
m_port_setting = port_setting;
|
|
||||||
m_device_capability = device_capability;
|
m_device_capability = device_capability;
|
||||||
m_device_type = device_type;
|
m_device_type = device_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pad(u32 port_status, u32 port_setting, u32 device_capability, u32 device_type)
|
Pad(u32 port_status, u32 device_capability, u32 device_type)
|
||||||
: m_buffer_cleared(true)
|
: m_buffer_cleared(true)
|
||||||
, m_port_status(port_status)
|
, m_port_status(port_status)
|
||||||
, m_port_setting(port_setting)
|
|
||||||
, m_device_capability(device_capability)
|
, m_device_capability(device_capability)
|
||||||
, m_device_type(device_type)
|
, m_device_type(device_type)
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace rsx
|
||||||
|
|
||||||
s32 run_input_loop()
|
s32 run_input_loop()
|
||||||
{
|
{
|
||||||
const auto handler = fxm::get<pad_thread>();
|
const auto handler = pad::get_current_handler();
|
||||||
if (!handler)
|
if (!handler)
|
||||||
{
|
{
|
||||||
LOG_ERROR(RSX, "Pad handler expected but none initialized!");
|
LOG_ERROR(RSX, "Pad handler expected but none initialized!");
|
||||||
|
@ -90,8 +90,6 @@ namespace rsx
|
||||||
}
|
}
|
||||||
|
|
||||||
const PadInfo& rinfo = handler->GetInfo();
|
const PadInfo& rinfo = handler->GetInfo();
|
||||||
if (rinfo.max_connect == 0)
|
|
||||||
return selection_code::error;
|
|
||||||
|
|
||||||
std::array<std::chrono::steady_clock::time_point, CELL_PAD_MAX_PORT_NUM> timestamp;
|
std::array<std::chrono::steady_clock::time_point, CELL_PAD_MAX_PORT_NUM> timestamp;
|
||||||
timestamp.fill(std::chrono::steady_clock::now());
|
timestamp.fill(std::chrono::steady_clock::now());
|
||||||
|
|
|
@ -1196,6 +1196,7 @@ void Emulator::Load(bool add_only)
|
||||||
ppu_load_exec(ppu_exec);
|
ppu_load_exec(ppu_exec);
|
||||||
|
|
||||||
fxm::import<GSRender>(Emu.GetCallbacks().get_gs_render); // TODO: must be created in appropriate sys_rsx syscall
|
fxm::import<GSRender>(Emu.GetCallbacks().get_gs_render); // TODO: must be created in appropriate sys_rsx syscall
|
||||||
|
fxm::import<pad_thread>(Emu.GetCallbacks().get_pad_handler);
|
||||||
network_thread_init();
|
network_thread_init();
|
||||||
}
|
}
|
||||||
else if (ppu_prx.open(elf_file) == elf_error::ok)
|
else if (ppu_prx.open(elf_file) == elf_error::ok)
|
||||||
|
|
|
@ -792,7 +792,6 @@ bool ds4_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::strin
|
||||||
pad->Init
|
pad->Init
|
||||||
(
|
(
|
||||||
CELL_PAD_STATUS_DISCONNECTED,
|
CELL_PAD_STATUS_DISCONNECTED,
|
||||||
CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF,
|
|
||||||
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
|
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
|
||||||
CELL_PAD_DEV_TYPE_STANDARD
|
CELL_PAD_DEV_TYPE_STANDARD
|
||||||
);
|
);
|
||||||
|
|
|
@ -938,7 +938,6 @@ bool evdev_joystick_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std
|
||||||
pad->Init
|
pad->Init
|
||||||
(
|
(
|
||||||
CELL_PAD_STATUS_DISCONNECTED,
|
CELL_PAD_STATUS_DISCONNECTED,
|
||||||
CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF,
|
|
||||||
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
|
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
|
||||||
CELL_PAD_DEV_TYPE_STANDARD
|
CELL_PAD_DEV_TYPE_STANDARD
|
||||||
);
|
);
|
||||||
|
|
|
@ -527,7 +527,6 @@ bool keyboard_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::
|
||||||
pad->Init
|
pad->Init
|
||||||
(
|
(
|
||||||
CELL_PAD_STATUS_DISCONNECTED,
|
CELL_PAD_STATUS_DISCONNECTED,
|
||||||
CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF,
|
|
||||||
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
|
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
|
||||||
CELL_PAD_DEV_TYPE_STANDARD
|
CELL_PAD_DEV_TYPE_STANDARD
|
||||||
);
|
);
|
||||||
|
|
|
@ -147,7 +147,6 @@ bool mm_joystick_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::s
|
||||||
pad->Init
|
pad->Init
|
||||||
(
|
(
|
||||||
CELL_PAD_STATUS_DISCONNECTED,
|
CELL_PAD_STATUS_DISCONNECTED,
|
||||||
CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF,
|
|
||||||
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
|
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
|
||||||
CELL_PAD_DEV_TYPE_STANDARD
|
CELL_PAD_DEV_TYPE_STANDARD
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "pad_thread.h"
|
#include "pad_thread.h"
|
||||||
#include "ds4_pad_handler.h"
|
#include "ds4_pad_handler.h"
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "xinput_pad_handler.h"
|
#include "xinput_pad_handler.h"
|
||||||
|
@ -9,24 +9,14 @@
|
||||||
#include "keyboard_pad_handler.h"
|
#include "keyboard_pad_handler.h"
|
||||||
#include "Emu/Io/Null/NullPadHandler.h"
|
#include "Emu/Io/Null/NullPadHandler.h"
|
||||||
|
|
||||||
|
namespace pad
|
||||||
|
{
|
||||||
|
atomic_t<pad_thread*> g_current = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
pad_thread::pad_thread(void *_curthread, void *_curwindow) : curthread(_curthread), curwindow(_curwindow)
|
pad_thread::pad_thread(void *_curthread, void *_curwindow) : curthread(_curthread), curwindow(_curwindow)
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pad_thread::~pad_thread()
|
|
||||||
{
|
|
||||||
active = false;
|
|
||||||
thread->join();
|
|
||||||
|
|
||||||
handlers.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void pad_thread::Init(const u32 max_connect)
|
|
||||||
{
|
{
|
||||||
std::memset(&m_info, 0, sizeof(m_info));
|
std::memset(&m_info, 0, sizeof(m_info));
|
||||||
m_info.max_connect = std::min(max_connect, (u32)7); // max 7 pads
|
|
||||||
m_info.now_connect = 0;
|
m_info.now_connect = 0;
|
||||||
|
|
||||||
g_cfg_input.load();
|
g_cfg_input.load();
|
||||||
|
@ -37,7 +27,7 @@ void pad_thread::Init(const u32 max_connect)
|
||||||
std::shared_ptr<NullPadHandler> nullpad = std::make_shared<NullPadHandler>();
|
std::shared_ptr<NullPadHandler> nullpad = std::make_shared<NullPadHandler>();
|
||||||
handlers.emplace(pad_handler::null, nullpad);
|
handlers.emplace(pad_handler::null, nullpad);
|
||||||
|
|
||||||
for (u32 i = 0; i < m_info.max_connect; i++)
|
for (u32 i = 0; i < 7 /* Max 7 pads */; i++)
|
||||||
{
|
{
|
||||||
std::shared_ptr<PadHandlerBase> cur_pad_handler;
|
std::shared_ptr<PadHandlerBase> cur_pad_handler;
|
||||||
|
|
||||||
|
@ -82,7 +72,6 @@ void pad_thread::Init(const u32 max_connect)
|
||||||
|
|
||||||
m_pads.push_back(std::make_shared<Pad>(
|
m_pads.push_back(std::make_shared<Pad>(
|
||||||
CELL_PAD_STATUS_DISCONNECTED,
|
CELL_PAD_STATUS_DISCONNECTED,
|
||||||
CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF,
|
|
||||||
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_ACTUATOR,
|
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_ACTUATOR,
|
||||||
CELL_PAD_DEV_TYPE_STANDARD));
|
CELL_PAD_DEV_TYPE_STANDARD));
|
||||||
|
|
||||||
|
@ -95,6 +84,16 @@ void pad_thread::Init(const u32 max_connect)
|
||||||
}
|
}
|
||||||
|
|
||||||
thread = std::make_shared<std::thread>(&pad_thread::ThreadFunc, this);
|
thread = std::make_shared<std::thread>(&pad_thread::ThreadFunc, this);
|
||||||
|
pad::g_current = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
pad_thread::~pad_thread()
|
||||||
|
{
|
||||||
|
pad::g_current = nullptr;
|
||||||
|
active = false;
|
||||||
|
thread->join();
|
||||||
|
|
||||||
|
handlers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pad_thread::SetRumble(const u32 pad, u8 largeMotor, bool smallMotor)
|
void pad_thread::SetRumble(const u32 pad, u8 largeMotor, bool smallMotor)
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
struct PadInfo
|
struct PadInfo
|
||||||
{
|
{
|
||||||
u32 max_connect;
|
|
||||||
u32 now_connect;
|
u32 now_connect;
|
||||||
u32 system_info;
|
u32 system_info;
|
||||||
};
|
};
|
||||||
|
@ -19,7 +18,6 @@ public:
|
||||||
pad_thread(void *_curthread, void *_curwindow); // void * instead of QThread * and QWindow * because of include in emucore
|
pad_thread(void *_curthread, void *_curwindow); // void * instead of QThread * and QWindow * because of include in emucore
|
||||||
~pad_thread();
|
~pad_thread();
|
||||||
|
|
||||||
void Init(const u32 max_connect);
|
|
||||||
PadInfo& GetInfo() { return m_info; }
|
PadInfo& GetInfo() { return m_info; }
|
||||||
std::vector<std::shared_ptr<Pad>>& GetPads() { return m_pads; }
|
std::vector<std::shared_ptr<Pad>>& GetPads() { return m_pads; }
|
||||||
void SetRumble(const u32 pad, u8 largeMotor, bool smallMotor);
|
void SetRumble(const u32 pad, u8 largeMotor, bool smallMotor);
|
||||||
|
@ -40,3 +38,13 @@ protected:
|
||||||
bool active;
|
bool active;
|
||||||
std::shared_ptr<std::thread> thread;
|
std::shared_ptr<std::thread> thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace pad
|
||||||
|
{
|
||||||
|
extern atomic_t<pad_thread*> g_current;
|
||||||
|
|
||||||
|
static inline class pad_thread* get_current_handler()
|
||||||
|
{
|
||||||
|
return verify(HERE, g_current.load());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -480,7 +480,6 @@ bool xinput_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::st
|
||||||
pad->Init
|
pad->Init
|
||||||
(
|
(
|
||||||
CELL_PAD_STATUS_DISCONNECTED,
|
CELL_PAD_STATUS_DISCONNECTED,
|
||||||
CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF,
|
|
||||||
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
|
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
|
||||||
CELL_PAD_DEV_TYPE_STANDARD
|
CELL_PAD_DEV_TYPE_STANDARD
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue