mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
NVIDIA: add TRIGGER_FLASH marker to input event handler
This commit is contained in:
parent
0e62280896
commit
6575f80447
@ -1,5 +1,35 @@
|
||||
#include "keys.h"
|
||||
#include "windows/id3dx.h"
|
||||
#include "geforce/reflex.h"
|
||||
|
||||
KeyInfo_t* g_pKeyInfo = nullptr;
|
||||
ButtonCode_t* g_pKeyEventTicks = nullptr;
|
||||
short* g_nKeyEventCount = 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);
|
||||
}
|
||||
|
||||
return v_Input_Event(inputEvent, noKeyUpCheck);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VKeys::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourSetup(&v_Input_Event, &Input_Event, bAttach);
|
||||
}
|
||||
|
@ -35,13 +35,14 @@ struct KeyInfo_t
|
||||
|
||||
bool m_bKeyDown;
|
||||
bool m_bEventIsButtonKey; // Is the event a button key (< ButtonCode_t::KEY_LAST)
|
||||
bool m_bBoundKeyDown;
|
||||
bool m_bTrapKeyUp;
|
||||
bool m_bBoundSecondKey; // Is the key bound to the second row?
|
||||
|
||||
short paddingMaybe;
|
||||
};
|
||||
|
||||
inline bool(*Key_Event)(const KeyEvent_t& keyEvent);
|
||||
inline bool (*v_Input_Event)(const InputEvent_t& inputEvent, const int noKeyUpCheck);
|
||||
inline bool(*v_Key_Event)(const KeyEvent_t& keyEvent);
|
||||
|
||||
extern KeyInfo_t* g_pKeyInfo; // ARRAYSIZE = ButtonCode_t::BUTTON_CODE_LAST
|
||||
extern ButtonCode_t* g_pKeyEventTicks; // ARRAYSIZE = ButtonCode_t::BUTTON_CODE_LAST
|
||||
@ -51,14 +52,16 @@ class VKeys : public IDetour
|
||||
{
|
||||
virtual void GetAdr(void) const
|
||||
{
|
||||
LogFunAdr("Key_Event", reinterpret_cast<uintptr_t>(Key_Event));
|
||||
LogFunAdr("Input_Event", reinterpret_cast<uintptr_t>(v_Input_Event));
|
||||
LogFunAdr("Key_Event", reinterpret_cast<uintptr_t>(v_Key_Event));
|
||||
LogVarAdr("g_pKeyInfo", reinterpret_cast<uintptr_t>(g_pKeyInfo));
|
||||
LogVarAdr("g_pKeyEventTicks", reinterpret_cast<uintptr_t>(g_pKeyEventTicks));
|
||||
LogVarAdr("g_nKeyEventCount", reinterpret_cast<uintptr_t>(g_nKeyEventCount));
|
||||
}
|
||||
virtual void GetFun(void) const
|
||||
{
|
||||
Key_Event = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 4C 63 41 08").RCast<bool(*)(const KeyEvent_t&)>();
|
||||
g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 55 41 54 41 56", v_Input_Event);
|
||||
g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 4C 63 41 08", v_Key_Event);
|
||||
}
|
||||
virtual void GetVar(void) const
|
||||
{
|
||||
@ -72,7 +75,7 @@ class VKeys : public IDetour
|
||||
g_pKeyEventTicks = l_EngineApi_PumpMessages.FindPatternSelf("48 8D 35").ResolveRelativeAddressSelf(3, 7).RCast<ButtonCode_t*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
|
||||
#endif // ENGINE_KEYS_H
|
||||
|
@ -174,7 +174,7 @@ void CEngineAPI::PumpMessages()
|
||||
if (in_syncRT->GetBool())
|
||||
(*g_fnSyncRTWithIn)();
|
||||
|
||||
g_pInputSystem->PollInputState(UIInputEventHandler);
|
||||
g_pInputSystem->PollInputState(v_UIInputEventHandler);
|
||||
g_pGame->DispatchAllStoredGameMessages();
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ void CGame::DispatchKeyEvent(const uint64_t msTime, const ButtonCode_t buttonCod
|
||||
keyEvent.m_nTick = buttonCode;
|
||||
keyEvent.m_bDown = true;
|
||||
|
||||
Key_Event(keyEvent);
|
||||
v_Key_Event(keyEvent);
|
||||
keyInfo.m_bKeyDown = true;
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ inline void*(*CEngineVGui_RenderStart)(CMatSystemSurface* pMatSystemSurface);
|
||||
inline CMemory p_CEngineVGui_RenderEnd;
|
||||
inline void*(*CEngineVGui_RenderEnd)(void);
|
||||
|
||||
inline InputEventCallback_t UIInputEventHandler = nullptr;
|
||||
inline InputEventCallback_t v_UIInputEventHandler = nullptr;
|
||||
inline CEngineVGui* g_pEngineVGui = nullptr;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -97,7 +97,7 @@ class VEngineVGui : public IDetour
|
||||
LogFunAdr("CEngineVGui::Paint", p_CEngineVGui_Paint.GetPtr());
|
||||
LogFunAdr("CEngineVGui::RenderStart", p_CEngineVGui_RenderStart.GetPtr());
|
||||
LogFunAdr("CEngineVGui::RenderEnd", p_CEngineVGui_RenderEnd.GetPtr());
|
||||
LogFunAdr("UIInputEventHandler", reinterpret_cast<uintptr_t>(UIInputEventHandler));
|
||||
LogFunAdr("UIInputEventHandler", reinterpret_cast<uintptr_t>(v_UIInputEventHandler));
|
||||
LogVarAdr("g_pEngineVGui", reinterpret_cast<uintptr_t>(g_pEngineVGui));
|
||||
}
|
||||
virtual void GetFun(void) const
|
||||
@ -118,7 +118,7 @@ class VEngineVGui : public IDetour
|
||||
p_CEngineVGui_RenderEnd = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 48 8B 0D ?? ?? ?? ?? C6 05 ?? ?? ?? ?? ?? 48 8B 01");
|
||||
CEngineVGui_RenderEnd = p_CEngineVGui_RenderEnd.RCast<void* (*)(void)>(); /*40 53 48 83 EC 20 48 8B 0D ?? ?? ?? ?? C6 05 ?? ?? ?? ?? ?? 48 8B 01*/
|
||||
|
||||
UIInputEventHandler = g_GameDll.FindPatternSIMD("40 53 48 83 EC 40 48 63 01").RCast<InputEventCallback_t>();
|
||||
g_GameDll.FindPatternSIMD("40 53 48 83 EC 40 48 63 01", v_UIInputEventHandler);
|
||||
}
|
||||
virtual void GetVar(void) const
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user