DXVIEW.C
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:135k
源码类别:

Windows编程

开发平台:

Visual C++

  1. /****************************************************************************
  2.     Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
  3.     PROGRAM: dxview.c
  4.     PURPOSE: DirectX Device Viewer
  5.     FUNCTIONS:
  6.     COMMENTS:
  7. ****************************************************************************/
  8. #include "dxview.h"
  9. #pragma comment(lib, "dxguid")
  10. #pragma comment(lib, "ddraw")
  11. #pragma comment(lib, "dsound")
  12. #pragma comment(lib, "dplayx")
  13. #pragma comment(lib, "dinput")
  14. #pragma comment(lib, "comctl32")
  15. /****************************************************************************
  16.  ***************************************************************************/
  17. HINSTANCE   g_hInstance;
  18. char        g_szAppName[]   = "DXView";
  19. char        g_szClassName[] = "DXView";
  20. char        g_szTitle[]     = "DirectX Device Viewer";
  21. HWND        g_hwndMain;
  22. HWND        g_hwndLV;        // List view
  23. HWND        g_hwndTV;        // Tree view
  24. HIMAGELIST  g_hImageList;
  25. HFONT       g_hFont;
  26. int         g_xPaneSplit;
  27. int         g_xHalfSplitWidth;
  28. BOOL        g_bSplitMove;
  29. DWORD       g_dwViewState;
  30. DWORD       g_tmAveCharWidth;
  31. extern BOOL g_PrintToFile;
  32. UINT g_idTimer;
  33. LPLOCALAPP g_lpLocalApp;
  34. HINSTANCE g_hDSoundLib = NULL;
  35. typedef HRESULT (WINAPI * PFN_DSCREATE)(LPGUID lpguid, LPDIRECTSOUND * ppDS, IUnknown FAR * pUnkOuter);
  36. typedef BOOL (WINAPI * PFN_DSENUMERATE)(LPDSENUMCALLBACK lpDSEnumCallback, LPVOID lpContext);
  37. typedef HRESULT (WINAPI * PFN_DSCCREATE)(LPGUID lpGUID, LPDIRECTSOUNDCAPTURE *lplpDSC,LPUNKNOWN pUnkOuter);
  38. typedef BOOL (WINAPI * PFN_DSCENUMERATE)(LPDSENUMCALLBACK lpDSEnumCallback,LPVOID lpContext);
  39. /****************************************************************************
  40.  ***************************************************************************/
  41. IDirectDraw *lpDD;                  // DirectDraw object
  42. IDirectDraw2 *lpDD2;                // DirectDraw object
  43. IDirect3D2  *lp3D;                  // Direct3D object
  44. GUID *       ddid;
  45. IDirectSound *lpDS;                 // DirectSound object
  46. GUID *       dsid;
  47. IDirectSoundCapture *lpDSC;         // DirectSoundCapture object
  48. GUID *       dscid;
  49. IDirectPlay3A  *lpDP3A;             // DirectPlay object
  50. GUID *       dpid;
  51. /****************************************************************************
  52.  ***************************************************************************/
  53. #define DDCAPDEF(name,val,flag) {name, FIELD_OFFSET(DDCAPS,val), flag}
  54. #define DDVALDEF(name,val)      {name, FIELD_OFFSET(DDCAPS,val), 0}
  55. #define DDHEXDEF(name,val)      {name, FIELD_OFFSET(DDCAPS,val), 0xFFFFFFFF}
  56. #define ROPDEF(name,dwRops,rop) DDCAPDEF(name,dwRops[((rop>>16)&0xFF)/32],(1<<((rop>>16)&0xFF)%32))
  57. #define DSCAPDEF(name,val,flag) {name, FIELD_OFFSET(DSCAPS,val), flag}
  58. #define DSVALDEF(name,val)      {name, FIELD_OFFSET(DSCAPS,val), 0}
  59. #define DSCCAPDEF(name,val,flag) {name, FIELD_OFFSET(DSCCAPS,val), flag}
  60. #define DSCVALDEF(name,val)      {name, FIELD_OFFSET(DSCCAPS,val), 0}
  61. #define DPCAPDEF(name,val,flag) {name, FIELD_OFFSET(DPCAPS,val), flag}
  62. #define DPHEXDEF(name,val)      {name, FIELD_OFFSET(DPCAPS,val), 0xFFFFFFFF}
  63. #define DPVALDEF(name,val)      {name, FIELD_OFFSET(DPCAPS,val), 0}
  64. #define D3CAPDEF(name,val,flag) {name, FIELD_OFFSET(D3DDEVICEDESC,val), flag}
  65. #define D3HEXDEF(name,val)      {name, FIELD_OFFSET(D3DDEVICEDESC,val), 0xFFFFFFFF}
  66. #define D3VALDEF(name,val)      {name, FIELD_OFFSET(D3DDEVICEDESC,val), 0}
  67. #define SURFCAPDEF(name,val,flag) {name, FIELD_OFFSET(DDSURFACEDESC,val), flag}
  68. #define SURFVALDEF(name,val)      {name, FIELD_OFFSET(DDSURFACEDESC,val), 0}
  69. #define MAKEMODE(xres,yres,bpp) (((DWORD)xres << 20) | ((DWORD)yres << 8) | bpp)
  70. #define GETXRES(mode)           (int)((mode >> 20) & 0x0FFF)
  71. #define GETYRES(mode)           (int)((mode >> 8)  & 0x0FFF)
  72. #define GETCRES(mode)           (int)((mode >> 0)  & 0x00FF)
  73. IDirectDraw * DDCreate(GUID *pid);
  74. BOOL PrintValueLine(char * szText, DWORD dwValue, PRINTCBINFO *lpInfo)
  75. {
  76.     char    szBuff[80];
  77.     DWORD cchLen;
  78.     int xName, xVal, yLine;
  79.     // Calculate Name and Value column x offsets
  80.     xName   = (lpInfo->dwCurrIndent * DEF_TAB_SIZE * lpInfo->dwCharWidth);
  81.     xVal    = xName + (32 * lpInfo->dwCharWidth);
  82.     yLine   = (lpInfo->dwCurrLine * lpInfo->dwLineHeight);
  83.     // Print name
  84.     wsprintf (szBuff, szText);
  85.     cchLen = _tcslen (szText);
  86.     if (! PrintLine (xName, yLine, szBuff, cchLen, lpInfo))
  87.         return FALSE;
  88.     // Print value
  89.     wsprintf (szBuff, "%d", dwValue);
  90.     cchLen = _tcslen (szBuff);
  91.     if (! PrintLine (xVal, yLine, szBuff, cchLen, lpInfo))
  92.         return FALSE;
  93.     // Advance to next line on page
  94.     if (! PrintNextLine (lpInfo))
  95.         return FALSE;
  96.    return TRUE;
  97. }
  98. VOID VidMem(long lParam1, long foo2)
  99. {
  100.     HRESULT ddrval;
  101.     DWORD dwTotalMem;
  102.     DWORD dwFreeMem;
  103.     DDSCAPS DDSCaps;
  104.     LVAddColumn(g_hwndLV, 0, "Type", 24);
  105.     LVAddColumn(g_hwndLV, 1, "Total", 10);
  106.     LVAddColumn(g_hwndLV, 2, "Free", 10);
  107.     if (DDCreate((GUID*)lParam1))
  108.     {
  109.         IDirectDraw_QueryInterface(lpDD,&IID_IDirectDraw2,&lpDD2);
  110.         DDSCaps.dwCaps = DDSCAPS_VIDEOMEMORY;
  111.         ddrval = IDirectDraw2_GetAvailableVidMem(lpDD2, &DDSCaps, &dwTotalMem, &dwFreeMem );
  112.         if(ddrval != DD_OK)
  113.         {
  114.             dwTotalMem = 0;
  115.             dwFreeMem = 0;
  116.         };
  117.         LVAddText(g_hwndLV, 0, "Video");
  118.         LVAddText(g_hwndLV, 1, "%d", dwTotalMem);
  119.         LVAddText(g_hwndLV, 2, "%d", dwFreeMem);
  120.         DDSCaps.dwCaps = DDSCAPS_LOCALVIDMEM;
  121.         ddrval = IDirectDraw2_GetAvailableVidMem(lpDD2, &DDSCaps, &dwTotalMem, &dwFreeMem );
  122.         if(ddrval != DD_OK)
  123.         {
  124.             dwTotalMem = 0;
  125.             dwFreeMem = 0;
  126.         };
  127.         LVAddText(g_hwndLV, 0, "Video (local)");
  128.         LVAddText(g_hwndLV, 1, "%d", dwTotalMem);
  129.         LVAddText(g_hwndLV, 2, "%d", dwFreeMem);
  130.         DDSCaps.dwCaps = DDSCAPS_NONLOCALVIDMEM;
  131.         ddrval = IDirectDraw2_GetAvailableVidMem(lpDD2, &DDSCaps, &dwTotalMem, &dwFreeMem );
  132.         if(ddrval != DD_OK)
  133.         {
  134.             dwTotalMem = 0;
  135.             dwFreeMem = 0;
  136.         };
  137.         LVAddText(g_hwndLV, 0, "Video (non-local)");
  138.         LVAddText(g_hwndLV, 1, "%d", dwTotalMem);
  139.         LVAddText(g_hwndLV, 2, "%d", dwFreeMem);
  140.         DDSCaps.dwCaps = DDSCAPS_TEXTURE;
  141.         ddrval = IDirectDraw2_GetAvailableVidMem(lpDD2, &DDSCaps, &dwTotalMem, &dwFreeMem );
  142.         if(ddrval != DD_OK)
  143.         {
  144.             dwTotalMem = 0;
  145.             dwFreeMem = 0;
  146.         };
  147.         LVAddText(g_hwndLV, 0, "Texture");
  148.         LVAddText(g_hwndLV, 1, "%d", dwTotalMem);
  149.         LVAddText(g_hwndLV, 2, "%d", dwFreeMem);
  150.     }
  151. }
  152. BOOL VidMemPrint(long lParam1, long lParam2, PRINTCBINFO *lpInfo)
  153. {
  154.     HRESULT ddrval;
  155.     DWORD dwTotalMem;
  156.     DWORD dwFreeMem;
  157.     DDSCAPS DDSCaps;
  158.     if (DDCreate((GUID*)lParam1))
  159.     {
  160.         IDirectDraw_QueryInterface(lpDD,&IID_IDirectDraw2,&lpDD2);
  161.         DDSCaps.dwCaps = DDSCAPS_VIDEOMEMORY;
  162.         ddrval = IDirectDraw2_GetAvailableVidMem(lpDD2, &DDSCaps, &dwTotalMem, &dwFreeMem );
  163.         if(ddrval != DD_OK)
  164.         {
  165.             dwTotalMem = 0;
  166.             dwFreeMem = 0;
  167.         };
  168.         PrintValueLine("TotalMem",dwTotalMem,lpInfo);
  169.         PrintValueLine("FreeMem",dwFreeMem,lpInfo);
  170.         DDSCaps.dwCaps = DDSCAPS_LOCALVIDMEM;
  171.         ddrval = IDirectDraw2_GetAvailableVidMem(lpDD2, &DDSCaps, &dwTotalMem, &dwFreeMem );
  172.         if(ddrval != DD_OK)
  173.         {
  174.             dwTotalMem = 0;
  175.             dwFreeMem = 0;
  176.         };
  177.         PrintValueLine("TotalVideoMem",dwTotalMem,lpInfo);
  178.         PrintValueLine("FreeVideoMem",dwFreeMem,lpInfo);
  179.         DDSCaps.dwCaps = DDSCAPS_NONLOCALVIDMEM;
  180.         ddrval = IDirectDraw2_GetAvailableVidMem(lpDD2, &DDSCaps, &dwTotalMem, &dwFreeMem );
  181.         if(ddrval != DD_OK)
  182.         {
  183.             dwTotalMem = 0;
  184.             dwFreeMem = 0;
  185.         };
  186.         PrintValueLine("TotalAGPMem",dwTotalMem,lpInfo);
  187.         PrintValueLine("FreeAGPMem",dwFreeMem,lpInfo);
  188.         DDSCaps.dwCaps = DDSCAPS_TEXTURE;
  189.         ddrval = IDirectDraw2_GetAvailableVidMem(lpDD2, &DDSCaps, &dwTotalMem, &dwFreeMem );
  190.         if(ddrval != DD_OK)
  191.         {
  192.             dwTotalMem = 0;
  193.             dwFreeMem = 0;
  194.         };
  195.         PrintValueLine("TotalTextureMem",dwTotalMem,lpInfo);
  196.         PrintValueLine("FreeTextureMem",dwFreeMem,lpInfo);
  197.     }
  198.     return TRUE; 
  199. };
  200. /****************************************************************************
  201.  ***************************************************************************/
  202. CAPDEF OtherInfoDefs[] =
  203. {
  204.     DDVALDEF("VidMemTotal",                   dwVidMemTotal),
  205.     DDVALDEF("VidMemFree",                    dwVidMemFree),
  206.     DDHEXDEF("AlphaBltConstBitDepths",        dwAlphaBltConstBitDepths),
  207.     DDCAPDEF("  8",                           dwAlphaBltConstBitDepths, DDBD_8),
  208.     DDCAPDEF("  16",                          dwAlphaBltConstBitDepths, DDBD_16),
  209.     DDCAPDEF("  24",                          dwAlphaBltConstBitDepths, DDBD_24),
  210.     DDCAPDEF("  32",                          dwAlphaBltConstBitDepths, DDBD_32),
  211.     DDHEXDEF("AlphaBltPixelBitDepths",        dwAlphaBltPixelBitDepths),
  212.     DDCAPDEF("  8",                           dwAlphaBltPixelBitDepths, DDBD_8),
  213.     DDCAPDEF("  16",                          dwAlphaBltPixelBitDepths, DDBD_16),
  214.     DDCAPDEF("  24",                          dwAlphaBltPixelBitDepths, DDBD_24),
  215.     DDCAPDEF("  32",                          dwAlphaBltPixelBitDepths, DDBD_32),
  216.     DDHEXDEF("AlphaBltSurfaceBitDepths",      dwAlphaBltSurfaceBitDepths),
  217.     DDCAPDEF("  8",                           dwAlphaBltSurfaceBitDepths, DDBD_8),
  218.     DDCAPDEF("  16",                          dwAlphaBltSurfaceBitDepths, DDBD_16),
  219.     DDCAPDEF("  24",                          dwAlphaBltSurfaceBitDepths, DDBD_24),
  220.     DDCAPDEF("  32",                          dwAlphaBltSurfaceBitDepths, DDBD_32),
  221.     DDHEXDEF("AlphaOverlayConstBitDepths",    dwAlphaOverlayConstBitDepths),
  222.     DDCAPDEF("  8",                           dwAlphaOverlayConstBitDepths, DDBD_8),
  223.     DDCAPDEF("  16",                          dwAlphaOverlayConstBitDepths, DDBD_16),
  224.     DDCAPDEF("  24",                          dwAlphaOverlayConstBitDepths, DDBD_24),
  225.     DDCAPDEF("  32",                          dwAlphaOverlayConstBitDepths, DDBD_32),
  226.     DDHEXDEF("AlphaOverlayPixelBitDepths",    dwAlphaOverlayPixelBitDepths),
  227.     DDCAPDEF("  8",                           dwAlphaOverlayPixelBitDepths, DDBD_8),
  228.     DDCAPDEF("  16",                          dwAlphaOverlayPixelBitDepths, DDBD_16),
  229.     DDCAPDEF("  24",                          dwAlphaOverlayPixelBitDepths, DDBD_24),
  230.     DDCAPDEF("  32",                          dwAlphaOverlayPixelBitDepths, DDBD_32),
  231.     DDHEXDEF("AlphaOverlaySurfaceBitDepths",  dwAlphaOverlaySurfaceBitDepths),
  232.     DDCAPDEF("  8",                           dwAlphaOverlaySurfaceBitDepths, DDBD_8),
  233.     DDCAPDEF("  16",                          dwAlphaOverlaySurfaceBitDepths, DDBD_16),
  234.     DDCAPDEF("  24",                          dwAlphaOverlaySurfaceBitDepths, DDBD_24),
  235.     DDCAPDEF("  32",                          dwAlphaOverlaySurfaceBitDepths, DDBD_32),
  236.     DDHEXDEF("ZBufferBitDepths",              dwZBufferBitDepths),
  237.     DDCAPDEF("  8",                           dwZBufferBitDepths, DDBD_8),
  238.     DDCAPDEF("  16",                          dwZBufferBitDepths, DDBD_16),
  239.     DDCAPDEF("  24",                          dwZBufferBitDepths, DDBD_24),
  240.     DDCAPDEF("  32",                          dwZBufferBitDepths, DDBD_32),
  241.     DDVALDEF("MaxVisibleOverlays",            dwMaxVisibleOverlays),
  242.     DDVALDEF("CurrVisibleOverlays",           dwCurrVisibleOverlays),
  243.     DDVALDEF("NumFourCCCodes",                dwNumFourCCCodes),
  244.     DDVALDEF("AlignBoundarySrc",              dwAlignBoundarySrc),
  245.     DDVALDEF("AlignSizeSrc",                  dwAlignSizeSrc),
  246.     DDVALDEF("AlignBoundaryDest",             dwAlignBoundaryDest),
  247.     DDVALDEF("AlignSizeDest",                 dwAlignSizeDest),
  248.     DDVALDEF("AlignStrideAlign",              dwAlignStrideAlign),
  249.     DDVALDEF("MinOverlayStretch",             dwMinOverlayStretch),
  250.     DDVALDEF("MaxOverlayStretch",             dwMaxOverlayStretch),
  251.     DDVALDEF("MinLiveVideoStretch",           dwMinLiveVideoStretch),
  252.     DDVALDEF("MaxLiveVideoStretch",           dwMaxLiveVideoStretch),
  253.     DDVALDEF("MinHwCodecStretch",             dwMinHwCodecStretch),
  254.     DDVALDEF("MaxHwCodecStretch",             dwMaxHwCodecStretch),
  255.     DDVALDEF("dwReserved1",                   dwReserved1),
  256.     DDVALDEF("dwReserved2",                   dwReserved2),
  257.     DDVALDEF("dwReserved3",                   dwReserved3),
  258.     //DDHEXDEF("dwCaps",                      dwCaps),
  259.     DDVALDEF("dwMaxVideoPorts",               dwMaxVideoPorts),
  260.     DDVALDEF("dwCurrVideoPorts",               dwCurrVideoPorts),
  261.     //DDVALDEF("dwSVBCaps2",                   dwSVBCaps2),
  262.     { "", 0, 0 }
  263. };
  264. /****************************************************************************
  265.  ***************************************************************************/
  266. #define GEN_CAPS(dwCaps)                                                     
  267.     DDCAPDEF("3D",                        dwCaps, DDCAPS_3D),                   
  268.     DDCAPDEF("ALIGNBOUNDARYDEST",         dwCaps, DDCAPS_ALIGNBOUNDARYDEST),    
  269.     DDCAPDEF("ALIGNSIZEDEST",             dwCaps, DDCAPS_ALIGNSIZEDEST),        
  270.     DDCAPDEF("ALIGNBOUNDARYSRC",          dwCaps, DDCAPS_ALIGNBOUNDARYSRC),     
  271.     DDCAPDEF("ALIGNSIZESRC",              dwCaps, DDCAPS_ALIGNSIZESRC),         
  272.     DDCAPDEF("ALIGNSTRIDE",               dwCaps, DDCAPS_ALIGNSTRIDE),          
  273.     DDCAPDEF("GDI",                       dwCaps, DDCAPS_GDI),                  
  274.     DDCAPDEF("OVERLAY",                   dwCaps, DDCAPS_OVERLAY),              
  275.     DDCAPDEF("OVERLAYCANTCLIP",           dwCaps, DDCAPS_OVERLAYCANTCLIP),      
  276.     DDCAPDEF("OVERLAYFOURCC",             dwCaps, DDCAPS_OVERLAYFOURCC),        
  277.     DDCAPDEF("OVERLAYSTRETCH",            dwCaps, DDCAPS_OVERLAYSTRETCH),       
  278.     DDCAPDEF("PALETTE",                   dwCaps, DDCAPS_PALETTE),              
  279.     DDCAPDEF("PALETTEVSYNC",              dwCaps, DDCAPS_PALETTEVSYNC),         
  280.     DDCAPDEF("READSCANLINE",              dwCaps, DDCAPS_READSCANLINE),         
  281.     DDCAPDEF("STEREOVIEW",                dwCaps, DDCAPS_STEREOVIEW),           
  282.     DDCAPDEF("VBI",                       dwCaps, DDCAPS_VBI),                  
  283.     DDCAPDEF("ZOVERLAYS",                 dwCaps, DDCAPS_ZOVERLAYS),            
  284.     DDCAPDEF("NOHARDWARE",                dwCaps, DDCAPS_NOHARDWARE),           
  285.     DDCAPDEF("BANKSWITCHED",              dwCaps, DDCAPS_BANKSWITCHED),
  286. #define GEN_CAPS2(dwCaps2)                                                      
  287.     DDCAPDEF("CERTIFIED",                 dwCaps2,DDCAPS2_CERTIFIED),           
  288.     DDCAPDEF("NO2DDURING3DSCENE",         dwCaps2,DDCAPS2_NO2DDURING3DSCENE),   
  289.     DDCAPDEF("VIDEOPORT",                 dwCaps2,DDCAPS2_VIDEOPORT),           
  290.     DDCAPDEF("AUTOFLIPOVERLAY",           dwCaps2,DDCAPS2_AUTOFLIPOVERLAY),     
  291.     DDCAPDEF("CANBOBINTERLEAVED",         dwCaps2,DDCAPS2_CANBOBINTERLEAVED),   
  292.     DDCAPDEF("CANBOBNONINTERLEAVED",      dwCaps2,DDCAPS2_CANBOBNONINTERLEAVED),
  293.     DDCAPDEF("COLORCONTROLOVERLAY",       dwCaps2,DDCAPS2_COLORCONTROLOVERLAY), 
  294.     DDCAPDEF("COLORCONTROLPRIMARY",       dwCaps2,DDCAPS2_COLORCONTROLPRIMARY), 
  295.     DDCAPDEF("NONLOCALVIDMEM",            dwCaps2,DDCAPS2_NONLOCALVIDMEM),      
  296.     DDCAPDEF("NONLOCALVIDMEMCAPS",        dwCaps2,DDCAPS2_NONLOCALVIDMEMCAPS),  
  297.     DDCAPDEF("WIDESURFACES",              dwCaps2,DDCAPS2_WIDESURFACES),        
  298.     DDCAPDEF("NOPAGELOCKREQUIRED",        dwCaps2,DDCAPS2_NOPAGELOCKREQUIRED),  
  299. #define GEN_BLTCAPS(dwCaps)                                                     
  300.     DDCAPDEF("BLT",                       dwCaps, DDCAPS_BLT),                  
  301.     DDCAPDEF("BLTCOLORFILL",              dwCaps, DDCAPS_BLTCOLORFILL),         
  302.     DDCAPDEF("BLTDEPTHFILL",              dwCaps, DDCAPS_BLTDEPTHFILL),         
  303.     DDCAPDEF("BLTFOURCC",                 dwCaps, DDCAPS_BLTFOURCC),            
  304.     DDCAPDEF("BLTSTRETCH",                dwCaps, DDCAPS_BLTSTRETCH),           
  305.     DDCAPDEF("BLTQUEUE",                  dwCaps, DDCAPS_BLTQUEUE),             
  306.     DDCAPDEF("COLORKEY",                  dwCaps, DDCAPS_COLORKEY),             
  307.     DDCAPDEF("ALPHA",                     dwCaps, DDCAPS_ALPHA),                
  308.     DDCAPDEF("CKEYHWASSIST",              dwCaps, DDCAPS_COLORKEYHWASSIST),     
  309.     DDCAPDEF("CANCLIP",                   dwCaps, DDCAPS_CANCLIP),              
  310.     DDCAPDEF("CANCLIPSTRETCHED",          dwCaps, DDCAPS_CANCLIPSTRETCHED),     
  311.     DDCAPDEF("CANBLTSYSMEM",              dwCaps, DDCAPS_CANBLTSYSMEM),         
  312.     DDCAPDEF("ZBLTS",                     dwCaps, DDCAPS_ZBLTS),                
  313. #define GEN_BLTCAPS2(dwCaps2)                                                   
  314.     DDCAPDEF("CANDROPZ16BIT",             dwCaps2,DDCAPS2_CANDROPZ16BIT),       
  315.     DDCAPDEF("NOPAGELOCKREQUIRED",        dwCaps2,DDCAPS2_NOPAGELOCKREQUIRED),  
  316. /****************************************************************************
  317.  ***************************************************************************/
  318. CAPDEF GenCaps[] =
  319. {
  320.     GEN_CAPS(dwCaps)
  321.     GEN_CAPS2(dwCaps2)
  322.     { "", 0, 0 }
  323. };
  324. //
  325. // NOTE GenCaps and CapsDefs are the same
  326. // because some are blt caps that apply to VRAM->VRAM blts and
  327. // some are "general" caps...
  328. //
  329. CAPDEF CapsDefs[] =
  330. {
  331.     GEN_BLTCAPS(dwCaps)
  332.     GEN_BLTCAPS2(dwCaps2)
  333.     { "", 0, 0 }
  334. };
  335. CAPDEF SVBCapsDefs[] =
  336. {
  337.     GEN_BLTCAPS(dwSVBCaps)
  338.     GEN_BLTCAPS2(dwSVBCaps2)
  339.     { "", 0, 0 }
  340. };
  341. CAPDEF VSBCapsDefs[] =
  342. {
  343.     GEN_BLTCAPS(dwVSBCaps)
  344. //  GEN_BLTCAPS2(dwVSBCaps2)
  345.     { "", 0, 0 }
  346. };
  347. CAPDEF SSBCapsDefs[] =
  348. {
  349.     GEN_BLTCAPS(dwSSBCaps)
  350. //  GEN_BLTCAPS2(dwSSBCaps2)
  351.     { "", 0, 0 }
  352. };
  353. CAPDEF NLVBCapsDefs[] =
  354. {
  355.     GEN_BLTCAPS(dwNLVBCaps)
  356.     GEN_BLTCAPS2(dwNLVBCaps2)
  357.     { "", 0, 0 }
  358. };
  359. /****************************************************************************
  360.  ***************************************************************************/
  361. #define GEN_CKCAPS(dwCKeyCaps)                                                              
  362.     DDCAPDEF("DESTBLT",                 dwCKeyCaps, DDCKEYCAPS_DESTBLT),                  
  363.     DDCAPDEF("DESTBLTCLRSPACE",         dwCKeyCaps, DDCKEYCAPS_DESTBLTCLRSPACE),          
  364.     DDCAPDEF("DESTBLTCLRSPACEYUV",      dwCKeyCaps, DDCKEYCAPS_DESTBLTCLRSPACEYUV),       
  365.     DDCAPDEF("DESTBLTYUV",              dwCKeyCaps, DDCKEYCAPS_DESTBLTYUV),               
  366.     DDCAPDEF("DESTOVERLAY",             dwCKeyCaps, DDCKEYCAPS_DESTOVERLAY),              
  367.     DDCAPDEF("DESTOVERLAYCLRSPACE",     dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYCLRSPACE),      
  368.     DDCAPDEF("DESTOVERLAYCLRSPACEYUV",  dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV),   
  369.     DDCAPDEF("DESTOVERLAYONEACTIVE",    dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYONEACTIVE),     
  370.     DDCAPDEF("DESTOVERLAYYUV",          dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYYUV),           
  371.     DDCAPDEF("SRCBLT",                  dwCKeyCaps, DDCKEYCAPS_SRCBLT),                   
  372.     DDCAPDEF("SRCBLTCLRSPACE",          dwCKeyCaps, DDCKEYCAPS_SRCBLTCLRSPACE),           
  373.     DDCAPDEF("SRCBLTCLRSPACEYUV",       dwCKeyCaps, DDCKEYCAPS_SRCBLTCLRSPACEYUV),        
  374.     DDCAPDEF("SRCBLTYUV",               dwCKeyCaps, DDCKEYCAPS_SRCBLTYUV),                
  375.     DDCAPDEF("SRCOVERLAY",              dwCKeyCaps, DDCKEYCAPS_SRCOVERLAY),               
  376.     DDCAPDEF("SRCOVERLAYCLRSPACE",      dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYCLRSPACE),       
  377.     DDCAPDEF("SRCOVERLAYCLRSPACEYUV",   dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV),    
  378.     DDCAPDEF("SRCOVERLAYONEACTIVE",     dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYONEACTIVE),      
  379.     DDCAPDEF("SRCOVERLAYYUV",           dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYYUV),
  380. CAPDEF CKeyCapsDefs[] =
  381. {
  382.     GEN_CKCAPS(dwCKeyCaps)
  383.     { "", 0, 0}
  384. };
  385. CAPDEF VSBCKeyCapsDefs[] =
  386. {
  387.     GEN_CKCAPS(dwVSBCKeyCaps)
  388.     { "", 0, 0}
  389. };
  390. CAPDEF SVBCKeyCapsDefs[] =
  391. {
  392.     GEN_CKCAPS(dwSVBCKeyCaps)
  393.     { "", 0, 0}
  394. };
  395. CAPDEF SSBCKeyCapsDefs[] =
  396. {
  397.     GEN_CKCAPS(dwSSBCKeyCaps)
  398.     { "", 0, 0}
  399. };
  400. CAPDEF NLVBCKeyCapsDefs[] =
  401. {
  402.     GEN_CKCAPS(dwNLVBCKeyCaps)
  403.     { "", 0, 0}
  404. };
  405. /****************************************************************************
  406.  ***************************************************************************/
  407. #define GEN_FXCAPS(dwFXCaps)                                                            
  408.     DDCAPDEF("BLTARITHSTRETCHY",          dwFXCaps, DDFXCAPS_BLTARITHSTRETCHY),         
  409.     DDCAPDEF("BLTARITHSTRETCHYN",         dwFXCaps, DDFXCAPS_BLTARITHSTRETCHYN),        
  410.     DDCAPDEF("BLTMIRRORLEFTRIGHT",        dwFXCaps, DDFXCAPS_BLTMIRRORLEFTRIGHT),       
  411.     DDCAPDEF("BLTMIRRORUPDOWN",           dwFXCaps, DDFXCAPS_BLTMIRRORUPDOWN),          
  412.     DDCAPDEF("BLTROTATION",               dwFXCaps, DDFXCAPS_BLTROTATION),              
  413.     DDCAPDEF("BLTROTATION90",             dwFXCaps, DDFXCAPS_BLTROTATION90),            
  414.     DDCAPDEF("BLTSHRINKX",                dwFXCaps, DDFXCAPS_BLTSHRINKX),               
  415.     DDCAPDEF("BLTSHRINKXN",               dwFXCaps, DDFXCAPS_BLTSHRINKXN),              
  416.     DDCAPDEF("BLTSHRINKY",                dwFXCaps, DDFXCAPS_BLTSHRINKY),               
  417.     DDCAPDEF("BLTSHRINKYN",               dwFXCaps, DDFXCAPS_BLTSHRINKYN),              
  418.     DDCAPDEF("BLTSTRETCHX",               dwFXCaps, DDFXCAPS_BLTSTRETCHX),              
  419.     DDCAPDEF("BLTSTRETCHXN",              dwFXCaps, DDFXCAPS_BLTSTRETCHXN),             
  420.     DDCAPDEF("BLTSTRETCHY",               dwFXCaps, DDFXCAPS_BLTSTRETCHY),              
  421.     DDCAPDEF("BLTSTRETCHYN",              dwFXCaps, DDFXCAPS_BLTSTRETCHYN),             
  422.     DDCAPDEF("OVERLAYARITHSTRETCHY",      dwFXCaps, DDFXCAPS_OVERLAYARITHSTRETCHY),     
  423.     DDCAPDEF("OVERLAYARITHSTRETCHYN",     dwFXCaps, DDFXCAPS_OVERLAYARITHSTRETCHYN),    
  424.     DDCAPDEF("OVERLAYSHRINKX",            dwFXCaps, DDFXCAPS_OVERLAYSHRINKX),           
  425.     DDCAPDEF("OVERLAYSHRINKXN",           dwFXCaps, DDFXCAPS_OVERLAYSHRINKXN),          
  426.     DDCAPDEF("OVERLAYSHRINKY",            dwFXCaps, DDFXCAPS_OVERLAYSHRINKY),           
  427.     DDCAPDEF("OVERLAYSHRINKYN",           dwFXCaps, DDFXCAPS_OVERLAYSHRINKYN),          
  428.     DDCAPDEF("OVERLAYSTRETCHX",           dwFXCaps, DDFXCAPS_OVERLAYSTRETCHX),          
  429.     DDCAPDEF("OVERLAYSTRETCHXN",          dwFXCaps, DDFXCAPS_OVERLAYSTRETCHXN),         
  430.     DDCAPDEF("OVERLAYSTRETCHY",           dwFXCaps, DDFXCAPS_OVERLAYSTRETCHY),          
  431.     DDCAPDEF("OVERLAYSTRETCHYN",          dwFXCaps, DDFXCAPS_OVERLAYSTRETCHYN),         
  432.     DDCAPDEF("OVERLAYMIRRORLEFTRIGHT",    dwFXCaps, DDFXCAPS_OVERLAYMIRRORLEFTRIGHT),   
  433.     DDCAPDEF("OVERLAYMIRRORUPDOWN",       dwFXCaps, DDFXCAPS_OVERLAYMIRRORUPDOWN),
  434. CAPDEF FXCapsDefs[] =
  435. {
  436.     GEN_FXCAPS(dwFXCaps)
  437.     { "", 0, 0}
  438. };
  439. CAPDEF VSBFXCapsDefs[] =
  440. {
  441.     GEN_FXCAPS(dwVSBFXCaps)
  442.     { "", 0, 0}
  443. };
  444. CAPDEF SVBFXCapsDefs[] =
  445. {
  446.     GEN_FXCAPS(dwSVBFXCaps)
  447.     { "", 0, 0}
  448. };
  449. CAPDEF SSBFXCapsDefs[] =
  450. {
  451.     GEN_FXCAPS(dwSSBFXCaps)
  452.     { "", 0, 0}
  453. };
  454. CAPDEF NLVBFXCapsDefs[] =
  455. {
  456.     GEN_FXCAPS(dwNLVBFXCaps)
  457.     { "", 0, 0}
  458. };
  459. /****************************************************************************
  460.  ***************************************************************************/
  461. CAPDEF PalCapsDefs[] =
  462. {
  463.     DDCAPDEF("4BIT",              dwPalCaps, DDPCAPS_4BIT),
  464.     DDCAPDEF("8BITENTRIES",       dwPalCaps, DDPCAPS_8BITENTRIES),
  465.     DDCAPDEF("8BIT",              dwPalCaps, DDPCAPS_8BIT),
  466.     DDCAPDEF("INITIALIZE",        dwPalCaps, DDPCAPS_INITIALIZE),
  467.     DDCAPDEF("PRIMARYSURFACE",    dwPalCaps, DDPCAPS_PRIMARYSURFACE),
  468.     DDCAPDEF("PRIMARYSURFACELEFT",dwPalCaps, DDPCAPS_PRIMARYSURFACELEFT),
  469.     DDCAPDEF("VSYNC",             dwPalCaps, DDPCAPS_VSYNC),
  470.     { "", 0, 0}
  471. };
  472. /****************************************************************************
  473.  ***************************************************************************/
  474. CAPDEF SurfCapsDefs[] =
  475. {
  476.     DDCAPDEF( "3DDEVICE",             ddsCaps.dwCaps, DDSCAPS_3DDEVICE),
  477.     DDCAPDEF( "ALPHA",                ddsCaps.dwCaps, DDSCAPS_ALPHA),
  478.     DDCAPDEF( "BACKBUFFER",           ddsCaps.dwCaps, DDSCAPS_BACKBUFFER),
  479.     DDCAPDEF( "COMPLEX",              ddsCaps.dwCaps, DDSCAPS_COMPLEX),
  480.     DDCAPDEF( "FLIP",                 ddsCaps.dwCaps, DDSCAPS_FLIP),
  481.     DDCAPDEF( "FRONTBUFFER",          ddsCaps.dwCaps, DDSCAPS_FRONTBUFFER),
  482.     DDCAPDEF( "MIPMAP",               ddsCaps.dwCaps, DDSCAPS_MIPMAP),
  483.     DDCAPDEF( "OFFSCREENPLAIN",       ddsCaps.dwCaps, DDSCAPS_OFFSCREENPLAIN),
  484.     DDCAPDEF( "OVERLAY",              ddsCaps.dwCaps, DDSCAPS_OVERLAY),
  485.     DDCAPDEF( "PALETTE",              ddsCaps.dwCaps, DDSCAPS_PALETTE),
  486.     DDCAPDEF( "PRIMARYSURFACE",       ddsCaps.dwCaps, DDSCAPS_PRIMARYSURFACE),
  487.     DDCAPDEF( "PRIMARYSURFACELEFT",   ddsCaps.dwCaps, DDSCAPS_PRIMARYSURFACELEFT),
  488.     DDCAPDEF( "SYSTEMMEMORY",         ddsCaps.dwCaps, DDSCAPS_SYSTEMMEMORY),
  489.     DDCAPDEF( "TEXTURE",              ddsCaps.dwCaps, DDSCAPS_TEXTURE),
  490.     DDCAPDEF( "VIDEOMEMORY",          ddsCaps.dwCaps, DDSCAPS_VIDEOMEMORY),
  491.     DDCAPDEF( "VISIBLE",              ddsCaps.dwCaps, DDSCAPS_VISIBLE),
  492.     DDCAPDEF( "WRITEONLY",            ddsCaps.dwCaps, DDSCAPS_WRITEONLY),
  493.     DDCAPDEF( "ZBUFFER",              ddsCaps.dwCaps, DDSCAPS_ZBUFFER),
  494.     DDCAPDEF( "OWNDC",                ddsCaps.dwCaps, DDSCAPS_OWNDC),
  495.     DDCAPDEF( "LIVEVIDEO",            ddsCaps.dwCaps, DDSCAPS_LIVEVIDEO),
  496.     DDCAPDEF( "HWCODEC",              ddsCaps.dwCaps, DDSCAPS_HWCODEC),
  497.     DDCAPDEF( "MODEX",                ddsCaps.dwCaps, DDSCAPS_MODEX),
  498.     { "", 0, 0}
  499. };
  500. /****************************************************************************
  501.  ***************************************************************************/
  502. CAPDEF SVisionCapsDefs[] =
  503. {
  504.     DDCAPDEF( "ENIGMA",  dwSVCaps, DDSVCAPS_ENIGMA),
  505.     DDCAPDEF( "FLICKER", dwSVCaps, DDSVCAPS_FLICKER),
  506.     DDCAPDEF( "REDBLUE", dwSVCaps, DDSVCAPS_REDBLUE),
  507.     DDCAPDEF( "SPLIT",   dwSVCaps, DDSVCAPS_SPLIT),
  508.     { "", 0, 0}
  509. };
  510. /****************************************************************************
  511.  ***************************************************************************/
  512. #define GEN_ROPS(dwRops)
  513.     ROPDEF("SRCCOPY",    dwRops, SRCCOPY),      
  514.     ROPDEF("SRCPAINT",   dwRops, SRCPAINT),     
  515.     ROPDEF("SRCAND",     dwRops, SRCAND),       
  516.     ROPDEF("SRCINVERT",  dwRops, SRCINVERT),    
  517.     ROPDEF("SRCERASE",   dwRops, SRCERASE),     
  518.     ROPDEF("NOTSRCCOPY", dwRops, NOTSRCCOPY),   
  519.     ROPDEF("NOTSRCERASE",dwRops, NOTSRCERASE),  
  520.     ROPDEF("MERGECOPY",  dwRops, MERGECOPY),    
  521.     ROPDEF("MERGEPAINT", dwRops, MERGEPAINT),   
  522.     ROPDEF("PATCOPY",    dwRops, PATCOPY),      
  523.     ROPDEF("PATPAINT",   dwRops, PATPAINT),     
  524.     ROPDEF("PATINVERT",  dwRops, PATINVERT),    
  525.     ROPDEF("DSTINVERT",  dwRops, DSTINVERT),    
  526.     ROPDEF("BLACKNESS",  dwRops, BLACKNESS),    
  527.     ROPDEF("WHITENESS",  dwRops, WHITENESS),
  528. CAPDEF ROPCapsDefs[] =
  529. {
  530.     GEN_ROPS(dwRops)
  531.     {"", 0, 0}
  532. };
  533. CAPDEF VSBROPCapsDefs[] =
  534. {
  535.     GEN_ROPS(dwVSBRops)
  536.     {"", 0, 0}
  537. };
  538. CAPDEF SVBROPCapsDefs[] =
  539. {
  540.     GEN_ROPS(dwSVBRops)
  541.     {"", 0, 0}
  542. };
  543. CAPDEF SSBROPCapsDefs[] =
  544. {
  545.     GEN_ROPS(dwSSBRops)
  546.     {"", 0, 0}
  547. };
  548. CAPDEF NLVBROPCapsDefs[] =
  549. {
  550.     GEN_ROPS(dwNLVBRops)
  551.     {"", 0, 0}
  552. };
  553. /****************************************************************************
  554.  ***************************************************************************/
  555. CAPDEFS DDCapDefs[] =
  556. {
  557.     {"",                    NULL,               (LPARAM)0,                  NULL},
  558.     {"Memory",              VidMem,             (LPARAM)0,                  VidMemPrint},
  559.     {"+Caps",               NULL,               (LPARAM)0,                  NULL},
  560.     {"General",             DDAddCaps,          (LPARAM)GenCaps,           DDPrintCaps},
  561.     {"Palette Caps",        DDAddCaps,          (LPARAM)PalCapsDefs,        DDPrintCaps},
  562.     {"Surface Caps",        DDAddCaps,          (LPARAM)SurfCapsDefs,       DDPrintCaps},
  563.     {"Stereo Vision Caps",  DDAddCaps,          (LPARAM)SVisionCapsDefs,    DDPrintCaps},
  564.     {"+Video - Video",      NULL,               (LPARAM)0,                  NULL},
  565.     {"General",             DDAddCaps,          (LPARAM)CapsDefs,           DDPrintCaps},
  566.     {"Color Key",           DDAddCaps,          (LPARAM)CKeyCapsDefs,       DDPrintCaps},
  567.     {"FX",                  DDAddCaps,          (LPARAM)FXCapsDefs,         DDPrintCaps},
  568.     {"ROPS",                DDAddCaps,          (LPARAM)ROPCapsDefs,        DDPrintCaps},
  569.     {"-",                   NULL,               (LPARAM)0,                  NULL},
  570.     {"+System - Video",     NULL,               (LPARAM)0,                  NULL},
  571.     {"General",             DDAddCaps,          (LPARAM)SVBCapsDefs,        DDPrintCaps},
  572.     {"Color Key",           DDAddCaps,          (LPARAM)SVBCKeyCapsDefs,    DDPrintCaps},
  573.     {"FX",                  DDAddCaps,          (LPARAM)SVBFXCapsDefs,      DDPrintCaps},
  574.     {"ROPS",                DDAddCaps,          (LPARAM)SVBROPCapsDefs,     DDPrintCaps},
  575.     {"-",                   NULL,               (LPARAM)0,                  NULL},
  576.     {"+Video - System",     NULL,               (LPARAM)0,                  NULL},
  577.     {"General",             DDAddCaps,          (LPARAM)VSBCapsDefs,        DDPrintCaps},
  578.     {"Color Key",           DDAddCaps,          (LPARAM)SSBCKeyCapsDefs,    DDPrintCaps},
  579.     {"FX",                  DDAddCaps,          (LPARAM)SSBFXCapsDefs,      DDPrintCaps},
  580.     {"ROPS",                DDAddCaps,          (LPARAM)VSBROPCapsDefs,     DDPrintCaps},
  581.     {"-",                   NULL,               (LPARAM)0,                  NULL},
  582.     {"+System - System",    NULL,               (LPARAM)0,                  NULL},
  583.     {"General",             DDAddCaps,          (LPARAM)SSBCapsDefs,        DDPrintCaps},
  584.     {"Color Key",           DDAddCaps,          (LPARAM)SSBCKeyCapsDefs,    DDPrintCaps},
  585.     {"FX",                  DDAddCaps,          (LPARAM)SSBFXCapsDefs,      DDPrintCaps},
  586.     {"ROPS",                DDAddCaps,          (LPARAM)SSBROPCapsDefs,     DDPrintCaps},
  587.     {"-",                   NULL,               (LPARAM)0,                  NULL},
  588.     {"+NonLocal - Video",   NULL,               (LPARAM)0,                  NULL},
  589.     {"General",             DDAddCaps,          (LPARAM)NLVBCapsDefs,       DDPrintCaps},
  590.     {"Color Key",           DDAddCaps,          (LPARAM)NLVBCKeyCapsDefs,   DDPrintCaps},
  591.     {"FX",                  DDAddCaps,          (LPARAM)NLVBFXCapsDefs,     DDPrintCaps},
  592.     {"ROPS",                DDAddCaps,          (LPARAM)NLVBROPCapsDefs,    DDPrintCaps},
  593.     {"-",                   NULL,               (LPARAM)0,                  NULL},
  594.     {"-",                   NULL,               (LPARAM)0,                  NULL},
  595.     {"Video Modes",         DDAddVideoModes,    (LPARAM)0,                  DDPrintVideoModes},
  596.     {"FourCC Formats",      DDFourCCFormat,     (LPARAM)0,                  DDPrintFourCCFormat},
  597.     {"Other",               DDAddCaps,          (LPARAM)OtherInfoDefs,      DDPrintCaps},
  598.     { NULL, 0, 0, NULL}
  599. };
  600. /****************************************************************************
  601.  ***************************************************************************/
  602. CAPDEF ValidFlags[] =
  603. {
  604.     D3CAPDEF("COLORMODEL",            dwFlags, D3DDD_COLORMODEL),           
  605.     D3CAPDEF("DEVCAPS",               dwFlags, D3DDD_DEVCAPS),              
  606.     D3CAPDEF("TRANSFORMCAPS",         dwFlags, D3DDD_TRANSFORMCAPS),        
  607.     D3CAPDEF("LIGHTINGCAPS",          dwFlags, D3DDD_LIGHTINGCAPS),         
  608.     D3CAPDEF("BCLIPPING",             dwFlags, D3DDD_BCLIPPING),            
  609.     D3CAPDEF("LINECAPS",              dwFlags, D3DDD_LINECAPS),             
  610.     D3CAPDEF("TRICAPS",               dwFlags, D3DDD_TRICAPS),              
  611.     D3CAPDEF("DEVICERENDERBITDEPTH",  dwFlags, D3DDD_DEVICERENDERBITDEPTH), 
  612.     D3CAPDEF("DEVICEZBUFFERBITDEPTH", dwFlags, D3DDD_DEVICEZBUFFERBITDEPTH),
  613.     D3CAPDEF("MAXBUFFERSIZE",         dwFlags, D3DDD_MAXBUFFERSIZE),        
  614.     D3CAPDEF("MAXVERTEXCOUNT",        dwFlags, D3DDD_MAXVERTEXCOUNT),       
  615.     {"",0,0}
  616. };
  617. /****************************************************************************
  618.  ***************************************************************************/
  619. CAPDEF ColorModel[] =
  620. {
  621.     D3CAPDEF("D3DCOLOR_MONO",           dcmColorModel, D3DCOLOR_MONO),
  622.     D3CAPDEF("D3DCOLOR_RGB",            dcmColorModel, D3DCOLOR_RGB),
  623.     {"",0,0}
  624. };
  625. /****************************************************************************
  626.  ***************************************************************************/
  627. CAPDEF DevCaps[] =
  628. {
  629.     D3CAPDEF("SORTINCREASINGZ",             dwDevCaps, D3DDEVCAPS_SORTINCREASINGZ),
  630.     D3CAPDEF("SORTDECREASINGZ",             dwDevCaps, D3DDEVCAPS_SORTDECREASINGZ),
  631.     D3CAPDEF("SORTEXACT",                   dwDevCaps, D3DDEVCAPS_SORTEXACT),
  632.     D3CAPDEF("EXECUTESYSTEMMEMORY",         dwDevCaps, D3DDEVCAPS_EXECUTESYSTEMMEMORY),
  633.     D3CAPDEF("EXECUTEVIDEOMEMORY",          dwDevCaps, D3DDEVCAPS_EXECUTEVIDEOMEMORY),
  634.     D3CAPDEF("TLVERTEXSYSTEMEMORY",         dwDevCaps, D3DDEVCAPS_TLVERTEXSYSTEMMEMORY),
  635.     D3CAPDEF("TLVERTEXVIDEOMEMORY",         dwDevCaps, D3DDEVCAPS_TLVERTEXVIDEOMEMORY),
  636.     D3CAPDEF("TEXTURESYSTEMMEMORY",         dwDevCaps, D3DDEVCAPS_TEXTURESYSTEMMEMORY),
  637.     D3CAPDEF("TEXTUREVIDEOMEMORY",          dwDevCaps, D3DDEVCAPS_TEXTUREVIDEOMEMORY),
  638.     D3CAPDEF("FLOATTLVERTEX"              , dwDevCaps, D3DDEVCAPS_FLOATTLVERTEX),
  639.     D3CAPDEF("DRAWPRIMTLVERTEX"           , dwDevCaps, D3DDEVCAPS_DRAWPRIMTLVERTEX),
  640.     D3CAPDEF("CANRENDERAFTERFLIP"         , dwDevCaps, D3DDEVCAPS_CANRENDERAFTERFLIP),
  641.     D3CAPDEF("TEXTURENONLOCALVIDMEM" , dwDevCaps, D3DDEVCAPS_TEXTURENONLOCALVIDMEM),
  642.     {"",0,0}
  643. };
  644. /****************************************************************************
  645.  ***************************************************************************/
  646. CAPDEF TransformCaps[] =
  647. {
  648.     D3CAPDEF("CLIP",  dtcTransformCaps.dwCaps, D3DTRANSFORMCAPS_CLIP),  
  649.     {"",0,0}
  650. };
  651. /****************************************************************************
  652.  ***************************************************************************/
  653. CAPDEF LightingCaps[] =
  654. {
  655.     D3CAPDEF("D3DLIGHTINGMODEL_RGB",       dlcLightingCaps.dwLightingModel, D3DLIGHTINGMODEL_RGB),      
  656.     D3CAPDEF("D3DLIGHTINGMODEL_MONO",      dlcLightingCaps.dwLightingModel, D3DLIGHTINGMODEL_MONO),     
  657.     D3CAPDEF("D3DLIGHTCAPS_POINT",         dlcLightingCaps.dwCaps,          D3DLIGHTCAPS_POINT),        
  658.     D3CAPDEF("D3DLIGHTCAPS_SPOT",          dlcLightingCaps.dwCaps,          D3DLIGHTCAPS_SPOT),         
  659.     D3CAPDEF("D3DLIGHTCAPS_DIRECTIONAL",   dlcLightingCaps.dwCaps,          D3DLIGHTCAPS_DIRECTIONAL),  
  660.     D3CAPDEF("D3DLIGHTCAPS_PARALLELPOINT", dlcLightingCaps.dwCaps,          D3DLIGHTCAPS_PARALLELPOINT),
  661.     D3VALDEF("dwNumLights",                dlcLightingCaps.dwNumLights),   
  662.     {"",0,0}
  663. };
  664. /****************************************************************************
  665.  ***************************************************************************/
  666. CAPDEF BClipping[] =
  667. {
  668.     D3CAPDEF("bClipping", bClipping, TRUE),
  669.     {"",0,0}
  670. };
  671. /****************************************************************************
  672.  ***************************************************************************/
  673. CAPDEF TriMisc[] =
  674. {
  675.     D3CAPDEF("MASKPLANES",            dpcTriCaps.dwMiscCaps,           D3DPMISCCAPS_MASKPLANES),
  676.     D3CAPDEF("MASKZ",                 dpcTriCaps.dwMiscCaps,           D3DPMISCCAPS_MASKZ),
  677.     D3CAPDEF("LINEPATTERNREP",        dpcTriCaps.dwMiscCaps,           D3DPMISCCAPS_LINEPATTERNREP),
  678.     D3CAPDEF("CONFORMANT",            dpcTriCaps.dwMiscCaps,           D3DPMISCCAPS_CONFORMANT),
  679.     D3CAPDEF("CULLNONE",              dpcTriCaps.dwMiscCaps,           D3DPMISCCAPS_CULLNONE),
  680.     D3CAPDEF("CULLCW",                dpcTriCaps.dwMiscCaps,           D3DPMISCCAPS_CULLCW),
  681.     D3CAPDEF("CULLCCW",               dpcTriCaps.dwMiscCaps,           D3DPMISCCAPS_CULLCCW),
  682.     D3CAPDEF("DITHER",              dpcTriCaps.dwRasterCaps,         D3DPRASTERCAPS_DITHER),
  683.     D3CAPDEF("ROP2",                dpcTriCaps.dwRasterCaps,         D3DPRASTERCAPS_ROP2),
  684.     D3CAPDEF("XOR",                 dpcTriCaps.dwRasterCaps,         D3DPRASTERCAPS_XOR),
  685.     D3CAPDEF("PAT",                 dpcTriCaps.dwRasterCaps,         D3DPRASTERCAPS_PAT),
  686.     D3CAPDEF("ZTEST",               dpcTriCaps.dwRasterCaps,         D3DPRASTERCAPS_ZTEST),
  687.     D3CAPDEF("SUBPIXEL",            dpcTriCaps.dwRasterCaps,         D3DPRASTERCAPS_SUBPIXEL),
  688.     D3CAPDEF("SUBPIXELX",           dpcTriCaps.dwRasterCaps,         D3DPRASTERCAPS_SUBPIXELX),
  689.     D3CAPDEF("FOGVERTEX",           dpcTriCaps.dwRasterCaps,         D3DPRASTERCAPS_FOGVERTEX),
  690.     D3CAPDEF("FOGTABLE",            dpcTriCaps.dwRasterCaps,         D3DPRASTERCAPS_FOGTABLE),
  691.     {"",0,0}
  692. };
  693. /****************************************************************************
  694.  ***************************************************************************/
  695. CAPDEF TriFog[] =
  696. {
  697.     D3CAPDEF("FOGVERTEX",       dpcTriCaps.dwRasterCaps,         D3DPRASTERCAPS_FOGVERTEX),
  698.     D3CAPDEF("FOGTABLE",        dpcTriCaps.dwRasterCaps,         D3DPRASTERCAPS_FOGTABLE),
  699.     D3CAPDEF("FOG FLAT",        dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_FOGFLAT             ),
  700.     D3CAPDEF("FOG GOURAUD",     dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_FOGGOURAUD          ),
  701.     D3CAPDEF("FOG PHONG",       dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_FOGPHONG            ),
  702.     {"",0,0}
  703. };
  704. /****************************************************************************
  705.  ***************************************************************************/
  706. CAPDEF TriCull[] =
  707. {
  708.     D3CAPDEF("CULL NONE",           dpcTriCaps.dwMiscCaps,           D3DPMISCCAPS_CULLNONE),
  709.     D3CAPDEF("CULL CW",             dpcTriCaps.dwMiscCaps,           D3DPMISCCAPS_CULLCW),
  710.     D3CAPDEF("CULL CCW",            dpcTriCaps.dwMiscCaps,           D3DPMISCCAPS_CULLCCW),
  711.     {"",0,0}
  712. };
  713. /****************************************************************************
  714.  ***************************************************************************/
  715. CAPDEF TriTextureBlend[] =
  716. {
  717.     D3CAPDEF("DECAL",           dpcTriCaps.dwTextureBlendCaps,   D3DPTBLENDCAPS_DECAL              ),
  718.     D3CAPDEF("MODULATE",        dpcTriCaps.dwTextureBlendCaps,   D3DPTBLENDCAPS_MODULATE           ),
  719.     D3CAPDEF("DECALALPHA",      dpcTriCaps.dwTextureBlendCaps,   D3DPTBLENDCAPS_DECALALPHA         ),
  720.     D3CAPDEF("MODULATEALPHA",   dpcTriCaps.dwTextureBlendCaps,   D3DPTBLENDCAPS_MODULATEALPHA      ),
  721.     D3CAPDEF("DECALMASK",       dpcTriCaps.dwTextureBlendCaps,   D3DPTBLENDCAPS_DECALMASK          ),
  722.     D3CAPDEF("MODULATEMASK",    dpcTriCaps.dwTextureBlendCaps,   D3DPTBLENDCAPS_MODULATEMASK       ),
  723.     D3CAPDEF("COPY",            dpcTriCaps.dwTextureBlendCaps,   D3DPTBLENDCAPS_COPY               ),
  724.     {"",0,0}
  725. };
  726. /****************************************************************************
  727.  ***************************************************************************/
  728. CAPDEF TriTextureFilter[] =
  729. {
  730.     D3CAPDEF("NEAREST",         dpcTriCaps.dwTextureFilterCaps,  D3DPTFILTERCAPS_NEAREST           ),
  731.     D3CAPDEF("LINEAR",          dpcTriCaps.dwTextureFilterCaps,  D3DPTFILTERCAPS_LINEAR            ),
  732.     D3CAPDEF("MIPNEAREST",      dpcTriCaps.dwTextureFilterCaps,  D3DPTFILTERCAPS_MIPNEAREST        ),
  733.     D3CAPDEF("MIPLINEAR",       dpcTriCaps.dwTextureFilterCaps,  D3DPTFILTERCAPS_MIPLINEAR         ),
  734.     D3CAPDEF("LINEARMIPNEAREST",dpcTriCaps.dwTextureFilterCaps,  D3DPTFILTERCAPS_LINEARMIPNEAREST  ),
  735.     D3CAPDEF("LINEARMIPLINEAR", dpcTriCaps.dwTextureFilterCaps,  D3DPTFILTERCAPS_LINEARMIPLINEAR   ),
  736.     {"",0,0}
  737. };
  738. /****************************************************************************
  739.  ***************************************************************************/
  740. CAPDEF TriTextureCaps[] =
  741. {
  742.     D3CAPDEF("PERSPECTIVE",     dpcTriCaps.dwTextureCaps,        D3DPTEXTURECAPS_PERSPECTIVE       ),
  743.     D3CAPDEF("POW2",            dpcTriCaps.dwTextureCaps,        D3DPTEXTURECAPS_POW2              ),
  744.     D3CAPDEF("ALPHA",           dpcTriCaps.dwTextureCaps,        D3DPTEXTURECAPS_ALPHA             ),
  745.     D3CAPDEF("TRANSPARENCY",    dpcTriCaps.dwTextureCaps,        D3DPTEXTURECAPS_TRANSPARENCY      ),
  746.     D3CAPDEF("BORDER",          dpcTriCaps.dwTextureCaps,        D3DPTEXTURECAPS_BORDER            ),
  747.     D3CAPDEF("SQUAREONLY",      dpcTriCaps.dwTextureCaps,        D3DPTEXTURECAPS_SQUAREONLY        ),
  748.     
  749.     D3CAPDEF("WRAP",            dpcTriCaps.dwTextureAddressCaps, D3DPTADDRESSCAPS_WRAP             ),
  750.     D3CAPDEF("MIRROR",          dpcTriCaps.dwTextureAddressCaps, D3DPTADDRESSCAPS_MIRROR           ),
  751.     D3CAPDEF("CLAMP",           dpcTriCaps.dwTextureAddressCaps, D3DPTADDRESSCAPS_CLAMP            ),
  752.     D3CAPDEF("BORDER",          dpcTriCaps.dwTextureAddressCaps, D3DPTADDRESSCAPS_BORDER           ),
  753.     D3CAPDEF("INDEPENDENTUV",   dpcTriCaps.dwTextureAddressCaps, D3DPTADDRESSCAPS_INDEPENDENTUV    ),
  754.     {"",0,0}
  755. };
  756. /****************************************************************************
  757.  ***************************************************************************/
  758. CAPDEF TriZCmpCaps[] =
  759. {
  760.     D3CAPDEF("NEVER",               dpcTriCaps.dwZCmpCaps,           D3DPCMPCAPS_NEVER                 ),
  761.     D3CAPDEF("LESS",                dpcTriCaps.dwZCmpCaps,           D3DPCMPCAPS_LESS                  ),
  762.     D3CAPDEF("EQUAL",               dpcTriCaps.dwZCmpCaps,           D3DPCMPCAPS_EQUAL                 ),
  763.     D3CAPDEF("LESSEQUAL",           dpcTriCaps.dwZCmpCaps,           D3DPCMPCAPS_LESSEQUAL             ),
  764.     D3CAPDEF("GREATER",             dpcTriCaps.dwZCmpCaps,           D3DPCMPCAPS_GREATER               ),
  765.     D3CAPDEF("NOTEQUAL",            dpcTriCaps.dwZCmpCaps,           D3DPCMPCAPS_NOTEQUAL              ),
  766.     D3CAPDEF("GREATEREQUAL",        dpcTriCaps.dwZCmpCaps,           D3DPCMPCAPS_GREATEREQUAL          ),
  767.     D3CAPDEF("ALWAYS",              dpcTriCaps.dwZCmpCaps,           D3DPCMPCAPS_ALWAYS                ),
  768.     {"",0,0}
  769. };
  770. /****************************************************************************
  771.  ***************************************************************************/
  772. CAPDEF TriACmpCaps[] =
  773. {
  774.     D3CAPDEF("NEVER",                  dpcTriCaps.dwAlphaCmpCaps,       D3DPCMPCAPS_NEVER                 ),
  775.     D3CAPDEF("LESS",                   dpcTriCaps.dwAlphaCmpCaps,       D3DPCMPCAPS_LESS                  ),
  776.     D3CAPDEF("EQUAL",                  dpcTriCaps.dwAlphaCmpCaps,       D3DPCMPCAPS_EQUAL                 ),
  777.     D3CAPDEF("LESSEQUAL",              dpcTriCaps.dwAlphaCmpCaps,       D3DPCMPCAPS_LESSEQUAL             ),
  778.     D3CAPDEF("GREATER",                dpcTriCaps.dwAlphaCmpCaps,       D3DPCMPCAPS_GREATER               ),
  779.     D3CAPDEF("NOTEQUAL",               dpcTriCaps.dwAlphaCmpCaps,       D3DPCMPCAPS_NOTEQUAL              ),
  780.     D3CAPDEF("GREATEREQUAL",           dpcTriCaps.dwAlphaCmpCaps,       D3DPCMPCAPS_GREATEREQUAL          ),
  781.     D3CAPDEF("ALWAYS",                 dpcTriCaps.dwAlphaCmpCaps,       D3DPCMPCAPS_ALWAYS                ),
  782.     {"",0,0}
  783. };
  784. /****************************************************************************
  785.  ***************************************************************************/
  786. CAPDEF TriSrcBlendCaps[] =
  787. {
  788.     D3CAPDEF("ZERO",                 dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_ZERO                ),
  789.     D3CAPDEF("ONE",                  dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_ONE                 ),
  790.     D3CAPDEF("SRCCOLOR",             dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_SRCCOLOR            ),
  791.     D3CAPDEF("INVSRCCOLOR",          dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_INVSRCCOLOR         ),
  792.     D3CAPDEF("SRCALPHA",             dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_SRCALPHA            ),
  793.     D3CAPDEF("INVSRCALPHA",          dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_INVSRCALPHA         ),
  794.     D3CAPDEF("DESTALPHA",            dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_DESTALPHA           ),
  795.     D3CAPDEF("INVDESTALPHA",         dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_INVDESTALPHA        ),
  796.     D3CAPDEF("DESTCOLOR",            dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_DESTCOLOR           ),
  797.     D3CAPDEF("INVDESTCOLOR",         dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_INVDESTCOLOR        ),
  798.     D3CAPDEF("SRCALPHASAT",          dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_SRCALPHASAT         ),
  799.     D3CAPDEF("BOTHSRCALPHA",         dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_BOTHSRCALPHA        ),
  800.     D3CAPDEF("BOTHINVSRCALPHA",      dpcTriCaps.dwSrcBlendCaps,       D3DPBLENDCAPS_BOTHINVSRCALPHA     ),
  801.     {"",0,0}
  802. };
  803.     
  804. /****************************************************************************
  805.  ***************************************************************************/
  806. CAPDEF TriDestBlendCaps[] =
  807. {
  808.     D3CAPDEF("ZERO",                 dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_ZERO                ),
  809.     D3CAPDEF("ONE",                  dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_ONE                 ),
  810.     D3CAPDEF("SRCCOLOR",             dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_SRCCOLOR            ),
  811.     D3CAPDEF("INVSRCCOLOR",          dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_INVSRCCOLOR         ),
  812.     D3CAPDEF("SRCALPHA",             dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_SRCALPHA            ),
  813.     D3CAPDEF("INVSRCALPHA",          dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_INVSRCALPHA         ),
  814.     D3CAPDEF("DESTALPHA",            dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_DESTALPHA           ),
  815.     D3CAPDEF("INVDESTALPHA",         dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_INVDESTALPHA        ),
  816.     D3CAPDEF("DESTCOLOR",            dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_DESTCOLOR           ),
  817.     D3CAPDEF("INVDESTCOLOR",         dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_INVDESTCOLOR        ),
  818.     D3CAPDEF("SRCALPHASAT",          dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_SRCALPHASAT         ),
  819.     D3CAPDEF("BOTHSRCALPHA",         dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_BOTHSRCALPHA        ),
  820.     D3CAPDEF("BOTHINVSRCALPHA",      dpcTriCaps.dwDestBlendCaps,      D3DPBLENDCAPS_BOTHINVSRCALPHA     ),
  821.     {"",0,0}
  822. };
  823.     
  824. /****************************************************************************
  825.  ***************************************************************************/
  826. CAPDEF TriShadeCaps[] =
  827. {
  828.     D3CAPDEF("COLOR FLAT MONO",        dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_COLORFLATMONO       ),
  829.     D3CAPDEF("COLOR FLAT RGB",         dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_COLORFLATRGB        ),
  830.     D3CAPDEF("COLOR GOURAUD MONO",     dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_COLORGOURAUDMONO    ),
  831.     D3CAPDEF("COLOR GOURAUD RGB",      dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_COLORGOURAUDRGB     ),
  832.     D3CAPDEF("COLOR PHONG MONO",       dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_COLORPHONGMONO      ),
  833.     D3CAPDEF("COLOR PHONG RGB",        dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_COLORPHONGRGB       ),
  834.     
  835.     D3CAPDEF("SPECULAR FLAT MONO",     dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_SPECULARFLATMONO    ),
  836.     D3CAPDEF("SPECULAR FLAT RGB",      dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_SPECULARFLATRGB     ),
  837.     D3CAPDEF("SPECULAR GOURAUD MONO",  dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_SPECULARGOURAUDMONO ),
  838.     D3CAPDEF("SPECULAR GOURAUD RGB",   dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_SPECULARGOURAUDRGB  ),
  839.     D3CAPDEF("SPECULAR PHONG MONO",    dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_SPECULARPHONGMONO   ),
  840.     D3CAPDEF("SPECULAR PHONG RGB",     dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_SPECULARPHONGRGB    ),
  841.     
  842.     D3CAPDEF("ALPHA FLAT BLEND",       dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_ALPHAFLATBLEND      ),
  843.     D3CAPDEF("ALPHA FLAT STIPPLED",    dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_ALPHAFLATSTIPPLED   ),
  844.     D3CAPDEF("ALPHA GOURAUD BLEND",    dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_ALPHAGOURAUDBLEND   ),
  845.     D3CAPDEF("ALPHA GOURAUD STIPPLED", dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED),
  846.     D3CAPDEF("ALPHA PHONG BLEND",      dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_ALPHAPHONGBLEND     ),
  847.     D3CAPDEF("ALPHA PHONG STIPPLED",   dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_ALPHAPHONGSTIPPLED  ),
  848.     
  849.     D3CAPDEF("FOG FLAT",               dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_FOGFLAT             ),
  850.     D3CAPDEF("FOG GOURAUD",            dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_FOGGOURAUD          ),
  851.     D3CAPDEF("FOG PHONG",              dpcTriCaps.dwShadeCaps,          D3DPSHADECAPS_FOGPHONG            ),
  852.     
  853.     {"",0,0}
  854. };
  855. /****************************************************************************
  856.  ***************************************************************************/
  857. CAPDEF D3dMisc[] =
  858. {
  859.     D3CAPDEF("D3DCOLOR_MONO",         dcmColorModel, D3DCOLOR_MONO),
  860.     D3CAPDEF("D3DCOLOR_RGB",          dcmColorModel, D3DCOLOR_RGB),
  861.     D3CAPDEF("bClipping", bClipping, TRUE),
  862.     D3CAPDEF("CLIP",  dtcTransformCaps.dwCaps, D3DTRANSFORMCAPS_CLIP),  
  863.     D3VALDEF("MaxBufferSize",         dwMaxBufferSize),        
  864.     D3VALDEF("MaxVertexCount",        dwMaxVertexCount),       
  865.     D3HEXDEF("DeviceRenderBitDepth",  dwDeviceRenderBitDepth),
  866.     D3CAPDEF("  8",                   dwDeviceRenderBitDepth, DDBD_8),
  867.     D3CAPDEF("  16",                  dwDeviceRenderBitDepth, DDBD_16),
  868.     D3CAPDEF("  24",                  dwDeviceRenderBitDepth, DDBD_24),
  869.     D3CAPDEF("  32",                  dwDeviceRenderBitDepth, DDBD_32),
  870.     D3HEXDEF("DeviceZBufferBitDepth", dwDeviceZBufferBitDepth),
  871.     D3CAPDEF("  8",                   dwDeviceZBufferBitDepth, DDBD_8),
  872.     D3CAPDEF("  16",                  dwDeviceZBufferBitDepth, DDBD_16),
  873.     D3CAPDEF("  24",                  dwDeviceZBufferBitDepth, DDBD_24),
  874.     D3CAPDEF("  32",                  dwDeviceZBufferBitDepth, DDBD_32),
  875.     D3VALDEF("MinTextureWidth",       dwMinTextureWidth),
  876.     D3VALDEF("MinTextureHeight",      dwMinTextureHeight),
  877.     D3VALDEF("MaxTextureWidth",       dwMaxTextureWidth),
  878.     D3VALDEF("MaxTextureHeight",      dwMaxTextureHeight),
  879.     D3VALDEF("MinStippleWidth",       dwMinStippleWidth),
  880.     D3VALDEF("MaxStippleWidth",       dwMaxStippleWidth),
  881.     D3VALDEF("MinStippleHeight",      dwMinStippleHeight),
  882.     D3VALDEF("MaxStippleHeight",      dwMaxStippleHeight),
  883.     {"",0,0}
  884. };
  885. /****************************************************************************
  886.  ***************************************************************************/
  887. CAPDEFS D3CapDefs[] =
  888. {
  889.     {"",                D3AddCaps, (LPARAM)ValidFlags,       D3PrintCaps},
  890.     {"DevCaps",         D3AddCaps, (LPARAM)DevCaps,          D3PrintCaps},
  891.     {"Misc",            D3AddCaps, (LPARAM)D3dMisc,          D3PrintCaps},
  892. //  {"ColorModel",      D3AddCaps, (LPARAM)ColorModel,       D3PrintCaps},
  893. //  {"TransformCaps",   D3AddCaps, (LPARAM)TransformCaps,    D3PrintCaps},
  894. //  {"BClipping",       D3AddCaps, (LPARAM)BClipping,        D3PrintCaps},
  895.     {"LightingCaps",    D3AddCaps, (LPARAM)LightingCaps,     D3PrintCaps},
  896.     {"+Triangle Caps",      NULL,      (LPARAM)0,                NULL},
  897.     {"Z Compare",           D3AddCaps, (LPARAM)TriZCmpCaps,      D3PrintCaps},
  898.     {"Alpha Compare",       D3AddCaps, (LPARAM)TriACmpCaps,      D3PrintCaps},
  899.     {"Misc",                D3AddCaps, (LPARAM)TriMisc,          D3PrintCaps},
  900.     {"Cull",                D3AddCaps, (LPARAM)TriCull,          D3PrintCaps},
  901.     {"Fog",                 D3AddCaps, (LPARAM)TriFog,           D3PrintCaps},
  902.     {"Texture Caps",        D3AddCaps, (LPARAM)TriTextureCaps,   D3PrintCaps},
  903.     {"Texture Filter",      D3AddCaps, (LPARAM)TriTextureFilter, D3PrintCaps},
  904.     {"Texture Blend",       D3AddCaps, (LPARAM)TriTextureBlend,  D3PrintCaps},
  905.     {"Texture Source Blend",D3AddCaps, (LPARAM)TriSrcBlendCaps,  D3PrintCaps},
  906.     {"Texture Dest Blend",  D3AddCaps, (LPARAM)TriDestBlendCaps, D3PrintCaps},
  907.     {"-",                   NULL,      (LPARAM)0,                NULL},
  908.     {"+Line Caps",          NULL,          (LPARAM)0,                NULL},
  909.     {"Z Compare",           D3AddLineCaps, (LPARAM)TriZCmpCaps,      D3PrintCaps},
  910.     {"Alpha Compare",       D3AddLineCaps, (LPARAM)TriACmpCaps,      D3PrintCaps},
  911.     {"Misc",                D3AddLineCaps, (LPARAM)TriMisc,          D3PrintCaps},
  912.     {"Cull",                D3AddLineCaps, (LPARAM)TriCull,          D3PrintCaps},
  913.     {"Fog",                 D3AddLineCaps, (LPARAM)TriFog,           D3PrintCaps},
  914.     {"Texture Caps",        D3AddLineCaps, (LPARAM)TriTextureCaps,   D3PrintCaps},
  915.     {"Texture Filter",      D3AddLineCaps, (LPARAM)TriTextureFilter, D3PrintCaps},
  916.     {"Texture Blend",       D3AddLineCaps, (LPARAM)TriTextureBlend,  D3PrintCaps},
  917.     {"Texture Source Blend",D3AddLineCaps, (LPARAM)TriSrcBlendCaps,  D3PrintCaps},
  918.     {"Texture Dest Blend",  D3AddLineCaps, (LPARAM)TriDestBlendCaps, D3PrintCaps},
  919.     {"-",                   NULL,          (LPARAM)0,                NULL},
  920.     {"Texture Formats",     D3AddTexF, (LPARAM)0,                0},
  921.     {NULL, 0, 0, NULL}
  922. };
  923. /****************************************************************************
  924.  ***************************************************************************/
  925. CAPDEF DSInfo[] =
  926. {
  927.     DSVALDEF("MinSecondarySampleRate",          dwMinSecondarySampleRate),
  928.     DSVALDEF("MaxSecondarySampleRate",          dwMaxSecondarySampleRate),
  929.     DSVALDEF("PrimaryBuffers",                  dwPrimaryBuffers),
  930.     DSVALDEF("MaxHwMixingAllBuffers",           dwMaxHwMixingAllBuffers),
  931.     DSVALDEF("MaxHwMixingStaticBuffers",        dwMaxHwMixingStaticBuffers),
  932.     DSVALDEF("MaxHwMixingStreamingBuffers",     dwMaxHwMixingStreamingBuffers),
  933.     DSVALDEF("FreeHwMixingAllBuffers",          dwFreeHwMixingAllBuffers),
  934.     DSVALDEF("FreeHwMixingStaticBuffers",       dwFreeHwMixingStaticBuffers),
  935.     DSVALDEF("FreeHwMixingStreamingBuffers",    dwFreeHwMixingStreamingBuffers),
  936.     DSVALDEF("MaxHw3DAllBuffers",               dwMaxHw3DAllBuffers),
  937.     DSVALDEF("MaxHw3DStaticBuffers",            dwMaxHw3DStaticBuffers),
  938.     DSVALDEF("MaxHw3DStreamingBuffers",         dwMaxHw3DStreamingBuffers),
  939.     DSVALDEF("FreeHw3DAllBuffers",              dwFreeHw3DAllBuffers),
  940.     DSVALDEF("FreeHw3DStaticBuffers",           dwFreeHw3DStaticBuffers),
  941.     DSVALDEF("FreeHw3DStreamingBuffers",        dwFreeHw3DStreamingBuffers),
  942.     DSVALDEF("TotalHwMemBytes",                 dwTotalHwMemBytes),
  943.     DSVALDEF("FreeHwMemBytes",                  dwFreeHwMemBytes),
  944.     DSVALDEF("MaxContigFreeHwMemBytes",         dwMaxContigFreeHwMemBytes),
  945.     DSVALDEF("UnlockTransferRateHwBuffers",     dwUnlockTransferRateHwBuffers),
  946.     DSVALDEF("PlayCpuOverheadSwBuffers",        dwPlayCpuOverheadSwBuffers),
  947.     {"", 0, 0}
  948. };
  949. /****************************************************************************
  950.  ***************************************************************************/
  951. CAPDEF DSGeneralCaps[] =
  952. {
  953.     DSCAPDEF("PRIMARYMONO",       dwFlags,    DSCAPS_PRIMARYMONO),
  954.     DSCAPDEF("PRIMARYSTEREO",     dwFlags,    DSCAPS_PRIMARYSTEREO),
  955.     DSCAPDEF("PRIMARY8BIT",       dwFlags,    DSCAPS_PRIMARY8BIT),
  956.     DSCAPDEF("PRIMARY16BIT",      dwFlags,    DSCAPS_PRIMARY16BIT),
  957.     DSCAPDEF("CONTINUOUSRATE",    dwFlags,    DSCAPS_CONTINUOUSRATE),
  958.     DSCAPDEF("EMULDRIVER",        dwFlags,    DSCAPS_EMULDRIVER),
  959.     DSCAPDEF("SECONDARYMONO",     dwFlags,    DSCAPS_SECONDARYMONO),
  960.     DSCAPDEF("SECONDARYSTEREO",   dwFlags,    DSCAPS_SECONDARYSTEREO),
  961.     DSCAPDEF("SECONDARY8BIT",     dwFlags,    DSCAPS_SECONDARY8BIT),
  962.     DSCAPDEF("SECONDARY16BIT",    dwFlags,    DSCAPS_SECONDARY16BIT),
  963.     {"", 0, 0}
  964. };
  965. /****************************************************************************
  966.  ***************************************************************************/
  967. CAPDEFS DSCapDefs[] =
  968. {
  969.     {"",                    DSAddCaps,          (LPARAM)DSInfo,         DSPrintCaps},
  970.     {"General",             DSAddCaps,          (LPARAM)DSInfo,         DSPrintCaps},
  971.     {"General Caps",        DSAddCaps,          (LPARAM)DSGeneralCaps,  DSPrintCaps},
  972.     {NULL, 0, 0, NULL}
  973. };
  974. /****************************************************************************
  975.  ***************************************************************************/
  976. CAPDEF DSCInfo[] =
  977. {
  978.     DSCVALDEF("Channels",          dwChannels),
  979.     {"", 0, 0}
  980. };
  981. /****************************************************************************
  982.  ***************************************************************************/
  983. CAPDEF DSCGeneralCaps[] =
  984. {
  985.     DSCCAPDEF("EMULDRIVER",        dwFlags,    DSCCAPS_EMULDRIVER),
  986.     DSCCAPDEF("WAVE_FORMAT_1M08",  dwFormats,  WAVE_FORMAT_1M08),
  987.     DSCCAPDEF("WAVE_FORMAT_1S08",  dwFormats,  WAVE_FORMAT_1S08),
  988.     DSCCAPDEF("WAVE_FORMAT_1M16",  dwFormats,  WAVE_FORMAT_1M16),
  989.     DSCCAPDEF("WAVE_FORMAT_1S16",  dwFormats,  WAVE_FORMAT_1S16),
  990.     DSCCAPDEF("WAVE_FORMAT_2M08",  dwFormats,  WAVE_FORMAT_2M08),
  991.     DSCCAPDEF("WAVE_FORMAT_2S08",  dwFormats,  WAVE_FORMAT_2S08),
  992.     DSCCAPDEF("WAVE_FORMAT_2M16",  dwFormats,  WAVE_FORMAT_2M16),
  993.     DSCCAPDEF("WAVE_FORMAT_2S16",  dwFormats,  WAVE_FORMAT_2S16),
  994.     DSCCAPDEF("WAVE_FORMAT_4M08",  dwFormats,  WAVE_FORMAT_4M08),
  995.     DSCCAPDEF("WAVE_FORMAT_4S08",  dwFormats,  WAVE_FORMAT_4S08),
  996.     DSCCAPDEF("WAVE_FORMAT_4M16",  dwFormats,  WAVE_FORMAT_4M16),
  997.     DSCCAPDEF("WAVE_FORMAT_4S16",  dwFormats,  WAVE_FORMAT_4S16),
  998.     {"", 0, 0}
  999. };
  1000. /****************************************************************************
  1001.  ***************************************************************************/
  1002. CAPDEFS DSCCapDefs[] =
  1003. {
  1004.     {"",                    DSCAddCaps,          (LPARAM)DSCInfo,         DSCPrintCaps},
  1005.     {"General",             DSCAddCaps,          (LPARAM)DSCInfo,         DSCPrintCaps},
  1006.     {"General Caps",        DSCAddCaps,          (LPARAM)DSCGeneralCaps,  DSCPrintCaps},
  1007.     {NULL, 0, 0, NULL}
  1008. };
  1009. /****************************************************************************
  1010.  ***************************************************************************/
  1011. CAPDEF DPInfo[] =
  1012. {
  1013.     DPVALDEF("Size",                dwSize),
  1014.     DPHEXDEF("Flags",               dwFlags),
  1015.     DPVALDEF("MaxBufferSize",       dwMaxBufferSize),
  1016.     DPVALDEF("MaxQueueSize",        dwMaxQueueSize),
  1017.     DPVALDEF("MaxPlayers",          dwMaxPlayers),
  1018.     DPVALDEF("HundredBaud",         dwHundredBaud),
  1019.     DPVALDEF("Latency",             dwLatency),
  1020.     DPVALDEF("MaxLocalPlayers",     dwMaxLocalPlayers),
  1021.     DPVALDEF("HeaderLength",        dwHeaderLength),
  1022.     DPVALDEF("Timeout",             dwTimeout),
  1023.     {"", 0, 0}
  1024. };
  1025. /****************************************************************************
  1026.  ***************************************************************************/
  1027. CAPDEFS DPCapDefs[] =
  1028. {
  1029.     {"",                    DPAddCaps, (LPARAM)DPInfo,   DPPrintCaps},
  1030.     {"Sessions",            DPAddSessions,      (LPARAM)0,            DPPrintSessions},
  1031.     {NULL, 0, 0}
  1032. };
  1033. /****************************************************************************
  1034.  ***************************************************************************/
  1035. CAPDEFS DPLocalAppsDef[] =
  1036. {
  1037.     {"LocalApplications", DPAddLocalApps, (LPARAM)0, DPPrintLocalApps},
  1038.     {NULL, 0, 0}
  1039. };
  1040. //================================================================
  1041. //  WinMain - entry point
  1042. //================================================================
  1043. int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  1044. {
  1045.     MSG msg;
  1046.     CoInitialize( NULL );
  1047.     g_hInstance = hInstance; // Store instance handle in our global variable
  1048.     g_idTimer = 0;                  //Used by DPlay
  1049.     g_lpLocalApp = NULL;    //Used by DPLay
  1050.     // Try to load the dsound.dll
  1051.     g_hDSoundLib = LoadLibrary("DSOUND.DLL");
  1052.     if (g_hDSoundLib == NULL)
  1053.     {       // couldn't load the library so put up a message and quit.
  1054.         MessageBox(g_hwndMain, "Could not load DSOUND.DLL", g_szAppName, MB_OK);
  1055.         CoUninitialize();
  1056.         return 0;       // terminate after showing the message.
  1057.     }
  1058.     //Create the initial local app list.
  1059.     DPAddLocalApps(0L, 0);
  1060.     if (InitInstance(hInstance, lpCmdLine, nCmdShow, DXView_WIDTH, DXView_HEIGHT))
  1061.     {
  1062.         while(GetMessage(&msg, NULL, 0, 0))
  1063.         {
  1064.             TranslateMessage(&msg);
  1065.             DispatchMessage(&msg);
  1066.         }
  1067.     }
  1068.     if (g_lpLocalApp)
  1069.         FreeLocalAppList();
  1070.     // Unload dsound.dll
  1071.     FreeLibrary(g_hDSoundLib);
  1072.     CoUninitialize();
  1073.     return(msg.wParam);
  1074. }
  1075. //================================================================
  1076. //  InitInstance - create main window
  1077. //================================================================
  1078. BOOL InitInstance(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow, int iWidth, int iHeight)
  1079. {
  1080.     WNDCLASS  wc;
  1081.     wc.style         = CS_HREDRAW | CS_VREDRAW; // Class style(s).
  1082.     wc.lpfnWndProc   = (WNDPROC)WndProc;        // Window Procedure
  1083.     wc.cbClsExtra    = 0;                       // No per-class extra data.
  1084.     wc.cbWndExtra    = 0;                       // No per-window extra data.
  1085.     wc.hInstance     = hInstance;               // Owner of this class
  1086.     wc.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DIRECTX)); // Icon name from .RC
  1087.     wc.hCursor       = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_SPLIT));// Cursor
  1088.     wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); // Default color
  1089.     wc.lpszMenuName  = "Menu";                   // Menu name from .RC
  1090.     wc.lpszClassName = g_szClassName;            // Name to register as
  1091.     if(!RegisterClass(&wc))
  1092.     {
  1093.         return FALSE;
  1094.     }
  1095.     // Create a main window for this application instance.
  1096.     g_hwndMain = CreateWindowEx(
  1097.         0,
  1098.         g_szClassName,   // See RegisterClass() call.
  1099.         g_szTitle,       // Text for window title bar.
  1100.         WS_OVERLAPPEDWINDOW,// Window style.
  1101.         CW_USEDEFAULT, CW_USEDEFAULT, iWidth, iHeight, // Use default positioning
  1102.         NULL,            // Overlapped windows have no parent.
  1103.         NULL,            // Use the window class menu.
  1104.         hInstance,       // This instance owns this window.
  1105.         NULL);
  1106.     // If window could not be created, return "failure"
  1107.     if (! g_hwndMain)
  1108.     {
  1109.         return(FALSE);
  1110.     }
  1111.     // Make the window visible; update its client area; and return "success"
  1112.     ShowWindow (g_hwndMain, nCmdShow); // Show the window
  1113.     return(TRUE);              // We succeeded...
  1114. }
  1115. //================================================================
  1116. //  WndProc - main window proc
  1117. //================================================================
  1118. LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  1119. {
  1120.     switch(message)
  1121.     {
  1122.         case WM_CREATE:
  1123.             return DXView_OnCreate(hwnd);
  1124.         case WM_SIZE:
  1125.             DXView_OnSize(hwnd);
  1126.             break;
  1127.         case WM_LBUTTONDOWN:
  1128.             g_bSplitMove = TRUE;
  1129.             SetCapture(hwnd);
  1130.             break;
  1131.         case WM_LBUTTONUP:
  1132.             g_bSplitMove = FALSE;
  1133.             ReleaseCapture();
  1134.             break;
  1135.         case WM_MOUSEMOVE:
  1136.             if(g_bSplitMove)
  1137.             {
  1138.                 RECT    rect;
  1139.                 // change the value from unsigned to signed
  1140.                 int     x = (int)(short)LOWORD(lParam);
  1141.                 GetClientRect(hwnd, &rect);
  1142.                 if (rect.left > x)
  1143.                 {
  1144.                     x = rect.left;
  1145.                 }
  1146.                 else if (rect.right < x)
  1147.                 {
  1148.                     x = rect.right;
  1149.                 }
  1150.                 g_xPaneSplit = (x - g_xHalfSplitWidth);
  1151.                 DXView_OnSize(hwnd);
  1152.             }
  1153.             break;
  1154.         case WM_NOTIFY:
  1155.             if (((NMHDR*)lParam)->hwndFrom == g_hwndTV)
  1156.             {
  1157.                 if (((NMHDR*)lParam)->code == TVN_SELCHANGED)
  1158.                     DXView_OnTreeSelect(g_hwndTV, (NM_TREEVIEW*)lParam);
  1159.             }
  1160.             if (((NMHDR*)lParam)->hwndFrom == g_hwndLV)
  1161.             {
  1162.                 if (((NMHDR*)lParam)->code == NM_RDBLCLK)
  1163.                     DXView_OnListViewDblClick(g_hwndLV, (NM_LISTVIEW*)lParam);
  1164.             }
  1165.             break;
  1166.        case WM_TIMER:
  1167. // refresh the session list
  1168. EnumSessions( lpDP3A );
  1169. break;
  1170.        case WM_COMMAND:  // message: command from application menu
  1171.             DXView_OnCommand(hwnd, wParam);
  1172.             break;
  1173.         case WM_CLOSE:
  1174.             DestroyWindow(hwnd);
  1175.             return 0;
  1176.         case WM_DESTROY:  // message: window being destroyed
  1177.             DXView_Cleanup();  // Free per item struct for all items
  1178.             PostQuitMessage(0);
  1179.             break;
  1180.     }
  1181.     return(DefWindowProc(hwnd, message, wParam, lParam));
  1182. }
  1183. //================================================================
  1184. //================================================================
  1185. BOOL DXView_OnCreate(HWND hwnd)
  1186. {
  1187.     HDC hDC;
  1188.     int PixelsPerInch;
  1189.     TEXTMETRIC tm;
  1190.     static TCHAR szBuf[MAX_PATH];
  1191.     hDC = GetDC(hwnd);
  1192.     PixelsPerInch = GetDeviceCaps(hDC, LOGPIXELSX);
  1193.     g_hFont = GetStockObject(ANSI_FIXED_FONT);
  1194.     SelectObject(hDC, g_hFont);
  1195.     GetTextMetrics(hDC, &tm);
  1196.     g_tmAveCharWidth = tm.tmAveCharWidth;
  1197.     ReleaseDC(hwnd, hDC);
  1198.     // Initialize global data
  1199.     g_dwViewState = IDM_VIEWAVAIL;
  1200.     g_xPaneSplit = PixelsPerInch * 12 / 4;
  1201.     g_xHalfSplitWidth = GetSystemMetrics(SM_CXSIZEFRAME) / 2;
  1202.     // Make sure that the common control library read to rock
  1203.     InitCommonControls();
  1204.     CheckMenuItem(GetMenu(hwnd), g_dwViewState, MF_BYCOMMAND | MF_CHECKED);
  1205.     // Create the list view window.
  1206.     g_hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, "",
  1207.         WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT,
  1208.         0, 0, 0, 0, hwnd, (HMENU)IDC_LV, g_hInstance, NULL);
  1209.     // create the tree view window.
  1210.     g_hwndTV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, "",
  1211.         WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES |
  1212.         TVS_HASBUTTONS | TVS_LINESATROOT,
  1213.         0, 0, 0, 0, hwnd, (HMENU)IDC_TV, g_hInstance, NULL);
  1214.     // create our image list.
  1215.     DXView_InitImageList();
  1216.     // Initialize the tree view
  1217.     DXView_FillTree(g_hwndTV);
  1218.     return(TRUE);
  1219. }
  1220. //================================================================
  1221. //================================================================
  1222. IDirectDraw * DDCreate(GUID *pid)
  1223. {
  1224.     if (lpDD && pid == ddid)
  1225.         return lpDD;
  1226.     if (lp3D)
  1227.     {
  1228.         IDirect3D2_Release(lp3D);
  1229.         lp3D = NULL;
  1230.     }
  1231.     if (lpDD)
  1232.     {
  1233.         IDirectDraw_Release(lpDD);
  1234.         lpDD = NULL;
  1235.     }
  1236.     // There is no need to create DirectDraw emulation-only just to get
  1237.     // the HEL caps.  In fact, this will fail if there is another DirectDraw
  1238.     // app running and using the hardware.
  1239.     if( pid == (GUID *)DDCREATE_EMULATIONONLY )
  1240.     {
  1241.         pid = NULL;
  1242.     }
  1243.     if (DirectDrawCreate(pid, &lpDD, NULL) == DD_OK)
  1244.     {
  1245.         IDirectDraw_QueryInterface(lpDD,&IID_IDirect3D2,&lp3D);
  1246.         ddid = pid;
  1247.         return lpDD;
  1248.     }
  1249.     if(!g_PrintToFile)
  1250.         MessageBox(g_hwndMain, "DirectDrawCreate failed.", g_szAppName, MB_OK);
  1251.     return NULL;
  1252. }
  1253. //================================================================
  1254. //================================================================
  1255. IDirectSound * DSCreate(GUID *pid)
  1256. {
  1257. PFN_DSCREATE pfn_DSCreate;
  1258.     if (lpDS && pid == dsid)
  1259.         return lpDS;
  1260.     if (lpDS)
  1261.     {
  1262.         IDirectSound_Release(lpDS);
  1263.         lpDS = NULL;
  1264.     }
  1265. // Call DirectSoundCreate.
  1266. pfn_DSCreate = (PFN_DSCREATE)GetProcAddress(g_hDSoundLib, "DirectSoundCreate");
  1267. if (pfn_DSCreate == NULL)
  1268. {
  1269.         MessageBox(g_hwndMain, "DSOUND.DLL does not implement DirectSoundCreate()", g_szAppName, MB_OK);
  1270. return NULL;
  1271. }
  1272. if ((*pfn_DSCreate)(pid, &lpDS, NULL) == DD_OK)
  1273. {
  1274. dsid = pid;
  1275. return lpDS;
  1276. }
  1277.     if(!g_PrintToFile)
  1278.         MessageBox(g_hwndMain, "DirectSoundCreate failed.", g_szAppName, MB_OK);
  1279.     return NULL;
  1280. }
  1281. //================================================================
  1282. //================================================================
  1283. IDirectSoundCapture * DSCCreate(GUID *pid)
  1284. {
  1285. PFN_DSCCREATE pfn_DSCCreate;
  1286.     if (lpDSC && pid == dsid)
  1287.         return lpDSC;
  1288.     if (lpDSC)
  1289.     {
  1290.         IDirectSoundCapture_Release(lpDSC);
  1291.         lpDSC = NULL;
  1292.     }
  1293. pfn_DSCCreate = (PFN_DSCCREATE)GetProcAddress(g_hDSoundLib, "DirectSoundCaptureCreate");
  1294. if (pfn_DSCCreate == NULL)
  1295. {
  1296.         MessageBox(g_hwndMain, "DSOUND.DLL does not implement DirectSoundCaptureCreate()", g_szAppName, MB_OK);
  1297. return NULL;
  1298. }
  1299. if ((*pfn_DSCCreate)(pid, &lpDSC, NULL) == DD_OK)
  1300. {
  1301.         dscid = pid;
  1302.         return lpDSC;
  1303. }
  1304.     if(!g_PrintToFile)
  1305.         MessageBox(g_hwndMain, "DirectSoundCaptureCreate failed.", g_szAppName, MB_OK);
  1306.     return NULL;
  1307. }
  1308. //================================================================
  1309. //================================================================
  1310. IDirectPlay3 * DPCreate(GUID *pid)
  1311. {
  1312. LPDIRECTPLAY lpDP = NULL;
  1313. HRESULT hr;
  1314.     if (lpDP3A && pid == dpid)
  1315.         return lpDP3A;
  1316.     if (lpDP3A)
  1317. {
  1318.         lpDP3A->lpVtbl->Release(lpDP3A);
  1319. lpDP3A = NULL;
  1320. }
  1321.     if (DirectPlayCreate(pid, &lpDP, NULL) == DD_OK)
  1322.     {
  1323.         hr = lpDP->lpVtbl->QueryInterface( lpDP, &IID_IDirectPlay3A, (LPVOID *) &lpDP3A );
  1324. lpDP->lpVtbl->Release(lpDP);
  1325. dpid = pid;
  1326.         return lpDP3A;
  1327.     }
  1328.     if(!g_PrintToFile)
  1329.         MessageBox(g_hwndMain, "DirectPlayCreate failed.", g_szAppName, MB_OK);
  1330.     return NULL;
  1331. }
  1332. //================================================================
  1333. //================================================================
  1334. void AddCapsToTV(HTREEITEM hRoot, CAPDEFS *pcds, LPARAM lParam1)
  1335. {
  1336.     HTREEITEM hTree;
  1337.     HTREEITEM hParent[20];
  1338.     char *name;
  1339.     int level=0;
  1340.     BOOL fRoot = TRUE; // the first one is always a root
  1341.     hParent[0] = hRoot;
  1342.     while (name = pcds->szName)
  1343.     {
  1344.         if (*name == '-')
  1345.         {
  1346.             level--;
  1347.             name++;
  1348.         }
  1349.         if (*name == '+')
  1350.         {
  1351.             fRoot = TRUE;
  1352.             name++;
  1353.         }
  1354.         if (*name)
  1355.         {
  1356.             hTree = TVAddNode(hParent[level], name, fRoot, IDI_CAPS,
  1357.                               pcds->Callback, lParam1,
  1358.                               pcds->lParam2, pcds->printCallback);
  1359.             if (fRoot)
  1360.             {
  1361.                 level++;
  1362.                 hParent[level] = hTree;
  1363.                 fRoot = FALSE;
  1364.             }
  1365.         }
  1366.         pcds++;  // Get next Cap bit definition
  1367.     }
  1368. }
  1369. //================================================================
  1370. //================================================================
  1371. char c_szYes[] = "Yes";
  1372. char c_szNo[] = "No";
  1373. char c_szCurrentMode[] = "Current Mode";
  1374. //================================================================
  1375. // AddMoreCapsToLV is like AddCapsToLV, except it doesn't add the
  1376. // column headers like AddCapsToLV does.
  1377. //================================================================
  1378. void AddMoreCapsToLV(CAPDEF *pcd, LPVOID pv)
  1379. {
  1380.     DWORD dwValue;
  1381.     while(pcd->szName && *pcd->szName)
  1382.     {
  1383.         dwValue = *(DWORD *)(((BYTE *)pv) + pcd->dwOffset);
  1384.         if (pcd->dwFlag == 0)
  1385.         {
  1386.             LVAddText(g_hwndLV, 0, "%s", pcd->szName);
  1387.             LVAddText(g_hwndLV, 1, "%d", dwValue);
  1388.         }
  1389.         else if (pcd->dwFlag == 0xFFFFFFFF)     // hex
  1390.         {
  1391.             LVAddText(g_hwndLV, 0, "%s", pcd->szName);
  1392.             LVAddText(g_hwndLV, 1, "0x%08X", dwValue);
  1393.         }
  1394.         else
  1395.         {
  1396.             if (pcd->dwFlag & dwValue)
  1397.             {
  1398.                 LVAddText(g_hwndLV, 0, pcd->szName);
  1399.                 LVAddText(g_hwndLV, 1, c_szYes);
  1400.             }
  1401.             else if (g_dwViewState == IDM_VIEWALL)
  1402.             {
  1403.                 LVAddText(g_hwndLV, 0, pcd->szName);
  1404.                 LVAddText(g_hwndLV, 1, c_szNo);
  1405.             }
  1406.         }
  1407.         pcd++;  // Get next Cap bit definition
  1408.     }
  1409. }
  1410. //================================================================
  1411. // AddColsToLV adds the column headers but no data.
  1412. //================================================================
  1413. void AddColsToLV(void)
  1414. {
  1415.     LVAddColumn(g_hwndLV, 0, "Name", 24);
  1416.     LVAddColumn(g_hwndLV, 1, "Value", 10);
  1417. }
  1418. //================================================================
  1419. //================================================================
  1420. void AddCapsToLV(CAPDEF *pcd, LPVOID pv)
  1421. {
  1422.     AddColsToLV();
  1423.     AddMoreCapsToLV(pcd, pv);
  1424. }
  1425. //================================================================
  1426. //================================================================
  1427. BOOL PrintCapsToDC(CAPDEF *pcd, LPVOID pv, PRINTCBINFO * lpInfo)
  1428. {
  1429.     DWORD dwValue;
  1430.     DWORD cchLen;
  1431.     int   xName, xVal, yLine;
  1432.     // Check Parameters
  1433.     if ((! pcd) || (!lpInfo))
  1434.         return FALSE;
  1435.     // Calculate Name and Value column x offsets
  1436.     xName   = (lpInfo->dwCurrIndent * DEF_TAB_SIZE * lpInfo->dwCharWidth);
  1437.     xVal    = xName + (32 * lpInfo->dwCharWidth);
  1438.     while (pcd->szName && *pcd->szName)
  1439.     {
  1440.         dwValue = *(DWORD *)(((BYTE *)pv) + pcd->dwOffset);
  1441.         yLine = lpInfo->dwCurrLine * lpInfo->dwLineHeight;
  1442.         if (pcd->dwFlag)
  1443.         {
  1444.             if (pcd->dwFlag & dwValue)
  1445.             {
  1446.                 // Print Name
  1447.                 cchLen = _tcslen (pcd->szName);
  1448.                 if (! PrintLine (xName, yLine, pcd->szName, cchLen, lpInfo))
  1449.                     return FALSE;
  1450.                 // Print Yes in value column
  1451.                 cchLen = _tcslen (c_szYes);
  1452.                 if (! PrintLine (xVal, yLine, c_szYes, cchLen, lpInfo))
  1453.                     return FALSE;
  1454.         
  1455.                 // Advance to next line on page
  1456.                 if (! PrintNextLine (lpInfo))
  1457.                     return FALSE;
  1458.             }
  1459.             else if (g_dwViewState == IDM_VIEWALL)
  1460.             {
  1461.                 // Print name
  1462.                 cchLen = _tcslen (pcd->szName);
  1463.                 if (! PrintLine (xName, yLine, pcd->szName, cchLen, lpInfo))
  1464.                     return FALSE;
  1465.                 // Print No in value column
  1466.                 cchLen = _tcslen (c_szNo);
  1467.                 if (! PrintLine (xVal, yLine, c_szNo, cchLen, lpInfo))
  1468.                     return FALSE;
  1469.                 // Advance to next line on page
  1470.                 if (! PrintNextLine (lpInfo))
  1471.                     return FALSE;
  1472.             }
  1473.         }
  1474.         else
  1475.         {
  1476.             char    szBuff[80];
  1477.             // Print name
  1478.             wsprintf (szBuff, pcd->szName, "test");
  1479.             cchLen = _tcslen (pcd->szName);
  1480.             if (! PrintLine (xName, yLine, szBuff, cchLen, lpInfo))
  1481.                 return FALSE;
  1482.             // Print value
  1483.             wsprintf (szBuff, "%d", dwValue);
  1484.             cchLen = _tcslen (szBuff);
  1485.             if (! PrintLine (xVal, yLine, szBuff, cchLen, lpInfo))
  1486.                 return FALSE;
  1487.             // Advance to next line on page
  1488.             if (! PrintNextLine (lpInfo))
  1489.                 return FALSE;
  1490.         }
  1491.         pcd++;  // Get next Cap bit definition
  1492.     }
  1493.     // Success
  1494.     return TRUE;
  1495. } // End PrintCapsToDC
  1496. //================================================================
  1497. //================================================================
  1498. void DDAddCaps(LPARAM lParam1, LPARAM lParam2)
  1499. {
  1500.     // lParam1 is the GUID for the driver we should open
  1501.     // lParam2 is the CAPDEF table we should use
  1502.     if (DDCreate((GUID*)lParam1))
  1503.     {
  1504.         DDCAPS ddcaps;
  1505.         ddcaps.dwSize = sizeof(ddcaps);
  1506.         if (lParam1 == DDCREATE_EMULATIONONLY)
  1507.             IDirectDraw_GetCaps(lpDD, NULL, &ddcaps);
  1508.         else
  1509.             IDirectDraw_GetCaps(lpDD, &ddcaps, NULL);
  1510.         AddCapsToLV((CAPDEF *)lParam2, (LPVOID)&ddcaps);
  1511.     }
  1512. }
  1513. //================================================================
  1514. //================================================================
  1515. BOOL DDPrintCaps(LPARAM lParam1, LPARAM lParam2, PRINTCBINFO * lpInfo)
  1516. {
  1517.     // lParam1 is the GUID for the driver we should open
  1518.     // lParam2 is the CAPDEF table we should use
  1519.     if (DDCreate((GUID*)lParam1))
  1520.     {
  1521.         DDCAPS ddcaps;
  1522.         ddcaps.dwSize = sizeof(ddcaps);
  1523.         if (lParam1 == DDCREATE_EMULATIONONLY)
  1524.             IDirectDraw_GetCaps(lpDD, NULL, &ddcaps);
  1525.         else
  1526.             IDirectDraw_GetCaps(lpDD, &ddcaps, NULL);
  1527.         // Print DirectDraw caps
  1528.         return PrintCapsToDC((CAPDEF *)lParam2, (LPVOID)&ddcaps, lpInfo);
  1529.     }
  1530.     // DDCreate failed but keep printing
  1531.     return TRUE;
  1532. }
  1533. //================================================================
  1534. //================================================================
  1535. void DSAddCaps(LPARAM lParam1, LPARAM lParam2)
  1536. {
  1537.     // lParam1 is the GUID for the driver we should open
  1538.     // lParam2 is the CAPDEF table we should use
  1539.     if (DSCreate((GUID*)lParam1))
  1540.     {
  1541.         DSCAPS dscaps;
  1542.         dscaps.dwSize = sizeof(dscaps);
  1543.         IDirectSound_GetCaps(lpDS, &dscaps);
  1544.         AddCapsToLV((CAPDEF *)lParam2, (LPVOID)&dscaps);
  1545.     }
  1546. }
  1547. //================================================================
  1548. //================================================================
  1549. BOOL DSPrintCaps(LPARAM lParam1, LPARAM lParam2, PRINTCBINFO * lpInfo)
  1550. {
  1551.     // lParam1 is the GUID for the driver we should open
  1552.     // lParam2 is the CAPDEF table we should use
  1553.     if (DSCreate((GUID*)lParam1))
  1554.     {
  1555.         DSCAPS dscaps;
  1556.         dscaps.dwSize = sizeof(dscaps);
  1557.         IDirectSound_GetCaps(lpDS, &dscaps);
  1558.         // Print DirectSound Caps
  1559.         return PrintCapsToDC((CAPDEF *)lParam2, (LPVOID)&dscaps, lpInfo);
  1560.     }
  1561.     // DSCreate failed but keep printing
  1562.     return TRUE;
  1563. }
  1564. //================================================================
  1565. //================================================================
  1566. void DSCAddCaps(LPARAM lParam1, LPARAM lParam2)
  1567. {
  1568.     // lParam1 is the GUID for the driver we should open
  1569.     // lParam2 is the CAPDEF table we should use
  1570.     if (DSCCreate((GUID*)lParam1))
  1571.     {
  1572.         DSCCAPS dsccaps;
  1573.         dsccaps.dwSize = sizeof(dsccaps);
  1574.         IDirectSoundCapture_GetCaps(lpDSC, &dsccaps);
  1575.         AddCapsToLV((CAPDEF *)lParam2, (LPVOID)&dsccaps);
  1576.     }
  1577. }
  1578. //================================================================
  1579. //================================================================
  1580. BOOL DSCPrintCaps(LPARAM lParam1, LPARAM lParam2, PRINTCBINFO * lpInfo)
  1581. {
  1582.     // lParam1 is the GUID for the driver we should open
  1583.     // lParam2 is the CAPDEF table we should use
  1584.     if (DSCCreate((GUID*)lParam1))
  1585.     {
  1586.         DSCCAPS dsccaps;
  1587.         dsccaps.dwSize = sizeof(dsccaps);
  1588.         IDirectSoundCapture_GetCaps(lpDSC, &dsccaps);
  1589.         // Print DirectSound Caps
  1590.         return PrintCapsToDC((CAPDEF *)lParam2, (LPVOID)&dsccaps, lpInfo);
  1591.     }
  1592.     // DSCCreate failed but keep printing
  1593.     return TRUE;
  1594. }