diff --git a/premake5.lua b/premake5.lua index 03672f124d..bfa7cc9697 100644 --- a/premake5.lua +++ b/premake5.lua @@ -8,6 +8,10 @@ Options and Actions --]] +newoption { + trigger = "script-tracing", + description = "Enable script command trace logging (Slow!)" +} newoption { trigger = "outdir", value = "path", diff --git a/source/game_sa/Scripts/RunningScript.cpp b/source/game_sa/Scripts/RunningScript.cpp index a5af94f359..1e9dba2c79 100644 --- a/source/game_sa/Scripts/RunningScript.cpp +++ b/source/game_sa/Scripts/RunningScript.cpp @@ -933,7 +933,13 @@ OpcodeResult CRunningScript::ProcessOneCommand() { }; } op = { CTheScripts::Read2BytesFromScript(m_IP) }; - SPDLOG_LOGGER_TRACE(logger, "[{}][IP: {:#x} + {:#x}]: {} [{:#x}]", m_szName, LOG_PTR(m_pBaseIP), LOG_PTR(m_IP - m_pBaseIP), notsa::script::GetScriptCommandName((eScriptCommands)op.command), (size_t)op.command); +#ifdef NOTSA_SCRIPT_TRACING + // snprintf is faster (in debug at least) - Gotta stick to it for now + char msg[4096]; + sprintf_s(msg, "[%s][IP: 0x%X + 0x%X]: %s [0x%X]", m_szName, LOG_PTR(m_pBaseIP), LOG_PTR(m_IP - m_pBaseIP), notsa::script::GetScriptCommandName((eScriptCommands)op.command).data(), (size_t)op.command); + SPDLOG_LOGGER_TRACE(logger, msg); + //SPDLOG_LOGGER_TRACE(logger, "[{}][IP: {:#x} + {:#x}]: {} [{:#x}]", m_szName, LOG_PTR(m_pBaseIP), LOG_PTR(m_IP - m_pBaseIP), notsa::script::GetScriptCommandName((eScriptCommands)op.command), (size_t)op.command); +#endif m_bNotFlag = op.notFlag; diff --git a/source/premake5.lua b/source/premake5.lua index b2591e4d50..5586c233cb 100644 --- a/source/premake5.lua +++ b/source/premake5.lua @@ -41,6 +41,10 @@ project "gta_sa_modern" "../libs/tracy/public", "../libs/json/include" } + + filter "options:script-tracing" + defines { "NOTSA_SCRIPT_TRACING" } + filter {} defines { "NOMINMAX",