update readme + add glow check

This commit is contained in:
nullifiedcat 2017-05-03 22:26:06 +03:00
parent c48f616991
commit 8fb2d03e8e
3 changed files with 57 additions and 60 deletions

View File

@ -6,7 +6,7 @@
Ubuntu (and probably Debian) users can run this script:
```
sudo apt update && sudo apt install build-essential software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update && sudo apt install gcc-snapshot -y && sudo apt update && sudo apt install libc6-dev gcc-6 g++-6 g++-6-multilib gdb -y && git clone --recursive https://github.com/nullifiedcat/cathook && cd cathook && make -j4
sudo apt update && sudo apt install build-essential software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update && sudo apt install gcc-snapshot -y && sudo apt update && sudo apt install git libc6-dev gcc-6 g++-6 libc6-dev:i386 g++-6-multilib gdb -y && git clone --recursive https://github.com/nullifiedcat/cathook && cd cathook && make -j4
```
**Errors while installing?**

View File

@ -67,17 +67,11 @@ void hack::ExecuteCommand(const std::string command) {
ConCommand* hack::c_Cat = 0;
void hack::CC_Cat(const CCommand& args) {
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::blu), "cathook");
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), " by ");
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::blu), "d4rkc4t\n");
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), "build: " CATHOOK_BUILD_NUMBER " \"" CATHOOK_BUILD_NAME "\"\n");
#if _DEVELOPER
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "[DEVELOPER BUILD]\n");
#else
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "Build for user " __DRM_NAME " (Early Access)\n");
#endif
#ifdef __DRM_NOTES
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "Build notes: " __DRM_NOTES "\n");
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), "cathook");
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::blu), " by ");
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "nullifiedcat\n");
#if defined(GIT_COMMIT_HASH) && defined(GIT_COMMIT_DATE)
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), "commit: #" GIT_COMMIT_HASH " " GIT_COMMIT_DATE "\n");
#endif
}
@ -167,7 +161,7 @@ void hack::Initialize() {
hooks::hkInput->Init((void*)g_IInput, 0);
hooks::hkInput->HookMethod((void*)GetUserCmd_hook, hooks::offGetUserCmd);
hooks::hkInput->Apply();
logging::Info("Before hacking: %s", g_ISteamFriends->GetPersonaName());
//logging::Info("Before hacking: %s", g_ISteamFriends->GetPersonaName());
hooks::hkIVModelRender = new hooks::VMTHook();
hooks::hkIVModelRender->Init(g_IVModelRender, 0);
hooks::hkIVModelRender->HookMethod((void*)DrawModelExecute_hook, hooks::offDrawModelExecute);
@ -176,7 +170,7 @@ void hack::Initialize() {
hooks::hkSteamFriends->Init(g_ISteamFriends, 0);
hooks::hkSteamFriends->HookMethod((void*)GetFriendPersonaName_hook, hooks::offGetFriendPersonaName);
hooks::hkSteamFriends->Apply();
logging::Info("After hacking: %s", g_ISteamFriends->GetPersonaName());
//logging::Info("After hacking: %s", g_ISteamFriends->GetPersonaName());
// Sadly, it doesn't work as expected :(
/*hooks::hkBaseClientState = new hooks::VMTHook();
hooks::hkBaseClientState->Init((void*)g_IBaseClientState, 0);

View File

@ -190,54 +190,57 @@ void FrameStageNotify_hook(void* thisptr, int stage) {
}
}
}
static ConVar* glow_outline_effect = g_ICvar->FindVar("glow_outline_effect_enable");
if (TF && cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) {
if (glow_enabled) {
for (int i = 0; i < g_GlowObjectManager->m_GlowObjectDefinitions.m_Size; i++) {
GlowObjectDefinition_t& glowobject = g_GlowObjectManager->m_GlowObjectDefinitions[i];
if (glowobject.m_nNextFreeSlot != ENTRY_IN_USE)
continue;
int color = GetEntityGlowColor(glowobject.m_hEntity.m_Index & 0xFFF);
if (color == 0) {
glowobject.m_flGlowAlpha = 0.0f;
} else {
glowobject.m_flGlowAlpha = (float)glow_alpha;
}
unsigned char _b = (color >> 16) & 0xFF;
unsigned char _g = (color >> 8) & 0xFF;
unsigned char _r = (color) & 0xFF;
glowobject.m_vGlowColor.x = (float)_r / 255.0f;
glowobject.m_vGlowColor.y = (float)_g / 255.0f;
glowobject.m_vGlowColor.z = (float)_b / 255.0f;
}
}
// Remove glow from dead entities
for (int i = 0; i < g_GlowObjectManager->m_GlowObjectDefinitions.Count(); i++) {
if (g_GlowObjectManager->m_GlowObjectDefinitions[i].m_nNextFreeSlot != ENTRY_IN_USE) continue;
IClientEntity* ent = (IClientEntity*)g_IEntityList->GetClientEntityFromHandle(g_GlowObjectManager->m_GlowObjectDefinitions[i].m_hEntity);
if (ent && ent->IsDormant()) {
g_GlowObjectManager->DisableGlow(i);
} else if (ent && ent->GetClientClass()->m_ClassID == g_pClassID->C_Player) {
if (NET_BYTE(ent, netvar.iLifeState) != LIFE_ALIVE) {
g_GlowObjectManager->DisableGlow(i);
}
}
}
if (glow_enabled) {
for (int i = 1; i < g_IEntityList->GetHighestEntityIndex(); i++) {
IClientEntity* entity = g_IEntityList->GetClientEntity(i);
if (!entity || i == g_IEngine->GetLocalPlayer() || entity->IsDormant())
continue;
if (!CanEntityEvenGlow(i)) continue;
int clazz = entity->GetClientClass()->m_ClassID;
int current_handle = g_GlowObjectManager->GlowHandle(entity);
bool shouldglow = ShouldEntityGlow(i);
if (current_handle != -1) {
if (!shouldglow) {
g_GlowObjectManager->DisableGlow(current_handle);
if (glow_outline_effect->GetBool()) {
if (glow_enabled) {
for (int i = 0; i < g_GlowObjectManager->m_GlowObjectDefinitions.m_Size; i++) {
GlowObjectDefinition_t& glowobject = g_GlowObjectManager->m_GlowObjectDefinitions[i];
if (glowobject.m_nNextFreeSlot != ENTRY_IN_USE)
continue;
int color = GetEntityGlowColor(glowobject.m_hEntity.m_Index & 0xFFF);
if (color == 0) {
glowobject.m_flGlowAlpha = 0.0f;
} else {
glowobject.m_flGlowAlpha = (float)glow_alpha;
}
} else {
if (shouldglow) {
g_GlowObjectManager->EnableGlow(entity, colors::white);
unsigned char _b = (color >> 16) & 0xFF;
unsigned char _g = (color >> 8) & 0xFF;
unsigned char _r = (color) & 0xFF;
glowobject.m_vGlowColor.x = (float)_r / 255.0f;
glowobject.m_vGlowColor.y = (float)_g / 255.0f;
glowobject.m_vGlowColor.z = (float)_b / 255.0f;
}
}
// Remove glow from dead entities
for (int i = 0; i < g_GlowObjectManager->m_GlowObjectDefinitions.Count(); i++) {
if (g_GlowObjectManager->m_GlowObjectDefinitions[i].m_nNextFreeSlot != ENTRY_IN_USE) continue;
IClientEntity* ent = (IClientEntity*)g_IEntityList->GetClientEntityFromHandle(g_GlowObjectManager->m_GlowObjectDefinitions[i].m_hEntity);
if (ent && ent->IsDormant()) {
g_GlowObjectManager->DisableGlow(i);
} else if (ent && ent->GetClientClass()->m_ClassID == g_pClassID->C_Player) {
if (NET_BYTE(ent, netvar.iLifeState) != LIFE_ALIVE) {
g_GlowObjectManager->DisableGlow(i);
}
}
}
if (glow_enabled) {
for (int i = 1; i < g_IEntityList->GetHighestEntityIndex(); i++) {
IClientEntity* entity = g_IEntityList->GetClientEntity(i);
if (!entity || i == g_IEngine->GetLocalPlayer() || entity->IsDormant())
continue;
if (!CanEntityEvenGlow(i)) continue;
int clazz = entity->GetClientClass()->m_ClassID;
int current_handle = g_GlowObjectManager->GlowHandle(entity);
bool shouldglow = ShouldEntityGlow(i);
if (current_handle != -1) {
if (!shouldglow) {
g_GlowObjectManager->DisableGlow(current_handle);
}
} else {
if (shouldglow) {
g_GlowObjectManager->EnableGlow(entity, colors::white);
}
}
}
}