mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Windows: remove extraneous code
PostMessage hooks are no longer needed as we properly handle the messages when the imgui window procedure is running. The g_nWindowRect global is also no longer necessary because we now properly update the CGame's window size members as of commit 7ec1e679fd2676cde8e286812a0f5bec454f7d92.
This commit is contained in:
parent
f7f9e9e425
commit
c8e8bea154
@ -4,7 +4,6 @@
|
||||
//
|
||||
//===========================================================================//
|
||||
#include "core/stdafx.h"
|
||||
#include "windows/id3dx.h"
|
||||
#include "engine/sys_getmodes.h"
|
||||
#include "gameui/imgui_system.h"
|
||||
|
||||
@ -13,9 +12,6 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
bool HCVideoMode_Common__CreateGameWindow(int* pnRect)
|
||||
{
|
||||
g_nWindowRect[0] = pnRect[0];
|
||||
g_nWindowRect[1] = pnRect[1];
|
||||
|
||||
const bool ret = CVideoMode_Common__CreateGameWindow(pnRect);
|
||||
return ret;
|
||||
}
|
||||
|
@ -35,13 +35,6 @@ History:
|
||||
typedef BOOL(WINAPI* IPostMessageA)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
typedef BOOL(WINAPI* IPostMessageW)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
extern UINT g_nWindowRect[2] = { NULL, NULL };
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
static IPostMessageA s_oPostMessageA = NULL;
|
||||
static IPostMessageW s_oPostMessageW = NULL;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
static IDXGIResizeBuffers s_fnResizeBuffers = NULL;
|
||||
static IDXGISwapChainPresent s_fnSwapChainPresent = NULL;
|
||||
@ -58,30 +51,6 @@ LRESULT CALLBACK DXGIMsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
//#################################################################################
|
||||
// POST MESSAGE
|
||||
//#################################################################################
|
||||
|
||||
BOOL WINAPI HPostMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (g_bBlockInput && Msg == WM_MOUSEMOVE)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return s_oPostMessageA(hWnd, Msg, wParam, lParam);
|
||||
}
|
||||
|
||||
BOOL WINAPI HPostMessageW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (g_bBlockInput && Msg == WM_MOUSEMOVE)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return s_oPostMessageW(hWnd, Msg, wParam, lParam);
|
||||
}
|
||||
|
||||
//#################################################################################
|
||||
// IDXGI
|
||||
//#################################################################################
|
||||
@ -134,9 +103,6 @@ HRESULT __stdcall Present(IDXGISwapChain* pSwapChain, UINT nSyncInterval, UINT n
|
||||
|
||||
HRESULT __stdcall ResizeBuffers(IDXGISwapChain* pSwapChain, UINT nBufferCount, UINT nWidth, UINT nHeight, DXGI_FORMAT dxFormat, UINT nSwapChainFlags)
|
||||
{
|
||||
g_nWindowRect[0] = nWidth;
|
||||
g_nWindowRect[1] = nHeight;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
g_pGame->SetWindowSize(nWidth, nHeight);
|
||||
return s_fnResizeBuffers(pSwapChain, nBufferCount, nWidth, nHeight, dxFormat, nSwapChainFlags);
|
||||
@ -321,20 +287,11 @@ bool PanelsVisible()
|
||||
|
||||
void DirectX_Init()
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
s_oPostMessageA = (IPostMessageA)DetourFindFunction("user32.dll", "PostMessageA");
|
||||
s_oPostMessageW = (IPostMessageW)DetourFindFunction("user32.dll", "PostMessageW");
|
||||
|
||||
// Begin the detour transaction
|
||||
DetourTransactionBegin();
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
|
||||
// Hook PostMessage
|
||||
DetourAttach(&(LPVOID&)s_oPostMessageA, (PBYTE)HPostMessageA);
|
||||
DetourAttach(&(LPVOID&)s_oPostMessageW, (PBYTE)HPostMessageW);
|
||||
|
||||
// Hook SwapChain
|
||||
|
||||
DWORD_PTR* pSwapChainVtable = *reinterpret_cast<DWORD_PTR**>(g_ppSwapChain[0]);
|
||||
|
||||
int pIDX = static_cast<int>(DXGISwapChainVTbl::Present);
|
||||
@ -383,10 +340,6 @@ void DirectX_Shutdown()
|
||||
DetourTransactionBegin();
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
|
||||
// Unhook PostMessage
|
||||
DetourDetach(&(LPVOID&)s_oPostMessageA, (PBYTE)HPostMessageA);
|
||||
DetourDetach(&(LPVOID&)s_oPostMessageW, (PBYTE)HPostMessageW);
|
||||
|
||||
// Unhook SwapChain
|
||||
DetourDetach(&(LPVOID&)s_fnSwapChainPresent, (PBYTE)Present);
|
||||
DetourDetach(&(LPVOID&)s_fnResizeBuffers, (PBYTE)ResizeBuffers);
|
||||
|
@ -12,17 +12,12 @@ extern HRESULT __stdcall Present(IDXGISwapChain* pSwapChain, UINT nSyncInterval,
|
||||
extern bool LoadTextureBuffer(unsigned char* buffer, int len, ID3D11ShaderResourceView** out_srv, int* out_width, int* out_height);
|
||||
|
||||
extern void ResetInput();
|
||||
extern bool PanelsVisible();
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Typedefs
|
||||
typedef HRESULT(__stdcall* IDXGISwapChainPresent)(IDXGISwapChain* pSwapChain, UINT nSyncInterval, UINT nFlags);
|
||||
typedef HRESULT(__stdcall* IDXGIResizeBuffers) (IDXGISwapChain* pSwapChain, UINT nBufferCount, UINT nWidth, UINT nHeight, DXGI_FORMAT dxFormat, UINT nSwapChainFlags);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Globals
|
||||
extern UINT g_nWindowRect[2]; // TODO[ AMOS ]: Remove this in favor of CGame's window rect members???
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Enums
|
||||
enum class D3D11DeviceVTbl : short
|
||||
|
Loading…
x
Reference in New Issue
Block a user