From 91a249380bfa8ecacc1a70d95b3d25d5aa65fc75 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sat, 16 Jan 2016 15:03:09 +0100 Subject: [PATCH] Add debug branding. --- src/Components/Modules/Exception.cpp | 10 +++++++++- src/Game/Functions.cpp | 1 + src/Game/Functions.hpp | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Components/Modules/Exception.cpp b/src/Components/Modules/Exception.cpp index e60c5f31..08c2bf73 100644 --- a/src/Components/Modules/Exception.cpp +++ b/src/Components/Modules/Exception.cpp @@ -49,7 +49,15 @@ namespace Components Exception::Exception() { -#ifndef DEBUG +#ifdef DEBUG + // Display DEBUG branding, so we know we're on a debug build + Renderer::OnFrame([] () + { + Game::Font_s* font = Game::R_RegisterFont("fonts/normalFont"); + float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; + Game::R_AddCmdDrawText("DEBUG-BUILD", 0x7FFFFFFF, font, 15.0f, 10.0f + Game::R_TextHeight(font), 1.0f, 1.0f, 0.0f, color, 0); + }); +#else Utils::Hook::Set(0x6D70AC, Exception::SetUnhandledExceptionFilterStub); SetUnhandledExceptionFilter(&Exception::ExceptionFilter); #endif diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index b1fbc314..251f4660 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -111,6 +111,7 @@ namespace Game R_RegisterFont_t R_RegisterFont = (R_RegisterFont_t)0x505670; R_AddCmdDrawText_t R_AddCmdDrawText = (R_AddCmdDrawText_t)0x509D80; R_TextWidth_t R_TextWidth = (R_TextWidth_t)0x5056C0; + R_TextHeight_t R_TextHeight = (R_TextHeight_t)0x505770; Script_Alloc_t Script_Alloc = (Script_Alloc_t)0x422E70; Script_SetupTokens_t Script_SetupTokens = (Script_SetupTokens_t)0x4E6950; diff --git a/src/Game/Functions.hpp b/src/Game/Functions.hpp index 18c6bfd8..cfb23aa6 100644 --- a/src/Game/Functions.hpp +++ b/src/Game/Functions.hpp @@ -265,9 +265,12 @@ namespace Game typedef void(_cdecl * R_AddCmdDrawStretchPic_t)(float x, float y, float w, float h, float xScale, float yScale, float xay, float yay, const float *color, void* material); extern R_AddCmdDrawStretchPic_t R_AddCmdDrawStretchPic; - typedef int(__cdecl * R_TextWidth_t)(const char* text, int maxlength, void* font); + typedef int(__cdecl * R_TextWidth_t)(const char* text, int maxlength, Font_s* font); extern R_TextWidth_t R_TextWidth; + typedef int(__cdecl * R_TextHeight_t)(Font_s* font); + extern R_TextHeight_t R_TextHeight; + typedef script_t* (__cdecl * Script_Alloc_t)(int length); extern Script_Alloc_t Script_Alloc;