limit new gyro and touchpad logic to controller 1

This commit is contained in:
WujekFoliarz 2025-05-29 20:47:04 +02:00
parent b56d666bcd
commit bab1a52ff6

View File

@ -440,7 +440,8 @@ int PS4_SYSV_ABI scePadReadState(s32 handle, OrbisPadData* pData) {
pData->angularVelocity.z = state.angularVelocity.z; pData->angularVelocity.z = state.angularVelocity.z;
pData->orientation = {0.0f, 0.0f, 0.0f, 1.0f}; pData->orientation = {0.0f, 0.0f, 0.0f, 1.0f};
if (engine) { // Only do this on handle 1 for now
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();
@ -455,11 +456,14 @@ int PS4_SYSV_ABI scePadReadState(s32 handle, OrbisPadData* pData) {
deltaTime, lastOrientation, outputOrientation); deltaTime, lastOrientation, outputOrientation);
pData->orientation = outputOrientation; pData->orientation = outputOrientation;
controller->SetLastOrientation(outputOrientation); controller->SetLastOrientation(outputOrientation);
std::cout << pData->orientation.x << std::endl;
} }
} }
pData->touchData.touchNum = pData->touchData.touchNum =
(state.touchpad[0].state ? 1 : 0) + (state.touchpad[1].state ? 1 : 0); (state.touchpad[0].state ? 1 : 0) + (state.touchpad[1].state ? 1 : 0);
// Only do this on handle 1 for now
if(handle == 1) {
if (controller->GetTouchCount() >= 127) { if (controller->GetTouchCount() >= 127) {
controller->SetTouchCount(0); controller->SetTouchCount(0);
} }
@ -493,6 +497,10 @@ int PS4_SYSV_ABI scePadReadState(s32 handle, OrbisPadData* pData) {
state.touchpad[0].ID = controller->GetTouchCount(); state.touchpad[0].ID = controller->GetTouchCount();
state.touchpad[1].ID = controller->GetSecondaryTouchCount(); state.touchpad[1].ID = controller->GetSecondaryTouchCount();
} }
} else {
state.touchpad[0].ID = 1;
state.touchpad[1].ID = 2;
}
pData->touchData.touch[0].x = state.touchpad[0].x; pData->touchData.touch[0].x = state.touchpad[0].x;
pData->touchData.touch[0].y = state.touchpad[0].y; pData->touchData.touch[0].y = state.touchpad[0].y;