👍 My Korea WarRock Source
21/08/11 works
cBase.cpp
cBase.h
cBase.cpp
Code:
#include <stdio.h>
#include <d3dx9.h>
#include <d3d9.h>
#include "cBase.h"
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
int ICh_CrossHair = 0;
int Screenw;
int Screenh;
bool WorldToScreen(LPDIRECT3DDEVICE9 pDevice, D3DVECTOR Player, D3DVECTOR &PlayerScaled)
{
if(!pDevice)
return NULL;
D3DVIEWPORT9 viewPort;
D3DDISPLAYMODE ViewInfo;
D3DXVECTOR3 vScreenCoord;
D3DXVECTOR3 vWorldLocation(Player.x,Player.y,Player.z);
D3DXMATRIX projection, view, world, identity;
pDevice->GetTransform(D3DTS_VIEW, &view);
pDevice->GetTransform(D3DTS_PROJECTION, &projection);
pDevice->GetTransform(D3DTS_WORLD, &world);
pDevice->GetViewport(&viewPort);
pDevice->GetDisplayMode(NULL, &ViewInfo);
Screenw = (float)ViewInfo.Width;
Screenh = (float)ViewInfo.Height;
viewPort.X = 0;
viewPort.Y = 0;
viewPort.Width = Screenw;
viewPort.Height = Screenh;
viewPort.MinZ = 0;
viewPort.MaxZ = 1;
D3DXMatrixIdentity(&identity);
D3DXVec3Project(&vScreenCoord, &vWorldLocation, &viewPort, &projection, &view, &identity);
if(vScreenCoord.x < 1)
{
PlayerScaled.x = vScreenCoord.x;
PlayerScaled.y = vScreenCoord.y;
return true;
}
return 0;
}
void PreReset(void)
{
if(pFont)
{
if(pFont->Release())
pFont = NULL;
}
}
void MyRelease(LPDIRECT3DDEVICE9 pDevice)
{
D3DXCreateFont(pDevice, 16, 0, FW_HEAVY, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, TEXT("Your Font name"), &pFont);
}
void __cdecl myEndScene(LPDIRECT3DDEVICE9 pDevice)
{
__asm pushad;
MyRelease(pDevice);
pFont->OnLostDevice();
pFont->OnResetDevice();
DWORD dwPlayerPtr = *(DWORD*)PPointer;
DWORD dwServerPtr = *(DWORD*)SPointer;
if(dwServerPtr != 0)
{
GMWarning();
*(DWORD*)(0x00C65670) = 1;
*(DWORD*)(cAddy_Respawn) = 0;
*(DWORD*)(cAddy_ViewDistance) = 1371963904;
DrawTextC(185, 30, D3DCOLOR_ARGB(255, 255, 255, 0), "Inset Hook || http://mpgh.net", pFont);
}
if(dwPlayerPtr != 0)
{
if(ICh_CrossHair == 1)
{
int x = (GetSystemMetrics(0) / 2);
int y = (GetSystemMetrics(1) / 2);
D3DRECT rec = {x - 20, y, x + 20, y + 1};
D3DRECT rec2 = {x, y - 20, x + 1, y + 20};
pDevice->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 255, 255, 255), 0, 0);
pDevice->Clear(1, &rec2, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 255, 255, 255), 0, 0);
}
for(int i = 0; i < 32; i++)
{
if(!g_pBase->player || !g_pBase->local) break;
CPlayer* pPlayer = g_pBase->player[i];
CPlayerInfo *pInfo = GetPlayerInfo(i);
CPlayerInfo *pInfoIP = GetPlayerIP(i);
CPlayerInfo *pInfoName = GetPlayerName(i);
if(pInfo && pPlayer)
{
D3DXVECTOR3 g_pPlayer(pPlayer->CPx, pPlayer->CPy, pPlayer->CPz),g_vView;
if(WorldToScreen(pDevice, g_vView, g_pPlayer))
{
if(pInfo->health > 0)
{
int Red1,Green1;
Red1 = 255-((pInfo->health/10)*2.55);
Green1 = (pInfo->health/10)*2.55;
sprintf(szHealth, "HP : %d", (int)pInfo->health/10);
sprintf(szIP, "\n%s", pInfoIP);
sprintf(szName, "\n\n%s", pInfoName);
if(*(BYTE*)(dwServerPtr + OFS_TeamSlot) == 1)
{
if(pInfo->team == 0)
{
DrawTextC(g_vView.x, g_vView.y, D3DCOLOR_ARGB(255, 0, 190, 255), szIP, pFont);
DrawTextC(g_vView.x, g_vView.y, D3DCOLOR_ARGB(255, 0, 190, 255), szName, pFont);
DrawTextC((float)g_vView.x, (float)g_vView.y, D3DCOLOR_ARGB(255, Red1, Green1, 0), szHealth, pFont);
}
}
else if(*(BYTE*)(dwServerPtr + OFS_TeamSlot) == 0)
{
if(pInfo->team == 1)
{
DrawTextC(g_vView.x, g_vView.y, D3DCOLOR_ARGB(255, 0, 190, 255), szIP, pFont);
DrawTextC(g_vView.x, g_vView.y, D3DCOLOR_ARGB(255, 0, 190, 255), szName, pFont);
DrawTextC((float)g_vView.x, (float)g_vView.y, D3DCOLOR_ARGB(255, Red1, Green1, 0), szHealth, pFont);
}
}
}
}
}
}
}
PreReset();
__asm popad;
}
__declspec(naked) void EndScene_Hook()
{
__asm
{
call myEndScene;
call dword ptr ds:[ecx+0xA8];
ret;
}
}
void __cdecl myDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice)
{
__asm pushad;
//pDevice->SetRenderState(D3DRS_FOGENABLE, false);
pDevice->SetRenderState(D3DRS_LIGHTING, false);
pDevice->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_ARGB(255, 255, 255, 255));
__asm popad;
}
__declspec(naked) void DrawIndexedPrimitive_Hook()
{
__asm
{
call myDrawIndexedPrimitive;
call dword ptr ds:[esi+0x148];
pop esi;
retn 0x18;
}
}
int InstallHooking(void)
{
WriteDouble((DWORD)cAddy_NoSpread, 1);
WriteFloat((DWORD)cAddy_HeroTime, 0);
WriteASM((DWORD)cAddy_HeadShotA, (DWORD)(PBYTE)"\xB9\x64\xC1\x54\xA5\x90", 6);
WriteASM((DWORD)cAddy_HeadShotB, (DWORD)(PBYTE)"\x90\x90\x90\x90", 4);
WriteASM((DWORD)cAddy_NoRecoil, (DWORD)(PBYTE)"\x90\x90\x90\x90\x90\x90", 6);
WriteASM((DWORD)cAddy_PremiumCrossHair, (DWORD)(PBYTE)"\x90\x90\x90\x90\x90\x90", 6);
WriteASM((DWORD)cAddy_PremiumCrossHairC, (DWORD)(PBYTE)"\xB8\x02\x00\x00\x00", 5);
DetourFeatures((PBYTE)0x008708E9, (PBYTE)EndScene_Hook, 5);
DetourFeatures((PBYTE)0x008707B8, (PBYTE)DrawIndexedPrimitive_Hook, 5);
/*for(;;) // Telekill
{
Sleep(1);
DWORD cPlayerPtr = *(DWORD*)PPointer;
DWORD cServerPtr = *(DWORD*)SPointer;
if(cPlayerPtr != 0)
{
for(int i = 0; i < 32; i++)
{
if(!g_pBase->player || !g_pBase->local) break;
CPlayer* pPlayer = g_pBase->player[i];
CPlayerInfo *pInfo = GetPlayerInfo(i);
if(pInfo && pPlayer)
{
if(pInfo->health > 0)
{
if(GetAsyncKeyState(VK_MBUTTON)& 0x8000)
{
if(*(BYTE*)(cServerPtr + OFS_TeamSlot) == 1)
{
if(pInfo->team == 0)
{
g_pBase->local->pX = pPlayer->CPx;
g_pBase->local->pY = (float)(pPlayer->CPy) + 10;
g_pBase->local->pZ = pPlayer->CPz;
}
}
else if(*(BYTE*)(cServerPtr + OFS_TeamSlot) == 0)
{
if(pInfo->team == 1)
{
g_pBase->local->pX = pPlayer->CPx;
g_pBase->local->pY = (float)(pPlayer->CPy) + 10;
g_pBase->local->pZ = pPlayer->CPz;
}
}
}
}
}
}
}
}*/
return 0;
}
BOOL WINAPI DllMain(HMODULE hDll,
DWORD dwReason,
LPVOID lpReserved
)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)&InstallHooking, NULL, NULL, NULL);
}
return TRUE;
}
Code:
#ifndef _CBASE_H
#define _CBASE_H
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <time.h>
#define D3DparamX , UINT paramx
#define D3DparamvalX , paramx
ID3DXFont *pFont;
#pragma warning(disable : 4244)
char szIP[100];
char szName[100];
char szTeam[100];
char szHealth[100];
char szServerName[10];
D3DCOLOR Color_ESP = D3DCOLOR_ARGB(255, 255, 255, 255);
void *DetourFeatures(BYTE *src, const BYTE *dst, const int len)
{
BYTE *jmp = (BYTE*)malloc(len+5);
DWORD dwback;
VirtualProtect(src, len, PAGE_READWRITE, &dwback);
memcpy(jmp, src, len); jmp += len;
jmp[0] = 0xE9;
*(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
src[0] = 0xE9;
*(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
VirtualProtect(src, len, dwback, &dwback);
return (jmp-len);
}
void WriteDouble(DWORD dwIAddy, double x)
{
unsigned long Protection;
VirtualProtect((void*)dwIAddy, sizeof(x), PAGE_READWRITE, &Protection);
memcpy((void*)dwIAddy, &x , sizeof(x));
VirtualProtect((void*)dwIAddy, sizeof(x), Protection, NULL);
}
void WriteFloat(DWORD dwIAddy, float x)
{
unsigned long Protection;
VirtualProtect((void*)dwIAddy, sizeof(x), PAGE_READWRITE, &Protection);
memcpy((void*)dwIAddy, &x , sizeof(x));
VirtualProtect((void*)dwIAddy, sizeof(x), Protection, NULL);
}
void WriteASM(DWORD dwIAddy, DWORD dwASM, int len)
{
unsigned long Protection;
VirtualProtect((void*)dwIAddy, len, PAGE_EXECUTE_READWRITE, &Protection);
memcpy((void*)dwIAddy, (const void*)dwASM, len);
VirtualProtect((void*)dwIAddy, len, Protection, NULL);
}
void DrawTextC(int x, int y, DWORD color, char *text, ID3DXFont* pFont)
{
RECT rect, rect2;
SetRect(&rect, x, y, x, y);
SetRect(&rect2, x - 0.1, y + 0.2, x - 0.1, y + 0.);
pFont->DrawTextA(NULL,text,-1,&rect2, DT_CENTER|DT_NOCLIP, color);
pFont->DrawTextA(NULL,text,-1,&rect, DT_CENTER|DT_NOCLIP, color);
}
#endif
#define PPointer 0x00DE9920
#define SPointer 0x00CE05B0
#define BPointer 0x00D193C0
#define IPointer 0x00D19AA0
#define NPointer 0x00D19D8C
#define VPointer 0x00C6F8D8
#define GM_Warning 0x00
#define OFS_Server 0x14
#define OFS_Size 0x1CF8
#define OFS_TeamSlot 0xE183C
#define cAddy_Respawn 0x00C98CDC
#define cAddy_HeadShotA 0x00483AC9
#define cAddy_HeadShotB 0x00483ACF
#define cAddy_NoRecoil 0x005FBC87
#define cAddy_NoSpread 0x00AE3CE0
#define cAddy_HeroTime 0x00AF2670
#define cAddy_ViewDistance 0x00C6B4D0
#define cAddy_PremiumCrossHair 0x0069A42E
#define cAddy_PremiumCrossHairC 0x0069A439
struct vectorA
{
float x,z,y;
};//0x00C
struct CPlayer
{
char ch_unknown1 [50308]; //0x00
BYTE index; //0xC484
char ch_unknown2 [15676]; //0xC488
float CPx; //0x101C4
float CPy; //0x101C8
float CPz; //0x101CC
char ch_unknown3 [252]; //0x101D0
float FallDamage; //0x102CC
char ch_unknown4 [20]; //0x102D0
float pX; //0x102E4
char ch_unknown5 [4]; //0x102E8
float pY; //0x102EC
char ch_unknown6 [4]; //0x102F0
float pZ; //0x102F4
};
struct CBase
{
CPlayer* local; //0x0000
char unknown4[72]; //0x0004
CPlayer** player; //0x004C
char unknown80[48]; //0x0050
};//Size=0x0080(128)
struct CPlayerInfo
{
char unknown1[7068]; //0x00
__int32 health; //0x1B9C
char unknown2[324]; //0x1BA0
BYTE team; //0x1CE4
};
struct CLocal
{
char unknown0[32]; //0x0000
vectorA pos; //0x0020
char unknown44[36]; //0x002C
float pitch; //0x0050
float yaw; //0x0054
char unknown88[16]; //0x0058
float down; //0x0068
float up; //0x006C
float fovx; //0x0070
float fovy; //0x0074
};//Size=0x0078(120)
CBase *g_pBase = (CBase*)PPointer;
CPlayerInfo* GetPlayerInfo(int index)
{
if(index > 32) return 0;
DWORD dwBasePointer = BPointer;
return (CPlayerInfo*) (dwBasePointer +(index*OFS_Size));
}
CPlayerInfo* GetPlayerIP(int index)
{
if(index > 32) return 0;
DWORD dwIPPointer = IPointer;
return (CPlayerInfo*) (dwIPPointer +(index*OFS_Size));
}
CPlayerInfo* GetPlayerName(int index)
{
if(index > 32) return 0;
DWORD dwNamePointer = NPointer;
return (CPlayerInfo*) (dwNamePointer +(index*OFS_Size));
}
void FillRGB(int x, int y, int w, int h, D3DCOLOR color, LPDIRECT3DDEVICE9 pDevice)
{
D3DRECT rec;
rec.x1 = x;
rec.x2 = x + w;
rec.y1 = y;
rec.y2 = y + h;
pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 1.0f, 0);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE);
pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
}
void DrawBorder(int x, int y, int w, int h, int px, D3DCOLOR BorderColor, LPDIRECT3DDEVICE9 pDevice)
{
FillRGB( x, (y + h - px), w, px, BorderColor, pDevice);
FillRGB( x, y, px, h, BorderColor, pDevice);
FillRGB( x, y, w, px, BorderColor, pDevice);
FillRGB( (x + w - px), y, px, h, BorderColor, pDevice);
}
void DrawBox(int x, int y, int w, int h, D3DCOLOR Color, LPDIRECT3DDEVICE9 pDevice)
{
struct Vertex
{
float x,y,z,ht;
DWORD Color;
};
Vertex V[8];
V[0].Color = V[1].Color = V[2].Color = V[3].Color = Color;
V[0].z = V[1].z = V[2].z = V[3].z = 0.0f;
V[0].ht = V[1].ht = V[2].ht = V[3].ht = 0.0f;
V[0].x = V[1].x = (float)x;
V[0].y = V[2].y = (float)(y + h);
V[1].y = V[3].y = (float)y;
V[2].x = V[3].x = (float)(x + w);
FillRGB(x, y, w, h, Color, pDevice);
DrawBorder( x, y, w, h, 1, Color, pDevice);
pDevice->SetTexture(0, NULL);
pDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));
}
void DrawBox_s(LPDIRECT3DDEVICE9 pDevice , int x, int y, int w, int h, DWORD Color)
{
D3DRECT rec;
rec.x1 = x;
rec.x2 = x + w;
rec.y1 = y;
rec.y2 = y + h;
pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, Color, 0, 0 );
}
void DrawRectangle(int x, int y, int w, int h, int s, DWORD Color, LPDIRECT3DDEVICE9 pDevice)
{
DrawBox_s(pDevice, x, y, w, s, Color);
DrawBox_s(pDevice, x, y, s, h, Color);
DrawBox_s(pDevice, (x+w), y, s, h, Color);
DrawBox_s(pDevice, x, (y+h), w+s, s, Color);
}
void GMWarning()
{
char *cGM_Name = (char*)(GM_Warning);
if(strlen(cGM_Name) > 2)
{
ExitProcess(0);
}
}

