|
|
//---------------------------------------------------------------------------- // // 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 "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_ || _IA64_)
#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, pSurface); SOFF(ATTRSET, pZ); SOFF(ATTRSET, fZ); SOFF(ATTRSET, fOoW); SOFF(ATTRSET, fUoW); SOFF(ATTRSET, fVoW); SOFF(ATTRSET, fB); SOFF(ATTRSET, fG); SOFF(ATTRSET, fR); SOFF(ATTRSET, fA); SOFF(ATTRSET, fDIdx); SOFF(ATTRSET, fDIdxA); SOFF(ATTRSET, fBS); SOFF(ATTRSET, fGS); SOFF(ATTRSET, fRS); SOFF(ATTRSET, fFog); 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, iUoW); SOFF(ATTRSET, iVoW); SOFF(ATTRSET, iB); SOFF(ATTRSET, iG); SOFF(ATTRSET, iR); SOFF(ATTRSET, iA); SOFF(ATTRSET, iBS); SOFF(ATTRSET, iGS); SOFF(ATTRSET, iRS); SOFF(ATTRSET, iFog); EQ("SIZEOF_ATTRSET", sizeof(ATTRSET));
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, iIdx); SOFF(D3DI_RASTSPAN, iIdxA); SOFF(D3DI_RASTSPAN, uBS); SOFF(D3DI_RASTSPAN, uGS); SOFF(D3DI_RASTSPAN, uRS); SOFF(D3DI_RASTSPAN, uFog); SOFF(D3DI_RASTSPAN, iDFog); SOFF(D3DI_RASTSPAN, iW); SOFF(D3DI_RASTSPAN, iOoW); SOFF(D3DI_RASTSPAN, UVoW); SOFF(D3DI_RASTSPAN, iLOD); SOFF(D3DI_RASTSPAN, iDLOD); EQ("SIZEOF_RASTSPAN", sizeof(D3DI_RASTSPAN));
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, iDIdxDX); SOFF(D3DI_RASTPRIM, iDIdxADX); SOFF(D3DI_RASTPRIM, iDBSDX); SOFF(D3DI_RASTPRIM, iDGSDX); SOFF(D3DI_RASTPRIM, iDRSDX); SOFF(D3DI_RASTPRIM, iDOoWDX); SOFF(D3DI_RASTPRIM, iDOoWDY); SOFF(D3DI_RASTPRIM, DUVoWDX); SOFF(D3DI_RASTPRIM, DUVoWDY); EQ("SIZEOF_RASTPRIM", sizeof(D3DI_RASTPRIM));
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, PrimProcessor); SOFF(SETUPCTX, pCtx); SOFF(SETUPCTX, uFlags); SOFF(SETUPCTX, pFlatVtx); 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, uPwlFlags); SOFF(SETUPCTX, fNextOoW); SOFF(SETUPCTX, fNextUoW1); SOFF(SETUPCTX, fNextVoW1); SOFF(SETUPCTX, iDLocalFogDX); 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); SOFF(SETUPCTX, pfnTriSetupFirstAttr); SOFF(SETUPCTX, pfnTriSetupZEnd); SOFF(SETUPCTX, pfnTriSetupTexEnd); SOFF(SETUPCTX, pfnTriSetupDiffEnd); SOFF(SETUPCTX, pfnTriSetupSpecEnd); SOFF(SETUPCTX, pfnTriSetupFogEnd);
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("RAST_GENERIC_VERTEX"); SPRE("TM"); SOFF(RAST_GENERIC_VERTEX, texCoord);
printf("\n"); COMMENT("RASTCTX"); SPRE("RCTX"); SOFF(D3DI_RASTCTX, pdwRenderState); SOFF(D3DI_RASTCTX, iZBitCount); SOFF(D3DI_RASTCTX, pTexture); SOFF(D3DI_RASTCTX, RampBase); SOFF(D3DI_RASTCTX, RampSize); SOFF(D3DI_RASTCTX, bRampSpecular); SOFF(D3DI_RASTCTX, cActTex);
printf("\n"); COMMENT("SPANTEX"); SPRE("STEX");
printf("\n"); COMMENT("Flags"); EQ("TRIF_X_DEC", TRIF_X_DEC); EQ("TRIF_RASTPRIM_OVERFLOW", TRIF_RASTPRIM_OVERFLOW); EQ("PRIMF_FIXED_OVERFLOW", PRIMF_FIXED_OVERFLOW); EQ("PRIMSF_GLOBAL_FOG_USED", PRIMSF_GLOBAL_FOG_USED);
printf("\n"); COMMENT("D3DRENDERSTATE values."); EQ("RS_SHADEMODE", D3DRS_SHADEMODE*sizeof(DWORD)); EQ("RS_WRAP0", D3DRS_WRAP0*sizeof(DWORD));
printf("\n"); COMMENT("Miscellaneous defines."); EQ("D3DSHADE_FLAT", D3DSHADE_FLAT); EQ("D3DWRAP_U", D3DWRAP_U); EQ("D3DWRAP_V", D3DWRAP_V);
printf("\n"); COMMENT("FP constants."); TEXTERN("_g_fOne", "DWORD"); TEXTERN("_g_fOo255", "DWORD"); TEXTERN("_g_fTwoPow8", "DWORD"); TEXTERN("_g_fTwoPow15", "DWORD"); TEXTERN("_g_fOoTwoPow15", "DWORD"); TEXTERN("_g_fTwoPow16", "DWORD"); TEXTERN("_g_fOoTwoPow16", "DWORD"); TEXTERN("_g_fTwoPow20", "DWORD"); TEXTERN("_g_fTwoPow31", "DWORD"); TEXTERN("_g_fNearTwoPow31", "DWORD"); TEXTERN("_g_fOoTwoPow31", "DWORD"); TEXTERN("_g_fOoNearTwoPow31", "DWORD"); TEXTERN("_g_fTwoPow32", "DWORD"); TEXTERN("_g_fNearTwoPow32", "DWORD"); TEXTERN("_g_fTwoPow39", "DWORD"); TEXTERN("_g_fTwoPow47", "DWORD");
EQ("C_Z_LIMIT", C_Z_LIMIT); EQ("C_OOW_LIMIT", C_OOW_LIMIT); EQ("C_COLOR_LIMIT", C_COLOR_LIMIT); EQ("C_INDEX_COLOR_LIMIT", C_INDEX_COLOR_LIMIT); EQ("C_TEX_LIMIT", C_TEX_LIMIT); EQ("C_FOG_LIMIT", C_FOG_LIMIT);
TEQF("Z16_FRAC_SCALE", "_g_fTwoPow%d", (Z16_FRAC_SHIFT)); TEQF("OO_Z16_FRAC_SCALE", "_g_fOoTwoPow%d", (Z16_FRAC_SHIFT)); TEQF("Z16_SCALE", "_g_fNearTwoPow%d", (Z16_SHIFT)); if (Z32_FRAC_SHIFT == 0) { TEQ("Z32_FRAC_SCALE", "_g_fOne"); TEQ("OO_Z32_FRAC_SCALE", "_g_fOoNearTwoPow31"); } else { TEQF("Z32_FRAC_SCALE", "_g_fTwoPow%d", (Z32_FRAC_SHIFT)); TEQF("OO_Z32_FRAC_SCALE", "_g_fOoNearTwoPow%d", (Z32_FRAC_SHIFT)); } TEQF("Z32_SCALE", "_g_fNearTwoPow%d", (Z32_SHIFT)); TEQF("OOW_SCALE", "_g_fNearTwoPow%d", (OOW_SHIFT)); TEQF("OOW_W_SCALE", "_g_fTwoPow%d", (OOW_W_SHIFT)); TEQF("COLOR_SCALE", "_g_fTwoPow%d", (COLOR_SHIFT)); EQ("COLOR_SHIFT", COLOR_SHIFT); TEQF("INDEX_COLOR_SCALE", "_g_fTwoPow%d", (INDEX_COLOR_SHIFT)); EQ("INDEX_COLOR_SHIFT", INDEX_COLOR_SHIFT); TEQF("INDEX_COLOR_FIXED_SCALE", "_g_fTwoPow%d", (INDEX_COLOR_FIXED_SHIFT)); EQ("INDEX_COLOR_FIXED_SHIFT", INDEX_COLOR_FIXED_SHIFT); TEQF("TEX_SCALE", "_g_fTwoPow%d", (TEX_SHIFT)); EQ("FOG_SHIFT", FOG_SHIFT); TEQF("FOG_SCALE", "_g_fTwoPow%d", (FOG_SHIFT));
exit(0); }
|