Merge pull request #30 from PixieCore/master

This commit is contained in:
PixieCore 2021-08-13 16:25:09 +02:00 committed by GitHub
commit cbcf289287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 38 deletions

View File

@ -293,14 +293,8 @@ public:
float m_flValue; //0x0068
__int64 m_iValue; //0x006C
bool m_bHasMin; //0x0070
private:
char pad_0071[3]; //0x0071
public:
float m_flMinValue; //0x0074
bool m_bHasMax; //0x0078
private:
char pad_0079[3]; //0x0079
public:
float m_flMaxValue; //0x007C
}; //Size: 0x0080

View File

@ -266,23 +266,25 @@ void DrawImGui()
ImGui::NewFrame();
if (g_bShowConsole)
if (g_bShowConsole || g_bShowBrowser)
{
GameGlobals::InputSystem->EnableInput(false); // Disable input.
}
else
{
GameGlobals::InputSystem->EnableInput(true); // Enable input.
}
if (g_bShowConsole)
{
DrawConsole();
}
if (g_bShowBrowser)
{
GameGlobals::InputSystem->EnableInput(false); // Disable input.
DrawBrowser();
}
if (!g_bShowConsole && !g_bShowBrowser)
{
GameGlobals::InputSystem->EnableInput(true); // Enable input.
}
ImGui::EndFrame();
ImGui::Render();
@ -312,25 +314,6 @@ void CreateRenderTarget(IDXGISwapChain* pSwapChain)
pBackBuffer->Release();
}
void CreateViewPort( UINT nWidth, UINT nHeight)
{
float width = *(float*)(&nWidth);
float height = *(float*)(&nHeight);
D3D11_VIEWPORT vp;
///////////////////////////////////////////////////////////////////////////////
vp.Width = width;
vp.Height = height;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
///////////////////////////////////////////////////////////////////////////////
g_pDeviceContext->RSSetViewports(1, &vp);
}
void DestroyRenderTarget()
{
if (nullptr != g_pRenderTargetView)
@ -368,12 +351,9 @@ HRESULT __stdcall GetResizeBuffers(IDXGISwapChain* pSwapChain, UINT nBufferCount
g_bPresentHooked = false;
///////////////////////////////////////////////////////////////////////////////
ImGui_ImplDX11_InvalidateDeviceObjects();
DestroyRenderTarget();
CreateViewPort(nWidth, nHeight);
ImGui_ImplDX11_CreateDeviceObjects();
///////////////////////////////////////////////////////////////////////////////
return originalResizeBuffers(pSwapChain, nBufferCount, nWidth, nHeight, dxFormat, nSwapChainFlags);
}
@ -484,14 +464,14 @@ void InstallDXHooks()
///////////////////////////////////////////////////////////////////////////////
// Hook SwapChain
MH_CreateHook(g_fnIDXGISwapChainPresent, &Present, reinterpret_cast<void**>(&originalPresent));
// MH_CreateHook(g_oResizeBuffers, &GetResizeBuffers, reinterpret_cast<void**>(&originalResizeBuffers));
MH_CreateHook(g_oResizeBuffers, &GetResizeBuffers, reinterpret_cast<void**>(&originalResizeBuffers));
///////////////////////////////////////////////////////////////////////////////
// Enable hooks
MH_EnableHook(PostMessageA);
MH_EnableHook(PostMessageW);
MH_EnableHook(g_fnIDXGISwapChainPresent);
// MH_EnableHook(g_oResizeBuffers);
MH_EnableHook(g_oResizeBuffers);
}
void RemoveDXHooks()
@ -512,7 +492,7 @@ void RemoveDXHooks()
///////////////////////////////////////////////////////////////////////////////
// Unhook SwapChain
MH_RemoveHook(g_fnIDXGISwapChainPresent);
// MH_RemoveHook(g_oResizeBuffers);
MH_RemoveHook(g_oResizeBuffers);
///////////////////////////////////////////////////////////////////////////////
// Shutdown ImGui