2022-04-09 06:05:47 +02:00
|
|
|
//===========================================================================//
|
|
|
|
//
|
|
|
|
// Purpose:
|
|
|
|
//
|
|
|
|
//===========================================================================//
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
#include "core/stdafx.h"
|
|
|
|
#include "vpc/IAppSystem.h"
|
2023-12-24 20:38:50 +01:00
|
|
|
#include "windows/id3dx.h"
|
|
|
|
#include "geforce/reflex.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
#include "inputsystem/inputsystem.h"
|
2023-12-25 19:23:01 +01:00
|
|
|
#include <materialsystem/cmaterialsystem.h>
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2024-04-05 17:09:47 +02:00
|
|
|
////-----------------------------------------------------------------------------
|
|
|
|
//// Enables/disables input
|
|
|
|
////-----------------------------------------------------------------------------
|
|
|
|
//void CInputSystem::EnableInput(bool bEnabled)
|
|
|
|
//{
|
|
|
|
// const static int index = 10;
|
|
|
|
// CallVFunc<void>(index, this, bEnabled);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
////-----------------------------------------------------------------------------
|
|
|
|
//// Enables/disables the inputsystem windows message pump
|
|
|
|
////-----------------------------------------------------------------------------
|
|
|
|
//void CInputSystem::EnableMessagePump(bool bEnabled)
|
|
|
|
//{
|
|
|
|
// const static int index = 11;
|
|
|
|
// CallVFunc<void>(index, this, bEnabled);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
////-----------------------------------------------------------------------------
|
|
|
|
//// Poll current state
|
|
|
|
////-----------------------------------------------------------------------------
|
|
|
|
//bool CInputSystem::IsButtonDown(ButtonCode_t Button)
|
|
|
|
//{
|
|
|
|
// const static int index = 13;
|
|
|
|
// return CallVFunc<bool>(index, this, Button);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
////-----------------------------------------------------------------------------
|
|
|
|
//// Convert back + forth between ButtonCode/AnalogCode + strings
|
|
|
|
////-----------------------------------------------------------------------------
|
|
|
|
//bool CInputSystem::ButtonCodeToString(ButtonCode_t Button)
|
|
|
|
//{
|
|
|
|
// const static int index = 25;
|
|
|
|
// return CallVFunc<bool>(index, this, Button);
|
|
|
|
//}
|
|
|
|
//ButtonCode_t CInputSystem::StringToButtonCode(const char* pString)
|
|
|
|
//{
|
|
|
|
// const static int index = 26;
|
|
|
|
// return CallVFunc<ButtonCode_t>(index, this, pString);
|
|
|
|
//}
|
2022-11-10 15:32:56 +01:00
|
|
|
|
2023-12-24 20:38:50 +01:00
|
|
|
LRESULT CInputSystem::WindowProc(void* unused, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
if (g_pInputSystem->m_bEnabled &&
|
|
|
|
((hwnd == g_pInputSystem->m_hAttachedHWnd) || (uMsg == WM_ACTIVATEAPP)) &&
|
|
|
|
(uMsg != WM_CLOSE))
|
|
|
|
{
|
|
|
|
if (PCLSTATS_IS_PING_MSG_ID(uMsg))
|
|
|
|
{
|
2023-12-25 19:23:01 +01:00
|
|
|
GFX_SetLatencyMarker(D3D11Device(), PC_LATENCY_PING, MaterialSystem()->GetCurrentFrameCount());
|
2023-12-24 20:38:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-02 15:21:36 +01:00
|
|
|
return CInputSystem__WindowProc(unused, hwnd, uMsg, wParam, lParam);
|
2023-12-24 20:38:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void VInputSystem::Detour(const bool bAttach) const
|
|
|
|
{
|
2024-01-02 15:21:36 +01:00
|
|
|
DetourSetup(&CInputSystem__WindowProc, &CInputSystem::WindowProc, bAttach);
|
2023-12-24 20:38:50 +01:00
|
|
|
}
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2023-12-24 16:29:42 +01:00
|
|
|
CInputSystem* g_pInputSystem = nullptr;
|
|
|
|
bool(**g_fnSyncRTWithIn)(void) = nullptr;
|