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.
 
 
 
 
 
 

186 lines
5.7 KiB

//----------------------------------------------------------------------------
//
// offs_acp.acp
//
// Assembly structure offset generator.
//
// Copyright (C) Microsoft Corporation, 1997.
//
//----------------------------------------------------------------------------
#include <stdio.h>
#include <windows.h>
#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 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("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, iUoW1);
SOFF(D3DI_RASTSPAN, iVoW1);
SOFF(D3DI_RASTSPAN, iUoW2);
SOFF(D3DI_RASTSPAN, iVoW2);
SOFF(D3DI_RASTSPAN, iLOD);
SOFF(D3DI_RASTSPAN, iDLOD);
EQ("SIZEOF_RASTSPAN", sizeof(D3DI_RASTSPAN));
printf("\n");
CSPRE("RASTPRIM");
SOFF(D3DI_RASTPRIM, pNext);
SOFF(D3DI_RASTPRIM, uFlags);
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, iDUoW1DX);
SOFF(D3DI_RASTPRIM, iDVoW1DX);
SOFF(D3DI_RASTPRIM, iDUoW1DY);
SOFF(D3DI_RASTPRIM, iDVoW1DY);
SOFF(D3DI_RASTPRIM, iDUoW2DX);
SOFF(D3DI_RASTPRIM, iDVoW2DX);
SOFF(D3DI_RASTPRIM, iDUoW2DY);
SOFF(D3DI_RASTPRIM, iDVoW2DY);
EQ("SIZEOF_RASTPRIM", sizeof(D3DI_RASTPRIM));
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);
SOFF(D3DI_RASTCTX, iSurfaceStep);
SOFF(D3DI_RASTCTX, iZStep);
SOFF(D3DI_RASTCTX, iZBitCount);
SOFF(D3DI_RASTCTX, pTexture);
SOFF(D3DI_RASTCTX, RampBase);
SOFF(D3DI_RASTCTX, RampSize);
SOFF(D3DI_RASTCTX, bRampSpecular);
SOFF(D3DI_RASTCTX, pTexRampMap);
SOFF(D3DI_RASTCTX, pRampMap);
SOFF(D3DI_RASTCTX, pPrim);
SOFF(D3DI_RASTCTX, pSurfaceBits);
SOFF(D3DI_RASTCTX, iSurfaceStride);
SOFF(D3DI_RASTCTX, pZBits);
SOFF(D3DI_RASTCTX, iZStride);
SOFF(D3DI_RASTCTX, pFillParams);
printf("\n");
COMMENT("FILLPARAMS");
SPRE("FPMS");
SOFF(D3DI_FILLPARAMS, dwWrapU);
SOFF(D3DI_FILLPARAMS, dwWrapV);
SOFF(D3DI_FILLPARAMS, dwCullCCW);
SOFF(D3DI_FILLPARAMS, dwCullCW);
printf("\n");
COMMENT("SPANTEX");
SPRE("STEX");
SOFF(D3DI_SPANTEX, iShiftU);
SOFF(D3DI_SPANTEX, iShiftV);
SOFF(D3DI_SPANTEX, uMaskU);
SOFF(D3DI_SPANTEX, uMaskV);
SOFF(D3DI_SPANTEX, pBits);
SOFF(D3DI_SPANTEX, iShiftPitch);
SOFF(D3DI_SPANTEX, iPaletteSize);
SOFF(D3DI_SPANTEX, TransparentColor);
SOFF(D3DI_SPANTEX, pRampmap);
printf("\n");
COMMENT("Flags");
printf("\n");
COMMENT("Miscellaneous defines.");
EQ("D3DI_RASTPRIM_X_DEC", D3DI_RASTPRIM_X_DEC);
EQ("TEX_FINAL_SHIFT", TEX_FINAL_SHIFT);
printf("\n");
COMMENT("FP constants.");
TEXTERN("_g_fOne", "DWORD");
TEXTERN("_g_fOoTwoPow20", "DWORD");
TEXTERN("_g_fTwoPow27", "DWORD");
TEQ("TEX_UVW_TO_FINAL_SCALE", "_g_fOoTwoPow20");
TEQ("TEX_OOW_TO_FINAL_SCALE", "_g_fTwoPow27");
exit(0);
}