nixware.cc
-
Автор темы
- #1
В этот раз не будет хайда, ибо я считаю эту функцию юзлесс говном.
Ну да ладно, для пастеров самое то.
Ну да ладно, для пастеров самое то.
Добавляем в проект flashlight.h
Далее добавляем этот код в cinpunt.hppКод:#include "..\INDIGO\Engine\Render.h" class CFlashLightEffect { public: bool m_bIsOn; //0x0000 char pad_0x0001[0x3]; //0x0001 int m_nEntIndex; //0x0004 WORD m_FlashLightHandle; //0x0008 char pad_0x000A[0x2]; //0x000A float m_flMuzzleFlashBrightness; //0x000C float m_flFov; //0x0010 float m_flFarZ; //0x0014 float m_flLinearAtten; //0x0018 bool m_bCastsShadows; //0x001C char pad_0x001D[0x3]; //0x001D float m_flCurrentPullBackDist; //0x0020 DWORD m_MuzzleFlashTexture; //0x0024 DWORD m_FlashLightTexture; //0x0028 char m_szTextureName[64]; //0x1559888 }; //Size=0x006C void DestroyFlashLight(CFlashLightEffect *pFlashLight) { static DWORD oDestructor = CSX::Memory::FindPattern(CLIENT_DLL, "56 8B F1 E8 ? ? ? ? 8B 4E 28", 0); __asm { mov ecx, pFlashLight push ecx call oDestructor } }//dont we have to define them? they are difines as voids void UpdateFlashLight(CFlashLightEffect *pFlashLight, const Vector &vecPos, const Vector &vecForward, const Vector &vecRight, const Vector &vecUp) { typedef void(__thiscall* UpdateLight_t)(void*, int, const Vector&, const Vector&, const Vector&, const Vector&, float, float, float, bool, const char*); static UpdateLight_t oUpdateLight = NULL; if (!oUpdateLight) { DWORD callInstruction = CSX::Memory::FindPattern(CLIENT_DLL, "E8 ? ? ? ? 8B 06 F3 0F 10 46", 0); DWORD relativeAddress = *(DWORD*)(callInstruction + 1); DWORD nextInstruction = callInstruction + 5; oUpdateLight = (UpdateLight_t)(nextInstruction + relativeAddress); } oUpdateLight(pFlashLight, pFlashLight->m_nEntIndex, vecPos, vecForward, vecRight, vecUp, pFlashLight->m_flFov, pFlashLight->m_flFarZ, pFlashLight->m_flLinearAtten, pFlashLight->m_bCastsShadows, pFlashLight->m_szTextureName); } CFlashLightEffect *CreateFlashLight(int nEntIndex, const char *pszTextureName, float flFov, float flFarZ, float flLinearAtten) { static DWORD oConstructor = CSX::Memory::FindPattern(CLIENT_DLL, "55 8B EC F3 0F 10 45 ? B8", 0); CFlashLightEffect *pFlashLight = (CFlashLightEffect*)Interfaces::g_pMemAlloc->Alloc(sizeof(CFlashLightEffect)); if (!pFlashLight) return NULL; __asm { movss xmm3, flFov mov ecx, pFlashLight push flLinearAtten push flFarZ push pszTextureName push nEntIndex call oConstructor } return pFlashLight; } void RunFrame(CBaseEntity *pLocal) { static CFlashLightEffect *pFlashLight = NULL; static int x = 0; if (Settings::Esp::esp_lanterna && GetAsyncKeyState('F') & 1) { if (!pFlashLight) { pFlashLight = CreateFlashLight(pLocal->EntIndex(), "effects/flashlight001", 35, 1000, 1000); } else { DestroyFlashLight(pFlashLight); pFlashLight = NULL; } } if (pFlashLight) { Vector f, r, u; Vector viewAngles; Interfaces::Engine()->GetViewAngles(viewAngles); AngleVectors2(viewAngles, &f, &r, &u); pFlashLight->m_bIsOn = true; pFlashLight->m_bCastsShadows = false; pFlashLight->m_flFov = fabsf(13 + 37 * cosf(x)); UpdateFlashLight(pFlashLight, pLocal->GetEyePosition(), f, r, u); } }
В engine.cpp добавляем эти кодыКод:typedef size_t(*MemAllocFailHandler_t)(size_t); class IMemAlloc { public: virtual ~IMemAlloc(); // Release versions virtual void *Alloc(size_t nSize) = 0; virtual void *Realloc(void *pMem, size_t nSize) = 0; virtual void Free(void *pMem) = 0; virtual void *Expand_NoLongerSupported(void *pMem, size_t nSize) = 0; // Debug versions //virtual void *Alloc(size_t nSize, const char *pFileName, int nLine) = 0; //virtual void *Realloc(void *pMem, size_t nSize, const char *pFileName, int nLine) = 0; //virtual void Free(void *pMem, const char *pFileName, int nLine) = 0; //virtual void *Expand_NoLongerSupported(void *pMem, size_t nSize, const char *pFileName, int nLine) = 0; // Returns size of a particular allocation virtual size_t GetSize(void *pMem) = 0; // Force file + line information for an allocation virtual void PushAllocDbgInfo(const char *pFileName, int nLine) = 0; virtual void PopAllocDbgInfo() = 0; // FIXME: Remove when we have our own allocator // these methods of the Crt debug code is used in our codebase currently virtual long CrtSetBreakAlloc(long lNewBreakAlloc) = 0; virtual int CrtSetReportMode(int nReportType, int nReportMode) = 0; virtual int CrtIsValidHeapPointer(const void *pMem) = 0; virtual int CrtIsValidPointer(const void *pMem, unsigned int size, int access) = 0; virtual int CrtCheckMemory(void) = 0; virtual int CrtSetDbgFlag(int nNewFlag) = 0; virtual void CrtMemCheckpoint(_CrtMemState *pState) = 0; // FIXME: Make a better stats interface virtual void DumpStats() = 0; virtual void DumpStatsFileBase(char const *pchFileBase) = 0; // FIXME: Remove when we have our own allocator virtual void* CrtSetReportFile(int nRptType, void* hFile) = 0; virtual void* CrtSetReportHook(void* pfnNewHook) = 0; virtual int CrtDbgReport(int nRptType, const char * szFile, int nLine, const char * szModule, const char * pMsg) = 0; virtual int heapchk() = 0; virtual bool IsDebugHeap() = 0; virtual void GetActualDbgInfo(const char *&pFileName, int &nLine) = 0; virtual void RegisterAllocation(const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime) = 0; virtual void RegisterDeallocation(const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime) = 0; virtual int GetVersion() = 0; virtual void CompactHeap() = 0; // Function called when malloc fails or memory limits hit to attempt to free up memory (can come in any thread) virtual MemAllocFailHandler_t SetAllocFailHandler(MemAllocFailHandler_t pfnMemAllocFailHandler) = 0; virtual void DumpBlockStats(void *) = 0; #if defined( _MEMTEST ) virtual void SetStatsExtraInfo(const char *pMapName, const char *pComment) = 0; #endif // Returns 0 if no failure, otherwise the size_t of the last requested chunk // "I'm sure this is completely thread safe!" Brian Deen 7/19/2012. virtual size_t MemoryAllocFailed() = 0; // handles storing allocation info for coroutines virtual int GetDebugInfoSize() = 0; virtual void SaveDebugInfo(void *pvDebugInfo) = 0; virtual void RestoreDebugInfo(const void *pvDebugInfo) = 0; virtual void InitDebugInfo(void *pvDebugInfo, const char *pchRootFileName, int nLine) = 0; // Replacement for ::GlobalMemoryStatus which accounts for unused memory in our system virtual void GlobalMemoryStatus(size_t *pUsedMemory, size_t *pFreeMemory) = 0; };
в sdk.cppКод:if (!SDK::Interfaces::g_pMemAllocgood()) { return false; } void SinCos(float a, float* s, float*c) { *s = sin(a); *c = cos(a); } void AngleVectors2(const Vector &angles, Vector *forward, Vector *right, Vector *up) { float sr, sp, sy, cr, cp, cy; SinCos(DEG2RAD(angles[1]), &sy, &cy); SinCos(DEG2RAD(angles[0]), &sp, &cp); SinCos(DEG2RAD(angles[2]), &sr, &cr); if (forward) { forward->x = cp*cy; forward->y = cp*sy; forward->z = -sp; } if (right) { right->x = (-1 * sr*sp*cy + -1 * cr*-sy); right->y = (-1 * sr*sp*sy + -1 * cr*cy); right->z = -1 * sr*cp; } if (up) { up->x = (cr*sp*cy + -sr*-sy); up->y = (cr*sp*sy + -sr*cy); up->z = cr*cp; } }
в sdk.h паблик классКод:IMemAlloc* Interfaces::g_pMemAlloc = nullptr; IMemAlloc* Interfaces::g_pMemAllocgood() { if (!g_pMemAlloc) { g_pMemAlloc = *(IMemAlloc**)(GetProcAddress(GetModuleHandle("tier0.dll"), "g_pMemAlloc")); } return g_pMemAlloc; }
вызываем в esp.cpp onrenderКод:static IMemAlloc* g_pMemAllocgood(); static IMemAlloc* g_pMemAlloc;
Код:CBaseEntity* pPlayer = (CBaseEntity*)Interfaces::EntityList()->GetClientEntity(Interfaces::Engine()->GetLocalPlayer()); RunFrame(pPlayer);
Теперь вы никогда не упустите противника из вида даже ночью!
//Активировать фонарик на клавишу F