Thread: DIP Hook. Go RQ

Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 53
  1. #16
    Crash's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    JAville
    Posts
    2,889
    Reputation
    163
    Thanks
    3,289
    My Mood
    Sleepy
    Quote Originally Posted by the grim reaper View Post
    hmm? should i use this? i already have my own hook
    NOBODY TEH CARE /NIGGUH
    Last edited by Crash; 05-08-2011 at 12:00 PM.

  2. The Following 2 Users Say Thank You to Crash For This Useful Post:

    pashak (05-08-2011),topblast (05-08-2011)

  3. #17
    Sydney's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Germany...
    Posts
    1,358
    Reputation
    37
    Thanks
    1,144
    My Mood
    Amused
    D3D Chams is nothing special for me. You can use Nx Chams too. No Big Difference.

    Thanks Cosmos


  4. #18
    pashak's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    350
    Reputation
    29
    Thanks
    42
    Quote Originally Posted by Sydney View Post
    D3D Chams is nothing special for me. You can use Nx Chams to. No Big Difference.
    but it is sexier

  5. #19
    Sydney's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Germany...
    Posts
    1,358
    Reputation
    37
    Thanks
    1,144
    My Mood
    Amused
    Quote Originally Posted by pashak View Post
    but it is sexier
    yeh, a bit.

    Thanks Cosmos


  6. #20
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    818
    Reputation
    125
    Thanks
    1,785
    My Mood
    Doh
    Only problem with d3d is they are plane basic colors and normal only red green blue ect.. Actually I prefer Nx Chams, I don't really like my self being all colored up.

  7. The Following User Says Thank You to Departure For This Useful Post:

    markoj (05-08-2011)

  8. #21
    Crash's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    JAville
    Posts
    2,889
    Reputation
    163
    Thanks
    3,289
    My Mood
    Sleepy
    Quote Originally Posted by Sydney View Post
    yeh, a bit.
    You can see them easier because of the bright colors

    I also don't like the look for sat chams

  9. #22
    pashak's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    350
    Reputation
    29
    Thanks
    42
    Quote Originally Posted by Crash View Post
    You can see them easier because of the bright colors

    I also don't like the look for sat chams
    JAJA

  10. #23
    _Fk127_'s Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    724
    Reputation
    16
    Thanks
    208
    My Mood
    Bitchy
    Quote Originally Posted by pashak View Post
    well I've been around on mpgh for some time trying to learn and make hacks. I never said I could code like @flameswor10 or like @whit or whoever else... I just wanted to learn and be accepted. I show one thing that I am proud of and it gets flamed. Well you know what? FUCK YOU


    Hope all the noobs leech off of this:

    Code:
    #include "DIPHOOK.h"
    
    #define safe_release(x) if(x != NULL){ x->Release(); x = NULL;}
    
    void Dx9Hook( LPCSTR D3D9 );
    INT Thread_XD3DXINIT( );
    LPDIRECT3DDEVICE9 pDevice; 
    DWORD * VTable;
    
    BYTE DIPOpCodes[7];
    DWORD dwDIP_hook, dwDIP_ret;
    BYTE ImJumpingBack = 0x00;
    D3DPRIMITIVETYPE PrimitiveType;
    INT BaseIndex;
    LPD3DXFONT pFont;
    UINT MinIndex, NumVertices, StartIndex, PrimitiveCount, Device_Interface;
    HRESULT (WINAPI* DrawIndexedPrimitive_Pointer) (LPDIRECT3DDEVICE9, D3DPRIMITIVETYPE, INT, UINT, UINT, UINT, UINT);
    LPDIRECT3DVERTEXBUFFER9 Stream_Data;
    LPDIRECT3DDEVICE9 g_pDevice=NULL;
    UINT Offset = 0, m_Stride = 0;
    IDirect3DTexture9* texBack=NULL,*texFront=NULL;
    
    void SetLightChams(float A, float R, float G, float B, IDirect3DDevice9 *pDevice)
    {
        D3DMATERIAL9 pMaterial;
        ZeroMemory(&pMaterial, sizeof(D3DMATERIAL9));
    	pDevice->SetRenderState(D3DRS_LIGHTING, TRUE); //Enable Lighting
    	//Ambient
    	pMaterial.Ambient.a     =  (A/255);
        pMaterial.Ambient.r     =  (R/255);
        pMaterial.Ambient.g     =  (G/255);
        pMaterial.Ambient.b     =  (B/255);
    	//Diffuse
    	pMaterial.Diffuse.a     = (A/255);
        pMaterial.Diffuse.r     = (R/255);
        pMaterial.Diffuse.g     = (G/255);
        pMaterial.Diffuse.b     = (B/255);
    	//Specular
    	pMaterial.Specular.a = (A/255);
    	pMaterial.Specular.r = (R/255);
        pMaterial.Specular.g = (G/255);
        pMaterial.Specular.b = (B/255);
        pDevice->SetMaterial(&pMaterial);
    }
    
    void DoDIP(LPDIRECT3DDEVICE9 pDevice)
    {
    	if(pDevice->GetStreamSource(0, &Stream_Data, &Offset, &m_Stride) == D3D_OK)
    		Stream_Data->Release();
    
    	if (g_pDevice != pDevice)
    	{
    		safe_release(g_pDevice)
    		g_pDevice = pDevice;
    		safe_release(texBack)
    		safe_release(texFront)
    	}
    
    	if (texBack == NULL)
    	{
    		GenerateTexture(pDevice, &texBack, 0xff0000ff);
    	}
    
    	if (texFront == NULL)
    	{
    		GenerateTexture(pDevice, &texFront, 0xff00ff00);
    	}
    
    	if( m_Stride == 44 ||  m_Stride == 36 || m_Stride == 32 || m_Stride == 36 || m_Stride == 40 || m_Stride == 42 ) 
    	{		
    		DWORD dwOldZEnable = D3DZB_TRUE;
    		pDevice->SetTexture(0,0);
    		pDevice->SetTexture(0, texBack);
    		pDevice->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable);
    		pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
    		pDIP(pDevice, PrimitiveType, BaseIndex, MinIndex, NumVertices, StartIndex, PrimitiveCount);
    		pDevice->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
    		pDevice->SetTexture(0,0);
    		pDevice->SetTexture(0, texFront);/* try? hmm hold
    		DWORD dwOldZEnable = D3DZB_TRUE;
    		pDevice->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable);
    		pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
    		pDevice->SetRenderState(255,0,0,255, pDevice);
    		pDIP(pDevice, PrimitiveType, BaseIndex, MinIndex, NumVertices, StartIndex, PrimitiveCount);		
    		pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
    		pDevice->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_ARGB(255,0,255,0));*/
    	}
    }
    
    __declspec( naked ) void MyDIP(LPDIRECT3DDEVICE9 pDevice)
    {
    	__asm 
    	{
    		MOV EDI,DWORD PTR SS:[EBP+0x8] 
    		XOR EBX,EBX 
    		MOV pDevice, EDI; 
    		PUSHFD 
    		PUSHAD
    		MOV EAX,DWORD PTR SS:[EBP+0x20]
    		MOV DWORD PTR DS:[PrimitiveCount], EAX
    		MOV ECX,DWORD PTR SS:[EBP+0x1C]
    		MOV DWORD PTR DS:[StartIndex], ECX
    		MOV EDX,DWORD PTR SS:[EBP+0x18]
    		MOV DWORD PTR DS:[NumVertices], EDX
    		MOV EAX,DWORD PTR SS:[EBP+0x14]
    		MOV DWORD PTR DS:[MinIndex], EAX
    		MOV ECX,DWORD PTR SS:[EBP+0x10]
    		MOV DWORD PTR DS:[BaseIndex], ECX
    		MOV EDX,DWORD PTR SS:[EBP+0x0C]
    		MOV DWORD PTR DS:[PrimitiveType], EDX
    		MOV EAX,DWORD PTR SS:[EBP+0x08]
    		MOV DWORD PTR DS:[Device_Interface], EAX
    
    		// Get DIP Pointer
    		MOV ECX,DWORD PTR DS:[EDI]// pDevice
    		MOV EAX,DWORD PTR DS:[ECX+0x148]// DIP pointer
    		MOV DWORD PTR SS:[pDIP],EAX// need this
    	}
     
     
    	if( ImJumpingBack )
    		goto Jumpback;
    	ImJumpingBack = 0x01;
    
    	DoDIP(pDevice);
    
    	ImJumpingBack = 0x00;
    	Jumpback:
    	__asm
    	{
    		POPAD
    		POPFD
    		CMP EDI,EBX //replace patched code
    		jmp dwDIP_ret; //jump back to normal DIP
    	}
    
    }
    
    
    //Then make a thread
    bool IsGameReadyForHook(void)
    {
    	if( GetModuleHandle( "d3d9.dll"     ) != NULL )
            return true;
    
        return false;
    }
    INT Thread_XD3DXINIT(  )
    {
    	while(!IsGameReadyForHook() )
    		Sleep(100);
    	
        Dx9Hook("d3d9.dll");
    	WriteOpCode((void *)DIPOpCodes, (void *)"\x8B\x7D\x08\x33\xDB\x3B\xFB", 7);
    	while( 1 )
    	 {
    		Sleep( 1000 );
    		if(memcmp((void *)DIPOpCodes, (void *)dwDIP_hook, 7) == 0 )
    		DetourCreate((PBYTE)dwDIP_hook, (PBYTE)MyDIP, DETOUR_TYPE_NOP_NOP_JMP);  
    	 } 
        return NULL;
    }
    bool bCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
    {
        for(;*szMask;++szMask,++pData,++bMask)
            if(*szMask=='x' && *pData!=*bMask)   return 0;
        return (*szMask) == NULL;
    }
    
    DWORD FindPattern(DWORD dwdwAdd,DWORD dwLen,BYTE *bMask,char * szMask)
    {
        for(DWORD i=0; i<dwLen; i++)
            if (bCompare((BYTE*)(dwdwAdd+i),bMask,szMask))  return (DWORD)(dwdwAdd+i);
        return 0;
    }
    
    //then your hook that goes in thread:
    
    DWORD * FindDevice(VOID)//Finds the Device on Injection
    {
        DWORD Base = (DWORD)LoadLibraryW(L"d3d9.dll");
        for(DWORD i = 0; i < 0x128000; i++ )
        {
          if ( (*(BYTE *)(Base+i+0x00))==0xC7
            && (*(BYTE *)(Base+i+0x01))==0x06
            && (*(BYTE *)(Base+i+0x06))==0x89
            && (*(BYTE *)(Base+i+0x07))==0x86
            && (*(BYTE *)(Base+i+0x0C))==0x89
            && (*(BYTE *)(Base+i+0x0D))==0x86 )
            return (DWORD *)(Base + i + 2);
        }
        return NULL;
    }  
    
    void Dx9Hook( LPCSTR D3D9 )
    {
    	DWORD hD3D = NULL;
        while (!hD3D) hD3D = (DWORD)GetModuleHandle(D3D9);
        DWORD PPPDevice = FindPattern(hD3D, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
        memcpy( &VTable, (void *)(PPPDevice + 2), 4);
    
    	dwDIP_hook = VTable[82] + 0x2D;
    	dwDIP_ret = dwDIP_hook + 0x7;
    	*(PDWORD)&DrawIndexedPrimitive_Pointer = (DWORD)VTable[82];
    }
    
    BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
    {
    	DisableThreadLibraryCalls(hDll);
    	if ( dwReason == DLL_PROCESS_ATTACH )
    		CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)Thread_XD3DXINIT, NULL, NULL, NULL);
    	
    return TRUE;
    }
    idc who the credits go to I'm done with CA

    Go Kill Yourselfs
    I didn't ever flame you



    Put this image in your signature if you support HTML5 development!

  11. #24
    pashak's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    350
    Reputation
    29
    Thanks
    42
    Quote Originally Posted by _Fk127_ View Post
    I didn't ever flame you
    well I just wanted to put peoples name so that they see htis.

  12. #25
    LionelMessi10's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    MPGH.NET
    Posts
    6,125
    Reputation
    114
    Thanks
    4,545
    My Mood
    Aggressive
    Hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

    Interesting....................



  13. #26
    topblast's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Far from around you Programmer: C++ | VB | C# | JAVA
    Posts
    3,607
    Reputation
    149
    Thanks
    4,922
    My Mood
    Cool
    I got the chams to work ^^, i help a lot with this.
    I just like programming, that is all.

    Current Stuff:

    • GPU Programmer (Cuda)
    • Client/Server (Cloud Server)
    • Mobile App Development

  14. #27
    supercarz1991's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    North of Hell, South of Heaven
    Posts
    6,067
    Reputation
    323
    Thanks
    3,320
    My Mood
    Doh
    *sigh of relief* its different than mine...wont be patched

  15. #28
    AVGN's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Making America Great Again.
    Posts
    15,451
    Reputation
    1549
    Thanks
    6,234
    nice sauce



    ^Thanks to RJ^




  16. #29
    SNal2F's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    175
    Reputation
    30
    Thanks
    99
    Quote Originally Posted by Departure View Post
    Only problem with d3d is they are plane basic colors and normal only red green blue ect.. Actually I prefer Nx Chams, I don't really like my self being all colored up.
    you can create other textures , ez way


    D3DXCreateTextureFromFile Function (Windows)

    also light, fog , pixel shaders etc
    Last edited by SNal2F; 05-09-2011 at 09:03 PM.

  17. #30
    AVGN's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Making America Great Again.
    Posts
    15,451
    Reputation
    1549
    Thanks
    6,234
    Quote Originally Posted by SNal2F View Post
    you can create other textures , ez way


    D3DXCreateTextureFromFile Function (Windows)

    also light, fog , pixel shaders etc
    i remember seeing overlay chams once but idk if that was CA or not i cant remember



    ^Thanks to RJ^




Page 2 of 4 FirstFirst 1234 LastLast