Fix External drawing
This commit is contained in:
parent
edd7937460
commit
e1b517935a
@ -52,6 +52,10 @@ if(NOT EnableVisuals)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (EnableVisuals)
|
if (EnableVisuals)
|
||||||
|
# Bruh moment
|
||||||
|
if (ExternalDrawing AND EnableEngineDrawing)
|
||||||
|
set(ExternalDrawing 0)
|
||||||
|
endif()
|
||||||
if (EnableImGuiDrawing)
|
if (EnableImGuiDrawing)
|
||||||
set(EnableEngineDrawing 0)
|
set(EnableEngineDrawing 0)
|
||||||
find_package(Freetype REQUIRED)
|
find_package(Freetype REQUIRED)
|
||||||
|
2
external/libglez
vendored
2
external/libglez
vendored
@ -1 +1 @@
|
|||||||
Subproject commit d73465e8ac369db0cbbfcd0b9f7d4047cc66b3ed
|
Subproject commit c3000f17c40495ade208a04b6f151e553444d419
|
@ -19,7 +19,9 @@
|
|||||||
#include "MiscTemporary.hpp"
|
#include "MiscTemporary.hpp"
|
||||||
|
|
||||||
#include <hacks/hacklist.hpp>
|
#include <hacks/hacklist.hpp>
|
||||||
|
#if EXTERNAL_DRAWING
|
||||||
|
#include "xoverlay.h"
|
||||||
|
#endif
|
||||||
#define STRINGIFY(x) #x
|
#define STRINGIFY(x) #x
|
||||||
#define TO_STRING(x) STRINGIFY(x)
|
#define TO_STRING(x) STRINGIFY(x)
|
||||||
|
|
||||||
@ -424,6 +426,9 @@ void hack::Shutdown()
|
|||||||
#if ENABLE_VISUALS
|
#if ENABLE_VISUALS
|
||||||
g_pScreenSpaceEffects->DisableScreenSpaceEffect("_cathook_glow");
|
g_pScreenSpaceEffects->DisableScreenSpaceEffect("_cathook_glow");
|
||||||
g_pScreenSpaceEffects->DisableScreenSpaceEffect("_cathook_chams");
|
g_pScreenSpaceEffects->DisableScreenSpaceEffect("_cathook_chams");
|
||||||
|
#if EXTERNAL_DRAWING
|
||||||
|
xoverlay_destroy();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
logging::Info("Success..");
|
logging::Info("Success..");
|
||||||
|
@ -51,14 +51,14 @@ DEFINE_HOOKED_METHOD(SDL_GL_SwapWindow, void, SDL_Window *window)
|
|||||||
if (!tf2_sdl)
|
if (!tf2_sdl)
|
||||||
tf2_sdl = SDL_GL_GetCurrentContext();
|
tf2_sdl = SDL_GL_GetCurrentContext();
|
||||||
|
|
||||||
#if ENABLE_IMGUI_DRAWING
|
#if ENABLE_IMGUI_DRAWING && !EXTERNAL_DRAWING
|
||||||
if (!imgui_sdl)
|
if (!imgui_sdl)
|
||||||
imgui_sdl = SDL_GL_CreateContext(window);
|
imgui_sdl = SDL_GL_CreateContext(window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (isHackActive() && !disable_visuals)
|
if (isHackActive() && !disable_visuals)
|
||||||
{
|
{
|
||||||
#if ENABLE_IMGUI_DRAWING
|
#if ENABLE_IMGUI_DRAWING && !EXTERNAL_DRAWING
|
||||||
SDL_GL_MakeCurrent(window, imgui_sdl);
|
SDL_GL_MakeCurrent(window, imgui_sdl);
|
||||||
#endif
|
#endif
|
||||||
static int prev_width, prev_height;
|
static int prev_width, prev_height;
|
||||||
|
@ -139,8 +139,8 @@ static InitRoutine font_size([]() {
|
|||||||
if (after > 0 && after < 100)
|
if (after > 0 && after < 100)
|
||||||
{
|
{
|
||||||
#if !ENABLE_ENGINE_DRAWING && !ENABLE_IMGUI_DRAWING
|
#if !ENABLE_ENGINE_DRAWING && !ENABLE_IMGUI_DRAWING
|
||||||
fonts::esp_font_size->unload();
|
fonts::esp->unload();
|
||||||
fonts::esp_font_size.reset(new fonts::font(DATA_PATH "/fonts/verasans.ttf", after));
|
fonts::esp.reset(new fonts::font(DATA_PATH "/fonts/verasans.ttf", after));
|
||||||
#else
|
#else
|
||||||
fonts::esp->changeSize(after);
|
fonts::esp->changeSize(after);
|
||||||
#endif
|
#endif
|
||||||
@ -491,16 +491,12 @@ unsigned int Texture::get()
|
|||||||
return texture_id;
|
return texture_id;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
SDL_GLContext context = nullptr;
|
|
||||||
|
|
||||||
void InitGL()
|
void InitGL()
|
||||||
{
|
{
|
||||||
logging::Info("InitGL: %d, %d", draw::width, draw::height);
|
logging::Info("InitGL: %d, %d", draw::width, draw::height);
|
||||||
#if EXTERNAL_DRAWING
|
#if EXTERNAL_DRAWING
|
||||||
int status = xoverlay_init();
|
int status = xoverlay_init();
|
||||||
xoverlay_draw_begin();
|
|
||||||
glez::init(xoverlay_library.width, xoverlay_library.height);
|
|
||||||
xoverlay_draw_end();
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
{
|
{
|
||||||
logging::Info("ERROR: could not initialize Xoverlay: %d", status);
|
logging::Info("ERROR: could not initialize Xoverlay: %d", status);
|
||||||
@ -510,9 +506,16 @@ void InitGL()
|
|||||||
logging::Info("Xoverlay initialized");
|
logging::Info("Xoverlay initialized");
|
||||||
}
|
}
|
||||||
xoverlay_show();
|
xoverlay_show();
|
||||||
context = SDL_GL_CreateContext(sdl_hooks::window);
|
xoverlay_draw_begin();
|
||||||
|
#if !ENABLE_IMGUI_DRAWING && !ENABLE_ENGINE_DRAWING
|
||||||
|
glez::init(xoverlay_library.width, xoverlay_library.height);
|
||||||
|
#elif ENABLE_IMGUI_DRAWING
|
||||||
|
im_renderer::init();
|
||||||
|
#endif
|
||||||
|
xoverlay_draw_end();
|
||||||
#else
|
#else
|
||||||
#if ENABLE_IMGUI_DRAWING
|
#if ENABLE_IMGUI_DRAWING
|
||||||
|
glewInit();
|
||||||
im_renderer::init();
|
im_renderer::init();
|
||||||
#elif !ENABLE_ENGINE_DRAWING
|
#elif !ENABLE_ENGINE_DRAWING
|
||||||
glClearColor(1.0, 0.0, 0.0, 0.5);
|
glClearColor(1.0, 0.0, 0.0, 0.5);
|
||||||
@ -530,6 +533,9 @@ void InitGL()
|
|||||||
void BeginGL()
|
void BeginGL()
|
||||||
{
|
{
|
||||||
#if ENABLE_IMGUI_DRAWING
|
#if ENABLE_IMGUI_DRAWING
|
||||||
|
#if EXTERNAL_DRAWING
|
||||||
|
xoverlay_draw_begin();
|
||||||
|
#endif
|
||||||
im_renderer::renderStart();
|
im_renderer::renderStart();
|
||||||
#elif !ENABLE_ENGINE_DRAWING
|
#elif !ENABLE_ENGINE_DRAWING
|
||||||
glColor3f(1, 1, 1);
|
glColor3f(1, 1, 1);
|
||||||
@ -554,6 +560,10 @@ void EndGL()
|
|||||||
{
|
{
|
||||||
#if ENABLE_IMGUI_DRAWING
|
#if ENABLE_IMGUI_DRAWING
|
||||||
im_renderer::renderEnd();
|
im_renderer::renderEnd();
|
||||||
|
#if EXTERNAL_DRAWING
|
||||||
|
xoverlay_draw_end();
|
||||||
|
SDL_GL_MakeCurrent(sdl_hooks::window, nullptr);
|
||||||
|
#endif
|
||||||
#elif !ENABLE_ENGINE_DRAWING
|
#elif !ENABLE_ENGINE_DRAWING
|
||||||
PROF_SECTION(DRAWEX_draw_end);
|
PROF_SECTION(DRAWEX_draw_end);
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user