From 92faa929b03eba2338ec74d573baec816d8d9e73 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 9 May 2023 17:23:27 -0400 Subject: [PATCH 1/4] correctly null terminate buffer, don't escape redscript_paths.txt, ensure wstring lasts long enough --- src/dll/Hooks/ExecuteProcess.cpp | 4 ++-- src/dll/Systems/ScriptCompilationSystem.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dll/Hooks/ExecuteProcess.cpp b/src/dll/Hooks/ExecuteProcess.cpp index 29f605b1..3cda7841 100644 --- a/src/dll/Hooks/ExecuteProcess.cpp +++ b/src/dll/Hooks/ExecuteProcess.cpp @@ -21,10 +21,10 @@ bool _Global_ExecuteProcess(void* a1, RED4ext::CString& aCommand, FixedWString& return Global_ExecuteProcess(a1, aCommand, aArgs, aCurrentDirectory, a5); } - auto scriptCompilationSystem = App::Get()->GetScriptCompilationSystem(); + auto str = App::Get()->GetScriptCompilationSystem()->GetCompilationArgs(aArgs); FixedWString newArgs; - newArgs.str = scriptCompilationSystem->GetCompilationArgs(aArgs).c_str(); + newArgs.str = str.c_str(); newArgs.length = newArgs.maxLength = wcslen(newArgs.str); return Global_ExecuteProcess(a1, aCommand, newArgs, aCurrentDirectory, a5); } diff --git a/src/dll/Systems/ScriptCompilationSystem.cpp b/src/dll/Systems/ScriptCompilationSystem.cpp index 202eeb1e..d489a265 100644 --- a/src/dll/Systems/ScriptCompilationSystem.cpp +++ b/src/dll/Systems/ScriptCompilationSystem.cpp @@ -90,10 +90,10 @@ std::wstring ScriptCompilationSystem::GetCompilationArgs(const FixedWString& aOr for (const auto& [plugin, path] : m_scriptPaths) { spdlog::info(L"{}: '{}'", plugin->GetName(), path); - pathsFile << path << std::endl; + pathsFile << path.wstring() << std::endl; } spdlog::info(L"Paths written to: '{}'", pathsFilePath); - format_to(std::back_inserter(buffer), LR"( -compilePathsFile "{}"\0)", pathsFilePath); + format_to(std::back_inserter(buffer), LR"( -compilePathsFile "{}"{})", pathsFilePath, '\0'); spdlog::info(L"Final redscript compilation arg string: '{}'", buffer.data()); return buffer.data(); } From 9e128c0fc1d74dee61224ce6091d87c0390580c9 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Wed, 10 May 2023 10:47:26 -0400 Subject: [PATCH 2/4] adds some error checking for redscript compilation, exits on error --- src/dll/Hooks/ExecuteProcess.cpp | 46 +++++++++++++++++---- src/dll/Systems/ScriptCompilationSystem.cpp | 1 - src/dll/Systems/ScriptCompilationSystem.hpp | 25 +++++++++++ 3 files changed, 64 insertions(+), 8 deletions(-) diff --git a/src/dll/Hooks/ExecuteProcess.cpp b/src/dll/Hooks/ExecuteProcess.cpp index 3cda7841..eecd23ed 100644 --- a/src/dll/Hooks/ExecuteProcess.cpp +++ b/src/dll/Hooks/ExecuteProcess.cpp @@ -3,30 +3,62 @@ #include "App.hpp" #include "Hook.hpp" #include "Systems/ScriptCompilationSystem.hpp" +#include namespace { bool isAttached = false; -bool _Global_ExecuteProcess(void* a1, RED4ext::CString& aCommand, FixedWString& aArgs, - RED4ext::CString& aCurrentDirectory, char a5); +bool _Global_ExecuteProcess(ScriptCompilation* a1, RED4ext::CString& aCommand, FixedWString& aArgs, + RED4ext::CString& aCurrentDirectory, ExecuteProcess_Flags aFlags); Hook Global_ExecuteProcess(Addresses::Global_ExecuteProcess, &_Global_ExecuteProcess); -bool _Global_ExecuteProcess(void* a1, RED4ext::CString& aCommand, FixedWString& aArgs, - RED4ext::CString& aCurrentDirectory, char a5) +bool _Global_ExecuteProcess(ScriptCompilation* a1, RED4ext::CString& aCommand, FixedWString& aArgs, + RED4ext::CString& aCurrentDirectory, ExecuteProcess_Flags aFlags) { if (strstr(aCommand.c_str(), "scc.exe") == nullptr) { - return Global_ExecuteProcess(a1, aCommand, aArgs, aCurrentDirectory, a5); + return Global_ExecuteProcess(a1, aCommand, aArgs, aCurrentDirectory, aFlags); } auto str = App::Get()->GetScriptCompilationSystem()->GetCompilationArgs(aArgs); - + FixedWString newArgs; newArgs.str = str.c_str(); newArgs.length = newArgs.maxLength = wcslen(newArgs.str); - return Global_ExecuteProcess(a1, aCommand, newArgs, aCurrentDirectory, a5); + + spdlog::info(L"Final redscript compilation arg string: '{}'", newArgs.str); + auto result = Global_ExecuteProcess(a1, aCommand, newArgs, aCurrentDirectory, aFlags); + + // 60000 is used in the game + auto waitResult = WaitForSingleObject(a1->handle, 60000); + switch (waitResult) { + case WAIT_TIMEOUT: + spdlog::error("Redscript compilation timed-out - exiting"); + SHOW_LAST_ERROR_MESSAGE_AND_EXIT_FILE_LINE("Redscript compilation timed-out"); + break; + case WAIT_ABANDONED: + spdlog::error("Redscript compilation was abandoned - exiting"); + SHOW_LAST_ERROR_MESSAGE_AND_EXIT_FILE_LINE("Redscript compilation was abandoned"); + break; + case WAIT_FAILED: + spdlog::error("Redscript compilation failed - exiting"); + SHOW_LAST_ERROR_MESSAGE_AND_EXIT_FILE_LINE("Redscript compilation failed"); + break; + } + + GetExitCodeProcess(a1->handle, &a1->errorCode); + + if (a1->errorCode) { + spdlog::error(L"Redscript compilation was unsuccessful with error code: {} - exiting", a1->errorCode); + // redscript already showed the error, so we can just exit + TerminateProcess(GetCurrentProcess(), 1); + } else { + spdlog::info(L"Redscript compilation executed successfully"); + } + + return result; } } // namespace diff --git a/src/dll/Systems/ScriptCompilationSystem.cpp b/src/dll/Systems/ScriptCompilationSystem.cpp index d489a265..6d840fa3 100644 --- a/src/dll/Systems/ScriptCompilationSystem.cpp +++ b/src/dll/Systems/ScriptCompilationSystem.cpp @@ -94,6 +94,5 @@ std::wstring ScriptCompilationSystem::GetCompilationArgs(const FixedWString& aOr } spdlog::info(L"Paths written to: '{}'", pathsFilePath); format_to(std::back_inserter(buffer), LR"( -compilePathsFile "{}"{})", pathsFilePath, '\0'); - spdlog::info(L"Final redscript compilation arg string: '{}'", buffer.data()); return buffer.data(); } diff --git a/src/dll/Systems/ScriptCompilationSystem.hpp b/src/dll/Systems/ScriptCompilationSystem.hpp index 085610c5..1f5e4661 100644 --- a/src/dll/Systems/ScriptCompilationSystem.hpp +++ b/src/dll/Systems/ScriptCompilationSystem.hpp @@ -12,6 +12,31 @@ struct FixedWString const wchar_t* str; }; +// aFlags is initially 0 +enum class ExecuteProcess_Flags : unsigned char +{ + // unsets CREATE_NO_WINDOW + ShouldCreateWindow = 0x1, + // sets CREATE_BREAKAWAY_FROM_JOB | CREATE_SUSPENDED in Process Creation Flags + BreakawayAndSuspend = 0x2, + Unk3 = 0x3, + // unsets bInheritHandles + NoInheritHandles = 0x4, +}; + +DEFINE_ENUM_FLAG_OPERATORS(ExecuteProcess_Flags) + +struct ScriptCompilation +{ + wchar_t command[4096]; + PHANDLE readPipe; + PHANDLE writePipe; + HANDLE handle; + HANDLE hThread; + uint64_t unk2; + DWORD errorCode; +}; + class ScriptCompilationSystem : public ISystem { public: From 32f76f4705a85481d41004723ab926890f562150 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Wed, 10 May 2023 15:40:02 -0400 Subject: [PATCH 3/4] updates from review, move struct to sdk --- deps/red4ext.sdk | 2 +- scripts/patterns.py | 7 +- src/dll/Addresses.hpp | 5 +- src/dll/Hooks/ExecuteProcess.cpp | 88 ++++++++++++--------- src/dll/Systems/ScriptCompilationSystem.cpp | 6 +- src/dll/Systems/ScriptCompilationSystem.hpp | 37 +-------- 6 files changed, 71 insertions(+), 74 deletions(-) diff --git a/deps/red4ext.sdk b/deps/red4ext.sdk index 99ba88ab..b3b496a5 160000 --- a/deps/red4ext.sdk +++ b/deps/red4ext.sdk @@ -1 +1 @@ -Subproject commit 99ba88ab9749bffac5d0d27185390be016e0222d +Subproject commit b3b496a507ab076494850b4d6b7193e176a687ec diff --git a/scripts/patterns.py b/scripts/patterns.py index 8cebb7b6..3bee9c20 100644 --- a/scripts/patterns.py +++ b/scripts/patterns.py @@ -28,7 +28,6 @@ def get_groups() -> List[Group]: return [ Group(name='Global', functions=[ Item(name='Main', pattern='40 53 48 81 EC ? ? ? ? FF 15 ? ? ? ? E8 ? ? ? ? E8 ? ? ? ?', expected=1, index=0), - Item(name='ExecuteProcess', pattern='48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 40 48 8B FA 48 8B F1 48 8D 54 24 30 49 8B C9 49 8B D8', expected=1, index=0), ]), Group(name='CGameApplication', functions=[ @@ -46,7 +45,11 @@ def get_groups() -> List[Group]: Group(name='CShutdownState', functions=[ Item(name='Run', pattern='48 89 6C 24 18 56 48 83 EC 30 48 8B 0D ? ? ? ?', expected=1, index=0) ]), - + + Group(name='RedProcess', functions=[ + Item(name='Execute', pattern='48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 40 48 8B FA 48 8B F1 48 8D 54 24 30 49 8B C9 49 8B D8', expected=1, index=0), + ]), + Group(name='CBaseEngine', function=[ Item(name='InitScripts', pattern='48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 20 41 0F B7 D8 0F B6 FA 48 8B F1 E8', expected=1, index=0), Item(name='LoadScripts', pattern='48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 48 89 7C 24 20 41 56 48 83 EC 20 49 8B F9 41 C6 81', expected=1, index=0) diff --git a/src/dll/Addresses.hpp b/src/dll/Addresses.hpp index 25819e9a..8a714647 100644 --- a/src/dll/Addresses.hpp +++ b/src/dll/Addresses.hpp @@ -31,7 +31,10 @@ constexpr uintptr_t CShutdownState_Run = 0x140A82390 - ImageBase; // 48 89 6C 24 #pragma region Global constexpr uintptr_t Global_Main = 0x1401A0330 - ImageBase; // 40 53 48 81 EC ? ? ? ? FF 15 ? ? ? ? E8 ? ? ? ? E8 ? ? ? ?, expected: 1, index: 0 -constexpr uintptr_t Global_ExecuteProcess = 0x2C23D70; // 48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 40 48 8B FA 48 8B F1 48 8D 54 24 30 49 8B C9 49 8B D8, expected: 1, index: 0 +#pragma endregion + +#pragma region RedProcess +constexpr uintptr_t RedProcess_Execute = 0x2C23D70; // 48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 40 48 8B FA 48 8B F1 48 8D 54 24 30 49 8B C9 49 8B D8, expected: 1, index: 0 #pragma endregion #pragma region CBaseEngine diff --git a/src/dll/Hooks/ExecuteProcess.cpp b/src/dll/Hooks/ExecuteProcess.cpp index eecd23ed..d47dbc9d 100644 --- a/src/dll/Hooks/ExecuteProcess.cpp +++ b/src/dll/Hooks/ExecuteProcess.cpp @@ -3,61 +3,77 @@ #include "App.hpp" #include "Hook.hpp" #include "Systems/ScriptCompilationSystem.hpp" -#include namespace { bool isAttached = false; +uint32_t runCount = 0; -bool _Global_ExecuteProcess(ScriptCompilation* a1, RED4ext::CString& aCommand, FixedWString& aArgs, - RED4ext::CString& aCurrentDirectory, ExecuteProcess_Flags aFlags); -Hook Global_ExecuteProcess(Addresses::Global_ExecuteProcess, - &_Global_ExecuteProcess); +bool _RedProcess_Execute(RED4ext::red::Process* aThis, RED4ext::CString& aCommand, + RED4ext::red::Process::FixedWString& aArgs, RED4ext::CString& aCurrentDirectory, + RED4ext::red::Process::ExecutionFlags aFlags); +Hook RedProcess_Execute(Addresses::RedProcess_Execute, + &_RedProcess_Execute); -bool _Global_ExecuteProcess(ScriptCompilation* a1, RED4ext::CString& aCommand, FixedWString& aArgs, - RED4ext::CString& aCurrentDirectory, ExecuteProcess_Flags aFlags) +bool _RedProcess_Execute(RED4ext::red::Process* aThis, RED4ext::CString& aCommand, + RED4ext::red::Process::FixedWString& aArgs, RED4ext::CString& aCurrentDirectory, + RED4ext::red::Process::ExecutionFlags aFlags) { if (strstr(aCommand.c_str(), "scc.exe") == nullptr) { - return Global_ExecuteProcess(a1, aCommand, aArgs, aCurrentDirectory, aFlags); + return RedProcess_Execute(aThis, aCommand, aArgs, aCurrentDirectory, aFlags); } - auto str = App::Get()->GetScriptCompilationSystem()->GetCompilationArgs(aArgs); + auto scriptCompilationSystem = App::Get()->GetScriptCompilationSystem(); + auto str = scriptCompilationSystem->GetCompilationArgs(aArgs); - FixedWString newArgs; + RED4ext::red::Process::FixedWString newArgs; newArgs.str = str.c_str(); newArgs.length = newArgs.maxLength = wcslen(newArgs.str); spdlog::info(L"Final redscript compilation arg string: '{}'", newArgs.str); - auto result = Global_ExecuteProcess(a1, aCommand, newArgs, aCurrentDirectory, aFlags); - - // 60000 is used in the game - auto waitResult = WaitForSingleObject(a1->handle, 60000); - switch (waitResult) { - case WAIT_TIMEOUT: - spdlog::error("Redscript compilation timed-out - exiting"); - SHOW_LAST_ERROR_MESSAGE_AND_EXIT_FILE_LINE("Redscript compilation timed-out"); - break; - case WAIT_ABANDONED: - spdlog::error("Redscript compilation was abandoned - exiting"); - SHOW_LAST_ERROR_MESSAGE_AND_EXIT_FILE_LINE("Redscript compilation was abandoned"); - break; - case WAIT_FAILED: - spdlog::error("Redscript compilation failed - exiting"); - SHOW_LAST_ERROR_MESSAGE_AND_EXIT_FILE_LINE("Redscript compilation failed"); - break; + auto result = RedProcess_Execute(aThis, aCommand, newArgs, aCurrentDirectory, aFlags); + + auto waitResult = WaitForSingleObject(aThis->handle, RED4ext::red::Process::defaultTimeout); + switch (waitResult) + { + case WAIT_TIMEOUT: + { + spdlog::error("Redscript compilation timed-out - exiting"); + SHOW_LAST_ERROR_MESSAGE_AND_EXIT_FILE_LINE("Redscript compilation timed-out"); + break; + } + case WAIT_ABANDONED: + { + spdlog::error("Redscript compilation was abandoned - exiting"); + SHOW_LAST_ERROR_MESSAGE_AND_EXIT_FILE_LINE("Redscript compilation was abandoned"); + break; + } + case WAIT_FAILED: + { + spdlog::error("Redscript compilation failed - exiting"); + SHOW_LAST_ERROR_MESSAGE_AND_EXIT_FILE_LINE("Redscript compilation failed"); + break; + } } - GetExitCodeProcess(a1->handle, &a1->errorCode); + GetExitCodeProcess(aThis->handle, &aThis->errorCode); - if (a1->errorCode) { - spdlog::error(L"Redscript compilation was unsuccessful with error code: {} - exiting", a1->errorCode); + if (aThis->errorCode) + { + spdlog::error(L"Redscript compilation was unsuccessful with error code: {} - exiting", aThis->errorCode); // redscript already showed the error, so we can just exit - TerminateProcess(GetCurrentProcess(), 1); - } else { + if (scriptCompilationSystem->HasScripts() && runCount == 0) { + TerminateProcess(GetCurrentProcess(), 1); + } + } + else + { spdlog::info(L"Redscript compilation executed successfully"); } + runCount++; + return result; } } // namespace @@ -65,9 +81,9 @@ bool _Global_ExecuteProcess(ScriptCompilation* a1, RED4ext::CString& aCommand, F bool Hooks::ExecuteProcess::Attach() { spdlog::trace("Trying to attach the hook for execute process at {}...", - RED4EXT_OFFSET_TO_ADDR(Addresses::Global_ExecuteProcess)); + RED4EXT_OFFSET_TO_ADDR(Addresses::RedProcess_Execute)); - auto result = Global_ExecuteProcess.Attach(); + auto result = RedProcess_Execute.Attach(); if (result != NO_ERROR) { spdlog::error("Could not attach the hook for execute process. Detour error code: {}", result); @@ -89,9 +105,9 @@ bool Hooks::ExecuteProcess::Detach() } spdlog::trace("Trying to detach the hook for execute process at {}...", - RED4EXT_OFFSET_TO_ADDR(Addresses::Global_ExecuteProcess)); + RED4EXT_OFFSET_TO_ADDR(Addresses::RedProcess_Execute)); - auto result = Global_ExecuteProcess.Detach(); + auto result = RedProcess_Execute.Detach(); if (result != NO_ERROR) { spdlog::error("Could not detach the hook for execute process. Detour error code: {}", result); diff --git a/src/dll/Systems/ScriptCompilationSystem.cpp b/src/dll/Systems/ScriptCompilationSystem.cpp index 6d840fa3..93fef05a 100644 --- a/src/dll/Systems/ScriptCompilationSystem.cpp +++ b/src/dll/Systems/ScriptCompilationSystem.cpp @@ -72,7 +72,7 @@ bool ScriptCompilationSystem::Add(std::shared_ptr aPlugin, const wch } } -std::wstring ScriptCompilationSystem::GetCompilationArgs(const FixedWString& aOriginal) +std::wstring ScriptCompilationSystem::GetCompilationArgs(const RED4ext::red::Process::FixedWString& aOriginal) { fmt::wmemory_buffer buffer; if (m_hasScriptsBlob) @@ -96,3 +96,7 @@ std::wstring ScriptCompilationSystem::GetCompilationArgs(const FixedWString& aOr format_to(std::back_inserter(buffer), LR"( -compilePathsFile "{}"{})", pathsFilePath, '\0'); return buffer.data(); } + +bool ScriptCompilationSystem::HasScripts() const { + return !m_scriptPaths.empty(); +} diff --git a/src/dll/Systems/ScriptCompilationSystem.hpp b/src/dll/Systems/ScriptCompilationSystem.hpp index 1f5e4661..f0794dc0 100644 --- a/src/dll/Systems/ScriptCompilationSystem.hpp +++ b/src/dll/Systems/ScriptCompilationSystem.hpp @@ -4,38 +4,7 @@ #include "ISystem.hpp" #include "Paths.hpp" #include "PluginBase.hpp" - -struct FixedWString -{ - uint32_t length; - uint32_t maxLength; - const wchar_t* str; -}; - -// aFlags is initially 0 -enum class ExecuteProcess_Flags : unsigned char -{ - // unsets CREATE_NO_WINDOW - ShouldCreateWindow = 0x1, - // sets CREATE_BREAKAWAY_FROM_JOB | CREATE_SUSPENDED in Process Creation Flags - BreakawayAndSuspend = 0x2, - Unk3 = 0x3, - // unsets bInheritHandles - NoInheritHandles = 0x4, -}; - -DEFINE_ENUM_FLAG_OPERATORS(ExecuteProcess_Flags) - -struct ScriptCompilation -{ - wchar_t command[4096]; - PHANDLE readPipe; - PHANDLE writePipe; - HANDLE handle; - HANDLE hThread; - uint64_t unk2; - DWORD errorCode; -}; +#include class ScriptCompilationSystem : public ISystem { @@ -52,7 +21,9 @@ class ScriptCompilationSystem : public ISystem void SetScriptsBlob(const std::filesystem::path& aPath); const std::filesystem::path& GetScriptsBlob() const; - std::wstring GetCompilationArgs(const FixedWString& aOriginal); + std::wstring GetCompilationArgs(const RED4ext::red::Process::FixedWString& aOriginal); + + bool HasScripts() const; private: using Map_t = std::unordered_multimap, std::filesystem::path>; From faaa3611513e6969ca51e6ab85efda5fcd817cd1 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Wed, 10 May 2023 22:23:15 -0400 Subject: [PATCH 4/4] update sdk --- deps/red4ext.sdk | 2 +- src/dll/Hooks/ExecuteProcess.cpp | 16 ++++++++-------- src/dll/Systems/ScriptCompilationSystem.cpp | 2 +- src/dll/Systems/ScriptCompilationSystem.hpp | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/deps/red4ext.sdk b/deps/red4ext.sdk index b3b496a5..a4c529d3 160000 --- a/deps/red4ext.sdk +++ b/deps/red4ext.sdk @@ -1 +1 @@ -Subproject commit b3b496a507ab076494850b4d6b7193e176a687ec +Subproject commit a4c529d34ea63f32398db8903e0d3a5217a86a8c diff --git a/src/dll/Hooks/ExecuteProcess.cpp b/src/dll/Hooks/ExecuteProcess.cpp index d47dbc9d..f56c547d 100644 --- a/src/dll/Hooks/ExecuteProcess.cpp +++ b/src/dll/Hooks/ExecuteProcess.cpp @@ -9,15 +9,15 @@ namespace bool isAttached = false; uint32_t runCount = 0; -bool _RedProcess_Execute(RED4ext::red::Process* aThis, RED4ext::CString& aCommand, - RED4ext::red::Process::FixedWString& aArgs, RED4ext::CString& aCurrentDirectory, - RED4ext::red::Process::ExecutionFlags aFlags); +bool _RedProcess_Execute(RED4ext::Process* aThis, RED4ext::CString& aCommand, + RED4ext::Process::FixedWString& aArgs, RED4ext::CString& aCurrentDirectory, + RED4ext::Process::ExecutionFlags aFlags); Hook RedProcess_Execute(Addresses::RedProcess_Execute, &_RedProcess_Execute); -bool _RedProcess_Execute(RED4ext::red::Process* aThis, RED4ext::CString& aCommand, - RED4ext::red::Process::FixedWString& aArgs, RED4ext::CString& aCurrentDirectory, - RED4ext::red::Process::ExecutionFlags aFlags) +bool _RedProcess_Execute(RED4ext::Process* aThis, RED4ext::CString& aCommand, + RED4ext::Process::FixedWString& aArgs, RED4ext::CString& aCurrentDirectory, + RED4ext::Process::ExecutionFlags aFlags) { if (strstr(aCommand.c_str(), "scc.exe") == nullptr) { @@ -27,14 +27,14 @@ bool _RedProcess_Execute(RED4ext::red::Process* aThis, RED4ext::CString& aComman auto scriptCompilationSystem = App::Get()->GetScriptCompilationSystem(); auto str = scriptCompilationSystem->GetCompilationArgs(aArgs); - RED4ext::red::Process::FixedWString newArgs; + RED4ext::Process::FixedWString newArgs; newArgs.str = str.c_str(); newArgs.length = newArgs.maxLength = wcslen(newArgs.str); spdlog::info(L"Final redscript compilation arg string: '{}'", newArgs.str); auto result = RedProcess_Execute(aThis, aCommand, newArgs, aCurrentDirectory, aFlags); - auto waitResult = WaitForSingleObject(aThis->handle, RED4ext::red::Process::defaultTimeout); + auto waitResult = WaitForSingleObject(aThis->handle, RED4ext::Process::DefaultTimeout); switch (waitResult) { case WAIT_TIMEOUT: diff --git a/src/dll/Systems/ScriptCompilationSystem.cpp b/src/dll/Systems/ScriptCompilationSystem.cpp index 93fef05a..cadaaba6 100644 --- a/src/dll/Systems/ScriptCompilationSystem.cpp +++ b/src/dll/Systems/ScriptCompilationSystem.cpp @@ -72,7 +72,7 @@ bool ScriptCompilationSystem::Add(std::shared_ptr aPlugin, const wch } } -std::wstring ScriptCompilationSystem::GetCompilationArgs(const RED4ext::red::Process::FixedWString& aOriginal) +std::wstring ScriptCompilationSystem::GetCompilationArgs(const RED4ext::Process::FixedWString& aOriginal) { fmt::wmemory_buffer buffer; if (m_hasScriptsBlob) diff --git a/src/dll/Systems/ScriptCompilationSystem.hpp b/src/dll/Systems/ScriptCompilationSystem.hpp index f0794dc0..91f0d1c5 100644 --- a/src/dll/Systems/ScriptCompilationSystem.hpp +++ b/src/dll/Systems/ScriptCompilationSystem.hpp @@ -4,7 +4,7 @@ #include "ISystem.hpp" #include "Paths.hpp" #include "PluginBase.hpp" -#include +#include class ScriptCompilationSystem : public ISystem { @@ -21,7 +21,7 @@ class ScriptCompilationSystem : public ISystem void SetScriptsBlob(const std::filesystem::path& aPath); const std::filesystem::path& GetScriptsBlob() const; - std::wstring GetCompilationArgs(const RED4ext::red::Process::FixedWString& aOriginal); + std::wstring GetCompilationArgs(const RED4ext::Process::FixedWString& aOriginal); bool HasScripts() const;