#include "app.h" IDirect3DTexture8 *TexScreen=NULL; int TexWidth=0,TexHeight=0; // Blank the texture: static int TexBlank() { D3DLOCKED_RECT lock={0,NULL}; unsigned char *dest=NULL; int y=0,line=0; TexScreen->LockRect(0,&lock,NULL,0); if (lock.pBits==NULL) return 1; dest=(unsigned char *)lock.pBits; for (y=0; yUnlockRect(0); return 0; } int TexScreenInit() { TexWidth =512; TexHeight=512; Device->CreateTexture(TexWidth,TexHeight,1,0,D3DFMT_R5G6B5,D3DPOOL_MANAGED,&TexScreen); if (TexScreen==NULL) return 1; TexBlank(); return 0; } void TexScreenExit() { RELEASE(TexScreen) TexWidth=TexHeight=0; } // Copy screen to a swizzled texture int TexScreenSwizzle() { D3DLOCKED_RECT lock={0,NULL}; unsigned char *dest=NULL; int y=0,sy=0,mask=0; unsigned short *ps=NULL; mask=TexWidth*TexHeight-1; TexScreen->LockRect(0,&lock,NULL,0); if (lock.pBits==NULL) return 1; dest=(unsigned char *)lock.pBits; ps=EmuScreen; // Write to swizzled locations: for (y=0,sy=0; yUnlockRect(0); return 0; } // Copy screen to a linear texture: int TexScreenLinear() { D3DLOCKED_RECT lock={0,NULL}; unsigned char *dest=NULL; int y=0,line=0; unsigned short *ps=NULL; TexScreen->LockRect(0,&lock,NULL,0); if (lock.pBits==NULL) return 1; dest=(unsigned char *)lock.pBits; ps=EmuScreen; for (y=0; yUnlockRect(0); return 0; }