mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
Default to current mode bpp
This commit is contained in:
parent
23cf107020
commit
b6642edb67
2
main.c
2
main.c
@ -498,7 +498,7 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
|
|||||||
This->render->bpp = GetPrivateProfileIntA("ddraw", "bpp", 32, ini_path);
|
This->render->bpp = GetPrivateProfileIntA("ddraw", "bpp", 32, ini_path);
|
||||||
if(This->render->bpp != 16 && This->render->bpp != 24 && This->render->bpp != 32)
|
if(This->render->bpp != 16 && This->render->bpp != 24 && This->render->bpp != 32)
|
||||||
{
|
{
|
||||||
This->render->bpp = 32;
|
This->render->bpp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPrivateProfileStringA("ddraw", "filter", tmp, tmp, sizeof(tmp), ini_path);
|
GetPrivateProfileStringA("ddraw", "filter", tmp, tmp, sizeof(tmp), ini_path);
|
||||||
|
@ -72,19 +72,23 @@ HRESULT WINAPI render_opengl_SetDisplayMode(DWORD width, DWORD height)
|
|||||||
{
|
{
|
||||||
DEVMODE mode;
|
DEVMODE mode;
|
||||||
|
|
||||||
|
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &render_opengl.restore);
|
||||||
|
|
||||||
if(ddraw->windowed)
|
if(ddraw->windowed)
|
||||||
{
|
{
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &render_opengl.restore);
|
|
||||||
|
|
||||||
memset(&mode, 0, sizeof(DEVMODE));
|
memset(&mode, 0, sizeof(DEVMODE));
|
||||||
mode.dmSize = sizeof(DEVMODE);
|
mode.dmSize = sizeof(DEVMODE);
|
||||||
mode.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
|
mode.dmFields = DM_PELSWIDTH|DM_PELSHEIGHT;
|
||||||
mode.dmPelsWidth = render_opengl.width;
|
mode.dmPelsWidth = render_opengl.width;
|
||||||
mode.dmPelsHeight = render_opengl.height;
|
mode.dmPelsHeight = render_opengl.height;
|
||||||
mode.dmBitsPerPel = render_opengl.bpp;
|
if(render_opengl.bpp)
|
||||||
|
{
|
||||||
|
mode.dmFields |= DM_BITSPERPEL;
|
||||||
|
mode.dmBitsPerPel = render_opengl.bpp;
|
||||||
|
}
|
||||||
|
|
||||||
return ChangeDisplaySettings(&mode, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL ? DD_OK : DDERR_INVALIDMODE;
|
return ChangeDisplaySettings(&mode, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL ? DD_OK : DDERR_INVALIDMODE;
|
||||||
}
|
}
|
||||||
@ -119,7 +123,7 @@ DWORD WINAPI render_opengl_main(IDirectDrawSurfaceImpl *surface)
|
|||||||
pfd.nVersion = 1;
|
pfd.nVersion = 1;
|
||||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
||||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||||
pfd.cColorBits = render_opengl.bpp;
|
pfd.cColorBits = render_opengl.bpp ? render_opengl.bpp : render_opengl.restore.dmBitsPerPel;
|
||||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||||
SetPixelFormat( hDC, ChoosePixelFormat( hDC, &pfd ), &pfd );
|
SetPixelFormat( hDC, ChoosePixelFormat( hDC, &pfd ), &pfd );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user