1
0
mirror of https://github.com/DxWnd/DxWnd.reloaded synced 2024-12-30 09:25:35 +01:00

v2_02_37_src

Former-commit-id: c7b580036eb054a39dd0d693576369b6ece331e3
This commit is contained in:
gho tik 2013-11-10 11:38:21 -05:00 committed by Refael ACkermann
parent e0e9bcffd2
commit 15a98a4dff
76 changed files with 8302 additions and 715 deletions

1688
Include/d3d.h Normal file

File diff suppressed because it is too large Load Diff

601
Include/d3dcaps.h Normal file
View File

@ -0,0 +1,601 @@
/*==========================================================================;
*
* Copyright (C) Microsoft Corporation. All Rights Reserved.
*
* File: d3dcaps.h
* Content: Direct3D capabilities include file
*
***************************************************************************/
#ifndef _D3DCAPS_H
#define _D3DCAPS_H
/*
* Pull in DirectDraw include file automatically:
*/
#include "ddraw.h"
#ifndef DIRECT3D_VERSION
#define DIRECT3D_VERSION 0x0700
#endif
#if defined(_X86_) || defined(_IA64_)
#pragma pack(4)
#endif
/* Description of capabilities of transform */
typedef struct _D3DTRANSFORMCAPS {
DWORD dwSize;
DWORD dwCaps;
} D3DTRANSFORMCAPS, *LPD3DTRANSFORMCAPS;
#define D3DTRANSFORMCAPS_CLIP 0x00000001L /* Will clip whilst transforming */
/* Description of capabilities of lighting */
typedef struct _D3DLIGHTINGCAPS {
DWORD dwSize;
DWORD dwCaps; /* Lighting caps */
DWORD dwLightingModel; /* Lighting model - RGB or mono */
DWORD dwNumLights; /* Number of lights that can be handled */
} D3DLIGHTINGCAPS, *LPD3DLIGHTINGCAPS;
#define D3DLIGHTINGMODEL_RGB 0x00000001L
#define D3DLIGHTINGMODEL_MONO 0x00000002L
#define D3DLIGHTCAPS_POINT 0x00000001L /* Point lights supported */
#define D3DLIGHTCAPS_SPOT 0x00000002L /* Spot lights supported */
#define D3DLIGHTCAPS_DIRECTIONAL 0x00000004L /* Directional lights supported */
#if(DIRECT3D_VERSION < 0x700)
#define D3DLIGHTCAPS_PARALLELPOINT 0x00000008L /* Parallel point lights supported */
#endif
#if(DIRECT3D_VERSION < 0x500)
#define D3DLIGHTCAPS_GLSPOT 0x00000010L /* GL syle spot lights supported */
#endif
/* Description of capabilities for each primitive type */
typedef struct _D3DPrimCaps {
DWORD dwSize;
DWORD dwMiscCaps; /* Capability flags */
DWORD dwRasterCaps;
DWORD dwZCmpCaps;
DWORD dwSrcBlendCaps;
DWORD dwDestBlendCaps;
DWORD dwAlphaCmpCaps;
DWORD dwShadeCaps;
DWORD dwTextureCaps;
DWORD dwTextureFilterCaps;
DWORD dwTextureBlendCaps;
DWORD dwTextureAddressCaps;
DWORD dwStippleWidth; /* maximum width and height of */
DWORD dwStippleHeight; /* of supported stipple (up to 32x32) */
} D3DPRIMCAPS, *LPD3DPRIMCAPS;
/* D3DPRIMCAPS dwMiscCaps */
#define D3DPMISCCAPS_MASKPLANES 0x00000001L
#define D3DPMISCCAPS_MASKZ 0x00000002L
#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L
#define D3DPMISCCAPS_CONFORMANT 0x00000008L
#define D3DPMISCCAPS_CULLNONE 0x00000010L
#define D3DPMISCCAPS_CULLCW 0x00000020L
#define D3DPMISCCAPS_CULLCCW 0x00000040L
/* D3DPRIMCAPS dwRasterCaps */
#define D3DPRASTERCAPS_DITHER 0x00000001L
#define D3DPRASTERCAPS_ROP2 0x00000002L
#define D3DPRASTERCAPS_XOR 0x00000004L
#define D3DPRASTERCAPS_PAT 0x00000008L
#define D3DPRASTERCAPS_ZTEST 0x00000010L
#define D3DPRASTERCAPS_SUBPIXEL 0x00000020L
#define D3DPRASTERCAPS_SUBPIXELX 0x00000040L
#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L
#define D3DPRASTERCAPS_FOGTABLE 0x00000100L
#define D3DPRASTERCAPS_STIPPLE 0x00000200L
#if(DIRECT3D_VERSION >= 0x0500)
#define D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT 0x00000400L
#define D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT 0x00000800L
#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000L
#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L
#define D3DPRASTERCAPS_ZBIAS 0x00004000L
#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L
#define D3DPRASTERCAPS_FOGRANGE 0x00010000L
#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L
#endif /* DIRECT3D_VERSION >= 0x0500 */
#if(DIRECT3D_VERSION >= 0x0600)
#define D3DPRASTERCAPS_WBUFFER 0x00040000L
#define D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT 0x00080000L
#define D3DPRASTERCAPS_WFOG 0x00100000L
#define D3DPRASTERCAPS_ZFOG 0x00200000L
#endif /* DIRECT3D_VERSION >= 0x0600 */
/* D3DPRIMCAPS dwZCmpCaps, dwAlphaCmpCaps */
#define D3DPCMPCAPS_NEVER 0x00000001L
#define D3DPCMPCAPS_LESS 0x00000002L
#define D3DPCMPCAPS_EQUAL 0x00000004L
#define D3DPCMPCAPS_LESSEQUAL 0x00000008L
#define D3DPCMPCAPS_GREATER 0x00000010L
#define D3DPCMPCAPS_NOTEQUAL 0x00000020L
#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L
#define D3DPCMPCAPS_ALWAYS 0x00000080L
/* D3DPRIMCAPS dwSourceBlendCaps, dwDestBlendCaps */
#define D3DPBLENDCAPS_ZERO 0x00000001L
#define D3DPBLENDCAPS_ONE 0x00000002L
#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L
#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L
#define D3DPBLENDCAPS_SRCALPHA 0x00000010L
#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L
#define D3DPBLENDCAPS_DESTALPHA 0x00000040L
#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L
#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L
#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L
#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L
#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L
#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L
/* D3DPRIMCAPS dwShadeCaps */
#define D3DPSHADECAPS_COLORFLATMONO 0x00000001L
#define D3DPSHADECAPS_COLORFLATRGB 0x00000002L
#define D3DPSHADECAPS_COLORGOURAUDMONO 0x00000004L
#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L
#define D3DPSHADECAPS_COLORPHONGMONO 0x00000010L
#define D3DPSHADECAPS_COLORPHONGRGB 0x00000020L
#define D3DPSHADECAPS_SPECULARFLATMONO 0x00000040L
#define D3DPSHADECAPS_SPECULARFLATRGB 0x00000080L
#define D3DPSHADECAPS_SPECULARGOURAUDMONO 0x00000100L
#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L
#define D3DPSHADECAPS_SPECULARPHONGMONO 0x00000400L
#define D3DPSHADECAPS_SPECULARPHONGRGB 0x00000800L
#define D3DPSHADECAPS_ALPHAFLATBLEND 0x00001000L
#define D3DPSHADECAPS_ALPHAFLATSTIPPLED 0x00002000L
#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L
#define D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED 0x00008000L
#define D3DPSHADECAPS_ALPHAPHONGBLEND 0x00010000L
#define D3DPSHADECAPS_ALPHAPHONGSTIPPLED 0x00020000L
#define D3DPSHADECAPS_FOGFLAT 0x00040000L
#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L
#define D3DPSHADECAPS_FOGPHONG 0x00100000L
/* D3DPRIMCAPS dwTextureCaps */
/*
* Perspective-correct texturing is supported
*/
#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L
/*
* Power-of-2 texture dimensions are required
*/
#define D3DPTEXTURECAPS_POW2 0x00000002L
/*
* Alpha in texture pixels is supported
*/
#define D3DPTEXTURECAPS_ALPHA 0x00000004L
/*
* Color-keyed textures are supported
*/
#define D3DPTEXTURECAPS_TRANSPARENCY 0x00000008L
/*
* obsolete, see D3DPTADDRESSCAPS_BORDER
*/
#define D3DPTEXTURECAPS_BORDER 0x00000010L
/*
* Only square textures are supported
*/
#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L
#if(DIRECT3D_VERSION >= 0x0600)
/*
* Texture indices are not scaled by the texture size prior
* to interpolation.
*/
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L
/*
* Device can draw alpha from texture palettes
*/
#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L
/*
* Device can use non-POW2 textures if:
* 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
* 2) D3DRS_WRAP(N) is zero for this texture's coordinates
* 3) mip mapping is not enabled (use magnification filter only)
*/
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L
#endif /* DIRECT3D_VERSION >= 0x0600 */
#if(DIRECT3D_VERSION >= 0x0700)
// 0x00000200L unused
/*
* Device can divide transformed texture coordinates by the
* COUNTth texture coordinate (can do D3DTTFF_PROJECTED)
*/
#define D3DPTEXTURECAPS_PROJECTED 0x00000400L
/*
* Device can do cubemap textures
*/
#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L
#define D3DPTEXTURECAPS_COLORKEYBLEND 0x00001000L
#endif /* DIRECT3D_VERSION >= 0x0700 */
/* D3DPRIMCAPS dwTextureFilterCaps */
#define D3DPTFILTERCAPS_NEAREST 0x00000001L
#define D3DPTFILTERCAPS_LINEAR 0x00000002L
#define D3DPTFILTERCAPS_MIPNEAREST 0x00000004L
#define D3DPTFILTERCAPS_MIPLINEAR 0x00000008L
#define D3DPTFILTERCAPS_LINEARMIPNEAREST 0x00000010L
#define D3DPTFILTERCAPS_LINEARMIPLINEAR 0x00000020L
#if(DIRECT3D_VERSION >= 0x0600)
/* Device3 Min Filter */
#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L
#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L
#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L
/* Device3 Mip Filter */
#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L
#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L
/* Device3 Mag Filter */
#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L
#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L
#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L
#define D3DPTFILTERCAPS_MAGFAFLATCUBIC 0x08000000L
#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC 0x10000000L
#endif /* DIRECT3D_VERSION >= 0x0600 */
/* D3DPRIMCAPS dwTextureBlendCaps */
#define D3DPTBLENDCAPS_DECAL 0x00000001L
#define D3DPTBLENDCAPS_MODULATE 0x00000002L
#define D3DPTBLENDCAPS_DECALALPHA 0x00000004L
#define D3DPTBLENDCAPS_MODULATEALPHA 0x00000008L
#define D3DPTBLENDCAPS_DECALMASK 0x00000010L
#define D3DPTBLENDCAPS_MODULATEMASK 0x00000020L
#define D3DPTBLENDCAPS_COPY 0x00000040L
#if(DIRECT3D_VERSION >= 0x0500)
#define D3DPTBLENDCAPS_ADD 0x00000080L
#endif /* DIRECT3D_VERSION >= 0x0500 */
/* D3DPRIMCAPS dwTextureAddressCaps */
#define D3DPTADDRESSCAPS_WRAP 0x00000001L
#define D3DPTADDRESSCAPS_MIRROR 0x00000002L
#define D3DPTADDRESSCAPS_CLAMP 0x00000004L
#if(DIRECT3D_VERSION >= 0x0500)
#define D3DPTADDRESSCAPS_BORDER 0x00000008L
#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L
#endif /* DIRECT3D_VERSION >= 0x0500 */
#if(DIRECT3D_VERSION >= 0x0600)
/* D3DDEVICEDESC dwStencilCaps */
#define D3DSTENCILCAPS_KEEP 0x00000001L
#define D3DSTENCILCAPS_ZERO 0x00000002L
#define D3DSTENCILCAPS_REPLACE 0x00000004L
#define D3DSTENCILCAPS_INCRSAT 0x00000008L
#define D3DSTENCILCAPS_DECRSAT 0x00000010L
#define D3DSTENCILCAPS_INVERT 0x00000020L
#define D3DSTENCILCAPS_INCR 0x00000040L
#define D3DSTENCILCAPS_DECR 0x00000080L
/* D3DDEVICEDESC dwTextureOpCaps */
#define D3DTEXOPCAPS_DISABLE 0x00000001L
#define D3DTEXOPCAPS_SELECTARG1 0x00000002L
#define D3DTEXOPCAPS_SELECTARG2 0x00000004L
#define D3DTEXOPCAPS_MODULATE 0x00000008L
#define D3DTEXOPCAPS_MODULATE2X 0x00000010L
#define D3DTEXOPCAPS_MODULATE4X 0x00000020L
#define D3DTEXOPCAPS_ADD 0x00000040L
#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L
#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L
#define D3DTEXOPCAPS_SUBTRACT 0x00000200L
#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L
#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L
#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L
#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L
#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L
#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L
#define D3DTEXOPCAPS_PREMODULATE 0x00010000L
#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L
#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L
#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L
#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L
#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L
#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L
#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L
/* D3DDEVICEDESC dwFVFCaps flags */
#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */
#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */
#endif /* DIRECT3D_VERSION >= 0x0600 */
/*
* Description for a device.
* This is used to describe a device that is to be created or to query
* the current device.
*/
typedef struct _D3DDeviceDesc {
DWORD dwSize; /* Size of D3DDEVICEDESC structure */
DWORD dwFlags; /* Indicates which fields have valid data */
D3DCOLORMODEL dcmColorModel; /* Color model of device */
DWORD dwDevCaps; /* Capabilities of device */
D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */
BOOL bClipping; /* Device can do 3D clipping */
D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */
D3DPRIMCAPS dpcLineCaps;
D3DPRIMCAPS dpcTriCaps;
DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */
DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */
DWORD dwMaxBufferSize; /* Maximum execute buffer size */
DWORD dwMaxVertexCount; /* Maximum vertex count */
#if(DIRECT3D_VERSION >= 0x0500)
// *** New fields for DX5 *** //
// Width and height caps are 0 for legacy HALs.
DWORD dwMinTextureWidth, dwMinTextureHeight;
DWORD dwMaxTextureWidth, dwMaxTextureHeight;
DWORD dwMinStippleWidth, dwMaxStippleWidth;
DWORD dwMinStippleHeight, dwMaxStippleHeight;
#endif /* DIRECT3D_VERSION >= 0x0500 */
#if(DIRECT3D_VERSION >= 0x0600)
// New fields for DX6
DWORD dwMaxTextureRepeat;
DWORD dwMaxTextureAspectRatio;
DWORD dwMaxAnisotropy;
// Guard band that the rasterizer can accommodate
// Screen-space vertices inside this space but outside the viewport
// will get clipped properly.
D3DVALUE dvGuardBandLeft;
D3DVALUE dvGuardBandTop;
D3DVALUE dvGuardBandRight;
D3DVALUE dvGuardBandBottom;
D3DVALUE dvExtentsAdjust;
DWORD dwStencilCaps;
DWORD dwFVFCaps;
DWORD dwTextureOpCaps;
WORD wMaxTextureBlendStages;
WORD wMaxSimultaneousTextures;
#endif /* DIRECT3D_VERSION >= 0x0600 */
} D3DDEVICEDESC, *LPD3DDEVICEDESC;
#if(DIRECT3D_VERSION >= 0x0700)
typedef struct _D3DDeviceDesc7 {
DWORD dwDevCaps; /* Capabilities of device */
D3DPRIMCAPS dpcLineCaps;
D3DPRIMCAPS dpcTriCaps;
DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */
DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */
DWORD dwMinTextureWidth, dwMinTextureHeight;
DWORD dwMaxTextureWidth, dwMaxTextureHeight;
DWORD dwMaxTextureRepeat;
DWORD dwMaxTextureAspectRatio;
DWORD dwMaxAnisotropy;
D3DVALUE dvGuardBandLeft;
D3DVALUE dvGuardBandTop;
D3DVALUE dvGuardBandRight;
D3DVALUE dvGuardBandBottom;
D3DVALUE dvExtentsAdjust;
DWORD dwStencilCaps;
DWORD dwFVFCaps;
DWORD dwTextureOpCaps;
WORD wMaxTextureBlendStages;
WORD wMaxSimultaneousTextures;
DWORD dwMaxActiveLights;
D3DVALUE dvMaxVertexW;
GUID deviceGUID;
WORD wMaxUserClipPlanes;
WORD wMaxVertexBlendMatrices;
DWORD dwVertexProcessingCaps;
DWORD dwReserved1;
DWORD dwReserved2;
DWORD dwReserved3;
DWORD dwReserved4;
} D3DDEVICEDESC7, *LPD3DDEVICEDESC7;
#endif /* DIRECT3D_VERSION >= 0x0700 */
#define D3DDEVICEDESCSIZE (sizeof(D3DDEVICEDESC))
#define D3DDEVICEDESC7SIZE (sizeof(D3DDEVICEDESC7))
typedef HRESULT (CALLBACK * LPD3DENUMDEVICESCALLBACK)(GUID FAR *lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID);
#if(DIRECT3D_VERSION >= 0x0700)
typedef HRESULT (CALLBACK * LPD3DENUMDEVICESCALLBACK7)(LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC7, LPVOID);
#endif /* DIRECT3D_VERSION >= 0x0700 */
/* D3DDEVICEDESC dwFlags indicating valid fields */
#define D3DDD_COLORMODEL 0x00000001L /* dcmColorModel is valid */
#define D3DDD_DEVCAPS 0x00000002L /* dwDevCaps is valid */
#define D3DDD_TRANSFORMCAPS 0x00000004L /* dtcTransformCaps is valid */
#define D3DDD_LIGHTINGCAPS 0x00000008L /* dlcLightingCaps is valid */
#define D3DDD_BCLIPPING 0x00000010L /* bClipping is valid */
#define D3DDD_LINECAPS 0x00000020L /* dpcLineCaps is valid */
#define D3DDD_TRICAPS 0x00000040L /* dpcTriCaps is valid */
#define D3DDD_DEVICERENDERBITDEPTH 0x00000080L /* dwDeviceRenderBitDepth is valid */
#define D3DDD_DEVICEZBUFFERBITDEPTH 0x00000100L /* dwDeviceZBufferBitDepth is valid */
#define D3DDD_MAXBUFFERSIZE 0x00000200L /* dwMaxBufferSize is valid */
#define D3DDD_MAXVERTEXCOUNT 0x00000400L /* dwMaxVertexCount is valid */
/* D3DDEVICEDESC dwDevCaps flags */
#define D3DDEVCAPS_FLOATTLVERTEX 0x00000001L /* Device accepts floating point */
/* for post-transform vertex data */
#define D3DDEVCAPS_SORTINCREASINGZ 0x00000002L /* Device needs data sorted for increasing Z */
#define D3DDEVCAPS_SORTDECREASINGZ 0X00000004L /* Device needs data sorted for decreasing Z */
#define D3DDEVCAPS_SORTEXACT 0x00000008L /* Device needs data sorted exactly */
#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */
#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */
#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */
#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */
#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */
#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */
#if(DIRECT3D_VERSION >= 0x0500)
#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */
#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */
#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */
#endif /* DIRECT3D_VERSION >= 0x0500 */
#if(DIRECT3D_VERSION >= 0x0600)
#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */
#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */
#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/
#endif /* DIRECT3D_VERSION >= 0x0600 */
#if(DIRECT3D_VERSION >= 0x0700)
#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */
#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */
#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */
/*
* These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field
*/
/* device can do texgen */
#define D3DVTXPCAPS_TEXGEN 0x00000001L
/* device can do IDirect3DDevice7 colormaterialsource ops */
#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L
/* device can do vertex fog */
#define D3DVTXPCAPS_VERTEXFOG 0x00000004L
/* device can do directional lights */
#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L
/* device can do positional lights (includes point and spot) */
#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L
/* device can do local viewer */
#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L
#endif /* DIRECT3D_VERSION >= 0x0700 */
#define D3DFDS_COLORMODEL 0x00000001L /* Match color model */
#define D3DFDS_GUID 0x00000002L /* Match guid */
#define D3DFDS_HARDWARE 0x00000004L /* Match hardware/software */
#define D3DFDS_TRIANGLES 0x00000008L /* Match in triCaps */
#define D3DFDS_LINES 0x00000010L /* Match in lineCaps */
#define D3DFDS_MISCCAPS 0x00000020L /* Match primCaps.dwMiscCaps */
#define D3DFDS_RASTERCAPS 0x00000040L /* Match primCaps.dwRasterCaps */
#define D3DFDS_ZCMPCAPS 0x00000080L /* Match primCaps.dwZCmpCaps */
#define D3DFDS_ALPHACMPCAPS 0x00000100L /* Match primCaps.dwAlphaCmpCaps */
#define D3DFDS_SRCBLENDCAPS 0x00000200L /* Match primCaps.dwSourceBlendCaps */
#define D3DFDS_DSTBLENDCAPS 0x00000400L /* Match primCaps.dwDestBlendCaps */
#define D3DFDS_SHADECAPS 0x00000800L /* Match primCaps.dwShadeCaps */
#define D3DFDS_TEXTURECAPS 0x00001000L /* Match primCaps.dwTextureCaps */
#define D3DFDS_TEXTUREFILTERCAPS 0x00002000L /* Match primCaps.dwTextureFilterCaps */
#define D3DFDS_TEXTUREBLENDCAPS 0x00004000L /* Match primCaps.dwTextureBlendCaps */
#define D3DFDS_TEXTUREADDRESSCAPS 0x00008000L /* Match primCaps.dwTextureBlendCaps */
/*
* FindDevice arguments
*/
typedef struct _D3DFINDDEVICESEARCH {
DWORD dwSize;
DWORD dwFlags;
BOOL bHardware;
D3DCOLORMODEL dcmColorModel;
GUID guid;
DWORD dwCaps;
D3DPRIMCAPS dpcPrimCaps;
} D3DFINDDEVICESEARCH, *LPD3DFINDDEVICESEARCH;
typedef struct _D3DFINDDEVICERESULT {
DWORD dwSize;
GUID guid; /* guid which matched */
D3DDEVICEDESC ddHwDesc; /* hardware D3DDEVICEDESC */
D3DDEVICEDESC ddSwDesc; /* software D3DDEVICEDESC */
} D3DFINDDEVICERESULT, *LPD3DFINDDEVICERESULT;
/*
* Description of execute buffer.
*/
typedef struct _D3DExecuteBufferDesc {
DWORD dwSize; /* size of this structure */
DWORD dwFlags; /* flags indicating which fields are valid */
DWORD dwCaps; /* capabilities of execute buffer */
DWORD dwBufferSize; /* size of execute buffer data */
LPVOID lpData; /* pointer to actual data */
} D3DEXECUTEBUFFERDESC, *LPD3DEXECUTEBUFFERDESC;
/* D3DEXECUTEBUFFER dwFlags indicating valid fields */
#define D3DDEB_BUFSIZE 0x00000001l /* buffer size valid */
#define D3DDEB_CAPS 0x00000002l /* caps valid */
#define D3DDEB_LPDATA 0x00000004l /* lpData valid */
/* D3DEXECUTEBUFFER dwCaps */
#define D3DDEBCAPS_SYSTEMMEMORY 0x00000001l /* buffer in system memory */
#define D3DDEBCAPS_VIDEOMEMORY 0x00000002l /* buffer in device memory */
#define D3DDEBCAPS_MEM (D3DDEBCAPS_SYSTEMMEMORY|D3DDEBCAPS_VIDEOMEMORY)
#if(DIRECT3D_VERSION < 0x0800)
#if(DIRECT3D_VERSION >= 0x0700)
typedef struct _D3DDEVINFO_TEXTUREMANAGER {
BOOL bThrashing; /* indicates if thrashing */
DWORD dwApproxBytesDownloaded; /* Approximate number of bytes downloaded by texture manager */
DWORD dwNumEvicts; /* number of textures evicted */
DWORD dwNumVidCreates; /* number of textures created in video memory */
DWORD dwNumTexturesUsed; /* number of textures used */
DWORD dwNumUsedTexInVid; /* number of used textures present in video memory */
DWORD dwWorkingSet; /* number of textures in video memory */
DWORD dwWorkingSetBytes; /* number of bytes in video memory */
DWORD dwTotalManaged; /* total number of managed textures */
DWORD dwTotalBytes; /* total number of bytes of managed textures */
DWORD dwLastPri; /* priority of last texture evicted */
} D3DDEVINFO_TEXTUREMANAGER, *LPD3DDEVINFO_TEXTUREMANAGER;
typedef struct _D3DDEVINFO_TEXTURING {
DWORD dwNumLoads; /* counts Load() API calls */
DWORD dwApproxBytesLoaded; /* Approximate number bytes loaded via Load() */
DWORD dwNumPreLoads; /* counts PreLoad() API calls */
DWORD dwNumSet; /* counts SetTexture() API calls */
DWORD dwNumCreates; /* counts texture creates */
DWORD dwNumDestroys; /* counts texture destroys */
DWORD dwNumSetPriorities; /* counts SetPriority() API calls */
DWORD dwNumSetLODs; /* counts SetLOD() API calls */
DWORD dwNumLocks; /* counts number of texture locks */
DWORD dwNumGetDCs; /* counts number of GetDCs to textures */
} D3DDEVINFO_TEXTURING, *LPD3DDEVINFO_TEXTURING;
#endif /* DIRECT3D_VERSION >= 0x0700 */
#endif //(DIRECT3D_VERSION < 0x0800)
#pragma pack()
#endif /* _D3DCAPS_H_ */

2119
Include/d3dtypes.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -102,6 +102,7 @@
#define BUFFEREDIOFIX 0x00100000 // fix buffered IO incompatibilities between pre-Win98 and post-WinNT
#define FILTERMESSAGES 0x00200000 // ignore offending messages that are typical of a window and are hot handled by a fullscreeen app
#define PEEKALLMESSAGES 0x00400000 // force Peek-ing all sort of messages to avoid Win7 message queue saturation that leads to program halt
#define SURFACEWARN 0x00800000 // warn when a unclassified surface capability is met (debug only!)
// logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general

167
build/dxwnd.3.ini Normal file
View File

@ -0,0 +1,167 @@
[window]
posx=1452
posy=365
sizx=320
sizy=514
[target]
title0=Rayman 2 Demo
path0=D:\Games\Rayman2Demo\Rayman2Demo.exe
module0=
opengllib0=
ver0=1
coord0=0
flag0=402653217
flagg0=1210056704
flagh0=2097172
flagi0=0
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
title1=Mirror's Edge
path1=D:\Games\Mirror's Edge\Binaries\MirrorsEdge.exe
module1=
opengllib1=
ver1=0
coord1=0
flag1=-2013265882
flagg1=1207959552
flagh1=2097172
flagi1=0
tflag1=5
initx1=0
inity1=0
minx1=0
miny1=0
maxx1=0
maxy1=0
posx1=50
posy1=50
sizx1=800
sizy1=600
maxfps1=0
initts1=6
title2=LastHalfWin.exe
path2=D:\Games\Last Half Of Darkness\LastHalfWin.exe
module2=
opengllib2=
ver2=1
coord2=0
flag2=134217760
flagg2=1207959552
flagh2=4
flagi2=0
tflag2=512
initx2=0
inity2=0
minx2=0
miny2=0
maxx2=0
maxy2=0
posx2=50
posy2=50
sizx2=800
sizy2=600
maxfps2=0
initts2=0
title3=DOOM95.EXE
path3=D:\Games\Doom95i\DOOM95.EXE
module3=
opengllib3=
ver3=0
coord3=0
flag3=134217762
flagg3=1207959552
flagh3=20
flagi3=0
tflag3=512
initx3=0
inity3=0
minx3=0
miny3=0
maxx3=0
maxy3=0
posx3=50
posy3=50
sizx3=800
sizy3=600
maxfps3=0
initts3=0
title4=CNC3.exe
path4=D:\Games\Command & Conquer 3\CNC3.exe
module4=
opengllib4=
ver4=9
coord4=0
flag4=134217762
flagg4=1207959552
flagh4=20
flagi4=0
tflag4=512
initx4=0
inity4=0
minx4=0
miny4=0
maxx4=0
maxy4=0
posx4=50
posy4=50
sizx4=800
sizy4=600
maxfps4=0
initts4=0
title5=Div.exe
path5=D:\Games\Beyond Divinity\Div.exe
module5=
opengllib5=
ver5=0
coord5=0
flag5=134217762
flagg5=1207959552
flagh5=20
flagi5=0
tflag5=512
initx5=0
inity5=0
minx5=0
miny5=0
maxx5=0
maxy5=0
posx5=50
posy5=50
sizx5=800
sizy5=600
maxfps5=0
initts5=0
title6=martian gothic.exe
path6=D:\Games\Martian Gothic\martian gothic.exe
module6=
opengllib6=
ver6=7
coord6=0
flag6=201326626
flagg6=1208090624
flagh6=276
flagi6=0
tflag6=263
initx6=0
inity6=0
minx6=0
miny6=0
maxx6=0
maxy6=0
posx6=50
posy6=50
sizx6=800
sizy6=600
maxfps6=0
initts6=0

2214
build/dxwnd.4.ini Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:87bb2172d84948aba5cd6af6e3b810430441b3935584ea3d46b3ef4c0bf1f8ed
size 407552
oid sha256:0c14a21ce803c1f48696c754cbdb5368e40439fab6b64b9af7188331c159cba9
size 414720

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6228efb8d349dfee02f1fc5b997651e2bb36d01120398c7743ab495286852aeb
size 525312
oid sha256:12cba4b1f36d3b9f0ed76b365035ee75fb22df7f464e0f05f05339a829c9586c
size 526336

View File

@ -267,4 +267,8 @@ hook trace is now activated from a separate log flag to reduce debug log size
added "Peek all messages in queue" to avoid queue saturation and automatic task kill in Win7 (thank to P K help)
fixed message handling in the case messages are passed to a routine handle
v2.02.37
code reorganization
GUI:
removed useless flags and moved debug options in a hidden tab

File diff suppressed because it is too large Load Diff

View File

@ -328,7 +328,7 @@ static HRESULT WINAPI EmuBlt_32_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes
long srcpitch, destpitch;
HRESULT res;
DWORD *src32;
DWORD *dest, dest0;
DWORD *dest, *dest0;
DDSURFACEDESC2 ddsd_src, ddsd_dst;
w = lpdestrect->right - lpdestrect->left;
@ -336,7 +336,7 @@ static HRESULT WINAPI EmuBlt_32_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst);
ddsd_dst.dxw.dwFlags1 = DDSD_LPSURFACE | DDSD_PITCH;
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddsdst, 0, (LPDIRECTDRAWSURFACE)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("EmuBlt32_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
@ -344,7 +344,7 @@ static HRESULT WINAPI EmuBlt_32_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes
memset(&ddsd_src,0,sizeof(DDSURFACEDESC2));
ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc);
ddsd_src.dxw.dwFlags1 = DDSD_LPSURFACE | DDSD_PITCH;
ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if (lpsurface) { // already locked, just get info ....
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
OutTraceE("EmuBlt32_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);

View File

@ -72,7 +72,8 @@ char *ExplainDDSCaps(DWORD c)
if (c & DDSCAPS_LIVEVIDEO) strcat(eb, "LIVEVIDEO+");
if (c & DDSCAPS_HWCODEC) strcat(eb, "HWCODEC+");
if (c & DDSCAPS_MODEX) strcat(eb, "MODEX+");
if (c & DDSCAPS_MIPMAP) strcat(eb, "MIPMAP+");
if (c & DDSCAPS_MIPMAP) strcat(eb, "MIPMAP+");
if (c & DDSCAPS_RESERVED2) strcat(eb, "RESERVED2+");
if (c & DDSCAPS_ALLOCONLOAD) strcat(eb, "ALLOCONLOAD+");
if (c & DDSCAPS_VIDEOPORT) strcat(eb, "VIDEOPORT+");
if (c & DDSCAPS_LOCALVIDMEM) strcat(eb, "LOCALVIDMEM+");
@ -1101,6 +1102,11 @@ char *ExplainGUID(GUID FAR *lpguid)
case 0xb0ab3b61: sguid="IID_IDirect3DViewport3"; break;
case 0x7a503555: sguid="IID_IDirect3DVertexBuffer"; break;
case 0xf5049e7d: sguid="IID_IDirect3DVertexBuffer7"; break;
case 0xF2086B20: sguid="IID_IDirect3DRampDevice"; break;
case 0x881949a1: sguid="IID_IDirect3DMMXDevice"; break;
case 0x50936643: sguid="IID_IDirect3DRefDevice"; break;
case 0x8767df22: sguid="IID_IDirect3DNullDevice"; break;
case 0xf5049e78: sguid="IID_IDirect3DTnLHalDevice"; break;
case 0xD7B70EE0: sguid="CLSID_DirectDraw"; break;
case 0x3c305196: sguid="CLSID_DirectDraw7"; break;
case 0x593817A0: sguid="CLSID_DirectDrawClipper"; break;
@ -1468,3 +1474,22 @@ char *ExplainDCType(DWORD c)
if (c>=0 && c<=GDI_OBJ_LAST) return Captions[c];
return "???";
}
char *ExplainPeekRemoveMsg(DWORD c)
{
static char eb[128];
strcpy(eb, (c & PM_REMOVE) ? "PM_REMOVE" : "PM_NOREMOVE");
if(c & PM_NOYIELD) strcat(eb, "+NOYIELD");
c >>= 16;
if(c & QS_MOUSEMOVE) strcat(eb, "+MOUSEMOVE");
if(c & QS_MOUSEBUTTON) strcat(eb, "+MOUSEBUTTON");
if(c & QS_KEY) strcat(eb, "+KEY");
if(c & QS_RAWINPUT) strcat(eb, "+RAWINPUT");
if(c & QS_PAINT) strcat(eb, "+PAINT");
if(c & QS_POSTMESSAGE) strcat(eb, "+POSTMESSAGE");
if(c & QS_HOTKEY) strcat(eb, "+HOTKEY");
if(c & QS_TIMER) strcat(eb, "+TIMER");
if(c & QS_SENDMESSAGE) strcat(eb, "+SENDMESSAGE");
if(c & QS_ALLPOSTMESSAGE) strcat(eb, "+ALLPOSTMESSAGE");
return(eb);
}

View File

@ -41,3 +41,4 @@ extern char *ExplainMCICommands(DWORD);
extern char *ExplainMCIFlags(DWORD, DWORD);
extern char *ExplainRegType(DWORD);
extern char *ExplainDCType(DWORD);
extern char *ExplainPeekRemoveMsg(DWORD);

View File

@ -38,7 +38,7 @@ static char *FlagNames[32]={
"AUTOREFRESH", "FIXWINFRAME", "HIDEHWCURSOR", "SLOWDOWN",
"ENABLECLIPPING", "LOCKWINSTYLE", "MAPGDITOPRIMARY", "FIXTEXTOUT",
"KEEPCURSORWITHIN", "USERGB565", "SUPPRESSDXERRORS", "PREVENTMAXIMIZE",
"ONEPIXELFIX", "FIXPARENTWIN", "SWITCHVIDEOMEMORY", "CLIENTREMAPPING",
"LOCKEDSURFACE", "FIXPARENTWIN", "SWITCHVIDEOMEMORY", "CLIENTREMAPPING",
"HANDLEALTF4", "LOCKWINPOS", "HOOKCHILDWIN", "MESSAGEPROC"
};
@ -290,6 +290,12 @@ void SetHook(void *target, void *hookproc, void **hookedproc, char *hookname)
dwTmp = *(DWORD *)target;
if(dwTmp == (DWORD)hookproc) return; // already hooked
if((dwTmp <= MaxHook) && (dwTmp >= MinHook)) return; // already hooked
if(dwTmp == 0){
sprintf(msg,"SetHook ERROR: NULL target for %s\n", hookname);
OutTraceD(msg);
MessageBox(0, msg, "SetHook", MB_OK | MB_ICONEXCLAMATION);
return; // error condition
}
if(!VirtualProtect(target, 4, PAGE_READWRITE, &oldprot)) {
sprintf(msg,"SetHook ERROR: target=%x err=%d\n", target, GetLastError());
OutTraceD(msg);
@ -841,7 +847,6 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
if(dxw.dwFlags3 & FILTERMESSAGES){
LRESULT ret;
switch(message){
case WM_NCCALCSIZE:
case WM_NCMOUSEMOVE:
case WM_NCLBUTTONDOWN:
case WM_NCLBUTTONUP:
@ -852,8 +857,6 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
case WM_NCMBUTTONDOWN:
case WM_NCMBUTTONUP:
case WM_NCMBUTTONDBLCLK:
//case WM_WINDOWPOSCHANGING:
//case WM_WINDOWPOSCHANGED:
OutTraceW("WindowProc[%x]: WinMsg=%x filtered message=%x(%s)\n", hwnd, message, ExplainWinMessage(message));
ret=0;
return ret;
@ -1285,6 +1288,7 @@ void HookModule(HMODULE base, int dxversion)
if(dxw.dwFlags1 & HOOKDI) HookDirectInput(base, dxversion);
HookDirectDraw(base, dxversion);
HookDirect3D(base, dxversion);
HookDirect3D7(base, dxversion);
if(dxw.dwFlags2 & HOOKOPENGL) HookOpenGLLibs(base, dxw.CustomOpenGLLib);
if((dxw.dwFlags3 & EMULATEREGISTRY) || (dxw.dwTFlags & OUTREGISTRY)) HookAdvApi32(base);
HookMSV4WLibs(base); // -- used by Aliens & Amazons demo: what for?

View File

@ -1,6 +1,7 @@
extern int HookDirectDraw(HMODULE, int);
extern int HookDDProxy(HMODULE, int);
extern int HookDirect3D(HMODULE, int);
extern int HookDirect3D7(HMODULE, int);
extern void HookOle32(HMODULE);
extern void HookGDI32(HMODULE);
extern int HookDirectInput(HMODULE, int);
@ -16,6 +17,7 @@ extern LPCSTR ProcToString(LPCSTR proc);
extern HRESULT HookDxDiag(REFIID, LPVOID FAR*);
extern FARPROC Remap_ddraw_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_d3d7_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_d3d8_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_d3d9_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_d3d10_ProcAddress(LPCSTR, HMODULE);

View File

@ -79,24 +79,6 @@ void dxwCore::InitTarget(TARGETMAP *target)
// Primary surfaces auxiliary functions
/* ------------------------------------------------------------------ */
void dxwCore::MarkPrimarySurface(LPDIRECTDRAWSURFACE ps)
{
int i;
// OutTraceD("PRIMARYSURFACE add %x\n",ps);
for (i=0;i<DDSQLEN;i++) {
if (PrimSurfaces[i]==(DWORD)ps) return; // if already there ....
if (PrimSurfaces[i]==(DWORD)0) break; // got end of list
}
PrimSurfaces[i]=(DWORD)ps;
}
// Note: since MS itself declares that the object refcount is not reliable and should
// be used for debugging only, it's not safe to rely on refcount==0 when releasing a
// surface to terminate its classification as primary. As an alternate and more reliable
// way, we use UnmarkPrimarySurface each time you create a new not primary surface,
// eliminating the risk that a surface previously classified as primary and then closed
// had the same surface handle than this new one that is not primary at all.
void dxwCore::UnmarkPrimarySurface(LPDIRECTDRAWSURFACE ps)
{
int i;
@ -114,6 +96,60 @@ void dxwCore::UnmarkPrimarySurface(LPDIRECTDRAWSURFACE ps)
}
}
void dxwCore::UnmarkBackBufferSurface(LPDIRECTDRAWSURFACE ps)
{
int i;
// OutTraceD("PRIMARYSURFACE del %x\n",ps);
for (i=0;i<DDSQLEN;i++) {
if (BackSurfaces[i]==(DWORD)ps) break;
if (BackSurfaces[i]==0) break;
}
if (BackSurfaces[i]==(DWORD)ps){
for (; i<DDSQLEN; i++){
BackSurfaces[i]=BackSurfaces[i+1];
if (BackSurfaces[i]==0) break;
}
BackSurfaces[DDSQLEN]=0;
}
}
void dxwCore::MarkPrimarySurface(LPDIRECTDRAWSURFACE ps)
{
int i;
// OutTraceD("PRIMARYSURFACE add %x\n",ps);
for (i=0;i<DDSQLEN;i++) {
if (PrimSurfaces[i]==(DWORD)ps) return; // if already there ....
if (PrimSurfaces[i]==(DWORD)0) break; // got end of list
}
PrimSurfaces[i]=(DWORD)ps;
UnmarkBackBufferSurface(ps);
}
void dxwCore::MarkBackBufferSurface(LPDIRECTDRAWSURFACE ps)
{
int i;
// OutTraceD("PRIMARYSURFACE add %x\n",ps);
for (i=0;i<DDSQLEN;i++) {
if (BackSurfaces[i]==(DWORD)ps) return; // if already there ....
if (BackSurfaces[i]==(DWORD)0) break; // got end of list
}
BackSurfaces[i]=(DWORD)ps;
UnmarkPrimarySurface(ps);
}
void dxwCore::MarkRegularSurface(LPDIRECTDRAWSURFACE ps)
{
UnmarkBackBufferSurface(ps);
UnmarkPrimarySurface(ps);
}
// Note: since MS itself declares that the object refcount is not reliable and should
// be used for debugging only, it's not safe to rely on refcount==0 when releasing a
// surface to terminate its classification as primary. As an alternate and more reliable
// way, we use UnmarkPrimarySurface each time you create a new not primary surface,
// eliminating the risk that a surface previously classified as primary and then closed
// had the same surface handle than this new one that is not primary at all.
BOOL dxwCore::IsAPrimarySurface(LPDIRECTDRAWSURFACE ps)
{
int i;
@ -126,6 +162,18 @@ BOOL dxwCore::IsAPrimarySurface(LPDIRECTDRAWSURFACE ps)
return FALSE;
}
BOOL dxwCore::IsABackBufferSurface(LPDIRECTDRAWSURFACE ps)
{
int i;
// treat NULL surface ptr as a non primary
if(!ps) return FALSE;
for (i=0;i<DDSQLEN;i++) {
if (BackSurfaces[i]==(DWORD)ps) return TRUE;
if (BackSurfaces[i]==0) return FALSE;
}
return FALSE;
}
LPDIRECTDRAWSURFACE dxwCore::GetPrimarySurface(void)
{
// return last opened one....
@ -137,6 +185,17 @@ LPDIRECTDRAWSURFACE dxwCore::GetPrimarySurface(void)
return NULL;
}
LPDIRECTDRAWSURFACE dxwCore::GetBackBufferSurface(void)
{
// return last opened one....
int i;
for (i=0;i<DDSQLEN;i++) {
if (BackSurfaces[i]==0) break;
}
if (i) return((LPDIRECTDRAWSURFACE)BackSurfaces[i-1]);
return NULL;
}
void dxwCore::SetPrimarySurface(void)
{
if (!lpDDSPrimHDC) lpDDSPrimHDC=GetPrimarySurface();
@ -1004,6 +1063,8 @@ int dxwCore::GetDLLIndex(char *lpFileName)
"netapi32",
"wintrust",
"advapi32",
"d3dim",
"d3dim700",
NULL
};

View File

@ -53,9 +53,12 @@ public: // methods
BOOL HandleFPS(void);
DWORD GetTickCount(void);
void MarkPrimarySurface(LPDIRECTDRAWSURFACE);
void UnmarkPrimarySurface(LPDIRECTDRAWSURFACE);
BOOL IsAPrimarySurface(LPDIRECTDRAWSURFACE);
LPDIRECTDRAWSURFACE GetPrimarySurface(void);
void MarkBackBufferSurface(LPDIRECTDRAWSURFACE);
BOOL IsABackBufferSurface(LPDIRECTDRAWSURFACE);
LPDIRECTDRAWSURFACE GetBackBufferSurface(void);
void MarkRegularSurface(LPDIRECTDRAWSURFACE);
void SetPrimarySurface(void);
void ResetPrimarySurface(void);
void GetSystemTime(LPSYSTEMTIME lpSystemTime);
@ -81,8 +84,6 @@ public: // methods
public: // simple data variables
DDPIXELFORMAT ActualPixelFormat;
DDPIXELFORMAT VirtualPixelFormat;
DWORD dwPrimarySurfaceCaps;
DWORD dwBackBufferCount;
DWORD dwDDVersion;
DWORD dwTargetDDVersion;
DWORD dwMaxDDVersion;
@ -119,8 +120,14 @@ protected:
BOOL FullScreen;
HWND hWnd, hWndFPS;
DWORD PrimSurfaces[DDSQLEN+1];
DWORD BackSurfaces[DDSQLEN+1];
HDC VirtualHDC;
HBITMAP VirtualPic;
private:
void UnmarkPrimarySurface(LPDIRECTDRAWSURFACE);
void UnmarkBackBufferSurface(LPDIRECTDRAWSURFACE);
};
extern dxwCore dxw;
@ -155,5 +162,7 @@ typedef enum {
SYSLIBIDX_TAPI32,
SYSLIBIDX_NETAPI32,
SYSLIBIDX_WINTRUST,
SYSLIBIDX_DIRECT3D,
SYSLIBIDX_DIRECT3D700,
SYSLIBIDX_MAX }
enum_syslibraries;

View File

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "dxwnd.h"
#include "dxwcore.hpp"
#define VERSION "2.02.35"
#define VERSION "2.02.37"
#define DDTHREADLOCK 1

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="dxwnd"
ProjectGUID="{579E7FE7-2745-4100-A802-23511711FCDE}"
RootNamespace="dxwnd"
@ -348,6 +348,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\hd3d7.cpp"
>
</File>
<File
RelativePath=".\hddproxy.cpp"
>

View File

@ -794,32 +794,41 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
OutTraceD("GDI.BitBlt: HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d hdcSrc=%x nXSrc=%d nYSrc=%d dwRop=%x(%s)\n",
hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop, ExplainROP(dwRop));
if (dxw.HandleFPS()) return TRUE;
OutTraceB("GDI.StretchBlt: DEBUG FullScreen=%x target hdctype=%x(%s) hwnd=%x\n",
dxw.IsFullScreen(), GetObjectType(hdcDest), ExplainDCType(GetObjectType(hdcDest)), WindowFromDC(hdcDest));
// beware: HDC could refer to screen DC that are written directly on screen, or memory DC that will be scaled to
// the screen surface later on, on ReleaseDC or ddraw Blit / Flip operation. Scaling of rect coordinates is
// needed only in the first case, and must be avoided on the second, otherwise the image would be scaled twice!
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){
int nWDest, nHDest;
nWDest= nWidth;
nHDest= nHeight;
dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
}
else if(WindowFromDC(hdcDest)==NULL){
// V2.02.31: See StretchBlt.
int nWDest, nHDest;
nWDest= nWidth;
nHDest= nHeight;
dxw.MapWindow(&nXDest, &nYDest, &nWDest, &nHDest);
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
res=0;
if (OBJ_DC == GetObjectType(hdcDest)){
if (dxw.HandleFPS()) return TRUE;
if(dxw.IsFullScreen()){
int nWDest, nHDest;
nWDest= nWidth;
nHDest= nHeight;
dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest);
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
OutTrace("Debug: DC dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest);
}
else if(WindowFromDC(hdcDest)==NULL){
// V2.02.31: See StretchBlt.
int nWDest, nHDest;
nWDest= nWidth;
nHDest= nHeight;
dxw.MapWindow(&nXDest, &nYDest, &nWDest, &nHDest);
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
OutTrace("Debug: NULL dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest);
}
}
else {
res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
OutTrace("Debug: MEM dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWidth, nHeight);
}
if(!res) OutTraceE("GDI.BitBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return res;
@ -828,28 +837,34 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
BOOL WINAPI extGDIPatBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, DWORD dwRop)
{
BOOL res;
BOOL IsToScreen;
OutTraceD("GDI.PatBlt: HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d dwRop=%x(%s)\n",
hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop, ExplainROP(dwRop));
if (dxw.HandleFPS()) return TRUE;
OutTraceB("GDI.StretchBlt: DEBUG FullScreen=%x target hdctype=%x(%s) hwnd=%x\n",
dxw.IsFullScreen(), GetObjectType(hdcDest), ExplainDCType(GetObjectType(hdcDest)), WindowFromDC(hdcDest));
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){
dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
}
else if(WindowFromDC(hdcDest)==NULL){
// V2.02.31: See StretchBlt.
dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight);
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
IsToScreen=FALSE;
res=0;
if (OBJ_DC == GetObjectType(hdcDest)){
IsToScreen=TRUE;
if (dxw.HandleFPS()) return TRUE;
if (dxw.IsFullScreen()){
dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
}
else if(WindowFromDC(hdcDest)==NULL){
// V2.02.31: See StretchBlt.
dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight);
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
}
}
else {
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
}
if (IsToScreen && (dxw.dwFlags2 & SHOWFPSOVERLAY)) dxw.ShowFPS(hdcDest);
if(!res) OutTraceE("GDI.PatBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return res;
@ -859,28 +874,31 @@ BOOL WINAPI extGDIStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, in
HDC hdcSrc, int nXSrc, int nYSrc, int nWSrc, int nHSrc, DWORD dwRop)
{
BOOL res;
BOOL IsToScreen;
OutTraceD("GDI.StretchBlt: HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d hdcSrc=%x nXSrc=%d nYSrc=%d nWSrc=%d nHSrc=%d dwRop=%x(%s)\n",
hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop, ExplainROP(dwRop));
if (dxw.HandleFPS()) return TRUE;
OutTraceB("GDI.StretchBlt: DEBUG FullScreen=%x target hdctype=%x(%s) hwnd=%x\n",
dxw.IsFullScreen(), GetObjectType(hdcDest), ExplainDCType(GetObjectType(hdcDest)), WindowFromDC(hdcDest));
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){
IsToScreen=FALSE;
if (OBJ_DC == GetObjectType(hdcDest)){
if (dxw.HandleFPS()) return TRUE;
IsToScreen=TRUE;
if(dxw.IsFullScreen()){
dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
}
else if(WindowFromDC(hdcDest)==NULL){
// V2.02.31: In "Silent Hunter II" intro movie, QuickTime 5 renders the vidoe on the PrimarySurface->GetDC device context,
// that is a memory device type associated to NULL (desktop) window, through GDI StretchBlt api. So, you shoud compensate
// by scaling and offsetting to main window.
dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
}
else if(WindowFromDC(hdcDest)==NULL){
// V2.02.31: In "Silent Hunter II" intro movie, QuickTime 5 renders the video on the PrimarySurface->GetDC device context,
// that is a memory device type associated to NULL (desktop) window, through GDI StretchBlt api. So, you shoud compensate
// by scaling and offsetting to main window.
dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight);
}
}
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop);
if (IsToScreen && (dxw.dwFlags2 & SHOWFPSOVERLAY)) dxw.ShowFPS(hdcDest);
if(!res) OutTraceE("GDI.StretchBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return res;
}

497
dll/hd3d7.cpp Normal file
View File

@ -0,0 +1,497 @@
#include <windows.h>
#include <d3d.h>
#include "dxwnd.h"
#include "dxwcore.hpp"
#include "dxhook.h"
#include "syslibs.h"
#include "dxhelper.h"
// exported API
DWORD gD3DVersion; // quick & dirty ....
#undef OutTraceD
#define OutTraceD OutTrace
typedef HRESULT (WINAPI *Direct3DCreateDevice_Type)(GUID FAR *, LPDIRECT3D, LPDIRECTDRAWSURFACE, LPDIRECT3D *, LPUNKNOWN);
typedef HRESULT (WINAPI *Direct3DCreate_Type)(UINT, LPDIRECT3D *, LPUNKNOWN);
Direct3DCreateDevice_Type pDirect3DCreateDevice = NULL;
Direct3DCreate_Type pDirect3DCreate = NULL;
HRESULT WINAPI extDirect3DCreateDevice(GUID FAR *, LPDIRECT3D, LPDIRECTDRAWSURFACE, LPDIRECT3D *, LPUNKNOWN);
HRESULT WINAPI extDirect3DCreate(UINT, LPDIRECT3D *, LPUNKNOWN);
// IDirect3D interfaces
typedef HRESULT (WINAPI *Initialize_Type)(void *);
typedef HRESULT (WINAPI *EnumDevices_Type)(void *, LPD3DENUMDEVICESCALLBACK, LPVOID);
typedef HRESULT (WINAPI *CreateLight_Type)(void *, LPDIRECT3DLIGHT *, IUnknown *);
typedef HRESULT (WINAPI *CreateMaterial_Type)(void *, LPDIRECT3DMATERIAL *, IUnknown *);
typedef HRESULT (WINAPI *CreateViewport_Type)(void *, LPDIRECT3DVIEWPORT *, IUnknown *);
typedef HRESULT (WINAPI *FindDevice_Type)(void *, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
typedef HRESULT (WINAPI *CreateDevice2_Type)(void *, REFCLSID, LPDIRECTDRAWSURFACE, LPDIRECT3DDEVICE2 *);
typedef HRESULT (WINAPI *CreateDevice3_Type)(void *, REFCLSID, LPDIRECTDRAWSURFACE4, LPDIRECT3DDEVICE3 *, LPUNKNOWN);
typedef HRESULT (WINAPI *InitializeVP_Type)(void *, LPDIRECT3D);
typedef HRESULT (WINAPI *SetViewport_Type)(void *, LPD3DVIEWPORT);
typedef HRESULT (WINAPI *GetViewport_Type)(void *, LPD3DVIEWPORT);
typedef HRESULT (WINAPI *QueryInterfaceD3_Type)(void *, REFIID, LPVOID *);
Initialize_Type pInitialize = NULL;
EnumDevices_Type pEnumDevices = NULL;
CreateLight_Type pCreateLight = NULL;
CreateMaterial_Type pCreateMaterial = NULL;
CreateViewport_Type pCreateViewport = NULL;
FindDevice_Type pFindDevice = NULL;
CreateDevice2_Type pCreateDevice2 = NULL;
CreateDevice3_Type pCreateDevice3 = NULL;
InitializeVP_Type pInitializeVP = NULL;
SetViewport_Type pSetViewport = NULL;
GetViewport_Type pGetViewport = NULL;
QueryInterfaceD3_Type pQueryInterfaceD3 = NULL;
HRESULT WINAPI extInitialize(void *);
HRESULT WINAPI extEnumDevices(void *, LPD3DENUMDEVICESCALLBACK, LPVOID);
HRESULT WINAPI extCreateLight(void *, LPDIRECT3DLIGHT *, IUnknown *);
HRESULT WINAPI extCreateMaterial(void *, LPDIRECT3DMATERIAL *, IUnknown *);
HRESULT WINAPI extCreateViewport(void *, LPDIRECT3DVIEWPORT *, IUnknown *);
HRESULT WINAPI extFindDevice(void *, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
HRESULT WINAPI extCreateDevice2(void *, REFCLSID, LPDIRECTDRAWSURFACE, LPDIRECT3DDEVICE2 *);
HRESULT WINAPI extCreateDevice3(void *, REFCLSID, LPDIRECTDRAWSURFACE4, LPDIRECT3DDEVICE3 *, LPUNKNOWN);
HRESULT WINAPI extInitializeVP(void *, LPDIRECT3D);
HRESULT WINAPI extSetViewport(void *, LPD3DVIEWPORT);
HRESULT WINAPI extGetViewport(void *, LPD3DVIEWPORT);
HRESULT WINAPI extQueryInterfaceD3(void *, REFIID, LPVOID *);
extern char *ExplainDDError(DWORD);
int HookDirect3D7(HMODULE module, int version){
void *tmp;
HINSTANCE hinst;
LPDIRECT3D lpd3d=NULL;
gD3DVersion = version;
switch(version){
case 0:
case 1:
tmp = HookAPI(module, "d3dim.dll", NULL, "Direct3DCreate", extDirect3DCreate);
if(tmp) pDirect3DCreate = (Direct3DCreate_Type)tmp;
tmp = HookAPI(module, "d3dim.dll", NULL, "Direct3DCreateDevice", extDirect3DCreateDevice);
if(tmp) pDirect3DCreateDevice = (Direct3DCreateDevice_Type)tmp;
tmp = HookAPI(module, "d3dim700.dll", NULL, "Direct3DCreate", extDirect3DCreate);
if(tmp) pDirect3DCreate = (Direct3DCreate_Type)tmp;
tmp = HookAPI(module, "d3dim700.dll", NULL, "Direct3DCreateDevice", extDirect3DCreateDevice);
if(tmp) pDirect3DCreateDevice = (Direct3DCreateDevice_Type)tmp;
break;
case 7:
hinst = LoadLibrary("d3dim.dll");
if (hinst){
pDirect3DCreate =
(Direct3DCreate_Type)GetProcAddress(hinst, "Direct3DCreate");
if(pDirect3DCreate){
lpd3d = (LPDIRECT3D)extDirect3DCreate(0x0700, &lpd3d, NULL);
if(lpd3d) lpd3d->Release();
}
}
else {
hinst = LoadLibrary("d3dim700.dll");
pDirect3DCreate =
(Direct3DCreate_Type)GetProcAddress(hinst, "Direct3DCreate");
if(pDirect3DCreate){
lpd3d = (LPDIRECT3D)extDirect3DCreate(0x0700, &lpd3d, NULL);
if(lpd3d) lpd3d->Release();
}
}
break;
}
return 0;
}
FARPROC Remap_d3d7_ProcAddress(LPCSTR proc, HMODULE hModule)
{
if (!strcmp(proc,"Direct3DCreate") && !pDirect3DCreate){
pDirect3DCreate=(Direct3DCreate_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate);
return (FARPROC)extDirect3DCreate;
}
if (!strcmp(proc,"Direct3DCreateDevice") && !pDirect3DCreateDevice){
pDirect3DCreateDevice=(Direct3DCreateDevice_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreateDevice);
return (FARPROC)extDirect3DCreateDevice;
}
// NULL -> keep the original call address
return NULL;
}
HRESULT WINAPI extDirect3DCreateDevice(GUID FAR *lpGUID, LPDIRECT3D lpd3ddevice, LPDIRECTDRAWSURFACE surf, LPDIRECT3D *lplpd3ddevice, LPUNKNOWN pUnkOuter)
{
HRESULT res;
OutTraceD("Direct3DCreateDevice: guid=%x d3ddevice=%x dds=%x UnkOuter=%x\n",
lpGUID, lpd3ddevice, surf, pUnkOuter);
res=(*pDirect3DCreateDevice)(lpGUID, lpd3ddevice, surf, lplpd3ddevice, pUnkOuter);
if(res) OutTraceE("Direct3DCreateDevice ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceD("Direct3DCreateDevice: d3ddevice=%x\n", *lplpd3ddevice);
return res;
}
void HookDirect3DSession(LPDIRECTDRAW *lplpdd, int dxversion)
{
OutTraceD("HookDirect3DSession: d3d=%x d3dversion=%d\n", *lplpdd, dxversion);
gD3DVersion = dxversion;
switch(dxversion){
case 1:
SetHook((void *)(**(DWORD **)lplpdd + 0), extQueryInterfaceD3, (void **)&pQueryInterfaceD3, "QueryInterface(D3S)");
SetHook((void *)(**(DWORD **)lplpdd + 12), extInitialize, (void **)&pInitialize, "Initialize");
SetHook((void *)(**(DWORD **)lplpdd + 16), extEnumDevices, (void **)&pEnumDevices, "EnumDevices");
SetHook((void *)(**(DWORD **)lplpdd + 20), extCreateLight, (void **)&pCreateLight, "CreateLight");
SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial");
SetHook((void *)(**(DWORD **)lplpdd + 28), extCreateViewport, (void **)&pCreateViewport, "CreateViewport");
SetHook((void *)(**(DWORD **)lplpdd + 32), extFindDevice, (void **)&pFindDevice, "FindDevice");
break;
case 5:
SetHook((void *)(**(DWORD **)lplpdd + 0), extQueryInterfaceD3, (void **)&pQueryInterfaceD3, "QueryInterface(D3S)");
SetHook((void *)(**(DWORD **)lplpdd + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices");
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateLight, (void **)&pCreateLight, "CreateLight");
SetHook((void *)(**(DWORD **)lplpdd + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial");
SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateViewport, (void **)&pCreateViewport, "CreateViewport");
SetHook((void *)(**(DWORD **)lplpdd + 28), extFindDevice, (void **)&pFindDevice, "FindDevice");
SetHook((void *)(**(DWORD **)lplpdd + 32), extCreateDevice2, (void **)&pCreateDevice2, "CreateDevice(D3D2)");
break;
case 6:
SetHook((void *)(**(DWORD **)lplpdd + 0), extQueryInterfaceD3, (void **)&pQueryInterfaceD3, "QueryInterface(D3S)");
SetHook((void *)(**(DWORD **)lplpdd + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices");
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateLight, (void **)&pCreateLight, "CreateLight");
SetHook((void *)(**(DWORD **)lplpdd + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial");
SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateViewport, (void **)&pCreateViewport, "CreateViewport");
SetHook((void *)(**(DWORD **)lplpdd + 28), extFindDevice, (void **)&pFindDevice, "FindDevice");
SetHook((void *)(**(DWORD **)lplpdd + 32), extCreateDevice3, (void **)&pCreateDevice3, "CreateDevice(D3D3)");
break;
}
}
void HookDirect3DDevice(LPDIRECTDRAW *lpd3d, int dxversion)
{
OutTraceD("HookDirect3DDevice: d3d=%x d3dversion=%d\n", *lpd3d, dxversion);
gD3DVersion = dxversion;
switch(dxversion){
case 1:
//SetHook((void *)(**(DWORD **)lpd3d + 12), extInitialize, (void **)&pInitialize, "Initialize");
//SetHook((void *)(**(DWORD **)lpd3d + 16), extEnumDevices, (void **)&pEnumDevices, "EnumDevices");
//SetHook((void *)(**(DWORD **)lpd3d + 20), extCreateLight, (void **)&pCreateLight, "CreateLight");
//SetHook((void *)(**(DWORD **)lpd3d + 24), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial");
//SetHook((void *)(**(DWORD **)lpd3d + 28), extCreateViewport, (void **)&pCreateViewport, "CreateViewport");
//SetHook((void *)(**(DWORD **)lpd3d + 32), extFindDevice, (void **)&pFindDevice, "FindDevice");
break;
case 5:
case 6:
//SetHook((void *)(**(DWORD **)lpd3d + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices");
//SetHook((void *)(**(DWORD **)lpd3d + 16), extCreateLight, (void **)&pCreateLight, "CreateLight");
//SetHook((void *)(**(DWORD **)lpd3d + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial");
//SetHook((void *)(**(DWORD **)lpd3d + 24), extCreateViewport, (void **)&pCreateViewport, "CreateViewport");
//SetHook((void *)(**(DWORD **)lpd3d + 28), extFindDevice, (void **)&pFindDevice, "FindDevice");
break;
}
}
HRESULT WINAPI extDirect3DCreate(UINT SDKVersion, LPDIRECT3D *lplpd3d, LPUNKNOWN pUnkOuter)
{
HRESULT res;
OutTraceD("Direct3DCreate: SDKVersion=%x UnkOuter=%x\n", SDKVersion, pUnkOuter);
res=(*pDirect3DCreate)(SDKVersion, lplpd3d, pUnkOuter);
if(res) {
OutTraceE("Direct3DCreate ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
HookDirect3DSession((LPDIRECTDRAW *)lplpd3d, SDKVersion);
OutTraceD("Direct3DCreate: d3d=%x\n", *lplpd3d);
return res;
}
void HookViewport(LPDIRECT3DVIEWPORT *lpViewport, int dxversion)
{
OutTraceD("HookViewport: Viewport=%x d3dversion=%d\n", *lpViewport, dxversion);
switch(dxversion){
case 1:
case 5:
case 6:
case 7:
SetHook((void *)(**(DWORD **)lpViewport + 12), extInitializeVP, (void **)&pInitializeVP, "Initialize(VP)");
SetHook((void *)(**(DWORD **)lpViewport + 16), extGetViewport, (void **)&pGetViewport, "GetViewport");
SetHook((void *)(**(DWORD **)lpViewport + 20), extSetViewport, (void **)&pSetViewport, "SetViewport");
break;
}
}
HRESULT WINAPI extQueryInterfaceD3(void *lpd3d, REFIID riid, LPVOID * ppvObj)
{
HRESULT res;
int d3dversion;
OutTraceD("QueryInterface(D3): d3d=%x REFIID=%x obj=%x\n", lpd3d, riid.Data1, ppvObj);
d3dversion=0;
res=(*pQueryInterfaceD3)(lpd3d, riid, ppvObj);
switch(riid.Data1){
case 0x3BBA0080: d3dversion=1; break;
case 0x6aae1ec1: d3dversion=5; break;
case 0xbb223240: d3dversion=6; break;
case 0xf5049e77: d3dversion=7; break;
}
if(d3dversion) OutTraceD("QueryInterface(D3): hooking version=%d\n", d3dversion);
switch(d3dversion){
case 1:
SetHook((void *)(**(DWORD **)ppvObj + 12), extInitialize, (void **)&pInitialize, "Initialize");
SetHook((void *)(**(DWORD **)ppvObj + 16), extEnumDevices, (void **)&pEnumDevices, "EnumDevices");
SetHook((void *)(**(DWORD **)ppvObj + 20), extCreateLight, (void **)&pCreateLight, "CreateLight");
SetHook((void *)(**(DWORD **)ppvObj + 24), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial");
SetHook((void *)(**(DWORD **)ppvObj + 28), extCreateViewport, (void **)&pCreateViewport, "CreateViewport");
SetHook((void *)(**(DWORD **)ppvObj + 32), extFindDevice, (void **)&pFindDevice, "FindDevice");
break;
case 5:
case 6:
SetHook((void *)(**(DWORD **)ppvObj + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices");
SetHook((void *)(**(DWORD **)ppvObj + 16), extCreateLight, (void **)&pCreateLight, "CreateLight");
SetHook((void *)(**(DWORD **)ppvObj + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial");
SetHook((void *)(**(DWORD **)ppvObj + 24), extCreateViewport, (void **)&pCreateViewport, "CreateViewport");
SetHook((void *)(**(DWORD **)ppvObj + 28), extFindDevice, (void **)&pFindDevice, "FindDevice");
break;
}
return res;
}
HRESULT WINAPI extInitialize(void *lpd3d)
{
HRESULT res;
OutTraceD("Initialize: d3d=%x\n", lpd3d);
res=(*pInitialize)(lpd3d);
if(res) OutTraceE("Initialize ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceD("Initialize: OK\n");
return res;
}
typedef struct {
LPD3DENUMDEVICESCALLBACK *cb;
LPVOID arg;
} CallbackArg;
static void DumpD3DDevideDesc(LPD3DDEVICEDESC d3, char *label)
{
OutTraceD("EnumDevices: CALLBACK dev=%s Size=%d Flags=%x ", label, d3->dwSize, d3->dwFlags);
if(d3->dwFlags & D3DDD_COLORMODEL) OutTraceD("ColorModel=%x ", d3->dcmColorModel);
if(d3->dwFlags & D3DDD_DEVCAPS) OutTraceD("DevCaps=%x ", d3->dwDevCaps);
if(d3->dwFlags & D3DDD_TRANSFORMCAPS) OutTraceD("TransformCaps=%x ", d3->dtcTransformCaps.dwCaps);
if(d3->dwFlags & D3DDD_LIGHTINGCAPS) OutTraceD("LightingCaps=%x ", d3->dlcLightingCaps);
if(d3->dwFlags & D3DDD_BCLIPPING) OutTraceD("Clipping=%x ", d3->bClipping);
if(d3->dwFlags & D3DDD_LINECAPS) OutTraceD("LineCaps=%x ", d3->dpcLineCaps);
if(d3->dwFlags & D3DDD_TRICAPS) OutTraceD("TriCaps=%x ", d3->dpcTriCaps);
if(d3->dwFlags & D3DDD_DEVICERENDERBITDEPTH) OutTraceD("DeviceRenderBitDepth=%d ", d3->dwDeviceRenderBitDepth);
if(d3->dwFlags & D3DDD_DEVICEZBUFFERBITDEPTH) OutTraceD("DeviceZBufferBitDepth=%d ", d3->dwDeviceZBufferBitDepth);
if(d3->dwFlags & D3DDD_MAXBUFFERSIZE) OutTraceD("MaxBufferSize=%d ", d3->dwMaxBufferSize);
if(d3->dwFlags & D3DDD_MAXVERTEXCOUNT) OutTraceD("MaxVertexCount=%d ", d3->dwMaxVertexCount);
OutTraceD("\n");
}
HRESULT WINAPI extDeviceProxy(GUID FAR *lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC lpd3ddd1, LPD3DDEVICEDESC lpd3ddd2, LPVOID arg)
{
HRESULT res;
OutTraceD("EnumDevices: CALLBACK GUID=%x(%s) DeviceDescription=\"%s\", DeviceName=\"%s\", arg=%x\n", lpGuid->Data1, ExplainGUID(lpGuid), lpDeviceDescription, lpDeviceName, ((CallbackArg *)arg)->arg);
DumpD3DDevideDesc(lpd3ddd1, "HWDEV");
DumpD3DDevideDesc(lpd3ddd2, "SWDEV");
HookDirect3DDevice((LPDIRECTDRAW *)lpGuid, 0);
res = (*(((CallbackArg *)arg)->cb))(lpGuid, lpDeviceDescription, lpDeviceName, lpd3ddd1, lpd3ddd2, ((CallbackArg *)arg)->arg);
OutTraceD("EnumDevices: CALLBACK ret=%x\n", res);
return res;
}
HRESULT WINAPI extEnumDevices(void *lpd3d, LPD3DENUMDEVICESCALLBACK cb, LPVOID arg)
{
HRESULT res;
CallbackArg Arg;
OutTraceD("EnumDevices: d3d=%x arg=%x\n", lpd3d, arg);
Arg.cb= &cb;
Arg.arg=arg;
res=(*pEnumDevices)(lpd3d, (LPD3DENUMDEVICESCALLBACK)extDeviceProxy, (LPVOID)&Arg);
if(res) OutTraceE("EnumDevices ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceD("EnumDevices: OK\n");
return res;
}
HRESULT WINAPI extCreateLight(void *lpd3d, LPDIRECT3DLIGHT *lpLight, IUnknown *p0)
{
HRESULT res;
OutTraceD("CreateLight: d3d=%x\n", lpd3d);
res=(*pCreateLight)(lpd3d, lpLight, p0);
if(res) OutTraceE("CreateLight ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceD("CreateLight: OK\n");
return res;
}
HRESULT WINAPI extCreateMaterial(void *lpd3d, LPDIRECT3DMATERIAL *lpMaterial, IUnknown *p0)
{
HRESULT res;
OutTraceD("CreateMaterial: d3d=%x\n", lpd3d);
res=(*pCreateMaterial)(lpd3d, lpMaterial, p0);
if(res) OutTraceE("CreateMaterial ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceD("CreateMaterial: OK\n");
return res;
}
HRESULT WINAPI extCreateViewport(void *lpd3d, LPDIRECT3DVIEWPORT *lpViewport, IUnknown *p0)
{
HRESULT res;
OutTraceD("CreateViewport: d3d=%x\n", lpd3d);
res=(*pCreateViewport)(lpd3d, lpViewport, p0);
if(res) OutTraceE("CreateViewport ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceD("CreateViewport: Viewport=%x\n", *lpViewport);
HookViewport(lpViewport, gD3DVersion);
return res;
}
HRESULT WINAPI extFindDevice(void *lpd3d, LPD3DFINDDEVICESEARCH p1, LPD3DFINDDEVICERESULT p2)
{
HRESULT res;
OutTraceD("FindDevice: d3d=%x devsearch=%x (size=%d flags=%x caps=%x primcaps=%x colormodel=%x hw=%x guid=%x) p2=%x\n",
lpd3d, p1, p1->dwSize, p1->dwFlags, p1->dwCaps, p1->dpcPrimCaps, p1->dcmColorModel, p1->bHardware, p1->guid, p2);
res=(*pFindDevice)(lpd3d, p1, p2);
if(res) OutTraceE("FindDevice ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else {
OutTraceD("FindDevice: GUID=%x.%x.%x.%x\n", p2->guid.Data1, p2->guid.Data2, p2->guid.Data3, p2->guid.Data4);
DumpD3DDevideDesc(&(p2->ddHwDesc), "HWDEV");
DumpD3DDevideDesc(&(p2->ddSwDesc), "SWDEV");
}
return res;
}
HRESULT WINAPI extSetViewport(void *lpvp, LPD3DVIEWPORT vpd)
{
HRESULT res;
OutTraceD("SetViewport: viewport=%x viewportd=%x size=%d pos=(%d,%d) dim=(%dx%d) scale=(%fx%f) maxXYZ=(%f,%f,%f) minZ=%f\n",
lpvp, vpd, vpd->dwSize, vpd->dwX, vpd->dwY, vpd->dwHeight, vpd->dwWidth, vpd->dvScaleX, vpd->dvScaleY,
vpd->dvMaxX, vpd->dvMaxY, vpd->dvMaxZ, vpd->dvMinZ);
res=(*pSetViewport)(lpvp, vpd);
if(res) OutTraceE("SetViewport ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceD("SetViewport: OK\n");
return res;
}
HRESULT WINAPI extGetViewport(void *lpvp, LPD3DVIEWPORT vpd)
{
HRESULT res;
OutTraceD("GetViewport: viewport=%x viewportd=%x\n", lpvp, vpd);
res=(*pGetViewport)(lpvp, vpd);
if(res) OutTraceE("GetViewport ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceD("GetViewport: OK size=%d pos=(%d,%d) dim=(%dx%d) scale=(%fx%f) maxXYZ=(%f,%f,%f) minZ=%f\n",
vpd->dwSize, vpd->dwX, vpd->dwY, vpd->dwHeight, vpd->dwWidth, vpd->dvScaleX, vpd->dvScaleY,
vpd->dvMaxX, vpd->dvMaxY, vpd->dvMaxZ, vpd->dvMinZ);
return res;
}
HRESULT WINAPI extInitializeVP(void *lpvp, LPDIRECT3D lpd3d)
{
HRESULT res;
OutTraceD("Initialize(VP): viewport=%x d3d=%x\n", lpvp, lpd3d);
res=(*pInitializeVP)(lpvp, lpd3d);
if(res) OutTraceE("Initialize(VP) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceD("Initialize(VP): OK \n");
return res;
}
HRESULT WINAPI extCreateDevice2(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE lpdds, LPDIRECT3DDEVICE2 *lplpd3dd)
{
HRESULT res;
OutTraceD("CreateDevice(D3D2): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds);
res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd);
if(res) {
OutTraceE("CreateDevice(D3D2) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
// Hook device here ...!
return res;
}
const GUID IID_IDirect3DRampDevice;
const GUID IID_IDirect3DRGBDevice;
HRESULT WINAPI extCreateDevice3(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE4 lpdds, LPDIRECT3DDEVICE3 *lplpd3dd, LPUNKNOWN unk)
{
HRESULT res;
GUID IID_IDirect3DRGBDevice = {0xA4665C60,0x2673,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56};
GUID IID_IDirect3DRampDevice = {0xF2086B20,0x259F,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56};
GUID IID_IDirect3DMMXDevice = {0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29};
OutTraceD("CreateDevice(D3D3): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds);
res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk);
//res=(*pCreateDevice3)(lpd3d, IID_IDirect3DMMXDevice, lpdds, lplpd3dd, unk);
if(res) {
OutTraceE("CreateDevice(D3D3) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
//if(1) {
// GUID IID_IDirect3DRGBDevice = {0xA4665C60,0x2673,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56};
// GUID IID_IDirect3DRampDevice = {0xF2086B20,0x259F,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56};
// GUID IID_IDirect3DMMXDevice = {0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29};
// res=(*pCreateDevice3)(lpd3d, IID_IDirect3DRGBDevice, lpdds, lplpd3dd, unk);
// if(res) OutTraceE("CreateDevice(IID_IDirect3DRGBDevice) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
// res=(*pCreateDevice3)(lpd3d, IID_IDirect3DRampDevice, lpdds, lplpd3dd, unk);
// if(res) OutTraceE("CreateDevice(IID_IDirect3DRampDevice) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
// res=(*pCreateDevice3)(lpd3d, IID_IDirect3DMMXDevice, lpdds, lplpd3dd, unk);
// if(res) OutTraceE("CreateDevice(IID_IDirect3DMMXDevice) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
//}
return res;
}
// Hook device here ...!
return res;
}
#if 0
HRESULT WINAPI extInitialize(void *d3dd, LPDIRECT3D lpd3d, LPGUID lpGuid, LPD3DDEVICEDESC lpd3ddd)
{
HRESULT res;
OutTrace("Initialize: d3dd=%x lpd3d=%x GUID=%x lpd3ddd=%x\n", d3dd, lpd3d, lpGuid->Data1, lpd3ddd);
res=(*pInitialize)(d3dd, lpd3d, lpGuid, lpd3ddd);
if(res) OutTraceE("Initialize ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
HRESULT WINAPI extGetCaps(void *d3dd, LPD3DDEVICEDESC,LPD3DDEVICEDESC)
//HRESULT WINAPI extSwapTextureHandles(void *d3dd, LPDIRECT3DTEXTURE,LPDIRECT3DTEXTURE)
//HRESULT WINAPI extCreateExecuteBuffer(void *d3dd, LPD3DEXECUTEBUFFERDESC,LPDIRECT3DEXECUTEBUFFER*,IUnknown*)
//HRESULT WINAPI extGetStats(void *d3dd, LPD3DSTATS)
HRESULT WINAPI extExecute(void *d3dd, LPDIRECT3DEXECUTEBUFFER lpd3dEB, LPDIRECT3DVIEWPORT lpd3dVP, DWORD dwFlags)
HRESULT WINAPI extAddViewport(void *d3dd, LPDIRECT3DVIEWPORT)
HRESULT WINAPI extDeleteViewport(void *d3dd,HIS_ LPDIRECT3DVIEWPORT)
HRESULT WINAPI extNextViewport(void *d3dd, LPDIRECT3DVIEWPORT,LPDIRECT3DVIEWPORT*,DWORD)
HRESULT WINAPI extPick(void *d3dd, LPDIRECT3DEXECUTEBUFFER,LPDIRECT3DVIEWPORT,DWORD,LPD3DRECT)
HRESULT WINAPI extGetPickRecords(void *d3dd, LPDWORD,LPD3DPICKRECORD)
HRESULT WINAPI extEnumTextureFormats(void *d3dd, LPD3DENUMTEXTUREFORMATSCALLBACK,LPVOID)
HRESULT WINAPI extCreateMatrix(void *d3dd, LPD3DMATRIXHANDLE)
HRESULT WINAPI extSetMatrix(void *d3dd, D3DMATRIXHANDLE,const LPD3DMATRIX)
HRESULT WINAPI extGetMatrix(void *d3dd, D3DMATRIXHANDLE,LPD3DMATRIX)
HRESULT WINAPI extDeleteMatrix(void *d3dd, D3DMATRIXHANDLE)
HRESULT WINAPI extBeginScene(void *d3dd)
HRESULT WINAPI extEndScene(void *d3dd)
HRESULT WINAPI extGetDirect3D(void *d3dd, LPDIRECT3D*)
#endif

View File

@ -1186,6 +1186,7 @@ HRESULT WINAPI extGetClipperProxy(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWCLIPPER
HRESULT WINAPI extGetFlipStatusProxy(LPDIRECTDRAWSURFACE lpdds, DWORD flags)
{
#if 0
HRESULT res;
OutTraceP("GetFlipStatus(S): PROXED lpdds=%x flags=%x(%s)\n", lpdds, flags, ExplainFlipStatusFlags(flags));
res=(*pGetFlipStatus)(lpdds, flags);
@ -1193,6 +1194,18 @@ HRESULT WINAPI extGetFlipStatusProxy(LPDIRECTDRAWSURFACE lpdds, DWORD flags)
else
if(res) OutTraceP("GetFlipStatus(S): ERROR err=%x(%s)\n", res, ExplainDDError(res));
return res;
#else
HRESULT res;
static int DeMux=0;
OutTraceP("GetFlipStatus(S): DELAYED lpdds=%x flags=%x(%s)\n", lpdds, flags, ExplainFlipStatusFlags(flags));
DeMux = (DeMux + 1) % 10;
res=(*pGetFlipStatus)(lpdds, flags);
if(res==DDERR_WASSTILLDRAWING) OutTraceP("GetFlipStatus(S): res=%x(%s)\n", res, ExplainDDError(res));
else
if(res) OutTraceP("GetFlipStatus(S): ERROR err=%x(%s)\n", res, ExplainDDError(res));
if(DeMux) res=DDERR_WASSTILLDRAWING;
return res;
#endif
}
HRESULT WINAPI extGetOverlayPositionProxy(LPDIRECTDRAWSURFACE lpdds, LPLONG lpl1, LPLONG lpl2)

View File

@ -114,3 +114,7 @@ typedef HRESULT (WINAPI *GetCapsP_Type)(LPDIRECTDRAWPALETTE, LPDWORD);
typedef HRESULT (WINAPI *GetEntries_Type)(LPDIRECTDRAWPALETTE, DWORD, DWORD, DWORD, LPPALETTEENTRY);
// STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD, LPPALETTEENTRY) PURE;
typedef HRESULT (WINAPI *SetEntries_Type)(LPDIRECTDRAWPALETTE, DWORD, DWORD, DWORD, LPPALETTEENTRY);
//
// GammaRamp
typedef HRESULT (WINAPI *GammaRamp_Type)(LPDIRECTDRAWSURFACE, DWORD, LPDDGAMMARAMP);

View File

@ -442,6 +442,12 @@ FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc)
case SYSLIBIDX_ADVAPI32:
if (remap=Remap_AdvApi32_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_DIRECT3D:
if (remap=Remap_d3d7_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_DIRECT3D700:
if (remap=Remap_d3d7_ProcAddress(proc, hModule)) return remap;
break;
default:
break;
}

View File

@ -38,8 +38,8 @@ static void HookDDSession(LPDIRECTDRAW *, int);
HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv)
{
HRESULT res;
OutTraceD("CoCreateInstance: rclsid=%x UnkOuter=%x ClsContext=%x refiid=%x\n",
rclsid, pUnkOuter, dwClsContext, riid);
OutTraceD("CoCreateInstance: rclsid=%x UnkOuter=%x ClsContext=%x refiid=%x(%s)\n",
rclsid, pUnkOuter, dwClsContext, riid.Data1, ExplainGUID((GUID *)&riid));
// CLSID e436ebb3 implies loading quartz.dll to play movies through dshow:
// quartz.dll must be hooked.

View File

@ -318,7 +318,6 @@ DXWEXTERN GetClipCursor_Type pGetClipCursor DXWINITIALIZED;
DXWEXTERN GetCursorPos_Type pGetCursorPos DXWINITIALIZED;
DXWEXTERN GDIGetDC_Type pGDIGetDC DXWINITIALIZED;
DXWEXTERN GetDesktopWindow_Type pGetDesktopWindow DXWINITIALIZED;
DXWEXTERN GetMessage_Type pGetMessage DXWINITIALIZED;
DXWEXTERN GetSystemMetrics_Type pGetSystemMetrics DXWINITIALIZED;
DXWEXTERN GetTopWindow_Type pGetTopWindow DXWINITIALIZED;
DXWEXTERN GDIGetDC_Type pGDIGetWindowDC DXWINITIALIZED;
@ -491,7 +490,6 @@ extern BOOL WINAPI extGetCursorPos(LPPOINT);
extern HDC WINAPI extGDIGetDC(HWND);
extern HDC WINAPI extDDGetDC(HWND);
extern HWND WINAPI extGetDesktopWindow(void);
extern BOOL WINAPI extGetMessage(LPMSG, HWND, UINT, UINT);
extern int WINAPI extGetSystemMetrics(int);
extern HWND WINAPI extGetTopWindow(HWND);
extern HDC WINAPI extGDIGetWindowDC(HWND);
@ -503,7 +501,6 @@ extern BOOL WINAPI extDDInvalidateRect(HWND, RECT *, BOOL);
extern int WINAPI extMapWindowPoints(HWND, HWND, LPPOINT, UINT);
extern BOOL WINAPI extMoveWindow(HWND, int, int, int, int, BOOL);
extern BOOL WINAPI extPeekMessage(LPMSG, HWND, UINT, UINT, UINT);
extern BOOL WINAPI extPeekAnyMessage(LPMSG, HWND, UINT, UINT, UINT);
extern ATOM WINAPI extRegisterClassExA(WNDCLASSEXA *);
extern int WINAPI extDDReleaseDC(HWND, HDC);
extern int WINAPI extGDIReleaseDC(HWND, HDC);

View File

@ -73,15 +73,9 @@ static HookEntry_Type RemapHooks[]={
{0, NULL, 0, 0} // terminator
};
static HookEntry_Type MessageHooks[]={
//{"PeekMessageA", (FARPROC)PeekMessageA, (FARPROC *)&pPeekMessage, (FARPROC)extPeekMessage},
//{"GetMessageA", (FARPROC)GetMessageA, (FARPROC *)&pGetMessage, (FARPROC)extGetMessage},
{0, NULL, 0, 0} // terminator
};
static HookEntry_Type PeekAllHooks[]={
{"PeekMessageA", (FARPROC)NULL, (FARPROC *)&pPeekMessage, (FARPROC)extPeekAnyMessage},
{"PeekMessageW", (FARPROC)NULL, (FARPROC *)&pPeekMessage, (FARPROC)extPeekAnyMessage},
{"PeekMessageA", (FARPROC)NULL, (FARPROC *)&pPeekMessage, (FARPROC)extPeekMessage},
{"PeekMessageW", (FARPROC)NULL, (FARPROC *)&pPeekMessage, (FARPROC)extPeekMessage},
{0, NULL, 0, 0} // terminator
};
@ -118,9 +112,6 @@ FARPROC Remap_user32_ProcAddress(LPCSTR proc, HMODULE hModule)
if (addr=RemapLibrary(proc, hModule, (dxw.dwFlags1 & MAPGDITOPRIMARY) ? DDHooks : GDIHooks)) return addr;
if (dxw.dwFlags1 & CLIENTREMAPPING)
if (addr=RemapLibrary(proc, hModule, RemapHooks)) return addr;
// commented out since message processing was given to SetWindowHook callback
// if (dxw.dwFlags1 & MESSAGEPROC)
// if (addr=RemapLibrary(proc, hModule, MessageHooks)) return addr;
if(dxw.dwFlags1 & MODIFYMOUSE)
if (addr=RemapLibrary(proc, hModule, MouseHooks)) return addr;
if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE))
@ -141,7 +132,6 @@ void HookUser32(HMODULE hModule)
HookLibrary(hModule, EmulateHooks, libname);
HookLibrary(hModule, (dxw.dwFlags1 & MAPGDITOPRIMARY) ? DDHooks : GDIHooks, libname);
if (dxw.dwFlags1 & CLIENTREMAPPING) HookLibrary(hModule, RemapHooks, libname);
//if (dxw.dwFlags1 & MESSAGEPROC) HookLibrary(hModule, MessageHooks, libname);
if(dxw.dwFlags1 & MODIFYMOUSE)HookLibrary(hModule, MouseHooks, libname);
if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE))HookLibrary(hModule, WinHooks, libname);
if((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)) HookLibrary(hModule, MouseHooks2, libname);
@ -154,7 +144,6 @@ void HookUser32Init()
HookLibInit(Hooks);
HookLibInit(DDHooks);
HookLibInit(RemapHooks);
HookLibInit(MessageHooks);
HookLibInit(MouseHooks);
HookLibInit(WinHooks);
HookLibInit(MouseHooks2);
@ -350,11 +339,6 @@ static LRESULT WINAPI FixWindowProc(char *ApiName, HWND hwnd, UINT Msg, WPARAM w
ApiName, hwnd, Msg, ExplainWinMessage(Msg), wParam, lParam);
switch(Msg){
// attempt to fix Sleepwalker
//case WM_NCCALCSIZE:
// if (dxw.dwFlags1 & PREVENTMAXIMIZE)
// return 0;
// break;
case WM_ERASEBKGND:
OutTraceD("%s: prevent erase background\n", ApiName);
return 1; // 1=erased
@ -370,15 +354,6 @@ static LRESULT WINAPI FixWindowProc(char *ApiName, HWND hwnd, UINT Msg, WPARAM w
case WM_STYLECHANGED:
dxw.FixStyle(ApiName, hwnd, wParam, lParam);
break;
case WM_DISPLAYCHANGE:
// too late? to be deleted....
if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()) return 0;
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
OutTraceD("%s: WM_DISPLAYCHANGE depth=%d size=(%d,%d)\n",
ApiName, wParam, HIWORD(lParam), LOWORD(lParam));
return 0;
}
break;
case WM_SIZE:
if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()) return 0;
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
@ -780,88 +755,20 @@ BOOL WINAPI extSetCursorPos(int x, int y)
return res;
}
BOOL WINAPI extPeekAnyMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
BOOL WINAPI extPeekMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
{
BOOL res;
res=(*pPeekMessage)(lpMsg, hwnd, 0, 0, (wRemoveMsg & 0x000F));
OutTraceW("PeekMessage: ANY lpmsg=%x hwnd=%x filter=(%x-%x) remove=%x msg=%x(%s) wparam=%x, lparam=%x pt=(%d,%d) res=%x\n",
lpMsg, lpMsg->hwnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg,
OutTraceW("PeekMessage: ANY lpmsg=%x hwnd=%x filter=(%x-%x) remove=%x(%s) msg=%x(%s) wparam=%x, lparam=%x pt=(%d,%d) res=%x\n",
lpMsg, lpMsg->hwnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg, ExplainPeekRemoveMsg(wRemoveMsg),
lpMsg->message, ExplainWinMessage(lpMsg->message & 0xFFFF),
lpMsg->wParam, lpMsg->lParam, lpMsg->pt.x, lpMsg->pt.y, res);
return res;
}
BOOL WINAPI extPeekMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
{
BOOL res;
UINT iRemoveMsg;
iRemoveMsg = wRemoveMsg;
if(1) iRemoveMsg &= 0x000F; // Peek all messages
res=(*pPeekMessage)(lpMsg, hwnd, wMsgFilterMin, wMsgFilterMax, iRemoveMsg);
OutTraceW("PeekMessage: lpmsg=%x hwnd=%x filter=(%x-%x) remove=%x msg=%x(%s) wparam=%x, lparam=%x pt=(%d,%d) res=%x\n",
lpMsg, lpMsg->hwnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg,
lpMsg->message, ExplainWinMessage(lpMsg->message & 0xFFFF),
lpMsg->wParam, lpMsg->lParam, lpMsg->pt.x, lpMsg->pt.y, res);
// v2.1.74: skip message fix for WM_CHAR to avoid double typing bug
switch(lpMsg->message){
//case WM_CHAR:
case WM_KEYUP:
case WM_KEYDOWN:
return res;
}
// fix to avoid crash in Warhammer Final Liberation, that evidently intercepts mouse position by
// peeking & removing messages from window queue and considering the lParam parameter.
// v2.1.100 - never alter the lpMsg, otherwise the message is duplicated in the queue! Work on a copy of it.
if(wRemoveMsg){
static MSG MsgCopy;
MsgCopy=*lpMsg;
MsgCopy.pt=FixMessagePt(dxw.GethWnd(), MsgCopy.pt);
if((MsgCopy.message <= WM_MOUSELAST) && (MsgCopy.message >= WM_MOUSEFIRST)) MsgCopy.lParam = MAKELPARAM(MsgCopy.pt.x, MsgCopy.pt.y);
OutTraceC("PeekMessage: fixed lparam/pt=(%d,%d)\n", MsgCopy.pt.x, MsgCopy.pt.y);
lpMsg=&MsgCopy;
GetHookInfo()->CursorX=(short)MsgCopy.pt.x;
GetHookInfo()->CursorY=(short)MsgCopy.pt.y;
}
return res;
}
BOOL WINAPI extGetMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
{
BOOL res;
HWND FixedHwnd;
res=(*pGetMessage)(lpMsg, hwnd, wMsgFilterMin, wMsgFilterMax);
OutTraceW("GetMessage: lpmsg=%x hwnd=%x filter=(%x-%x) msg=%x(%s) wparam=%x, lparam=%x pt=(%d,%d) res=%x\n",
lpMsg, lpMsg->hwnd, wMsgFilterMin, wMsgFilterMax,
lpMsg->message, ExplainWinMessage(lpMsg->message & 0xFFFF),
lpMsg->wParam, lpMsg->lParam, lpMsg->pt.x, lpMsg->pt.y, res);
// V2.1.68: processing ALL mouse events, to sync mouse over and mouse click events
// in "Uprising 2", now perfectly working.
DWORD Message;
Message=lpMsg->message & 0xFFFF;
if((Message <= WM_MOUSELAST) && (Message >= WM_MOUSEFIRST)){
FixedHwnd=(hwnd)?hwnd:dxw.GethWnd();
if(dxw.IsRealDesktop(FixedHwnd)) FixedHwnd=dxw.GethWnd(); // GPL fix...
lpMsg->pt=FixMessagePt(FixedHwnd, lpMsg->pt);
lpMsg->lParam = MAKELPARAM(lpMsg->pt.x, lpMsg->pt.y);
OutTraceC("PeekMessage: fixed lparam/pt=(%d,%d)\n", lpMsg->pt.x, lpMsg->pt.y);
GetHookInfo()->CursorX=(short)lpMsg->pt.x;
GetHookInfo()->CursorY=(short)lpMsg->pt.y;
}
return res;
}
BOOL WINAPI extClientToScreen(HWND hwnd, LPPOINT lppoint)
{
// v2.02.10: fully revised to handle scaled windows
@ -1742,7 +1649,6 @@ BOOL WINAPI extMoveWindow(HWND hwnd, int X, int Y, int nWidth, int nHeight, BOOL
}
}
ret=(*pMoveWindow)(hwnd, X, Y, nWidth, nHeight, bRepaint);
if(!ret) OutTraceE("MoveWindow: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return ret;

BIN
host/Release/BuildLog.htm Normal file

Binary file not shown.

BIN
host/Release/Inject.obj Normal file

Binary file not shown.

BIN
host/Release/KillProc.obj Normal file

Binary file not shown.

BIN
host/Release/MainFrm.obj Normal file

Binary file not shown.

Binary file not shown.

BIN
host/Release/StdAfx.obj Normal file

Binary file not shown.

BIN
host/Release/SystemTray.obj Normal file

Binary file not shown.

BIN
host/Release/TabColor.obj Normal file

Binary file not shown.

BIN
host/Release/TabCompat.obj Normal file

Binary file not shown.

BIN
host/Release/TabDebug.obj Normal file

Binary file not shown.

BIN
host/Release/TabDirectX.obj Normal file

Binary file not shown.

BIN
host/Release/TabGDI.obj Normal file

Binary file not shown.

BIN
host/Release/TabLogs.obj Normal file

Binary file not shown.

BIN
host/Release/TabMouse.obj Normal file

Binary file not shown.

BIN
host/Release/TabOpenGL.obj Normal file

Binary file not shown.

BIN
host/Release/TabProgram.obj Normal file

Binary file not shown.

BIN
host/Release/TabTiming.obj Normal file

Binary file not shown.

BIN
host/Release/TabWindow.obj Normal file

Binary file not shown.

BIN
host/Release/TargetDlg.obj Normal file

Binary file not shown.

Binary file not shown.

BIN
host/Release/dxTabCtrl.obj Normal file

Binary file not shown.

View File

@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

BIN
host/Release/dxwndhost.obj Normal file

Binary file not shown.

BIN
host/Release/dxwndhost.pch Normal file

Binary file not shown.

BIN
host/Release/dxwndhost.res Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
host/Release/getfname.obj Normal file

Binary file not shown.

1
host/Release/mt.dep Normal file
View File

@ -0,0 +1 @@
Manifest resource last updated at 9:28:09,93 on 12/10/2013

BIN
host/Release/vc90.idb Normal file

Binary file not shown.

View File

@ -36,6 +36,7 @@
#define IDD_TAB_COMPAT 160
#define IDD_TAB_GDI 161
#define IDD_TAB_COLOR 162
#define IDD_TAB_DEBUG 163
#define IDC_AUTO 300
#define IDC_DIRECTX1 301
#define IDC_DIRECTX7 302
@ -144,6 +145,8 @@
#define IDC_SUPPRESSD3DEXT 1101
#define IDC_FULLRECTBLT 1102
#define IDC_TIMESPEED 1103
#define IDC_FULLRECTBLT2 1103
#define IDC_SURFACEWARN 1103
#define IDC_HOOKDLLS 1104
#define IDC_HOOKENABLED 1105
#define IDC_DESKTOPWORKAREA 1106
@ -171,7 +174,7 @@
#define IDC_BUFFEREDIOFIX 1128
#define IDC_FILTERMESSAGES 1129
#define IDC_PEEKALLMESSAGES 1130
#define IDC_TRACEHOOKS 1131
#define IDC_TRACEHOOKS 1131
#define ID_MODIFY 32771
#define ID_DELETE 32772
#define ID_ADD 32773

View File

@ -34,8 +34,6 @@ void CTabColor::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_BLACKWHITE, cTarget->m_BlackWhite);
DDX_Check(pDX, IDC_USERGB565, cTarget->m_UseRGB565);
DDX_Check(pDX, IDC_LOCKSYSCOLORS, cTarget->m_LockSysColors);
DDX_Check(pDX, IDC_RGB2YUV, cTarget->m_ForceRGBtoYUV);
DDX_Check(pDX, IDC_YUV2RGB, cTarget->m_ForceYUVtoRGB);
}
BEGIN_MESSAGE_MAP(CTabColor, CDialog)

61
host/TabDebug.cpp Normal file
View File

@ -0,0 +1,61 @@
// TabDebug.cpp : implementation file
//
#include "stdafx.h"
#include "TargetDlg.h"
#include "TabDebug.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTabCompat dialog
CTabDebug::CTabDebug(CWnd* pParent /*=NULL*/)
// : CTargetDlg(pParent)
: CDialog(CTabDebug::IDD, pParent)
{
//{{AFX_DATA_INIT(CTabDebug)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CTabDebug::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
DDX_Check(pDX, IDC_RGB2YUV, cTarget->m_ForceRGBtoYUV);
DDX_Check(pDX, IDC_YUV2RGB, cTarget->m_ForceYUVtoRGB);
DDX_Check(pDX, IDC_DXPROXED, cTarget->m_DXProxed);
DDX_Check(pDX, IDC_ASSERT, cTarget->m_AssertDialog);
DDX_Check(pDX, IDC_FULLRECTBLT, cTarget->m_FullRectBlt);
DDX_Check(pDX, IDC_MARKBLIT, cTarget->m_MarkBlit);
DDX_Check(pDX, IDC_SURFACEWARN, cTarget->m_SurfaceWarn);
}
BEGIN_MESSAGE_MAP(CTabDebug, CDialog)
//{{AFX_MSG_MAP(CTabCompat)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTabCompat message handlers
//BOOL CTabCompat::OnInitDialog()
//{
// AfxEnableControlContainer();
// CListBox *List;
// CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
// int i;
// List=(CListBox *)this->GetDlgItem(IDC_LISTFAKE);
// List->ResetContent();
// for(i=0; i<9; i++) List->AddString(WinVersions[i].sName);
// List->SetCurSel(cTarget->m_FakeVersion);
// CDialog::OnInitDialog();
// return TRUE;
//}

50
host/TabDebug.h Normal file
View File

@ -0,0 +1,50 @@
#if !defined(AFX_TABCOMPAT_H__12345678_C906_446C_822D_322B5AB6C4C4__INCLUDED_)
#define AFX_TABCOMPAT_H__12345678_C906_446C_822D_322B5AB6C4C4__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// TabDirectX.h : header file
//
#include "resource.h"
#include "TargetDlg.h"
/////////////////////////////////////////////////////////////////////////////
// CTabDirectX dialog
//class CTabCompat : public CTargetDlg
class CTabDebug : public CDialog
{
// Construction
public:
CTabDebug(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CTabDirectX)
enum { IDD = IDD_TAB_DEBUG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTabDirectX)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//BOOL OnInitDialog();
// Generated message map functions
//{{AFX_MSG(CTabDirectX)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_TABTHREE_H__798A9124_C906_446C_822D_322B5AB6C4C4__INCLUDED_)

View File

@ -28,19 +28,17 @@ void CTabDirectX::DoDataExchange(CDataExchange* pDX)
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
DDX_Radio(pDX, IDC_AUTO, cTarget->m_DXVersion);
DDX_Radio(pDX, IDC_NOEMULATESURFACE, cTarget->m_DxEmulationMode);
DDX_Check(pDX, IDC_HANDLEDC, cTarget->m_HandleDC);
//DDX_Check(pDX, IDC_HANDLEDC, cTarget->m_HandleDC);
DDX_Check(pDX, IDC_SUPPRESSCLIPPING, cTarget->m_SuppressClipping);
DDX_Check(pDX, IDC_BLITFROMBACKBUFFER, cTarget->m_BlitFromBackBuffer);
DDX_Check(pDX, IDC_AUTOREFRESH, cTarget->m_AutoRefresh);
DDX_Check(pDX, IDC_VIDEOTOSYSTEMMEM, cTarget->m_VideoToSystemMem);
DDX_Check(pDX, IDC_SUPPRESSDXERRORS, cTarget->m_SuppressDXErrors);
DDX_Check(pDX, IDC_MARKBLIT, cTarget->m_MarkBlit);
DDX_Check(pDX, IDC_BACKBUFATTACH, cTarget->m_BackBufAttach);
DDX_Check(pDX, IDC_FULLRECTBLT, cTarget->m_FullRectBlt);
DDX_Check(pDX, IDC_NOPALETTEUPDATE, cTarget->m_NoPaletteUpdate);
DDX_Check(pDX, IDC_SETCOMPATIBILITY, cTarget->m_SetCompatibility);
DDX_Check(pDX, IDC_DISABLEHAL, cTarget->m_DisableHAL);
DDX_Check(pDX, IDC_SAVECAPS, cTarget->m_SaveCaps);
//DDX_Check(pDX, IDC_SAVECAPS, cTarget->m_SaveCaps);
// DirectInput
DDX_Check(pDX, IDC_HOOKDI, cTarget->m_HookDI);
DDX_Text(pDX, IDC_INITX, cTarget->m_InitX);

View File

@ -22,20 +22,20 @@ CTabLogs::CTabLogs(CWnd* pParent /*=NULL*/)
//}}AFX_DATA_INIT
}
BOOL CTabLogs::OnInitDialog()
{
extern BOOL gbDebug;
CDialog::OnInitDialog();
(CButton *)(this->GetDlgItem(IDC_DXPROXED))->EnableWindow(gbDebug ? TRUE : FALSE);
(CButton *)(this->GetDlgItem(IDC_ASSERT))->EnableWindow(gbDebug ? TRUE : FALSE);
return TRUE;
}
//BOOL CTabLogs::OnInitDialog()
//{
// extern BOOL gbDebug;
// CDialog::OnInitDialog();
// (CButton *)(this->GetDlgItem(IDC_DXPROXED))->EnableWindow(gbDebug ? TRUE : FALSE);
// (CButton *)(this->GetDlgItem(IDC_ASSERT))->EnableWindow(gbDebug ? TRUE : FALSE);
// return TRUE;
//}
void CTabLogs::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
extern BOOL gbDebug;
//extern BOOL gbDebug;
DDX_Check(pDX, IDC_OUTTRACE, cTarget->m_OutTrace);
DDX_Check(pDX, IDC_OUTDEBUG, cTarget->m_OutDebug);
DDX_Check(pDX, IDC_CURSORTRACE, cTarget->m_CursorTrace);
@ -45,10 +45,6 @@ void CTabLogs::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_IMPORTTABLE, cTarget->m_ImportTable);
DDX_Check(pDX, IDC_OUTREGISTRY, cTarget->m_RegistryOp);
DDX_Check(pDX, IDC_TRACEHOOKS, cTarget->m_TraceHooks);
if(gbDebug){
DDX_Check(pDX, IDC_DXPROXED, cTarget->m_DXProxed);
DDX_Check(pDX, IDC_ASSERT, cTarget->m_AssertDialog);
}
}
BEGIN_MESSAGE_MAP(CTabLogs, CDialog)

View File

@ -16,7 +16,7 @@ class CTabLogs : public CDialog
// Construction
public:
CTabLogs(CWnd* pParent = NULL); // standard constructor
virtual BOOL OnInitDialog();
//virtual BOOL OnInitDialog();
// Dialog Data
//{{AFX_DATA(CTabLogs)

View File

@ -11,6 +11,8 @@
static char THIS_FILE[] = __FILE__;
#endif
extern BOOL gbDebug;
/////////////////////////////////////////////////////////////////////////////
// CTargetDlg Dialog
@ -106,6 +108,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_ForceHookOpenGL = FALSE;
m_FakeVersion = FALSE;
m_FullRectBlt = FALSE;
m_SurfaceWarn = FALSE;
m_NoPaletteUpdate = FALSE;
m_WireFrame = FALSE;
m_BlackWhite = FALSE;
@ -140,6 +143,7 @@ BOOL CTargetDlg::OnInitDialog()
m_tabdxTabCtrl.InsertItem(i++, _T("OpenGL"));
m_tabdxTabCtrl.InsertItem(i++, _T("GDI"));
m_tabdxTabCtrl.InsertItem(i++, _T("Compat"));
if (gbDebug) m_tabdxTabCtrl.InsertItem(i++, _T("Debug"));
m_tabdxTabCtrl.Init();
return TRUE;
}

View File

@ -104,6 +104,7 @@ public:
BOOL m_ForceHookOpenGL;
BOOL m_FakeVersion;
BOOL m_FullRectBlt;
BOOL m_SurfaceWarn;
BOOL m_NoPaletteUpdate;
BOOL m_LimitResources;
BOOL m_CDROMDriveType;

View File

@ -31,6 +31,7 @@
#include "TabCompat.h"
#include "TabColor.h"
#include "TabGDI.h"
#include "TabDebug.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@ -38,6 +39,8 @@
static char THIS_FILE[] = __FILE__;
#endif
extern BOOL gbDebug;
/////////////////////////////////////////////////////////////////////////////
// CDXTabCtrl
@ -54,6 +57,7 @@ CDXTabCtrl::CDXTabCtrl()
m_tabPages[i++]=new CTabOpenGL;
m_tabPages[i++]=new CTabGDI;
m_tabPages[i++]=new CTabCompat;
if (gbDebug) m_tabPages[i++]=new CTabDebug;
m_nNumberOfPages=i;
}
@ -80,6 +84,7 @@ void CDXTabCtrl::Init()
m_tabPages[i++]->Create(IDD_TAB_OPENGL, this);
m_tabPages[i++]->Create(IDD_TAB_GDI, this);
m_tabPages[i++]->Create(IDD_TAB_COMPAT, this);
if (gbDebug) m_tabPages[i++]->Create(IDD_TAB_DEBUG, this);
for(int nCount=0; nCount < m_nNumberOfPages; nCount++){
m_tabPages[nCount]->ShowWindow(nCount ? SW_HIDE:SW_SHOW);

View File

@ -16,7 +16,7 @@ class CDXTabCtrl : public CTabCtrl
// Construction
public:
CDXTabCtrl();
CDialog *m_tabPages[10];
CDialog *m_tabPages[11];
int m_tabCurrent;
int m_nNumberOfPages;
enum { IDD = IDC_TABPANEL };

Binary file not shown.

View File

@ -291,9 +291,6 @@ BEGIN
CONTROL "Win Events",IDC_OUTWINMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,70,73,12
CONTROL "Cursor/Mouse",IDC_CURSORTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,82,73,12
CONTROL "Import Table",IDC_IMPORTTABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,94,73,12
GROUPBOX "debug mode only",IDC_STATIC,7,154,130,79
CONTROL "Assert Dialog",IDC_ASSERT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,165,73,12
CONTROL "ddraw Proxy",IDC_DXPROXED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,177,73,12
CONTROL "Debug",IDC_OUTDEBUG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,106,73,12
CONTROL "Registry op.",IDC_OUTREGISTRY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,118,73,12
CONTROL "Hook op.",IDC_TRACEHOOKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,130,73,12
@ -317,17 +314,15 @@ BEGIN
CONTROL "Primary Surface",IDC_EMULATESURFACE,"Button",BS_AUTORADIOBUTTON,14,156,77,12
GROUPBOX "DirectX Version Hook",IDC_STATIC,6,3,98,103,WS_GROUP
GROUPBOX "Emulation",IDC_STATIC,7,109,98,61,WS_GROUP
CONTROL "Handle DC",IDC_HANDLEDC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,26,78,12
CONTROL "Auto Primary Surface Refresh",IDC_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,38,126,9
CONTROL "Auto Primary Surface Refresh",IDC_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,16,126,9
GROUPBOX "DirectDraw Surface handling",IDC_STATIC,112,3,181,167
CONTROL "VIDEO->SYSTEM surf. on fail",IDC_VIDEOTOSYSTEMMEM,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,118,50,126,9
CONTROL "Suppress DX common errors",IDC_SUPPRESSDXERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,62,127,10
CONTROL "Make Backbuf attachable",IDC_BACKBUFATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,86,119,10
CONTROL "Blit from BackBuffer",IDC_BLITFROMBACKBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,98,119,10
CONTROL "Suppress clipping",IDC_SUPPRESSCLIPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,110,119,10
CONTROL "Full RECT Blit",IDC_FULLRECTBLT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,122,119,10
CONTROL "Palette update don't Blit",IDC_NOPALETTEUPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,134,119,10
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,118,28,126,9
CONTROL "Suppress DX common errors",IDC_SUPPRESSDXERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,40,127,10
CONTROL "Make Backbuf attachable",IDC_BACKBUFATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,52,119,10
CONTROL "Blit from BackBuffer",IDC_BLITFROMBACKBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,64,119,10
CONTROL "Suppress clipping",IDC_SUPPRESSCLIPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,76,119,10
CONTROL "Palette update don't Blit",IDC_NOPALETTEUPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,88,119,10
LTEXT "DirectInput initial coord. and X,Y range",IDC_STATIC,19,197,146,9
LTEXT "X",IDC_STATIC,13,212,9,9
LTEXT "Y",IDC_STATIC,40,212,9,9
@ -344,10 +339,8 @@ BEGIN
EDITTEXT IDC_MAXY,148,209,17,14,ES_AUTOHSCROLL,WS_EX_RIGHT
CONTROL "DirectInput Hooking",IDC_HOOKDI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,182,97,12
GROUPBOX "DirectInput",IDC_STATIC,7,172,286,61
CONTROL "Set AERO compatible mode",IDC_SETCOMPATIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,146,109,12
CONTROL "Highlight blit to primary",IDC_MARKBLIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,74,127,10
CONTROL "Preserve surface capabilities",IDC_SAVECAPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,14,109,12
CONTROL "Disable HAL support",IDC_DISABLEHAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,158,109,12
CONTROL "Set AERO compatible mode",IDC_SETCOMPATIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,100,109,12
CONTROL "Disable HAL support",IDC_DISABLEHAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,112,109,12
END
IDD_TAB_MOUSE DIALOGEX 0, 0, 300, 240
@ -466,8 +459,22 @@ BEGIN
CONTROL "Simulate BW monitor",IDC_BLACKWHITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,76,96,10
CONTROL "Set 16BPP RGB565 encoding",IDC_USERGB565,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,88,126,9
CONTROL "Lock Sys Colors",IDC_LOCKSYSCOLORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,100,126,9
CONTROL "Simulate YUV to RGB color conv.",IDC_YUV2RGB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,112,126,9
CONTROL "Simulate RGB to YUV color conv.",IDC_RGB2YUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,124,126,9
END
IDD_TAB_DEBUG DIALOGEX 0, 0, 300, 240
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Debug flags",IDC_STATIC,7,3,140,144
CONTROL "Simulate YUV to RGB color conv.",IDC_YUV2RGB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,36,119,9
CONTROL "Simulate RGB to YUV color conv.",IDC_RGB2YUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,48,119,9
CONTROL "Highlight blit to primary",IDC_MARKBLIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,24,99,10
CONTROL "Full RECT Blit",IDC_FULLRECTBLT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,60,119,10
GROUPBOX "debug mode logs",IDC_STATIC,7,154,139,79
CONTROL "Assert Dialog",IDC_ASSERT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,166,73,11
CONTROL "ddraw Proxy",IDC_DXPROXED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,178,73,9
CONTROL "Warning for analytic surface mode",IDC_SURFACEWARN,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,72,127,10
END
@ -637,6 +644,14 @@ BEGIN
TOPMARGIN, 3
BOTTOMMARGIN, 233
END
IDD_TAB_DEBUG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 293
TOPMARGIN, 7
BOTTOMMARGIN, 233
END
END
#endif // APSTUDIO_INVOKED

BIN
host/dxwndhost.vs2008.ncb Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="dxwndhost"
ProjectGUID="{FD0B0234-8EC5-43C0-A384-1B881DD3D925}"
RootNamespace="dxwndhost"
@ -373,6 +373,10 @@
RelativePath=".\TabCompat.cpp"
>
</File>
<File
RelativePath=".\TabDebug.cpp"
>
</File>
<File
RelativePath=".\TabDirectX.cpp"
>
@ -482,6 +486,10 @@
RelativePath=".\TabCompat.h"
>
</File>
<File
RelativePath=".\TabDebug.h"
>
</File>
<File
RelativePath=".\TabDirectX.h"
>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="9,00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="USER-PC"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="USER-PC"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

View File

@ -213,6 +213,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_FakeVersion) t->flags2 |= FAKEVERSION;
if(dlg->m_FullRectBlt) t->flags2 |= FULLRECTBLT;
if(dlg->m_NoPaletteUpdate) t->flags2 |= NOPALETTEUPDATE;
if(dlg->m_SurfaceWarn) t->flags3 |= SURFACEWARN;
t->initx = dlg->m_InitX;
t->inity = dlg->m_InitY;
t->minx = dlg->m_MinX;
@ -339,6 +340,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_FakeVersion = t->flags2 & FAKEVERSION ? 1 : 0;
dlg->m_FullRectBlt = t->flags2 & FULLRECTBLT ? 1 : 0;
dlg->m_NoPaletteUpdate = t->flags2 & NOPALETTEUPDATE ? 1 : 0;
dlg->m_SurfaceWarn = t->flags3 & SURFACEWARN ? 1 : 0;
dlg->m_InitX = t->initx;
dlg->m_InitY = t->inity;
dlg->m_MinX = t->minx;