r5sdk/r5dev/engine/keys.cpp
Kawe Mazidjatari 735a9e0489 NVIDIA: properly enqueue frame ID
Sync Frame ID between main thread and render thread, this changes makes the integration PASS the reflex test utility.
2024-04-05 17:12:52 +02:00

37 lines
1017 B
C++

#include "keys.h"
#include "windows/id3dx.h"
#include "geforce/reflex.h"
#include <materialsystem/cmaterialsystem.h>
KeyInfo_t* g_pKeyInfo = nullptr;
ButtonCode_t* g_pKeyEventTicks = nullptr;
short* g_nKeyEventCount = nullptr;
bool Input_Event(const InputEvent_t& inputEvent, const int noKeyUpCheck)
{
bool runTriggerMarker = inputEvent.m_nData == ButtonCode_t::MOUSE_LEFT;
const KeyInfo_t& keyInfo = g_pKeyInfo[inputEvent.m_nData];
if (noKeyUpCheck)
{
const int v = (inputEvent.m_nType & 0xFFFFFFFD) == 0;
if (keyInfo.m_nKeyDownTarget == v)
runTriggerMarker = false;
}
if (runTriggerMarker && (inputEvent.m_nType != IE_ButtonReleased || keyInfo.m_bTrapKeyUp))
{
GFX_SetLatencyMarker(D3D11Device(), TRIGGER_FLASH, MaterialSystem()->GetCurrentFrameCount());
}
return v_Input_Event(inputEvent, noKeyUpCheck);
}
///////////////////////////////////////////////////////////////////////////////
void VKeys::Detour(const bool bAttach) const
{
DetourSetup(&v_Input_Event, &Input_Event, bAttach);
}