static int GGIclose(ggi_visual * vis, struct ggi_dlhandle *dlh) { directx_priv *priv = GGIDIRECTX_PRIV(vis); GGI_directx_Lock(priv->cs); DDShutdown(priv); GGI_directx_Unlock(priv->cs); GGI_directx_LockDestroy(priv->cs); GGI_directx_LockDestroy(priv->spincs); GGI_directx_LockDestroy(priv->sizingcs); free(priv); if (LIBGGI_GC(vis)) free(LIBGGI_GC(vis)); return 0; }
/* * FiniApp: * Cleans up the application, frees memory. */ void FiniApp(void) { WriteError("\n ====== KILL ======"); // Kill the game stuff KillStuff(); // Blacken the surfaces of the flipping chain // prevents residue gfx showing up after closing WriteError("\n Clearing Display Surfaces..."); DDFillSurface(lpDDSPrimary, 0); // Fill the primary surface with black DDFillSurface(lpDDSBack, 0); // Fill the back surface with black // shutdown directdraw WriteError("\n Shutting down DirectDraw..."); DDShutdown(); WriteError("\n DirectDraw shut down..."); // shutdown DigitalFX WriteError("\n Shutting down DigitalFX..."); digifxDone(); WriteError("\n DigitalFX shut down..."); // shutdown directsound WriteError("\n Shutting down DirectSound..."); DSShutdown(); WriteError("\n DirectSound shut down..."); // release all input devices WriteError("\n Releasing Control of Input Devices..."); DIReleaseKeyboard(); DIReleaseJoystick(); WriteError("\n Input Devices released..."); // shutdown directinput WriteError("\n Shutting down DirectInput..."); DIShutdown(); WriteError("\n DirectInput shut down..."); WriteError("\n ====== END KILL ======"); // close the error file CloseErrorFile(); }