Index: ddraw/ddraw.vcxproj |
— | — | @@ -171,6 +171,7 @@ |
172 | 172 | <ClInclude Include="glDirectDrawPalette.h" />
|
173 | 173 | <ClInclude Include="glDirectDrawSurface.h" />
|
174 | 174 | <ClInclude Include="glExtensions.h" />
|
| 175 | + <ClInclude Include="glThread.h" />
|
175 | 176 | <ClInclude Include="glutil.h" />
|
176 | 177 | <ClInclude Include="include\d3d.h" />
|
177 | 178 | <ClInclude Include="include\d3dcaps.h" />
|
— | — | @@ -213,6 +214,7 @@ |
214 | 215 | <ClCompile Include="glDirectDrawPalette.cpp" />
|
215 | 216 | <ClCompile Include="glDirectDrawSurface.cpp" />
|
216 | 217 | <ClCompile Include="glExtensions.cpp" />
|
| 218 | + <ClCompile Include="glThread.cpp" />
|
217 | 219 | <ClCompile Include="glutil.cpp" />
|
218 | 220 | <ClCompile Include="precomp.cpp">
|
219 | 221 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'">Create</PrecompiledHeader>
|
Index: ddraw/ddraw.vcxproj.filters |
— | — | @@ -92,6 +92,9 @@ |
93 | 93 | <ClInclude Include="shadergen.h">
|
94 | 94 | <Filter>Header Files</Filter>
|
95 | 95 | </ClInclude>
|
| 96 | + <ClInclude Include="glThread.h">
|
| 97 | + <Filter>Header Files</Filter>
|
| 98 | + </ClInclude>
|
96 | 99 | </ItemGroup>
|
97 | 100 | <ItemGroup>
|
98 | 101 | <ClCompile Include="ddraw.cpp">
|
— | — | @@ -145,6 +148,9 @@ |
146 | 149 | <ClCompile Include="shadergen.cpp">
|
147 | 150 | <Filter>Source Files</Filter>
|
148 | 151 | </ClCompile>
|
| 152 | + <ClCompile Include="glThread.cpp">
|
| 153 | + <Filter>Source Files</Filter>
|
| 154 | + </ClCompile>
|
149 | 155 | </ItemGroup>
|
150 | 156 | <ItemGroup>
|
151 | 157 | <ResourceCompile Include="ddraw.rc">
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -578,7 +578,11 @@ |
579 | 579 | }
|
580 | 580 | if(surfaces)
|
581 | 581 | {
|
582 | | -
|
| 582 | + for(int i = 0; i < surfacecount; i++)
|
| 583 | + {
|
| 584 | + if(surfaces[i]) delete surfaces[i];
|
| 585 | + surfaces[i] = NULL;
|
| 586 | + }
|
583 | 587 | free(surfaces);
|
584 | 588 | }
|
585 | 589 | DeleteGL();
|
— | — | @@ -1544,6 +1548,12 @@ |
1545 | 1549 | if(hrender) *hrender = hRenderWnd;
|
1546 | 1550 | }
|
1547 | 1551 |
|
| 1552 | +void glDirectDraw7::DeleteSurface(glDirectDrawSurface7 *surface)
|
| 1553 | +{
|
| 1554 | + for(int i = 0; i < surfacecount; i++)
|
| 1555 | + if(surfaces[i] == surface) surfaces[i] = NULL;
|
| 1556 | +}
|
| 1557 | +
|
1548 | 1558 | // DDRAW1 wrapper
|
1549 | 1559 | glDirectDraw1::glDirectDraw1(glDirectDraw7 *gl_DD7)
|
1550 | 1560 | {
|
Index: ddraw/glDirectDraw.h |
— | — | @@ -105,6 +105,7 @@ |
106 | 106 | DWORD primaryx,primaryy,primaryrefresh,primarybpp;
|
107 | 107 | bool GetFullscreen(){return fullscreen;};
|
108 | 108 | void GetHandles(HWND *hwnd, HWND *hrender);
|
| 109 | + void DeleteSurface(glDirectDrawSurface7 *surface);
|
109 | 110 | glDirectDrawSurface7 *primary;
|
110 | 111 | bool hasHWnd;
|
111 | 112 | DIB dib;
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -480,7 +480,6 @@ |
481 | 481 | else *error = DDERR_INVALIDPARAMS;
|
482 | 482 | }
|
483 | 483 | }
|
484 | | - //ddInterface->AddRef();
|
485 | 484 | }
|
486 | 485 | glDirectDrawSurface7::~glDirectDrawSurface7()
|
487 | 486 | {
|
— | — | @@ -496,7 +495,7 @@ |
497 | 496 | if(buffer) free(buffer);
|
498 | 497 | if(bigbuffer) free(bigbuffer);
|
499 | 498 | if(zbuffer) zbuffer->Release();
|
500 | | - ddInterface->Release();
|
| 499 | + ddInterface->DeleteSurface(this);
|
501 | 500 | }
|
502 | 501 | HRESULT WINAPI glDirectDrawSurface7::QueryInterface(REFIID riid, void** ppvObj)
|
503 | 502 | {
|
Index: ddraw/glThread.cpp |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2012 William Feely
|
| 4 | +
|
| 5 | +// This library is free software; you can redistribute it and/or
|
| 6 | +// modify it under the terms of the GNU Lesser General Public
|
| 7 | +// License as published by the Free Software Foundation; either
|
| 8 | +// version 2.1 of the License, or (at your option) any later version.
|
| 9 | +
|
| 10 | +// This library is distributed in the hope that it will be useful,
|
| 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +// Lesser General Public License for more details.
|
| 14 | +
|
| 15 | +// You should have received a copy of the GNU Lesser General Public
|
| 16 | +// License along with this library; if not, write to the Free Software
|
| 17 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 18 | +
|
| 19 | +#include "common.h"
|
| 20 | +#include "glThread.h" |
\ No newline at end of file |
Index: ddraw/glThread.h |
— | — | @@ -0,0 +1,31 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2012 William Feely
|
| 4 | +
|
| 5 | +// This library is free software; you can redistribute it and/or
|
| 6 | +// modify it under the terms of the GNU Lesser General Public
|
| 7 | +// License as published by the Free Software Foundation; either
|
| 8 | +// version 2.1 of the License, or (at your option) any later version.
|
| 9 | +
|
| 10 | +// This library is distributed in the hope that it will be useful,
|
| 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +// Lesser General Public License for more details.
|
| 14 | +
|
| 15 | +// You should have received a copy of the GNU Lesser General Public
|
| 16 | +// License along with this library; if not, write to the Free Software
|
| 17 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 18 | +
|
| 19 | +#ifndef _GLTHREAD_H
|
| 20 | +#define _GLTHREAD_H
|
| 21 | +
|
| 22 | +class glThread
|
| 23 | +{
|
| 24 | +public:
|
| 25 | + glThread(int width, int height, int bpp, bool fullscreen, HWND hWnd, glDirectDraw7 *glDD7);
|
| 26 | + ~glThread();
|
| 27 | + void ThreadEntry(void *entry);
|
| 28 | +private:
|
| 29 | + glDirectDraw7 *ddInterface;
|
| 30 | +};
|
| 31 | +
|
| 32 | +#endif //_GLTHREAD_H |
\ No newline at end of file |