Merge branch 'testing'

This commit is contained in:
TotallyNotElite 2018-12-20 11:10:25 +01:00
commit 87849ff153
13 changed files with 43 additions and 47 deletions

2
external/libglez vendored

@ -1 +1 @@
Subproject commit dd0158bcb389a5687c16ae8075574db5b7dd1954
Subproject commit ac817c1c55b61387df289773fb3761fee8f462c0

View File

@ -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;

View File

@ -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

View File

@ -16,11 +16,9 @@ namespace effect_chams
class EffectChams : public IScreenSpaceEffect
{
std::vector<KeyValues *> chams_keyvalues;
public:
virtual void Init();
inline virtual void Shutdown()
virtual void Shutdown()
{
if (init)
{
@ -28,8 +26,6 @@ public:
mat_unlit_z.Shutdown();
mat_lit.Shutdown();
mat_lit_z.Shutdown();
for (auto kv : chams_keyvalues)
kv->deleteThis();
init = false;
}
}

View File

@ -15,11 +15,9 @@ namespace effect_glow
class EffectGlow : public IScreenSpaceEffect
{
std::vector<KeyValues *> glow_keyvalues;
public:
virtual void Init();
inline virtual void Shutdown()
virtual void Shutdown()
{
if (init)
{
@ -30,8 +28,7 @@ public:
mat_unlit_z.Shutdown();
mat_blur_x.Shutdown();
mat_blur_y.Shutdown();
for (auto kv : glow_keyvalues)
kv->deleteThis();
init = false;
}
}

View File

@ -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();
});

View File

@ -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);

View File

@ -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;
@ -307,7 +309,6 @@ free(logname);*/
{
effect_chams::g_pEffectChams = new CScreenSpaceEffectRegistration("_cathook_chams", &effect_chams::g_EffectChams);
g_pScreenSpaceEffects->EnableScreenSpaceEffect("_cathook_chams");
effect_chams::g_EffectChams.Init();
effect_glow::g_pEffectGlow = new CScreenSpaceEffectRegistration("_cathook_glow", &effect_glow::g_EffectGlow);
g_pScreenSpaceEffects->EnableScreenSpaceEffect("_cathook_glow");
}
@ -368,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();
@ -375,8 +378,15 @@ void hack::Shutdown()
logging::Info("Unregistering convars..");
ConVar_Unregister();
logging::Info("Shutting down killsay...");
hacks::shared::killsay::shutdown();
hacks::shared::dominatesay::shutdown();
hacks::shared::announcer::shutdown();
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..");
}

View File

@ -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

View File

@ -128,7 +128,7 @@ const char *GetNamestealName(CSteamID steam_id)
{
// Return the name that has changed from the func above
return format(stolen_name, "\015").c_str();
return format(stolen_name, "\e").c_str();
}
}
}

View File

@ -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))

View File

@ -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;

View File

@ -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