Index: ddraw/glDirectDraw.cpp |
— | — | @@ -831,7 +831,7 @@ |
832 | 832 | surfacecountmax += 1024;
|
833 | 833 | }
|
834 | 834 | HRESULT error;
|
835 | | - surfaces[surfacecount-1] = new glDirectDrawSurface7(this,lpDDSurfaceDesc2,lplpDDSurface,&error,false,NULL);
|
| 835 | + surfaces[surfacecount-1] = new glDirectDrawSurface7(this,lpDDSurfaceDesc2,&error,false,NULL);
|
836 | 836 | if(lpDDSurfaceDesc2->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
|
837 | 837 | {
|
838 | 838 | primary = surfaces[surfacecount-1];
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -37,9 +37,9 @@ |
38 | 38 |
|
39 | 39 |
|
40 | 40 | // DDRAW7 routines
|
41 | | -glDirectDrawSurface7::glDirectDrawSurface7(LPDIRECTDRAW7 lpDD7, LPDDSURFACEDESC2 lpDDSurfaceDesc2, LPDIRECTDRAWSURFACE7 *lplpDDSurface7, HRESULT *error, bool copysurface, glDirectDrawPalette *palettein)
|
| 41 | +glDirectDrawSurface7::glDirectDrawSurface7(LPDIRECTDRAW7 lpDD7, LPDDSURFACEDESC2 lpDDSurfaceDesc2, HRESULT *error, bool copysurface, glDirectDrawPalette *palettein)
|
42 | 42 | {
|
43 | | - TRACE_ENTER(7,14,this,14,lpDD7,14,lpDDSurfaceDesc2,14,lplpDDSurface7,14,error,21,copysurface,14,palettein);
|
| 43 | + TRACE_ENTER(6,14,this,14,lpDD7,14,lpDDSurfaceDesc2,14,error,21,copysurface,14,palettein);
|
44 | 44 | hasstencil = false;
|
45 | 45 | dirty = 2;
|
46 | 46 | handle = 0;
|
— | — | @@ -335,14 +335,12 @@ |
336 | 336 | ddsdBack.dwBackBufferCount--;
|
337 | 337 | ddsdBack.ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER;
|
338 | 338 | ddsdBack.ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER;
|
339 | | - glDirectDrawSurface7 *tmp;
|
340 | | - backbuffer = new glDirectDrawSurface7(ddInterface,&ddsdBack,(LPDIRECTDRAWSURFACE7 *)&tmp,error,false,palette);
|
| 339 | + backbuffer = new glDirectDrawSurface7(ddInterface,&ddsdBack,error,false,palette);
|
341 | 340 | }
|
342 | 341 | else if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT){}
|
343 | 342 | else *error = DDERR_INVALIDPARAMS;
|
344 | 343 | }
|
345 | 344 | }
|
346 | | - TRACE_VAR("*lplpDDSurface7",14,*lplpDDSurface7);
|
347 | 345 | TRACE_VAR("*error",23,*error);
|
348 | 346 | TRACE_EXIT(-1,0);
|
349 | 347 | }
|
Index: ddraw/glDirectDrawSurface.h |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | class glDirectDrawSurface7 : public IDirectDrawSurface7
|
41 | 41 | {
|
42 | 42 | public:
|
43 | | - glDirectDrawSurface7(LPDIRECTDRAW7 lpDD7, LPDDSURFACEDESC2 lpDDSurfaceDesc2, LPDIRECTDRAWSURFACE7 *lplpDDSurface7, HRESULT *error, bool copysurface, glDirectDrawPalette *palettein);
|
| 43 | + glDirectDrawSurface7(LPDIRECTDRAW7 lpDD7, LPDDSURFACEDESC2 lpDDSurfaceDesc2, HRESULT *error, bool copysurface, glDirectDrawPalette *palettein);
|
44 | 44 | virtual ~glDirectDrawSurface7();
|
45 | 45 | // ddraw 1+ api
|
46 | 46 | HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
|
Index: ddraw/shadergen.cpp |
— | — | @@ -25,10 +25,11 @@ |
26 | 26 | #include "shadergen.h"
|
27 | 27 | #include "shaders.h"
|
28 | 28 |
|
29 | | -GenShader genshaders[256];
|
| 29 | +GenShader *genshaders = NULL;
|
30 | 30 | static __int64 current_shader = 0;
|
31 | 31 | static __int64 current_texid[8];
|
32 | 32 | static int shadercount = 0;
|
| 33 | +static int maxshaders = 0;
|
33 | 34 | static int genindex = 0;
|
34 | 35 | static bool initialized = false;
|
35 | 36 | static bool isbuiltin = true;
|
— | — | @@ -103,6 +104,9 @@ |
104 | 105 | */
|
105 | 106 | void ZeroShaderArray()
|
106 | 107 | {
|
| 108 | + if(genshaders) free(genshaders);
|
| 109 | + maxshaders = 256;
|
| 110 | + genshaders = (GenShader*)malloc(256*sizeof(GenShader));
|
107 | 111 | ZeroMemory(genshaders,256*sizeof(GenShader));
|
108 | 112 | current_shader = 0;
|
109 | 113 | isbuiltin = true;
|
— | — | @@ -113,6 +117,7 @@ |
114 | 118 | */
|
115 | 119 | void ClearShaders()
|
116 | 120 | {
|
| 121 | + if(!genshaders) return;
|
117 | 122 | for(int i = 0; i < shadercount; i++)
|
118 | 123 | {
|
119 | 124 | genshaders[i].id = 0;
|
— | — | @@ -122,7 +127,7 @@ |
123 | 128 | if(genshaders[i].shader.vs) glDeleteShader(genshaders[i].shader.vs);
|
124 | 129 | if(genshaders[i].shader.fsrc) delete genshaders[i].shader.fsrc;
|
125 | 130 | if(genshaders[i].shader.vsrc) delete genshaders[i].shader.vsrc;
|
126 | | - ZeroMemory(&genshaders[i].shader,sizeof(_GENSHADER));
|
| 131 | + if(genshaders) free(genshaders);
|
127 | 132 | }
|
128 | 133 | current_genshader = -1;
|
129 | 134 | shadercount = 0;
|
Index: ddraw/shadergen.h |
— | — | @@ -45,6 +45,6 @@ |
46 | 46 | GLuint GetProgram();
|
47 | 47 | void ZeroShaderArray();
|
48 | 48 | void CreateShader(int index, __int64 id, TEXTURESTAGE *texstate, int *texcoords);
|
49 | | -extern GenShader genshaders[256];
|
| 49 | +extern GenShader *genshaders;
|
50 | 50 | extern int current_genshader;
|
51 | 51 | #endif |
\ No newline at end of file |