oki... well new day new problems

well oki its an old problem, but its a new day
RavenDx8.cpp
// RavenDx8.cpp : Main DLL Entry Point
//
#include <d3d8.h>
#include "RavenDx8.h"
// Constructors (optional)
//
#include "globstruct.h"
GlobStruct* g_pGlob = NULL;
void Constructor ( void )
{
// Create memory here
}
void Destructor ( void )
{
// Free memory here
}
void ReceiveCoreDataPtr ( LPVOID pCore )
{
// Get Core Data Pointer here
g_pGlob = (GlobStruct*)pCore;
}
// Main DLL
//
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
void FSAA ( DWORD dwSamples, DWORD bEdge )
{
LPDIRECT3D8 pD3D = NULL;
LPDIRECT3DDEVICE8 d3dDevice = NULL;
D3DMULTISAMPLE_TYPE CurrentSamples;
ZeroMemory( &CurrentSamples, sizeof( CurrentSamples ) );
// assume these succeed
g_pGlob->pCurrentBitmapSurface->GetDevice( &d3dDevice );
d3dDevice->GetDirect3D( &pD3D );
if( dwSamples==0 )
CurrentSamples = D3DMULTISAMPLE_NONE;
if( dwSamples==2 )
CurrentSamples = D3DMULTISAMPLE_2_SAMPLES;
if( dwSamples==4 )
CurrentSamples = D3DMULTISAMPLE_3_SAMPLES;
if( SUCCEEDED(pD3D->CheckDeviceMultiSampleType( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_R8G8B8,
FALSE, CurrentSamples ) ) )
{
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof( d3dpp ) );
d3dpp.Windowed = FALSE;
d3dpp.hDeviceWindow = NULL;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.MultiSampleType = CurrentSamples;
if( g_pGlob->iSoftwareVP == TRUE )
{
pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_pGlob->hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3dDevice );
}
else
{
pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_pGlob->hWnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &d3dDevice );
}
if( bEdge==FALSE )
{
d3dDevice->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, TRUE );
}
else
{
d3dDevice->SetRenderState( D3DRS_EDGEANTIALIAS, TRUE );
}
}
if ( d3dDevice )
d3dDevice->Release();
if ( pD3D )
pD3D->Release();
}
void FSAAOFF ( void )
{
LPDIRECT3D8 pD3D = NULL;
LPDIRECT3DDEVICE8 d3dDevice = NULL;
// assume these succeed
g_pGlob->pCurrentBitmapSurface->GetDevice( &d3dDevice );
d3dDevice->GetDirect3D( &pD3D );
d3dDevice->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, FALSE );
d3dDevice->SetRenderState( D3DRS_EDGEANTIALIAS, FALSE );
if ( d3dDevice )
d3dDevice->Release();
if ( pD3D )
pD3D->Release();
}
RavenDx8.h
// Header File
//
// Common Includes
#include "windows.h"
#include "d3d8types.h"
#include "d3d8caps.h"
// Define macro
#define DLLEXPORT __declspec ( dllexport )
// Constructor Functions (optional)
DLLEXPORT void Constructor ( void );
DLLEXPORT void Destructor ( void );
DLLEXPORT void ReceiveCoreDataPtr ( LPVOID pCore );
HRESULT Direct3D ( void );
// Do not decorate DLL-function-names
extern "C"
{
// export commands go here
DLLEXPORT void FSAA ( DWORD dwSamples, DWORD bEdge );
DLLEXPORT void FSAAOFF ( void );
}
you should be able to create the string table on your own

now, in the RavenDx8.cpp file the following lines cause the program to crash ->
if( bEdge==FALSE )
{
d3dDevice->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, TRUE );
}
else
{
d3dDevice->SetRenderState( D3DRS_EDGEANTIALIAS, TRUE );
}
why? ... becuase d3dDevice appears to be invalid, yet oddly the d3d data that was obtained from it is completely valid.
if you run this in debugger mode you'll see what i mean, this is why i have posted the source so you can veiw the actual debug steps,
notice how &d3dDevice is a valid device, but the d3dDevice isn't.
its odd because it should be populated now ... however atleast now i can create and destroy d3d devices

which is comming in handy with current Shader Extensions i'm working on.
but i just think the current problem is a little odd, no doubt on of you guys can figure it out - i've never had to yank the Dx inteface before so this is kinda odd.
Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!