Index: ddraw/ddraw.cpp |
— | — | @@ -17,6 +17,7 @@ |
18 | 18 |
|
19 | 19 | #include "common.h"
|
20 | 20 | #include "ddraw.h"
|
| 21 | +#include "glClassFactory.h"
|
21 | 22 | #include "glDirectDraw.h"
|
22 | 23 | #include "glDirectDrawClipper.h"
|
23 | 24 | #include <intrin.h>
|
— | — | @@ -234,8 +235,12 @@ |
235 | 236 | }
|
236 | 237 | HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
237 | 238 | {
|
238 | | - FIXME("DllGetClassObject: stub\n");
|
239 | | - return CLASS_E_CLASSNOTAVAILABLE;
|
| 239 | + if(rclsid != CLSID_DirectDraw) return CLASS_E_CLASSNOTAVAILABLE;
|
| 240 | + glClassFactory *factory = new glClassFactory;
|
| 241 | + if(factory == NULL) return E_OUTOFMEMORY;
|
| 242 | + HRESULT result = factory->QueryInterface(riid,ppv);
|
| 243 | + factory->Release();
|
| 244 | + return result;
|
240 | 245 | }
|
241 | 246 | DDRAW_API void WINAPI GetDDSurfaceLocal()
|
242 | 247 | {
|
Index: ddraw/ddraw.vcxproj |
— | — | @@ -161,6 +161,7 @@ |
162 | 162 | <ItemGroup>
|
163 | 163 | <ClInclude Include="common.h" />
|
164 | 164 | <ClInclude Include="ddraw.h" />
|
| 165 | + <ClInclude Include="glClassFactory.h" />
|
165 | 166 | <ClInclude Include="glDirectDraw.h" />
|
166 | 167 | <ClInclude Include="glDirectDrawClipper.h" />
|
167 | 168 | <ClInclude Include="glDirectDrawPalette.h" />
|
— | — | @@ -191,6 +192,7 @@ |
192 | 193 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">
|
193 | 194 | </PrecompiledHeader>
|
194 | 195 | </ClCompile>
|
| 196 | + <ClCompile Include="glClassFactory.cpp" />
|
195 | 197 | <ClCompile Include="dxguid.cpp">
|
196 | 198 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
197 | 199 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'">NotUsing</PrecompiledHeader>
|
Index: ddraw/ddraw.vcxproj.filters |
— | — | @@ -71,6 +71,9 @@ |
72 | 72 | <ClInclude Include="scalers.h">
|
73 | 73 | <Filter>Header Files</Filter>
|
74 | 74 | </ClInclude>
|
| 75 | + <ClInclude Include="glClassFactory.h">
|
| 76 | + <Filter>Header Files</Filter>
|
| 77 | + </ClInclude>
|
75 | 78 | </ItemGroup>
|
76 | 79 | <ItemGroup>
|
77 | 80 | <ClCompile Include="ddraw.cpp">
|
— | — | @@ -106,6 +109,9 @@ |
107 | 110 | <ClCompile Include="scalers.cpp">
|
108 | 111 | <Filter>Source Files</Filter>
|
109 | 112 | </ClCompile>
|
| 113 | + <ClCompile Include="glClassFactory.cpp">
|
| 114 | + <Filter>Source Files</Filter>
|
| 115 | + </ClCompile>
|
110 | 116 | </ItemGroup>
|
111 | 117 | <ItemGroup>
|
112 | 118 | <ResourceCompile Include="ddraw.rc">
|
Index: ddraw/glClassFactory.cpp |
— | — | @@ -0,0 +1,50 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2011 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 "glClassFactory.h"
|
| 21 | +
|
| 22 | +ULONG WINAPI glClassFactory::AddRef()
|
| 23 | +{
|
| 24 | + refcount++;
|
| 25 | + return refcount;
|
| 26 | +}
|
| 27 | +ULONG WINAPI glClassFactory::Release()
|
| 28 | +{
|
| 29 | + ULONG ret;
|
| 30 | + refcount--;
|
| 31 | + ret = refcount;
|
| 32 | + if(refcount == 0) delete this;
|
| 33 | + return ret;
|
| 34 | +}
|
| 35 | +
|
| 36 | +HRESULT WINAPI glClassFactory::QueryInterface(REFIID riid, void** ppvObj)
|
| 37 | +{
|
| 38 | + FIXME("glClassFactory::QueryInterface: stub");
|
| 39 | + return E_FAIL;
|
| 40 | +}
|
| 41 | +HRESULT WINAPI glClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
|
| 42 | +{
|
| 43 | + FIXME("glClassFactory::CreateInterface: stub");
|
| 44 | + return E_FAIL;
|
| 45 | +}
|
| 46 | +HRESULT WINAPI glClassFactory::LockServer(BOOL fLock)
|
| 47 | +{
|
| 48 | + FIXME("glClassFactory::LockServer: stub");
|
| 49 | + return E_FAIL;
|
| 50 | +}
|
| 51 | +
|
Index: ddraw/glClassFactory.h |
— | — | @@ -0,0 +1,36 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2011 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 | +#pragma once
|
| 20 | +#ifndef _DXGLCLASSFACTORY_H
|
| 21 | +#define _DXGLCLASSFACTORY_H
|
| 22 | +
|
| 23 | +class glClassFactory : public IClassFactory
|
| 24 | +{
|
| 25 | +public:
|
| 26 | + ULONG WINAPI AddRef();
|
| 27 | + ULONG WINAPI Release();
|
| 28 | + HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
|
| 29 | + HRESULT WINAPI CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject);
|
| 30 | + HRESULT WINAPI LockServer(BOOL fLock);
|
| 31 | + glClassFactory() {refcount = 1; lockcount = 0;}
|
| 32 | + ~glClassFactory() {}
|
| 33 | +private:
|
| 34 | + ULONG refcount;
|
| 35 | + ULONG lockcount;
|
| 36 | +};
|
| 37 | +#endif //_DXGLCLASSFACTORY_H
|