Add debug branding.

This commit is contained in:
momo5502 2016-01-16 15:03:09 +01:00
parent e884ae672a
commit 91a249380b
3 changed files with 14 additions and 2 deletions

View File

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

View File

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

View File

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