Results 1 to 7 of 7
  1. #1

    (Cod5) D3D Cham Crash

    I am creating chams with DIP (DrawIndexPrimitive) and my game keeps crashing when I see a player.
    I think its because of the Memory Pattern, but I don't know, Hope one of you people can help me.

    Info:
    Game : CoD5
    Patch : 1.7

    My Setup:
    Code:
    typedef HRESULT(WINAPI* DrawIndexedPrimitive_)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseIndex, UINT MinIndex, UINT NumVertices, UINT StartIndex, UINT primCount);
    DrawIndexedPrimitive_ org_DrawIndexedPrimitive;
    
    
    HRESULT WINAPI hook_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseIndex, UINT MinIndex, UINT NumVertices, UINT StartIndex, UINT primCount)
    {
        if(GOOD_GUYS)
        {
            //blabla
        }
    
        if(BAD_GUYS)
        {
            //blabla
        }
        return  org_DrawIndexedPrimitive(pDevice, Type,BaseIndex, MinIndex,NumVertices,StartIndex,primCount);
    }
    
    int D3DHooks()
    {
    	DWORD D3DPattern,*vTable, DXBase=NULL;
    	DXBase = (DWORD)LoadLibraryA("d3d9.dll");
    	  
    	while(!DXBase);
    		{
    		  D3DPattern = FindPattern(DXBase, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
    		}
    
    	if(D3DPattern)
    	{
    		memcpy(&vTable,(void *)(D3DPattern+2),4);
    		org_EndScene = (EndScene_)DetourFunction((PBYTE)vTable[42],(PBYTE)hook_EndScene);
    		org_DrawIndexedPrimitive = (DrawIndexedPrimitive_)DetourFunction((PBYTE)vTable[82],(PBYTE)hook_DrawIndexedPrimitive);
    	}
    	return 0;
    }
    
    BOOL WINAPI DllMain (HMODULE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
    {
    	switch (fdwReason)
        {
    		case DLL_PROCESS_ATTACH:
    			    DisableThreadLibraryCalls( hinstDLL );
    				{
    			
    				}
    
    				main_hinstDLL = hinstDLL;
    			 	ENGINE.isOn = true;	
    				CreateThread(NULL, NULL, ENGINE.HooK, NULL, NULL, NULL);
    				CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)D3DHooks, NULL, NULL, NULL);
    
    				break;
    		case DLL_PROCESS_DETACH:
    		    	ENGINE.isOn = false;
    	    		CreateThread(NULL, NULL, ENGINE.HooK, NULL, NULL, NULL); 
    				break;
        }
    	return 1;
    }

  2. #2
    Coders (+)_'s Avatar
    Join Date
    Jan 2010
    Location
    Earth
    Posts
    455

    Re: (Cod5) D3D Cham Crash

    That pattern is no longer valid. :'(

  3. #3

    Re: (Cod5) D3D Cham Crash

    Then How Should I Do This?
    Is There a New Memory Code? Different Method?

  4. #4
    Coders (+)_'s Avatar
    Join Date
    Jan 2010
    Location
    Earth
    Posts
    455

    Re: (Cod5) D3D Cham Crash

    Hook CreateDevice9. : ' )

  5. #5

    Re: (Cod5) D3D Cham Crash

    I Tried Hooking it This way and The Chams Just Don't show up Now. Are They Not Be Initalized?

    If I going Completely wrong then can you give me a example of how to hook CreateDevice9?
    Code:
    fn_Direct3DCreate9 or_Direct3DCreate9, or1_Direct3DCreate9 = NULL;;
    hkIDirect3D9 *hk_Direct3D9 = NULL; 
    IDirect3D9 *Handle = NULL;
    
    IDirect3D9 *APIENTRY hk_Direct3dCreate9(UINT SDKVersion)
    {
    	static IDirect3D9 *HookReturn;
    	HookReturn = new hkIDirect3D9;
    
    	Handle = or1_Direct3DCreate9(SDKVersion);
    	if(!Handle)
    	{
    		return Handle;
    	}
    
    	return HookReturn;
    }
    Code:
    DWORD WINAPI InitalizeThread(LPVOID Parameter)
    {
    	HMODULE hDirect3DLib = NULL;
    	while(!hDirect3DLib)
    	{
    		hDirect3DLib = GetModuleHandle("d3d9.dll");
    		Sleep(10);
    	} 
    
    	or_Direct3DCreate9 =  (fn_Direct3DCreate9)GetProcAddress(hDirect3DLib, "Direct3DCreate9");
    
    	or1_Direct3DCreate9 = (fn_Direct3DCreate9)DetourFunc(( BYTE* )GetProcAddress( LoadLibrary( "d3d9.dll" ), "Direct3DCreate9" ), (BYTE *)hk_Direct3dCreate9, 5);
    
    	return 1;
    }
    DLL_Main.cpp
    Code:
    CreateThread(NULL, 0, InitalizeThread, NULL, NULL, NULL);

  6. #6
    Coders (+)_'s Avatar
    Join Date
    Jan 2010
    Location
    Earth
    Posts
    455

    Re: (Cod5) D3D Cham Crash

    Why not just find the offset of DrawIndexedPrimitive since it is the same for dx9 and use that : ' )

    Here the offset to EndScene DX9c:
    Code:
    (PBYTE)LoadLibraryA( "d3d9.dll" ) + 0x1CEC7
    Last edited by (+)_; June 17th, 2013 at 11:37.

  7. #7
    Coders (+)_'s Avatar
    Join Date
    Jan 2010
    Location
    Earth
    Posts
    455

    Re: (Cod5) D3D Cham Crash

    I think this is your error:

    Code:
    if(D3DPattern)
    	{
    		LPDIRECT3DDEVICE9 pDevice = NULL;
    		memcpy(&pDevice,(void *)(D3DPattern+2),4);
    		vTable = (PDWORD)*(PDWORD)pDevice;
    		org_EndScene = (EndScene_)DetourFunction((PBYTE)vTable[42],(PBYTE)hook_EndScene);

Similar Threads

  1. looking for a simple css cham hack
    By chuckles1 in forum Counterstrike Source Cheats
    Replies: 1
    Last Post: February 17th, 2010, 13:42
  2. [COD5]Call of Duty : World At War Cham's Preview
    By Znighty in forum Private Cheats Gallery
    Replies: 0
    Last Post: November 10th, 2008, 03:19
  3. cham colours
    By Killacali in forum Enemy Territory Cheats
    Replies: 3
    Last Post: September 22nd, 2008, 19:19
  4. ETH32 Cham colours
    By [deF] VinCe in forum Vecs & Scripts
    Replies: 9
    Last Post: July 1st, 2008, 04:54
  5. Clienthook Cham Vis Fix
    By Couch in forum Client Hooks
    Replies: 0
    Last Post: April 19th, 2006, 22:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •