mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 20:38:07 +01:00
Try to Disable all inputs when overlay is on
This commit is contained in:
parent
7daf605511
commit
fdeb5912d3
2 changed files with 37 additions and 9 deletions
|
@ -16,6 +16,9 @@
|
||||||
|
|
||||||
#include "notification.h"
|
#include "notification.h"
|
||||||
|
|
||||||
|
static decltype(GetRawInputBuffer)* _GetRawInputBuffer = GetRawInputBuffer;
|
||||||
|
static decltype(GetRawInputData)* _GetRawInputData = GetRawInputData;
|
||||||
|
|
||||||
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
bool Steam_Overlay::IgnoreMsg(UINT uMsg)
|
bool Steam_Overlay::IgnoreMsg(UINT uMsg)
|
||||||
|
@ -134,20 +137,43 @@ void Steam_Overlay::SetupOverlay()
|
||||||
Hook_Manager::Inst().HookRenderer(this);
|
Hook_Manager::Inst().HookRenderer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT WINAPI Steam_Overlay::MyGetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader)
|
||||||
|
{
|
||||||
|
Steam_Overlay* _this = Hook_Manager::Inst().GetOverlay();
|
||||||
|
if( !_this->show_overlay )
|
||||||
|
return _GetRawInputBuffer(pData, pcbSize, cbSizeHeader);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT WINAPI Steam_Overlay::MyGetRawInputData(HRAWINPUT hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader)
|
||||||
|
{
|
||||||
|
Steam_Overlay* _this = Hook_Manager::Inst().GetOverlay();
|
||||||
|
if (!_this->show_overlay)
|
||||||
|
return _GetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void Steam_Overlay::HookReady(void* hWnd)
|
void Steam_Overlay::HookReady(void* hWnd)
|
||||||
{
|
{
|
||||||
if (game_hwnd != hWnd)
|
if (game_hwnd != hWnd)
|
||||||
{
|
{
|
||||||
if (!is_ready) // If this is the first time we are ready, hook directinput and xinput, so we can intercept em and disable mouse.
|
if (!is_ready) // If this is the first time we are ready, hook directinput and xinput, so we can intercept em and disable mouse.
|
||||||
{
|
{
|
||||||
//window_hooks.BeginHook();
|
window_hooks.BeginHook();
|
||||||
//
|
|
||||||
//window_hooks.HookFuncs(std::make_pair<void**, void*>(&(PVOID&)_DispatchMessageA, &Steam_Overlay::MyDispatchMessageA),
|
window_hooks.HookFuncs(std::make_pair<void**, void*>(&(PVOID&)_GetRawInputBuffer, &MyGetRawInputBuffer),
|
||||||
// std::make_pair<void**, void*>(&(PVOID&)_DispatchMessageW, &Steam_Overlay::MyDispatchMessageW)
|
std::make_pair<void**, void*>(&(PVOID&)_GetRawInputData, &MyGetRawInputData)
|
||||||
// // Add XInput and DirectInput hooks to catch all mouse & controllers input when overlay is on
|
);
|
||||||
// );
|
|
||||||
//
|
window_hooks.EndHook();
|
||||||
//window_hooks.EndHook();
|
|
||||||
|
// TODO: Uncomment this and draw our own cursor (cosmetics)
|
||||||
|
//ImGuiIO &io = ImGui::GetIO();
|
||||||
|
//io.WantSetMousePos = false;
|
||||||
|
//io.MouseDrawCursor = false;
|
||||||
|
//io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;
|
||||||
|
|
||||||
is_ready = true;
|
is_ready = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,8 @@ class Steam_Overlay
|
||||||
bool IgnoreMsg(UINT uMsg);
|
bool IgnoreMsg(UINT uMsg);
|
||||||
|
|
||||||
static LRESULT CALLBACK HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
static UINT WINAPI MyGetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader);
|
||||||
|
static UINT WINAPI MyGetRawInputData(HRAWINPUT hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader);
|
||||||
|
|
||||||
static void steam_overlay_run_every_runcb(void* object);
|
static void steam_overlay_run_every_runcb(void* object);
|
||||||
static void steam_overlay_callback(void* object, Common_Message* msg);
|
static void steam_overlay_callback(void* object, Common_Message* msg);
|
||||||
|
|
Loading…
Reference in a new issue