From 36028645235229ee4c318cbb30cde96f6c57fdbb Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 30 Oct 2023 08:57:43 +0200 Subject: [PATCH] added timestamp in buttons state --- src/Emulator/HLE/Libraries/LibPad/pad.cpp | 2 +- src/Emulator/Host/controller.cpp | 2 ++ src/Emulator/Host/controller.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Emulator/HLE/Libraries/LibPad/pad.cpp b/src/Emulator/HLE/Libraries/LibPad/pad.cpp index d09944c4..1fe2798d 100644 --- a/src/Emulator/HLE/Libraries/LibPad/pad.cpp +++ b/src/Emulator/HLE/Libraries/LibPad/pad.cpp @@ -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; diff --git a/src/Emulator/Host/controller.cpp b/src/Emulator/Host/controller.cpp index 6930c969..f0e00885 100644 --- a/src/Emulator/Host/controller.cpp +++ b/src/Emulator/Host/controller.cpp @@ -1,4 +1,5 @@ #include "controller.h" +#include 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 { diff --git a/src/Emulator/Host/controller.h b/src/Emulator/Host/controller.h index f2c1db8f..f534ed7a 100644 --- a/src/Emulator/Host/controller.h +++ b/src/Emulator/Host/controller.h @@ -5,6 +5,7 @@ namespace Emulator::Host::Controller { struct State { u32 buttonsState =0; + u64 time = 0; }; constexpr u32 MAX_STATES = 64;