├── .gitignore ├── ASM ├── MgAsmBase.cpp ├── MgAsmCom.cpp ├── MgAsmCom.h ├── MgAsmComDef.h ├── MgDisasm.cpp └── MgDisasmBase.cpp ├── CreateGif ├── GSKCreateGIF.cpp ├── GSKCreateGIF.h ├── Quantizer.cpp ├── Quantizer.h ├── SelTransparentColorDlg.cpp └── SelTransparentColorDlg.h ├── DLLMODUL.CPP ├── DXBind.cpp ├── DXBind.h ├── KeyMouse ├── MyKeyboardNamespace.cpp ├── MyKeyboardNamespace.h ├── MyMouseNamespace.cpp └── MyMouseNamespace.h ├── MapFile.cpp ├── MapFile.h ├── README.md ├── ReadMe.txt ├── TCProtect_se ├── TCProtect_se.sys.tyuyan#$%0409zlc ├── TSFindPicture.cpp ├── TSFindPicture.h ├── TSHookFuntion.h ├── TSMemoryAPI.cpp ├── TSMemoryAPI.h ├── TSMessage.h ├── TSMyKernel32DllFuntion.h ├── TSMyKernel32User32DllFuntion.cpp ├── TSMyUser32DllFuntion.h ├── TSPlug.aps ├── TSPlug.cpp ├── TSPlug.def ├── TSPlug.idl ├── TSPlug.rc ├── TSPlug.rgs ├── TSPlug.sln ├── TSPlug.vcproj ├── TSPlug.vcproj.think-THINK.Administrator.user ├── TSPlug.vcproj.zlc-PC.zlc.user ├── TSPlug.vcxproj ├── TSPlug.vcxproj.filters ├── TSPlug.vcxproj.user ├── TSPlugInterFace.cpp ├── TSPlugInterFace.h ├── TSPlugInterFace.rgs ├── TSPlugPS.vcproj ├── TSPlugPS.vcproj.think-THINK.Administrator.user ├── TSPlugPS.vcproj.zlc-PC.zlc.user ├── TSPlugPS.vcxproj ├── TSPlugPS.vcxproj.filters ├── TSPlug_i.c ├── TSPlug_i.h ├── TSPlug_p.c ├── TSPlugps.def ├── TSRuntime.cpp ├── TSRuntime.h ├── TSVIPHookFuntion.h ├── TSWindowsAPI.cpp ├── TSWindowsAPI.cpp~RF14b6222.TMP ├── TSWindowsAPI.h ├── Toolhelp.h ├── Ts.chm ├── UpgradeLog.htm ├── UpgradeLog2.htm ├── d3dx9.h ├── d3dx9anim.h ├── d3dx9core.h ├── d3dx9effect.h ├── d3dx9math.h ├── d3dx9math.inl ├── d3dx9mesh.h ├── d3dx9shader.h ├── d3dx9shape.h ├── d3dx9tex.h ├── d3dx9xof.h ├── dlldata.c ├── dllmain.cpp ├── dllmain.h ├── resource.h ├── stdafx.cpp ├── stdafx.h ├── targetver.h └── ve-8EF.tmp /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /ASM/MgAsmBase.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/ASM/MgAsmBase.cpp -------------------------------------------------------------------------------- /ASM/MgAsmCom.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/ASM/MgAsmCom.cpp -------------------------------------------------------------------------------- /ASM/MgAsmCom.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/ASM/MgAsmCom.h -------------------------------------------------------------------------------- /ASM/MgAsmComDef.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/ASM/MgAsmComDef.h -------------------------------------------------------------------------------- /ASM/MgDisasm.cpp: -------------------------------------------------------------------------------- 1 | // MgDisasm.cpp : Defines the entry point for the console application. 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "MgAsmCom.h" 6 | #include 7 | 8 | CMgDisasmBase g_Disasm; 9 | CMgAsmBase g_Asm; 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | int i, j, n; 14 | ulong l; 15 | char s[TEXTLEN], errtext[TEXTLEN]; 16 | char *pasm; 17 | 18 | CMgDisasmBase::t_disasm da; 19 | CMgAsmBase::t_asmmodel am; 20 | 21 | // Demonstration of Disassembler. 22 | printf("Disassembler:\n"); 23 | 24 | //// Quickly determine size of command. 25 | //l=g_Disasm.Disasm("\xB8\x50\x11\x40\x00\xFF\xD0", 26 | // 10,0x400000,&da,DISASM_SIZE); 27 | //printf("Size of command = %i bytes\n",l); 28 | 29 | //ADD [475AE0],1 MASM mode, lowercase, don't show default segment 30 | g_Disasm.m_nIDEAL=0; g_Disasm.m_nLowercase=1; g_Disasm.m_nPutDefSeg=0; 31 | l=g_Disasm.Disasm("\xE8\x4B\x11\x00\x00", 32 | 10,0x400000,&da,DISASM_CODE); 33 | printf("%3i %-24s %-24s (MASM)\n",l,da.dump,da.result); 34 | 35 | 36 | // ADD [475AE0],1 IDEAL mode, uppercase, show default segment 37 | //g_Disasm.m_nIDEAL=1; g_Disasm.m_nLowercase=0; g_Disasm.m_nPutDefSeg=1; 38 | //l=g_Disasm.Disasm("\xE8\x4B\x11\x00\x00", 39 | // 10,0x400000,&da,DISASM_CODE); 40 | //printf("%3i %-24s %-24s (IDEAL)\n",l,da.dump,da.result); 41 | 42 | //// CALL 45187C 43 | //l=g_Disasm.Disasm("\xE8\x1F\x14\x00\x00", 44 | // 5,0x450458,&da,DISASM_CODE); 45 | //printf("%3i %-24s %-24s jmpconst=%08X\n",l,da.dump,da.result,da.jmpconst); 46 | // 47 | //// JNZ 450517 48 | //l=g_Disasm.Disasm("\xE8\x1F\x14\x00\x00", 49 | // 2,0x4504A3,&da,DISASM_CODE); 50 | //printf("%3i %-24s %-24s jmpconst=%08X\n",l,da.dump,da.result,da.jmpconst); 51 | 52 | 53 | //g_Disasm.m_nIDEAL=0; g_Disasm.m_nLowercase=1; g_Disasm.m_nPutDefSeg=0; 54 | //l=g_Disasm.Disasm("\x0F\x9E\xC0", 55 | // 10,0x400000,&da,DISASM_CODE); 56 | //printf("%3i %-24s %-24s (MASM)\n",l,da.dump,da.result); 57 | 58 | 59 | // Demonstration of Assembler. 60 | printf("\nAssembler:\n"); 61 | 62 | // Assemble one of the commands above. First try form with 32-bit immediate.//32λ 63 | pasm = "mov eax,dword ptr [40E000]"; 64 | printf("%s:\n", pasm); 65 | j = g_Asm.Assemble(pasm, 0x400000, &am, 0, 0, errtext); 66 | n = sprintf(s, "%3i ", j); 67 | for (i = 0; i < j; i++) 68 | n += sprintf(s + n, "%02X ", am.code[i]); 69 | if (j <= 0) 70 | sprintf(s + n, " error=\"%s\"", errtext); 71 | printf("%s\n", s); 72 | 73 | // Then variant with 8-bit immediate constant.//8λ 74 | //j=g_Asm.Assemble(pasm,0x400000,&am,0,2,errtext); 75 | //n=sprintf(s,"%3i ",j); 76 | //for (i=0; i 4 | 5 | ///////////////////////////////////////////////////////////////////////////// 6 | CQuantizer::CQuantizer (UINT nMaxColors, UINT nColorBits) 7 | { 8 | m_nColorBits = nColorBits < 8 ? nColorBits : 8; 9 | 10 | m_pTree = NULL; 11 | m_nLeafCount = 0; 12 | for (int i=0; i<=(int) m_nColorBits; i++) 13 | m_pReducibleNodes[i] = NULL; 14 | m_nMaxColors = nMaxColors; 15 | } 16 | 17 | ///////////////////////////////////////////////////////////////////////////// 18 | CQuantizer::~CQuantizer () 19 | { 20 | if (m_pTree != NULL) 21 | DeleteTree (&m_pTree); 22 | } 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | BOOL CQuantizer::ProcessImage (HANDLE hImage) 26 | { 27 | BYTE r, g, b; 28 | int i, j; 29 | 30 | BITMAPINFOHEADER ds; 31 | memcpy(&ds,hImage, sizeof(ds)); 32 | int effwdt = ((((ds.biBitCount * ds.biWidth ) + 31) / 32) * 4); 33 | 34 | int nPad = effwdt - (((ds.biWidth * ds.biBitCount) + 7) / 8); 35 | 36 | BYTE* pbBits = (BYTE*)hImage + *(LPDWORD)hImage; 37 | 38 | switch (ds.biBitCount) { 39 | 40 | case 1: // 1-bit DIB 41 | case 4: // 4-bit DIB 42 | case 8: // 8-bit DIB 43 | for (i=0; i m_nMaxColors) 54 | ReduceTree (m_nColorBits, &m_nLeafCount, 55 | m_pReducibleNodes); 56 | } 57 | } 58 | break; 59 | case 15: 60 | case 16://16bit 61 | for (i=0; i>5; 67 | g |= ((*pbBits)&0x03)<<3; 68 | r = ((*pbBits++)>>2)&0x1F; 69 | 70 | r *= 8; 71 | b *= 8; 72 | g *= 8; 73 | 74 | AddColor (&m_pTree, r, g, b, m_nColorBits, 0, &m_nLeafCount, 75 | m_pReducibleNodes); 76 | while (m_nLeafCount > m_nMaxColors) 77 | ReduceTree (m_nColorBits, &m_nLeafCount, m_pReducibleNodes); 78 | } 79 | 80 | pbBits += nPad; 81 | } 82 | break; 83 | case 24: // 24-bit DIB 84 | for (i=0; i m_nMaxColors) 92 | ReduceTree (m_nColorBits, &m_nLeafCount, m_pReducibleNodes); 93 | } 94 | pbBits += nPad; 95 | } 96 | break; 97 | case 32: // 32-bit DIB 98 | for (i=0; i m_nMaxColors) 108 | ReduceTree (m_nColorBits, &m_nLeafCount, m_pReducibleNodes); 109 | } 110 | pbBits += nPad; 111 | } 112 | break; 113 | default: // Unrecognized color format 114 | return FALSE; 115 | } 116 | return TRUE; 117 | } 118 | 119 | ///////////////////////////////////////////////////////////////////////////// 120 | void CQuantizer::AddColor (NODE** ppNode, BYTE r, BYTE g, BYTE b, 121 | UINT nColorBits, UINT nLevel, UINT* pLeafCount, NODE** pReducibleNodes) 122 | { 123 | static BYTE mask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; 124 | 125 | // If the node doesn't exist, create it. 126 | if (*ppNode == NULL) 127 | *ppNode = (NODE*)CreateNode (nLevel, nColorBits, pLeafCount, pReducibleNodes); 128 | 129 | // Update color information if it's a leaf node. 130 | if ((*ppNode)->bIsLeaf) 131 | { 132 | (*ppNode)->nPixelCount++; 133 | (*ppNode)->nRedSum += r; 134 | (*ppNode)->nGreenSum += g; 135 | (*ppNode)->nBlueSum += b; 136 | } else 137 | { // Recurse a level deeper if the node is not a leaf. 138 | int shift = 7 - nLevel; 139 | int nIndex =(((r & mask[nLevel]) >> shift) << 2) | 140 | (((g & mask[nLevel]) >> shift) << 1) | 141 | (( b & mask[nLevel]) >> shift); 142 | AddColor(&((*ppNode)->pChild[nIndex]), r, g, b, nColorBits, 143 | nLevel + 1, pLeafCount, pReducibleNodes); 144 | } 145 | } 146 | 147 | ///////////////////////////////////////////////////////////////////////////// 148 | void* CQuantizer::CreateNode (UINT nLevel, UINT nColorBits, UINT* pLeafCount, 149 | NODE** pReducibleNodes) 150 | { 151 | NODE* pNode = (NODE*)calloc(1,sizeof(NODE)); 152 | 153 | if (pNode== NULL) return NULL; 154 | 155 | pNode->bIsLeaf = (nLevel == nColorBits) ? TRUE : FALSE; 156 | if (pNode->bIsLeaf) (*pLeafCount)++; 157 | else { 158 | pNode->pNext = pReducibleNodes[nLevel]; 159 | pReducibleNodes[nLevel] = pNode; 160 | } 161 | return pNode; 162 | } 163 | 164 | ///////////////////////////////////////////////////////////////////////////// 165 | void CQuantizer::ReduceTree (UINT nColorBits, UINT* pLeafCount, 166 | NODE** pReducibleNodes) 167 | { 168 | int i; 169 | // Find the deepest level containing at least one reducible node. 170 | for (i=nColorBits - 1; (i>0) && (pReducibleNodes[i] == NULL); i--); 171 | 172 | // Reduce the node most recently added to the list at level i. 173 | NODE* pNode = pReducibleNodes[i]; 174 | pReducibleNodes[i] = pNode->pNext; 175 | 176 | NODE* pNodeTmp = pNode; 177 | NODE* pNeedReduceNode = NULL,*pPreNode = NULL,*pPreNodeTmp = NULL; 178 | long nMinPixelCount = 0; 179 | 180 | while(pNodeTmp) 181 | { 182 | long nPixelCount = 0; 183 | for (int m=0; m<8; m++) 184 | { 185 | if (pNodeTmp->pChild[m] != NULL) 186 | { 187 | nPixelCount += pNodeTmp->pChild[m]->nPixelCount; 188 | } 189 | } 190 | 191 | if(nMinPixelCount == 0) 192 | { 193 | nMinPixelCount = nPixelCount; 194 | pNeedReduceNode = pNodeTmp; 195 | } 196 | else if(nPixelCount < nMinPixelCount) 197 | { 198 | nMinPixelCount = nPixelCount; 199 | pNeedReduceNode = pNodeTmp; 200 | pPreNode = pPreNodeTmp; 201 | } 202 | 203 | pPreNodeTmp = pNodeTmp; 204 | pNodeTmp = pNodeTmp->pNext; 205 | } 206 | 207 | if(pPreNode) 208 | { 209 | pPreNode->pNext = pNeedReduceNode->pNext; 210 | pReducibleNodes[i] = pNode; 211 | } 212 | 213 | pNode = pNeedReduceNode; 214 | 215 | UINT nRedSum = 0; 216 | UINT nGreenSum = 0; 217 | UINT nBlueSum = 0; 218 | UINT nChildren = 0; 219 | 220 | for (i=0; i<8; i++) 221 | { 222 | if (pNode->pChild[i] != NULL) 223 | { 224 | nRedSum += pNode->pChild[i]->nRedSum; 225 | nGreenSum += pNode->pChild[i]->nGreenSum; 226 | nBlueSum += pNode->pChild[i]->nBlueSum; 227 | pNode->nPixelCount += pNode->pChild[i]->nPixelCount; 228 | free(pNode->pChild[i]); 229 | pNode->pChild[i] = NULL; 230 | nChildren++; 231 | } 232 | } 233 | 234 | pNode->bIsLeaf = TRUE; 235 | pNode->nRedSum = nRedSum; 236 | pNode->nGreenSum = nGreenSum; 237 | pNode->nBlueSum = nBlueSum; 238 | *pLeafCount -= (nChildren - 1); 239 | } 240 | 241 | ///////////////////////////////////////////////////////////////////////////// 242 | void CQuantizer::DeleteTree (NODE** ppNode) 243 | { 244 | for (int i=0; i<8; i++) { 245 | if ((*ppNode)->pChild[i] != NULL) DeleteTree (&((*ppNode)->pChild[i])); 246 | } 247 | free(*ppNode); 248 | *ppNode = NULL; 249 | } 250 | 251 | 252 | BOOL CQuantizer::FindColorIndex(NODE *pNode,BYTE r,BYTE g,BYTE b,int nLevel,UINT *pColorIndex) 253 | { 254 | static BYTE mask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; 255 | 256 | // If the node doesn't exist, create it. 257 | if (pNode == NULL) 258 | { 259 | return FALSE; 260 | } 261 | 262 | // Update color information if it's a leaf node. 263 | if (pNode->bIsLeaf) 264 | { 265 | *pColorIndex = pNode->nColorIndex; 266 | return TRUE; 267 | } 268 | 269 | // Recurse a level deeper if the node is not a leaf. 270 | int shift = 7 - nLevel; 271 | int nIndex =(((r & mask[nLevel]) >> shift) << 2) | 272 | (((g & mask[nLevel]) >> shift) << 1) | 273 | (( b & mask[nLevel]) >> shift); 274 | 275 | return FindColorIndex(pNode->pChild[nIndex], r, g, b, nLevel+1, pColorIndex); 276 | } 277 | 278 | BOOL CQuantizer::GetColorIndex(BYTE r,BYTE g,BYTE b,UINT *pColorIndex) 279 | { 280 | return FindColorIndex(m_pTree,r,g,b,0,pColorIndex); 281 | } 282 | 283 | ///////////////////////////////////////////////////////////////////////////// 284 | void CQuantizer::GetPaletteColors (NODE* pTree, RGBQUAD* prgb, UINT* pIndex) 285 | { 286 | if (pTree){ 287 | if (pTree->bIsLeaf) { 288 | prgb[*pIndex].rgbRed = (BYTE)((pTree->nRedSum)/(pTree->nPixelCount)); 289 | prgb[*pIndex].rgbGreen = (BYTE)((pTree->nGreenSum)/(pTree->nPixelCount)); 290 | prgb[*pIndex].rgbBlue = (BYTE)((pTree->nBlueSum)/(pTree->nPixelCount)); 291 | prgb[*pIndex].rgbReserved = 0; 292 | pTree->nColorIndex = *pIndex; 293 | (*pIndex)++; 294 | } else { 295 | for (int i=0; i<8; i++) { 296 | if (pTree->pChild[i] != NULL) 297 | GetPaletteColors (pTree->pChild[i], prgb, pIndex); 298 | } 299 | } 300 | } 301 | } 302 | 303 | ///////////////////////////////////////////////////////////////////////////// 304 | UINT CQuantizer::GetColorCount () 305 | { 306 | return m_nLeafCount; 307 | } 308 | 309 | ///////////////////////////////////////////////////////////////////////////// 310 | void CQuantizer::SetColorTable (RGBQUAD* prgb) 311 | { 312 | UINT nIndex = 0; 313 | GetPaletteColors (m_pTree, prgb, &nIndex); 314 | } 315 | 316 | ///////////////////////////////////////////////////////////////////////////// 317 | BYTE CQuantizer::GetPixelIndex(long x, long y, int nbit, long effwdt, BYTE *pimage) 318 | { 319 | if (nbit==8) 320 | { 321 | return pimage[y*effwdt + x]; 322 | } else 323 | { 324 | BYTE pos; 325 | BYTE iDst= pimage[y*effwdt + (x*nbit >> 3)]; 326 | if (nbit==4) 327 | { 328 | pos = 4*(1-x%2); 329 | iDst &= (0x0F<> pos; 331 | } else if (nbit==1) 332 | { 333 | pos = 7-x%8; 334 | iDst &= (0x01<> pos; 336 | } 337 | } 338 | return 0; 339 | } 340 | 341 | CRGBQuantizer::CRGBQuantizer(UINT nMaxColors, UINT nColorBits) 342 | :CQuantizer(nMaxColors,nColorBits) 343 | { 344 | } 345 | 346 | BOOL CRGBQuantizer::ProcessImageRGB(BYTE *pRGBData,UINT nWidth,UINT nHeight) 347 | { 348 | BYTE r,g,b; 349 | 350 | for (int i=0; i m_nMaxColors) 360 | ReduceTree (m_nColorBits, &m_nLeafCount, m_pReducibleNodes); 361 | } 362 | } 363 | 364 | return TRUE; 365 | } 366 | 367 | CBitmapQuantizer::CBitmapQuantizer(UINT nMaxColors, UINT nColorBits) 368 | :CQuantizer(nMaxColors,nColorBits) 369 | { 370 | } 371 | 372 | BOOL CBitmapQuantizer::ProcessImageBitmap (HBITMAP hBmp) 373 | { 374 | BITMAP bm; 375 | PBITMAPINFO bmpInf; 376 | 377 | if(GetObject(hBmp,sizeof(bm),&bm)==0) 378 | return FALSE; 379 | 380 | int nPaletteSize=0; 381 | 382 | if(bm.bmBitsPixel<16) 383 | nPaletteSize=(int)pow(2.0,bm.bmBitsPixel); 384 | 385 | bmpInf=(PBITMAPINFO)LocalAlloc(LPTR,sizeof(BITMAPINFOHEADER)+ 386 | sizeof(RGBQUAD)*nPaletteSize+ 387 | (bm.bmWidth+7)/8*bm.bmHeight*bm.bmBitsPixel); 388 | 389 | BYTE* buf = ((BYTE*)bmpInf)+ 390 | sizeof(BITMAPINFOHEADER)+ 391 | sizeof(RGBQUAD)*nPaletteSize; 392 | 393 | //----------------------------------------------- 394 | bmpInf->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 395 | bmpInf->bmiHeader.biWidth = bm.bmWidth; 396 | bmpInf->bmiHeader.biHeight = bm.bmHeight; 397 | bmpInf->bmiHeader.biPlanes = bm.bmPlanes; 398 | bmpInf->bmiHeader.biBitCount = bm.bmBitsPixel; 399 | bmpInf->bmiHeader.biCompression = BI_RGB; 400 | bmpInf->bmiHeader.biSizeImage = (bm.bmWidth+7)/8*bm.bmHeight*bm.bmBitsPixel; 401 | bmpInf->bmiHeader.biXPelsPerMeter = 0; 402 | bmpInf->bmiHeader.biYPelsPerMeter = 0; 403 | bmpInf->bmiHeader.biClrUsed = 0; 404 | bmpInf->bmiHeader.biClrImportant = 0; 405 | //----------------------------------------------- 406 | 407 | HDC hDC = ::GetWindowDC(NULL); 408 | 409 | if(!::GetDIBits(hDC,hBmp,0,(UINT)bm.bmHeight,buf,bmpInf,DIB_RGB_COLORS)) 410 | { 411 | ::ReleaseDC(NULL,hDC); 412 | LocalFree(bmpInf); 413 | return FALSE; 414 | } 415 | 416 | ::ReleaseDC(NULL,hDC); 417 | 418 | bmpInf->bmiHeader.biSize = sizeof(BITMAPINFOHEADER)+sizeof(RGBQUAD)*nPaletteSize; 419 | BOOL bRet = ProcessImage(bmpInf); 420 | 421 | LocalFree(bmpInf); 422 | 423 | return bRet; 424 | } -------------------------------------------------------------------------------- /CreateGif/Quantizer.h: -------------------------------------------------------------------------------- 1 | #if !defined(QUANTIZER_H_) 2 | #define QUANTIZER_H_ 3 | 4 | struct NODE 5 | { 6 | BOOL bIsLeaf; 7 | long nPixelCount; 8 | long nRedSum; 9 | long nGreenSum; 10 | long nBlueSum; 11 | UINT nColorIndex; 12 | NODE *pChild[8]; 13 | NODE *pNext; 14 | }; 15 | 16 | class CQuantizer 17 | { 18 | public: 19 | CQuantizer(UINT nMaxColors, UINT nColorBits); 20 | ~CQuantizer(); 21 | 22 | BOOL ProcessImage (HANDLE hImage); 23 | 24 | UINT GetColorCount (); 25 | 26 | void SetColorTable (RGBQUAD* prgb); 27 | 28 | BOOL GetColorIndex(BYTE r,BYTE g,BYTE b,UINT *pColorIndex); 29 | 30 | protected: 31 | 32 | void AddColor (NODE** ppNode, BYTE r, BYTE g, BYTE b, 33 | UINT nColorBits, UINT nLevel, UINT* pLeafCount, NODE** pReducibleNodes); 34 | 35 | void* CreateNode (UINT nLevel, UINT nColorBits, UINT* pLeafCount, 36 | NODE** pReducibleNodes); 37 | 38 | void ReduceTree (UINT nColorBits, UINT* pLeafCount, 39 | NODE** pReducibleNodes); 40 | 41 | void DeleteTree (NODE** ppNode); 42 | 43 | void GetPaletteColors (NODE* pTree, RGBQUAD* prgb, UINT* pIndex); 44 | 45 | BOOL FindColorIndex(NODE *pNode,BYTE r,BYTE g,BYTE b,int nLevel,UINT *pColorIndex); 46 | 47 | BYTE GetPixelIndex(long x, long y, int nbit, long effwdt, BYTE *pimage); 48 | 49 | int m_nColorBits; 50 | UINT m_nLeafCount; 51 | int m_nMaxColors; 52 | NODE *m_pTree; 53 | NODE *m_pReducibleNodes[9]; 54 | }; 55 | 56 | class CRGBQuantizer: public CQuantizer 57 | { 58 | public: 59 | CRGBQuantizer(UINT nMaxColors, UINT nColorBits); 60 | BOOL ProcessImageRGB (BYTE *pRGBData,UINT nWidth,UINT nHeight); 61 | }; 62 | 63 | class CBitmapQuantizer: public CQuantizer 64 | { 65 | public: 66 | CBitmapQuantizer(UINT nMaxColors, UINT nColorBits); 67 | BOOL ProcessImageBitmap (HBITMAP hBmp); 68 | }; 69 | 70 | 71 | #endif -------------------------------------------------------------------------------- /CreateGif/SelTransparentColorDlg.cpp: -------------------------------------------------------------------------------- 1 | // SelTransparentColorDlg.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "CreateGIF.h" 6 | #include "SelTransparentColorDlg.h" 7 | 8 | #ifdef _DEBUG 9 | #define new DEBUG_NEW 10 | #undef THIS_FILE 11 | static char THIS_FILE[] = __FILE__; 12 | #endif 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | // CSelTransparentColorDlg dialog 16 | 17 | 18 | CSelTransparentColorDlg::CSelTransparentColorDlg(CWnd* pParent /*=NULL*/) 19 | : CDialog(CSelTransparentColorDlg::IDD, pParent) 20 | { 21 | //{{AFX_DATA_INIT(CSelTransparentColorDlg) 22 | // NOTE: the ClassWizard will add member initialization here 23 | //}}AFX_DATA_INIT 24 | m_transparentColorIndex = 0; 25 | } 26 | 27 | 28 | void CSelTransparentColorDlg::DoDataExchange(CDataExchange* pDX) 29 | { 30 | CDialog::DoDataExchange(pDX); 31 | //{{AFX_DATA_MAP(CSelTransparentColorDlg) 32 | // NOTE: the ClassWizard will add DDX and DDV calls here 33 | //}}AFX_DATA_MAP 34 | } 35 | 36 | 37 | BEGIN_MESSAGE_MAP(CSelTransparentColorDlg, CDialog) 38 | //{{AFX_MSG_MAP(CSelTransparentColorDlg) 39 | ON_WM_CTLCOLOR() 40 | ON_WM_LBUTTONDOWN() 41 | //}}AFX_MSG_MAP 42 | END_MESSAGE_MAP() 43 | 44 | ///////////////////////////////////////////////////////////////////////////// 45 | // CSelTransparentColorDlg message handlers 46 | void CSelTransparentColorDlg::SetBitmap(BYTE *pData,BYTE*palette,int nWidth,int nHeight) 47 | { 48 | m_pData = pData; 49 | m_palette = palette; 50 | m_nWidth = nWidth; 51 | m_nHeight = nHeight; 52 | } 53 | 54 | HBRUSH CSelTransparentColorDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 55 | { 56 | HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); 57 | 58 | // TODO: Change any attributes of the DC here 59 | if(pWnd->GetDlgCtrlID() == IDC_STATIC_BMP) 60 | { 61 | for(int i=0; iSetPixel(j,i,RGB(m_palette[nIndex],m_palette[nIndex+1],m_palette[nIndex+2])); 67 | } 68 | } 69 | } 70 | 71 | // TODO: Return a different brush if the default is not desired 72 | return hbr; 73 | } 74 | 75 | void CSelTransparentColorDlg::OnLButtonDown(UINT nFlags, CPoint point) 76 | { 77 | // TODO: Add your message handler code here and/or call default 78 | CPoint pt; 79 | GetCursorPos(&pt); 80 | GetDlgItem(IDC_STATIC_BMP)->ScreenToClient(&pt); 81 | 82 | m_transparentColorIndex = m_pData[pt.y*m_nWidth+pt.x]; 83 | 84 | CDialog::OnLButtonDown(nFlags, point); 85 | } 86 | 87 | void CSelTransparentColorDlg::OnOK() 88 | { 89 | // TODO: Add extra validation here 90 | 91 | CDialog::OnOK(); 92 | } 93 | -------------------------------------------------------------------------------- /CreateGif/SelTransparentColorDlg.h: -------------------------------------------------------------------------------- 1 | #if !defined(AFX_SELTRANSPARENTCOLORDLG_H__9A8C06A1_62C4_477B_A811_14D68184E4DB__INCLUDED_) 2 | #define AFX_SELTRANSPARENTCOLORDLG_H__9A8C06A1_62C4_477B_A811_14D68184E4DB__INCLUDED_ 3 | 4 | #if _MSC_VER > 1000 5 | #pragma once 6 | #endif // _MSC_VER > 1000 7 | // SelTransparentColorDlg.h : header file 8 | // 9 | 10 | ///////////////////////////////////////////////////////////////////////////// 11 | // CSelTransparentColorDlg dialog 12 | 13 | class CSelTransparentColorDlg : public CDialog 14 | { 15 | // Construction 16 | public: 17 | CSelTransparentColorDlg(CWnd* pParent = NULL); // standard constructor 18 | void SetBitmap(BYTE *pData,BYTE*palette,int nWidth,int nHeight); 19 | BYTE m_transparentColorIndex; 20 | 21 | // Dialog Data 22 | //{{AFX_DATA(CSelTransparentColorDlg) 23 | enum { IDD = IDD_DIALOG_SEL_TRANSPARENT_COLOR }; 24 | // NOTE: the ClassWizard will add data members here 25 | //}}AFX_DATA 26 | 27 | 28 | // Overrides 29 | // ClassWizard generated virtual function overrides 30 | //{{AFX_VIRTUAL(CSelTransparentColorDlg) 31 | protected: 32 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 33 | //}}AFX_VIRTUAL 34 | 35 | // Implementation 36 | protected: 37 | BYTE *m_pData; 38 | BYTE *m_palette; 39 | int m_nWidth; 40 | int m_nHeight; 41 | // Generated message map functions 42 | //{{AFX_MSG(CSelTransparentColorDlg) 43 | afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); 44 | afx_msg void OnLButtonDown(UINT nFlags, CPoint point); 45 | virtual void OnOK(); 46 | //}}AFX_MSG 47 | DECLARE_MESSAGE_MAP() 48 | }; 49 | 50 | //{{AFX_INSERT_LOCATION}} 51 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 52 | 53 | #endif // !defined(AFX_SELTRANSPARENTCOLORDLG_H__9A8C06A1_62C4_477B_A811_14D68184E4DB__INCLUDED_) 54 | -------------------------------------------------------------------------------- /DLLMODUL.CPP: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #ifdef _DEBUG 3 | #undef THIS_FILE 4 | static char THIS_FILE[] = __FILE__; 5 | #endif 6 | 7 | #define new DEBUG_NEW 8 | 9 | //////////////////////////////////////////////////////////////////// 10 | 11 | // The following symbol used to force inclusion of this module for _USRDLL 12 | #ifdef _X86_ 13 | extern "C" { int _afxForceUSRDLL; } 14 | #else 15 | extern "C" { int __afxForceUSRDLL; } 16 | #endif -------------------------------------------------------------------------------- /DXBind.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/DXBind.cpp -------------------------------------------------------------------------------- /DXBind.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/DXBind.h -------------------------------------------------------------------------------- /KeyMouse/MyKeyboardNamespace.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/KeyMouse/MyKeyboardNamespace.cpp -------------------------------------------------------------------------------- /KeyMouse/MyKeyboardNamespace.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/KeyMouse/MyKeyboardNamespace.h -------------------------------------------------------------------------------- /KeyMouse/MyMouseNamespace.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/KeyMouse/MyMouseNamespace.cpp -------------------------------------------------------------------------------- /KeyMouse/MyMouseNamespace.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/KeyMouse/MyMouseNamespace.h -------------------------------------------------------------------------------- /MapFile.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/MapFile.cpp -------------------------------------------------------------------------------- /MapFile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | LPVOID HookIMEdllIAT(char *SouceMode,char* hookdll); 4 | class CMapFile 5 | { 6 | public: 7 | CMapFile(char * pPath,bool bWrite,PVOID &pMap,DWORD &dwFileSize); 8 | ~CMapFile(void); 9 | private : 10 | HANDLE hFileHandle; 11 | HANDLE hFileMapHandle; 12 | PVOID &pImageView; 13 | DWORD &dwSize; 14 | }; 15 | 16 | 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TSPlug 天使插件 2 | 3 | 天使插件是长沙简单软件有限公司2012年与合作开发者合作开发,由于近段时间一直没未更新,长沙简单软件科技有限公司经商议决定,将天使4.019版本代码开源,希望有兴趣的朋友,能够将天使插件的功能继续维护下去,同时也希望各位朋友遵循相关开源协议. 4 | 5 | 我的博客:[www.gaojunxin.cn](https://www.gaojunxin.cn) 6 | ## 开源的原因 7 | 8 | TC官方之前已经宣布了停止开发天使插件,我们认为大漠已经很成熟了,所以我们也解散了合作开发团队,但是因为现在大漠也不在对外更新(当然这个只是我们听到很多作者的反馈),很多作者都很担心如果没有一款后台DX插件了要怎么办,TC官方经过讨论后不再继续开发天使插件,所以我们决定把天使源码开源,希望后台插件会继续发展. 9 | 10 | 开源代码中,DX后台功能源码完全开放,无任何保留部分,且长沙简单软件开发有限公司对于此源码将不做后期维护.各位感兴趣的朋友可以自行修改,发布. 11 | 12 | ## 编译环境 13 | 14 | 1,本插件使用VC2008开发,使用C++语言,和极少的汇编语言开发. 15 | 2,本插件可以直接编译生成,如果不能直接编译的,请自行安装 DirectX sdk (DXSDK_Feb10.exe),配置相关环境,环境配置请,参考DirectX游戏开发的 16 | 17 | ![image.png](http://image.gaojunxin.cn/i/2024/01/23/65af683338132.png) 18 | 19 | 20 | 可以直接编译DLL 21 | 22 | TS插件使用方法 23 | 24 | TS插件遵循COM规范编写支持任何高级语言调用 25 | 26 | ``` 27 | 1、注册插件. 28 | 使用TS之前,首先必须得先注册TS—>注册 29 | 方法1: 开始->运行-> "Regsvr32 c:\\TSPlug.dll" 30 | 方法2: 用TC自带的 "TC插件辅助工具" 注册 31 | 方法3: 用TC注册命令 help.regdll("c:\\TSPlug.dll",true) 32 | 2、创建对象. 33 | 插件注册成功以后,我们接下来要做的工具就是如何使用插件里的功能—>创建对象 34 | 方法1: ts=com("ts.tssoft") 35 | (注意:这里创建的对象在TC里面是区分大小写的) 36 | 3、调用接口. 37 | 插件注册成功了,对象也创建成功了,接下来我们就可以开始工了—>接口的调用 38 | 代码还是TC的代码,简单写两个吧,大家都懂的 39 | ret=ts.BindWindow(hwnd,"dx","dx","dx",0) 40 | if(ret==1) 41 | help.messagebox("绑定成功") 42 | else 43 | help.messagebox("绑定失败") 44 | endif 45 | ``` 46 | 47 | ## 说明 48 | 说明文档在源码根目录下:Ts.chm 49 | 50 | ![image.png](http://image.gaojunxin.cn/i/2024/01/23/65af688ea14dc.png) -------------------------------------------------------------------------------- /ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | 活动模板库 : TSPlug 项目概述 3 | ======================================================================== 4 | 5 | 应用程序向导已为您创建了此 TSPlug 项目,作为编写动态链接库 (DLL) 的起点。 6 | 7 | 本文件概要介绍组成项目的每个文件的内容。 8 | 9 | TSPlug.vcproj 10 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件, 11 | 其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 12 | 13 | TSPlug.idl 14 | 此文件包含项目中定义的类型库、接口和 co-class 的 IDL 定义。 15 | 此文件将由 MIDL 编译器进行处理以生成: 16 | C++ 接口定义和 GUID 声明 (TSPlug.h) 17 | GUID 定义 (TSPlug_i.c) 18 | 类型库 (TSPlug.tlb) 19 | 封送处理代码 (TSPlug_p.c 和 dlldata.c) 20 | 21 | TSPlug.h 22 | 此文件包含 TSPlug.idl 中定义的项目的 C++ 接口定义和 GUID 声明。它将在编译过程中由 MIDL 重新生成。 23 | 24 | TSPlug.cpp 25 | 此文件包含对象映射和 DLL 导出的实现。 26 | 27 | TSPlug.rc 28 | 这是程序使用的所有 Microsoft Windows 资源的列表。 29 | 30 | TSPlug.def 31 | 此模块定义文件为链接器提供有关 DLL 所要求的导出的信息,其中包含用于以下内容的导出: 32 | DllGetClassObject 33 | DllCanUnloadNow 34 | DllRegisterServer 35 | DllUnregisterServer 36 | 37 | ///////////////////////////////////////////////////////////////////////////// 38 | 其他标准文件: 39 | 40 | StdAfx.h, StdAfx.cpp 41 | 这些文件用于生成名为 TSPlug.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 42 | 43 | Resource.h 44 | 这是用于定义资源 ID 的标准头文件。 45 | 46 | ///////////////////////////////////////////////////////////////////////////// 47 | 代理/存根 (stub) DLL 项目和模块定义文件: 48 | 49 | TSPlugps.vcproj 50 | 此文件是用于生成代理/存根 (stub) DLL 的项目文件(若有必要)。 51 | 主项目中的 IDL 文件必须至少包含一个接口,并且 52 | 在生成代理/存根 (stub) DLL 之前必须先编译 IDL 文件。 此进程生成 53 | dlldata.c、TSPlug_i.c 和 TSPlug_p.c,这些文件是 54 | 生成代理/存根 (stub) DLL 所必需的。 55 | 56 | TSPlugps.def 57 | 此模块定义文件为链接器提供有关代理/存根 (stub) 所要求的导出的信息。 58 | 59 | ///////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /TCProtect_se: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TCProtect_se -------------------------------------------------------------------------------- /TCProtect_se.sys.tyuyan#$%0409zlc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TCProtect_se.sys.tyuyan#$%0409zlc -------------------------------------------------------------------------------- /TSFindPicture.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSFindPicture.cpp -------------------------------------------------------------------------------- /TSFindPicture.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSFindPicture.h -------------------------------------------------------------------------------- /TSHookFuntion.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSHookFuntion.h -------------------------------------------------------------------------------- /TSMemoryAPI.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSMemoryAPI.cpp -------------------------------------------------------------------------------- /TSMemoryAPI.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSMemoryAPI.h -------------------------------------------------------------------------------- /TSMessage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSMessage.h -------------------------------------------------------------------------------- /TSMyKernel32DllFuntion.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "TSMemoryAPI.h" 3 | 4 | typedef HANDLE(__stdcall *myOpenProcess)( DWORD fdwAccess, BOOL fInherit, DWORD IDProcess); 5 | 6 | 7 | typedef bool (__stdcall * myVirtualProtect)(LPVOID lpAddress,DWORD dwSize,DWORD flNewProtect, PDWORD lpflOldProtect); 8 | 9 | typedef BOOL (__stdcall * myVirtualProtectEx)( HANDLE hProcess, LPVOID lpAddress,SIZE_T dwSize,DWORD flNewProtect, PDWORD lpflOldProtect); 10 | 11 | typedef BOOL(__stdcall *myReadProcessMemory)( HANDLE hProcess, LPCVOID lpBaseAddress, 12 | LPVOID lpBuffer, DWORD nSize, LPDWORD lpNumberOfBytesRead ); 13 | 14 | 15 | 16 | typedef bool (__stdcall * myWriteProcessMemory)( HANDLE hProcess, 17 | LPVOID lpBaseAddress, 18 | LPVOID lpBuffer, 19 | DWORD nSize, 20 | LPDWORD lpNumberOfBytesWritten); 21 | 22 | typedef BOOL (__stdcall * myTerminateProcess)( HANDLE hProcess, DWORD uExitCode); 23 | 24 | typedef HANDLE (__stdcall * myCreateRemoteThread)( __in HANDLE hProcess, 25 | __in LPSECURITY_ATTRIBUTES lpThreadAttributes, 26 | __in SIZE_T dwStackSize, 27 | __in LPTHREAD_START_ROUTINE lpStartAddress, 28 | __in LPVOID lpParameter, 29 | __in DWORD dwCreationFlags, 30 | __out LPDWORD lpThreadId 31 | ); 32 | 33 | typedef BOOL (__stdcall * myDeviceIoControl)( HANDLE hDevice, DWORD dwIoControlCode, 34 | LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, 35 | DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped); 36 | 37 | typedef NTSTATUS (__stdcall *myZwOpenProcess) (__out PHANDLE ProcessHandle,__in ACCESS_MASK DesiredAccess, 38 | __in POBJECT_ATTRIBUTES ObjectAttributes,__in_opt PCLIENT_ID ClientId); 39 | 40 | typedef DWORD (__stdcall *myGetTickCount)(); 41 | 42 | typedef void (__stdcall *mySleep)(DWORD dwMilliseconds); 43 | 44 | 45 | 46 | bool InitialMykernel32Dll(); 47 | bool InitialMykernel32DllWIN7(); 48 | 49 | 50 | -------------------------------------------------------------------------------- /TSMyKernel32User32DllFuntion.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "TSMyUser32DllFuntion.h" 3 | #include "TSMyKernel32DllFuntion.h" 4 | #include "TSRuntime.h" 5 | 6 | myWindowFromPoint my_WindowFromPoint=NULL; 7 | myGetWindowLong my_GetWindowLong=NULL; 8 | myFindWindowEx my_FindWindowEx=NULL; 9 | mySendMessage my_SendMessage=NULL; 10 | myPostMessage my_PostMessage=NULL; 11 | myGetWindowThreadProcessId my_GetWindowThreadProcessId=NULL; 12 | myFindWindow my_FindWindow=NULL; 13 | myGetWindow my_GetWindow=NULL; 14 | myScreenToClient my_ScreenToClient=NULL; 15 | myClientToScreen my_ClientToScreen=NULL; 16 | myGetCursorPos my_GetCursorPos=NULL; 17 | myIsWindow my_IsWindow=NULL; 18 | 19 | myZwOpenProcess my_ZwOpenProcess=NULL; 20 | myOpenProcess my_OpenProcess=NULL; 21 | myVirtualProtect my_VirtualProtect=NULL; 22 | myVirtualProtectEx my_VirtualProtectEx=NULL; 23 | myReadProcessMemory my_ReadProcessMemory=NULL; 24 | myWriteProcessMemory my_WriteProcessMemory=NULL; 25 | myTerminateProcess my_TerminateProcess=NULL; 26 | myCreateRemoteThread my_CreateRemoteThread=NULL; 27 | myDeviceIoControl my_DeviceIoControl=NULL; 28 | myGetTickCount my_myGetTickCount=NULL; 29 | mySleep my_sleep=NULL; 30 | 31 | bool InitialMykernel32DllWIN7() 32 | { 33 | bool bret=false; 34 | //my_ZwOpenProcess 35 | HMODULE hmod=::LoadLibrary(L"ntdll.dll"); 36 | if(hmod) 37 | { 38 | my_ZwOpenProcess=(myZwOpenProcess)::GetProcAddress(hmod,"ZwOpenProcess"); 39 | if(my_ZwOpenProcess!=NULL) 40 | bret=true; 41 | } 42 | 43 | return bret; 44 | 45 | } 46 | 47 | bool InitialMykernel32Dll() 48 | { 49 | bool bret=false; 50 | 51 | my_OpenProcess=(myOpenProcess)TSRuntime::GetPassR3HookFuntionAddr("kernel32.dll","OpenProcess"); 52 | my_VirtualProtect=(myVirtualProtect)TSRuntime::GetPassR3HookFuntionAddr("kernel32.dll","VirtualProtect"); 53 | my_ReadProcessMemory=(myReadProcessMemory)TSRuntime::GetPassR3HookFuntionAddr("kernel32.dll","ReadProcessMemory"); 54 | my_WriteProcessMemory=(myWriteProcessMemory)TSRuntime::GetPassR3HookFuntionAddr("kernel32.dll","WriteProcessMemory"); 55 | my_TerminateProcess=(myTerminateProcess)TSRuntime::GetPassR3HookFuntionAddr("kernel32.dll","TerminateProcess"); 56 | my_VirtualProtectEx=(myVirtualProtectEx)TSRuntime::GetPassR3HookFuntionAddr("kernel32.dll","VirtualProtectEx"); 57 | my_CreateRemoteThread=(myCreateRemoteThread)TSRuntime::GetPassR3HookFuntionAddr("kernel32.dll","CreateRemoteThread"); 58 | my_DeviceIoControl=(myDeviceIoControl)TSRuntime::GetPassR3HookFuntionAddr("kernel32.dll","DeviceIoControl"); 59 | my_myGetTickCount=(myGetTickCount)TSRuntime::GetPassR3HookFuntionAddr("kernel32.dll","GetTickCount"); 60 | my_sleep=(mySleep)TSRuntime::GetPassR3HookFuntionAddr("kernel32.dll","Sleep"); 61 | //my_ScreenToClient=(myScreenToClient)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","ScreenToClient"); 62 | //my_GetWindow=(myGetWindow)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","GetWindow"); 63 | //my_FindWindow=(myFindWindow)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","FindWindowW"); 64 | //my_WindowFromPoint=(myWindowFromPoint)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","WindowFromPoint"); 65 | //my_GetWindowLong=(myGetWindowLong)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","GetWindowLongW"); 66 | //my_FindWindowEx=(myFindWindowEx)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","FindWindowExW"); 67 | 68 | //TSRuntime::add_log( "my_GetCursorPos:%d,my_ClientToScreen:%d,my_ScreenToClient:%d,my_GetWindow:%d,my_FindWindow:%d,my_WindowFromPoint:%d,my_GetWindowLong:%d,my_FindWindowEx:%d",my_GetCursorPos,my_ClientToScreen 69 | // ,my_ScreenToClient,my_GetWindow,my_FindWindow,my_WindowFromPoint,my_GetWindowLong,my_FindWindowEx); 70 | if(my_OpenProcess==NULL 71 | ||my_VirtualProtect==NULL 72 | ||my_WriteProcessMemory==NULL 73 | ||my_ReadProcessMemory==NULL 74 | ||my_VirtualProtectEx==NULL 75 | ||my_TerminateProcess==NULL 76 | ||my_CreateRemoteThread==NULL) 77 | return bret; 78 | else 79 | bret=true; 80 | 81 | return bret; 82 | } 83 | 84 | 85 | bool InitialMyUser32Dll() 86 | { 87 | bool bret=false; 88 | my_GetCursorPos=(myGetCursorPos)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","GetCursorPos"); 89 | my_ClientToScreen=(myClientToScreen)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","ClientToScreen"); 90 | my_ScreenToClient=(myScreenToClient)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","ScreenToClient"); 91 | my_GetWindow=(myGetWindow)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","GetWindow"); 92 | my_FindWindow=(myFindWindow)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","FindWindowW"); 93 | my_WindowFromPoint=(myWindowFromPoint)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","WindowFromPoint"); 94 | my_GetWindowLong=(myGetWindowLong)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","GetWindowLongW"); 95 | my_FindWindowEx=(myFindWindowEx)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","FindWindowExW"); 96 | my_SendMessage=(mySendMessage)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","SendMessageW"); 97 | my_PostMessage=(myPostMessage)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","PostMessageW"); 98 | my_GetWindowThreadProcessId=(myGetWindowThreadProcessId)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","GetWindowThreadProcessId"); 99 | my_IsWindow=(myIsWindow)TSRuntime::GetPassR3HookFuntionAddr("user32.dll","IsWindow"); 100 | 101 | //TSRuntime::add_log( "my_GetCursorPos:%d,my_ClientToScreen:%d,my_ScreenToClient:%d,my_GetWindow:%d,my_FindWindow:%d,my_WindowFromPoint:%d,my_GetWindowLong:%d,my_FindWindowEx:%d",my_GetCursorPos,my_ClientToScreen 102 | // ,my_ScreenToClient,my_GetWindow,my_FindWindow,my_WindowFromPoint,my_GetWindowLong,my_FindWindowEx); 103 | if(my_GetCursorPos==NULL 104 | ||my_ClientToScreen==NULL 105 | ||my_ScreenToClient==NULL 106 | ||my_GetWindow==NULL 107 | ||my_FindWindow==NULL 108 | ||my_WindowFromPoint==NULL 109 | ||my_GetWindowLong==NULL 110 | ||my_FindWindowEx==NULL 111 | ||my_SendMessage==NULL 112 | ||my_PostMessage==NULL) 113 | return bret; 114 | else 115 | bret=true; 116 | 117 | return bret; 118 | } -------------------------------------------------------------------------------- /TSMyUser32DllFuntion.h: -------------------------------------------------------------------------------- 1 | //#if !defined(TSMYUSER32DLLFUNTION_H) 2 | //#define TSMYUSER32DLLFUNTION_H 3 | 4 | #pragma once 5 | 6 | 7 | typedef bool (_stdcall * myGetCursorPos)( LPPOINT lpPoint); 8 | 9 | 10 | typedef bool (_stdcall * myClientToScreen)(HWND hWnd,LPPOINT lpPoint); 11 | 12 | 13 | typedef bool (_stdcall * myScreenToClient)( HWND hWnd,LPPOINT lpPoint); 14 | 15 | 16 | typedef HWND (_stdcall *myGetWindow)(HWND hWnd,UINT uCmd ); 17 | 18 | 19 | typedef HWND (_stdcall *myFindWindow)( LPCTSTR lpClassName, LPCTSTR lpWindowName ); 20 | 21 | 22 | typedef HWND (_stdcall *myWindowFromPoint)( POINT Point ); 23 | 24 | 25 | typedef LONG (_stdcall *myGetWindowLong)( HWND hWnd, int nIndex); 26 | 27 | 28 | typedef HWND (_stdcall *myFindWindowEx)( HWND hwndParent,HWND hwndChildAfter,LPCTSTR lpszClass,LPCTSTR lpszWindow); 29 | 30 | 31 | typedef LRESULT (_stdcall *mySendMessage)(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam ); 32 | 33 | 34 | typedef bool (_stdcall *myPostMessage)(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam ); 35 | 36 | 37 | typedef DWORD (_stdcall *myGetWindowThreadProcessId)( HWND hWnd, LPDWORD lpdwProcessId ); 38 | 39 | typedef BOOL (_stdcall *myIsWindow)( HWND hWnd ); 40 | 41 | bool InitialMyUser32Dll(); 42 | 43 | 44 | 45 | //#endif 46 | 47 | -------------------------------------------------------------------------------- /TSPlug.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSPlug.aps -------------------------------------------------------------------------------- /TSPlug.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSPlug.cpp -------------------------------------------------------------------------------- /TSPlug.def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSPlug.def -------------------------------------------------------------------------------- /TSPlug.idl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSPlug.idl -------------------------------------------------------------------------------- /TSPlug.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSPlug.rc -------------------------------------------------------------------------------- /TSPlug.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove AppID 4 | { 5 | '%APPID%' = s 'TSPlug' 6 | 'TSPlug.DLL' 7 | { 8 | val AppID = s '%APPID%' 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /TSPlug.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TSPlug", "TSPlug.vcxproj", "{0762D45C-EC2D-45A8-B44E-557D0D4326F4}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TSPlugPS", "TSPlugPS.vcxproj", "{F7CCD322-F28F-4A26-B9B7-EF2C64919DA6}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {0762D45C-EC2D-45A8-B44E-557D0D4326F4}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {0762D45C-EC2D-45A8-B44E-557D0D4326F4}.Debug|Win32.Build.0 = Debug|Win32 16 | {0762D45C-EC2D-45A8-B44E-557D0D4326F4}.Release|Win32.ActiveCfg = Release|Win32 17 | {0762D45C-EC2D-45A8-B44E-557D0D4326F4}.Release|Win32.Build.0 = Release|Win32 18 | {F7CCD322-F28F-4A26-B9B7-EF2C64919DA6}.Debug|Win32.ActiveCfg = Debug|Win32 19 | {F7CCD322-F28F-4A26-B9B7-EF2C64919DA6}.Debug|Win32.Build.0 = Debug|Win32 20 | {F7CCD322-F28F-4A26-B9B7-EF2C64919DA6}.Release|Win32.ActiveCfg = Release|Win32 21 | {F7CCD322-F28F-4A26-B9B7-EF2C64919DA6}.Release|Win32.Build.0 = Release|Win32 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /TSPlug.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSPlug.vcproj -------------------------------------------------------------------------------- /TSPlug.vcproj.think-THINK.Administrator.user: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSPlug.vcproj.think-THINK.Administrator.user -------------------------------------------------------------------------------- /TSPlug.vcproj.zlc-PC.zlc.user: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSPlug.vcproj.zlc-PC.zlc.user -------------------------------------------------------------------------------- /TSPlug.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {0762D45C-EC2D-45A8-B44E-557D0D4326F4} 15 | TSPlug 16 | AtlProj 17 | 18 | 19 | 20 | DynamicLibrary 21 | v110 22 | Static 23 | Unicode 24 | 25 | 26 | DynamicLibrary 27 | v110 28 | Static 29 | Unicode 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <_ProjectFileVersion>11.0.61030.0 43 | 44 | 45 | $(Configuration)\ 46 | $(Configuration)\ 47 | true 48 | true 49 | 50 | 51 | $(Configuration)\ 52 | $(Configuration)\ 53 | true 54 | false 55 | 56 | 57 | 58 | _DEBUG;%(PreprocessorDefinitions) 59 | false 60 | Win32 61 | true 62 | $(IntDir)TSPlug.tlb 63 | TSPlug_i.h 64 | 65 | TSPlug_i.c 66 | TSPlug_p.c 67 | true 68 | 69 | 70 | Disabled 71 | WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) 72 | true 73 | EnableFastChecks 74 | MultiThreadedDebugDLL 75 | Use 76 | Level3 77 | EditAndContinue 78 | 79 | 80 | _DEBUG;%(PreprocessorDefinitions) 81 | 0x0804 82 | $(IntDir);%(AdditionalIncludeDirectories) 83 | 84 | 85 | true 86 | .\TSPlug.def 87 | true 88 | Windows 89 | MachineX86 90 | 91 | 92 | 93 | 94 | NDEBUG;%(PreprocessorDefinitions) 95 | false 96 | Win32 97 | true 98 | $(IntDir)TSPlug.tlb 99 | TSPlug_i.h 100 | 101 | TSPlug_i.c 102 | TSPlug_p.c 103 | true 104 | 105 | 106 | MaxSpeed 107 | WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) 108 | MultiThreaded 109 | Use 110 | Level3 111 | ProgramDatabase 112 | 113 | 114 | NDEBUG;%(PreprocessorDefinitions) 115 | 0x0804 116 | $(IntDir);%(AdditionalIncludeDirectories) 117 | 118 | 119 | true 120 | .\TSPlug.def 121 | true 122 | Windows 123 | true 124 | true 125 | MachineX86 126 | 127 | 128 | 129 | 130 | 131 | 132 | false 133 | 134 | 135 | false 136 | 137 | 138 | 139 | 140 | Create 141 | Create 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | false 150 | 151 | 152 | false 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | -------------------------------------------------------------------------------- /TSPlug.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 6 | h;hpp;hxx;hm;inl;inc;xsd 7 | 8 | 9 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 10 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 11 | 12 | 13 | {c38e14f2-5e6c-4411-ad94-959870b1b1e4} 14 | False 15 | 16 | 17 | {5e5d53e4-fcd9-4ac9-8d3d-8eb33274dee6} 18 | 19 | 20 | {8b9d1d94-300b-48d0-b72e-5633c319d8bc} 21 | 22 | 23 | {b05630f9-33ad-442a-ba62-7c5a581c2c47} 24 | 25 | 26 | {f9a9b1ce-564b-49f8-b4ca-c642bb9c6e9f} 27 | 28 | 29 | {7d90305c-df64-4136-a969-9cd7527db653} 30 | 31 | 32 | {1d3f8305-1855-4375-8eaf-ff5f350a5444} 33 | 34 | 35 | 36 | 37 | TSPlug 38 | 39 | 40 | TSPlug 41 | 42 | 43 | TSPlug 44 | 45 | 46 | TSPlug 47 | 48 | 49 | TSPlug 50 | 51 | 52 | 生成的文件 53 | 54 | 55 | DX后台 56 | 57 | 58 | DX后台 59 | 60 | 61 | DX后台 62 | 63 | 64 | CreateGif 65 | 66 | 67 | CreateGif 68 | 69 | 70 | 窗口API 71 | 72 | 73 | 内存API 74 | 75 | 76 | ASM 77 | 78 | 79 | ASM 80 | 81 | 82 | ASM 83 | 84 | 85 | kd 86 | 87 | 88 | kd 89 | 90 | 91 | 92 | 93 | TSPlug 94 | 95 | 96 | TSPlug 97 | 98 | 99 | TSPlug 100 | 101 | 102 | TSPlug 103 | 104 | 105 | TSPlug 106 | 107 | 108 | 生成的文件 109 | 110 | 111 | DX后台 112 | 113 | 114 | DX后台 115 | 116 | 117 | DX后台 118 | 119 | 120 | DX后台 121 | 122 | 123 | DX后台 124 | 125 | 126 | DX后台 127 | 128 | 129 | CreateGif 130 | 131 | 132 | CreateGif 133 | 134 | 135 | 窗口API 136 | 137 | 138 | 内存API 139 | 140 | 141 | ASM 142 | 143 | 144 | ASM 145 | 146 | 147 | kd 148 | 149 | 150 | kd 151 | 152 | 153 | 154 | 155 | TSPlug 156 | 157 | 158 | 资源文件 159 | 160 | 161 | 资源文件 162 | 163 | 164 | 165 | 166 | 167 | 168 | TSPlug 169 | 170 | 171 | 172 | 173 | 资源文件 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /TSPlug.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | F:\VB\ts测试\工程1.exe 5 | WindowsLocalDebugger 6 | 7 | 8 | F:\VB\ts测试\工程1.exe 9 | WindowsLocalDebugger 10 | 11 | -------------------------------------------------------------------------------- /TSPlugInterFace.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSPlugInterFace.cpp -------------------------------------------------------------------------------- /TSPlugInterFace.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSPlugInterFace.h -------------------------------------------------------------------------------- /TSPlugInterFace.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | Ts.TsSoft = s 'TSPlugInterFace Class' 4 | { 5 | CLSID = s '{BCE4A484-C3BC-418B-B1F6-69D6987C126B}' 6 | CurVer = s 'Ts.TsSoft' 7 | } 8 | NoRemove CLSID 9 | { 10 | ForceRemove {BCE4A484-C3BC-418B-B1F6-69D6987C126B} = s 'TSPlugInterFace Class' 11 | { 12 | ProgID = s 'Ts.TsSoft' 13 | InprocServer32 = s '%MODULE%' 14 | { 15 | val ThreadingModel = s 'Apartment' 16 | } 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /TSPlugPS.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSPlugPS.vcproj -------------------------------------------------------------------------------- /TSPlugPS.vcproj.think-THINK.Administrator.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /TSPlugPS.vcproj.zlc-PC.zlc.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /TSPlugPS.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {F7CCD322-F28F-4A26-B9B7-EF2C64919DA6} 15 | AtlPSProj 16 | 17 | 18 | 19 | DynamicLibrary 20 | v110 21 | Unicode 22 | 23 | 24 | DynamicLibrary 25 | v110 26 | Unicode 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | <_ProjectFileVersion>11.0.61030.0 40 | 41 | 42 | $(Configuration)PS\ 43 | $(Configuration)PS\ 44 | 45 | 46 | $(Configuration)PS\ 47 | $(Configuration)PS\ 48 | 49 | 50 | 51 | 检查是否有所需的文件 52 | if exist dlldata.c goto :END 53 | Echo 错误: MIDL 将不会生成 DLLDATA.C,除非在主项目中至少有 1 个接口。 54 | Exit 1 55 | :END 56 | 57 | 58 | 59 | WIN32;_WIN32_WINNT=0x0500;REGISTER_PROXY_DLL;_DEBUG;%(PreprocessorDefinitions) 60 | MultiThreadedDebugDLL 61 | 62 | 63 | true 64 | kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies) 65 | TSPlugPS.def 66 | 67 | 68 | 69 | 70 | 检查是否有所需的文件 71 | if exist dlldata.c goto :END 72 | Echo 错误: MIDL 将不会生成 DLLDATA.C,除非在主项目中至少有 1 个接口。 73 | Exit 1 74 | :END 75 | 76 | 77 | 78 | MaxSpeed 79 | WIN32;_WIN32_WINNT=0x0500;REGISTER_PROXY_DLL;NDEBUG;%(PreprocessorDefinitions) 80 | MultiThreadedDLL 81 | 82 | 83 | true 84 | kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies) 85 | TSPlugPS.def 86 | true 87 | true 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /TSPlugPS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {3935196a-7aee-4abd-be53-002da619eb89} 6 | 7 | 8 | {ed871c01-b745-47e6-8ecc-9022b9f174da} 9 | False 10 | 11 | 12 | 13 | 14 | 生成的文件 15 | 16 | 17 | 生成的文件 18 | 19 | 20 | 生成的文件 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /TSPlug_i.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ 4 | 5 | /* link this file in with the server and any clients */ 6 | 7 | 8 | /* File created by MIDL compiler version 8.00.0595 */ 9 | /* at Sun Sep 14 16:36:22 2014 10 | */ 11 | /* Compiler settings for TSPlug.idl: 12 | Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0595 13 | protocol : dce , ms_ext, c_ext, robust 14 | error checks: allocation ref bounds_check enum stub_data 15 | VC __declspec() decoration level: 16 | __declspec(uuid()), __declspec(selectany), __declspec(novtable) 17 | DECLSPEC_UUID(), MIDL_INTERFACE() 18 | */ 19 | /* @@MIDL_FILE_HEADING( ) */ 20 | 21 | #pragma warning( disable: 4049 ) /* more than 64k source lines */ 22 | 23 | 24 | #ifdef __cplusplus 25 | extern "C"{ 26 | #endif 27 | 28 | 29 | #include 30 | #include 31 | 32 | #ifdef _MIDL_USE_GUIDDEF_ 33 | 34 | #ifndef INITGUID 35 | #define INITGUID 36 | #include 37 | #undef INITGUID 38 | #else 39 | #include 40 | #endif 41 | 42 | #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ 43 | DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) 44 | 45 | #else // !_MIDL_USE_GUIDDEF_ 46 | 47 | #ifndef __IID_DEFINED__ 48 | #define __IID_DEFINED__ 49 | 50 | typedef struct _IID 51 | { 52 | unsigned long x; 53 | unsigned short s1; 54 | unsigned short s2; 55 | unsigned char c[8]; 56 | } IID; 57 | 58 | #endif // __IID_DEFINED__ 59 | 60 | #ifndef CLSID_DEFINED 61 | #define CLSID_DEFINED 62 | typedef IID CLSID; 63 | #endif // CLSID_DEFINED 64 | 65 | #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ 66 | const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} 67 | 68 | #endif !_MIDL_USE_GUIDDEF_ 69 | 70 | MIDL_DEFINE_GUID(IID, IID_ITSPlugInterFace,0xF3E95C10,0x606A,0x474E,0xBB,0x4A,0xB9,0xCC,0xBF,0x7D,0xB5,0x59); 71 | 72 | 73 | MIDL_DEFINE_GUID(IID, LIBID_TSPlugLib,0x525CF7E5,0xDB36,0x491F,0xA9,0x1C,0x2D,0xB8,0x6E,0x67,0x12,0x6D); 74 | 75 | 76 | MIDL_DEFINE_GUID(CLSID, CLSID_TSPlugInterFace,0xBCE4A484,0xC3BC,0x418B,0xB1,0xF6,0x69,0xD6,0x98,0x7C,0x12,0x6B); 77 | 78 | #undef MIDL_DEFINE_GUID 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /TSPlugps.def: -------------------------------------------------------------------------------- 1 | 2 | LIBRARY "TSPlugPS" 3 | 4 | EXPORTS 5 | DllGetClassObject PRIVATE 6 | DllCanUnloadNow PRIVATE 7 | DllRegisterServer PRIVATE 8 | DllUnregisterServer PRIVATE 9 | -------------------------------------------------------------------------------- /TSRuntime.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSRuntime.cpp -------------------------------------------------------------------------------- /TSRuntime.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSRuntime.h -------------------------------------------------------------------------------- /TSVIPHookFuntion.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSVIPHookFuntion.h -------------------------------------------------------------------------------- /TSWindowsAPI.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSWindowsAPI.cpp -------------------------------------------------------------------------------- /TSWindowsAPI.cpp~RF14b6222.TMP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSWindowsAPI.cpp~RF14b6222.TMP -------------------------------------------------------------------------------- /TSWindowsAPI.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/TSWindowsAPI.h -------------------------------------------------------------------------------- /Toolhelp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Module: Toolhelp.h 3 | Notices: Copyright (c) 2000 Jeffrey Richter 4 | ******************************************************************************/ 5 | 6 | 7 | #pragma once 8 | 9 | 10 | /////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | //#include "..\CmnHdr.h" /* See Appendix A. */ 14 | #include 15 | #include 16 | 17 | 18 | /////////////////////////////////////////////////////////////////////////////// 19 | 20 | 21 | class CToolhelp { 22 | private: 23 | HANDLE m_hSnapshot; 24 | 25 | public: 26 | CToolhelp(DWORD dwFlags = 0, DWORD dwProcessID = 0); 27 | ~CToolhelp(); 28 | 29 | BOOL CreateSnapshot(DWORD dwFlags, DWORD dwProcessID = 0); 30 | 31 | BOOL ProcessFirst(PPROCESSENTRY32 ppe) const; 32 | BOOL ProcessNext(PPROCESSENTRY32 ppe) const; 33 | BOOL ProcessFind(DWORD dwProcessId, PPROCESSENTRY32 ppe) const; 34 | 35 | BOOL ModuleFirst(PMODULEENTRY32 pme) const; 36 | BOOL ModuleNext(PMODULEENTRY32 pme) const; 37 | BOOL ModuleFind(PVOID pvBaseAddr, PMODULEENTRY32 pme) const; 38 | BOOL ModuleFind(PTSTR pszModName, PMODULEENTRY32 pme) const; 39 | 40 | BOOL ThreadFirst(PTHREADENTRY32 pte) const; 41 | BOOL ThreadNext(PTHREADENTRY32 pte) const; 42 | 43 | BOOL HeapListFirst(PHEAPLIST32 phl) const; 44 | BOOL HeapListNext(PHEAPLIST32 phl) const; 45 | int HowManyHeaps() const; 46 | 47 | // Note: The heap block functions do not reference a snapshot and 48 | // just walk the process's heap from the beginning each time. Infinite 49 | // loops can occur if the target process changes its heap while the 50 | // functions below are enumerating the blocks in the heap. 51 | BOOL HeapFirst(PHEAPENTRY32 phe, DWORD dwProcessID, 52 | UINT_PTR dwHeapID) const; 53 | BOOL HeapNext(PHEAPENTRY32 phe) const; 54 | int HowManyBlocksInHeap(DWORD dwProcessID, DWORD dwHeapId) const; 55 | BOOL IsAHeap(HANDLE hProcess, PVOID pvBlock, PDWORD pdwFlags) const; 56 | 57 | public: 58 | static BOOL EnableDebugPrivilege(BOOL fEnable = TRUE); 59 | static BOOL ReadProcessMemory(DWORD dwProcessID, LPCVOID pvBaseAddress, 60 | PVOID pvBuffer, DWORD cbRead, PDWORD pdwNumberOfBytesRead = NULL); 61 | }; 62 | 63 | 64 | /////////////////////////////////////////////////////////////////////////////// 65 | 66 | 67 | inline CToolhelp::CToolhelp(DWORD dwFlags, DWORD dwProcessID) { 68 | 69 | m_hSnapshot = INVALID_HANDLE_VALUE; 70 | CreateSnapshot(dwFlags, dwProcessID); 71 | } 72 | 73 | 74 | /////////////////////////////////////////////////////////////////////////////// 75 | 76 | 77 | inline CToolhelp::~CToolhelp() { 78 | 79 | if (m_hSnapshot != INVALID_HANDLE_VALUE) 80 | CloseHandle(m_hSnapshot); 81 | } 82 | 83 | 84 | /////////////////////////////////////////////////////////////////////////////// 85 | 86 | 87 | inline BOOL CToolhelp::CreateSnapshot(DWORD dwFlags, DWORD dwProcessID) { 88 | 89 | if (m_hSnapshot != INVALID_HANDLE_VALUE) 90 | CloseHandle(m_hSnapshot); 91 | 92 | if (dwFlags == 0) { 93 | m_hSnapshot = INVALID_HANDLE_VALUE; 94 | } else { 95 | m_hSnapshot = CreateToolhelp32Snapshot(dwFlags, dwProcessID); 96 | } 97 | return(m_hSnapshot != INVALID_HANDLE_VALUE); 98 | } 99 | 100 | 101 | /////////////////////////////////////////////////////////////////////////////// 102 | 103 | 104 | inline BOOL CToolhelp::EnableDebugPrivilege(BOOL fEnable) { 105 | 106 | // Enabling the debug privilege allows the application to see 107 | // information about service applications 108 | BOOL fOk = FALSE; // Assume function fails 109 | HANDLE hToken; 110 | 111 | // Try to open this process's access token 112 | if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, 113 | &hToken)) { 114 | 115 | // Attempt to modify the "Debug" privilege 116 | TOKEN_PRIVILEGES tp; 117 | tp.PrivilegeCount = 1; 118 | LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tp.Privileges[0].Luid); 119 | tp.Privileges[0].Attributes = fEnable ? SE_PRIVILEGE_ENABLED : 0; 120 | AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(tp), NULL, NULL); 121 | fOk = (GetLastError() == ERROR_SUCCESS); 122 | CloseHandle(hToken); 123 | } 124 | return(fOk); 125 | } 126 | 127 | 128 | /////////////////////////////////////////////////////////////////////////////// 129 | 130 | 131 | inline BOOL CToolhelp::ReadProcessMemory(DWORD dwProcessID, 132 | LPCVOID pvBaseAddress, PVOID pvBuffer, DWORD cbRead, 133 | PDWORD pdwNumberOfBytesRead) { 134 | 135 | return(Toolhelp32ReadProcessMemory(dwProcessID, pvBaseAddress, pvBuffer, 136 | cbRead, pdwNumberOfBytesRead)); 137 | } 138 | 139 | 140 | /////////////////////////////////////////////////////////////////////////////// 141 | 142 | 143 | inline BOOL CToolhelp::ProcessFirst(PPROCESSENTRY32 ppe) const { 144 | 145 | BOOL fOk = Process32First(m_hSnapshot, ppe); 146 | if (fOk && (ppe->th32ProcessID == 0)) 147 | fOk = ProcessNext(ppe); // Remove the "[System Process]" (PID = 0) 148 | return(fOk); 149 | } 150 | 151 | 152 | inline BOOL CToolhelp::ProcessNext(PPROCESSENTRY32 ppe) const { 153 | 154 | BOOL fOk = Process32Next(m_hSnapshot, ppe); 155 | if (fOk && (ppe->th32ProcessID == 0)) 156 | fOk = ProcessNext(ppe); // Remove the "[System Process]" (PID = 0) 157 | return(fOk); 158 | } 159 | 160 | 161 | inline BOOL CToolhelp::ProcessFind(DWORD dwProcessId, PPROCESSENTRY32 ppe) 162 | const { 163 | 164 | BOOL fFound = FALSE; 165 | for (BOOL fOk = ProcessFirst(ppe); fOk; fOk = ProcessNext(ppe)) { 166 | fFound = (ppe->th32ProcessID == dwProcessId); 167 | if (fFound) break; 168 | } 169 | return(fFound); 170 | } 171 | 172 | 173 | /////////////////////////////////////////////////////////////////////////////// 174 | 175 | 176 | inline BOOL CToolhelp::ModuleFirst(PMODULEENTRY32 pme) const { 177 | 178 | return(Module32First(m_hSnapshot, pme)); 179 | } 180 | 181 | 182 | inline BOOL CToolhelp::ModuleNext(PMODULEENTRY32 pme) const { 183 | 184 | return(Module32Next(m_hSnapshot, pme)); 185 | } 186 | 187 | inline BOOL CToolhelp::ModuleFind(PVOID pvBaseAddr, PMODULEENTRY32 pme) const { 188 | 189 | BOOL fFound = FALSE; 190 | for (BOOL fOk = ModuleFirst(pme); fOk; fOk = ModuleNext(pme)) { 191 | fFound = (pme->modBaseAddr == pvBaseAddr); 192 | if (fFound) break; 193 | } 194 | return(fFound); 195 | } 196 | 197 | inline BOOL CToolhelp::ModuleFind(PTSTR pszModName, PMODULEENTRY32 pme) const { 198 | BOOL fFound = FALSE; 199 | for (BOOL fOk = ModuleFirst(pme); fOk; fOk = ModuleNext(pme)) { 200 | fFound = (lstrcmpi(pme->szModule, pszModName) == 0) || 201 | (lstrcmpi(pme->szExePath, pszModName) == 0); 202 | if (fFound) break; 203 | } 204 | return(fFound); 205 | } 206 | 207 | 208 | /////////////////////////////////////////////////////////////////////////////// 209 | 210 | 211 | inline BOOL CToolhelp::ThreadFirst(PTHREADENTRY32 pte) const { 212 | 213 | return(Thread32First(m_hSnapshot, pte)); 214 | } 215 | 216 | 217 | inline BOOL CToolhelp::ThreadNext(PTHREADENTRY32 pte) const { 218 | 219 | return(Thread32Next(m_hSnapshot, pte)); 220 | } 221 | 222 | 223 | /////////////////////////////////////////////////////////////////////////////// 224 | 225 | 226 | inline int CToolhelp::HowManyHeaps() const { 227 | 228 | int nHowManyHeaps = 0; 229 | HEAPLIST32 hl = { sizeof(hl) }; 230 | for (BOOL fOk = HeapListFirst(&hl); fOk; fOk = HeapListNext(&hl)) 231 | nHowManyHeaps++; 232 | return(nHowManyHeaps); 233 | } 234 | 235 | 236 | inline int CToolhelp::HowManyBlocksInHeap(DWORD dwProcessID, 237 | DWORD dwHeapID) const { 238 | 239 | int nHowManyBlocksInHeap = 0; 240 | HEAPENTRY32 he = { sizeof(he) }; 241 | BOOL fOk = HeapFirst(&he, dwProcessID, dwHeapID); 242 | for (; fOk; fOk = HeapNext(&he)) 243 | nHowManyBlocksInHeap++; 244 | return(nHowManyBlocksInHeap); 245 | } 246 | 247 | 248 | inline BOOL CToolhelp::HeapListFirst(PHEAPLIST32 phl) const { 249 | 250 | return(Heap32ListFirst(m_hSnapshot, phl)); 251 | } 252 | 253 | 254 | inline BOOL CToolhelp::HeapListNext(PHEAPLIST32 phl) const { 255 | 256 | return(Heap32ListNext(m_hSnapshot, phl)); 257 | } 258 | 259 | 260 | inline BOOL CToolhelp::HeapFirst(PHEAPENTRY32 phe, DWORD dwProcessID, 261 | UINT_PTR dwHeapID) const { 262 | 263 | return(Heap32First(phe, dwProcessID, dwHeapID)); 264 | } 265 | 266 | 267 | inline BOOL CToolhelp::HeapNext(PHEAPENTRY32 phe) const { 268 | 269 | return(Heap32Next(phe)); 270 | } 271 | 272 | 273 | //inline BOOL CToolhelp::IsAHeap(HANDLE hProcess, PVOID pvBlock, 274 | // PDWORD pdwFlags) const { 275 | // 276 | // HEAPLIST32 hl = { sizeof(hl) }; 277 | // for (BOOL fOkHL = HeapListFirst(&hl); fOkHL; fOkHL = HeapListNext(&hl)) { 278 | // HEAPENTRY32 he = { sizeof(he) }; 279 | // BOOL fOkHE = HeapFirst(&he, hl.th32ProcessID, hl.th32HeapID); 280 | // for (; fOkHE; fOkHE = HeapNext(&he)) { 281 | // MEMORY_BASIC_INFORMATION mbi; 282 | // VirtualQueryEx(hProcess, (PVOID) he.dwAddress, &mbi, sizeof(mbi)); 283 | // if (chINRANGE(mbi.AllocationBase, pvBlock, 284 | // (PBYTE) mbi.AllocationBase + mbi.RegionSize)) { 285 | // 286 | // *pdwFlags = hl.dwFlags; 287 | // return(TRUE); 288 | // } 289 | // } 290 | // } 291 | // return(FALSE); 292 | //} 293 | 294 | 295 | //////////////////////////////// End of File ////////////////////////////////// 296 | -------------------------------------------------------------------------------- /Ts.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/Ts.chm -------------------------------------------------------------------------------- /UpgradeLog.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/UpgradeLog.htm -------------------------------------------------------------------------------- /UpgradeLog2.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/UpgradeLog2.htm -------------------------------------------------------------------------------- /d3dx9.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (C) Microsoft Corporation. All Rights Reserved. 4 | // 5 | // File: d3dx9.h 6 | // Content: D3DX utility library 7 | // 8 | ////////////////////////////////////////////////////////////////////////////// 9 | 10 | #ifdef __D3DX_INTERNAL__ 11 | #error Incorrect D3DX header used 12 | #endif 13 | 14 | #ifndef __D3DX9_H__ 15 | #define __D3DX9_H__ 16 | 17 | 18 | // Defines 19 | #include 20 | 21 | #define D3DX_DEFAULT ((UINT) -1) 22 | #define D3DX_DEFAULT_NONPOW2 ((UINT) -2) 23 | #define D3DX_DEFAULT_FLOAT FLT_MAX 24 | #define D3DX_FROM_FILE ((UINT) -3) 25 | #define D3DFMT_FROM_FILE ((D3DFORMAT) -3) 26 | 27 | #ifndef D3DXINLINE 28 | #ifdef _MSC_VER 29 | #if (_MSC_VER >= 1200) 30 | #define D3DXINLINE __forceinline 31 | #else 32 | #define D3DXINLINE __inline 33 | #endif 34 | #else 35 | #ifdef __cplusplus 36 | #define D3DXINLINE inline 37 | #else 38 | #define D3DXINLINE 39 | #endif 40 | #endif 41 | #endif 42 | 43 | 44 | 45 | // Includes 46 | #include "d3d9.h" 47 | #include "d3dx9math.h" 48 | #include "d3dx9core.h" 49 | #include "d3dx9xof.h" 50 | #include "d3dx9mesh.h" 51 | #include "d3dx9shader.h" 52 | #include "d3dx9effect.h" 53 | #include "d3dx9tex.h" 54 | #include "d3dx9shape.h" 55 | #include "d3dx9anim.h" 56 | 57 | 58 | // Errors 59 | #define _FACDD 0x876 60 | #define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) 61 | 62 | enum _D3DXERR { 63 | D3DXERR_CANNOTMODIFYINDEXBUFFER = MAKE_DDHRESULT(2900), 64 | D3DXERR_INVALIDMESH = MAKE_DDHRESULT(2901), 65 | D3DXERR_CANNOTATTRSORT = MAKE_DDHRESULT(2902), 66 | D3DXERR_SKINNINGNOTSUPPORTED = MAKE_DDHRESULT(2903), 67 | D3DXERR_TOOMANYINFLUENCES = MAKE_DDHRESULT(2904), 68 | D3DXERR_INVALIDDATA = MAKE_DDHRESULT(2905), 69 | D3DXERR_LOADEDMESHASNODATA = MAKE_DDHRESULT(2906), 70 | D3DXERR_DUPLICATENAMEDFRAGMENT = MAKE_DDHRESULT(2907), 71 | D3DXERR_CANNOTREMOVELASTITEM = MAKE_DDHRESULT(2908), 72 | }; 73 | 74 | 75 | #endif //__D3DX9_H__ 76 | 77 | -------------------------------------------------------------------------------- /d3dx9core.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (C) Microsoft Corporation. All Rights Reserved. 4 | // 5 | // File: d3dx9core.h 6 | // Content: D3DX core types and functions 7 | // 8 | /////////////////////////////////////////////////////////////////////////// 9 | 10 | #include "d3dx9.h" 11 | 12 | #ifndef __D3DX9CORE_H__ 13 | #define __D3DX9CORE_H__ 14 | 15 | 16 | /////////////////////////////////////////////////////////////////////////// 17 | // D3DX_SDK_VERSION: 18 | // ----------------- 19 | // This identifier is passed to D3DXCheckVersion in order to ensure that an 20 | // application was built against the correct header files and lib files. 21 | // This number is incremented whenever a header (or other) change would 22 | // require applications to be rebuilt. If the version doesn't match, 23 | // D3DXCheckVersion will return FALSE. (The number itself has no meaning.) 24 | /////////////////////////////////////////////////////////////////////////// 25 | 26 | #define D3DX_VERSION 0x0902 27 | 28 | #define D3DX_SDK_VERSION 42 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif //__cplusplus 33 | 34 | BOOL WINAPI 35 | D3DXCheckVersion(UINT D3DSdkVersion, UINT D3DXSdkVersion); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif //__cplusplus 40 | 41 | 42 | 43 | /////////////////////////////////////////////////////////////////////////// 44 | // D3DXDebugMute 45 | // Mutes D3DX and D3D debug spew (TRUE - mute, FALSE - not mute) 46 | // 47 | // returns previous mute value 48 | // 49 | /////////////////////////////////////////////////////////////////////////// 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif //__cplusplus 54 | 55 | BOOL WINAPI 56 | D3DXDebugMute(BOOL Mute); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif //__cplusplus 61 | 62 | 63 | /////////////////////////////////////////////////////////////////////////// 64 | // D3DXGetDriverLevel: 65 | // Returns driver version information: 66 | // 67 | // 700 - DX7 level driver 68 | // 800 - DX8 level driver 69 | // 900 - DX9 level driver 70 | /////////////////////////////////////////////////////////////////////////// 71 | 72 | #ifdef __cplusplus 73 | extern "C" { 74 | #endif //__cplusplus 75 | 76 | UINT WINAPI 77 | D3DXGetDriverLevel(LPDIRECT3DDEVICE9 pDevice); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif //__cplusplus 82 | 83 | 84 | /////////////////////////////////////////////////////////////////////////// 85 | // ID3DXBuffer: 86 | // ------------ 87 | // The buffer object is used by D3DX to return arbitrary size data. 88 | // 89 | // GetBufferPointer - 90 | // Returns a pointer to the beginning of the buffer. 91 | // 92 | // GetBufferSize - 93 | // Returns the size of the buffer, in bytes. 94 | /////////////////////////////////////////////////////////////////////////// 95 | 96 | typedef interface ID3DXBuffer ID3DXBuffer; 97 | typedef interface ID3DXBuffer *LPD3DXBUFFER; 98 | 99 | // {8BA5FB08-5195-40e2-AC58-0D989C3A0102} 100 | DEFINE_GUID(IID_ID3DXBuffer, 101 | 0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2); 102 | 103 | #undef INTERFACE 104 | #define INTERFACE ID3DXBuffer 105 | 106 | DECLARE_INTERFACE_(ID3DXBuffer, IUnknown) 107 | { 108 | // IUnknown 109 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 110 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 111 | STDMETHOD_(ULONG, Release)(THIS) PURE; 112 | 113 | // ID3DXBuffer 114 | STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; 115 | STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; 116 | }; 117 | 118 | 119 | 120 | ////////////////////////////////////////////////////////////////////////////// 121 | // D3DXSPRITE flags: 122 | // ----------------- 123 | // D3DXSPRITE_DONOTSAVESTATE 124 | // Specifies device state is not to be saved and restored in Begin/End. 125 | // D3DXSPRITE_DONOTMODIFY_RENDERSTATE 126 | // Specifies device render state is not to be changed in Begin. The device 127 | // is assumed to be in a valid state to draw vertices containing POSITION0, 128 | // TEXCOORD0, and COLOR0 data. 129 | // D3DXSPRITE_OBJECTSPACE 130 | // The WORLD, VIEW, and PROJECTION transforms are NOT modified. The 131 | // transforms currently set to the device are used to transform the sprites 132 | // when the batch is drawn (at Flush or End). If this is not specified, 133 | // WORLD, VIEW, and PROJECTION transforms are modified so that sprites are 134 | // drawn in screenspace coordinates. 135 | // D3DXSPRITE_BILLBOARD 136 | // Rotates each sprite about its center so that it is facing the viewer. 137 | // D3DXSPRITE_ALPHABLEND 138 | // Enables ALPHABLEND(SRCALPHA, INVSRCALPHA) and ALPHATEST(alpha > 0). 139 | // ID3DXFont expects this to be set when drawing text. 140 | // D3DXSPRITE_SORT_TEXTURE 141 | // Sprites are sorted by texture prior to drawing. This is recommended when 142 | // drawing non-overlapping sprites of uniform depth. For example, drawing 143 | // screen-aligned text with ID3DXFont. 144 | // D3DXSPRITE_SORT_DEPTH_FRONTTOBACK 145 | // Sprites are sorted by depth front-to-back prior to drawing. This is 146 | // recommended when drawing opaque sprites of varying depths. 147 | // D3DXSPRITE_SORT_DEPTH_BACKTOFRONT 148 | // Sprites are sorted by depth back-to-front prior to drawing. This is 149 | // recommended when drawing transparent sprites of varying depths. 150 | // D3DXSPRITE_DO_NOT_ADDREF_TEXTURE 151 | // Disables calling AddRef() on every draw, and Release() on Flush() for 152 | // better performance. 153 | ////////////////////////////////////////////////////////////////////////////// 154 | 155 | #define D3DXSPRITE_DONOTSAVESTATE (1 << 0) 156 | #define D3DXSPRITE_DONOTMODIFY_RENDERSTATE (1 << 1) 157 | #define D3DXSPRITE_OBJECTSPACE (1 << 2) 158 | #define D3DXSPRITE_BILLBOARD (1 << 3) 159 | #define D3DXSPRITE_ALPHABLEND (1 << 4) 160 | #define D3DXSPRITE_SORT_TEXTURE (1 << 5) 161 | #define D3DXSPRITE_SORT_DEPTH_FRONTTOBACK (1 << 6) 162 | #define D3DXSPRITE_SORT_DEPTH_BACKTOFRONT (1 << 7) 163 | #define D3DXSPRITE_DO_NOT_ADDREF_TEXTURE (1 << 8) 164 | 165 | 166 | ////////////////////////////////////////////////////////////////////////////// 167 | // ID3DXSprite: 168 | // ------------ 169 | // This object intends to provide an easy way to drawing sprites using D3D. 170 | // 171 | // Begin - 172 | // Prepares device for drawing sprites. 173 | // 174 | // Draw - 175 | // Draws a sprite. Before transformation, the sprite is the size of 176 | // SrcRect, with its top-left corner specified by Position. The color 177 | // and alpha channels are modulated by Color. 178 | // 179 | // Flush - 180 | // Forces all batched sprites to submitted to the device. 181 | // 182 | // End - 183 | // Restores device state to how it was when Begin was called. 184 | // 185 | // OnLostDevice, OnResetDevice - 186 | // Call OnLostDevice() on this object before calling Reset() on the 187 | // device, so that this object can release any stateblocks and video 188 | // memory resources. After Reset(), the call OnResetDevice(). 189 | ////////////////////////////////////////////////////////////////////////////// 190 | 191 | typedef interface ID3DXSprite ID3DXSprite; 192 | typedef interface ID3DXSprite *LPD3DXSPRITE; 193 | 194 | 195 | // {BA0B762D-7D28-43ec-B9DC-2F84443B0614} 196 | DEFINE_GUID(IID_ID3DXSprite, 197 | 0xba0b762d, 0x7d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14); 198 | 199 | 200 | #undef INTERFACE 201 | #define INTERFACE ID3DXSprite 202 | 203 | DECLARE_INTERFACE_(ID3DXSprite, IUnknown) 204 | { 205 | // IUnknown 206 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 207 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 208 | STDMETHOD_(ULONG, Release)(THIS) PURE; 209 | 210 | // ID3DXSprite 211 | STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; 212 | 213 | STDMETHOD(GetTransform)(THIS_ D3DXMATRIX *pTransform) PURE; 214 | STDMETHOD(SetTransform)(THIS_ CONST D3DXMATRIX *pTransform) PURE; 215 | 216 | STDMETHOD(SetWorldViewRH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE; 217 | STDMETHOD(SetWorldViewLH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE; 218 | 219 | STDMETHOD(Begin)(THIS_ DWORD Flags) PURE; 220 | STDMETHOD(Draw)(THIS_ LPDIRECT3DTEXTURE9 pTexture, CONST RECT *pSrcRect, CONST D3DXVECTOR3 *pCenter, CONST D3DXVECTOR3 *pPosition, D3DCOLOR Color) PURE; 221 | STDMETHOD(Flush)(THIS) PURE; 222 | STDMETHOD(End)(THIS) PURE; 223 | 224 | STDMETHOD(OnLostDevice)(THIS) PURE; 225 | STDMETHOD(OnResetDevice)(THIS) PURE; 226 | }; 227 | 228 | 229 | #ifdef __cplusplus 230 | extern "C" { 231 | #endif //__cplusplus 232 | 233 | HRESULT WINAPI 234 | D3DXCreateSprite( 235 | LPDIRECT3DDEVICE9 pDevice, 236 | LPD3DXSPRITE* ppSprite); 237 | 238 | #ifdef __cplusplus 239 | } 240 | #endif //__cplusplus 241 | 242 | 243 | 244 | ////////////////////////////////////////////////////////////////////////////// 245 | // ID3DXFont: 246 | // ---------- 247 | // Font objects contain the textures and resources needed to render a specific 248 | // font on a specific device. 249 | // 250 | // GetGlyphData - 251 | // Returns glyph cache data, for a given glyph. 252 | // 253 | // PreloadCharacters/PreloadGlyphs/PreloadText - 254 | // Preloads glyphs into the glyph cache textures. 255 | // 256 | // DrawText - 257 | // Draws formatted text on a D3D device. Some parameters are 258 | // surprisingly similar to those of GDI's DrawText function. See GDI 259 | // documentation for a detailed description of these parameters. 260 | // If pSprite is NULL, an internal sprite object will be used. 261 | // 262 | // OnLostDevice, OnResetDevice - 263 | // Call OnLostDevice() on this object before calling Reset() on the 264 | // device, so that this object can release any stateblocks and video 265 | // memory resources. After Reset(), the call OnResetDevice(). 266 | ////////////////////////////////////////////////////////////////////////////// 267 | 268 | typedef struct _D3DXFONT_DESCA 269 | { 270 | INT Height; 271 | UINT Width; 272 | UINT Weight; 273 | UINT MipLevels; 274 | BOOL Italic; 275 | BYTE CharSet; 276 | BYTE OutputPrecision; 277 | BYTE Quality; 278 | BYTE PitchAndFamily; 279 | CHAR FaceName[LF_FACESIZE]; 280 | 281 | } D3DXFONT_DESCA, *LPD3DXFONT_DESCA; 282 | 283 | typedef struct _D3DXFONT_DESCW 284 | { 285 | INT Height; 286 | UINT Width; 287 | UINT Weight; 288 | UINT MipLevels; 289 | BOOL Italic; 290 | BYTE CharSet; 291 | BYTE OutputPrecision; 292 | BYTE Quality; 293 | BYTE PitchAndFamily; 294 | WCHAR FaceName[LF_FACESIZE]; 295 | 296 | } D3DXFONT_DESCW, *LPD3DXFONT_DESCW; 297 | 298 | #ifdef UNICODE 299 | typedef D3DXFONT_DESCW D3DXFONT_DESC; 300 | typedef LPD3DXFONT_DESCW LPD3DXFONT_DESC; 301 | #else 302 | typedef D3DXFONT_DESCA D3DXFONT_DESC; 303 | typedef LPD3DXFONT_DESCA LPD3DXFONT_DESC; 304 | #endif 305 | 306 | 307 | typedef interface ID3DXFont ID3DXFont; 308 | typedef interface ID3DXFont *LPD3DXFONT; 309 | 310 | 311 | // {D79DBB70-5F21-4d36-BBC2-FF525C213CDC} 312 | DEFINE_GUID(IID_ID3DXFont, 313 | 0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc); 314 | 315 | 316 | #undef INTERFACE 317 | #define INTERFACE ID3DXFont 318 | 319 | DECLARE_INTERFACE_(ID3DXFont, IUnknown) 320 | { 321 | // IUnknown 322 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 323 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 324 | STDMETHOD_(ULONG, Release)(THIS) PURE; 325 | 326 | // ID3DXFont 327 | STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE; 328 | STDMETHOD(GetDescA)(THIS_ D3DXFONT_DESCA *pDesc) PURE; 329 | STDMETHOD(GetDescW)(THIS_ D3DXFONT_DESCW *pDesc) PURE; 330 | STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE; 331 | STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE; 332 | 333 | STDMETHOD_(HDC, GetDC)(THIS) PURE; 334 | STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, LPDIRECT3DTEXTURE9 *ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE; 335 | 336 | STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE; 337 | STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE; 338 | STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE; 339 | STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE; 340 | 341 | STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DXSPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE; 342 | STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DXSPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE; 343 | 344 | STDMETHOD(OnLostDevice)(THIS) PURE; 345 | STDMETHOD(OnResetDevice)(THIS) PURE; 346 | 347 | #ifdef __cplusplus 348 | #ifdef UNICODE 349 | HRESULT GetDesc(D3DXFONT_DESCW *pDesc) { return GetDescW(pDesc); } 350 | HRESULT PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); } 351 | #else 352 | HRESULT GetDesc(D3DXFONT_DESCA *pDesc) { return GetDescA(pDesc); } 353 | HRESULT PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); } 354 | #endif 355 | #endif //__cplusplus 356 | }; 357 | 358 | #ifndef GetTextMetrics 359 | #ifdef UNICODE 360 | #define GetTextMetrics GetTextMetricsW 361 | #else 362 | #define GetTextMetrics GetTextMetricsA 363 | #endif 364 | #endif 365 | 366 | #ifndef DrawText 367 | #ifdef UNICODE 368 | #define DrawText DrawTextW 369 | #else 370 | #define DrawText DrawTextA 371 | #endif 372 | #endif 373 | 374 | 375 | #ifdef __cplusplus 376 | extern "C" { 377 | #endif //__cplusplus 378 | 379 | 380 | HRESULT WINAPI 381 | D3DXCreateFontA( 382 | LPDIRECT3DDEVICE9 pDevice, 383 | INT Height, 384 | UINT Width, 385 | UINT Weight, 386 | UINT MipLevels, 387 | BOOL Italic, 388 | DWORD CharSet, 389 | DWORD OutputPrecision, 390 | DWORD Quality, 391 | DWORD PitchAndFamily, 392 | LPCSTR pFaceName, 393 | LPD3DXFONT* ppFont); 394 | 395 | HRESULT WINAPI 396 | D3DXCreateFontW( 397 | LPDIRECT3DDEVICE9 pDevice, 398 | INT Height, 399 | UINT Width, 400 | UINT Weight, 401 | UINT MipLevels, 402 | BOOL Italic, 403 | DWORD CharSet, 404 | DWORD OutputPrecision, 405 | DWORD Quality, 406 | DWORD PitchAndFamily, 407 | LPCWSTR pFaceName, 408 | LPD3DXFONT* ppFont); 409 | 410 | #ifdef UNICODE 411 | #define D3DXCreateFont D3DXCreateFontW 412 | #else 413 | #define D3DXCreateFont D3DXCreateFontA 414 | #endif 415 | 416 | 417 | HRESULT WINAPI 418 | D3DXCreateFontIndirectA( 419 | LPDIRECT3DDEVICE9 pDevice, 420 | CONST D3DXFONT_DESCA* pDesc, 421 | LPD3DXFONT* ppFont); 422 | 423 | HRESULT WINAPI 424 | D3DXCreateFontIndirectW( 425 | LPDIRECT3DDEVICE9 pDevice, 426 | CONST D3DXFONT_DESCW* pDesc, 427 | LPD3DXFONT* ppFont); 428 | 429 | #ifdef UNICODE 430 | #define D3DXCreateFontIndirect D3DXCreateFontIndirectW 431 | #else 432 | #define D3DXCreateFontIndirect D3DXCreateFontIndirectA 433 | #endif 434 | 435 | 436 | #ifdef __cplusplus 437 | } 438 | #endif //__cplusplus 439 | 440 | 441 | 442 | /////////////////////////////////////////////////////////////////////////// 443 | // ID3DXRenderToSurface: 444 | // --------------------- 445 | // This object abstracts rendering to surfaces. These surfaces do not 446 | // necessarily need to be render targets. If they are not, a compatible 447 | // render target is used, and the result copied into surface at end scene. 448 | // 449 | // BeginScene, EndScene - 450 | // Call BeginScene() and EndScene() at the beginning and ending of your 451 | // scene. These calls will setup and restore render targets, viewports, 452 | // etc.. 453 | // 454 | // OnLostDevice, OnResetDevice - 455 | // Call OnLostDevice() on this object before calling Reset() on the 456 | // device, so that this object can release any stateblocks and video 457 | // memory resources. After Reset(), the call OnResetDevice(). 458 | /////////////////////////////////////////////////////////////////////////// 459 | 460 | typedef struct _D3DXRTS_DESC 461 | { 462 | UINT Width; 463 | UINT Height; 464 | D3DFORMAT Format; 465 | BOOL DepthStencil; 466 | D3DFORMAT DepthStencilFormat; 467 | 468 | } D3DXRTS_DESC, *LPD3DXRTS_DESC; 469 | 470 | 471 | typedef interface ID3DXRenderToSurface ID3DXRenderToSurface; 472 | typedef interface ID3DXRenderToSurface *LPD3DXRENDERTOSURFACE; 473 | 474 | 475 | // {6985F346-2C3D-43b3-BE8B-DAAE8A03D894} 476 | DEFINE_GUID(IID_ID3DXRenderToSurface, 477 | 0x6985f346, 0x2c3d, 0x43b3, 0xbe, 0x8b, 0xda, 0xae, 0x8a, 0x3, 0xd8, 0x94); 478 | 479 | 480 | #undef INTERFACE 481 | #define INTERFACE ID3DXRenderToSurface 482 | 483 | DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown) 484 | { 485 | // IUnknown 486 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 487 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 488 | STDMETHOD_(ULONG, Release)(THIS) PURE; 489 | 490 | // ID3DXRenderToSurface 491 | STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; 492 | STDMETHOD(GetDesc)(THIS_ D3DXRTS_DESC* pDesc) PURE; 493 | 494 | STDMETHOD(BeginScene)(THIS_ LPDIRECT3DSURFACE9 pSurface, CONST D3DVIEWPORT9* pViewport) PURE; 495 | STDMETHOD(EndScene)(THIS_ DWORD MipFilter) PURE; 496 | 497 | STDMETHOD(OnLostDevice)(THIS) PURE; 498 | STDMETHOD(OnResetDevice)(THIS) PURE; 499 | }; 500 | 501 | 502 | #ifdef __cplusplus 503 | extern "C" { 504 | #endif //__cplusplus 505 | 506 | HRESULT WINAPI 507 | D3DXCreateRenderToSurface( 508 | LPDIRECT3DDEVICE9 pDevice, 509 | UINT Width, 510 | UINT Height, 511 | D3DFORMAT Format, 512 | BOOL DepthStencil, 513 | D3DFORMAT DepthStencilFormat, 514 | LPD3DXRENDERTOSURFACE* ppRenderToSurface); 515 | 516 | #ifdef __cplusplus 517 | } 518 | #endif //__cplusplus 519 | 520 | 521 | 522 | /////////////////////////////////////////////////////////////////////////// 523 | // ID3DXRenderToEnvMap: 524 | // -------------------- 525 | // This object abstracts rendering to environment maps. These surfaces 526 | // do not necessarily need to be render targets. If they are not, a 527 | // compatible render target is used, and the result copied into the 528 | // environment map at end scene. 529 | // 530 | // BeginCube, BeginSphere, BeginHemisphere, BeginParabolic - 531 | // This function initiates the rendering of the environment map. As 532 | // parameters, you pass the textures in which will get filled in with 533 | // the resulting environment map. 534 | // 535 | // Face - 536 | // Call this function to initiate the drawing of each face. For each 537 | // environment map, you will call this six times.. once for each face 538 | // in D3DCUBEMAP_FACES. 539 | // 540 | // End - 541 | // This will restore all render targets, and if needed compose all the 542 | // rendered faces into the environment map surfaces. 543 | // 544 | // OnLostDevice, OnResetDevice - 545 | // Call OnLostDevice() on this object before calling Reset() on the 546 | // device, so that this object can release any stateblocks and video 547 | // memory resources. After Reset(), the call OnResetDevice(). 548 | /////////////////////////////////////////////////////////////////////////// 549 | 550 | typedef struct _D3DXRTE_DESC 551 | { 552 | UINT Size; 553 | UINT MipLevels; 554 | D3DFORMAT Format; 555 | BOOL DepthStencil; 556 | D3DFORMAT DepthStencilFormat; 557 | 558 | } D3DXRTE_DESC, *LPD3DXRTE_DESC; 559 | 560 | 561 | typedef interface ID3DXRenderToEnvMap ID3DXRenderToEnvMap; 562 | typedef interface ID3DXRenderToEnvMap *LPD3DXRenderToEnvMap; 563 | 564 | 565 | // {313F1B4B-C7B0-4fa2-9D9D-8D380B64385E} 566 | DEFINE_GUID(IID_ID3DXRenderToEnvMap, 567 | 0x313f1b4b, 0xc7b0, 0x4fa2, 0x9d, 0x9d, 0x8d, 0x38, 0xb, 0x64, 0x38, 0x5e); 568 | 569 | 570 | #undef INTERFACE 571 | #define INTERFACE ID3DXRenderToEnvMap 572 | 573 | DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown) 574 | { 575 | // IUnknown 576 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 577 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 578 | STDMETHOD_(ULONG, Release)(THIS) PURE; 579 | 580 | // ID3DXRenderToEnvMap 581 | STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; 582 | STDMETHOD(GetDesc)(THIS_ D3DXRTE_DESC* pDesc) PURE; 583 | 584 | STDMETHOD(BeginCube)(THIS_ 585 | LPDIRECT3DCUBETEXTURE9 pCubeTex) PURE; 586 | 587 | STDMETHOD(BeginSphere)(THIS_ 588 | LPDIRECT3DTEXTURE9 pTex) PURE; 589 | 590 | STDMETHOD(BeginHemisphere)(THIS_ 591 | LPDIRECT3DTEXTURE9 pTexZPos, 592 | LPDIRECT3DTEXTURE9 pTexZNeg) PURE; 593 | 594 | STDMETHOD(BeginParabolic)(THIS_ 595 | LPDIRECT3DTEXTURE9 pTexZPos, 596 | LPDIRECT3DTEXTURE9 pTexZNeg) PURE; 597 | 598 | STDMETHOD(Face)(THIS_ D3DCUBEMAP_FACES Face, DWORD MipFilter) PURE; 599 | STDMETHOD(End)(THIS_ DWORD MipFilter) PURE; 600 | 601 | STDMETHOD(OnLostDevice)(THIS) PURE; 602 | STDMETHOD(OnResetDevice)(THIS) PURE; 603 | }; 604 | 605 | 606 | #ifdef __cplusplus 607 | extern "C" { 608 | #endif //__cplusplus 609 | 610 | HRESULT WINAPI 611 | D3DXCreateRenderToEnvMap( 612 | LPDIRECT3DDEVICE9 pDevice, 613 | UINT Size, 614 | UINT MipLevels, 615 | D3DFORMAT Format, 616 | BOOL DepthStencil, 617 | D3DFORMAT DepthStencilFormat, 618 | LPD3DXRenderToEnvMap* ppRenderToEnvMap); 619 | 620 | #ifdef __cplusplus 621 | } 622 | #endif //__cplusplus 623 | 624 | 625 | 626 | /////////////////////////////////////////////////////////////////////////// 627 | // ID3DXLine: 628 | // ------------ 629 | // This object intends to provide an easy way to draw lines using D3D. 630 | // 631 | // Begin - 632 | // Prepares device for drawing lines 633 | // 634 | // Draw - 635 | // Draws a line strip in screen-space. 636 | // Input is in the form of a array defining points on the line strip. of D3DXVECTOR2 637 | // 638 | // DrawTransform - 639 | // Draws a line in screen-space with a specified input transformation matrix. 640 | // 641 | // End - 642 | // Restores device state to how it was when Begin was called. 643 | // 644 | // SetPattern - 645 | // Applies a stipple pattern to the line. Input is one 32-bit 646 | // DWORD which describes the stipple pattern. 1 is opaque, 0 is 647 | // transparent. 648 | // 649 | // SetPatternScale - 650 | // Stretches the stipple pattern in the u direction. Input is one 651 | // floating-point value. 0.0f is no scaling, whereas 1.0f doubles 652 | // the length of the stipple pattern. 653 | // 654 | // SetWidth - 655 | // Specifies the thickness of the line in the v direction. Input is 656 | // one floating-point value. 657 | // 658 | // SetAntialias - 659 | // Toggles line antialiasing. Input is a BOOL. 660 | // TRUE = Antialiasing on. 661 | // FALSE = Antialiasing off. 662 | // 663 | // SetGLLines - 664 | // Toggles non-antialiased OpenGL line emulation. Input is a BOOL. 665 | // TRUE = OpenGL line emulation on. 666 | // FALSE = OpenGL line emulation off. 667 | // 668 | // OpenGL line: Regular line: 669 | // *\ *\ 670 | // | \ / \ 671 | // | \ *\ \ 672 | // *\ \ \ \ 673 | // \ \ \ \ 674 | // \ * \ * 675 | // \ | \ / 676 | // \| * 677 | // * 678 | // 679 | // OnLostDevice, OnResetDevice - 680 | // Call OnLostDevice() on this object before calling Reset() on the 681 | // device, so that this object can release any stateblocks and video 682 | // memory resources. After Reset(), the call OnResetDevice(). 683 | /////////////////////////////////////////////////////////////////////////// 684 | 685 | 686 | typedef interface ID3DXLine ID3DXLine; 687 | typedef interface ID3DXLine *LPD3DXLINE; 688 | 689 | 690 | // {D379BA7F-9042-4ac4-9F5E-58192A4C6BD8} 691 | DEFINE_GUID(IID_ID3DXLine, 692 | 0xd379ba7f, 0x9042, 0x4ac4, 0x9f, 0x5e, 0x58, 0x19, 0x2a, 0x4c, 0x6b, 0xd8); 693 | 694 | #undef INTERFACE 695 | #define INTERFACE ID3DXLine 696 | 697 | DECLARE_INTERFACE_(ID3DXLine, IUnknown) 698 | { 699 | // IUnknown 700 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 701 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 702 | STDMETHOD_(ULONG, Release)(THIS) PURE; 703 | 704 | // ID3DXLine 705 | STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; 706 | 707 | STDMETHOD(Begin)(THIS) PURE; 708 | 709 | STDMETHOD(Draw)(THIS_ CONST D3DXVECTOR2 *pVertexList, 710 | DWORD dwVertexListCount, D3DCOLOR Color) PURE; 711 | 712 | STDMETHOD(DrawTransform)(THIS_ CONST D3DXVECTOR3 *pVertexList, 713 | DWORD dwVertexListCount, CONST D3DXMATRIX* pTransform, 714 | D3DCOLOR Color) PURE; 715 | 716 | STDMETHOD(SetPattern)(THIS_ DWORD dwPattern) PURE; 717 | STDMETHOD_(DWORD, GetPattern)(THIS) PURE; 718 | 719 | STDMETHOD(SetPatternScale)(THIS_ FLOAT fPatternScale) PURE; 720 | STDMETHOD_(FLOAT, GetPatternScale)(THIS) PURE; 721 | 722 | STDMETHOD(SetWidth)(THIS_ FLOAT fWidth) PURE; 723 | STDMETHOD_(FLOAT, GetWidth)(THIS) PURE; 724 | 725 | STDMETHOD(SetAntialias)(THIS_ BOOL bAntialias) PURE; 726 | STDMETHOD_(BOOL, GetAntialias)(THIS) PURE; 727 | 728 | STDMETHOD(SetGLLines)(THIS_ BOOL bGLLines) PURE; 729 | STDMETHOD_(BOOL, GetGLLines)(THIS) PURE; 730 | 731 | STDMETHOD(End)(THIS) PURE; 732 | 733 | STDMETHOD(OnLostDevice)(THIS) PURE; 734 | STDMETHOD(OnResetDevice)(THIS) PURE; 735 | }; 736 | 737 | 738 | #ifdef __cplusplus 739 | extern "C" { 740 | #endif //__cplusplus 741 | 742 | 743 | HRESULT WINAPI 744 | D3DXCreateLine( 745 | LPDIRECT3DDEVICE9 pDevice, 746 | LPD3DXLINE* ppLine); 747 | 748 | #ifdef __cplusplus 749 | } 750 | #endif //__cplusplus 751 | 752 | #endif //__D3DX9CORE_H__ 753 | 754 | -------------------------------------------------------------------------------- /d3dx9effect.h: -------------------------------------------------------------------------------- 1 | 2 | ////////////////////////////////////////////////////////////////////////////// 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | // File: d3dx9effect.h 7 | // Content: D3DX effect types and Shaders 8 | // 9 | ////////////////////////////////////////////////////////////////////////////// 10 | 11 | #include "d3dx9.h" 12 | 13 | #ifndef __D3DX9EFFECT_H__ 14 | #define __D3DX9EFFECT_H__ 15 | 16 | 17 | //---------------------------------------------------------------------------- 18 | // D3DXFX_DONOTSAVESTATE 19 | // This flag is used as a parameter to ID3DXEffect::Begin(). When this flag 20 | // is specified, device state is not saved or restored in Begin/End. 21 | // D3DXFX_DONOTSAVESHADERSTATE 22 | // This flag is used as a parameter to ID3DXEffect::Begin(). When this flag 23 | // is specified, shader device state is not saved or restored in Begin/End. 24 | // This includes pixel/vertex shaders and shader constants 25 | // D3DXFX_DONOTSAVESAMPLERSTATE 26 | // This flag is used as a parameter to ID3DXEffect::Begin(). When this flag 27 | // is specified, sampler device state is not saved or restored in Begin/End. 28 | // D3DXFX_NOT_CLONEABLE 29 | // This flag is used as a parameter to the D3DXCreateEffect family of APIs. 30 | // When this flag is specified, the effect will be non-cloneable and will not 31 | // contain any shader binary data. 32 | // Furthermore, GetPassDesc will not return shader function pointers. 33 | // Setting this flag reduces effect memory usage by about 50%. 34 | //---------------------------------------------------------------------------- 35 | 36 | #define D3DXFX_DONOTSAVESTATE (1 << 0) 37 | #define D3DXFX_DONOTSAVESHADERSTATE (1 << 1) 38 | #define D3DXFX_DONOTSAVESAMPLERSTATE (1 << 2) 39 | 40 | #define D3DXFX_NOT_CLONEABLE (1 << 11) 41 | #define D3DXFX_LARGEADDRESSAWARE (1 << 17) 42 | 43 | //---------------------------------------------------------------------------- 44 | // D3DX_PARAMETER_SHARED 45 | // Indicates that the value of a parameter will be shared with all effects 46 | // which share the same namespace. Changing the value in one effect will 47 | // change it in all. 48 | // 49 | // D3DX_PARAMETER_LITERAL 50 | // Indicates that the value of this parameter can be treated as literal. 51 | // Literal parameters can be marked when the effect is compiled, and their 52 | // cannot be changed after the effect is compiled. Shared parameters cannot 53 | // be literal. 54 | //---------------------------------------------------------------------------- 55 | 56 | #define D3DX_PARAMETER_SHARED (1 << 0) 57 | #define D3DX_PARAMETER_LITERAL (1 << 1) 58 | #define D3DX_PARAMETER_ANNOTATION (1 << 2) 59 | 60 | //---------------------------------------------------------------------------- 61 | // D3DXEFFECT_DESC: 62 | //---------------------------------------------------------------------------- 63 | 64 | typedef struct _D3DXEFFECT_DESC 65 | { 66 | LPCSTR Creator; // Creator string 67 | UINT Parameters; // Number of parameters 68 | UINT Techniques; // Number of techniques 69 | UINT Functions; // Number of function entrypoints 70 | 71 | } D3DXEFFECT_DESC; 72 | 73 | 74 | //---------------------------------------------------------------------------- 75 | // D3DXPARAMETER_DESC: 76 | //---------------------------------------------------------------------------- 77 | 78 | typedef struct _D3DXPARAMETER_DESC 79 | { 80 | LPCSTR Name; // Parameter name 81 | LPCSTR Semantic; // Parameter semantic 82 | D3DXPARAMETER_CLASS Class; // Class 83 | D3DXPARAMETER_TYPE Type; // Component type 84 | UINT Rows; // Number of rows 85 | UINT Columns; // Number of columns 86 | UINT Elements; // Number of array elements 87 | UINT Annotations; // Number of annotations 88 | UINT StructMembers; // Number of structure member sub-parameters 89 | DWORD Flags; // D3DX_PARAMETER_* flags 90 | UINT Bytes; // Parameter size, in bytes 91 | 92 | } D3DXPARAMETER_DESC; 93 | 94 | 95 | //---------------------------------------------------------------------------- 96 | // D3DXTECHNIQUE_DESC: 97 | //---------------------------------------------------------------------------- 98 | 99 | typedef struct _D3DXTECHNIQUE_DESC 100 | { 101 | LPCSTR Name; // Technique name 102 | UINT Passes; // Number of passes 103 | UINT Annotations; // Number of annotations 104 | 105 | } D3DXTECHNIQUE_DESC; 106 | 107 | 108 | //---------------------------------------------------------------------------- 109 | // D3DXPASS_DESC: 110 | //---------------------------------------------------------------------------- 111 | 112 | typedef struct _D3DXPASS_DESC 113 | { 114 | LPCSTR Name; // Pass name 115 | UINT Annotations; // Number of annotations 116 | 117 | CONST DWORD *pVertexShaderFunction; // Vertex shader function 118 | CONST DWORD *pPixelShaderFunction; // Pixel shader function 119 | 120 | } D3DXPASS_DESC; 121 | 122 | 123 | //---------------------------------------------------------------------------- 124 | // D3DXFUNCTION_DESC: 125 | //---------------------------------------------------------------------------- 126 | 127 | typedef struct _D3DXFUNCTION_DESC 128 | { 129 | LPCSTR Name; // Function name 130 | UINT Annotations; // Number of annotations 131 | 132 | } D3DXFUNCTION_DESC; 133 | 134 | 135 | 136 | ////////////////////////////////////////////////////////////////////////////// 137 | // ID3DXEffectPool /////////////////////////////////////////////////////////// 138 | ////////////////////////////////////////////////////////////////////////////// 139 | 140 | typedef interface ID3DXEffectPool ID3DXEffectPool; 141 | typedef interface ID3DXEffectPool *LPD3DXEFFECTPOOL; 142 | 143 | // {9537AB04-3250-412e-8213-FCD2F8677933} 144 | DEFINE_GUID(IID_ID3DXEffectPool, 145 | 0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33); 146 | 147 | 148 | #undef INTERFACE 149 | #define INTERFACE ID3DXEffectPool 150 | 151 | DECLARE_INTERFACE_(ID3DXEffectPool, IUnknown) 152 | { 153 | // IUnknown 154 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 155 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 156 | STDMETHOD_(ULONG, Release)(THIS) PURE; 157 | 158 | // No public methods 159 | }; 160 | 161 | 162 | ////////////////////////////////////////////////////////////////////////////// 163 | // ID3DXBaseEffect /////////////////////////////////////////////////////////// 164 | ////////////////////////////////////////////////////////////////////////////// 165 | 166 | typedef interface ID3DXBaseEffect ID3DXBaseEffect; 167 | typedef interface ID3DXBaseEffect *LPD3DXBASEEFFECT; 168 | 169 | // {017C18AC-103F-4417-8C51-6BF6EF1E56BE} 170 | DEFINE_GUID(IID_ID3DXBaseEffect, 171 | 0x17c18ac, 0x103f, 0x4417, 0x8c, 0x51, 0x6b, 0xf6, 0xef, 0x1e, 0x56, 0xbe); 172 | 173 | 174 | #undef INTERFACE 175 | #define INTERFACE ID3DXBaseEffect 176 | 177 | DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown) 178 | { 179 | // IUnknown 180 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 181 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 182 | STDMETHOD_(ULONG, Release)(THIS) PURE; 183 | 184 | // Descs 185 | STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; 186 | STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; 187 | STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; 188 | STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; 189 | STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; 190 | 191 | // Handle operations 192 | STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; 193 | STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; 194 | STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; 195 | STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; 196 | STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; 197 | STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; 198 | STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; 199 | STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; 200 | STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; 201 | STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; 202 | STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; 203 | STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; 204 | 205 | // Get/Set Parameters 206 | STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; 207 | STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; 208 | STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; 209 | STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; 210 | STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; 211 | STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; 212 | STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; 213 | STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; 214 | STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; 215 | STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; 216 | STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; 217 | STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; 218 | STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; 219 | STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; 220 | STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; 221 | STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; 222 | STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; 223 | STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; 224 | STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; 225 | STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; 226 | STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; 227 | STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; 228 | STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; 229 | STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; 230 | STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; 231 | STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; 232 | STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; 233 | STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; 234 | STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; 235 | STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; 236 | STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; 237 | STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; 238 | STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; 239 | STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; 240 | STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; 241 | STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; 242 | 243 | //Set Range of an Array to pass to device 244 | //Useful for sending only a subrange of an array down to the device 245 | STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; 246 | 247 | }; 248 | 249 | 250 | //---------------------------------------------------------------------------- 251 | // ID3DXEffectStateManager: 252 | // ------------------------ 253 | // This is a user implemented interface that can be used to manage device 254 | // state changes made by an Effect. 255 | //---------------------------------------------------------------------------- 256 | 257 | typedef interface ID3DXEffectStateManager ID3DXEffectStateManager; 258 | typedef interface ID3DXEffectStateManager *LPD3DXEFFECTSTATEMANAGER; 259 | 260 | // {79AAB587-6DBC-4fa7-82DE-37FA1781C5CE} 261 | DEFINE_GUID(IID_ID3DXEffectStateManager, 262 | 0x79aab587, 0x6dbc, 0x4fa7, 0x82, 0xde, 0x37, 0xfa, 0x17, 0x81, 0xc5, 0xce); 263 | 264 | #undef INTERFACE 265 | #define INTERFACE ID3DXEffectStateManager 266 | 267 | DECLARE_INTERFACE_(ID3DXEffectStateManager, IUnknown) 268 | { 269 | // The user must correctly implement QueryInterface, AddRef, and Release. 270 | 271 | // IUnknown 272 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 273 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 274 | STDMETHOD_(ULONG, Release)(THIS) PURE; 275 | 276 | // The following methods are called by the Effect when it wants to make 277 | // the corresponding device call. Note that: 278 | // 1. Users manage the state and are therefore responsible for making the 279 | // the corresponding device calls themselves inside their callbacks. 280 | // 2. Effects pay attention to the return values of the callbacks, and so 281 | // users must pay attention to what they return in their callbacks. 282 | 283 | STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) PURE; 284 | STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9 *pMaterial) PURE; 285 | STDMETHOD(SetLight)(THIS_ DWORD Index, CONST D3DLIGHT9 *pLight) PURE; 286 | STDMETHOD(LightEnable)(THIS_ DWORD Index, BOOL Enable) PURE; 287 | STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State, DWORD Value) PURE; 288 | STDMETHOD(SetTexture)(THIS_ DWORD Stage, LPDIRECT3DBASETEXTURE9 pTexture) PURE; 289 | STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) PURE; 290 | STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) PURE; 291 | STDMETHOD(SetNPatchMode)(THIS_ FLOAT NumSegments) PURE; 292 | STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; 293 | STDMETHOD(SetVertexShader)(THIS_ LPDIRECT3DVERTEXSHADER9 pShader) PURE; 294 | STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE; 295 | STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE; 296 | STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE; 297 | STDMETHOD(SetPixelShader)(THIS_ LPDIRECT3DPIXELSHADER9 pShader) PURE; 298 | STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE; 299 | STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE; 300 | STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE; 301 | }; 302 | 303 | 304 | ////////////////////////////////////////////////////////////////////////////// 305 | // ID3DXEffect /////////////////////////////////////////////////////////////// 306 | ////////////////////////////////////////////////////////////////////////////// 307 | 308 | typedef interface ID3DXEffect ID3DXEffect; 309 | typedef interface ID3DXEffect *LPD3DXEFFECT; 310 | 311 | // {F6CEB4B3-4E4C-40dd-B883-8D8DE5EA0CD5} 312 | DEFINE_GUID(IID_ID3DXEffect, 313 | 0xf6ceb4b3, 0x4e4c, 0x40dd, 0xb8, 0x83, 0x8d, 0x8d, 0xe5, 0xea, 0xc, 0xd5); 314 | 315 | #undef INTERFACE 316 | #define INTERFACE ID3DXEffect 317 | 318 | DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect) 319 | { 320 | // ID3DXBaseEffect 321 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 322 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 323 | STDMETHOD_(ULONG, Release)(THIS) PURE; 324 | 325 | // Descs 326 | STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; 327 | STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; 328 | STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; 329 | STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; 330 | STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; 331 | 332 | // Handle operations 333 | STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; 334 | STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; 335 | STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; 336 | STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; 337 | STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; 338 | STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; 339 | STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; 340 | STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; 341 | STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; 342 | STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; 343 | STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; 344 | STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; 345 | 346 | // Get/Set Parameters 347 | STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; 348 | STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; 349 | STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; 350 | STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; 351 | STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; 352 | STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; 353 | STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; 354 | STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; 355 | STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; 356 | STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; 357 | STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; 358 | STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; 359 | STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; 360 | STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; 361 | STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; 362 | STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; 363 | STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; 364 | STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; 365 | STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; 366 | STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; 367 | STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; 368 | STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; 369 | STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; 370 | STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; 371 | STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; 372 | STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; 373 | STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; 374 | STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; 375 | STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; 376 | STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; 377 | STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; 378 | STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; 379 | STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; 380 | STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; 381 | STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; 382 | STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; 383 | 384 | //Set Range of an Array to pass to device 385 | //Usefull for sending only a subrange of an array down to the device 386 | STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; 387 | // ID3DXBaseEffect 388 | 389 | 390 | // Pool 391 | STDMETHOD(GetPool)(THIS_ LPD3DXEFFECTPOOL* ppPool) PURE; 392 | 393 | // Selecting and setting a technique 394 | STDMETHOD(SetTechnique)(THIS_ D3DXHANDLE hTechnique) PURE; 395 | STDMETHOD_(D3DXHANDLE, GetCurrentTechnique)(THIS) PURE; 396 | STDMETHOD(ValidateTechnique)(THIS_ D3DXHANDLE hTechnique) PURE; 397 | STDMETHOD(FindNextValidTechnique)(THIS_ D3DXHANDLE hTechnique, D3DXHANDLE *pTechnique) PURE; 398 | STDMETHOD_(BOOL, IsParameterUsed)(THIS_ D3DXHANDLE hParameter, D3DXHANDLE hTechnique) PURE; 399 | 400 | // Using current technique 401 | // Begin starts active technique 402 | // BeginPass begins a pass 403 | // CommitChanges updates changes to any set calls in the pass. This should be called before 404 | // any DrawPrimitive call to d3d 405 | // EndPass ends a pass 406 | // End ends active technique 407 | STDMETHOD(Begin)(THIS_ UINT *pPasses, DWORD Flags) PURE; 408 | STDMETHOD(BeginPass)(THIS_ UINT Pass) PURE; 409 | STDMETHOD(CommitChanges)(THIS) PURE; 410 | STDMETHOD(EndPass)(THIS) PURE; 411 | STDMETHOD(End)(THIS) PURE; 412 | 413 | // Managing D3D Device 414 | STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; 415 | STDMETHOD(OnLostDevice)(THIS) PURE; 416 | STDMETHOD(OnResetDevice)(THIS) PURE; 417 | 418 | // Logging device calls 419 | STDMETHOD(SetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER pManager) PURE; 420 | STDMETHOD(GetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER *ppManager) PURE; 421 | 422 | // Parameter blocks 423 | STDMETHOD(BeginParameterBlock)(THIS) PURE; 424 | STDMETHOD_(D3DXHANDLE, EndParameterBlock)(THIS) PURE; 425 | STDMETHOD(ApplyParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE; 426 | STDMETHOD(DeleteParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE; 427 | 428 | // Cloning 429 | STDMETHOD(CloneEffect)(THIS_ LPDIRECT3DDEVICE9 pDevice, LPD3DXEFFECT* ppEffect) PURE; 430 | 431 | // Fast path for setting variables directly in ID3DXEffect 432 | STDMETHOD(SetRawValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT ByteOffset, UINT Bytes) PURE; 433 | }; 434 | 435 | 436 | ////////////////////////////////////////////////////////////////////////////// 437 | // ID3DXEffectCompiler /////////////////////////////////////////////////////// 438 | ////////////////////////////////////////////////////////////////////////////// 439 | 440 | typedef interface ID3DXEffectCompiler ID3DXEffectCompiler; 441 | typedef interface ID3DXEffectCompiler *LPD3DXEFFECTCOMPILER; 442 | 443 | // {51B8A949-1A31-47e6-BEA0-4B30DB53F1E0} 444 | DEFINE_GUID(IID_ID3DXEffectCompiler, 445 | 0x51b8a949, 0x1a31, 0x47e6, 0xbe, 0xa0, 0x4b, 0x30, 0xdb, 0x53, 0xf1, 0xe0); 446 | 447 | 448 | #undef INTERFACE 449 | #define INTERFACE ID3DXEffectCompiler 450 | 451 | DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect) 452 | { 453 | // ID3DXBaseEffect 454 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 455 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 456 | STDMETHOD_(ULONG, Release)(THIS) PURE; 457 | 458 | // Descs 459 | STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; 460 | STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; 461 | STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; 462 | STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; 463 | STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; 464 | 465 | // Handle operations 466 | STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; 467 | STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; 468 | STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; 469 | STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; 470 | STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; 471 | STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; 472 | STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; 473 | STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; 474 | STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; 475 | STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; 476 | STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; 477 | STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; 478 | 479 | // Get/Set Parameters 480 | STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; 481 | STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; 482 | STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; 483 | STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; 484 | STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; 485 | STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; 486 | STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; 487 | STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; 488 | STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; 489 | STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; 490 | STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; 491 | STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; 492 | STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; 493 | STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; 494 | STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; 495 | STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; 496 | STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; 497 | STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; 498 | STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; 499 | STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; 500 | STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; 501 | STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; 502 | STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; 503 | STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; 504 | STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; 505 | STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; 506 | STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; 507 | STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; 508 | STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; 509 | STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; 510 | STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; 511 | STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; 512 | STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; 513 | STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; 514 | STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; 515 | STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; 516 | 517 | //Set Range of an Array to pass to device 518 | //Usefull for sending only a subrange of an array down to the device 519 | STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; 520 | // ID3DXBaseEffect 521 | 522 | // Parameter sharing, specialization, and information 523 | STDMETHOD(SetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL Literal) PURE; 524 | STDMETHOD(GetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL *pLiteral) PURE; 525 | 526 | // Compilation 527 | STDMETHOD(CompileEffect)(THIS_ DWORD Flags, 528 | LPD3DXBUFFER* ppEffect, LPD3DXBUFFER* ppErrorMsgs) PURE; 529 | 530 | STDMETHOD(CompileShader)(THIS_ D3DXHANDLE hFunction, LPCSTR pTarget, DWORD Flags, 531 | LPD3DXBUFFER* ppShader, LPD3DXBUFFER* ppErrorMsgs, LPD3DXCONSTANTTABLE* ppConstantTable) PURE; 532 | }; 533 | 534 | 535 | ////////////////////////////////////////////////////////////////////////////// 536 | // APIs ////////////////////////////////////////////////////////////////////// 537 | ////////////////////////////////////////////////////////////////////////////// 538 | 539 | 540 | #ifdef __cplusplus 541 | extern "C" { 542 | #endif //__cplusplus 543 | 544 | //---------------------------------------------------------------------------- 545 | // D3DXCreateEffectPool: 546 | // --------------------- 547 | // Creates an effect pool. Pools are used for sharing parameters between 548 | // multiple effects. For all effects within a pool, shared parameters of the 549 | // same name all share the same value. 550 | // 551 | // Parameters: 552 | // ppPool 553 | // Returns the created pool. 554 | //---------------------------------------------------------------------------- 555 | 556 | HRESULT WINAPI 557 | D3DXCreateEffectPool( 558 | LPD3DXEFFECTPOOL* ppPool); 559 | 560 | 561 | //---------------------------------------------------------------------------- 562 | // D3DXCreateEffect: 563 | // ----------------- 564 | // Creates an effect from an ascii or binary effect description. 565 | // 566 | // Parameters: 567 | // pDevice 568 | // Pointer of the device on which to create the effect 569 | // pSrcFile 570 | // Name of the file containing the effect description 571 | // hSrcModule 572 | // Module handle. if NULL, current module will be used. 573 | // pSrcResource 574 | // Resource name in module 575 | // pSrcData 576 | // Pointer to effect description 577 | // SrcDataSize 578 | // Size of the effect description in bytes 579 | // pDefines 580 | // Optional NULL-terminated array of preprocessor macro definitions. 581 | // Flags 582 | // See D3DXSHADER_xxx flags. 583 | // pSkipConstants 584 | // A list of semi-colon delimited variable names. The effect will 585 | // not set these variables to the device when they are referenced 586 | // by a shader. NOTE: the variables specified here must be 587 | // register bound in the file and must not be used in expressions 588 | // in passes or samplers or the file will not load. 589 | // pInclude 590 | // Optional interface pointer to use for handling #include directives. 591 | // If this parameter is NULL, #includes will be honored when compiling 592 | // from file, and will error when compiling from resource or memory. 593 | // pPool 594 | // Pointer to ID3DXEffectPool object to use for shared parameters. 595 | // If NULL, no parameters will be shared. 596 | // ppEffect 597 | // Returns a buffer containing created effect. 598 | // ppCompilationErrors 599 | // Returns a buffer containing any error messages which occurred during 600 | // compile. Or NULL if you do not care about the error messages. 601 | // 602 | //---------------------------------------------------------------------------- 603 | 604 | HRESULT WINAPI 605 | D3DXCreateEffectFromFileA( 606 | LPDIRECT3DDEVICE9 pDevice, 607 | LPCSTR pSrcFile, 608 | CONST D3DXMACRO* pDefines, 609 | LPD3DXINCLUDE pInclude, 610 | DWORD Flags, 611 | LPD3DXEFFECTPOOL pPool, 612 | LPD3DXEFFECT* ppEffect, 613 | LPD3DXBUFFER* ppCompilationErrors); 614 | 615 | HRESULT WINAPI 616 | D3DXCreateEffectFromFileW( 617 | LPDIRECT3DDEVICE9 pDevice, 618 | LPCWSTR pSrcFile, 619 | CONST D3DXMACRO* pDefines, 620 | LPD3DXINCLUDE pInclude, 621 | DWORD Flags, 622 | LPD3DXEFFECTPOOL pPool, 623 | LPD3DXEFFECT* ppEffect, 624 | LPD3DXBUFFER* ppCompilationErrors); 625 | 626 | #ifdef UNICODE 627 | #define D3DXCreateEffectFromFile D3DXCreateEffectFromFileW 628 | #else 629 | #define D3DXCreateEffectFromFile D3DXCreateEffectFromFileA 630 | #endif 631 | 632 | 633 | HRESULT WINAPI 634 | D3DXCreateEffectFromResourceA( 635 | LPDIRECT3DDEVICE9 pDevice, 636 | HMODULE hSrcModule, 637 | LPCSTR pSrcResource, 638 | CONST D3DXMACRO* pDefines, 639 | LPD3DXINCLUDE pInclude, 640 | DWORD Flags, 641 | LPD3DXEFFECTPOOL pPool, 642 | LPD3DXEFFECT* ppEffect, 643 | LPD3DXBUFFER* ppCompilationErrors); 644 | 645 | HRESULT WINAPI 646 | D3DXCreateEffectFromResourceW( 647 | LPDIRECT3DDEVICE9 pDevice, 648 | HMODULE hSrcModule, 649 | LPCWSTR pSrcResource, 650 | CONST D3DXMACRO* pDefines, 651 | LPD3DXINCLUDE pInclude, 652 | DWORD Flags, 653 | LPD3DXEFFECTPOOL pPool, 654 | LPD3DXEFFECT* ppEffect, 655 | LPD3DXBUFFER* ppCompilationErrors); 656 | 657 | #ifdef UNICODE 658 | #define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceW 659 | #else 660 | #define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceA 661 | #endif 662 | 663 | 664 | HRESULT WINAPI 665 | D3DXCreateEffect( 666 | LPDIRECT3DDEVICE9 pDevice, 667 | LPCVOID pSrcData, 668 | UINT SrcDataLen, 669 | CONST D3DXMACRO* pDefines, 670 | LPD3DXINCLUDE pInclude, 671 | DWORD Flags, 672 | LPD3DXEFFECTPOOL pPool, 673 | LPD3DXEFFECT* ppEffect, 674 | LPD3DXBUFFER* ppCompilationErrors); 675 | 676 | // 677 | // Ex functions that accept pSkipConstants in addition to other parameters 678 | // 679 | 680 | HRESULT WINAPI 681 | D3DXCreateEffectFromFileExA( 682 | LPDIRECT3DDEVICE9 pDevice, 683 | LPCSTR pSrcFile, 684 | CONST D3DXMACRO* pDefines, 685 | LPD3DXINCLUDE pInclude, 686 | LPCSTR pSkipConstants, 687 | DWORD Flags, 688 | LPD3DXEFFECTPOOL pPool, 689 | LPD3DXEFFECT* ppEffect, 690 | LPD3DXBUFFER* ppCompilationErrors); 691 | 692 | HRESULT WINAPI 693 | D3DXCreateEffectFromFileExW( 694 | LPDIRECT3DDEVICE9 pDevice, 695 | LPCWSTR pSrcFile, 696 | CONST D3DXMACRO* pDefines, 697 | LPD3DXINCLUDE pInclude, 698 | LPCSTR pSkipConstants, 699 | DWORD Flags, 700 | LPD3DXEFFECTPOOL pPool, 701 | LPD3DXEFFECT* ppEffect, 702 | LPD3DXBUFFER* ppCompilationErrors); 703 | 704 | #ifdef UNICODE 705 | #define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExW 706 | #else 707 | #define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExA 708 | #endif 709 | 710 | 711 | HRESULT WINAPI 712 | D3DXCreateEffectFromResourceExA( 713 | LPDIRECT3DDEVICE9 pDevice, 714 | HMODULE hSrcModule, 715 | LPCSTR pSrcResource, 716 | CONST D3DXMACRO* pDefines, 717 | LPD3DXINCLUDE pInclude, 718 | LPCSTR pSkipConstants, 719 | DWORD Flags, 720 | LPD3DXEFFECTPOOL pPool, 721 | LPD3DXEFFECT* ppEffect, 722 | LPD3DXBUFFER* ppCompilationErrors); 723 | 724 | HRESULT WINAPI 725 | D3DXCreateEffectFromResourceExW( 726 | LPDIRECT3DDEVICE9 pDevice, 727 | HMODULE hSrcModule, 728 | LPCWSTR pSrcResource, 729 | CONST D3DXMACRO* pDefines, 730 | LPD3DXINCLUDE pInclude, 731 | LPCSTR pSkipConstants, 732 | DWORD Flags, 733 | LPD3DXEFFECTPOOL pPool, 734 | LPD3DXEFFECT* ppEffect, 735 | LPD3DXBUFFER* ppCompilationErrors); 736 | 737 | #ifdef UNICODE 738 | #define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExW 739 | #else 740 | #define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExA 741 | #endif 742 | 743 | 744 | HRESULT WINAPI 745 | D3DXCreateEffectEx( 746 | LPDIRECT3DDEVICE9 pDevice, 747 | LPCVOID pSrcData, 748 | UINT SrcDataLen, 749 | CONST D3DXMACRO* pDefines, 750 | LPD3DXINCLUDE pInclude, 751 | LPCSTR pSkipConstants, 752 | DWORD Flags, 753 | LPD3DXEFFECTPOOL pPool, 754 | LPD3DXEFFECT* ppEffect, 755 | LPD3DXBUFFER* ppCompilationErrors); 756 | 757 | //---------------------------------------------------------------------------- 758 | // D3DXCreateEffectCompiler: 759 | // ------------------------- 760 | // Creates an effect from an ascii or binary effect description. 761 | // 762 | // Parameters: 763 | // pSrcFile 764 | // Name of the file containing the effect description 765 | // hSrcModule 766 | // Module handle. if NULL, current module will be used. 767 | // pSrcResource 768 | // Resource name in module 769 | // pSrcData 770 | // Pointer to effect description 771 | // SrcDataSize 772 | // Size of the effect description in bytes 773 | // pDefines 774 | // Optional NULL-terminated array of preprocessor macro definitions. 775 | // pInclude 776 | // Optional interface pointer to use for handling #include directives. 777 | // If this parameter is NULL, #includes will be honored when compiling 778 | // from file, and will error when compiling from resource or memory. 779 | // pPool 780 | // Pointer to ID3DXEffectPool object to use for shared parameters. 781 | // If NULL, no parameters will be shared. 782 | // ppCompiler 783 | // Returns a buffer containing created effect compiler. 784 | // ppParseErrors 785 | // Returns a buffer containing any error messages which occurred during 786 | // parse. Or NULL if you do not care about the error messages. 787 | // 788 | //---------------------------------------------------------------------------- 789 | 790 | HRESULT WINAPI 791 | D3DXCreateEffectCompilerFromFileA( 792 | LPCSTR pSrcFile, 793 | CONST D3DXMACRO* pDefines, 794 | LPD3DXINCLUDE pInclude, 795 | DWORD Flags, 796 | LPD3DXEFFECTCOMPILER* ppCompiler, 797 | LPD3DXBUFFER* ppParseErrors); 798 | 799 | HRESULT WINAPI 800 | D3DXCreateEffectCompilerFromFileW( 801 | LPCWSTR pSrcFile, 802 | CONST D3DXMACRO* pDefines, 803 | LPD3DXINCLUDE pInclude, 804 | DWORD Flags, 805 | LPD3DXEFFECTCOMPILER* ppCompiler, 806 | LPD3DXBUFFER* ppParseErrors); 807 | 808 | #ifdef UNICODE 809 | #define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileW 810 | #else 811 | #define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileA 812 | #endif 813 | 814 | 815 | HRESULT WINAPI 816 | D3DXCreateEffectCompilerFromResourceA( 817 | HMODULE hSrcModule, 818 | LPCSTR pSrcResource, 819 | CONST D3DXMACRO* pDefines, 820 | LPD3DXINCLUDE pInclude, 821 | DWORD Flags, 822 | LPD3DXEFFECTCOMPILER* ppCompiler, 823 | LPD3DXBUFFER* ppParseErrors); 824 | 825 | HRESULT WINAPI 826 | D3DXCreateEffectCompilerFromResourceW( 827 | HMODULE hSrcModule, 828 | LPCWSTR pSrcResource, 829 | CONST D3DXMACRO* pDefines, 830 | LPD3DXINCLUDE pInclude, 831 | DWORD Flags, 832 | LPD3DXEFFECTCOMPILER* ppCompiler, 833 | LPD3DXBUFFER* ppParseErrors); 834 | 835 | #ifdef UNICODE 836 | #define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceW 837 | #else 838 | #define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceA 839 | #endif 840 | 841 | 842 | HRESULT WINAPI 843 | D3DXCreateEffectCompiler( 844 | LPCSTR pSrcData, 845 | UINT SrcDataLen, 846 | CONST D3DXMACRO* pDefines, 847 | LPD3DXINCLUDE pInclude, 848 | DWORD Flags, 849 | LPD3DXEFFECTCOMPILER* ppCompiler, 850 | LPD3DXBUFFER* ppParseErrors); 851 | 852 | //---------------------------------------------------------------------------- 853 | // D3DXDisassembleEffect: 854 | // ----------------------- 855 | // 856 | // Parameters: 857 | //---------------------------------------------------------------------------- 858 | 859 | HRESULT WINAPI 860 | D3DXDisassembleEffect( 861 | LPD3DXEFFECT pEffect, 862 | BOOL EnableColorCode, 863 | LPD3DXBUFFER *ppDisassembly); 864 | 865 | 866 | 867 | #ifdef __cplusplus 868 | } 869 | #endif //__cplusplus 870 | 871 | #endif //__D3DX9EFFECT_H__ 872 | 873 | 874 | -------------------------------------------------------------------------------- /d3dx9shader.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // 5 | // File: d3dx9shader.h 6 | // Content: D3DX Shader APIs 7 | // 8 | ////////////////////////////////////////////////////////////////////////////// 9 | 10 | #include "d3dx9.h" 11 | 12 | #ifndef __D3DX9SHADER_H__ 13 | #define __D3DX9SHADER_H__ 14 | 15 | 16 | //--------------------------------------------------------------------------- 17 | // D3DXTX_VERSION: 18 | // -------------- 19 | // Version token used to create a procedural texture filler in effects 20 | // Used by D3DXFill[]TX functions 21 | //--------------------------------------------------------------------------- 22 | #define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor)) 23 | 24 | 25 | 26 | //---------------------------------------------------------------------------- 27 | // D3DXSHADER flags: 28 | // ----------------- 29 | // D3DXSHADER_DEBUG 30 | // Insert debug file/line/type/symbol information. 31 | // 32 | // D3DXSHADER_SKIPVALIDATION 33 | // Do not validate the generated code against known capabilities and 34 | // constraints. This option is only recommended when compiling shaders 35 | // you KNOW will work. (ie. have compiled before without this option.) 36 | // Shaders are always validated by D3D before they are set to the device. 37 | // 38 | // D3DXSHADER_SKIPOPTIMIZATION 39 | // Instructs the compiler to skip optimization steps during code generation. 40 | // Unless you are trying to isolate a problem in your code using this option 41 | // is not recommended. 42 | // 43 | // D3DXSHADER_PACKMATRIX_ROWMAJOR 44 | // Unless explicitly specified, matrices will be packed in row-major order 45 | // on input and output from the shader. 46 | // 47 | // D3DXSHADER_PACKMATRIX_COLUMNMAJOR 48 | // Unless explicitly specified, matrices will be packed in column-major 49 | // order on input and output from the shader. This is generally more 50 | // efficient, since it allows vector-matrix multiplication to be performed 51 | // using a series of dot-products. 52 | // 53 | // D3DXSHADER_PARTIALPRECISION 54 | // Force all computations in resulting shader to occur at partial precision. 55 | // This may result in faster evaluation of shaders on some hardware. 56 | // 57 | // D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT 58 | // Force compiler to compile against the next highest available software 59 | // target for vertex shaders. This flag also turns optimizations off, 60 | // and debugging on. 61 | // 62 | // D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT 63 | // Force compiler to compile against the next highest available software 64 | // target for pixel shaders. This flag also turns optimizations off, 65 | // and debugging on. 66 | // 67 | // D3DXSHADER_NO_PRESHADER 68 | // Disables Preshaders. Using this flag will cause the compiler to not 69 | // pull out static expression for evaluation on the host cpu 70 | // 71 | // D3DXSHADER_AVOID_FLOW_CONTROL 72 | // Hint compiler to avoid flow-control constructs where possible. 73 | // 74 | // D3DXSHADER_PREFER_FLOW_CONTROL 75 | // Hint compiler to prefer flow-control constructs where possible. 76 | // 77 | //---------------------------------------------------------------------------- 78 | 79 | #define D3DXSHADER_DEBUG (1 << 0) 80 | #define D3DXSHADER_SKIPVALIDATION (1 << 1) 81 | #define D3DXSHADER_SKIPOPTIMIZATION (1 << 2) 82 | #define D3DXSHADER_PACKMATRIX_ROWMAJOR (1 << 3) 83 | #define D3DXSHADER_PACKMATRIX_COLUMNMAJOR (1 << 4) 84 | #define D3DXSHADER_PARTIALPRECISION (1 << 5) 85 | #define D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT (1 << 6) 86 | #define D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT (1 << 7) 87 | #define D3DXSHADER_NO_PRESHADER (1 << 8) 88 | #define D3DXSHADER_AVOID_FLOW_CONTROL (1 << 9) 89 | #define D3DXSHADER_PREFER_FLOW_CONTROL (1 << 10) 90 | #define D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12) 91 | #define D3DXSHADER_IEEE_STRICTNESS (1 << 13) 92 | #define D3DXSHADER_USE_LEGACY_D3DX9_31_DLL (1 << 16) 93 | 94 | 95 | // optimization level flags 96 | #define D3DXSHADER_OPTIMIZATION_LEVEL0 (1 << 14) 97 | #define D3DXSHADER_OPTIMIZATION_LEVEL1 0 98 | #define D3DXSHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15)) 99 | #define D3DXSHADER_OPTIMIZATION_LEVEL3 (1 << 15) 100 | 101 | 102 | 103 | //---------------------------------------------------------------------------- 104 | // D3DXCONSTTABLE flags: 105 | // ------------------- 106 | 107 | #define D3DXCONSTTABLE_LARGEADDRESSAWARE (1 << 17) 108 | 109 | 110 | 111 | //---------------------------------------------------------------------------- 112 | // D3DXHANDLE: 113 | // ----------- 114 | // Handle values used to efficiently reference shader and effect parameters. 115 | // Strings can be used as handles. However, handles are not always strings. 116 | //---------------------------------------------------------------------------- 117 | 118 | #ifndef D3DXFX_LARGEADDRESS_HANDLE 119 | typedef LPCSTR D3DXHANDLE; 120 | #else 121 | typedef UINT_PTR D3DXHANDLE; 122 | #endif 123 | typedef D3DXHANDLE *LPD3DXHANDLE; 124 | 125 | 126 | //---------------------------------------------------------------------------- 127 | // D3DXMACRO: 128 | // ---------- 129 | // Preprocessor macro definition. The application pass in a NULL-terminated 130 | // array of this structure to various D3DX APIs. This enables the application 131 | // to #define tokens at runtime, before the file is parsed. 132 | //---------------------------------------------------------------------------- 133 | 134 | typedef struct _D3DXMACRO 135 | { 136 | LPCSTR Name; 137 | LPCSTR Definition; 138 | 139 | } D3DXMACRO, *LPD3DXMACRO; 140 | 141 | 142 | //---------------------------------------------------------------------------- 143 | // D3DXSEMANTIC: 144 | //---------------------------------------------------------------------------- 145 | 146 | typedef struct _D3DXSEMANTIC 147 | { 148 | UINT Usage; 149 | UINT UsageIndex; 150 | 151 | } D3DXSEMANTIC, *LPD3DXSEMANTIC; 152 | 153 | 154 | 155 | //---------------------------------------------------------------------------- 156 | // D3DXREGISTER_SET: 157 | //---------------------------------------------------------------------------- 158 | 159 | typedef enum _D3DXREGISTER_SET 160 | { 161 | D3DXRS_BOOL, 162 | D3DXRS_INT4, 163 | D3DXRS_FLOAT4, 164 | D3DXRS_SAMPLER, 165 | 166 | // force 32-bit size enum 167 | D3DXRS_FORCE_DWORD = 0x7fffffff 168 | 169 | } D3DXREGISTER_SET, *LPD3DXREGISTER_SET; 170 | 171 | 172 | //---------------------------------------------------------------------------- 173 | // D3DXPARAMETER_CLASS: 174 | //---------------------------------------------------------------------------- 175 | 176 | typedef enum _D3DXPARAMETER_CLASS 177 | { 178 | D3DXPC_SCALAR, 179 | D3DXPC_VECTOR, 180 | D3DXPC_MATRIX_ROWS, 181 | D3DXPC_MATRIX_COLUMNS, 182 | D3DXPC_OBJECT, 183 | D3DXPC_STRUCT, 184 | 185 | // force 32-bit size enum 186 | D3DXPC_FORCE_DWORD = 0x7fffffff 187 | 188 | } D3DXPARAMETER_CLASS, *LPD3DXPARAMETER_CLASS; 189 | 190 | 191 | //---------------------------------------------------------------------------- 192 | // D3DXPARAMETER_TYPE: 193 | //---------------------------------------------------------------------------- 194 | 195 | typedef enum _D3DXPARAMETER_TYPE 196 | { 197 | D3DXPT_VOID, 198 | D3DXPT_BOOL, 199 | D3DXPT_INT, 200 | D3DXPT_FLOAT, 201 | D3DXPT_STRING, 202 | D3DXPT_TEXTURE, 203 | D3DXPT_TEXTURE1D, 204 | D3DXPT_TEXTURE2D, 205 | D3DXPT_TEXTURE3D, 206 | D3DXPT_TEXTURECUBE, 207 | D3DXPT_SAMPLER, 208 | D3DXPT_SAMPLER1D, 209 | D3DXPT_SAMPLER2D, 210 | D3DXPT_SAMPLER3D, 211 | D3DXPT_SAMPLERCUBE, 212 | D3DXPT_PIXELSHADER, 213 | D3DXPT_VERTEXSHADER, 214 | D3DXPT_PIXELFRAGMENT, 215 | D3DXPT_VERTEXFRAGMENT, 216 | D3DXPT_UNSUPPORTED, 217 | 218 | // force 32-bit size enum 219 | D3DXPT_FORCE_DWORD = 0x7fffffff 220 | 221 | } D3DXPARAMETER_TYPE, *LPD3DXPARAMETER_TYPE; 222 | 223 | 224 | //---------------------------------------------------------------------------- 225 | // D3DXCONSTANTTABLE_DESC: 226 | //---------------------------------------------------------------------------- 227 | 228 | typedef struct _D3DXCONSTANTTABLE_DESC 229 | { 230 | LPCSTR Creator; // Creator string 231 | DWORD Version; // Shader version 232 | UINT Constants; // Number of constants 233 | 234 | } D3DXCONSTANTTABLE_DESC, *LPD3DXCONSTANTTABLE_DESC; 235 | 236 | 237 | //---------------------------------------------------------------------------- 238 | // D3DXCONSTANT_DESC: 239 | //---------------------------------------------------------------------------- 240 | 241 | typedef struct _D3DXCONSTANT_DESC 242 | { 243 | LPCSTR Name; // Constant name 244 | 245 | D3DXREGISTER_SET RegisterSet; // Register set 246 | UINT RegisterIndex; // Register index 247 | UINT RegisterCount; // Number of registers occupied 248 | 249 | D3DXPARAMETER_CLASS Class; // Class 250 | D3DXPARAMETER_TYPE Type; // Component type 251 | 252 | UINT Rows; // Number of rows 253 | UINT Columns; // Number of columns 254 | UINT Elements; // Number of array elements 255 | UINT StructMembers; // Number of structure member sub-parameters 256 | 257 | UINT Bytes; // Data size, in bytes 258 | LPCVOID DefaultValue; // Pointer to default value 259 | 260 | } D3DXCONSTANT_DESC, *LPD3DXCONSTANT_DESC; 261 | 262 | 263 | 264 | //---------------------------------------------------------------------------- 265 | // ID3DXConstantTable: 266 | //---------------------------------------------------------------------------- 267 | 268 | typedef interface ID3DXConstantTable ID3DXConstantTable; 269 | typedef interface ID3DXConstantTable *LPD3DXCONSTANTTABLE; 270 | 271 | // {AB3C758F-093E-4356-B762-4DB18F1B3A01} 272 | DEFINE_GUID(IID_ID3DXConstantTable, 273 | 0xab3c758f, 0x93e, 0x4356, 0xb7, 0x62, 0x4d, 0xb1, 0x8f, 0x1b, 0x3a, 0x1); 274 | 275 | 276 | #undef INTERFACE 277 | #define INTERFACE ID3DXConstantTable 278 | 279 | DECLARE_INTERFACE_(ID3DXConstantTable, IUnknown) 280 | { 281 | // IUnknown 282 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 283 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 284 | STDMETHOD_(ULONG, Release)(THIS) PURE; 285 | 286 | // Buffer 287 | STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; 288 | STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; 289 | 290 | // Descs 291 | STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; 292 | STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; 293 | STDMETHOD_(UINT, GetSamplerIndex)(THIS_ D3DXHANDLE hConstant) PURE; 294 | 295 | // Handle operations 296 | STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; 297 | STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE; 298 | STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; 299 | 300 | // Set Constants 301 | STDMETHOD(SetDefaults)(THIS_ LPDIRECT3DDEVICE9 pDevice) PURE; 302 | STDMETHOD(SetValue)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE; 303 | STDMETHOD(SetBool)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, BOOL b) PURE; 304 | STDMETHOD(SetBoolArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE; 305 | STDMETHOD(SetInt)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, INT n) PURE; 306 | STDMETHOD(SetIntArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE; 307 | STDMETHOD(SetFloat)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, FLOAT f) PURE; 308 | STDMETHOD(SetFloatArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE; 309 | STDMETHOD(SetVector)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE; 310 | STDMETHOD(SetVectorArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE; 311 | STDMETHOD(SetMatrix)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; 312 | STDMETHOD(SetMatrixArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; 313 | STDMETHOD(SetMatrixPointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; 314 | STDMETHOD(SetMatrixTranspose)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; 315 | STDMETHOD(SetMatrixTransposeArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; 316 | STDMETHOD(SetMatrixTransposePointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; 317 | }; 318 | 319 | 320 | //---------------------------------------------------------------------------- 321 | // ID3DXTextureShader: 322 | //---------------------------------------------------------------------------- 323 | 324 | typedef interface ID3DXTextureShader ID3DXTextureShader; 325 | typedef interface ID3DXTextureShader *LPD3DXTEXTURESHADER; 326 | 327 | // {3E3D67F8-AA7A-405d-A857-BA01D4758426} 328 | DEFINE_GUID(IID_ID3DXTextureShader, 329 | 0x3e3d67f8, 0xaa7a, 0x405d, 0xa8, 0x57, 0xba, 0x1, 0xd4, 0x75, 0x84, 0x26); 330 | 331 | #undef INTERFACE 332 | #define INTERFACE ID3DXTextureShader 333 | 334 | DECLARE_INTERFACE_(ID3DXTextureShader, IUnknown) 335 | { 336 | // IUnknown 337 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; 338 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; 339 | STDMETHOD_(ULONG, Release)(THIS) PURE; 340 | 341 | // Gets 342 | STDMETHOD(GetFunction)(THIS_ LPD3DXBUFFER *ppFunction) PURE; 343 | STDMETHOD(GetConstantBuffer)(THIS_ LPD3DXBUFFER *ppConstantBuffer) PURE; 344 | 345 | // Descs 346 | STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; 347 | STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; 348 | 349 | // Handle operations 350 | STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; 351 | STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE; 352 | STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; 353 | 354 | // Set Constants 355 | STDMETHOD(SetDefaults)(THIS) PURE; 356 | STDMETHOD(SetValue)(THIS_ D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE; 357 | STDMETHOD(SetBool)(THIS_ D3DXHANDLE hConstant, BOOL b) PURE; 358 | STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE; 359 | STDMETHOD(SetInt)(THIS_ D3DXHANDLE hConstant, INT n) PURE; 360 | STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE; 361 | STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hConstant, FLOAT f) PURE; 362 | STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE; 363 | STDMETHOD(SetVector)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE; 364 | STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE; 365 | STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; 366 | STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; 367 | STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; 368 | STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; 369 | STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; 370 | STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; 371 | }; 372 | 373 | 374 | //---------------------------------------------------------------------------- 375 | // D3DXINCLUDE_TYPE: 376 | //---------------------------------------------------------------------------- 377 | 378 | typedef enum _D3DXINCLUDE_TYPE 379 | { 380 | D3DXINC_LOCAL, 381 | D3DXINC_SYSTEM, 382 | 383 | // force 32-bit size enum 384 | D3DXINC_FORCE_DWORD = 0x7fffffff 385 | 386 | } D3DXINCLUDE_TYPE, *LPD3DXINCLUDE_TYPE; 387 | 388 | 389 | //---------------------------------------------------------------------------- 390 | // ID3DXInclude: 391 | // ------------- 392 | // This interface is intended to be implemented by the application, and can 393 | // be used by various D3DX APIs. This enables application-specific handling 394 | // of #include directives in source files. 395 | // 396 | // Open() 397 | // Opens an include file. If successful, it should fill in ppData and 398 | // pBytes. The data pointer returned must remain valid until Close is 399 | // subsequently called. The name of the file is encoded in UTF-8 format. 400 | // Close() 401 | // Closes an include file. If Open was successful, Close is guaranteed 402 | // to be called before the API using this interface returns. 403 | //---------------------------------------------------------------------------- 404 | 405 | typedef interface ID3DXInclude ID3DXInclude; 406 | typedef interface ID3DXInclude *LPD3DXINCLUDE; 407 | 408 | #undef INTERFACE 409 | #define INTERFACE ID3DXInclude 410 | 411 | DECLARE_INTERFACE(ID3DXInclude) 412 | { 413 | STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE; 414 | STDMETHOD(Close)(THIS_ LPCVOID pData) PURE; 415 | }; 416 | 417 | 418 | ////////////////////////////////////////////////////////////////////////////// 419 | // APIs ////////////////////////////////////////////////////////////////////// 420 | ////////////////////////////////////////////////////////////////////////////// 421 | 422 | #ifdef __cplusplus 423 | extern "C" { 424 | #endif //__cplusplus 425 | 426 | 427 | //---------------------------------------------------------------------------- 428 | // D3DXAssembleShader: 429 | // ------------------- 430 | // Assembles a shader. 431 | // 432 | // Parameters: 433 | // pSrcFile 434 | // Source file name 435 | // hSrcModule 436 | // Module handle. if NULL, current module will be used 437 | // pSrcResource 438 | // Resource name in module 439 | // pSrcData 440 | // Pointer to source code 441 | // SrcDataLen 442 | // Size of source code, in bytes 443 | // pDefines 444 | // Optional NULL-terminated array of preprocessor macro definitions. 445 | // pInclude 446 | // Optional interface pointer to use for handling #include directives. 447 | // If this parameter is NULL, #includes will be honored when assembling 448 | // from file, and will error when assembling from resource or memory. 449 | // Flags 450 | // See D3DXSHADER_xxx flags 451 | // ppShader 452 | // Returns a buffer containing the created shader. This buffer contains 453 | // the assembled shader code, as well as any embedded debug info. 454 | // ppErrorMsgs 455 | // Returns a buffer containing a listing of errors and warnings that were 456 | // encountered during assembly. If you are running in a debugger, 457 | // these are the same messages you will see in your debug output. 458 | //---------------------------------------------------------------------------- 459 | 460 | 461 | HRESULT WINAPI 462 | D3DXAssembleShaderFromFileA( 463 | LPCSTR pSrcFile, 464 | CONST D3DXMACRO* pDefines, 465 | LPD3DXINCLUDE pInclude, 466 | DWORD Flags, 467 | LPD3DXBUFFER* ppShader, 468 | LPD3DXBUFFER* ppErrorMsgs); 469 | 470 | HRESULT WINAPI 471 | D3DXAssembleShaderFromFileW( 472 | LPCWSTR pSrcFile, 473 | CONST D3DXMACRO* pDefines, 474 | LPD3DXINCLUDE pInclude, 475 | DWORD Flags, 476 | LPD3DXBUFFER* ppShader, 477 | LPD3DXBUFFER* ppErrorMsgs); 478 | 479 | #ifdef UNICODE 480 | #define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileW 481 | #else 482 | #define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileA 483 | #endif 484 | 485 | 486 | HRESULT WINAPI 487 | D3DXAssembleShaderFromResourceA( 488 | HMODULE hSrcModule, 489 | LPCSTR pSrcResource, 490 | CONST D3DXMACRO* pDefines, 491 | LPD3DXINCLUDE pInclude, 492 | DWORD Flags, 493 | LPD3DXBUFFER* ppShader, 494 | LPD3DXBUFFER* ppErrorMsgs); 495 | 496 | HRESULT WINAPI 497 | D3DXAssembleShaderFromResourceW( 498 | HMODULE hSrcModule, 499 | LPCWSTR pSrcResource, 500 | CONST D3DXMACRO* pDefines, 501 | LPD3DXINCLUDE pInclude, 502 | DWORD Flags, 503 | LPD3DXBUFFER* ppShader, 504 | LPD3DXBUFFER* ppErrorMsgs); 505 | 506 | #ifdef UNICODE 507 | #define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceW 508 | #else 509 | #define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceA 510 | #endif 511 | 512 | 513 | HRESULT WINAPI 514 | D3DXAssembleShader( 515 | LPCSTR pSrcData, 516 | UINT SrcDataLen, 517 | CONST D3DXMACRO* pDefines, 518 | LPD3DXINCLUDE pInclude, 519 | DWORD Flags, 520 | LPD3DXBUFFER* ppShader, 521 | LPD3DXBUFFER* ppErrorMsgs); 522 | 523 | 524 | 525 | //---------------------------------------------------------------------------- 526 | // D3DXCompileShader: 527 | // ------------------ 528 | // Compiles a shader. 529 | // 530 | // Parameters: 531 | // pSrcFile 532 | // Source file name. 533 | // hSrcModule 534 | // Module handle. if NULL, current module will be used. 535 | // pSrcResource 536 | // Resource name in module. 537 | // pSrcData 538 | // Pointer to source code. 539 | // SrcDataLen 540 | // Size of source code, in bytes. 541 | // pDefines 542 | // Optional NULL-terminated array of preprocessor macro definitions. 543 | // pInclude 544 | // Optional interface pointer to use for handling #include directives. 545 | // If this parameter is NULL, #includes will be honored when compiling 546 | // from file, and will error when compiling from resource or memory. 547 | // pFunctionName 548 | // Name of the entrypoint function where execution should begin. 549 | // pProfile 550 | // Instruction set to be used when generating code. Currently supported 551 | // profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "ps_1_1", 552 | // "ps_1_2", "ps_1_3", "ps_1_4", "ps_2_0", "ps_2_a", "ps_2_sw", "tx_1_0" 553 | // Flags 554 | // See D3DXSHADER_xxx flags. 555 | // ppShader 556 | // Returns a buffer containing the created shader. This buffer contains 557 | // the compiled shader code, as well as any embedded debug and symbol 558 | // table info. (See D3DXGetShaderConstantTable) 559 | // ppErrorMsgs 560 | // Returns a buffer containing a listing of errors and warnings that were 561 | // encountered during the compile. If you are running in a debugger, 562 | // these are the same messages you will see in your debug output. 563 | // ppConstantTable 564 | // Returns a ID3DXConstantTable object which can be used to set 565 | // shader constants to the device. Alternatively, an application can 566 | // parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within 567 | // the shader. 568 | //---------------------------------------------------------------------------- 569 | 570 | HRESULT WINAPI 571 | D3DXCompileShaderFromFileA( 572 | LPCSTR pSrcFile, 573 | CONST D3DXMACRO* pDefines, 574 | LPD3DXINCLUDE pInclude, 575 | LPCSTR pFunctionName, 576 | LPCSTR pProfile, 577 | DWORD Flags, 578 | LPD3DXBUFFER* ppShader, 579 | LPD3DXBUFFER* ppErrorMsgs, 580 | LPD3DXCONSTANTTABLE* ppConstantTable); 581 | 582 | HRESULT WINAPI 583 | D3DXCompileShaderFromFileW( 584 | LPCWSTR pSrcFile, 585 | CONST D3DXMACRO* pDefines, 586 | LPD3DXINCLUDE pInclude, 587 | LPCSTR pFunctionName, 588 | LPCSTR pProfile, 589 | DWORD Flags, 590 | LPD3DXBUFFER* ppShader, 591 | LPD3DXBUFFER* ppErrorMsgs, 592 | LPD3DXCONSTANTTABLE* ppConstantTable); 593 | 594 | #ifdef UNICODE 595 | #define D3DXCompileShaderFromFile D3DXCompileShaderFromFileW 596 | #else 597 | #define D3DXCompileShaderFromFile D3DXCompileShaderFromFileA 598 | #endif 599 | 600 | 601 | HRESULT WINAPI 602 | D3DXCompileShaderFromResourceA( 603 | HMODULE hSrcModule, 604 | LPCSTR pSrcResource, 605 | CONST D3DXMACRO* pDefines, 606 | LPD3DXINCLUDE pInclude, 607 | LPCSTR pFunctionName, 608 | LPCSTR pProfile, 609 | DWORD Flags, 610 | LPD3DXBUFFER* ppShader, 611 | LPD3DXBUFFER* ppErrorMsgs, 612 | LPD3DXCONSTANTTABLE* ppConstantTable); 613 | 614 | HRESULT WINAPI 615 | D3DXCompileShaderFromResourceW( 616 | HMODULE hSrcModule, 617 | LPCWSTR pSrcResource, 618 | CONST D3DXMACRO* pDefines, 619 | LPD3DXINCLUDE pInclude, 620 | LPCSTR pFunctionName, 621 | LPCSTR pProfile, 622 | DWORD Flags, 623 | LPD3DXBUFFER* ppShader, 624 | LPD3DXBUFFER* ppErrorMsgs, 625 | LPD3DXCONSTANTTABLE* ppConstantTable); 626 | 627 | #ifdef UNICODE 628 | #define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceW 629 | #else 630 | #define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceA 631 | #endif 632 | 633 | 634 | HRESULT WINAPI 635 | D3DXCompileShader( 636 | LPCSTR pSrcData, 637 | UINT SrcDataLen, 638 | CONST D3DXMACRO* pDefines, 639 | LPD3DXINCLUDE pInclude, 640 | LPCSTR pFunctionName, 641 | LPCSTR pProfile, 642 | DWORD Flags, 643 | LPD3DXBUFFER* ppShader, 644 | LPD3DXBUFFER* ppErrorMsgs, 645 | LPD3DXCONSTANTTABLE* ppConstantTable); 646 | 647 | 648 | //---------------------------------------------------------------------------- 649 | // D3DXDisassembleShader: 650 | // ---------------------- 651 | // Takes a binary shader, and returns a buffer containing text assembly. 652 | // 653 | // Parameters: 654 | // pShader 655 | // Pointer to the shader byte code. 656 | // ShaderSizeInBytes 657 | // Size of the shader byte code in bytes. 658 | // EnableColorCode 659 | // Emit HTML tags for color coding the output? 660 | // pComments 661 | // Pointer to a comment string to include at the top of the shader. 662 | // ppDisassembly 663 | // Returns a buffer containing the disassembled shader. 664 | //---------------------------------------------------------------------------- 665 | 666 | HRESULT WINAPI 667 | D3DXDisassembleShader( 668 | CONST DWORD* pShader, 669 | BOOL EnableColorCode, 670 | LPCSTR pComments, 671 | LPD3DXBUFFER* ppDisassembly); 672 | 673 | 674 | //---------------------------------------------------------------------------- 675 | // D3DXGetPixelShaderProfile/D3DXGetVertexShaderProfile: 676 | // ----------------------------------------------------- 677 | // Returns the name of the HLSL profile best suited to a given device. 678 | // 679 | // Parameters: 680 | // pDevice 681 | // Pointer to the device in question 682 | //---------------------------------------------------------------------------- 683 | 684 | LPCSTR WINAPI 685 | D3DXGetPixelShaderProfile( 686 | LPDIRECT3DDEVICE9 pDevice); 687 | 688 | LPCSTR WINAPI 689 | D3DXGetVertexShaderProfile( 690 | LPDIRECT3DDEVICE9 pDevice); 691 | 692 | 693 | //---------------------------------------------------------------------------- 694 | // D3DXFindShaderComment: 695 | // ---------------------- 696 | // Searches through a shader for a particular comment, denoted by a FourCC in 697 | // the first DWORD of the comment. If the comment is not found, and no other 698 | // error has occurred, S_FALSE is returned. 699 | // 700 | // Parameters: 701 | // pFunction 702 | // Pointer to the function DWORD stream 703 | // FourCC 704 | // FourCC used to identify the desired comment block. 705 | // ppData 706 | // Returns a pointer to the comment data (not including comment token 707 | // and FourCC). Can be NULL. 708 | // pSizeInBytes 709 | // Returns the size of the comment data in bytes. Can be NULL. 710 | //---------------------------------------------------------------------------- 711 | 712 | HRESULT WINAPI 713 | D3DXFindShaderComment( 714 | CONST DWORD* pFunction, 715 | DWORD FourCC, 716 | LPCVOID* ppData, 717 | UINT* pSizeInBytes); 718 | 719 | 720 | //---------------------------------------------------------------------------- 721 | // D3DXGetShaderSize: 722 | // ------------------ 723 | // Returns the size of the shader byte-code, in bytes. 724 | // 725 | // Parameters: 726 | // pFunction 727 | // Pointer to the function DWORD stream 728 | //---------------------------------------------------------------------------- 729 | 730 | UINT WINAPI 731 | D3DXGetShaderSize( 732 | CONST DWORD* pFunction); 733 | 734 | 735 | //---------------------------------------------------------------------------- 736 | // D3DXGetShaderVersion: 737 | // ----------------------- 738 | // Returns the shader version of a given shader. Returns zero if the shader 739 | // function is NULL. 740 | // 741 | // Parameters: 742 | // pFunction 743 | // Pointer to the function DWORD stream 744 | //---------------------------------------------------------------------------- 745 | 746 | DWORD WINAPI 747 | D3DXGetShaderVersion( 748 | CONST DWORD* pFunction); 749 | 750 | //---------------------------------------------------------------------------- 751 | // D3DXGetShaderSemantics: 752 | // ----------------------- 753 | // Gets semantics for all input elements referenced inside a given shader. 754 | // 755 | // Parameters: 756 | // pFunction 757 | // Pointer to the function DWORD stream 758 | // pSemantics 759 | // Pointer to an array of D3DXSEMANTIC structures. The function will 760 | // fill this array with the semantics for each input element referenced 761 | // inside the shader. This array is assumed to contain at least 762 | // MAXD3DDECLLENGTH elements. 763 | // pCount 764 | // Returns the number of elements referenced by the shader 765 | //---------------------------------------------------------------------------- 766 | 767 | HRESULT WINAPI 768 | D3DXGetShaderInputSemantics( 769 | CONST DWORD* pFunction, 770 | D3DXSEMANTIC* pSemantics, 771 | UINT* pCount); 772 | 773 | HRESULT WINAPI 774 | D3DXGetShaderOutputSemantics( 775 | CONST DWORD* pFunction, 776 | D3DXSEMANTIC* pSemantics, 777 | UINT* pCount); 778 | 779 | 780 | //---------------------------------------------------------------------------- 781 | // D3DXGetShaderSamplers: 782 | // ---------------------- 783 | // Gets semantics for all input elements referenced inside a given shader. 784 | // 785 | // pFunction 786 | // Pointer to the function DWORD stream 787 | // pSamplers 788 | // Pointer to an array of LPCSTRs. The function will fill this array 789 | // with pointers to the sampler names contained within pFunction, for 790 | // each sampler referenced inside the shader. This array is assumed to 791 | // contain at least 16 elements. 792 | // pCount 793 | // Returns the number of samplers referenced by the shader 794 | //---------------------------------------------------------------------------- 795 | 796 | HRESULT WINAPI 797 | D3DXGetShaderSamplers( 798 | CONST DWORD* pFunction, 799 | LPCSTR* pSamplers, 800 | UINT* pCount); 801 | 802 | 803 | //---------------------------------------------------------------------------- 804 | // D3DXGetShaderConstantTable: 805 | // --------------------------- 806 | // Gets shader constant table embedded inside shader. A constant table is 807 | // generated by D3DXAssembleShader and D3DXCompileShader, and is embedded in 808 | // the body of the shader. 809 | // 810 | // Parameters: 811 | // pFunction 812 | // Pointer to the function DWORD stream 813 | // Flags 814 | // See D3DXCONSTTABLE_xxx 815 | // ppConstantTable 816 | // Returns a ID3DXConstantTable object which can be used to set 817 | // shader constants to the device. Alternatively, an application can 818 | // parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within 819 | // the shader. 820 | //---------------------------------------------------------------------------- 821 | 822 | HRESULT WINAPI 823 | D3DXGetShaderConstantTable( 824 | CONST DWORD* pFunction, 825 | LPD3DXCONSTANTTABLE* ppConstantTable); 826 | 827 | HRESULT WINAPI 828 | D3DXGetShaderConstantTableEx( 829 | CONST DWORD* pFunction, 830 | DWORD Flags, 831 | LPD3DXCONSTANTTABLE* ppConstantTable); 832 | 833 | 834 | 835 | //---------------------------------------------------------------------------- 836 | // D3DXCreateTextureShader: 837 | // ------------------------ 838 | // Creates a texture shader object, given the compiled shader. 839 | // 840 | // Parameters 841 | // pFunction 842 | // Pointer to the function DWORD stream 843 | // ppTextureShader 844 | // Returns a ID3DXTextureShader object which can be used to procedurally 845 | // fill the contents of a texture using the D3DXFillTextureTX functions. 846 | //---------------------------------------------------------------------------- 847 | 848 | HRESULT WINAPI 849 | D3DXCreateTextureShader( 850 | CONST DWORD* pFunction, 851 | LPD3DXTEXTURESHADER* ppTextureShader); 852 | 853 | 854 | //---------------------------------------------------------------------------- 855 | // D3DXPreprocessShader: 856 | // --------------------- 857 | // Runs the preprocessor on the specified shader or effect, but does 858 | // not actually compile it. This is useful for evaluating the #includes 859 | // and #defines in a shader and then emitting a reformatted token stream 860 | // for debugging purposes or for generating a self-contained shader. 861 | // 862 | // Parameters: 863 | // pSrcFile 864 | // Source file name 865 | // hSrcModule 866 | // Module handle. if NULL, current module will be used 867 | // pSrcResource 868 | // Resource name in module 869 | // pSrcData 870 | // Pointer to source code 871 | // SrcDataLen 872 | // Size of source code, in bytes 873 | // pDefines 874 | // Optional NULL-terminated array of preprocessor macro definitions. 875 | // pInclude 876 | // Optional interface pointer to use for handling #include directives. 877 | // If this parameter is NULL, #includes will be honored when assembling 878 | // from file, and will error when assembling from resource or memory. 879 | // ppShaderText 880 | // Returns a buffer containing a single large string that represents 881 | // the resulting formatted token stream 882 | // ppErrorMsgs 883 | // Returns a buffer containing a listing of errors and warnings that were 884 | // encountered during assembly. If you are running in a debugger, 885 | // these are the same messages you will see in your debug output. 886 | //---------------------------------------------------------------------------- 887 | 888 | HRESULT WINAPI 889 | D3DXPreprocessShaderFromFileA( 890 | LPCSTR pSrcFile, 891 | CONST D3DXMACRO* pDefines, 892 | LPD3DXINCLUDE pInclude, 893 | LPD3DXBUFFER* ppShaderText, 894 | LPD3DXBUFFER* ppErrorMsgs); 895 | 896 | HRESULT WINAPI 897 | D3DXPreprocessShaderFromFileW( 898 | LPCWSTR pSrcFile, 899 | CONST D3DXMACRO* pDefines, 900 | LPD3DXINCLUDE pInclude, 901 | LPD3DXBUFFER* ppShaderText, 902 | LPD3DXBUFFER* ppErrorMsgs); 903 | 904 | #ifdef UNICODE 905 | #define D3DXPreprocessShaderFromFile D3DXPreprocessShaderFromFileW 906 | #else 907 | #define D3DXPreprocessShaderFromFile D3DXPreprocessShaderFromFileA 908 | #endif 909 | 910 | HRESULT WINAPI 911 | D3DXPreprocessShaderFromResourceA( 912 | HMODULE hSrcModule, 913 | LPCSTR pSrcResource, 914 | CONST D3DXMACRO* pDefines, 915 | LPD3DXINCLUDE pInclude, 916 | LPD3DXBUFFER* ppShaderText, 917 | LPD3DXBUFFER* ppErrorMsgs); 918 | 919 | HRESULT WINAPI 920 | D3DXPreprocessShaderFromResourceW( 921 | HMODULE hSrcModule, 922 | LPCWSTR pSrcResource, 923 | CONST D3DXMACRO* pDefines, 924 | LPD3DXINCLUDE pInclude, 925 | LPD3DXBUFFER* ppShaderText, 926 | LPD3DXBUFFER* ppErrorMsgs); 927 | 928 | #ifdef UNICODE 929 | #define D3DXPreprocessShaderFromResource D3DXPreprocessShaderFromResourceW 930 | #else 931 | #define D3DXPreprocessShaderFromResource D3DXPreprocessShaderFromResourceA 932 | #endif 933 | 934 | HRESULT WINAPI 935 | D3DXPreprocessShader( 936 | LPCSTR pSrcData, 937 | UINT SrcDataSize, 938 | CONST D3DXMACRO* pDefines, 939 | LPD3DXINCLUDE pInclude, 940 | LPD3DXBUFFER* ppShaderText, 941 | LPD3DXBUFFER* ppErrorMsgs); 942 | 943 | 944 | #ifdef __cplusplus 945 | } 946 | #endif //__cplusplus 947 | 948 | 949 | ////////////////////////////////////////////////////////////////////////////// 950 | // Shader comment block layouts ////////////////////////////////////////////// 951 | ////////////////////////////////////////////////////////////////////////////// 952 | 953 | //---------------------------------------------------------------------------- 954 | // D3DXSHADER_CONSTANTTABLE: 955 | // ------------------------- 956 | // Shader constant information; included as an CTAB comment block inside 957 | // shaders. All offsets are BYTE offsets from start of CONSTANTTABLE struct. 958 | // Entries in the table are sorted by Name in ascending order. 959 | //---------------------------------------------------------------------------- 960 | 961 | typedef struct _D3DXSHADER_CONSTANTTABLE 962 | { 963 | DWORD Size; // sizeof(D3DXSHADER_CONSTANTTABLE) 964 | DWORD Creator; // LPCSTR offset 965 | DWORD Version; // shader version 966 | DWORD Constants; // number of constants 967 | DWORD ConstantInfo; // D3DXSHADER_CONSTANTINFO[Constants] offset 968 | DWORD Flags; // flags shader was compiled with 969 | DWORD Target; // LPCSTR offset 970 | 971 | } D3DXSHADER_CONSTANTTABLE, *LPD3DXSHADER_CONSTANTTABLE; 972 | 973 | 974 | typedef struct _D3DXSHADER_CONSTANTINFO 975 | { 976 | DWORD Name; // LPCSTR offset 977 | WORD RegisterSet; // D3DXREGISTER_SET 978 | WORD RegisterIndex; // register number 979 | WORD RegisterCount; // number of registers 980 | WORD Reserved; // reserved 981 | DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset 982 | DWORD DefaultValue; // offset of default value 983 | 984 | } D3DXSHADER_CONSTANTINFO, *LPD3DXSHADER_CONSTANTINFO; 985 | 986 | 987 | typedef struct _D3DXSHADER_TYPEINFO 988 | { 989 | WORD Class; // D3DXPARAMETER_CLASS 990 | WORD Type; // D3DXPARAMETER_TYPE 991 | WORD Rows; // number of rows (matrices) 992 | WORD Columns; // number of columns (vectors and matrices) 993 | WORD Elements; // array dimension 994 | WORD StructMembers; // number of struct members 995 | DWORD StructMemberInfo; // D3DXSHADER_STRUCTMEMBERINFO[Members] offset 996 | 997 | } D3DXSHADER_TYPEINFO, *LPD3DXSHADER_TYPEINFO; 998 | 999 | 1000 | typedef struct _D3DXSHADER_STRUCTMEMBERINFO 1001 | { 1002 | DWORD Name; // LPCSTR offset 1003 | DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset 1004 | 1005 | } D3DXSHADER_STRUCTMEMBERINFO, *LPD3DXSHADER_STRUCTMEMBERINFO; 1006 | 1007 | 1008 | 1009 | #endif //__D3DX9SHADER_H__ 1010 | 1011 | -------------------------------------------------------------------------------- /d3dx9shape.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (C) Microsoft Corporation. All Rights Reserved. 4 | // 5 | // File: d3dx9shapes.h 6 | // Content: D3DX simple shapes 7 | // 8 | /////////////////////////////////////////////////////////////////////////// 9 | 10 | #include "d3dx9.h" 11 | 12 | #ifndef __D3DX9SHAPES_H__ 13 | #define __D3DX9SHAPES_H__ 14 | 15 | /////////////////////////////////////////////////////////////////////////// 16 | // Functions: 17 | /////////////////////////////////////////////////////////////////////////// 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif //__cplusplus 22 | 23 | 24 | //------------------------------------------------------------------------- 25 | // D3DXCreatePolygon: 26 | // ------------------ 27 | // Creates a mesh containing an n-sided polygon. The polygon is centered 28 | // at the origin. 29 | // 30 | // Parameters: 31 | // 32 | // pDevice The D3D device with which the mesh is going to be used. 33 | // Length Length of each side. 34 | // Sides Number of sides the polygon has. (Must be >= 3) 35 | // ppMesh The mesh object which will be created 36 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 37 | //------------------------------------------------------------------------- 38 | HRESULT WINAPI 39 | D3DXCreatePolygon( 40 | LPDIRECT3DDEVICE9 pDevice, 41 | FLOAT Length, 42 | UINT Sides, 43 | LPD3DXMESH* ppMesh, 44 | LPD3DXBUFFER* ppAdjacency); 45 | 46 | 47 | //------------------------------------------------------------------------- 48 | // D3DXCreateBox: 49 | // -------------- 50 | // Creates a mesh containing an axis-aligned box. The box is centered at 51 | // the origin. 52 | // 53 | // Parameters: 54 | // 55 | // pDevice The D3D device with which the mesh is going to be used. 56 | // Width Width of box (along X-axis) 57 | // Height Height of box (along Y-axis) 58 | // Depth Depth of box (along Z-axis) 59 | // ppMesh The mesh object which will be created 60 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 61 | //------------------------------------------------------------------------- 62 | HRESULT WINAPI 63 | D3DXCreateBox( 64 | LPDIRECT3DDEVICE9 pDevice, 65 | FLOAT Width, 66 | FLOAT Height, 67 | FLOAT Depth, 68 | LPD3DXMESH* ppMesh, 69 | LPD3DXBUFFER* ppAdjacency); 70 | 71 | 72 | //------------------------------------------------------------------------- 73 | // D3DXCreateCylinder: 74 | // ------------------- 75 | // Creates a mesh containing a cylinder. The generated cylinder is 76 | // centered at the origin, and its axis is aligned with the Z-axis. 77 | // 78 | // Parameters: 79 | // 80 | // pDevice The D3D device with which the mesh is going to be used. 81 | // Radius1 Radius at -Z end (should be >= 0.0f) 82 | // Radius2 Radius at +Z end (should be >= 0.0f) 83 | // Length Length of cylinder (along Z-axis) 84 | // Slices Number of slices about the main axis 85 | // Stacks Number of stacks along the main axis 86 | // ppMesh The mesh object which will be created 87 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 88 | //------------------------------------------------------------------------- 89 | HRESULT WINAPI 90 | D3DXCreateCylinder( 91 | LPDIRECT3DDEVICE9 pDevice, 92 | FLOAT Radius1, 93 | FLOAT Radius2, 94 | FLOAT Length, 95 | UINT Slices, 96 | UINT Stacks, 97 | LPD3DXMESH* ppMesh, 98 | LPD3DXBUFFER* ppAdjacency); 99 | 100 | 101 | //------------------------------------------------------------------------- 102 | // D3DXCreateSphere: 103 | // ----------------- 104 | // Creates a mesh containing a sphere. The sphere is centered at the 105 | // origin. 106 | // 107 | // Parameters: 108 | // 109 | // pDevice The D3D device with which the mesh is going to be used. 110 | // Radius Radius of the sphere (should be >= 0.0f) 111 | // Slices Number of slices about the main axis 112 | // Stacks Number of stacks along the main axis 113 | // ppMesh The mesh object which will be created 114 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 115 | //------------------------------------------------------------------------- 116 | HRESULT WINAPI 117 | D3DXCreateSphere( 118 | LPDIRECT3DDEVICE9 pDevice, 119 | FLOAT Radius, 120 | UINT Slices, 121 | UINT Stacks, 122 | LPD3DXMESH* ppMesh, 123 | LPD3DXBUFFER* ppAdjacency); 124 | 125 | 126 | //------------------------------------------------------------------------- 127 | // D3DXCreateTorus: 128 | // ---------------- 129 | // Creates a mesh containing a torus. The generated torus is centered at 130 | // the origin, and its axis is aligned with the Z-axis. 131 | // 132 | // Parameters: 133 | // 134 | // pDevice The D3D device with which the mesh is going to be used. 135 | // InnerRadius Inner radius of the torus (should be >= 0.0f) 136 | // OuterRadius Outer radius of the torue (should be >= 0.0f) 137 | // Sides Number of sides in a cross-section (must be >= 3) 138 | // Rings Number of rings making up the torus (must be >= 3) 139 | // ppMesh The mesh object which will be created 140 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 141 | //------------------------------------------------------------------------- 142 | HRESULT WINAPI 143 | D3DXCreateTorus( 144 | LPDIRECT3DDEVICE9 pDevice, 145 | FLOAT InnerRadius, 146 | FLOAT OuterRadius, 147 | UINT Sides, 148 | UINT Rings, 149 | LPD3DXMESH* ppMesh, 150 | LPD3DXBUFFER* ppAdjacency); 151 | 152 | 153 | //------------------------------------------------------------------------- 154 | // D3DXCreateTeapot: 155 | // ----------------- 156 | // Creates a mesh containing a teapot. 157 | // 158 | // Parameters: 159 | // 160 | // pDevice The D3D device with which the mesh is going to be used. 161 | // ppMesh The mesh object which will be created 162 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 163 | //------------------------------------------------------------------------- 164 | HRESULT WINAPI 165 | D3DXCreateTeapot( 166 | LPDIRECT3DDEVICE9 pDevice, 167 | LPD3DXMESH* ppMesh, 168 | LPD3DXBUFFER* ppAdjacency); 169 | 170 | 171 | //------------------------------------------------------------------------- 172 | // D3DXCreateText: 173 | // --------------- 174 | // Creates a mesh containing the specified text using the font associated 175 | // with the device context. 176 | // 177 | // Parameters: 178 | // 179 | // pDevice The D3D device with which the mesh is going to be used. 180 | // hDC Device context, with desired font selected 181 | // pText Text to generate 182 | // Deviation Maximum chordal deviation from true font outlines 183 | // Extrusion Amount to extrude text in -Z direction 184 | // ppMesh The mesh object which will be created 185 | // pGlyphMetrics Address of buffer to receive glyph metric data (or NULL) 186 | //------------------------------------------------------------------------- 187 | HRESULT WINAPI 188 | D3DXCreateTextA( 189 | LPDIRECT3DDEVICE9 pDevice, 190 | HDC hDC, 191 | LPCSTR pText, 192 | FLOAT Deviation, 193 | FLOAT Extrusion, 194 | LPD3DXMESH* ppMesh, 195 | LPD3DXBUFFER* ppAdjacency, 196 | LPGLYPHMETRICSFLOAT pGlyphMetrics); 197 | 198 | HRESULT WINAPI 199 | D3DXCreateTextW( 200 | LPDIRECT3DDEVICE9 pDevice, 201 | HDC hDC, 202 | LPCWSTR pText, 203 | FLOAT Deviation, 204 | FLOAT Extrusion, 205 | LPD3DXMESH* ppMesh, 206 | LPD3DXBUFFER* ppAdjacency, 207 | LPGLYPHMETRICSFLOAT pGlyphMetrics); 208 | 209 | #ifdef UNICODE 210 | #define D3DXCreateText D3DXCreateTextW 211 | #else 212 | #define D3DXCreateText D3DXCreateTextA 213 | #endif 214 | 215 | 216 | #ifdef __cplusplus 217 | } 218 | #endif //__cplusplus 219 | 220 | #endif //__D3DX9SHAPES_H__ 221 | 222 | -------------------------------------------------------------------------------- /d3dx9xof.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (C) Microsoft Corporation. All Rights Reserved. 4 | // 5 | // File: d3dx9xof.h 6 | // Content: D3DX .X File types and functions 7 | // 8 | /////////////////////////////////////////////////////////////////////////// 9 | 10 | #include "d3dx9.h" 11 | 12 | #if !defined( __D3DX9XOF_H__ ) 13 | #define __D3DX9XOF_H__ 14 | 15 | #if defined( __cplusplus ) 16 | extern "C" { 17 | #endif // defined( __cplusplus ) 18 | 19 | //---------------------------------------------------------------------------- 20 | // D3DXF_FILEFORMAT 21 | // This flag is used to specify what file type to use when saving to disk. 22 | // _BINARY, and _TEXT are mutually exclusive, while 23 | // _COMPRESSED is an optional setting that works with all file types. 24 | //---------------------------------------------------------------------------- 25 | typedef DWORD D3DXF_FILEFORMAT; 26 | 27 | #define D3DXF_FILEFORMAT_BINARY 0 28 | #define D3DXF_FILEFORMAT_TEXT 1 29 | #define D3DXF_FILEFORMAT_COMPRESSED 2 30 | 31 | //---------------------------------------------------------------------------- 32 | // D3DXF_FILESAVEOPTIONS 33 | // This flag is used to specify where to save the file to. Each flag is 34 | // mutually exclusive, indicates the data location of the file, and also 35 | // chooses which additional data will specify the location. 36 | // _TOFILE is paired with a filename (LPCSTR) 37 | // _TOWFILE is paired with a filename (LPWSTR) 38 | //---------------------------------------------------------------------------- 39 | typedef DWORD D3DXF_FILESAVEOPTIONS; 40 | 41 | #define D3DXF_FILESAVE_TOFILE 0x00L 42 | #define D3DXF_FILESAVE_TOWFILE 0x01L 43 | 44 | //---------------------------------------------------------------------------- 45 | // D3DXF_FILELOADOPTIONS 46 | // This flag is used to specify where to load the file from. Each flag is 47 | // mutually exclusive, indicates the data location of the file, and also 48 | // chooses which additional data will specify the location. 49 | // _FROMFILE is paired with a filename (LPCSTR) 50 | // _FROMWFILE is paired with a filename (LPWSTR) 51 | // _FROMRESOURCE is paired with a (D3DXF_FILELOADRESOUCE*) description. 52 | // _FROMMEMORY is paired with a (D3DXF_FILELOADMEMORY*) description. 53 | //---------------------------------------------------------------------------- 54 | typedef DWORD D3DXF_FILELOADOPTIONS; 55 | 56 | #define D3DXF_FILELOAD_FROMFILE 0x00L 57 | #define D3DXF_FILELOAD_FROMWFILE 0x01L 58 | #define D3DXF_FILELOAD_FROMRESOURCE 0x02L 59 | #define D3DXF_FILELOAD_FROMMEMORY 0x03L 60 | 61 | //---------------------------------------------------------------------------- 62 | // D3DXF_FILELOADRESOURCE: 63 | //---------------------------------------------------------------------------- 64 | 65 | typedef struct _D3DXF_FILELOADRESOURCE 66 | { 67 | HMODULE hModule; // Desc 68 | LPCSTR lpName; // Desc 69 | LPCSTR lpType; // Desc 70 | } D3DXF_FILELOADRESOURCE; 71 | 72 | //---------------------------------------------------------------------------- 73 | // D3DXF_FILELOADMEMORY: 74 | //---------------------------------------------------------------------------- 75 | 76 | typedef struct _D3DXF_FILELOADMEMORY 77 | { 78 | LPCVOID lpMemory; // Desc 79 | SIZE_T dSize; // Desc 80 | } D3DXF_FILELOADMEMORY; 81 | 82 | #if defined( _WIN32 ) && !defined( _NO_COM ) 83 | 84 | // {cef08cf9-7b4f-4429-9624-2a690a933201} 85 | DEFINE_GUID( IID_ID3DXFile, 86 | 0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); 87 | 88 | // {cef08cfa-7b4f-4429-9624-2a690a933201} 89 | DEFINE_GUID( IID_ID3DXFileSaveObject, 90 | 0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); 91 | 92 | // {cef08cfb-7b4f-4429-9624-2a690a933201} 93 | DEFINE_GUID( IID_ID3DXFileSaveData, 94 | 0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); 95 | 96 | // {cef08cfc-7b4f-4429-9624-2a690a933201} 97 | DEFINE_GUID( IID_ID3DXFileEnumObject, 98 | 0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); 99 | 100 | // {cef08cfd-7b4f-4429-9624-2a690a933201} 101 | DEFINE_GUID( IID_ID3DXFileData, 102 | 0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); 103 | 104 | #endif // defined( _WIN32 ) && !defined( _NO_COM ) 105 | 106 | #if defined( __cplusplus ) 107 | #if !defined( DECLSPEC_UUID ) 108 | #if _MSC_VER >= 1100 109 | #define DECLSPEC_UUID( x ) __declspec( uuid( x ) ) 110 | #else // !( _MSC_VER >= 1100 ) 111 | #define DECLSPEC_UUID( x ) 112 | #endif // !( _MSC_VER >= 1100 ) 113 | #endif // !defined( DECLSPEC_UUID ) 114 | 115 | interface DECLSPEC_UUID( "cef08cf9-7b4f-4429-9624-2a690a933201" ) 116 | ID3DXFile; 117 | interface DECLSPEC_UUID( "cef08cfa-7b4f-4429-9624-2a690a933201" ) 118 | ID3DXFileSaveObject; 119 | interface DECLSPEC_UUID( "cef08cfb-7b4f-4429-9624-2a690a933201" ) 120 | ID3DXFileSaveData; 121 | interface DECLSPEC_UUID( "cef08cfc-7b4f-4429-9624-2a690a933201" ) 122 | ID3DXFileEnumObject; 123 | interface DECLSPEC_UUID( "cef08cfd-7b4f-4429-9624-2a690a933201" ) 124 | ID3DXFileData; 125 | 126 | #if defined( _COM_SMARTPTR_TYPEDEF ) 127 | _COM_SMARTPTR_TYPEDEF( ID3DXFile, 128 | __uuidof( ID3DXFile ) ); 129 | _COM_SMARTPTR_TYPEDEF( ID3DXFileSaveObject, 130 | __uuidof( ID3DXFileSaveObject ) ); 131 | _COM_SMARTPTR_TYPEDEF( ID3DXFileSaveData, 132 | __uuidof( ID3DXFileSaveData ) ); 133 | _COM_SMARTPTR_TYPEDEF( ID3DXFileEnumObject, 134 | __uuidof( ID3DXFileEnumObject ) ); 135 | _COM_SMARTPTR_TYPEDEF( ID3DXFileData, 136 | __uuidof( ID3DXFileData ) ); 137 | #endif // defined( _COM_SMARTPTR_TYPEDEF ) 138 | #endif // defined( __cplusplus ) 139 | 140 | typedef interface ID3DXFile ID3DXFile; 141 | typedef interface ID3DXFileSaveObject ID3DXFileSaveObject; 142 | typedef interface ID3DXFileSaveData ID3DXFileSaveData; 143 | typedef interface ID3DXFileEnumObject ID3DXFileEnumObject; 144 | typedef interface ID3DXFileData ID3DXFileData; 145 | 146 | ////////////////////////////////////////////////////////////////////////////// 147 | // ID3DXFile ///////////////////////////////////////////////////////////////// 148 | ////////////////////////////////////////////////////////////////////////////// 149 | 150 | #undef INTERFACE 151 | #define INTERFACE ID3DXFile 152 | 153 | DECLARE_INTERFACE_( ID3DXFile, IUnknown ) 154 | { 155 | STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; 156 | STDMETHOD_( ULONG, AddRef )( THIS ) PURE; 157 | STDMETHOD_( ULONG, Release )( THIS ) PURE; 158 | 159 | STDMETHOD( CreateEnumObject )( THIS_ LPCVOID, D3DXF_FILELOADOPTIONS, 160 | ID3DXFileEnumObject** ) PURE; 161 | STDMETHOD( CreateSaveObject )( THIS_ LPCVOID, D3DXF_FILESAVEOPTIONS, 162 | D3DXF_FILEFORMAT, ID3DXFileSaveObject** ) PURE; 163 | STDMETHOD( RegisterTemplates )( THIS_ LPCVOID, SIZE_T ) PURE; 164 | STDMETHOD( RegisterEnumTemplates )( THIS_ ID3DXFileEnumObject* ) PURE; 165 | }; 166 | 167 | ////////////////////////////////////////////////////////////////////////////// 168 | // ID3DXFileSaveObject /////////////////////////////////////////////////////// 169 | ////////////////////////////////////////////////////////////////////////////// 170 | 171 | #undef INTERFACE 172 | #define INTERFACE ID3DXFileSaveObject 173 | 174 | DECLARE_INTERFACE_( ID3DXFileSaveObject, IUnknown ) 175 | { 176 | STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; 177 | STDMETHOD_( ULONG, AddRef )( THIS ) PURE; 178 | STDMETHOD_( ULONG, Release )( THIS ) PURE; 179 | 180 | STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE; 181 | STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*, 182 | SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE; 183 | STDMETHOD( Save )( THIS ) PURE; 184 | }; 185 | 186 | ////////////////////////////////////////////////////////////////////////////// 187 | // ID3DXFileSaveData ///////////////////////////////////////////////////////// 188 | ////////////////////////////////////////////////////////////////////////////// 189 | 190 | #undef INTERFACE 191 | #define INTERFACE ID3DXFileSaveData 192 | 193 | DECLARE_INTERFACE_( ID3DXFileSaveData, IUnknown ) 194 | { 195 | STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; 196 | STDMETHOD_( ULONG, AddRef )( THIS ) PURE; 197 | STDMETHOD_( ULONG, Release )( THIS ) PURE; 198 | 199 | STDMETHOD( GetSave )( THIS_ ID3DXFileSaveObject** ) PURE; 200 | STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE; 201 | STDMETHOD( GetId )( THIS_ LPGUID ) PURE; 202 | STDMETHOD( GetType )( THIS_ GUID* ) PURE; 203 | STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*, 204 | SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE; 205 | STDMETHOD( AddDataReference )( THIS_ LPCSTR, CONST GUID* ) PURE; 206 | }; 207 | 208 | ////////////////////////////////////////////////////////////////////////////// 209 | // ID3DXFileEnumObject /////////////////////////////////////////////////////// 210 | ////////////////////////////////////////////////////////////////////////////// 211 | 212 | #undef INTERFACE 213 | #define INTERFACE ID3DXFileEnumObject 214 | 215 | DECLARE_INTERFACE_( ID3DXFileEnumObject, IUnknown ) 216 | { 217 | STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; 218 | STDMETHOD_( ULONG, AddRef )( THIS ) PURE; 219 | STDMETHOD_( ULONG, Release )( THIS ) PURE; 220 | 221 | STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE; 222 | STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE; 223 | STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE; 224 | STDMETHOD( GetDataObjectById )( THIS_ REFGUID, ID3DXFileData** ) PURE; 225 | STDMETHOD( GetDataObjectByName )( THIS_ LPCSTR, ID3DXFileData** ) PURE; 226 | }; 227 | 228 | ////////////////////////////////////////////////////////////////////////////// 229 | // ID3DXFileData ///////////////////////////////////////////////////////////// 230 | ////////////////////////////////////////////////////////////////////////////// 231 | 232 | #undef INTERFACE 233 | #define INTERFACE ID3DXFileData 234 | 235 | DECLARE_INTERFACE_( ID3DXFileData, IUnknown ) 236 | { 237 | STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; 238 | STDMETHOD_( ULONG, AddRef )( THIS ) PURE; 239 | STDMETHOD_( ULONG, Release )( THIS ) PURE; 240 | 241 | STDMETHOD( GetEnum )( THIS_ ID3DXFileEnumObject** ) PURE; 242 | STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE; 243 | STDMETHOD( GetId )( THIS_ LPGUID ) PURE; 244 | STDMETHOD( Lock )( THIS_ SIZE_T*, LPCVOID* ) PURE; 245 | STDMETHOD( Unlock )( THIS ) PURE; 246 | STDMETHOD( GetType )( THIS_ GUID* ) PURE; 247 | STDMETHOD_( BOOL, IsReference )( THIS ) PURE; 248 | STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE; 249 | STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE; 250 | }; 251 | 252 | STDAPI D3DXFileCreate( ID3DXFile** lplpDirectXFile ); 253 | 254 | /* 255 | * DirectX File errors. 256 | */ 257 | 258 | #define _FACD3DXF 0x876 259 | 260 | #define D3DXFERR_BADOBJECT MAKE_HRESULT( 1, _FACD3DXF, 900 ) 261 | #define D3DXFERR_BADVALUE MAKE_HRESULT( 1, _FACD3DXF, 901 ) 262 | #define D3DXFERR_BADTYPE MAKE_HRESULT( 1, _FACD3DXF, 902 ) 263 | #define D3DXFERR_NOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 903 ) 264 | #define D3DXFERR_NOTDONEYET MAKE_HRESULT( 1, _FACD3DXF, 904 ) 265 | #define D3DXFERR_FILENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 905 ) 266 | #define D3DXFERR_RESOURCENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 906 ) 267 | #define D3DXFERR_BADRESOURCE MAKE_HRESULT( 1, _FACD3DXF, 907 ) 268 | #define D3DXFERR_BADFILETYPE MAKE_HRESULT( 1, _FACD3DXF, 908 ) 269 | #define D3DXFERR_BADFILEVERSION MAKE_HRESULT( 1, _FACD3DXF, 909 ) 270 | #define D3DXFERR_BADFILEFLOATSIZE MAKE_HRESULT( 1, _FACD3DXF, 910 ) 271 | #define D3DXFERR_BADFILE MAKE_HRESULT( 1, _FACD3DXF, 911 ) 272 | #define D3DXFERR_PARSEERROR MAKE_HRESULT( 1, _FACD3DXF, 912 ) 273 | #define D3DXFERR_BADARRAYSIZE MAKE_HRESULT( 1, _FACD3DXF, 913 ) 274 | #define D3DXFERR_BADDATAREFERENCE MAKE_HRESULT( 1, _FACD3DXF, 914 ) 275 | #define D3DXFERR_NOMOREOBJECTS MAKE_HRESULT( 1, _FACD3DXF, 915 ) 276 | #define D3DXFERR_NOMOREDATA MAKE_HRESULT( 1, _FACD3DXF, 916 ) 277 | #define D3DXFERR_BADCACHEFILE MAKE_HRESULT( 1, _FACD3DXF, 917 ) 278 | 279 | /* 280 | * DirectX File object types. 281 | */ 282 | 283 | #ifndef WIN_TYPES 284 | #define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype 285 | #endif 286 | 287 | WIN_TYPES(ID3DXFile, D3DXFILE); 288 | WIN_TYPES(ID3DXFileEnumObject, D3DXFILEENUMOBJECT); 289 | WIN_TYPES(ID3DXFileSaveObject, D3DXFILESAVEOBJECT); 290 | WIN_TYPES(ID3DXFileData, D3DXFILEDATA); 291 | WIN_TYPES(ID3DXFileSaveData, D3DXFILESAVEDATA); 292 | 293 | #if defined( __cplusplus ) 294 | } // extern "C" 295 | #endif // defined( __cplusplus ) 296 | 297 | #endif // !defined( __D3DX9XOF_H__ ) 298 | 299 | 300 | -------------------------------------------------------------------------------- /dlldata.c: -------------------------------------------------------------------------------- 1 | /********************************************************* 2 | DllData file -- generated by MIDL compiler 3 | 4 | DO NOT ALTER THIS FILE 5 | 6 | This file is regenerated by MIDL on every IDL file compile. 7 | 8 | To completely reconstruct this file, delete it and rerun MIDL 9 | on all the IDL files in this DLL, specifying this file for the 10 | /dlldata command line option 11 | 12 | *********************************************************/ 13 | 14 | #define PROXY_DELEGATION 15 | 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | EXTERN_PROXY_FILE( TSPlug ) 23 | 24 | 25 | PROXYFILE_LIST_START 26 | /* Start of list */ 27 | REFERENCE_PROXY_FILE( TSPlug ), 28 | /* End of list */ 29 | PROXYFILE_LIST_END 30 | 31 | 32 | DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) 33 | 34 | #ifdef __cplusplus 35 | } /*extern "C" */ 36 | #endif 37 | 38 | /* end of generated dlldata file */ 39 | -------------------------------------------------------------------------------- /dllmain.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/dllmain.cpp -------------------------------------------------------------------------------- /dllmain.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/dllmain.h -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by TSPlug.rc 4 | // 5 | #define IDS_PROJNAME 100 6 | #define IDR_TSPLUG 101 7 | #define IDR_TSPLUGINTERFACE 102 8 | #define IDR_IME1 201 9 | #define IDR_TCPROTECT1 202 10 | #define IDR_DRIVEKDBMOUX861 203 11 | #define IDR_DRIVEKDBMOUX641 204 12 | 13 | // Next default values for new objects 14 | // 15 | #ifdef APSTUDIO_INVOKED 16 | #ifndef APSTUDIO_READONLY_SYMBOLS 17 | #define _APS_NEXT_RESOURCE_VALUE 205 18 | #define _APS_NEXT_COMMAND_VALUE 32768 19 | #define _APS_NEXT_CONTROL_VALUE 201 20 | #define _APS_NEXT_SYMED_VALUE 103 21 | #endif 22 | #endif 23 | -------------------------------------------------------------------------------- /stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/stdafx.cpp -------------------------------------------------------------------------------- /stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/stdafx.h -------------------------------------------------------------------------------- /targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/targetver.h -------------------------------------------------------------------------------- /ve-8EF.tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaojunxin/TSPlug/795209f68dc367c23dc3a6b17a6925d15dc9d6bc/ve-8EF.tmp --------------------------------------------------------------------------------