From d7785c1fd069ac7b150dcfd9e06e271ca0e02784 Mon Sep 17 00:00:00 2001 From: Neloreck Date: Wed, 15 Jan 2025 03:29:29 +0200 Subject: [PATCH] Add placeholder profiler.script. --- res/gamedata/scripts/profiler.script | 11 +++++++++++ src/xrScriptEngine/script_profiler.cpp | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 res/gamedata/scripts/profiler.script diff --git a/res/gamedata/scripts/profiler.script b/res/gamedata/scripts/profiler.script new file mode 100644 index 00000000000..26eb4d733c1 --- /dev/null +++ b/res/gamedata/scripts/profiler.script @@ -0,0 +1,11 @@ +-- Original profiler was not working and caused game to crash when jit parameter is disabled. +-- For safety reasons there is mock setup function and empty module without original code. +-- +-- 1) LUA does not allow setting up multiple hooks, adding hooks here instead of C++ codebase is problematic +-- 2) Luabind/Luajit already injects complex logics, C++ codebase adds error callbacks and custom logics. +-- As result, stack and state may be corrupted and cause random logics/memory errors. +-- +-- See: https://github.com/OpenXRay/xray-16/issues/1436 + +-- Mock placeholder. +function setup_hook() end diff --git a/src/xrScriptEngine/script_profiler.cpp b/src/xrScriptEngine/script_profiler.cpp index bae820ff27f..e1974bf44d7 100644 --- a/src/xrScriptEngine/script_profiler.cpp +++ b/src/xrScriptEngine/script_profiler.cpp @@ -104,8 +104,8 @@ void CScriptProfiler::stop() m_active = false; } -void CScriptProfiler::reset() -{ +void CScriptProfiler::reset() +{ Msg("Reset profiler"); m_profiling_portions.clear();