Exception shit

This commit is contained in:
momo5502 2016-08-28 20:52:47 +02:00
parent d6c33f7df8
commit cf59101497
3 changed files with 17 additions and 2 deletions

2
deps/fmt vendored

@ -1 +1 @@
Subproject commit 2ae6bca488795929a0207d109e135751f10c53d9
Subproject commit 0d25f6fcbbf0a867b939a5501965ee4462b21ee6

View File

@ -9,6 +9,8 @@
namespace Components
{
Utils::Hook Exception::SetFilterHook;
bool Exception::UploadMinidump(std::string filename)
{
if (Utils::IO::FileExists(filename))
@ -86,7 +88,10 @@ namespace Components
LPTOP_LEVEL_EXCEPTION_FILTER WINAPI Exception::SetUnhandledExceptionFilterStub(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter)
{
Exception::SetFilterHook.Uninstall();
SetUnhandledExceptionFilter(&Exception::ExceptionFilter);
Exception::SetFilterHook.Install();
return lpTopLevelExceptionFilter;
}
@ -110,7 +115,9 @@ namespace Components
Game::R_AddCmdDrawText("DEBUG-BUILD", 0x7FFFFFFF, font, 15.0f, 10.0f + Game::R_TextHeight(font), 1.0f, 1.0f, 0.0f, color, Game::ITEM_TEXTSTYLE_SHADOWED);
});
#else
Utils::Hook::Set(0x6D70AC, Exception::SetUnhandledExceptionFilterStub);
Exception::SetFilterHook.Initialize(SetUnhandledExceptionFilter, Exception::SetUnhandledExceptionFilterStub, HOOK_JUMP);
Exception::SetFilterHook.Install();
SetUnhandledExceptionFilter(&Exception::ExceptionFilter);
#endif
@ -141,4 +148,9 @@ namespace Components
Command::Execute(command, false);
});
}
Exception::~Exception()
{
Exception::SetFilterHook.Uninstall();
}
}

View File

@ -4,6 +4,7 @@ namespace Components
{
public:
Exception();
~Exception();
#ifdef DEBUG
const char* GetName() { return "Exception"; };
@ -14,5 +15,7 @@ namespace Components
static LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilterStub(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter);
static bool UploadMinidump(std::string filename);
static Utils::Hook SetFilterHook;
};
}