From de6b9c84a0c42f62fa9fc5848c1e6daca7dcc9ce Mon Sep 17 00:00:00 2001 From: Vektor Date: Mon, 27 Nov 2023 00:02:54 +0100 Subject: [PATCH 1/3] feat: add pool functions --- client/src/bindings/ClientBindingsMain.cpp | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/client/src/bindings/ClientBindingsMain.cpp b/client/src/bindings/ClientBindingsMain.cpp index 0e4e5ec0..f3037b0e 100644 --- a/client/src/bindings/ClientBindingsMain.cpp +++ b/client/src/bindings/ClientBindingsMain.cpp @@ -1203,6 +1203,39 @@ static void IsFullScreen(const v8::FunctionCallbackInfo& info) V8_RETURN_BOOLEAN(alt::ICore::Instance().IsFullScreen()); } +static void GetPoolSize(const v8::FunctionCallbackInfo& info) +{ + V8_GET_ISOLATE_CONTEXT(); + V8_CHECK_ARGS_LEN(1); + V8_ARG_TO_STRING(1, pool); + + V8_RETURN_UINT(alt::ICore::Instance().GetPoolSize(pool)); +} + +static void GetPoolCount(const v8::FunctionCallbackInfo& info) +{ + V8_GET_ISOLATE_CONTEXT(); + V8_CHECK_ARGS_LEN(1); + V8_ARG_TO_STRING(1, pool); + + V8_RETURN_UINT(alt::ICore::Instance().GetPoolCount(pool)); +} + +static void GetPoolEntities(const v8::FunctionCallbackInfo& info) +{ + V8_GET_ISOLATE_CONTEXT(); + V8_CHECK_ARGS_LEN(1); + V8_ARG_TO_STRING(1, pool); + + auto entities = alt::ICore::Instance().GetPoolEntities(pool); + v8::Local arr = v8::Array::New(isolate, entities.size()); + + for (uint32_t i = 0; i < entities.size(); ++i) + arr->Set(ctx, i, v8::Integer::NewFromUnsigned(isolate, entities[i])); + + V8_RETURN(arr); +} + extern V8Module sharedModule; extern V8Class v8Player, v8Player, v8Vehicle, v8WebView, v8HandlingData, v8LocalStorage, v8MemoryBuffer, v8MapZoomData, v8Discord, v8Voice, v8WebSocketClient, v8Checkpoint, v8HttpClient, v8Audio, v8LocalPlayer, v8Profiler, v8Worker, v8RmlDocument, v8RmlElement, v8WeaponData, v8FocusData, v8LocalObject, v8TextEncoder, v8TextDecoder, v8Object, v8VirtualEntityGroup, @@ -1390,4 +1423,8 @@ extern V8Module altModule("alt", V8Helpers::RegisterFunc(exports, "evalModule", &EvalModule); V8Helpers::RegisterFunc(exports, "isFullScreen", &IsFullScreen); + + V8Helpers::RegisterFunc(exports, "getPoolSize", &GetPoolSize); + V8Helpers::RegisterFunc(exports, "getPoolCount", &GetPoolCount); + V8Helpers::RegisterFunc(exports, "getPoolEntities", &GetPoolEntities); }); From f70de4d9fe96b1f840dbb044896b26c7f1b2760e Mon Sep 17 00:00:00 2001 From: Vektor Date: Mon, 27 Nov 2023 00:03:40 +0100 Subject: [PATCH 2/3] update sdk --- shared/deps/cpp-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/deps/cpp-sdk b/shared/deps/cpp-sdk index 5d4afcc3..2247ca25 160000 --- a/shared/deps/cpp-sdk +++ b/shared/deps/cpp-sdk @@ -1 +1 @@ -Subproject commit 5d4afcc33122f38aab94b7e144959ff0b5229084 +Subproject commit 2247ca25b332d862b9271e85e3809493f4d55b2f From 8c056acbf0ea4c587394fc4e6ae12f143382c412 Mon Sep 17 00:00:00 2001 From: Blue Date: Mon, 27 Nov 2023 00:14:53 +0100 Subject: [PATCH 3/3] fix(client): remove debuglogs --- client/src/bindings/AudioFilter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/bindings/AudioFilter.cpp b/client/src/bindings/AudioFilter.cpp index af9ae234..66e7ca96 100644 --- a/client/src/bindings/AudioFilter.cpp +++ b/client/src/bindings/AudioFilter.cpp @@ -102,7 +102,6 @@ static void AddVolumeEffect(const v8::FunctionCallbackInfo& info) channel = channel2; } - Log::Info << "VolumeEffect2: " << fVolume << ", " << priority << ", " << channel << Log::Endl; V8_RETURN_UINT(filter->AddVolumeEffect(fVolume, priority, channel)); }