From fda99c9acdafa5cbec03c61ec6ae687d6f053bfd Mon Sep 17 00:00:00 2001 From: aliendroid1 <9aliquraishi9@gmail.com> Date: Fri, 2 May 2025 22:39:28 -0500 Subject: [PATCH 1/3] [GEN][ZH] Fixed crash when alt-tabbing out of the game As noted in the original comment, the game was intended to switch to windowed mode when alt-tabbing out. However, the code mistakenly passed the current window mode instead, resulting in no actual change. This update corrects the parameter to 1, explicitly enabling windowed mode and preventing the crash. --- .../GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp | 2 +- .../GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 9f582cccc5c..3c6fab82476 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -505,7 +505,7 @@ void Reset_D3D_Device(bool active) else { //switch to windowed mode whenever the user alt-tabs out of game. Don't restore assets after reset since we'll do it when returning. - WW3D::Set_Render_Device( WW3D::Get_Render_Device(),TheDisplay->getWidth(),TheDisplay->getHeight(),TheDisplay->getBitDepth(),TheDisplay->getWindowed(),true, true, false); + WW3D::Set_Render_Device( WW3D::Get_Render_Device(),TheDisplay->getWidth(),TheDisplay->getHeight(),TheDisplay->getBitDepth(),1,true, true, false); } } } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 57d2450c21f..f349c1b85c9 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -571,7 +571,7 @@ void Reset_D3D_Device(bool active) else { //switch to windowed mode whenever the user alt-tabs out of game. Don't restore assets after reset since we'll do it when returning. - WW3D::Set_Render_Device( WW3D::Get_Render_Device(),TheDisplay->getWidth(),TheDisplay->getHeight(),TheDisplay->getBitDepth(),TheDisplay->getWindowed(),true, true, false); + WW3D::Set_Render_Device( WW3D::Get_Render_Device(),TheDisplay->getWidth(),TheDisplay->getHeight(),TheDisplay->getBitDepth(),1,true, true, false); } } } From 7285e741d1b3c1340130f8db5be48fadf7ee62e5 Mon Sep 17 00:00:00 2001 From: Ali Qureshi <56457664+aliendroid1@users.noreply.github.com> Date: Sat, 10 May 2025 15:53:15 -0500 Subject: [PATCH 2/3] added bugfix comment --- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 3c6fab82476..60288ff38d4 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -505,7 +505,10 @@ void Reset_D3D_Device(bool active) else { //switch to windowed mode whenever the user alt-tabs out of game. Don't restore assets after reset since we'll do it when returning. - WW3D::Set_Render_Device( WW3D::Get_Render_Device(),TheDisplay->getWidth(),TheDisplay->getHeight(),TheDisplay->getBitDepth(),1,true, true, false); + + // TheSuperHackers @bugfix aliendroid1 02/MAY/2025 Fixed crash when alt-tabbing out of the game + //WW3D::Set_Render_Device( WW3D::Get_Render_Device(),TheDisplay->getWidth(),TheDisplay->getHeight(),TheDisplay->getBitDepth(),TheDisplay->getWindowed(),true, true, false); + WW3D::Set_Render_Device( WW3D::Get_Render_Device(),TheDisplay->getWidth(),TheDisplay->getHeight(),TheDisplay->getBitDepth(),1,true, true, false); } } } From 2ac3af7617a40fe4db097172fade9a612e7b019e Mon Sep 17 00:00:00 2001 From: Ali Qureshi <56457664+aliendroid1@users.noreply.github.com> Date: Sat, 10 May 2025 15:57:18 -0500 Subject: [PATCH 3/3] added bugfix comment --- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index f349c1b85c9..55905a5e131 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -571,7 +571,10 @@ void Reset_D3D_Device(bool active) else { //switch to windowed mode whenever the user alt-tabs out of game. Don't restore assets after reset since we'll do it when returning. - WW3D::Set_Render_Device( WW3D::Get_Render_Device(),TheDisplay->getWidth(),TheDisplay->getHeight(),TheDisplay->getBitDepth(),1,true, true, false); + + // TheSuperHackers @bugfix aliendroid1 02/MAY/2025 Fixed crash when alt-tabbing out of the game + //WW3D::Set_Render_Device( WW3D::Get_Render_Device(),TheDisplay->getWidth(),TheDisplay->getHeight(),TheDisplay->getBitDepth(),TheDisplay->getWindowed(),true, true, false); + WW3D::Set_Render_Device( WW3D::Get_Render_Device(),TheDisplay->getWidth(),TheDisplay->getHeight(),TheDisplay->getBitDepth(),1,true, true, false); } } }