Skip to content

Commit

Permalink
Add mvalue sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Oct 21, 2023
1 parent e69e4ca commit ce4d268
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
14 changes: 14 additions & 0 deletions c-api/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ alt::MValueConst* Core_CreateMValueFunction(alt::ICore* core, CustomInvoker* val
return AllocMValue(std::move(mValue));
}

uint64_t Core_GetMValueSize(alt::ICore* core, alt::MValueConst* args)
{
return core->GetMValueSize(args->get()->Clone());
}

uint64_t Core_GetMValueArgsSize(alt::ICore* core, alt::MValueConst* args[], int size)
{
alt::MValueArgs mValues = alt::MValueArgs(size);
for (int i = 0; i < size; i++) {
ToMValueArg(mValues, core, args[i], i);
}
return core->GetMValueArgsSize(mValues);
}

alt::IPlayer** Core_GetPlayers(alt::ICore* core, uint64_t& size) {
auto players = core->GetBaseObjects(alt::IBaseObject::Type::PLAYER);
size = players.size();
Expand Down
2 changes: 2 additions & 0 deletions c-api/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ EXPORT_SHARED alt::MValueConst* Core_CreateMValueVector2(alt::ICore* core, vecto
EXPORT_SHARED alt::MValueConst* Core_CreateMValueRgba(alt::ICore* core, rgba_t value);
EXPORT_SHARED alt::MValueConst* Core_CreateMValueByteArray(alt::ICore* core, uint64_t size, const void* data);
EXPORT_SHARED alt::MValueConst* Core_CreateMValueFunction(alt::ICore* core, CustomInvoker* value);
EXPORT_SHARED uint64_t Core_GetMValueSize(alt::ICore* core, alt::MValueConst* args);
EXPORT_SHARED uint64_t Core_GetMValueArgsSize(alt::ICore* core, alt::MValueConst* args[], int size);

EXPORT_SHARED alt::IPlayer** Core_GetPlayers(alt::ICore* core, uint64_t& size);
EXPORT_SHARED alt::IVehicle** Core_GetVehicles(alt::ICore* core, uint64_t& size);
Expand Down
6 changes: 5 additions & 1 deletion c-api/func_table.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "func_table.h"

inline uint64_t capiHash = 4677548953854785821UL;
inline uint64_t capiHash = 16677003916101455049UL;
inline uint64_t capiHashes[] = {
0,
#ifdef ALT_CLIENT_API
Expand Down Expand Up @@ -1058,6 +1058,8 @@ inline uint64_t capiHashes[] = {
13737530370025977174UL,
7482854450085275693UL,
2139798095052897524UL,
2001253713694863162UL,
3166577616070768315UL,
15652019729912249391UL,
8454955647873390265UL,
5411021830103603795UL,
Expand Down Expand Up @@ -2801,6 +2803,8 @@ inline void* capiPointers[] = {
(void*) Core_GetEventTypeSize,
(void*) Core_GetMarkers,
(void*) Core_GetMetaData,
(void*) Core_GetMValueArgsSize,
(void*) Core_GetMValueSize,
(void*) Core_GetNetTime,
(void*) Core_GetNetworkObjects,
(void*) Core_GetPeds,
Expand Down
2 changes: 1 addition & 1 deletion cpp-sdk
Submodule cpp-sdk updated 1 files
+2 −0 ICore.h

0 comments on commit ce4d268

Please sign in to comment.