Results 1 to 11 of 11
  1. #1
    woodpusher637's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    1
    My Mood
    Aggressive

    Need Help With Chams DLL Source Code

    I have no reload/infinite ammo and nametags working fine I just need some help finishing the chams. I've attempted to learn Drawindexedprimitive to complete the source listed at the top of this thread but I can't figure it out.

    Before you flame me, I do realize I'm an extreme novice to this type of stuff so please work with me. Thanks.

    Heres a pic:

    https://img714.imageshack.us/i/chamsissue2.png/

    This is what I have so far:

    Code:
    // Hax.cpp : Defines the exported functions for the DLL application.
    //
    
    #include "stdafx.h"
    #include <wchar.h>
    #include <windows.h>
    #include <d3d9.h>
    #include <time.h>
    #include <stdlib.h>
    #include <fstream>
    #include <vector>    
    #include <stdio.h> 
    #include <time.h>
    #include <tchar.h>
    #include <iostream>
    #pragma warning(disable:4996)
    #pragma comment(lib, "d3d9.lib")
    #pragma comment(lib, "d3dx9.lib")
    
    #define D3DHOOK_TEXTURES
    #define ThreadMake(x) CreateThread(NULL,0, (LPTHREAD_START_ROUTINE)&x,NULL,0,NULL); 
    #define ThreadMakeParam(x, param) CreateThread(NULL,0, (LPTHREAD_START_ROUTINE)&x,param,0,NULL);
    #define CRYSIS2CHAMS ((m_Stride == 16 && NumVertices ==  8391 && primCount == 5677) || (m_Stride == 16 &&  NumVertices == 8391 && primCount == 5677) || (m_Stride == 12  && NumVertices == 8 && primCount == 10) || (m_Stride ==  12 && NumVertices == 30 && primCount == 14) || (m_Stride  == 16 && NumVertices == 2000 && primCount == 2549) ||  (m_Stride == 16 && NumVertices == 93 && primCount == 80)  || (m_Stride == 16 && NumVertices == 2406 && primCount  == 2365) || (m_Stride == 16 && NumVertices == 2259 &&  primCount == 1846) || (m_Stride == 16 && NumVertices == 190  && primCount == 172) || (m_Stride == 16 && NumVertices  == 621 && primCount == 712) || (m_Stride == 16 &&  NumVertices == 3107 && primCount == 3372) || (m_Stride == 16  && NumVertices == 1179 && primCount == 752) || (m_Stride  == 16 && NumVertices == 898 && primCount == 990) ||  (m_Stride == 16 && NumVertices == 3040 && primCount ==  2882) || (m_Stride == 16 && NumVertices == 5272 &&  primCount == 5595) || (m_Stride == 16 && NumVertices == 13248  && primCount == 13263) || (m_Stride == 16 && NumVertices  == 59 && primCount == 83) || (m_Stride == 16 &&  NumVertices == 120 && primCount == 28) || (m_Stride == 16  && NumVertices == 2124 && primCount == 657) || (m_Stride  == 16 && NumVertices == 466 && primCount == 185) ||  (m_Stride == 16 && NumVertices == 8572 && primCount ==  5694) || (m_Stride == 16 && NumVertices == 11127 &&  primCount == 9012) || (m_Stride == 16 && NumVertices == 2456  && primCount == 999) || (m_Stride == 16 && NumVertices  == 3414 && primCount == 2369))
    #define CRYSIS2CHAMSOTHER (m_Stride == 16 && NumVertices == 260 && primCount == 434)
    #define REMOVALS (m_Stride == 16 && NumVertices == 204  && primCount == 207 || (m_Stride == 16 && NumVertices ==  636 && primCount == 659) || (m_Stride == 16 &&  NumVertices == 349 && primCount == 243) || (m_Stride == 16  && NumVertices == 794 && primCount == 688) || (m_Stride  == 12 && NumVertices == 8 && primCount == 10))
    #define BEEP_ACTIVATED Beep(2000, 500);
    #define BEEP_DEACTIVATED Beep(1000, 500);
    #define NULL 0;
    
    void Initialize();
    void ToggleAmmo();
    void ToggleTagHack();
    void ToggleChamsHack();
    void Write2Asm(void*, BYTE*, int);
    
    DWORD pAmmo;
    DWORD pTagHack;
    
    IDirect3DPixelShader9* texGreen;
    IDirect3DPixelShader9* texYellow;
    
    
    void Hotkeys()
    {
    	while(true)
    	{
    		if (GetAsyncKeyState(VK_F4))
    		{
    			ToggleAmmo();
    		}
    
    		if (GetAsyncKeyState(VK_F3))
    		{
    			ToggleTagHack();
    		}
    
    		if (GetAsyncKeyState(VK_F2))
    		{
    			ToggleChamsHack();
    		}
    		Sleep(500);
    	}
    }
    
    BOOL APIENTRY DllMain( HMODULE hModule,
                           DWORD  ul_reason_for_call,
                           LPVOID lpReserved
    					 )
    {
    	switch (ul_reason_for_call)
    	{
    	case DLL_PROCESS_ATTACH:
    		Beep(5000, 1000);
    		Initialize();
    		ThreadMake(Hotkeys);
    	case DLL_THREAD_ATTACH:
    	case DLL_THREAD_DETACH:
    	case DLL_PROCESS_DETACH:
    		break;
    	}
    	return TRUE;
    }
    
    void Initialize()
    {
    	DWORD CrysisBase = (DWORD)GetModuleHandle(L"CryGameCrysis2");
    	pAmmo = (CrysisBase + 0x4225D);
    	pTagHack = (CrysisBase + 0xF50C2);
    
    	//WCHAR tempChar[256];
    	//swprintf(tempChar, 256, L"0x%X", pAmmoOffset);
    	//MessageBox(NULL, tempChar,  L"Info", MB_OK | MB_ICONASTERISK);
    }
    
    void ToggleAmmo()
    {
    	static bool hack_activated = false;
    
    	if(hack_activated)
    	{
    		Write2Asm((void*)pAmmo,(PBYTE)"\x89\x70\x04",3);
    		hack_activated = false;
    		BEEP_DEACTIVATED
    	} 
    	else
    	{
    		Write2Asm((void*)pAmmo,(PBYTE)"\x90\x90\x90",3);
    		hack_activated = true;
    		BEEP_ACTIVATED
    	}
    }
    
    void ToggleTagHack()
    {
    	static int hack_state = 0;
    	
    	switch(hack_state)
    	{
    		case 0:
    			Write2Asm((void*)pTagHack,(PBYTE)"\xB3\x01",2);			
    			hack_state++;
    			BEEP_ACTIVATED
    			break;	
    		case 1:
    			Write2Asm((void*)pTagHack,(PBYTE)"\xB3\x02",2);			
    			hack_state++;
    			BEEP_ACTIVATED
    			break;	
    		case 2:
    			Write2Asm((void*)pTagHack,(PBYTE)"\x8A\xD8",2);			
    			hack_state = 0;
    			BEEP_DEACTIVATED
    			break;	
    	}
    
    }
    void Write2Asm(void* pxAddress, BYTE * MyBytes,  int size)
    {
    	unsigned long Protection;
    	VirtualProtect((void*)pxAddress, size, PAGE_READWRITE, &Protection);
    	memcpy((void*)pxAddress, (const void*)MyBytes, size);
    	VirtualProtect((void*)pxAddress, size, Protection, 0);
    }
    
    
    typedef HRESULT (WINAPI* CreateDevice_Prototype)        (LPDIRECT3D9, UINT, D3DDEVTYPE, HWND, DWORD, D3DPRESENT_PARAMETERS*, LPDIRECT3DDEVICE9*);
    typedef HRESULT (WINAPI* Reset_Prototype)               (LPDIRECT3DDEVICE9, D3DPRESENT_PARAMETERS*);
    typedef HRESULT (WINAPI* EndScene_Prototype)            (LPDIRECT3DDEVICE9);
    typedef HRESULT (WINAPI* DrawIndexedPrimitive_Prototype)(LPDIRECT3DDEVICE9, D3DPRIMITIVETYPE, INT, UINT, UINT, UINT, UINT);
    
    CreateDevice_Prototype         CreateDevice_Pointer         = NULL;
    Reset_Prototype                Reset_Pointer                = NULL;
    EndScene_Prototype             EndScene_Pointer             = NULL;
    DrawIndexedPrimitive_Prototype DrawIndexedPrimitive_Pointer = NULL;
    
    HRESULT WINAPI Direct3DCreate9_VMTable    (VOID);
    HRESULT WINAPI CreateDevice_Detour        (LPDIRECT3D9, UINT, D3DDEVTYPE, HWND, DWORD, D3DPRESENT_PARAMETERS*, LPDIRECT3DDEVICE9*);
    HRESULT WINAPI Reset_Detour               (LPDIRECT3DDEVICE9, D3DPRESENT_PARAMETERS*);
    HRESULT WINAPI EndScene_Detour            (LPDIRECT3DDEVICE9);
    HRESULT WINAPI DrawIndexedPrimitive_Detour(LPDIRECT3DDEVICE9, D3DPRIMITIVETYPE, INT, UINT, UINT, UINT, UINT);
    
    
    
    void ToggleChamsHack()
    {
    	static bool hack_activated = false;
    
    	if(hack_activated)
    	{
    
    		HRESULT WINAPI DrawIndexedPrimitive(D3DPRIMITIVETYPE Type, INT BaseVertexIndex, 
            UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount)
    		{
    
    			UINT m_Stride;
    			UINT m_pD3Ddev;
    			UINT OffsetInBytes;
    			LPDIRECT3DDEVICE9 StreamData;
    
    
    			if(m_pD3Ddev->GetStreamSource(0,&StreamData,&OffsetInBytes,&m_Stride) == D3D_OK) 
    			{
    				StreamData->Release();
    			}
    
    			if (REMOVALS && removals)   
    			{
    				return null;
    			}
    
    			if(CRYSIS2CHAMS)				
    			{
    				DWORD dwOldZEnable = D3DZB_TRUE; 
    				m_pD3Ddev->SetTexture(0, texYellow);
    				m_pD3Ddev->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable);
    				m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
    				m_pD3Ddev->DrawIndexedPrimitive(Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
    				m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
    				m_pD3Ddev->SetTexture(0, texGreen);
    			}
    
    			return m_pD3Ddev->DrawIndexedPrimitive(Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
    		}
    	}
    }
    Last edited by woodpusher637; 03-08-2011 at 03:25 PM.

  2. #2
    masterupload's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    1
    cplusplus.com - The C++ Resources Network


    How are you goin to include files that aren't even on the Project Solution
    Last edited by masterupload; 03-07-2011 at 07:29 PM.

  3. The Following User Says Thank You to masterupload For This Useful Post:

    woodpusher637 (03-07-2011)

  4. #3
    woodpusher637's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    1
    My Mood
    Aggressive
    See that's one of my issues, I'm not even sure how to setup everything I need/don't need to finish this. I've been using ideas from multiple forums to compile a general idea of what I'm looking for. I need assist with what to #include and what not to #include as well as, specifically, what I need to finish the chams (which has been giving me errors on compile, mainly because I'm almost positive I don't even have them setup right).

    As of now the only issue going on is the Chams part, the other two are working perfect.

    Thanks for the reply,
    Hit me back with any more information you can give.

    Cheers.

  5. #4
    masterupload's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    1
    I suggest you learn c++ is the only way you will get it right and will understand the concept

  6. #5
    woodpusher637's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    1
    My Mood
    Aggressive
    I didn't ask for suggestions, I asked for some help. I can learn or "get it right" from constructive criticism, not self-scrutiny. If you're willing to assist in this matter, feel free to comment.


    Also, I've limited down the solution a bit for those who are truly willing to help; I'll post in a few.

    Cheers.

  7. #6
    hooch's Avatar
    Join Date
    Aug 2007
    Gender
    male
    Posts
    208
    Reputation
    6
    Thanks
    1,194
    My Mood
    Hungover
    You could at least give me credits. It's 90% my code.

  8. #7
    woodpusher637's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    1
    My Mood
    Aggressive
    Take it, I never said I wrote all of it... not to mention, I clearly stated I used the code from the top of the thread. l2r
    Last edited by woodpusher637; 03-09-2011 at 06:59 AM.

  9. #8
    banek192's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Russia
    Posts
    36
    Reputation
    9
    Thanks
    62
    for chams you need D3D base. if you make with strides and etc.

  10. The Following User Says Thank You to banek192 For This Useful Post:

    woodpusher637 (03-10-2011)

  11. #9
    woodpusher637's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    1
    My Mood
    Aggressive
    Figured it out, thanks all.

    /closed

  12. #10
    masterupload's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    1
    Learn Cplusplus

  13. #11
    woodpusher637's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    1
    My Mood
    Aggressive
    /closed means /closed.

    Thanks for trying though.