mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-27 04:25:12 +00:00
fix formatting and add the handle check to scePadRead
This commit is contained in:
parent
5378022215
commit
aa4f032006
@ -322,9 +322,8 @@ int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num) {
|
|||||||
pData[i].angularVelocity.x = states[i].angularVelocity.x;
|
pData[i].angularVelocity.x = states[i].angularVelocity.x;
|
||||||
pData[i].angularVelocity.y = states[i].angularVelocity.y;
|
pData[i].angularVelocity.y = states[i].angularVelocity.y;
|
||||||
pData[i].angularVelocity.z = states[i].angularVelocity.z;
|
pData[i].angularVelocity.z = states[i].angularVelocity.z;
|
||||||
pData[i].orientation = {0.0f, 0.0f, 0.0f, 1.0f};
|
|
||||||
|
|
||||||
if (engine) {
|
if (engine && handle == 1) {
|
||||||
const auto gyro_poll_rate = engine->GetAccelPollRate();
|
const auto gyro_poll_rate = engine->GetAccelPollRate();
|
||||||
if (gyro_poll_rate != 0.0f) {
|
if (gyro_poll_rate != 0.0f) {
|
||||||
auto now = std::chrono::steady_clock::now();
|
auto now = std::chrono::steady_clock::now();
|
||||||
@ -345,6 +344,7 @@ int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num) {
|
|||||||
pData[i].touchData.touchNum =
|
pData[i].touchData.touchNum =
|
||||||
(states[i].touchpad[0].state ? 1 : 0) + (states[i].touchpad[1].state ? 1 : 0);
|
(states[i].touchpad[0].state ? 1 : 0) + (states[i].touchpad[1].state ? 1 : 0);
|
||||||
|
|
||||||
|
if (handle == 1) {
|
||||||
if (controller->GetTouchCount() >= 127) {
|
if (controller->GetTouchCount() >= 127) {
|
||||||
controller->SetTouchCount(0);
|
controller->SetTouchCount(0);
|
||||||
}
|
}
|
||||||
@ -378,6 +378,10 @@ int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num) {
|
|||||||
states[i].touchpad[0].ID = controller->GetTouchCount();
|
states[i].touchpad[0].ID = controller->GetTouchCount();
|
||||||
states[i].touchpad[1].ID = controller->GetSecondaryTouchCount();
|
states[i].touchpad[1].ID = controller->GetSecondaryTouchCount();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
states[i].touchpad[0].ID = 1;
|
||||||
|
states[i].touchpad[1].ID = 2;
|
||||||
|
}
|
||||||
|
|
||||||
pData[i].touchData.touch[0].x = states[i].touchpad[0].x;
|
pData[i].touchData.touch[0].x = states[i].touchpad[0].x;
|
||||||
pData[i].touchData.touch[0].y = states[i].touchpad[0].y;
|
pData[i].touchData.touch[0].y = states[i].touchpad[0].y;
|
||||||
@ -429,6 +433,7 @@ int PS4_SYSV_ABI scePadReadState(s32 handle, OrbisPadData* pData) {
|
|||||||
pData->leftStick.x = state.axes[static_cast<int>(Input::Axis::LeftX)];
|
pData->leftStick.x = state.axes[static_cast<int>(Input::Axis::LeftX)];
|
||||||
pData->leftStick.y = state.axes[static_cast<int>(Input::Axis::LeftY)];
|
pData->leftStick.y = state.axes[static_cast<int>(Input::Axis::LeftY)];
|
||||||
pData->rightStick.x = state.axes[static_cast<int>(Input::Axis::RightX)];
|
pData->rightStick.x = state.axes[static_cast<int>(Input::Axis::RightX)];
|
||||||
|
pData->rightStick.x = state.axes[static_cast<int>(Input::Axis::RightX)];
|
||||||
pData->rightStick.y = state.axes[static_cast<int>(Input::Axis::RightY)];
|
pData->rightStick.y = state.axes[static_cast<int>(Input::Axis::RightY)];
|
||||||
pData->analogButtons.l2 = state.axes[static_cast<int>(Input::Axis::TriggerLeft)];
|
pData->analogButtons.l2 = state.axes[static_cast<int>(Input::Axis::TriggerLeft)];
|
||||||
pData->analogButtons.r2 = state.axes[static_cast<int>(Input::Axis::TriggerRight)];
|
pData->analogButtons.r2 = state.axes[static_cast<int>(Input::Axis::TriggerRight)];
|
||||||
|
Loading…
Reference in New Issue
Block a user