CTL-ALT-DEL crash, vista, windowed mode (1.1.3)
by amaranthia · in Torque Game Builder · 05/08/2007 (9:22 am) · 10 replies
Found an interesting bug...
Open a T2D game in Vista, put it in windowed mode, press CTL+ALT+DEL, wait for a little bit, and then go back to your game. You'll get a crash.
Some things that I've noticed:
The crash does not happen when the game is at the top of the z order when you CTL+ALT+DEL away from the game.
Open a T2D game in Vista, put it in windowed mode, press CTL+ALT+DEL, wait for a little bit, and then go back to your game. You'll get a crash.
Some things that I've noticed:
The crash does not happen when the game is at the top of the z order when you CTL+ALT+DEL away from the game.
#2
05/11/2007 (10:57 am)
I hope this gets added to stock TGB in future versions. Preventing crashes is always a good thing :) Thanks for sharing Amanda!
#3
05/11/2007 (3:45 pm)
I agree. This is a bug that will prevent Devs from getting their games listed on some of the major portals.
#4
I'm trying to track down and fix this issue, but am unable to get any version of TGB to act improperly on my test system. I've tried both version 1.1.3 out of the box, as well as the 1.5 Beta, with and without the window at the top of the z-order.
Is there any other information you can provide on how to reproduce this issue that might help me reproduce it?
Cheers,
-Justin
05/21/2007 (11:04 am)
Amaranthia, I'm trying to track down and fix this issue, but am unable to get any version of TGB to act improperly on my test system. I've tried both version 1.1.3 out of the box, as well as the 1.5 Beta, with and without the window at the top of the z-order.
Is there any other information you can provide on how to reproduce this issue that might help me reproduce it?
Cheers,
-Justin
#5
I've uninstalled all Windows updates AND my graphics drivers, now I can get it to crash. Seems this issue goes away when you run routine windows update or graphics updates. Will confirm which once I debug the issue.
05/21/2007 (11:25 am)
Ok, I've uninstalled all Windows updates AND my graphics drivers, now I can get it to crash. Seems this issue goes away when you run routine windows update or graphics updates. Will confirm which once I debug the issue.
#6
1) The first issue being that in TGB 1.5 Beta on Vista, the application will not launch.
Problem : Windows Vista does not ship with OpenGL drivers, and therefore when you're on Vista with a fresh install and no updated graphics card drivers, you will not be able to directly utilize OpenGL. This causes the first attempt at device creation to fail. Normally this is not an issue, but with the Beta there was a slight oversight in the project dependancies list for building TGB, which was causing the opengl2d3d.dll and glu2d3d.dll DLL's to not be built when you hit 'Build Solution'.
Solution : To resolve this issue, you have to manually set opengl2d3d and glu2d3d projects as dependencies on both the TGBGame and TorqueGameBuilder projects.
To do this, right click on TGBGame in your 'Solution Explorer' window of Visual Studio and select 'Project Dependencies...'
You'll be presented with a list of all the projects in the solution, and you should check both opengl2d3d and glu2d3d projects.
Repeat this step on the TorqueGameBuilder project and you should be able to build and run TGB 1.5 Beta.
2) When hitting Ctrl-Alt-Del on Vista or XP, TGB has crashed when you return from the dialog it presents.
Problem : When you hit Ctrl-Alt-Del, windows presents a system dialog, and locks the surface that TGB is rendering to. This means that when the next frame is rendered, it will cause an access violation error and crash the engine.
Solution : Currently, TGB will only actually deactivate rendering in Video::deactivate() when the device is in Full-screen. To fix this, open up platformVideo.cc and replace the Video::deactivate() and Video::reactivate() functions with the versions I've provided below.
Side-Effects : The only notable change I've found in this, is that it will cause the game to stop rendering when it goes into the background. In order to change this you need to be able to only stop rendering when the system presents a dialog that is going to lock the surface that TGB is drawing to. There is a way to do this in NT based windows systems but it involves installing a system DLL and adding some junk to the users registry, which is unacceptably intrusive and as such, this solution will have to do.
Result : This should fix issues where TGB will not start without updated OpenGL drivers on Windows Vista, as well as crashes resulting from going to and from the 'Ctrl-Alt-Del' screen while the game is running.
Cheers,
-Justin
05/21/2007 (2:46 pm)
I've dug into this a bit further and have resolved two issues.1) The first issue being that in TGB 1.5 Beta on Vista, the application will not launch.
Problem : Windows Vista does not ship with OpenGL drivers, and therefore when you're on Vista with a fresh install and no updated graphics card drivers, you will not be able to directly utilize OpenGL. This causes the first attempt at device creation to fail. Normally this is not an issue, but with the Beta there was a slight oversight in the project dependancies list for building TGB, which was causing the opengl2d3d.dll and glu2d3d.dll DLL's to not be built when you hit 'Build Solution'.
Solution : To resolve this issue, you have to manually set opengl2d3d and glu2d3d projects as dependencies on both the TGBGame and TorqueGameBuilder projects.
To do this, right click on TGBGame in your 'Solution Explorer' window of Visual Studio and select 'Project Dependencies...'
You'll be presented with a list of all the projects in the solution, and you should check both opengl2d3d and glu2d3d projects.
Repeat this step on the TorqueGameBuilder project and you should be able to build and run TGB 1.5 Beta.
2) When hitting Ctrl-Alt-Del on Vista or XP, TGB has crashed when you return from the dialog it presents.
Problem : When you hit Ctrl-Alt-Del, windows presents a system dialog, and locks the surface that TGB is rendering to. This means that when the next frame is rendered, it will cause an access violation error and crash the engine.
Solution : Currently, TGB will only actually deactivate rendering in Video::deactivate() when the device is in Full-screen. To fix this, open up platformVideo.cc and replace the Video::deactivate() and Video::reactivate() functions with the versions I've provided below.
//------------------------------------------------------------------------------
void Video::deactivate()
{
if ( smCritical )
return;
// Always deactivate the game rendering when video is deactivated
// We need to assume that the rendering should cease
GameDeactivate( true );
if ( smCurrentDevice && DisplayDevice::isFullScreen() )
{
smCritical = true;
Game->textureKill();
smCurrentDevice->shutdown();
Platform::minimizeWindow();
smCritical = false;
}
}
//------------------------------------------------------------------------------
void Video::reactivate()
{
if ( smCritical )
return;
if ( smCurrentDevice && DisplayDevice::isFullScreen() )
{
Resolution res = DisplayDevice::getResolution();
smCritical = true;
smCurrentDevice->activate(res.w,res.h,res.bpp,DisplayDevice::isFullScreen());
Game->textureResurrect();
smCritical = false;
if (sgOriginalGamma != -1.0)
Video::setGammaCorrection(sgOriginalGamma + sgGammaCorrection);
}
// Reactivate the game and let it continue rendering
GameReactivate();
}Side-Effects : The only notable change I've found in this, is that it will cause the game to stop rendering when it goes into the background. In order to change this you need to be able to only stop rendering when the system presents a dialog that is going to lock the surface that TGB is drawing to. There is a way to do this in NT based windows systems but it involves installing a system DLL and adding some junk to the users registry, which is unacceptably intrusive and as such, this solution will have to do.
Result : This should fix issues where TGB will not start without updated OpenGL drivers on Windows Vista, as well as crashes resulting from going to and from the 'Ctrl-Alt-Del' screen while the game is running.
Cheers,
-Justin
#7
Note2 : This fix did not involve modifying winWindow, because it already calls Video::deactivate() and Video::reactivate() when the window is activated/deactivated.
05/21/2007 (2:47 pm)
Note : This has been fixed in the TGB 1.5 Beta and will be available with the next release.Note2 : This fix did not involve modifying winWindow, because it already calls Video::deactivate() and Video::reactivate() when the window is activated/deactivated.
#8
Your fix works well on the Intel 950 chipsets by the way, and that covers a lot of computers out there.
Thanks,
Juan
05/25/2007 (6:13 pm)
Hey Justin. Yes, it did fix the problem. But unfortunately not on all machines. We still see the game crashing on the Nvidia Geforce 7300. You guys may want to try it on the rest of the Nvidia series, as it may still creating a problem.Your fix works well on the Intel 950 chipsets by the way, and that covers a lot of computers out there.
Thanks,
Juan
#9
A small update here. I've integrated one of our internal fixes to the wrapper DLL that is causing these crashes. It correctly handles error codes and should fix any TGB Vista crashes in the 1.5 release that came out the other day. This means you can remove any render pausing fixes you have, and render should continue as normal, but without the crashy side-effect.
Let me know if 1.5 solves this issue for you, it works great in our testing.
-Justin
07/13/2007 (3:10 pm)
Hey Guys,A small update here. I've integrated one of our internal fixes to the wrapper DLL that is causing these crashes. It correctly handles error codes and should fix any TGB Vista crashes in the 1.5 release that came out the other day. This means you can remove any render pausing fixes you have, and render should continue as normal, but without the crashy side-effect.
Let me know if 1.5 solves this issue for you, it works great in our testing.
-Justin
#10
I have done the modification in platformVideo.cc file,but it's not working for me,the game window is not getting minimized,I have TGB 1.7.4 version. Is there any different on using 1.5 ver and 1.7 ver, tell me if u have any idea about it.
Error Report:
1. Launch the game (XP & Vista).
2. Once in-game, press ctrl+alt+delete and select Task Manager.
3. Notice that you will be brought back to the desktop for a few seconds and won't be able to control mouse movement. They, the game will automatically be brought back into focus.
01/21/2009 (10:04 pm)
Dear JustinI have done the modification in platformVideo.cc file,but it's not working for me,the game window is not getting minimized,I have TGB 1.7.4 version. Is there any different on using 1.5 ver and 1.7 ver, tell me if u have any idea about it.
Error Report:
1. Launch the game (XP & Vista).
2. Once in-game, press ctrl+alt+delete and select Task Manager.
3. Notice that you will be brought back to the desktop for a few seconds and won't be able to control mouse movement. They, the game will automatically be brought back into focus.
Associate amaranthia
The problem is because you are continuing to attempt to draw when the drawing surface is locked.
This can be solved very simply by "deactivating" your application when you loose focus.
To do this, simply follow these steps:
1) Open "winWindow.cc" in the Torque Game Builder "Engine" sources.
2) Scroll down to the "WindowProc" function.
3) Scroll down further to the WM_ACTIVATEAPP case.
4) As the wParam of this message indicates the activation (or deactivation), simply apply the following call in the deactivation ("false" case) of this test so:
if ((bool) wParam) { // Do your activation code... } else { // Whatever else you need or care to do on deactivation here... GameDeactivate(true); }5) Before you attempt to compile, you will need to put the following "extern" reference above the call (typically at the top of the file for clairity, but anywhere above the call is all that is required):
extern void GameDeactivate ( bool noRender );
And with this, you no longer have the crash on Alt-Tab, nor Alt+Ctrl+Del, nor Windows Key + L, nor...
Enjoy...