diff options
Diffstat (limited to 'primedev')
-rw-r--r-- | primedev/squirrel/squirrel.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/primedev/squirrel/squirrel.cpp b/primedev/squirrel/squirrel.cpp index ac9a2ce9..43e43398 100644 --- a/primedev/squirrel/squirrel.cpp +++ b/primedev/squirrel/squirrel.cpp @@ -619,20 +619,12 @@ template <ScriptContext context> void ConCommand_script(const CCommand& args) g_pSquirrel<context>->ExecuteCode(args.ArgS()); } -// literal class type that wraps a constant expression string -template <size_t N> struct TemplateStringLiteral +template <ScriptContext context> SQRESULT SQ_StubbedFunc(HSquirrelVM* sqvm) { - constexpr TemplateStringLiteral(const char (&str)[N]) - { - std::copy_n(str, N, value); - } + SQStackInfos si; + g_pSquirrel<context>->sq_stackinfos(sqvm, 0, si); - char value[N]; -}; - -template <ScriptContext context, TemplateStringLiteral funcName> SQRESULT SQ_StubbedFunc(HSquirrelVM* sqvm) -{ - spdlog::info("Blocking call to stubbed function {} in {}", funcName.value, GetContextName(context)); + spdlog::warn("Blocking call to stubbed function {} in {}", si._name, GetContextName(context)); return SQRESULT_NULL; } @@ -640,12 +632,12 @@ template <ScriptContext context> void StubUnsafeSQFuncs() { if (!CommandLine()->CheckParm("-allowunsafesqfuncs")) { - g_pSquirrel<context>->AddFuncOverride("DevTextBufferWrite", SQ_StubbedFunc<context, "DevTextBufferWrite">); - g_pSquirrel<context>->AddFuncOverride("DevTextBufferClear", SQ_StubbedFunc<context, "DevTextBufferClear">); - g_pSquirrel<context>->AddFuncOverride("DevTextBufferDumpToFile", SQ_StubbedFunc<context, "DevTextBufferDumpToFile">); - g_pSquirrel<context>->AddFuncOverride("Dev_CommandLineAddParam", SQ_StubbedFunc<context, "Dev_CommandLineAddParam">); - g_pSquirrel<context>->AddFuncOverride("DevP4Checkout", SQ_StubbedFunc<context, "DevP4Checkout">); - g_pSquirrel<context>->AddFuncOverride("DevP4Add", SQ_StubbedFunc<context, "DevP4Add">); + g_pSquirrel<context>->AddFuncOverride("DevTextBufferWrite", SQ_StubbedFunc<context>); + g_pSquirrel<context>->AddFuncOverride("DevTextBufferClear", SQ_StubbedFunc<context>); + g_pSquirrel<context>->AddFuncOverride("DevTextBufferDumpToFile", SQ_StubbedFunc<context>); + g_pSquirrel<context>->AddFuncOverride("Dev_CommandLineAddParam", SQ_StubbedFunc<context>); + g_pSquirrel<context>->AddFuncOverride("DevP4Checkout", SQ_StubbedFunc<context>); + g_pSquirrel<context>->AddFuncOverride("DevP4Add", SQ_StubbedFunc<context>); } } |