FOV CIRCLE MFER

This commit is contained in:
nullifiedcat 2017-07-01 15:54:45 +03:00
parent 63fc7dd638
commit 0b43b0de92
7 changed files with 79 additions and 19 deletions

View File

@ -35,7 +35,7 @@
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1168214098." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.965909756" name="Linux GCC" nonInternalBuilderId="cdt.managedbuild.target.gnu.builder.exe.debug" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1799148153" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder arguments="-e GAME=tf2 NOIPC=1" buildPath="${workspace_loc:/kathook}" command="make" id="cdt.managedbuild.target.gnu.builder.exe.debug.1548213350" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<builder arguments="-e GAME=tf2 NOIPC=1" buildPath="${workspace_loc:/cathook}" command="make" id="cdt.managedbuild.target.gnu.builder.exe.debug.1548213350" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.782611349" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.883030293" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.908662295" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>

38
detach-backtrace Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
line=$(pidof hl2_linux)
arr=($line)
inst=$1
if [ $# == 0 ]; then
inst=0
fi
if [ ${#arr[@]} == 0 ]; then
echo TF2 isn\'t running!
exit
fi
if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then
echo wrong index!
exit
fi
echo Running instances: "${arr[@]}"
echo Detaching from "${arr[$1]}"
if grep -q "$(realpath bin/libcathook.so)" /proc/"${arr[$1]}"/maps; then
gdb -n -q -batch \
-ex "attach ${arr[$1]}" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
-ex "set \$dlclose = (int(*)(void*)) dlclose" \
-ex "set \$library = \$dlopen(\"$(realpath bin/libcathook.so)\", 6)" \
-ex "print \$library" \
-ex "sharedlibrary ." \
-ex "call \$dlclose(\$library)" \
-ex "call \$dlclose(\$library)" \
-ex "continue" \
-ex "backtrace"
echo "Detached"
else
echo "not found!"
fi

View File

@ -59,6 +59,7 @@ void AddCenterString(const std::string& string, const rgba_t& color) {
// TODO globals
int draw::width = 0;
int draw::height = 0;
float draw::fov = 90.0f;
namespace fonts {

View File

@ -36,6 +36,7 @@ namespace draw {
extern int width;
extern int height;
extern float fov;
void Initialize();

View File

@ -24,22 +24,11 @@ CatVar info_text(CV_SWITCH, "info", "1", "Show info", "Show cathook version in t
void DrawCheatVisuals() {
std::lock_guard<std::mutex> draw_lock(drawing_mutex);
if (drawgl::ready_state) {
{
PROF_SECTION(DRAW_aimbot);
hacks::shared::aimbot::DrawText();
}
{
PROF_SECTION(DRAW_misc);
SAFE_CALL(hacks::shared::misc::DrawText());
}
IF_GAME(IsTF2()) {
PROF_SECTION(DRAW_skinchanger);
SAFE_CALL(hacks::tf2::skinchanger::DrawText());
}
IF_GAME(IsTF()) {
PROF_SECTION(DRAW_radar);
SAFE_CALL(hacks::tf::radar::Draw());
}
if (info_text) {
PROF_SECTION(DRAW_info);
std::string name_s, reason_s;
@ -67,6 +56,18 @@ void DrawCheatVisuals() {
}
if (CE_GOOD(g_pLocalPlayer->entity) && !g_Settings.bInvalid) {
PROF_SECTION(PT_total_hacks);
{
PROF_SECTION(DRAW_aimbot);
hacks::shared::aimbot::DrawText();
}
IF_GAME(IsTF2()) {
PROF_SECTION(DRAW_skinchanger);
SAFE_CALL(hacks::tf2::skinchanger::DrawText());
}
IF_GAME(IsTF()) {
PROF_SECTION(DRAW_radar);
SAFE_CALL(hacks::tf::radar::Draw());
}
IF_GAME(IsTF2()) {
PROF_SECTION(DRAW_healarrows);
hacks::tf2::healarrow::Draw();

View File

@ -868,18 +868,36 @@ void DrawText() {
// Broken from kathook merge, TODO needs to be adapted for imgui
if (fov_draw) {
// It cant use fovs greater than 180, so we check for that
if ((int)fov < 180 && fov) {
if (fov && float(fov) < 180) {
// Dont show ring while player is dead
if (!LOCAL_E->m_bAlivePlayer) {
if (LOCAL_E->m_bAlivePlayer) {
// Grab the screen resolution and save to some vars
int width, height;
g_IEngine->GetScreenSize(width, height);
// Grab the cvar for fov_desired and attach to another var
static ConVar *realFov = g_ICvar->FindVar("fov_desired");
// Some math to find radius of the fov circle
float radius = tanf(DEG2RAD((float)fov) / 2) / tanf(DEG2RAD((int)realFov)/ 2) * width;
// float radius = tanf(DEG2RAD((float)fov) / 2) / tanf(DEG2RAD(draw::fov) / 2) * width;
float mon_fov = (float(width) / float(height) / (4.0f / 3.0f));
float fov_real = RAD2DEG(2 * atanf(mon_fov * tanf(DEG2RAD(draw::fov / 2))));
float radius = tan(DEG2RAD(float(fov)) / 2) / tan(DEG2RAD(fov_real) / 2) * (width);
// Draw a circle with our newfound circle
//draw::DrawCircle( width / 2 ,height / 2, radius, 35, GUIColor());
float px = 0;
float py = 0;
constexpr float steps = 120;
for (int i = 0; i < steps; i++) {
float ang = 2 * PI * (float(i) / steps);
float x = width / 2 + radius * cos(ang);
float y = height / 2 + radius * sin(ang);
if (!i) {
ang = 2 * PI * (float(steps - 1) / steps);
px = width / 2 + radius * cos(ang);
py = height / 2 + radius * sin(ang);
}
drawgl::Line(px, py, x - px, y - py, GUIColor());
px = x;
py = y;
}
}
}
}

View File

@ -302,6 +302,7 @@ void OverrideView_hook(void* _this, CViewSetup* setup) {
setup->fov = override_fov;
}
}
draw::fov = setup->fov;
SEGV_END;
}