Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

410 lines
14 KiB

//----------------------------------------------------------------------------
//
// setup.acp
//
// Assembly structure offset generator.
//
// Copyright (C) Microsoft Corporation, 1997.
//
//----------------------------------------------------------------------------
#include <stdio.h>
#include <windows.h>
typedef double DOUBLE;
#include <d3dp.h>
#include <rast.h>
// #include <refrast.hpp>
#include "stp_base.h"
#define OFFSET(Struct, Field) FIELD_OFFSET(Struct, Field)
char *pSPrefix = "";
#ifdef _X86_
#define EQ(Name, Value) printf("%s EQU 0%Xh\n", Name, Value)
#define TEQ(Name, String) printf("%s EQU %s\n", Name, String)
#define TEQF(Name, Fmt, Args) printf("%s EQU " Fmt "\n", Name, Args)
#define SOFF(Struct, Field) \
printf("%s_%s EQU 0%Xh\n", pSPrefix, #Field, OFFSET(Struct, Field))
#define COMMENT(String) printf("; %s\n", String)
#define TEXTERN(Name, Type) printf("EXTERN %s:%s\n", Name, Type)
#define EXTERN(Name) TEXTERN(Name, "NEAR")
#elif _ALPHA_
#define EQ(Name, Value) printf("#define %s 0x%X\n", Name, Value)
#define TEQ(Name, String) printf("#define %s %s\n", Name, String)
#define TEQF(Name, Fmt, Args) printf("#define %s " Fmt "\n", Name, Args)
#define SOFF(Struct, Field) \
printf("#define %s_%s 0x%X\n", pSPrefix, #Field, OFFSET(Struct, Field))
#define COMMENT(String) printf("/* %s */\n", String)
#define EXTERN(Name) printf("extern %s\n", Name)
#define TEXTERN(Name, Type) printf("extern %s:%s\n", Name, Type)
#endif
#define SPRE(pPre) (pSPrefix = (pPre))
#define CSPRE(pPre) (COMMENT(pPre), SPRE(pPre))
void __cdecl main(int argc, char **argv)
{
COMMENT("------------------------------------------------------"
"----------------------");
COMMENT("");
COMMENT(" Automatically generated structure offsets.");
COMMENT(" NOTE: DO NOT EDIT BY HAND.");
COMMENT("");
COMMENT(" Copyright (C) Microsoft Corporation, 1997.");
COMMENT("");
COMMENT("------------------------------------------------------"
"----------------------");
printf("\n");
CSPRE("ATTRSET");
SOFF(ATTRSET, fZ);
SOFF(ATTRSET, fOoW);
SOFF(ATTRSET, fB);
SOFF(ATTRSET, fG);
SOFF(ATTRSET, fR);
SOFF(ATTRSET, fA);
SOFF(ATTRSET, fUoW);
SOFF(ATTRSET, fVoW);
SOFF(ATTRSET, fBS);
SOFF(ATTRSET, fGS);
SOFF(ATTRSET, fRS);
SOFF(ATTRSET, fFog);
SOFF(ATTRSET, pSurface);
SOFF(ATTRSET, pZ);
SOFF(ATTRSET, ipSurface);
SOFF(ATTRSET, ipZ);
SOFF(ATTRSET, uZ);
SOFF(ATTRSET, uB);
SOFF(ATTRSET, uG);
SOFF(ATTRSET, uR);
SOFF(ATTRSET, uA);
SOFF(ATTRSET, uBS);
SOFF(ATTRSET, uGS);
SOFF(ATTRSET, uRS);
SOFF(ATTRSET, uFog);
SOFF(ATTRSET, iZ);
SOFF(ATTRSET, iOoW);
SOFF(ATTRSET, iB);
SOFF(ATTRSET, iG);
SOFF(ATTRSET, iR);
SOFF(ATTRSET, iA);
SOFF(ATTRSET, iUoW);
SOFF(ATTRSET, iVoW);
SOFF(ATTRSET, iBS);
SOFF(ATTRSET, iGS);
SOFF(ATTRSET, iRS);
SOFF(ATTRSET, iFog);
printf("ATTRSET_iUoW1 EQU 0%Xh\n", OFFSET(ATTRSET, iUoW));
printf("ATTRSET_iVoW1 EQU 0%Xh\n", OFFSET(ATTRSET, iVoW));
printf("\n");
CSPRE("RASTSPAN");
SOFF(D3DI_RASTSPAN, uPix);
SOFF(D3DI_RASTSPAN, uX);
SOFF(D3DI_RASTSPAN, uY);
SOFF(D3DI_RASTSPAN, pSurface);
SOFF(D3DI_RASTSPAN, pZ);
SOFF(D3DI_RASTSPAN, uZ);
SOFF(D3DI_RASTSPAN, uB);
SOFF(D3DI_RASTSPAN, uG);
SOFF(D3DI_RASTSPAN, uR);
SOFF(D3DI_RASTSPAN, uA);
SOFF(D3DI_RASTSPAN, uBS);
SOFF(D3DI_RASTSPAN, uGS);
SOFF(D3DI_RASTSPAN, uRS);
SOFF(D3DI_RASTSPAN, uFog);
SOFF(D3DI_RASTSPAN, iW);
SOFF(D3DI_RASTSPAN, iOoW);
SOFF(D3DI_RASTSPAN, UVoW);
SOFF(D3DI_RASTSPAN, iLOD);
SOFF(D3DI_RASTSPAN, iDLOD);
SOFF(D3DI_RASTSPAN, iDFog);
EQ("SIZEOF_RASTSPAN", sizeof(D3DI_RASTSPAN));
printf("RASTSPAN_iUoW1 EQU 0%Xh\n", OFFSET(D3DI_RASTSPAN, UVoW));
printf("RASTSPAN_iVoW1 EQU 0%Xh\n", OFFSET(D3DI_RASTSPAN, UVoW) + sizeof(INT32));
printf("\n");
CSPRE("RASTPRIM");
SOFF(D3DI_RASTPRIM, uSpans);
SOFF(D3DI_RASTPRIM, iDZDX);
SOFF(D3DI_RASTPRIM, iDBDX);
SOFF(D3DI_RASTPRIM, iDGDX);
SOFF(D3DI_RASTPRIM, iDRDX);
SOFF(D3DI_RASTPRIM, iDADX);
SOFF(D3DI_RASTPRIM, iDBSDX);
SOFF(D3DI_RASTPRIM, iDGSDX);
SOFF(D3DI_RASTPRIM, iDRSDX);
SOFF(D3DI_RASTPRIM, DUVoWDX);
SOFF(D3DI_RASTPRIM, DUVoWDY);
SOFF(D3DI_RASTPRIM, iDOoWDX);
SOFF(D3DI_RASTPRIM, uFlags);
SOFF(D3DI_RASTPRIM, pNext);
EQ("SIZEOF_RASTPRIM", sizeof(D3DI_RASTPRIM));
printf("RASTPRIM_iDUoW1DX EQU 0%Xh\n", OFFSET(D3DI_RASTPRIM, DUVoWDX));
printf("RASTPRIM_iDVoW1DX EQU 0%Xh\n", OFFSET(D3DI_RASTPRIM, DUVoWDX) + sizeof(INT32));
printf("RASTPRIM_iDUoW1DY EQU 0%Xh\n", OFFSET(D3DI_RASTPRIM, DUVoWDY));
printf("RASTPRIM_iDVoW1DY EQU 0%Xh\n", OFFSET(D3DI_RASTPRIM, DUVoWDY) + sizeof(INT32));
EQ("D3DI_RASTPRIM_X_DEC", D3DI_RASTPRIM_X_DEC);
printf("\n");
CSPRE("RASTCTX");
SOFF(D3DI_RASTCTX, pPrim);
SOFF(D3DI_RASTCTX, SI);
SOFF(D3DI_RASTCTX, pSurfaceBits);
SOFF(D3DI_RASTCTX, iSurfaceStep);
SOFF(D3DI_RASTCTX, iSurfaceBitCount);
SOFF(D3DI_RASTCTX, iSurfaceType);
SOFF(D3DI_RASTCTX, pZBits);
SOFF(D3DI_RASTCTX, iZStride);
SOFF(D3DI_RASTCTX, iZStep);
SOFF(D3DI_RASTCTX, iZBitCount);
SOFF(D3DI_RASTCTX, pdwRenderState);
SOFF(D3DI_RASTCTX, pTexture);
SOFF(D3DI_RASTCTX, pfnRenderSpans);
SOFF(D3DI_RASTCTX, pfnBegin);
SOFF(D3DI_RASTCTX, pfnTestPassEnd);
SOFF(D3DI_RASTCTX, pfnTestFailEnd);
SOFF(D3DI_RASTCTX, pfnTexAddr);
SOFF(D3DI_RASTCTX, pfnTexRead);
SOFF(D3DI_RASTCTX, pfnTexAddrEnd);
SOFF(D3DI_RASTCTX, pfnTexBlendEnd);
SOFF(D3DI_RASTCTX, pfnColorGenEnd);
SOFF(D3DI_RASTCTX, pfnSrcBlend);
SOFF(D3DI_RASTCTX, pfnDestBlend);
SOFF(D3DI_RASTCTX, pfnBufRead);
SOFF(D3DI_RASTCTX, pfnColorBlendEnd);
SOFF(D3DI_RASTCTX, pfnAlphaTestPassEnd);
SOFF(D3DI_RASTCTX, pfnAlphaTestFailEnd);
SOFF(D3DI_RASTCTX, pfnPixelEnd);
SOFF(D3DI_RASTCTX, pfnLoopEnd);
SOFF(D3DI_RASTCTX, pfnTexBlendGetAlpha);
SOFF(D3DI_RASTCTX, pfnTexBlendOpAlpha);
SOFF(D3DI_RASTCTX, pfnTexBlendGetColor);
SOFF(D3DI_RASTCTX, pfnTexBlendOpColor);
SOFF(D3DI_RASTCTX, iZAndMask);
SOFF(D3DI_RASTCTX, iZNeg);
SOFF(D3DI_RASTCTX, iZXorMask);
SOFF(D3DI_RASTCTX, iAAndMask);
SOFF(D3DI_RASTCTX, iANeg);
SOFF(D3DI_RASTCTX, iAXorMask);
SOFF(D3DI_RASTCTX, iARef);
SOFF(D3DI_RASTCTX, iSAndMask);
SOFF(D3DI_RASTCTX, iSNeg);
SOFF(D3DI_RASTCTX, iSXorMask);
SOFF(D3DI_RASTCTX, pRampMap);
SOFF(D3DI_RASTCTX, cActTex);
SOFF(D3DI_RASTCTX, cActBldStage);
EQ("SIZEOF_PFNTEXREAD", sizeof(PFNTEXREAD));
EQ("SIZEOF_RASTCTX", sizeof(D3DI_RASTCTX));
EQ("SIZEOF_UV_UNION", sizeof(UV_UNION));
EQ("SIZEOF_INT32", sizeof(INT32));
printf("\n");
CSPRE("SPANITER");
SOFF(D3DI_SPANITER, uBB);
SOFF(D3DI_SPANITER, uBG);
SOFF(D3DI_SPANITER, uBR);
SOFF(D3DI_SPANITER, uBA);
SOFF(D3DI_SPANITER, uFogB);
SOFF(D3DI_SPANITER, uFogG);
SOFF(D3DI_SPANITER, uFogR);
SOFF(D3DI_SPANITER, uFog);
SOFF(D3DI_SPANITER, iFogBDX);
SOFF(D3DI_SPANITER, iFogGDX);
SOFF(D3DI_SPANITER, iFogRDX);
SOFF(D3DI_SPANITER, iDFog);
SOFF(D3DI_SPANITER, uZDeferred);
SOFF(D3DI_SPANITER, TexUV);
SOFF(D3DI_SPANITER, TexCol);
SOFF(D3DI_SPANITER, uDitherOffset);
SOFF(D3DI_SPANITER, iXStep);
SOFF(D3DI_SPANITER, iDW);
SOFF(D3DI_SPANITER, iSpecialW);
SOFF(D3DI_SPANITER, bStencilPass);
EQ("SIZEOF_SPANITER", sizeof(D3DI_SPANITER));
printf("SPANITER_iU1 EQU 0%Xh\n", OFFSET(D3DI_SPANITER, TexUV));
printf("SPANITER_iV1 EQU 0%Xh\n", OFFSET(D3DI_SPANITER, TexUV) + sizeof(INT32));
printf("\n");
CSPRE("SPANTEX");
SOFF(D3DI_SPANTEX, uFlags);
SOFF(D3DI_SPANTEX, Format);
SOFF(D3DI_SPANTEX, TexAddrU);
SOFF(D3DI_SPANTEX, TexAddrV);
SOFF(D3DI_SPANTEX, uMagFilter);
SOFF(D3DI_SPANTEX, uMinFilter);
SOFF(D3DI_SPANTEX, uMipFilter);
SOFF(D3DI_SPANTEX, BorderColor);
SOFF(D3DI_SPANTEX, TransparentColor);
SOFF(D3DI_SPANTEX, pBits);
SOFF(D3DI_SPANTEX, pPalette);
SOFF(D3DI_SPANTEX, cLOD);
SOFF(D3DI_SPANTEX, iSizeU);
SOFF(D3DI_SPANTEX, iSizeV);
SOFF(D3DI_SPANTEX, iShiftU);
SOFF(D3DI_SPANTEX, iShiftV);
SOFF(D3DI_SPANTEX, iShiftPitch);
SOFF(D3DI_SPANTEX, uMaskU);
SOFF(D3DI_SPANTEX, uMaskV);
SOFF(D3DI_SPANTEX, iFlipMaskU);
SOFF(D3DI_SPANTEX, iFlipMaskV);
SOFF(D3DI_SPANTEX, iClampMinU);
SOFF(D3DI_SPANTEX, iClampMinV);
SOFF(D3DI_SPANTEX, iClampMaxU);
SOFF(D3DI_SPANTEX, iClampMaxV);
SOFF(D3DI_SPANTEX, iClampEnU);
SOFF(D3DI_SPANTEX, iClampEnV);
EQ("SIZEOF_PSPANTEX", sizeof(PD3DI_SPANTEX));
printf("\n");
COMMENT("INTCARRYVAL");
SPRE("ICV");
SOFF(INTCARRYVAL, iV);
SOFF(INTCARRYVAL, iFrac);
SOFF(INTCARRYVAL, iDFrac);
SOFF(INTCARRYVAL, iNC);
SOFF(INTCARRYVAL, iCY);
printf("\n");
COMMENT("SETUPCTX");
SPRE("SCTX");
SOFF(SETUPCTX, uFlags);
SOFF(SETUPCTX, X20);
SOFF(SETUPCTX, iY);
SOFF(SETUPCTX, Attr);
SOFF(SETUPCTX, DAttrDX);
SOFF(SETUPCTX, DAttrDY);
SOFF(SETUPCTX, DAttrNC);
SOFF(SETUPCTX, DAttrCY);
SOFF(SETUPCTX, pPrim);
SOFF(SETUPCTX, bNextValid);
SOFF(SETUPCTX, fDX10);
SOFF(SETUPCTX, fDX20);
SOFF(SETUPCTX, fDY10);
SOFF(SETUPCTX, fDY20);
SOFF(SETUPCTX, fOoDet);
SOFF(SETUPCTX, fNX10);
SOFF(SETUPCTX, fNX20);
SOFF(SETUPCTX, fNY10);
SOFF(SETUPCTX, fNY20);
SOFF(SETUPCTX, fDX);
SOFF(SETUPCTX, fDY);
SOFF(SETUPCTX, fX20NC);
SOFF(SETUPCTX, fX20CY);
SOFF(SETUPCTX, pCtx);
printf("\n");
COMMENT("D3DTLVERTEX");
SPRE("TL");
SOFF(D3DTLVERTEX, dvSZ);
SOFF(D3DTLVERTEX, dvRHW);
SOFF(D3DTLVERTEX, dcColor);
SOFF(D3DTLVERTEX, dcSpecular);
SOFF(D3DTLVERTEX, dvTU);
SOFF(D3DTLVERTEX, dvTV);
printf("\n");
COMMENT("RASTCTX");
SPRE("RCTX");
SOFF(D3DI_RASTCTX, pdwRenderState);
printf("\n");
COMMENT("Flags");
EQ("TRIP_X_DEC", TRIP_X_DEC);
EQ("TRIP_RASTPRIM_OVERFLOW", TRIP_RASTPRIM_OVERFLOW);
EQ("TRIP_FIXED_OVERFLOW", TRIP_FIXED_OVERFLOW);
printf("\n");
COMMENT("D3DRENDERSTATE values.");
EQ("RS_ZBIAS", D3DRS_ZBIAS*sizeof(DWORD));
// EQ("RS_WRAPU", D3DRENDERSTATE_WRAPU*sizeof(DWORD));
// EQ("RS_WRAPV", D3DRENDERSTATE_WRAPV*sizeof(DWORD));
EQ("RS_SHADEMODE", D3DRS_SHADEMODE*sizeof(DWORD));
EQ("RS_STENCILREF", D3DRS_STENCILREF*sizeof(DWORD));
EQ("RS_STENCILMASK", D3DRS_STENCILMASK*sizeof(DWORD));
EQ("RS_STENCILPASS", D3DRS_STENCILPASS*sizeof(DWORD));
EQ("RS_STENCILZFAIL", D3DRS_STENCILZFAIL*sizeof(DWORD));
EQ("RS_STENCILFAIL", D3DRS_STENCILFAIL*sizeof(DWORD));
EQ("RS_STENCILWRITEMASK", D3DRS_STENCILWRITEMASK*sizeof(DWORD));
EQ("RS_ALPHAREF", D3DRS_ALPHAREF*sizeof(DWORD));
// EQ("RS_ROP2", D3DRENDERSTATE_ROP2*sizeof(DWORD));
// EQ("RS_TEXTUREPERSPECTIVE", D3DRENDERSTATE_TEXTUREPERSPECTIVE*sizeof(DWORD));
EQ("RS_FOGCOLOR", D3DRS_FOGCOLOR*sizeof(DWORD));
EQ("RS_FOGENABLE", D3DRS_FOGENABLE*sizeof(DWORD));
EQ("RS_TEXTUREFACTOR", D3DRS_TEXTUREFACTOR*sizeof(DWORD));
printf("\n");
COMMENT("Raster Op values.");
// EQ("R2_BLACK", R2_BLACK);
// EQ("R2_NOTMERGEPEN", R2_NOTMERGEPEN);
// EQ("R2_MASKNOTPEN", R2_MASKNOTPEN);
// EQ("R2_NOTCOPYPEN", R2_NOTCOPYPEN);
// EQ("R2_MASKPENNOT", R2_MASKPENNOT);
// EQ("R2_NOT", R2_NOT);
// EQ("R2_XORPEN", R2_XORPEN);
// EQ("R2_NOTMASKPEN", R2_NOTMASKPEN);
// EQ("R2_MASKPEN", R2_MASKPEN);
// EQ("R2_NOTXORPEN", R2_NOTXORPEN);
// EQ("R2_NOP", R2_NOP);
// EQ("R2_MERGENOTPEN", R2_MERGENOTPEN);
// EQ("R2_COPYPEN", R2_COPYPEN);
// EQ("R2_MERGEPENNOT", R2_MERGEPENNOT);
// EQ("R2_MERGEPEN", R2_MERGEPEN);
// EQ("R2_WHITE", R2_WHITE);
EQ("D3DSTENCILOP_KEEP", D3DSTENCILOP_KEEP);
EQ("D3DSTENCILOP_ZERO", D3DSTENCILOP_ZERO);
EQ("D3DSTENCILOP_REPLACE", D3DSTENCILOP_REPLACE);
EQ("D3DSTENCILOP_INCRSAT", D3DSTENCILOP_INCRSAT);
EQ("D3DSTENCILOP_DECRSAT", D3DSTENCILOP_DECRSAT);
EQ("D3DSTENCILOP_INVERT", D3DSTENCILOP_INVERT);
EQ("D3DSTENCILOP_INCR", D3DSTENCILOP_INCR);
EQ("D3DSTENCILOP_DECR", D3DSTENCILOP_DECR);
printf("\n");
COMMENT("Miscellaneous defines.");
EQ("D3DSHADE_FLAT", D3DSHADE_FLAT);
EQ("D3DTFG_LINEAR", D3DTFG_LINEAR);
EQ("D3DTFG_POINT", D3DTFG_POINT);
EQ("TEX_TO_FINAL_SHIFT", TEX_TO_FINAL_SHIFT);
EQ("TEX_SHIFT", TEX_SHIFT);
EQ("TEX_FINAL_SHIFT", TEX_FINAL_SHIFT);
EQ("RAST_STYPE_B5G6R5", RAST_STYPE_B5G6R5);
EQ("RAST_STYPE_B5G5R5", RAST_STYPE_B5G5R5);
/*
printf("\n");
COMMENT("FP constants.");
TEXTERN("_g_fTwoPow8", "DWORD");
TEXTERN("_g_fTwoPow16", "DWORD");
TEXTERN("_g_fOoTwoPow16", "DWORD");
TEXTERN("_g_fTwoPow20", "DWORD");
TEXTERN("_g_fTwoPow31", "DWORD");
TEXTERN("_g_fTwoPow39", "DWORD");
EQ("C_Z_LIMIT", C_Z_LIMIT);
EQ("C_OOW_LIMIT", C_OOW_LIMIT);
EQ("C_COLOR_LIMIT", C_COLOR_LIMIT);
EQ("C_TEX_LIMIT", C_TEX_LIMIT);
//TEQF("Z_SCALE", "_g_fTwoPow%d", (Z_SHIFT));
//TEQF("OOW_SCALE", "_g_fTwoPow%d", (OOW_SHIFT));
//TEQF("OOW_W_SCALE", "_g_fTwoPow%d", (OOW_W_SHIFT));
//TEQF("COLOR_SCALE", "_g_fTwoPow%d", (COLOR_SHIFT));
//TEQF("TEX_SCALE", "_g_fTwoPow%d", (TEX_SHIFT));
*/
exit(0);
}