RE: [GD-General] longjmp for C++
Brought to you by:
vexxed72
|
From: Matt D. <ma...@co...> - 2002-01-10 12:27:13
|
Hi,
Under Windows, you can use the API calls HeapCreate, HeapDestroy, HeapAlloc
etc for you memory needs. HeapDestroy will remove the heap, clear any RAM
pages and so forth. Overload your new, new[], delete and delete[] to use
the Win32 API Heap functions and you can clear memory up easily.
As for DirectX, shutting it down should clear all resources associated with
a device driver, shouldn't it?
Alternatively, you can shut things down as normal and at the end of your
call do something like:
if (doReset) Spawn(filename,params,directory);
Where Spawn() is:
HANDLE Spawn (const char* commandLine, const char* params,
const char* directory)
{
SHELLEXECUTEINFO shellInfo;
ZeroMemory(&shellInfo,sizeof(SHELLEXECUTEINFO);
shellInfo.cbSize = sizeof(SHELLEXECUTEINFO);
shellInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
shellInfo.lpFile = commandLine;
shellInfo.lpParameters = params;
shellInfo.nShow = SW_SHOWNORMAL;
shellInfo.lpDirectory = directory;
if (ShellExecuteEx(&shellInfo)) return NULL;
return shellInfo.hProcess;
}
This will spawn another process which is your game. Which is, in effect,
rebooting your game.
Hope that helps.
Matt Davies
Programmer, Confounding Factor
ma...@co...
www.confounding-factor.com
-----Original Message-----
From: gam...@li...
[mailto:gam...@li...]On Behalf Of
Corrinne Yu
Sent: 09 January 2002 21:12
To: Gam...@li...
Subject: RE: [GD-General] longjmp for C++
-----Original Message-----
From: gam...@li...
[mailto:gam...@li...] On Behalf Of
Daniel Vogel
Sent: Wednesday, January 09, 2002 1:12 PM
To: Thatcher Ulrich; Gam...@li...
Subject: RE: [GD-General] longjmp for C++
What Secret Level did for the DreamCast version of Unreal Tournament was
reloading the section of the executable that contains the global
variables
and resetting the heap for level changes. On PS2 and XBox we simply
"reboot". Of course this is all console stuff ;)
-- Rebooting is the type of behavior I have in mind (which is currently
implemented by release and reload). I just wondered if anyone knows of
something that simple on the PC. (Not a real reboot of course, just
something that restores environment to a specifiable equally pristine
state.)
-- As for textures and all the device driver interface nastiness, it may
be helpful for some degenerate situations to completely shutdown all of
Direct X to do as clean a clear as possible. It is still not completely
clean, but it really helps the device drivers to re-compact things like
texture memory with a full rebuild of devices and reload of current used
textures. For in between, there are a few DX calls that compact and
reset, but not always very well. Of course, these degenerate situations
don't arise until running lots and lots of resources for a very long
time.
_______________________________________________
Gamedevlists-general mailing list
Gam...@li...
https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
|