2021-12-25 22:36:38 +01:00
|
|
|
#include "core/stdafx.h"
|
2021-12-28 01:15:12 +01:00
|
|
|
#include "core/logdef.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
#include "vphysics/QHull.h"
|
2022-01-14 20:45:36 +01:00
|
|
|
#ifndef DEDICATED
|
|
|
|
#include "gameui/IConsole.h"
|
|
|
|
#endif // !DEDICATED
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: qhull error and debug prints
|
|
|
|
//-----------------------------------------------------------------------------
|
2021-12-28 01:15:12 +01:00
|
|
|
int HQHull_PrintFunc(const char* fmt, ...)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-01-14 20:45:36 +01:00
|
|
|
static char buf[1024] = {};
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2022-01-14 20:45:36 +01:00
|
|
|
static std::shared_ptr<spdlog::logger> iconsole = spdlog::get("game_console");
|
|
|
|
static std::shared_ptr<spdlog::logger> wconsole = spdlog::get("win_console");
|
2022-05-17 23:00:30 +02:00
|
|
|
static std::shared_ptr<spdlog::logger> qhlogger = spdlog::get("qhull_info");
|
2021-12-28 01:15:12 +01:00
|
|
|
|
2022-05-09 02:20:07 +02:00
|
|
|
s_LogMutex.lock();
|
2022-01-14 20:45:36 +01:00
|
|
|
{/////////////////////////////
|
|
|
|
va_list args{};
|
|
|
|
va_start(args, fmt);
|
2021-12-28 01:15:12 +01:00
|
|
|
|
2022-01-14 20:45:36 +01:00
|
|
|
vsnprintf(buf, sizeof(buf), fmt, args);
|
2021-12-28 01:15:12 +01:00
|
|
|
|
2022-01-14 20:45:36 +01:00
|
|
|
buf[sizeof(buf) - 1] = 0;
|
|
|
|
va_end(args);
|
|
|
|
}/////////////////////////////
|
2021-12-28 01:15:12 +01:00
|
|
|
|
2022-01-14 20:45:36 +01:00
|
|
|
qhlogger->debug(buf);
|
|
|
|
wconsole->debug(buf);
|
2021-12-28 01:15:12 +01:00
|
|
|
|
2022-01-14 20:45:36 +01:00
|
|
|
#ifndef DEDICATED
|
2021-12-28 01:15:12 +01:00
|
|
|
iconsole->debug(buf);
|
2022-05-09 02:20:07 +02:00
|
|
|
g_pIConsole->m_ivConLog.push_back(CConLog(g_spd_sys_w_oss.str(), ImVec4(0.81f, 0.81f, 0.81f, 1.00f)));
|
2022-01-14 20:45:36 +01:00
|
|
|
|
2022-05-09 02:20:07 +02:00
|
|
|
g_spd_sys_w_oss.str("");
|
|
|
|
g_spd_sys_w_oss.clear();
|
2022-01-14 20:45:36 +01:00
|
|
|
#endif // !DEDICATED
|
2021-12-28 01:15:12 +01:00
|
|
|
|
2022-05-09 02:20:07 +02:00
|
|
|
s_LogMutex.unlock();
|
2021-12-28 01:15:12 +01:00
|
|
|
return NULL;
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2021-12-28 01:15:12 +01:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2021-12-25 22:36:38 +01:00
|
|
|
void QHull_Attach()
|
|
|
|
{
|
2021-12-28 01:15:12 +01:00
|
|
|
DetourAttach((LPVOID*)&QHull_PrintFunc, &HQHull_PrintFunc);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void QHull_Detach()
|
|
|
|
{
|
2021-12-28 01:15:12 +01:00
|
|
|
DetourDetach((LPVOID*)&QHull_PrintFunc, &HQHull_PrintFunc);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|