Fix External drawing

This commit is contained in:
BenCat07 2019-06-09 19:14:39 +02:00
parent edd7937460
commit e1b517935a
5 changed files with 30 additions and 11 deletions

View File

@ -52,6 +52,10 @@ if(NOT EnableVisuals)
endif()
if (EnableVisuals)
# Bruh moment
if (ExternalDrawing AND EnableEngineDrawing)
set(ExternalDrawing 0)
endif()
if (EnableImGuiDrawing)
set(EnableEngineDrawing 0)
find_package(Freetype REQUIRED)

2
external/libglez vendored

@ -1 +1 @@
Subproject commit d73465e8ac369db0cbbfcd0b9f7d4047cc66b3ed
Subproject commit c3000f17c40495ade208a04b6f151e553444d419

View File

@ -19,7 +19,9 @@
#include "MiscTemporary.hpp"
#include <hacks/hacklist.hpp>
#if EXTERNAL_DRAWING
#include "xoverlay.h"
#endif
#define STRINGIFY(x) #x
#define TO_STRING(x) STRINGIFY(x)
@ -424,6 +426,9 @@ void hack::Shutdown()
#if ENABLE_VISUALS
g_pScreenSpaceEffects->DisableScreenSpaceEffect("_cathook_glow");
g_pScreenSpaceEffects->DisableScreenSpaceEffect("_cathook_chams");
#if EXTERNAL_DRAWING
xoverlay_destroy();
#endif
#endif
}
logging::Info("Success..");

View File

@ -51,14 +51,14 @@ DEFINE_HOOKED_METHOD(SDL_GL_SwapWindow, void, SDL_Window *window)
if (!tf2_sdl)
tf2_sdl = SDL_GL_GetCurrentContext();
#if ENABLE_IMGUI_DRAWING
#if ENABLE_IMGUI_DRAWING && !EXTERNAL_DRAWING
if (!imgui_sdl)
imgui_sdl = SDL_GL_CreateContext(window);
#endif
if (isHackActive() && !disable_visuals)
{
#if ENABLE_IMGUI_DRAWING
#if ENABLE_IMGUI_DRAWING && !EXTERNAL_DRAWING
SDL_GL_MakeCurrent(window, imgui_sdl);
#endif
static int prev_width, prev_height;

View File

@ -139,8 +139,8 @@ static InitRoutine font_size([]() {
if (after > 0 && after < 100)
{
#if !ENABLE_ENGINE_DRAWING && !ENABLE_IMGUI_DRAWING
fonts::esp_font_size->unload();
fonts::esp_font_size.reset(new fonts::font(DATA_PATH "/fonts/verasans.ttf", after));
fonts::esp->unload();
fonts::esp.reset(new fonts::font(DATA_PATH "/fonts/verasans.ttf", after));
#else
fonts::esp->changeSize(after);
#endif
@ -491,16 +491,12 @@ unsigned int Texture::get()
return texture_id;
}
#endif
SDL_GLContext context = nullptr;
void InitGL()
{
logging::Info("InitGL: %d, %d", draw::width, draw::height);
#if EXTERNAL_DRAWING
int status = xoverlay_init();
xoverlay_draw_begin();
glez::init(xoverlay_library.width, xoverlay_library.height);
xoverlay_draw_end();
if (status < 0)
{
logging::Info("ERROR: could not initialize Xoverlay: %d", status);
@ -510,9 +506,16 @@ void InitGL()
logging::Info("Xoverlay initialized");
}
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
#if ENABLE_IMGUI_DRAWING
glewInit();
im_renderer::init();
#elif !ENABLE_ENGINE_DRAWING
glClearColor(1.0, 0.0, 0.0, 0.5);
@ -530,6 +533,9 @@ void InitGL()
void BeginGL()
{
#if ENABLE_IMGUI_DRAWING
#if EXTERNAL_DRAWING
xoverlay_draw_begin();
#endif
im_renderer::renderStart();
#elif !ENABLE_ENGINE_DRAWING
glColor3f(1, 1, 1);
@ -554,6 +560,10 @@ void EndGL()
{
#if ENABLE_IMGUI_DRAWING
im_renderer::renderEnd();
#if EXTERNAL_DRAWING
xoverlay_draw_end();
SDL_GL_MakeCurrent(sdl_hooks::window, nullptr);
#endif
#elif !ENABLE_ENGINE_DRAWING
PROF_SECTION(DRAWEX_draw_end);
{