33#include " Render.h"
44#include " IGame_Persistent.h"
55#include " xr_IOConsole.h"
6+ #include " xr_input.h"
67
78void CRenderDevice::Destroy ()
89{
910 if (!b_is_Ready)
1011 return ;
1112 Log (" Destroying Direct3D..." );
12- ShowCursor ( true );
13+ pInput-> ClipCursor ( false );
1314 GEnv.Render ->ValidateHW ();
1415 GEnv.DU ->OnDeviceDestroy ();
1516 b_is_Ready = false ;
@@ -36,27 +37,33 @@ extern BOOL bNeed_re_create_env;
3637
3738void CRenderDevice::Reset (bool precache)
3839{
39- u32 dwWidth_before = dwWidth;
40- u32 dwHeight_before = dwHeight;
40+ const auto dwWidth_before = dwWidth;
41+ const auto dwHeight_before = dwHeight;
42+ pInput->ClipCursor (false );
43+
44+ const auto tm_start = TimerAsync ();
45+
46+ GEnv.Render ->Reset (m_hWnd, dwWidth, dwHeight, fWidth_2 , fHeight_2 );
4147 GetWindowRect (m_hWnd, &m_rcWindowBounds);
4248 GetClientRect (m_hWnd, &m_rcWindowClient);
43- ShowCursor (true );
44- u32 tm_start = TimerAsync ();
45- GEnv.Render ->Reset (m_hWnd, dwWidth, dwHeight, fWidth_2 , fHeight_2 );
49+
4650 if (g_pGamePersistent)
4751 g_pGamePersistent->Environment ().bNeed_re_create_env = true ;
4852 _SetupStates ();
53+
4954 if (precache)
5055 PreCache (20 , true , false );
51- u32 tm_end = TimerAsync ();
56+
57+ const auto tm_end = TimerAsync ();
5258 Msg (" *** RESET [%d ms]" , tm_end - tm_start);
59+
5360 // TODO: Remove this! It may hide crash
5461 Memory.mem_compact ();
5562
56- if (!GEnv.isDedicatedServer )
57- ShowCursor (false );
58-
5963 seqDeviceReset.Process (rp_DeviceReset);
6064 if (dwWidth_before != dwWidth || dwHeight_before != dwHeight)
6165 seqResolutionChanged.Process (rp_ScreenResolutionChanged);
66+
67+ if (!GEnv.isDedicatedServer )
68+ pInput->ClipCursor (true );
6269}
0 commit comments