mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Tier0: emit text to debug console if debugger is attached
Small quality of life improvement while debugging the application.
This commit is contained in:
parent
802e1f42eb
commit
def6d4da68
@ -271,6 +271,10 @@ void EngineLoggerSink(LogType_t logType, LogLevel_t logLevel, eDLL_T context,
|
||||
}
|
||||
}
|
||||
|
||||
// If a debugger is attached, emit the text there too
|
||||
if (Plat_IsInDebugSession())
|
||||
Plat_DebugString(message.c_str());
|
||||
|
||||
#ifndef _TOOLS
|
||||
// Output is always logged to the file.
|
||||
std::shared_ptr<spdlog::logger> ntlogger = spdlog::get(pszLogger); // <-- Obtain by 'pszLogger'.
|
||||
|
@ -406,6 +406,32 @@ uint64_t Plat_MSTime();
|
||||
const char* Plat_GetProcessUpTime();
|
||||
void Plat_GetProcessUpTime(char* szBuf, size_t nSize);
|
||||
|
||||
inline bool Plat_IsInDebugSession()
|
||||
{
|
||||
#if defined( _X360 )
|
||||
return (XBX_IsDebuggerPresent() != 0);
|
||||
#elif defined( _WIN32 )
|
||||
return (IsDebuggerPresent() != 0);
|
||||
#elif defined( _PS3 ) && !defined(_CERT)
|
||||
return snIsDebuggerPresent();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void Plat_DebugString(const char* psz)
|
||||
{
|
||||
#if defined( _X360 )
|
||||
XBX_OutputDebugString(psz);
|
||||
#elif defined( _WIN32 )
|
||||
::OutputDebugStringA(psz);
|
||||
#elif defined(_PS3)
|
||||
printf("%s", psz);
|
||||
#else
|
||||
// do nothing?
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined( _X360 )
|
||||
#define Plat_FastMemset XMemSet
|
||||
#define Plat_FastMemcpy XMemCpy
|
||||
|
Loading…
x
Reference in New Issue
Block a user