Pointer Safety Is No Joke
This commit is contained in:
parent
0662732dd8
commit
ead04d789e
@ -5,7 +5,7 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-583904496284777874" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-583682204379314874" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
@ -16,7 +16,7 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-583901282865735446" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-583678990960272446" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
@ -50,10 +50,8 @@ void CachedEntity::Update(int idx) {
|
||||
} else {
|
||||
m_bNULL = false;
|
||||
}
|
||||
|
||||
m_iClassID = m_pEntity->GetClientClass()->m_ClassID;
|
||||
m_bDormant = m_pEntity->IsDormant();
|
||||
|
||||
if (g_pLocalPlayer->entity) {
|
||||
m_flDistance = (g_pLocalPlayer->entity->GetAbsOrigin().DistTo(m_pEntity->GetAbsOrigin()));
|
||||
}
|
||||
@ -101,13 +99,16 @@ EntityCache::EntityCache() {
|
||||
}
|
||||
|
||||
EntityCache::~EntityCache() {
|
||||
logging::Info("Destroying EntityCache!");
|
||||
delete m_pArray;
|
||||
}
|
||||
|
||||
void EntityCache::Update() {
|
||||
m_nMax = interfaces::entityList->GetHighestEntityIndex();
|
||||
for (int i = 0; i < m_nMax; i++) {
|
||||
for (int i = 0; i < m_nMax && i < 4096; i++) {
|
||||
//logging::Info("Updating %i", i);
|
||||
m_pArray[i].Update(i);
|
||||
//logging::Info("Back!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,6 +116,7 @@ CachedEntity* EntityCache::GetEntity(int idx) {
|
||||
if (idx < 0 || idx >= m_nMax) {
|
||||
logging::Info("Requested invalid entity: %i", idx);
|
||||
}
|
||||
//logging::Info("Request entity: %i, 0x%08x", idx, m_pArray[idx].m_pEntity);
|
||||
return &(m_pArray[idx]);
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,8 @@
|
||||
typedef void(PaintTraverse_t)(void*, unsigned int, bool, bool);
|
||||
typedef bool(CreateMove_t)(void*, float, CUserCmd*);
|
||||
|
||||
bool hack::invalidated = true;
|
||||
|
||||
void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
((PaintTraverse_t*)hooks::hkPaintTraverse->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar);
|
||||
if (!draw::width || !draw::height) {
|
||||
@ -78,7 +80,10 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!interfaces::engineClient->IsInGame()) return;
|
||||
if (!interfaces::engineClient->IsInGame()) {
|
||||
hack::invalidated = true;
|
||||
}
|
||||
if (hack::invalidated) return;
|
||||
if (draw::panel_top == vp) {
|
||||
for (IHack* i_hack : hack::hacks) {
|
||||
i_hack->PaintTraverse(p, vp, fr, ar);
|
||||
@ -86,9 +91,7 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
Vector screen;
|
||||
for (int i = 0; i < gEntityCache.m_nMax && i < interfaces::entityList->GetHighestEntityIndex(); i++) {
|
||||
CachedEntity* ce = gEntityCache.GetEntity(i);
|
||||
if (!ce->m_pEntity) continue;
|
||||
if (ce->m_pEntity->IsDormant()) continue;
|
||||
if (ce->m_bNULL) continue;
|
||||
if (!CheckCE(ce)) continue;
|
||||
if (ce->m_ESPOrigin.IsZero(1.0f))
|
||||
if (!draw::EntityCenterToScreen(ce->m_pEntity, screen)) continue;
|
||||
for (int j = 0; j < ce->m_nESPStrings; j++) {
|
||||
@ -108,13 +111,17 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
|
||||
bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
bool ret = ((CreateMove_t*)hooks::hkCreateMove->GetMethod(hooks::offCreateMove))(thisptr, inputSample, cmd);
|
||||
if (!interfaces::engineClient->IsInGame()) return true;
|
||||
if (!interfaces::engineClient->IsInGame()) {
|
||||
hack::invalidated = true;
|
||||
return true;
|
||||
}
|
||||
if (!cmd) return ret;
|
||||
gEntityCache.Update();
|
||||
//logging::Info("Inside CreateMove");
|
||||
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
|
||||
//g_pLocalPlayer->bUseSilentAngles = false;
|
||||
g_pLocalPlayer->Update();
|
||||
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
|
||||
gEntityCache.Update();
|
||||
|
||||
//logging::Info("Inside CreateMove");
|
||||
//g_pLocalPlayer->bUseSilentAngles = false;
|
||||
//logging::Info("Inside CreateMove #1");
|
||||
for (IHack* i_hack : hack::hacks) {
|
||||
if (!i_hack->CreateMove(thisptr, inputSample, cmd)) {
|
||||
@ -122,6 +129,7 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
//g_pLocalPlayer->bUseSilentAngles = true;
|
||||
}
|
||||
}
|
||||
hack::invalidated = false;
|
||||
//logging::Info("Inside CreateMove #2");
|
||||
/*if (g_pLocalPlayer->bUseSilentAngles) {
|
||||
Vector vsilent(cmd->forwardmove, cmd->sidemove, cmd->upmove);
|
||||
|
@ -17,6 +17,7 @@ namespace hack {
|
||||
|
||||
extern std::vector<IHack*> hacks;
|
||||
extern bool shutdown;
|
||||
extern bool invalidated;
|
||||
|
||||
void Hk_PaintTraverse(void*, unsigned int, bool, bool);
|
||||
bool Hk_CreateMove(void*, float, CUserCmd*);
|
||||
|
@ -58,8 +58,7 @@ void HEsp::Create() {
|
||||
#define ESP_HEIGHT 14
|
||||
|
||||
void HEsp::DrawBox(CachedEntity* ent, Color clr, float widthFactor, float addHeight) {
|
||||
//logging::Info("DRAWING BOX OF %i", ent->m_IDX);
|
||||
if (!ent || !ent->m_pEntity || ent->m_pEntity->IsDormant()) return;
|
||||
if (!CheckCE(ent)) return;
|
||||
Vector min, max;
|
||||
ent->m_pEntity->GetRenderBounds(min, max);
|
||||
Vector origin = ent->m_pEntity->GetAbsOrigin();
|
||||
@ -94,9 +93,7 @@ void HEsp::DrawBox(CachedEntity* ent, Color clr, float widthFactor, float addHei
|
||||
void HEsp::ProcessEntityPT(CachedEntity* ent) {
|
||||
if (!this->v_bEnabled->GetBool()) return;
|
||||
if (!this->v_bBox->GetBool()) return;
|
||||
if (ent->m_pEntity != interfaces::entityList->GetClientEntity(ent->m_IDX)) return;
|
||||
if (!ent || !ent->m_pEntity) return;
|
||||
if (ent->m_pEntity->IsDormant()) return;
|
||||
if (!CheckCE(ent)) return;
|
||||
if (ent->m_IDX == interfaces::engineClient->GetLocalPlayer()) return;
|
||||
Color color;
|
||||
switch (ent->m_iClassID) {
|
||||
@ -123,10 +120,7 @@ void HEsp::ProcessEntityPT(CachedEntity* ent) {
|
||||
|
||||
void HEsp::ProcessEntity(CachedEntity* ent) {
|
||||
if (!this->v_bEnabled->GetBool()) return;
|
||||
if (!ent->m_pEntity) return;
|
||||
if (ent->m_pEntity->IsDormant()) return;
|
||||
if (ent->m_bNULL) return;
|
||||
if (ent->m_bDormant) return;
|
||||
if (!CheckCE(ent)) return;
|
||||
|
||||
Color color = draw::white;
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "usercmd.h"
|
||||
#include "trace.h"
|
||||
#include "localplayer.h"
|
||||
#include "entitycache.h"
|
||||
|
||||
#include "fixsdk.h"
|
||||
#include <tier1/convar.h>
|
||||
@ -439,6 +440,10 @@ bool IsFriend(IClientEntity* ent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CheckCE(CachedEntity* entity) {
|
||||
return (entity && entity->m_pEntity && !entity->m_pEntity->IsDormant());
|
||||
}
|
||||
|
||||
const char* powerups[] = {
|
||||
"STRENGTH",
|
||||
"RESISTANCE",
|
||||
|
@ -8,6 +8,7 @@
|
||||
#ifndef HELPERS_H_
|
||||
#define HELPERS_H_
|
||||
|
||||
class CachedEntity;
|
||||
class IClientEntity;
|
||||
class ConVar;
|
||||
class ConCommand;
|
||||
@ -45,6 +46,7 @@ bool GetProjectileData(IClientEntity* weapon, float& speed, bool& arc);
|
||||
bool IsVectorVisible(Vector a, Vector b);
|
||||
bool PredictProjectileAim(Vector origin, IClientEntity* target, hitbox hb, float speed, bool arc, Vector& result);
|
||||
bool IsFriend(IClientEntity* ent);
|
||||
bool CheckCE(CachedEntity* entity);
|
||||
|
||||
extern const char* powerups[POWERUP_COUNT];
|
||||
extern const char* packs[PACK_COUNT];
|
||||
|
Reference in New Issue
Block a user