[Help] Still DC at login Screen
Base.cpp i use, credits: gellin
Code:
#include "base.h"
#include "Defines.h"
cBase Base;
CDetour m_dPresent, m_dReset;
bool cBase::IsGameReadyForHook(void)
{
if( GetModuleHandle( "d3d9.dll" ) != NULL
&& GetModuleHandle( "ClientFX.fxd" ) != NULL
&& GetModuleHandle( "CShell.dll" ) != NULL )
return true;
return false;
}
void __cdecl cBase::PushToConsole( const char* szCommand )
{
DWORD *LTClient = ( DWORD* )( 0x377EFBD8 );
void* CONoff = ( void* )*( DWORD* )( *LTClient + 0x208 );
__asm
{
push szCommand;
call CONoff;
add esp, 4;
}
}
typedef HRESULT ( WINAPI* oReset )( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters );
oReset pReset;
HRESULT WINAPI gellReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
{
Base.pFont->OnLostDevice();
HRESULT hRet = pReset(pDevice, pPresentationParameters);
Base.pFont->OnResetDevice();
return hRet;
}
typedef HRESULT ( WINAPI* oPresent ) ( LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion);
oPresent pPresent;
HRESULT WINAPI gellPresent(LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion)
{
if( !Base.bSet.bInit )
{
D3DXCreateFont(pDevice, 15, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &Base.pFont);
Base.bSet.bInit = true;
}
Base.GetInput();
//Fly Hack
if( GetAsyncKeyState(FlyKey) < 0)
Base.PushToConsole("PlayerGravity 800");
else
Base.PushToConsole("PlayerGravity -800");
if( Base.pFont == NULL )
D3DXCreateFont(pDevice, 15, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &Base.pFont);
else
RenderClass.DrawString(10, 10, D3DCOLOR_ARGB(255, 255, 0, 0), Base.pFont, "FU CA by Gellin For Delta-h And UC Forums ");
return pPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}
void cBase::GetInput(void)
{
if(GetAsyncKeyState(BoxKey)&1)
this->bSet.bBoxes =! this->bSet.bBoxes;
if(GetAsyncKeyState(NoFogKey)&1)
this->bSet.bNoFog =! this->bSet.bNoFog;
if(GetAsyncKeyState(TracerKey)&1)
this->bSet.bTracers =! this->bSet.bTracers;
}
void cBase::UpdateConsole(void)
{
while(1)
{
if( this->bSet.bBoxes )//3d BoxEsp
this->PushToConsole("ModelDebug_DrawBoxes 1");
else
this->PushToConsole("ModelDebug_DrawBoxes 0");
if( this->bSet.bNoFog )//No Fog
this->PushToConsole("FogEnable 0");
else
this->PushToConsole("FogEnable 1");
if( this->bSet.bTracers )//Tracers ( annoying )
this->PushToConsole("ShowFirePath 1");
else
this->PushToConsole("ShowFirePath 0");
if( this->bSet.bWindowed )//Windowed Defualt ON
this->PushToConsole("windowed 1");
else
this->PushToConsole("windowed 0");
Sleep(250);
//4x per second seems better than every frame so dont ask.
}
}
DWORD cBase::GetPointer(int index)
{
DWORD* devicePtr = ***(DWORD****)0x7E4CE0;
if( devicePtr == NULL )
return 0;
return devicePtr[index];
}
void cBase::Hook(void)
{
this->bSet.m_dwReset = this->GetPointer(16);
this->bSet.m_dwPresent = this->GetPointer(17);
pReset = (oReset)m_dReset.Create(( BYTE* )this->bSet.m_dwReset, ( BYTE* )gellReset, DETOUR_TYPE_JMP );
pPresent = (oPresent)m_dPresent.Create(( BYTE* )this->bSet.m_dwPresent, ( BYTE* )gellPresent, DETOUR_TYPE_JMP );
}
DWORD WINAPI dwMainThread(LPVOID)
{
while ( !Base.IsGameReadyForHook() )
Sleep(500);
Base.Hook();
return 0;
}
DWORD WINAPI dwHackThread(LPVOID)
{
while( !Base.IsGameReadyForHook() )
Sleep(500);
Base.UpdateConsole();
return 0;
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
DisableThreadLibraryCalls(hDll);
if ( dwReason == DLL_PROCESS_ATTACH )
{
CreateThread(NULL, NULL, dwMainThread, NULL, NULL, NULL);
CreateThread(NULL, NULL, dwHackThread, NULL, NULL, NULL);
}
return TRUE;
}
After compiled it as .dll & injected it, it dc me at login screen, how to fix it? I need some guide so i can fix it in future.
or the problem isn't at base.cpp ?
If anyone can help me i 'll appreciate... , all i want is to have my own menu shows in combat arms (it will make me happy xD) & i'll figure out adding the addies & rest later.