Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[help] d3d cham making

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
lexie
Advanced Cheater
Reputation: 0

Joined: 23 Jan 2007
Posts: 80

PostPosted: Fri Aug 01, 2008 12:15 pm    Post subject: [help] d3d cham making Reply with quote

Code:
//**Color**//
HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
{
if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL)) )
return E_FAIL;

WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
|(WORD)(((colour32>>20)&0xF)<<8)
|(WORD)(((colour32>>12)&0xF)<<4)
|(WORD)(((colour32>>4)&0xF)<<0);

D3DLOCKED_RECT d3dlr;
(*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
WORD *pDst16 = (WORD*)d3dlr.pBits;

for(int xy=0; xy < 8*8; xy++)
*pDst16++ = colour16;

(*ppD3Dtex)->UnlockRect(0);

return S_OK;
}

struct pixels
{
IDirect3DTexture9 *pBlue, *pRed, *pPurple, *pOrange, *pWhite, *pGreen, *pYellow, *pPink,*pCyan,*pBlack;
}; pixels pi;

#define pchamp( x, b, f )
if( x )
{
YourDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
YourDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER );
YourDevice->SetTexture( 0, NULL );
YourDevice->SetTexture( 0, f );
YourDevice->DrawIndexedPrimitive( Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount );
YourDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
YourDevice->SetRenderState( D3DRS_ZFUNC,D3DCMP_LESSEQUAL );
YourDevice->SetTexture( 0, b );
YourDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
return YourDevice->DrawIndexedPrimitive( Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount );
}
//**//
EndScene
Code:
int color = true;
if(color)
{
GenerateTexture(YourDevice,&pi.pRed, D3DCOLOR_ARGB(255,255,0,0 ));
GenerateTexture(YourDevice,&pi.pCyan, D3DCOLOR_ARGB(255,0,255,255 ));
GenerateTexture(YourDevice,&pi.pYellow, D3DCOLOR_ARGB(255,255,255,0 ));
GenerateTexture(YourDevice,&pi.pBlue, D3DCOLOR_ARGB(255,0,0,255 ));
GenerateTexture(YourDevice,&pi.pGreen, D3DCOLOR_ARGB(255,0,255,0 ));
GenerateTexture(YourDevice,&pi.pOrange, D3DCOLOR_ARGB(255,255,165,0 ));
GenerateTexture(YourDevice,&pi.pPurple, D3DCOLOR_ARGB(255,160,32,240 ));
GenerateTexture(YourDevice,&pi.pWhite, D3DCOLOR_ARGB(255,255,255,255 ));
GenerateTexture(YourDevice,&pi.pPink, D3DCOLOR_ARGB(255,255,105,180 ));
GenerateTexture(YourDevice,&pi.pBlack, D3DCOLOR_ARGB(255,0,0,0 ));
color = false;
}
DrawIndexedPrimitive()
Code:
if(chams)
{
pchamp(m_Stride == 44,pi.pBlue,pi.pGreen);
}

I have never worked with chams can anyone give me a place to get started from
google-->usless information in this regard...yes i have searched
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 475

Joined: 09 May 2003
Posts: 25974
Location: The netherlands

PostPosted: Sat Aug 02, 2008 1:32 pm    Post subject: Reply with quote

not sure what a cham is, but this sounds like some kind of wallhack / visibility hack

it requires you to hook DrawIndexedPrimitive
In there check is the given stride for the call is 44, and if so render the object 2 times.
Once without zbuffer so it's on the foreground in blue (wallhack), and another time so it's rendered in wireframe mode in green.

Se of you see him through a wall, you see him in blue, and when actually seeing him, you should see him as a green/blue wireframe.

Of course, for the colors to work, you'll have to create the textures.
The code you've given says to do that in a hook at EndScene , but I'd rather pick another spot. Or use a static int instead of just int, else color will be set to true on each frame, meaning each frame the textures are created. And even though they are small textures, it will eventually cause a memory leak so big the game will crash (or everything becomes textureless)

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Sat Aug 02, 2008 7:55 pm    Post subject: Reply with quote

Chams are colored models of other players based on their team.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites