mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Extra logger optimizations
This commit is contained in:
parent
ab7fb8f9b7
commit
c329405ae8
@ -16,6 +16,7 @@ static auto ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(oss)
|
||||
//-----------------------------------------------------------------------------
|
||||
void Hooks::NET_PrintFunc(const char* fmt, ...)
|
||||
{
|
||||
static bool initialized = false;
|
||||
static char buf[1024];
|
||||
|
||||
static auto iconsole = spdlog::stdout_logger_mt("net_iconsole"); // in-game console
|
||||
@ -24,11 +25,15 @@ void Hooks::NET_PrintFunc(const char* fmt, ...)
|
||||
oss.str("");
|
||||
oss.clear();
|
||||
|
||||
iconsole = std::make_shared<spdlog::logger>("ostream", ostream_sink);
|
||||
iconsole->set_pattern("[%S.%e] %v");
|
||||
iconsole->set_level(spdlog::level::debug);
|
||||
wconsole->set_pattern("[%S.%e] %v");
|
||||
wconsole->set_level(spdlog::level::debug);
|
||||
if (!initialized)
|
||||
{
|
||||
iconsole = std::make_shared<spdlog::logger>("ostream", ostream_sink);
|
||||
iconsole->set_pattern("[%S.%e] %v");
|
||||
iconsole->set_level(spdlog::level::debug);
|
||||
wconsole->set_pattern("[%S.%e] %v");
|
||||
wconsole->set_level(spdlog::level::debug);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
@ -16,6 +16,7 @@ static auto ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(oss)
|
||||
void* Hooks::SQVM_Print(void* sqvm, char* fmt, ...)
|
||||
{
|
||||
int vmIdx = *(int*)((std::uintptr_t)sqvm + 0x18);
|
||||
static bool initialized = false;
|
||||
|
||||
static char buf[1024];
|
||||
static std::string vmType[3] = { "Script(S):", "Script(C):", "Script(U):" };
|
||||
@ -28,11 +29,15 @@ void* Hooks::SQVM_Print(void* sqvm, char* fmt, ...)
|
||||
oss.str("");
|
||||
oss.clear();
|
||||
|
||||
iconsole = std::make_shared<spdlog::logger>("ostream", ostream_sink);
|
||||
iconsole->set_pattern("[%S.%e] %v");
|
||||
iconsole->set_level(spdlog::level::debug);
|
||||
wconsole->set_pattern("[%S.%e] %v");
|
||||
wconsole->set_level(spdlog::level::debug);
|
||||
if (!initialized)
|
||||
{
|
||||
iconsole = std::make_shared<spdlog::logger>("ostream", ostream_sink);
|
||||
iconsole->set_pattern("[%S.%e] %v");
|
||||
iconsole->set_level(spdlog::level::debug);
|
||||
wconsole->set_pattern("[%S.%e] %v");
|
||||
wconsole->set_level(spdlog::level::debug);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
@ -214,16 +214,16 @@ void GetPresent()
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
DWORD_PTR* pSwapChainVtable = nullptr;
|
||||
DWORD_PTR* pContextVTable = nullptr;
|
||||
DWORD_PTR* pDeviceVTable = nullptr;
|
||||
DWORD_PTR* pSwapChainVtable = nullptr;
|
||||
DWORD_PTR* pContextVTable = nullptr;
|
||||
DWORD_PTR* pDeviceVTable = nullptr;
|
||||
|
||||
pSwapChainVtable = (DWORD_PTR*)pSwapChain;
|
||||
pSwapChainVtable = (DWORD_PTR*)pSwapChainVtable[0];
|
||||
pContextVTable = (DWORD_PTR*)pContext;
|
||||
pContextVTable = (DWORD_PTR*)pContextVTable[0];
|
||||
pDeviceVTable = (DWORD_PTR*)pDevice;
|
||||
pDeviceVTable = (DWORD_PTR*)pDeviceVTable[0];
|
||||
pSwapChainVtable = (DWORD_PTR*)pSwapChain;
|
||||
pSwapChainVtable = (DWORD_PTR*)pSwapChainVtable[0];
|
||||
pContextVTable = (DWORD_PTR*)pContext;
|
||||
pContextVTable = (DWORD_PTR*)pContextVTable[0];
|
||||
pDeviceVTable = (DWORD_PTR*)pDevice;
|
||||
pDeviceVTable = (DWORD_PTR*)pDeviceVTable[0];
|
||||
|
||||
int pIDX = (int)DXGISwapChainVTbl::Present;
|
||||
int rIDX = (int)DXGISwapChainVTbl::ResizeBuffers;
|
||||
@ -521,11 +521,11 @@ void RemoveDXHooks()
|
||||
void PrintDXAddress()
|
||||
{
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
std::cout << "| ID3D11DeviceContext : " << std::hex << g_pDeviceContext << std::setw(13) << " |" << std::endl;
|
||||
std::cout << "| ID3D11Device : " << std::hex << g_pDevice << std::setw(13) << " |" << std::endl;
|
||||
std::cout << "| ID3D11RenderTargetView : " << std::hex << g_pRenderTargetView << std::setw(13) << " |" << std::endl;
|
||||
std::cout << "| IDXGISwapChain : " << std::hex << g_pSwapChain << std::setw(13) << " |" << std::endl;
|
||||
std::cout << "| IDXGISwapChainPresent : " << std::hex << g_fnIDXGISwapChainPresent << std::setw(13) << " |" << std::endl;
|
||||
std::cout << "| ID3D11DeviceContext : " << std::hex << std::uppercase << g_pDeviceContext << std::setw(13) << " |" << std::endl;
|
||||
std::cout << "| ID3D11Device : " << std::hex << std::uppercase << g_pDevice << std::setw(13) << " |" << std::endl;
|
||||
std::cout << "| ID3D11RenderTargetView : " << std::hex << std::uppercase << g_pRenderTargetView << std::setw(13) << " |" << std::endl;
|
||||
std::cout << "| IDXGISwapChain : " << std::hex << std::uppercase << g_pSwapChain << std::setw(13) << " |" << std::endl;
|
||||
std::cout << "| IDXGISwapChainPresent : " << std::hex << std::uppercase << g_fnIDXGISwapChainPresent << std::setw(13) << " |" << std::endl;
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user