Index: ddraw/glDirectDraw.cpp |
— | — | @@ -1054,6 +1054,8 @@ |
1055 | 1055 | {
|
1056 | 1056 | x = devmode.dmPelsWidth;
|
1057 | 1057 | y = devmode.dmPelsHeight;
|
| 1058 | + internalx = screenx = primaryx = devmode.dmPelsWidth;
|
| 1059 | + internaly = screeny = primaryy = devmode.dmPelsHeight;
|
1058 | 1060 | }
|
1059 | 1061 | else
|
1060 | 1062 | {
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -383,17 +383,19 @@ |
384 | 384 | *error = DDERR_INVALIDPIXELFORMAT;
|
385 | 385 | return;
|
386 | 386 | }
|
387 | | - if(ddInterface->GetBPP() > 8)
|
388 | | - {
|
389 | | - colormasks[0] = ddsd.ddpfPixelFormat.dwRBitMask;
|
390 | | - colormasks[1] = ddsd.ddpfPixelFormat.dwGBitMask;
|
391 | | - colormasks[2] = ddsd.ddpfPixelFormat.dwBBitMask;
|
392 | | - memcpy(bitmapinfo->bmiColors,colormasks,3*sizeof(DWORD));
|
393 | | - }
|
394 | 387 | }
|
395 | 388 | texture = renderer->MakeTexture(filter,filter,GL_CLAMP,GL_CLAMP,fakex,fakey,texformat,texformat2,texformat3);
|
396 | 389 | }
|
397 | 390 |
|
| 391 | + if(ddsd.ddpfPixelFormat.dwRGBBitCount > 8)
|
| 392 | + {
|
| 393 | + colormasks[0] = ddsd.ddpfPixelFormat.dwRBitMask;
|
| 394 | + colormasks[1] = ddsd.ddpfPixelFormat.dwGBitMask;
|
| 395 | + colormasks[2] = ddsd.ddpfPixelFormat.dwBBitMask;
|
| 396 | + memcpy(bitmapinfo->bmiColors,colormasks,3*sizeof(DWORD));
|
| 397 | + }
|
| 398 | + if(!bitmapinfo->bmiHeader.biBitCount)
|
| 399 | + bitmapinfo->bmiHeader.biBitCount = (WORD)ddsd.ddpfPixelFormat.dwRGBBitCount;
|
398 | 400 | refcount = 1;
|
399 | 401 | *error = DD_OK;
|
400 | 402 | backbuffer = NULL;
|
— | — | @@ -801,6 +803,7 @@ |
802 | 804 | {
|
803 | 805 | if(!this) return DDERR_INVALIDPARAMS;
|
804 | 806 | if(hdc) ERR(DDERR_DCALREADYCREATED);
|
| 807 | + glDirectDrawPalette *pal;
|
805 | 808 | DWORD colors[256];
|
806 | 809 | HRESULT error;
|
807 | 810 | LPVOID surface;
|
— | — | @@ -810,12 +813,15 @@ |
811 | 814 | bitmapinfo->bmiHeader.biWidth = ddsd.lPitch / (bitmapinfo->bmiHeader.biBitCount / 8);
|
812 | 815 | if(ddsd.ddpfPixelFormat.dwRGBBitCount == 8)
|
813 | 816 | {
|
814 | | - memcpy(colors,palette->GetPalette(NULL),1024);
|
| 817 | + if(palette) pal = palette;
|
| 818 | + else pal = ddInterface->primary->palette;
|
| 819 | + memcpy(colors,pal->GetPalette(NULL),1024);
|
815 | 820 | for(int i = 0; i < 256; i++)
|
816 | 821 | colors[i] = ((colors[i]&0x0000FF)<<16) | (colors[i]&0x00FF00) | ((colors[i]&0xFF0000)>>16);
|
817 | 822 | memcpy(bitmapinfo->bmiColors,colors,1024);
|
818 | 823 | }
|
819 | | - else if(ddsd.ddpfPixelFormat.dwRGBBitCount == 16)bitmapinfo->bmiHeader.biCompression = BI_BITFIELDS;
|
| 824 | + if(ddsd.ddpfPixelFormat.dwRGBBitCount == 16) bitmapinfo->bmiHeader.biCompression = BI_BITFIELDS;
|
| 825 | + else bitmapinfo->bmiHeader.biCompression = BI_RGB;
|
820 | 826 | hbitmap = CreateDIBSection(hdc,bitmapinfo,DIB_RGB_COLORS,&surface,NULL,0);
|
821 | 827 | memcpy(surface,ddsd.lpSurface,ddsd.lPitch*ddsd.dwHeight);
|
822 | 828 | HGDIOBJ temp = SelectObject(hdc,hbitmap);
|