Index: ddraw/common.h |
— | — | @@ -75,7 +75,17 @@ |
76 | 76 | DEBUGBREAK\
|
77 | 77 | return error;\
|
78 | 78 | }
|
| 79 | +
|
| 80 | +static inline int NextMultipleOf8(int number){return ((number+7) & (~7));}
|
| 81 | +static inline int NextMultipleOf4(int number){return ((number+3) & (~3));}
|
| 82 | +static inline int NextMultipleOf2(int number){return ((number+1) & (~1));}
|
| 83 | +#ifdef _M_X64
|
| 84 | +#define NextMultipleOfWord NextMultipleOf8
|
79 | 85 | #else
|
| 86 | +#define NextMultipleOfWord NextMultipleOf4
|
| 87 | +#endif
|
| 88 | +
|
| 89 | +#else
|
80 | 90 | #define ERR(error) return error;
|
81 | 91 | #endif
|
82 | 92 | #include "../cfgmgr/cfgmgr.h"
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -823,6 +823,8 @@ |
824 | 824 | DDSURFACEDESC2 ddsdMode;
|
825 | 825 | ZeroMemory(&ddsdMode, sizeof(DDSURFACEDESC2));
|
826 | 826 | ddsdMode.dwSize = sizeof(DDSURFACEDESC2);
|
| 827 | + ddsdMode.dwFlags = DDSD_REFRESHRATE | DDSD_PIXELFORMAT | DDSD_PITCH | DDSD_WIDTH | DDSD_HEIGHT;
|
| 828 | + ddsdMode.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
827 | 829 | DEVMODE currmode;
|
828 | 830 | if(fullscreen)
|
829 | 831 | {
|
— | — | @@ -831,6 +833,7 @@ |
832 | 834 | ddsdMode.ddpfPixelFormat.dwRBitMask = 0;
|
833 | 835 | ddsdMode.ddpfPixelFormat.dwGBitMask = 0;
|
834 | 836 | ddsdMode.ddpfPixelFormat.dwBBitMask = 0;
|
| 837 | + ddsdMode.ddpfPixelFormat.dwFlags |= DDPF_PALETTEINDEXED8;
|
835 | 838 | }
|
836 | 839 | else if(primarybpp == 15)
|
837 | 840 | {
|
— | — | @@ -853,9 +856,10 @@ |
854 | 857 | ddsdMode.ddpfPixelFormat.dwRGBBitCount = GetBPPMultipleOf8();
|
855 | 858 | ddsdMode.dwWidth = primaryx;
|
856 | 859 | ddsdMode.dwHeight = primaryy;
|
857 | | - if(primarybpp == 15) ddsdMode.lPitch = primaryx * 2;
|
858 | | - else if(primarybpp == 4) ddsdMode.lPitch = primaryx / 2;
|
859 | | - else ddsdMode.lPitch = primaryx * (primarybpp / 8);
|
| 860 | + ddsdMode.dwRefreshRate = primaryrefresh;
|
| 861 | + if(primarybpp == 15) ddsdMode.lPitch = NextMultipleOfWord(primaryx * 2);
|
| 862 | + else if(primarybpp == 4) ddsdMode.lPitch = NextMultipleOfWord(primaryx / 2);
|
| 863 | + else ddsdMode.lPitch = NextMultipleOfWord(primaryx * (primarybpp / 8));
|
860 | 864 | if(lpDDSurfaceDesc2->dwSize < sizeof(DDSURFACEDESC)) ERR(DDERR_INVALIDPARAMS);
|
861 | 865 | if(lpDDSurfaceDesc2->dwSize > sizeof(DDSURFACEDESC2))
|
862 | 866 | lpDDSurfaceDesc2->dwSize = sizeof(DDSURFACEDESC2);
|
Index: ddraw/glDirectDrawPalette.cpp |
— | — | @@ -161,7 +161,7 @@ |
162 | 162 | HRESULT WINAPI glDirectDrawPalette::Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable)
|
163 | 163 | {
|
164 | 164 | if(!this) return DDERR_INVALIDPARAMS;
|
165 | | - ERR(DDERR_ALREADYINITIALIZED);
|
| 165 | + return DDERR_ALREADYINITIALIZED;
|
166 | 166 | }
|
167 | 167 | HRESULT WINAPI glDirectDrawPalette::SetEntries(DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries)
|
168 | 168 | {
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -28,17 +28,6 @@ |
29 | 29 | #include "glutil.h"
|
30 | 30 |
|
31 | 31 |
|
32 | | -static inline int NextMultipleOf8(int number){return ((number+7) & (~7));}
|
33 | | -static inline int NextMultipleOf4(int number){return ((number+3) & (~3));}
|
34 | | -static inline int NextMultipleOf2(int number){return ((number+1) & (~1));}
|
35 | | -#ifdef _M_X64
|
36 | | -#define NextMultipleOfWord NextMultipleOf8
|
37 | | -#else
|
38 | | -#define NextMultipleOfWord NextMultipleOf4
|
39 | | -#endif
|
40 | | -
|
41 | | -
|
42 | | -
|
43 | 32 | // DDRAW7 routines
|
44 | 33 | glDirectDrawSurface7::glDirectDrawSurface7(LPDIRECTDRAW7 lpDD7, LPDDSURFACEDESC2 lpDDSurfaceDesc2, LPDIRECTDRAWSURFACE7 *lplpDDSurface7, HRESULT *error, bool copysurface, glDirectDrawPalette *palettein)
|
45 | 34 | {
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -25,15 +25,6 @@ |
26 | 26 | #include "scalers.h"
|
27 | 27 | #include "shadergen.h"
|
28 | 28 |
|
29 | | -static inline int NextMultipleOf8(int number){return ((number+7) & (~7));}
|
30 | | -static inline int NextMultipleOf4(int number){return ((number+3) & (~3));}
|
31 | | -static inline int NextMultipleOf2(int number){return ((number+1) & (~1));}
|
32 | | -#ifdef _M_X64
|
33 | | -#define NextMultipleOfWord NextMultipleOf8
|
34 | | -#else
|
35 | | -#define NextMultipleOfWord NextMultipleOf4
|
36 | | -#endif
|
37 | | -
|
38 | 29 | WNDCLASSEXA wndclass;
|
39 | 30 | bool wndclasscreated = false;
|
40 | 31 | GLuint backbuffer = 0;
|