Archived

This topic is now archived and is closed to further replies.

Tarique

PR 3.00 Shutdown problem

Recommended Posts

I have created an app as a DLL, using PR 3.00. The main app then does a LoadLibrary() call to load this dll and I then call a function to initialise PR.

I want to be able to click on various buttons in the main app to run up different environments. There are very good reasons for doing this as a DLL! We are co-developing a project with another company, who are doing the 2D bit and we decided it would be better for me to give them updates on the 3D side as a DLL which can hook into their code easily. Anyway, all this is irrelevant!

Basically, what is happening is that PR doesn't appear to shutdown properly and return to the main app, because when I then try to initialise it again, I get a DDERR_NOEXCLUSIVEMODE error in the log file.
To get around this I manually set the exclusive mode back to normal before shutting down, by calling:-

wgtpdd->SetCooperativeLevel(hWndMain, DDSCL_NORMAL);

It now lets me re-initialise PR fine. However, the problem now is that when I try to exit the main app, it GPF's! Any clues as to what I'm doing wrong?

Under normal cases, you would only do the shutdown at the end of your game just before exiting the app, and the OS would clean up when finished anyway, which is why noone else has noticed this (I presume).

I have done a test whereby I don't do anything else other than initialise PR and shut it down again. However, this problem still occurs.

And I have also noticed that to get PR to shutdown and return the screen back properly, I have to call PR_ShutdownD3D() as well as PR_Shutdown().

Any help on this would be most welcome!!! as I am being hassled to get this resolved!

If I've missed anything off, please let me know.

Are any of these problems solved in the later releases? I've been trying to download them for a couple of days now and I can't get to the FTP - Yes, I know it's not supposed to be up all the time! Just some of the time would be nice!

Cheers,
Tarique.

[This message has been edited by Tarique (edited December 22, 1999).]

Share this post


Link to post
Share on other sites
By the way, here's my shutdown code:-

VOID CGfx::FreeAll(VOID)
{
//----- only attempt to close if not already open ----------------

if(!m_Open)
return;

//----- free cameras ---------------------------------------------

for(INT32 i = 0; i < CCamera::MAX_CAMERAS; i++) {
delete Cam[i];
Cam[i] = NULL;
}

//----- free viewport and closedown ------------------------------

PR_FreeLights(&m_Lights);
PR_FreeLights(&scenelights);

PR_CloseViewport(&m_Viewport);

PR_DeleteAllShadeTables();
PR_DeleteAllTextures();
PR_DeleteAllMaterials();

wgtpdd->SetCooperativeLevel(hWndMain, DDSCL_NORMAL);
PR_ShutDown();
PR_ShutdownD3D();

m_Open = FALSE;
}

[This message has been edited by Tarique (edited December 22, 1999).]

Share this post


Link to post
Share on other sites