WIP Stuff
Fix glow and chams (kind of, todo) Add detach (todo)
This commit is contained in:
parent
dd6650c551
commit
e7908e2e90
@ -25,6 +25,7 @@ extern std::mutex command_stack_mutex;
|
||||
std::stack<std::string> &command_stack();
|
||||
void ExecuteCommand(const std::string command);
|
||||
|
||||
extern bool game_shutdown;
|
||||
extern bool shutdown;
|
||||
extern bool initialized;
|
||||
|
||||
|
@ -16,5 +16,4 @@ void shutdown();
|
||||
void reload();
|
||||
|
||||
extern const std::vector<std::string> builtin_default;
|
||||
extern const std::vector<std::string> jp_anime;
|
||||
} // namespace hacks::shared::dominatesay
|
||||
|
@ -16,8 +16,6 @@ namespace effect_chams
|
||||
|
||||
class EffectChams : public IScreenSpaceEffect
|
||||
{
|
||||
std::vector<KeyValues *> chams_keyvalues;
|
||||
|
||||
public:
|
||||
virtual void Init();
|
||||
virtual void Shutdown()
|
||||
@ -28,9 +26,6 @@ public:
|
||||
mat_unlit_z.Shutdown();
|
||||
mat_lit.Shutdown();
|
||||
mat_lit_z.Shutdown();
|
||||
for (auto kv : chams_keyvalues)
|
||||
if (kv)
|
||||
kv->deleteThis();
|
||||
init = false;
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ namespace effect_glow
|
||||
|
||||
class EffectGlow : public IScreenSpaceEffect
|
||||
{
|
||||
std::vector<KeyValues *> glow_keyvalues;
|
||||
|
||||
public:
|
||||
virtual void Init();
|
||||
virtual void Shutdown()
|
||||
@ -30,9 +28,6 @@ public:
|
||||
mat_unlit_z.Shutdown();
|
||||
mat_blur_x.Shutdown();
|
||||
mat_blur_y.Shutdown();
|
||||
for (auto kv : glow_keyvalues)
|
||||
if (kv)
|
||||
kv->deleteThis();
|
||||
init = false;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#include <core/logging.hpp>
|
||||
#include "common.hpp"
|
||||
#include <pthread.h>
|
||||
|
||||
#include "hack.hpp"
|
||||
@ -40,7 +40,7 @@ void *MainThread(void *arg)
|
||||
logging::Info("Shutting down...");
|
||||
hack::Shutdown();
|
||||
logging::Shutdown();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void __attribute__((constructor)) attach()
|
||||
@ -51,9 +51,19 @@ void __attribute__((constructor)) attach()
|
||||
pthread_create(&thread_main, 0, MainThread, &mutex_quit);
|
||||
}
|
||||
|
||||
void __attribute__((destructor)) detach()
|
||||
void detach()
|
||||
{
|
||||
logging::Info("Detaching");
|
||||
pthread_mutex_unlock(&mutex_quit);
|
||||
pthread_join(thread_main, 0);
|
||||
}
|
||||
|
||||
void __attribute__((destructor)) deconstruct()
|
||||
{
|
||||
detach();
|
||||
}
|
||||
|
||||
CatCommand cat_detach("detach", "Detach cathook from TF2", []() {
|
||||
hack::game_shutdown = false;
|
||||
detach();
|
||||
});
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <settings/Bool.hpp>
|
||||
|
||||
#include "common.hpp"
|
||||
#include "hack.hpp"
|
||||
|
||||
settings::Bool log_to_console{ "hack.log-console", "false" };
|
||||
|
||||
@ -45,7 +46,7 @@ void logging::Info(const char *fmt, ...)
|
||||
fprintf(logging::handle, "%s", result);
|
||||
fflush(logging::handle);
|
||||
#if ENABLE_VISUALS
|
||||
if (g_ICvar)
|
||||
if (!hack::game_shutdown && g_ICvar)
|
||||
{
|
||||
if (*log_to_console)
|
||||
g_ICvar->ConsolePrintf("%s", result);
|
||||
|
11
src/hack.cpp
11
src/hack.cpp
@ -32,6 +32,8 @@
|
||||
* Linux
|
||||
*/
|
||||
|
||||
// game_shutdown = Is full game shutdown or just detach
|
||||
bool hack::game_shutdown = true;
|
||||
bool hack::shutdown = false;
|
||||
bool hack::initialized = false;
|
||||
|
||||
@ -367,6 +369,8 @@ void hack::Shutdown()
|
||||
if (hack::shutdown)
|
||||
return;
|
||||
hack::shutdown = true;
|
||||
// Stop cathook stuff
|
||||
settings::RVarLock.store(true);
|
||||
playerlist::Save();
|
||||
#if ENABLE_VISUALS
|
||||
sdl_hooks::cleanSdlHooks();
|
||||
@ -374,8 +378,15 @@ void hack::Shutdown()
|
||||
logging::Info("Unregistering convars..");
|
||||
ConVar_Unregister();
|
||||
logging::Info("Shutting down killsay...");
|
||||
if (!hack::game_shutdown)
|
||||
{
|
||||
hacks::shared::killsay::shutdown();
|
||||
hacks::shared::dominatesay::shutdown();
|
||||
hacks::shared::announcer::shutdown();
|
||||
#if ENABLE_VISUALS
|
||||
g_pScreenSpaceEffects->DisableScreenSpaceEffect("_cathook_glow");
|
||||
g_pScreenSpaceEffects->DisableScreenSpaceEffect("_cathook_chams");
|
||||
#endif
|
||||
}
|
||||
logging::Info("Success..");
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ std::string ComposeDominateSay(IGameEvent *event)
|
||||
case 2:
|
||||
source = &builtin_default;
|
||||
break;
|
||||
case 3:
|
||||
source = &jp_anime;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -115,17 +112,4 @@ const std::vector<std::string> builtin_default = {
|
||||
"%killer% is dominating the server with %dominum% dominations!",
|
||||
};
|
||||
|
||||
// same goes to this one
|
||||
const std::vector<std::string> jp_anime = {
|
||||
"Get d-dominated %name%-senpai >:3",
|
||||
"g- gomenasai! %name%-san!",
|
||||
"Wow! hey hey hey H~ ey !!! I found you again~~!",
|
||||
"%name%-san please don't get mad at me.. ><",
|
||||
// https://youtu.be/sW3RT0tF020?t=207
|
||||
"kore kara mo douzo yoroshiku ne.",
|
||||
"konna watashi dakedo waratte yurushite ne.",
|
||||
"zutto taisetsu ni shite ne.",
|
||||
"eikyuu hoshou no watashi dakara.",
|
||||
};
|
||||
|
||||
} // namespace hacks::shared::dominatesay
|
||||
|
@ -38,20 +38,20 @@ CatCommand fix_black_chams("fix_black_chams", "Fix Black Chams", []() {
|
||||
|
||||
void EffectChams::Init()
|
||||
{
|
||||
if (init)
|
||||
return;
|
||||
logging::Info("Init EffectChams...");
|
||||
{
|
||||
KeyValues *kv = new KeyValues("UnlitGeneric");
|
||||
kv->SetString("$basetexture", "vgui/white_additive");
|
||||
kv->SetInt("$ignorez", 0);
|
||||
mat_unlit.Init("__cathook_echams_unlit", kv);
|
||||
chams_keyvalues.push_back(kv);
|
||||
}
|
||||
{
|
||||
KeyValues *kv = new KeyValues("UnlitGeneric");
|
||||
kv->SetString("$basetexture", "vgui/white_additive");
|
||||
kv->SetInt("$ignorez", 1);
|
||||
mat_unlit_z.Init("__cathook_echams_unlit_z", kv);
|
||||
chams_keyvalues.push_back(kv);
|
||||
}
|
||||
{
|
||||
KeyValues *kv = new KeyValues("VertexLitGeneric");
|
||||
@ -59,7 +59,6 @@ void EffectChams::Init()
|
||||
kv->SetInt("$ignorez", 0);
|
||||
kv->SetInt("$halflambert", 1);
|
||||
mat_lit.Init("__cathook_echams_lit", kv);
|
||||
chams_keyvalues.push_back(kv);
|
||||
}
|
||||
{
|
||||
KeyValues *kv = new KeyValues("VertexLitGeneric");
|
||||
@ -67,7 +66,6 @@ void EffectChams::Init()
|
||||
kv->SetInt("$ignorez", 1);
|
||||
kv->SetInt("$halflambert", 1);
|
||||
mat_lit_z.Init("__cathook_echams_lit_z", kv);
|
||||
chams_keyvalues.push_back(kv);
|
||||
}
|
||||
logging::Info("Init done!");
|
||||
init = true;
|
||||
@ -335,6 +333,8 @@ void EffectChams::Render(int x, int y, int w, int h)
|
||||
return;
|
||||
if (!enable)
|
||||
return;
|
||||
if (g_Settings.bInvalid)
|
||||
return;
|
||||
if (!init)
|
||||
Init();
|
||||
if (!isHackActive() || (g_IEngine->IsTakingScreenshot() && clean_screenshots))
|
||||
|
@ -129,20 +129,20 @@ CatCommand fix_black_glow("fix_black_glow", "Fix Black Glow", []() {
|
||||
|
||||
void EffectGlow::Init()
|
||||
{
|
||||
if (init)
|
||||
return;
|
||||
logging::Info("Init Glow...");
|
||||
{
|
||||
KeyValues *kv = new KeyValues("UnlitGeneric");
|
||||
kv->SetString("$basetexture", "vgui/white_additive");
|
||||
kv->SetInt("$ignorez", 0);
|
||||
mat_unlit.Init("__cathook_glow_unlit", kv);
|
||||
glow_keyvalues.push_back(kv);
|
||||
}
|
||||
{
|
||||
KeyValues *kv = new KeyValues("UnlitGeneric");
|
||||
kv->SetString("$basetexture", "vgui/white_additive");
|
||||
kv->SetInt("$ignorez", 1);
|
||||
mat_unlit_z.Init("__cathook_glow_unlit_z", kv);
|
||||
glow_keyvalues.push_back(kv);
|
||||
}
|
||||
// Initialize 2 buffers
|
||||
GetBuffer(1);
|
||||
@ -153,7 +153,6 @@ void EffectGlow::Init()
|
||||
kv->SetInt("$additive", 1);
|
||||
mat_blit.Init("__cathook_glow_blit", TEXTURE_GROUP_CLIENT_EFFECTS, kv);
|
||||
mat_blit->Refresh();
|
||||
glow_keyvalues.push_back(kv);
|
||||
}
|
||||
{
|
||||
KeyValues *kv = new KeyValues("BlurFilterX");
|
||||
@ -163,7 +162,6 @@ void EffectGlow::Init()
|
||||
kv->SetInt("$alphatest", 1);
|
||||
mat_blur_x.Init("_cathook_blurx", kv);
|
||||
mat_blur_x->Refresh();
|
||||
glow_keyvalues.push_back(kv);
|
||||
}
|
||||
{
|
||||
KeyValues *kv = new KeyValues("BlurFilterY");
|
||||
@ -174,7 +172,6 @@ void EffectGlow::Init()
|
||||
kv->SetInt("$alphatest", 1);
|
||||
mat_blur_y.Init("_cathook_blury", kv);
|
||||
mat_blur_y->Refresh();
|
||||
glow_keyvalues.push_back(kv);
|
||||
}
|
||||
{
|
||||
SS_NeverSolid.m_bEnable = true;
|
||||
|
@ -33,5 +33,6 @@ void applySdlHooks()
|
||||
void cleanSdlHooks()
|
||||
{
|
||||
*pointers::SDL_GL_SwapWindow = hooked_methods::original::SDL_GL_SwapWindow;
|
||||
*pointers::SDL_PollEvent = hooked_methods::original::SDL_PollEvent;
|
||||
}
|
||||
} // namespace sdl_hooks
|
Reference in New Issue
Block a user