Skip to content

Commit

Permalink
Merge branch 'dev' into rc
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Jan 2, 2024
2 parents d8a3a7e + b337918 commit b6fda80
Show file tree
Hide file tree
Showing 15 changed files with 167 additions and 55 deletions.
2 changes: 2 additions & 0 deletions c-api/cache/CachedVehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,8 @@ namespace cache
{
return _brakeLevel;
}

void SetBadge(uint32_t textureDictionary, uint32_t texture, alt::VehicleBadgePosition positions[4]) override {}
#endif
#ifdef ALT_CLIENT_API
float _wheelSpeed;
Expand Down
56 changes: 56 additions & 0 deletions c-api/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,62 @@ void Core_GetPoolEntities(alt::ICore* core, const char* pool, const uint32_t*& p
{
poolEntities = AllocateUInt32Array(core->GetPoolEntities(pool), size);
}

void Core_GetVoicePlayers(alt::ICore* core, const uint32_t*& voicePlayers, uint32_t& size)
{
voicePlayers = AllocateUInt32Array(core->GetVoicePlayers(), size);
}

void Core_RemoveVoicePlayer(alt::ICore* core, uint32_t playerRemodeId)
{
core->RemoveVoicePlayer(playerRemodeId);
}

float Core_GetVoiceSpatialVolume(alt::ICore* core, uint32_t playerRemodeId)
{
return core->GetVoiceSpatialVolume(playerRemodeId);
}

void Core_SetVoiceSpatialVolume(alt::ICore* core, uint32_t playerRemodeId, float volume)
{
core->SetVoiceSpatialVolume(playerRemodeId, volume);
}

float Core_GetVoiceNonSpatialVolume(alt::ICore* core, uint32_t playerRemodeId)
{
return core->GetVoiceNonSpatialVolume(playerRemodeId);
}

void Core_SetVoiceNonSpatialVolume(alt::ICore* core, uint32_t playerRemodeId, float volume)
{
core->SetVoiceNonSpatialVolume(playerRemodeId, volume);
}

void Core_AddVoiceFilter(alt::ICore* core, uint32_t playerRemodeId, alt::IAudioFilter* filter)
{
core->AddVoiceFilter(playerRemodeId, filter);
}

void Core_RemoveVoiceFilter(alt::ICore* core, uint32_t playerRemodeId)
{
core->RemoveVoiceFilter(playerRemodeId);
}

alt::IAudioFilter* Core_GetVoiceFilter(alt::ICore* core, uint32_t playerRemodeId)
{
return core->GetVoiceFilter(playerRemodeId);
}

void Core_UpdateClipContext(alt::ICore* core, const char* keys[], const char* values[], uint64_t size)
{
std::unordered_map<std::string, std::string> context = {};

for (uint64_t i = 0; i < size; i++) {
context[keys[i]] = values[i];
}

return core->UpdateClipContext(context);
}
#endif

CAPI_END()
14 changes: 14 additions & 0 deletions c-api/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,17 @@ EXPORT_SERVER uint8_t Core_HasBenefit(alt::ICore* core, uint8_t benefit);
EXPORT_CLIENT uint32_t Core_GetPoolSize(alt::ICore* core, const char* pool);
EXPORT_CLIENT uint32_t Core_GetPoolCount(alt::ICore* core, const char* pool);
EXPORT_CLIENT void Core_GetPoolEntities(alt::ICore* core, const char* pool, const uint32_t*& poolEntities, uint32_t& size);

EXPORT_CLIENT void Core_GetVoicePlayers(alt::ICore* core, const uint32_t*& voicePlayers, uint32_t& size);
EXPORT_CLIENT void Core_RemoveVoicePlayer(alt::ICore* core, uint32_t playerRemodeId);

EXPORT_CLIENT float Core_GetVoiceSpatialVolume(alt::ICore* core, uint32_t playerRemodeId);
EXPORT_CLIENT void Core_SetVoiceSpatialVolume(alt::ICore* core, uint32_t playerRemodeId, float volume);

EXPORT_CLIENT float Core_GetVoiceNonSpatialVolume(alt::ICore* core, uint32_t playerRemodeId);
EXPORT_CLIENT void Core_SetVoiceNonSpatialVolume(alt::ICore* core, uint32_t playerRemodeId, float volume);

EXPORT_CLIENT void Core_AddVoiceFilter(alt::ICore* core, uint32_t playerRemodeId, alt::IAudioFilter* filter);
EXPORT_CLIENT void Core_RemoveVoiceFilter(alt::ICore* core, uint32_t playerRemodeId);
EXPORT_CLIENT alt::IAudioFilter* Core_GetVoiceFilter(alt::ICore* core, uint32_t playerRemodeId);
EXPORT_CLIENT void Core_UpdateClipContext(alt::ICore* core, const char* keys[], const char* values[], uint64_t size);
4 changes: 3 additions & 1 deletion c-api/data/decoration.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ struct ClrDecoration
{
uint32_t collection;
uint32_t overlay;
uint8_t count;

ClrDecoration() = default;

ClrDecoration(alt::CDecoration info) : collection(info.collection),
overlay(info.overlay)
overlay(info.overlay),
count(info.count)
{
}
};
13 changes: 12 additions & 1 deletion c-api/data/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,15 @@ typedef struct {
uint8_t g;
uint8_t b;
uint8_t a;
} rgba_t;
} rgba_t;

typedef struct
{
uint8_t active;
uint8_t alpha;
float size;
int16_t boneIndex;
vector3_t offset;
vector3_t direction;
vector3_t side;
} vehicleBadgePosition_t;
8 changes: 6 additions & 2 deletions c-api/entities/connection_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ const char* ConnectionInfo_GetBranch(alt::IConnectionInfo* connectionInfo, int32
return AllocateString(connectionInfo->GetBranch(), size);
}

uint32_t ConnectionInfo_GetBuild(alt::IConnectionInfo* connectionInfo) {
return connectionInfo->GetBuild();
uint16_t ConnectionInfo_GetVersionMajor(alt::IConnectionInfo* connectionInfo) {
return connectionInfo->GetVersionMajor();
}

uint16_t ConnectionInfo_GetVersionMinor(alt::IConnectionInfo* connectionInfo) {
return connectionInfo->GetVersionMinor();
}

const char* ConnectionInfo_GetCdnUrl(alt::IConnectionInfo* connectionInfo, int32_t& size) {
Expand Down
3 changes: 2 additions & 1 deletion c-api/entities/connection_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ EXPORT_SERVER uint64_t ConnectionInfo_GetHwIdExHash(alt::IConnectionInfo* connec
EXPORT_SERVER const char* ConnectionInfo_GetAuthToken(alt::IConnectionInfo* connectionInfo, int32_t& size);
EXPORT_SERVER uint8_t ConnectionInfo_GetIsDebug(alt::IConnectionInfo* connectionInfo);
EXPORT_SERVER const char* ConnectionInfo_GetBranch(alt::IConnectionInfo* connectionInfo, int32_t& size);
EXPORT_SERVER uint32_t ConnectionInfo_GetBuild(alt::IConnectionInfo* connectionInfo);
EXPORT_SERVER uint16_t ConnectionInfo_GetVersionMajor(alt::IConnectionInfo* connectionInfo);
EXPORT_SERVER uint16_t ConnectionInfo_GetVersionMinor(alt::IConnectionInfo* connectionInfo);
EXPORT_SERVER const char* ConnectionInfo_GetCdnUrl(alt::IConnectionInfo* connectionInfo, int32_t& size);
EXPORT_SERVER uint64_t ConnectionInfo_GetPasswordHash(alt::IConnectionInfo* connectionInfo);
EXPORT_SERVER const char* ConnectionInfo_GetIp(alt::IConnectionInfo* connectionInfo, int32_t& size);
Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ ClrDecoration** Player_GetDecorations(alt::IPlayer* player, uint64_t& size)
return out;
}

void Player_DeallocVehicleModelInfo(ClrDecoration** decoInfo) {
void Player_DeallocDecoration(ClrDecoration** decoInfo) {
delete[] decoInfo;
}

Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ EXPORT_SERVER void Player_RemoveDecoration(alt::IPlayer* player, uint32_t collec
EXPORT_SERVER void Player_ClearDecorations(alt::IPlayer* player);

EXPORT_SERVER ClrDecoration** Player_GetDecorations(alt::IPlayer* player, uint64_t& size);
EXPORT_SERVER void Player_DeallocVehicleModelInfo(ClrDecoration** decoInfo);
EXPORT_SERVER void Player_DeallocDecoration(ClrDecoration** decoInfo);

EXPORT_SERVER void Player_PlayScenario(alt::IPlayer* player, const char* name);

Expand Down
34 changes: 34 additions & 0 deletions c-api/entities/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,40 @@ float Vehicle_GetBrakeLevel(alt::IVehicle* vehicle)
return vehicle->GetBrakeLevel();
}

void Vehicle_SetBadge(alt::IVehicle* vehicle, uint32_t textureDictionary, uint32_t texture,
vehicleBadgePosition_t vehicleBadgePosition[], uint16_t size)
{
const auto altVehicleBadgePositions = new alt::VehicleBadgePosition[4];

for (int i = 0; i < size; ++i)
{
auto offset = vehicleBadgePosition[i].offset;
auto direction = vehicleBadgePosition[i].direction;
auto side = vehicleBadgePosition[i].side;

altVehicleBadgePositions[i] = alt::VehicleBadgePosition(
vehicleBadgePosition[i].alpha,
vehicleBadgePosition[i].size,
vehicleBadgePosition[i].boneIndex,
alt::Vector3f(offset.x, offset.y, offset.z),
alt::Vector3f(direction.x, direction.y, direction.z),
alt::Vector3f(side.x, side.y, side.z)
);

altVehicleBadgePositions[i].active = vehicleBadgePosition[i].active;
}

if (size < 4)
{
for (int i = size; i < 4; ++i)
{
altVehicleBadgePositions[i] = alt::VehicleBadgePosition();
}
}

vehicle->SetBadge(textureDictionary, texture, altVehicleBadgePositions);
}

#endif

#ifdef ALT_CLIENT_API
Expand Down
2 changes: 2 additions & 0 deletions c-api/entities/vehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,5 @@ EXPORT_SERVER float Vehicle_GetBrakeLevel(alt::IVehicle* vehicle);

EXPORT_CLIENT float Vehicle_GetSuspensionHeight(alt::IVehicle* vehicle);
EXPORT_CLIENT void Vehicle_SetSuspensionHeight(alt::IVehicle* vehicle, float value);

EXPORT_SERVER void Vehicle_SetBadge(alt::IVehicle* vehicle, uint32_t textureDictionary, uint32_t texture, vehicleBadgePosition_t vehicleBadgePosition[], uint16_t size);
34 changes: 29 additions & 5 deletions 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 = 554522947139118248UL;
inline uint64_t capiHash = 13630124142623987997UL;
inline uint64_t capiHashes[] = {
0,
#ifdef ALT_CLIENT_API
Expand Down Expand Up @@ -93,6 +93,7 @@ inline uint64_t capiHashes[] = {
10807368225937279665UL,
11169437175796680635UL,
15861482869617048160UL,
16092557757480797995UL,
332214446285856938UL,
6617672605820539119UL,
787373906810962396UL,
Expand Down Expand Up @@ -175,7 +176,11 @@ inline uint64_t capiHashes[] = {
16154816553672886942UL,
2249875648683273533UL,
14311678038566163090UL,
15381961310249968205UL,
14294729290243559040UL,
14180673522110201914UL,
759879643372796676UL,
10827389293122297015UL,
18342201422886872407UL,
5500487167100623739UL,
8710938014357466262UL,
Expand Down Expand Up @@ -207,6 +212,8 @@ inline uint64_t capiHashes[] = {
84574382701044016UL,
2950682702415179672UL,
3186817815537256556UL,
4203146524234440953UL,
15949102402945152498UL,
6993510006268976715UL,
664982279299386907UL,
12948735896839739671UL,
Expand All @@ -233,6 +240,8 @@ inline uint64_t capiHashes[] = {
15051718600062446893UL,
6366517826241888414UL,
7814638701493567231UL,
8870406345125653689UL,
8791822899861925122UL,
7934747004301392615UL,
16585286735482336540UL,
13045279996168078519UL,
Expand All @@ -252,6 +261,7 @@ inline uint64_t capiHashes[] = {
5920144219377072122UL,
3268039739443301173UL,
17753040748478874447UL,
17801058509158105354UL,
5389506501733691988UL,
4168880360490742954UL,
12755828446518747613UL,
Expand Down Expand Up @@ -1313,7 +1323,6 @@ inline uint64_t capiHashes[] = {
8194004283135524333UL,
12397496971801767822UL,
1577439110274874884UL,
14204191833155309704UL,
5988681596904693572UL,
7415605567391116903UL,
7998061229071288348UL,
Expand All @@ -1328,6 +1337,8 @@ inline uint64_t capiHashes[] = {
10464338232675126241UL,
12079559810042444284UL,
15232547943166326905UL,
17632900701407653009UL,
5117935778920368749UL,
8806505177995284480UL,
13680172646316204766UL,
17282535440709139868UL,
Expand Down Expand Up @@ -1446,7 +1457,7 @@ inline uint64_t capiHashes[] = {
14293729102633233291UL,
2394928316223850939UL,
17674808600712417948UL,
10260708090721922895UL,
11055092498025975234UL,
18350138927152444768UL,
10068978925729858744UL,
6890209545812653225UL,
Expand Down Expand Up @@ -1664,6 +1675,7 @@ inline uint64_t capiHashes[] = {
277481303661922113UL,
1070345202824576095UL,
4149223353503655708UL,
15010482901293452804UL,
16890059088943800731UL,
5545167983491514394UL,
13734895793996634557UL,
Expand Down Expand Up @@ -1856,6 +1868,7 @@ inline void* capiPointers[] = {
(void*) Checkpoint_GetGameID,
(void*) Checkpoint_IsStreamedIn,
(void*) Core_AddGXTText,
(void*) Core_AddVoiceFilter,
(void*) Core_AreGameControlsEnabled,
(void*) Core_AreRmlControlsEnabled,
(void*) Core_AreVoiceControlsEnabled,
Expand Down Expand Up @@ -1938,7 +1951,11 @@ inline void* capiPointers[] = {
(void*) Core_GetTotalPacketsSent,
(void*) Core_GetVoiceActivationKey,
(void*) Core_GetVoiceActivationLevel,
(void*) Core_GetVoiceFilter,
(void*) Core_GetVoiceInputMuted,
(void*) Core_GetVoiceNonSpatialVolume,
(void*) Core_GetVoicePlayers,
(void*) Core_GetVoiceSpatialVolume,
(void*) Core_GetWeaponObjects,
(void*) Core_GetWebViewCount,
(void*) Core_GetWebViews,
Expand Down Expand Up @@ -1970,6 +1987,8 @@ inline void* capiPointers[] = {
(void*) Core_RegisterFont,
(void*) Core_RemoveGXTText,
(void*) Core_RemoveIpl,
(void*) Core_RemoveVoiceFilter,
(void*) Core_RemoveVoicePlayer,
(void*) Core_RequestIpl,
(void*) Core_ResetAllMapZoomData,
(void*) Core_ResetMapZoomData,
Expand All @@ -1996,6 +2015,8 @@ inline void* capiPointers[] = {
(void*) Core_SetStatUInt8,
(void*) Core_SetVoiceActivationLevel,
(void*) Core_SetVoiceInputMuted,
(void*) Core_SetVoiceNonSpatialVolume,
(void*) Core_SetVoiceSpatialVolume,
(void*) Core_SetWatermarkPosition,
(void*) Core_SetWeatherCycle,
(void*) Core_SetWeatherSyncActive,
Expand All @@ -2015,6 +2036,7 @@ inline void* capiPointers[] = {
(void*) Core_TriggerServerRPCEvent,
(void*) Core_TriggerWebViewEvent,
(void*) Core_UnloadYtyp,
(void*) Core_UpdateClipContext,
(void*) Core_WorldToScreen,
(void*) CustomTexture_GetBaseObject,
(void*) CustomTexture_GetID,
Expand Down Expand Up @@ -3076,7 +3098,6 @@ inline void* capiPointers[] = {
(void*) ConnectionInfo_GetAuthToken,
(void*) ConnectionInfo_GetBaseObject,
(void*) ConnectionInfo_GetBranch,
(void*) ConnectionInfo_GetBuild,
(void*) ConnectionInfo_GetCdnUrl,
(void*) ConnectionInfo_GetCloudAuthResult,
(void*) ConnectionInfo_GetCloudID,
Expand All @@ -3091,6 +3112,8 @@ inline void* capiPointers[] = {
(void*) ConnectionInfo_GetSocialId,
(void*) ConnectionInfo_GetSocialName,
(void*) ConnectionInfo_GetText,
(void*) ConnectionInfo_GetVersionMajor,
(void*) ConnectionInfo_GetVersionMinor,
(void*) ConnectionInfo_IsAccepted,
(void*) ConnectionInfo_SetText,
(void*) Core_AddClientConfigKey,
Expand Down Expand Up @@ -3209,7 +3232,7 @@ inline void* capiPointers[] = {
(void*) Player_ClearProps,
(void*) Player_ClearTasks,
(void*) Player_DeallocAmmoFlags,
(void*) Player_DeallocVehicleModelInfo,
(void*) Player_DeallocDecoration,
(void*) Player_DeleteLocalMetaData,
(void*) Player_Despawn,
(void*) Player_GetAmmo,
Expand Down Expand Up @@ -3427,6 +3450,7 @@ inline void* capiPointers[] = {
(void*) Vehicle_Repair,
(void*) Vehicle_SetArmoredWindowHealth,
(void*) Vehicle_SetArmoredWindowShootCount,
(void*) Vehicle_SetBadge,
(void*) Vehicle_SetBoatAnchor,
(void*) Vehicle_SetBodyAdditionalHealth,
(void*) Vehicle_SetBodyHealth,
Expand Down
2 changes: 1 addition & 1 deletion cpp-sdk
Loading

0 comments on commit b6fda80

Please sign in to comment.