Direct3d fixes, disabling lockable backbuffers.

Official 1.8 beta seems to have an incomplete
direct3d implementation.  You cannot select full screen modes
without using DirectDraw.  This is fixed in this buld



git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@27 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
DJRobX 2007-11-07 09:24:46 +00:00
parent f1c5e3fc54
commit 17ae4f9f56
2 changed files with 1573 additions and 1561 deletions

View File

@ -50,6 +50,7 @@ extern "C" bool cpu_mmx;
extern bool detectMMX(); extern bool detectMMX();
#endif #endif
extern int winVideoModeSelect(CWnd *, GUID **);
class Direct3DDisplay : public IDisplay { class Direct3DDisplay : public IDisplay {
private: private:
@ -283,6 +284,7 @@ bool Direct3DDisplay::initialize()
DXTRACE_ERR_MSGBOX( _T("Error creating Direct3D object"), 0 ); DXTRACE_ERR_MSGBOX( _T("Error creating Direct3D object"), 0 );
return FALSE; return FALSE;
} }
pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &mode);
theApp.mode320Available = FALSE; theApp.mode320Available = FALSE;
theApp.mode640Available = FALSE; theApp.mode640Available = FALSE;
@ -290,7 +292,28 @@ bool Direct3DDisplay::initialize()
theApp.mode1024Available = FALSE; theApp.mode1024Available = FALSE;
theApp.mode1280Available = FALSE; theApp.mode1280Available = FALSE;
pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &mode); unsigned int nModes, i;
D3DDISPLAYMODE dm;
nModes = pD3D->GetAdapterModeCount(theApp.fsAdapter, mode.Format);
for (i = 0; i<nModes; i++)
{
if (D3D_OK == pD3D->EnumAdapterModes(theApp.fsAdapter, mode.Format, i, &dm) )
{
if ( (dm.Width == 320) && (dm.Height == 240) )
theApp.mode320Available = true;
if ( (dm.Width == 640) && (dm.Height == 480) )
theApp.mode640Available = true;
if ( (dm.Width == 800) && (dm.Height == 600) )
theApp.mode800Available = true;
if ( (dm.Width == 1024) && (dm.Height == 768) )
theApp.mode1024Available = true;
if ( (dm.Width == 1280) && (dm.Height == 1024) )
theApp.mode1280Available = true;
}
}
screenFormat = mode.Format; screenFormat = mode.Format;
switch(mode.Format) { switch(mode.Format) {
@ -489,32 +512,15 @@ void Direct3DDisplay::resize( int w, int h )
resetDevice(); resetDevice();
calculateDestRect(); calculateDestRect();
} }
if(theApp.videoOption > VIDEO_4X)
resetDevice();
} }
int Direct3DDisplay::selectFullScreenMode( GUID ** ) int Direct3DDisplay::selectFullScreenMode( GUID **pGUID )
{ {
HRESULT hr; return winVideoModeSelect(theApp.m_pMainWnd, pGUID);
D3DDISPLAYMODE dm;
if( FAILED( hr = pDevice->GetDisplayMode( 0, &dm ) ) ) {
DXTRACE_ERR_MSGBOX( _T("pDevice->GetDisplayMode failed"), hr );
return false;
}
UINT bitsPerPixel;
switch( dm.Format )
{
case D3DFMT_A2R10G10B10:
case D3DFMT_X8R8G8B8:
bitsPerPixel = 32;
break;
case D3DFMT_X1R5G5B5:
case D3DFMT_R5G6B5:
bitsPerPixel = 16;
break;
}
return (bitsPerPixel << 24) | (dm.Width << 12) | dm.Height;
} }
@ -638,11 +644,17 @@ bool Direct3DDisplay::resetDevice()
destroyFont(); destroyFont();
destroySurface(); destroySurface();
setPresentationType(); setPresentationType();
if (!theApp.menuToggle)
pDevice->SetDialogBoxMode( FALSE );
if( FAILED( hr = pDevice->Reset( &dpp ) ) ) { if( FAILED( hr = pDevice->Reset( &dpp ) ) ) {
//DXTRACE_ERR_MSGBOX( _T("pDevice->Reset failed"), hr ); //DXTRACE_ERR_MSGBOX( _T("pDevice->Reset failed"), hr );
failed = true; failed = true;
return false; return false;
} }
if (theApp.menuToggle)
pDevice->SetDialogBoxMode( TRUE );
createFont(); createFont();
createSurface(); createSurface();
failed = false; failed = false;