mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-23 03:02:53 +01:00
Resets sleep timer on button press
Adds windows sleep timer reset on ds4 button input Refactoring Shorter version
This commit is contained in:
parent
a38182b967
commit
db9618ac2f
@ -5,6 +5,10 @@
|
||||
#include <thread>
|
||||
#include <cmath>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
const auto THREAD_SLEEP = 1ms; //ds4 has new data every ~4ms,
|
||||
@ -394,6 +398,17 @@ void ds4_pad_handler::ProcessData()
|
||||
pad.m_buttons[12 + i - 4].m_value = pressed ? 255 : 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
for (int i = 6; i < 16; i++)
|
||||
{
|
||||
if (pad.m_buttons[i].m_pressed)
|
||||
{
|
||||
SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// these values come already calibrated from our ds4Thread,
|
||||
// all we need to do is convert to ds3 range
|
||||
|
||||
|
@ -215,6 +215,15 @@ DWORD xinput_pad_handler::ThreadProcedure()
|
||||
pad.m_buttons[j].m_value = pressed ? 255 : 0;
|
||||
}
|
||||
|
||||
for (int i = 6; i < 16; i++)
|
||||
{
|
||||
if (pad.m_buttons[i].m_pressed)
|
||||
{
|
||||
SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pad.m_buttons[XINPUT_GAMEPAD_BUTTONS].m_pressed = state.Gamepad.bLeftTrigger > 0;
|
||||
pad.m_buttons[XINPUT_GAMEPAD_BUTTONS].m_value = state.Gamepad.bLeftTrigger;
|
||||
pad.m_buttons[XINPUT_GAMEPAD_BUTTONS + 1].m_pressed = state.Gamepad.bRightTrigger > 0;
|
||||
|
Loading…
Reference in New Issue
Block a user