Index: ddraw/ShaderGen2D.cpp |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | // DXGL
|
3 | | -// Copyright (C) 2013-2017 William Feely
|
| 3 | +// Copyright (C) 2013-2018 William Feely
|
4 | 4 |
|
5 | 5 | // This library is free software; you can redistribute it and/or
|
6 | 6 | // modify it under the terms of the GNU Lesser General Public
|
— | — | @@ -55,6 +55,8 @@ |
56 | 56 | Bit 29: (DXGL) Source color key range
|
57 | 57 | Bit 30: (DXGL) Dest. color key range
|
58 | 58 | Bit 31: reserved for DXGL usage
|
| 59 | +Bits 32-39: Texture type input
|
| 60 | +Bits 40-47: Texture type output
|
59 | 61 | AND the dwFlags by 0xF2FAADFF before packing ROP index bits
|
60 | 62 | */
|
61 | 63 |
|
— | — | @@ -650,7 +652,7 @@ |
651 | 653 | "pixel = colorsizedest;\n",//FF WHITENESS
|
652 | 654 | };
|
653 | 655 |
|
654 | | -DWORD PackROPBits(DWORD rop, DWORD flags)
|
| 656 | +__int64 PackROPBits(DWORD rop, __int64 flags)
|
655 | 657 | {
|
656 | 658 | DWORD out = flags & 0xF2FAADFF;
|
657 | 659 | if (rop & 0x10000) out |= 1 << 9;
|
— | — | @@ -664,7 +666,7 @@ |
665 | 667 | return out;
|
666 | 668 | }
|
667 | 669 |
|
668 | | -DWORD UnpackROPBits(DWORD flags)
|
| 670 | +DWORD UnpackROPBits(__int64 flags)
|
669 | 671 | {
|
670 | 672 | DWORD out = 0;
|
671 | 673 | if (flags & (1 << 9)) out |= 1;
|
— | — | @@ -707,7 +709,7 @@ |
708 | 710 | gen->genindex = 0;
|
709 | 711 | }
|
710 | 712 |
|
711 | | -void ShaderGen2D_CreateShader2D(ShaderGen2D *gen, int index, DWORD id)
|
| 713 | +void ShaderGen2D_CreateShader2D(ShaderGen2D *gen, int index, __int64 id)
|
712 | 714 | {
|
713 | 715 | STRING tmp;
|
714 | 716 | DWORD rop;
|
Index: ddraw/ShaderGen2D.h |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | // DXGL
|
3 | | -// Copyright (C) 2013 William Feely
|
| 3 | +// Copyright (C) 2013-2018 William Feely
|
4 | 4 |
|
5 | 5 | // This library is free software; you can redistribute it and/or
|
6 | 6 | // modify it under the terms of the GNU Lesser General Public
|
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | struct GenShader2D
|
41 | 41 | {
|
42 | 42 | _GENSHADER2D shader;
|
43 | | - DWORD id;
|
| 43 | + __int64 id;
|
44 | 44 | };
|
45 | 45 |
|
46 | 46 | typedef struct ShaderGen2D
|
— | — | @@ -57,11 +57,11 @@ |
58 | 58 | extern const DWORD supported_rops[8];
|
59 | 59 | extern const DWORD supported_rops_gl2[8];
|
60 | 60 |
|
61 | | -DWORD PackROPBits(DWORD rop, DWORD flags);
|
| 61 | +__int64 PackROPBits(DWORD rop, __int64 flags);
|
62 | 62 |
|
63 | 63 | void ShaderGen2D_Init(ShaderGen2D *gen, glExtensions *ext, ShaderManager *shaderman);
|
64 | 64 | void ShaderGen2D_Delete(ShaderGen2D *gen);
|
65 | | -void ShaderGen2D_CreateShader2D(ShaderGen2D *gen, int index, DWORD id);
|
| 65 | +void ShaderGen2D_CreateShader2D(ShaderGen2D *gen, int index, __int64 id);
|
66 | 66 |
|
67 | 67 | #ifdef __cplusplus
|
68 | 68 | }
|
Index: ddraw/ddraw.vcxproj |
— | — | @@ -319,6 +319,7 @@ |
320 | 320 | <ClInclude Include="common.h" />
|
321 | 321 | <ClInclude Include="const.h" />
|
322 | 322 | <ClInclude Include="ddraw.h" />
|
| 323 | + <ClInclude Include="fourcc.h" />
|
323 | 324 | <ClInclude Include="glClassFactory.h" />
|
324 | 325 | <ClInclude Include="glDirect3D.h" />
|
325 | 326 | <ClInclude Include="glDirect3DDevice.h" />
|
— | — | @@ -403,6 +404,15 @@ |
404 | 405 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">
|
405 | 406 | </PrecompiledHeader>
|
406 | 407 | </ClCompile>
|
| 408 | + <ClCompile Include="fourcc.c">
|
| 409 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
| 410 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">NotUsing</PrecompiledHeader>
|
| 411 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug VS2017|Win32'">NotUsing</PrecompiledHeader>
|
| 412 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'">NotUsing</PrecompiledHeader>
|
| 413 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
| 414 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release VS2017|Win32'">NotUsing</PrecompiledHeader>
|
| 415 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Trace|Win32'">NotUsing</PrecompiledHeader>
|
| 416 | + </ClCompile>
|
407 | 417 | <ClCompile Include="glClassFactory.cpp" />
|
408 | 418 | <ClCompile Include="dxguid.c">
|
409 | 419 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
Index: ddraw/ddraw.vcxproj.filters |
— | — | @@ -161,6 +161,9 @@ |
162 | 162 | <ClInclude Include="colorconv.h">
|
163 | 163 | <Filter>Header Files</Filter>
|
164 | 164 | </ClInclude>
|
| 165 | + <ClInclude Include="fourcc.h">
|
| 166 | + <Filter>Header Files</Filter>
|
| 167 | + </ClInclude>
|
165 | 168 | </ItemGroup>
|
166 | 169 | <ItemGroup>
|
167 | 170 | <ClCompile Include="ddraw.cpp">
|
— | — | @@ -271,6 +274,9 @@ |
272 | 275 | <ClCompile Include="colorconv.c">
|
273 | 276 | <Filter>Source Files</Filter>
|
274 | 277 | </ClCompile>
|
| 278 | + <ClCompile Include="fourcc.c">
|
| 279 | + <Filter>Source Files</Filter>
|
| 280 | + </ClCompile>
|
275 | 281 | </ItemGroup>
|
276 | 282 | <ItemGroup>
|
277 | 283 | <ResourceCompile Include="ddraw.rc">
|
Index: ddraw/fourcc.c |
— | — | @@ -0,0 +1,31 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2018 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 <windows.h>
|
| 20 | +#include <mmsystem.h>
|
| 21 | +#include "fourcc.h"
|
| 22 | +
|
| 23 | +static const int START_FOURCC = __LINE__;
|
| 24 | +const DWORD dxglfourcc[] =
|
| 25 | +{ 0 // TODO: Add FourCC codes and remove placeholder
|
| 26 | +};
|
| 27 | +static const int END_FOURCC = __LINE__ - 4;
|
| 28 | +
|
| 29 | +int GetNumFOURCC()
|
| 30 | +{
|
| 31 | + return END_FOURCC - START_FOURCC;
|
| 32 | +} |
\ No newline at end of file |
Index: ddraw/fourcc.h |
— | — | @@ -0,0 +1,33 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2018 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 __FOURCC_H
|
| 21 | +#define __FOURCC_H
|
| 22 | +
|
| 23 | +#ifdef __cplusplus
|
| 24 | +extern "C" {
|
| 25 | +#endif
|
| 26 | +
|
| 27 | +extern const DWORD dxglfourcc[];
|
| 28 | +int GetNumFOURCC();
|
| 29 | +
|
| 30 | +#ifdef __cplusplus
|
| 31 | +}
|
| 32 | +#endif
|
| 33 | +
|
| 34 | +#endif //__FOURCC_H |
\ No newline at end of file |
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -32,6 +32,7 @@ |
33 | 33 | #include "glRenderer.h"
|
34 | 34 | #include "../common/version.h"
|
35 | 35 | #include "hooks.h"
|
| 36 | +#include "fourcc.h"
|
36 | 37 |
|
37 | 38 | #ifndef DISP_CHANGE_BADDUALVIEW
|
38 | 39 | #define DISP_CHANGE_BADDUALVIEW -6
|
— | — | @@ -1629,10 +1630,16 @@ |
1630 | 1631 | TRACE_ENTER(3,14,this,14,lpNumCodes,14,lpCodes);
|
1631 | 1632 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1632 | 1633 | if(!lpNumCodes) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
1633 | | - if(!lpCodes) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
1634 | | - FIXME("IDirectDraw::GetFourCCCodes: stub\n");
|
1635 | | - TRACE_EXIT(23,DDERR_GENERIC);
|
1636 | | - ERR(DDERR_GENERIC);
|
| 1634 | + *lpNumCodes = GetNumFOURCC();
|
| 1635 | + if (lpCodes)
|
| 1636 | + {
|
| 1637 | + for (int i = 0; i < *lpNumCodes; i++)
|
| 1638 | + {
|
| 1639 | + lpCodes[i] = dxglfourcc[i];
|
| 1640 | + }
|
| 1641 | + }
|
| 1642 | + TRACE_EXIT(23,DD_OK);
|
| 1643 | + return DD_OK;
|
1637 | 1644 | }
|
1638 | 1645 | HRESULT WINAPI glDirectDraw7::GetGDISurface(LPDIRECTDRAWSURFACE7 FAR *lplpGDIDDSurface)
|
1639 | 1646 | {
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -3353,7 +3353,7 @@ |
3354 | 3354 | RECT srcrect;
|
3355 | 3355 | RECT destrect, destrect2;
|
3356 | 3356 | This->ddInterface->GetSizes(sizes);
|
3357 | | - DWORD shaderid;
|
| 3357 | + unsigned __int64 shaderid;
|
3358 | 3358 | DDSURFACEDESC2 ddsd;
|
3359 | 3359 | ddsd = cmd->dest->levels[cmd->destlevel].ddsd;
|
3360 | 3360 | if (!memcmp(&cmd->destrect, &nullrect, sizeof(RECT)))
|
— | — | @@ -3379,6 +3379,7 @@ |
3380 | 3380 | if (rop_texture_usage[(cmd->bltfx.dwROP >> 16) & 0xFF] & 4) usepattern = TRUE;
|
3381 | 3381 | }
|
3382 | 3382 | else shaderid = cmd->flags & 0xF2FAADFF;
|
| 3383 | + //TODO: Add src/dest texture types
|
3383 | 3384 | if (cmd->flags & DDBLT_KEYDEST) usedest = TRUE;
|
3384 | 3385 | if (IsAlphaCKey())
|
3385 | 3386 | {
|
Index: vs8/ddraw/ddraw.vcproj |
— | — | @@ -270,6 +270,26 @@ |
271 | 271 | </FileConfiguration>
|
272 | 272 | </File>
|
273 | 273 | <File
|
| 274 | + RelativePath="..\..\ddraw\fourcc.c"
|
| 275 | + >
|
| 276 | + <FileConfiguration
|
| 277 | + Name="Debug|Win32"
|
| 278 | + >
|
| 279 | + <Tool
|
| 280 | + Name="VCCLCompilerTool"
|
| 281 | + UsePrecompiledHeader="0"
|
| 282 | + />
|
| 283 | + </FileConfiguration>
|
| 284 | + <FileConfiguration
|
| 285 | + Name="Release|Win32"
|
| 286 | + >
|
| 287 | + <Tool
|
| 288 | + Name="VCCLCompilerTool"
|
| 289 | + UsePrecompiledHeader="0"
|
| 290 | + />
|
| 291 | + </FileConfiguration>
|
| 292 | + </File>
|
| 293 | + <File
|
274 | 294 | RelativePath="..\..\ddraw\glClassFactory.cpp"
|
275 | 295 | >
|
276 | 296 | </File>
|
— | — | @@ -576,6 +596,10 @@ |
577 | 597 | >
|
578 | 598 | </File>
|
579 | 599 | <File
|
| 600 | + RelativePath="..\..\ddraw\fourcc.h"
|
| 601 | + >
|
| 602 | + </File>
|
| 603 | + <File
|
580 | 604 | RelativePath="..\..\ddraw\glClassFactory.h"
|
581 | 605 | >
|
582 | 606 | </File>
|