From 028ef8b5abcde2e53091549bab83417dc3cce2f6 Mon Sep 17 00:00:00 2001 From: IcePixelx <41352111+PixieCore@users.noreply.github.com> Date: Fri, 13 Aug 2021 16:24:09 +0200 Subject: [PATCH 1/2] Fixed RUI resizing. --- r5dev/src/id3dx.cpp | 44 ++++++++++++-------------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/r5dev/src/id3dx.cpp b/r5dev/src/id3dx.cpp index c09b3492..c830c2d5 100644 --- a/r5dev/src/id3dx.cpp +++ b/r5dev/src/id3dx.cpp @@ -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(&originalPresent)); -// MH_CreateHook(g_oResizeBuffers, &GetResizeBuffers, reinterpret_cast(&originalResizeBuffers)); + MH_CreateHook(g_oResizeBuffers, &GetResizeBuffers, reinterpret_cast(&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 From 8d11dd6495417b5247baa706459cc15471520435 Mon Sep 17 00:00:00 2001 From: IcePixelx <41352111+PixieCore@users.noreply.github.com> Date: Fri, 13 Aug 2021 16:24:23 +0200 Subject: [PATCH 2/2] Removed padding, compiler takes care of those. --- r5dev/include/gameclasses.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/r5dev/include/gameclasses.h b/r5dev/include/gameclasses.h index 41b1a29f..90f343fd 100644 --- a/r5dev/include/gameclasses.h +++ b/r5dev/include/gameclasses.h @@ -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