added timestamp in buttons state

This commit is contained in:
georgemoralis 2023-10-30 08:57:43 +02:00
parent 758ef332f2
commit 3602864523
3 changed files with 4 additions and 1 deletions

View File

@ -38,7 +38,7 @@ int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) {
pData->orientation.y = 0;
pData->orientation.z = 0;
pData->orientation.w = 0;
pData->timestamp = state.time;
pData->connected = true; // isConnected; //TODO fix me proper
pData->connectedCount = 1;//connectedCount;
pData->deviceUniqueDataLen = 0;

View File

@ -1,4 +1,5 @@
#include "controller.h"
#include <Core/hle/libraries/libkernel/time_management.h>
namespace Emulator::Host::Controller {
GameController::GameController() { m_states_num = 0;
@ -39,6 +40,7 @@ void GameController::addState(const State& state) {
void GameController::checKButton(int id, u32 button, bool isPressed) {
std::scoped_lock lock{m_mutex};
auto state = getLastState();
state.time = Core::Libraries::sceKernelGetProcessTime();
if (isPressed) {
state.buttonsState |= button;
} else {

View File

@ -5,6 +5,7 @@
namespace Emulator::Host::Controller {
struct State {
u32 buttonsState =0;
u64 time = 0;
};
constexpr u32 MAX_STATES = 64;