From ec017ce4cfc9669badc5048f36bd0aec68c67815 Mon Sep 17 00:00:00 2001 From: Yauhen Pahrabniak Date: Thu, 10 Oct 2024 13:44:34 +0200 Subject: [PATCH] fix(fxserver): more fixes for linux compilation --- .../citizen-scripting-core/include/ScriptInvoker.h | 2 ++ code/components/citizen-scripting-core/src/ScriptInvoker.cpp | 4 ++-- code/components/citizen-scripting-v8/src/V8ScriptRuntime.cpp | 3 ++- code/components/gta-net-five/src/ClientRPC.cpp | 5 ++++- code/components/scripting-gta/src/ScriptEngine.cpp | 5 ++++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/code/components/citizen-scripting-core/include/ScriptInvoker.h b/code/components/citizen-scripting-core/include/ScriptInvoker.h index 6bc543b263..eb5504c325 100644 --- a/code/components/citizen-scripting-core/include/ScriptInvoker.h +++ b/code/components/citizen-scripting-core/include/ScriptInvoker.h @@ -11,6 +11,8 @@ #include "fxScripting.h" +#include + #ifndef IS_FXSERVER #include #endif diff --git a/code/components/citizen-scripting-core/src/ScriptInvoker.cpp b/code/components/citizen-scripting-core/src/ScriptInvoker.cpp index dfa0a1c56d..459c8a263d 100644 --- a/code/components/citizen-scripting-core/src/ScriptInvoker.cpp +++ b/code/components/citizen-scripting-core/src/ScriptInvoker.cpp @@ -250,7 +250,7 @@ void ScriptNativeContext::Invoke(IScriptHost& host) char* error = "Unknown"; host.GetLastErrorText(&error); - throw std::exception(va("Execution of native %016llx in script host failed: %s", nativeIdentifier, error)); + throw std::runtime_error(va("Execution of native %016llx in script host failed: %s", nativeIdentifier, error)); } PostInvoke(); @@ -299,7 +299,7 @@ static void InvokeNativeHandler(fxNativeContext& context, rage::scrEngine::Nativ exceptionAddress = GetExceptionInformation()->ExceptionRecord->ExceptionAddress, FilterFunc(GetExceptionInformation(), context.nativeIdentifier)) { - throw std::exception(va("Error executing native 0x%016llx at address %s.", context.nativeIdentifier, FormatModuleAddress(exceptionAddress))); + throw std::runtime_error(va("Error executing native 0x%016llx at address %s.", context.nativeIdentifier, FormatModuleAddress(exceptionAddress))); } } diff --git a/code/components/citizen-scripting-v8/src/V8ScriptRuntime.cpp b/code/components/citizen-scripting-v8/src/V8ScriptRuntime.cpp index 595a2d0f61..3722fd36f4 100644 --- a/code/components/citizen-scripting-v8/src/V8ScriptRuntime.cpp +++ b/code/components/citizen-scripting-v8/src/V8ScriptRuntime.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -1494,7 +1495,7 @@ static inline void CallHandler(void* handler, uint64_t nativeIdentifier, rage::s } __except (exceptionAddress = (GetExceptionInformation())->ExceptionRecord->ExceptionAddress, EXCEPTION_EXECUTE_HANDLER) { - throw std::exception(va("Error executing native 0x%016llx at address %p.", nativeIdentifier, exceptionAddress)); + throw std::runtime_error(va("Error executing native 0x%016llx at address %p.", nativeIdentifier, exceptionAddress)); } } diff --git a/code/components/gta-net-five/src/ClientRPC.cpp b/code/components/gta-net-five/src/ClientRPC.cpp index eba6bf776f..2ff2becdf1 100644 --- a/code/components/gta-net-five/src/ClientRPC.cpp +++ b/code/components/gta-net-five/src/ClientRPC.cpp @@ -1,4 +1,7 @@ #include + +#include + #include #include @@ -56,7 +59,7 @@ static inline void CallHandler(const THandler& handler, uint64_t nativeIdentifie } __except (exceptionAddress = (GetExceptionInformation())->ExceptionRecord->ExceptionAddress, ShouldHandleUnwind((GetExceptionInformation())->ExceptionRecord->ExceptionCode, nativeIdentifier)) { - throw std::exception(va("Error executing native 0x%016llx at address %s.", nativeIdentifier, FormatModuleAddress(exceptionAddress))); + throw std::runtime_error(va("Error executing native 0x%016llx at address %s.", nativeIdentifier, FormatModuleAddress(exceptionAddress))); } } diff --git a/code/components/scripting-gta/src/ScriptEngine.cpp b/code/components/scripting-gta/src/ScriptEngine.cpp index 52f1f34f8c..d48f1b299e 100644 --- a/code/components/scripting-gta/src/ScriptEngine.cpp +++ b/code/components/scripting-gta/src/ScriptEngine.cpp @@ -6,6 +6,9 @@ */ #include "StdInc.h" + +#include + #include #include @@ -64,7 +67,7 @@ static inline void CallHandler(const THandler& rageHandler, uint64_t nativeIdent } __except (exceptionAddress = (GetExceptionInformation())->ExceptionRecord->ExceptionAddress, ShouldHandleUnwind(GetExceptionInformation(), (GetExceptionInformation())->ExceptionRecord->ExceptionCode, nativeIdentifier)) { - throw std::exception(va("Error executing native 0x%016llx at address %s.", nativeIdentifier, FormatModuleAddress(exceptionAddress))); + throw std::runtime_error(va("Error executing native 0x%016llx at address %s.", nativeIdentifier, FormatModuleAddress(exceptionAddress))); } //#endif }