dumbo2007
Crazy about real time sims
I wrote a very basic graphics client overriding only the pure virtuals in GraphicsClient:
D3D11Client.h
D3D11Client.cpp
I was expecting this minimally complete client to work and it does, except for one problem. It does not exit smoothly to the launchpad. I get this after I close the window:
When I attach a debugger I see there are 2 threads and the stack trace of the main thread is in the pic :
Now I think this is because I havent implemented all the clbk* functions and Orbiter expects a non-null handle from one of them. But I cannot figure out which one it is. Can anyone tell me which other function I would need to override to have a cleanly exiting client ?
D3D11Client.h
Code:
/*
* Header file
*
*
*
*/
#pragma once
// Orbiter
#include "..\include\GraphicsAPI.h"
class D3D11Client : public oapi::GraphicsClient {
public:
D3D11Client( HINSTANCE hIn );
~D3D11Client();
//--------------------- Begin Orbiter Public Callbacks ---------------------------
bool clbkFullscreenMode () const;
void clbkGetViewportSize( DWORD *w, DWORD *h ) const;
bool clbkGetRenderParam( DWORD prm, DWORD *value ) const;// = 0
void clbkRenderScene () {};
//--------------------------- End Orbiter Public Callbacks ---------------------------------
// Handle to the Render Window(different from the dialog handles of VideoTab)
HWND m_hWindow;
};
extern D3D11Client *g_GraphicsClient;
D3D11Client.cpp
Code:
#define STRICT
#define ORBITER_MODULE
// Local
#include "D3D11Client.h"
HINSTANCE hDLL;
// Single global client object
D3D11Client *g_GraphicsClient = NULL;
//#pragma region Initialization
D3D11Client::D3D11Client( HINSTANCE hIn )
: oapi::GraphicsClient(hIn)
, m_hWindow(nullptr)
{
oapiWriteLogV("D3D11Client::D3D11Client");
}
D3D11Client::~D3D11Client()
{
oapiWriteLogV("D3D11Client::~D3D11Client");
}
void D3D11Client::clbkGetViewportSize( DWORD *w, DWORD *h ) const
{
oapiWriteLogV( "D3D11Client::clbkGetViewportSize" );
}
bool D3D11Client::clbkFullscreenMode() const
{
oapiWriteLogV( "D3D11Client::clbkFullscreenMode" );
return false;
}
bool D3D11Client::clbkGetRenderParam( DWORD param, DWORD *value ) const
{
oapiWriteLogV("D3D11Client::clbkGetRenderParam");
switch( param ) {
case RP_COLOURDEPTH:
*value = 32;
return true;
case RP_ZBUFFERDEPTH:
*value = 24;
return true;
case RP_STENCILDEPTH:
*value = 8;
return true;
case RP_MAXLIGHTS:
*value = 12;
return true;
case RP_ISTLDEVICE:
*value = TRUE;
return true;
case RP_REQUIRETEXPOW2:
*value = FALSE;
return true;
}
return false;
}
//module functions.
DLLCLBK void InitModule( HINSTANCE h )
{
oapiWriteLogV("D3D11Client::InitModule");
HMODULE hd3d11dll = ::LoadLibrary("d3d11.dll");
if (!hd3d11dll)
{
::MessageBox(0, "This module requires DirectX 11 to be installed.", "DirectX 11 is not installed", MB_OK | MB_ICONERROR);
return;
}
::FreeLibrary(hd3d11dll);
hDLL = h;
g_GraphicsClient = new D3D11Client( hDLL );
if( !oapiRegisterGraphicsClient( g_GraphicsClient ) ) {
delete g_GraphicsClient;
g_GraphicsClient = NULL;
}
}
DLLCLBK void ExitModule(HINSTANCE hDLL)
{
oapiWriteLogV("D3D11Client::clbkScaleBlt");
if( g_GraphicsClient ) {
oapiUnregisterGraphicsClient( g_GraphicsClient );
g_GraphicsClient = NULL;
}
}
I was expecting this minimally complete client to work and it does, except for one problem. It does not exit smoothly to the launchpad. I get this after I close the window:

When I attach a debugger I see there are 2 threads and the stack trace of the main thread is in the pic :

Now I think this is because I havent implemented all the clbk* functions and Orbiter expects a non-null handle from one of them. But I cannot figure out which one it is. Can anyone tell me which other function I would need to override to have a cleanly exiting client ?
Last edited: