Skip to content

Commit 0ce56f5

Browse files
committed
merge
2 parents 0f5795c + 34fabce commit 0ce56f5

File tree

9 files changed

+103
-32
lines changed

9 files changed

+103
-32
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ jobs:
1111
runs-on: ubuntu-22.04
1212
steps:
1313
- name: Check out repository code
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515
- name: Setup .NET Core
1616
shell: pwsh
1717
run: |
1818
.\download_dotnet.ps1 ${{ runner.temp }} linux
1919
- name: Upload artifacts
20-
uses: actions/upload-artifact@v3
20+
uses: actions/upload-artifact@v4
2121
with:
2222
name: nethost-linux
2323
path: ${{ runner.temp }}/libnethost.tar
2424
fetch-nethost-windows:
2525
runs-on: windows-2022
2626
steps:
2727
- name: Check out repository code
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2929
- name: Setup .NET Core
3030
shell: pwsh
3131
run: |
3232
.\download_dotnet.ps1 ${{ runner.temp }} win
3333
- name: Upload artifacts
34-
uses: actions/upload-artifact@v3
34+
uses: actions/upload-artifact@v4
3535
with:
3636
name: nethost-windows
3737
path: ${{ runner.temp }}\libnethost.tar
@@ -58,10 +58,10 @@ jobs:
5858
nethost: nethost-windows,
5959
}
6060
steps:
61-
- uses: actions/checkout@v3
61+
- uses: actions/checkout@v4
6262
with:
6363
submodules: recursive
64-
- uses: actions/download-artifact@v3
64+
- uses: actions/download-artifact@v4
6565
with:
6666
name: ${{ matrix.config.nethost }}
6767
path: ./nethost
@@ -105,18 +105,18 @@ jobs:
105105
filename=$(echo "${{ matrix.config.name }}")
106106
tar -cvf ./$filename.tar modules/$filename/modules
107107
echo "art_name=$filename" >> $GITHUB_OUTPUT
108-
- uses: actions/upload-artifact@v3
108+
- uses: actions/upload-artifact@v4
109109
with:
110110
name: csharp-module-${{ matrix.config.name }}
111111
path: ./${{ steps.create_archive.outputs.art_name }}.tar
112112
build-client:
113113
runs-on: windows-latest
114114
needs: [fetch-nethost-linux, fetch-nethost-windows]
115115
steps:
116-
- uses: actions/checkout@v3
116+
- uses: actions/checkout@v4
117117
with:
118118
submodules: recursive
119-
- uses: actions/download-artifact@v3
119+
- uses: actions/download-artifact@v4
120120
with:
121121
name: nethost-windows
122122
path: ./nethost
@@ -152,7 +152,7 @@ jobs:
152152
run: |
153153
tar -cvf ./$filename.tar client/windows/client
154154
echo "art_name=$filename" >> $GITHUB_OUTPUT
155-
- uses: actions/upload-artifact@v3
155+
- uses: actions/upload-artifact@v4
156156
with:
157157
name: client-windows
158158
path: ./${{ steps.create_archive.outputs.art_name }}.tar

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "cpp-sdk"]
22
path = cpp-sdk
3-
url = https://github.com/altmp/cpp-sdk.git
3+
url = git@github.com:altmp/cpp-sdk.git

c-api/cache/CachedEntity.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace cache
1818
_rotation(base->GetRotation()),
1919
_visible(base->GetVisible()),
2020
_frozen(base->IsFrozen()),
21+
_staticEntity(base->IsStaticEntity()),
2122
#ifdef ALT_SERVER_API
2223
_streamed(base->GetStreamed()),
2324
_collision(base->HasCollision()),
@@ -126,16 +127,22 @@ namespace cache
126127
{
127128
return _visible;
128129
}
129-
bool _frozen;
130+
bool _frozen;
130131

131-
bool IsFrozen() const override
132-
{
133-
return _frozen;
134-
}
132+
bool IsFrozen() const override
133+
{
134+
return _frozen;
135+
}
135136

136137
void SetFrozen(bool state) override
137138
{
138139
}
140+
bool _staticEntity;
141+
142+
bool IsStaticEntity() const override
143+
{
144+
return _staticEntity;
145+
}
139146

140147
#ifdef ALT_SERVER_API
141148
void SetNetworkOwner(alt::IPlayer* player, bool disableMigration) override
@@ -215,6 +222,8 @@ namespace cache
215222
void SetMultipleStreamSyncedMetaData(const std::unordered_map<std::string, alt::MValue>& values) override {}
216223

217224
void SetStreamingDistance(uint32_t streamingDistance) override {}
225+
226+
void SetStaticEntity(bool state) override {}
218227
#endif
219228

220229

c-api/core.cpp

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ void Core_TriggerClientEventUnreliableForAll(alt::ICore* core, const char* ev, a
568568
core->TriggerClientEventUnreliableForAll(ev, mValues);
569569
}
570570

571-
alt::IVehicle* Core_CreateVehicle(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint32_t &id) {
571+
alt::IVehicle* Core_CreateVehicle(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint8_t isStatic, uint32_t &id) {
572572
alt::Position position;
573573
position.x = pos.x;
574574
position.y = pos.y;
@@ -577,14 +577,14 @@ alt::IVehicle* Core_CreateVehicle(alt::ICore* core, uint32_t model, position_t p
577577
rotation.roll = rot.roll;
578578
rotation.pitch = rot.pitch;
579579
rotation.yaw = rot.yaw;
580-
auto vehicle = core->CreateVehicle(model, position, rotation, streamingDistance);
580+
auto vehicle = core->CreateVehicle(model, position, rotation, streamingDistance, isStatic);
581581
if (vehicle != nullptr) {
582582
id = vehicle->GetID();
583583
}
584584
return vehicle;
585585
}
586586

587-
alt::IPed* Core_CreatePed(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint32_t &id)
587+
alt::IPed* Core_CreatePed(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint8_t isStatic, uint32_t &id)
588588
{
589589
alt::Position position;
590590
position.x = pos.x;
@@ -596,7 +596,7 @@ alt::IPed* Core_CreatePed(alt::ICore* core, uint32_t model, position_t pos, rota
596596
rotation.pitch = rot.pitch;
597597
rotation.yaw = rot.yaw;
598598

599-
auto ped = core->CreatePed(model, position, rotation, streamingDistance);
599+
auto ped = core->CreatePed(model, position, rotation, streamingDistance, isStatic);
600600
if (ped != nullptr) {
601601
id = ped->GetID();
602602
}
@@ -859,7 +859,7 @@ alt::IMarker* Core_CreateMarker(alt::ICore* core, alt::IPlayer* target, uint8_t
859859
}
860860

861861
alt::IObject* Core_CreateObject(alt::ICore* core, uint32_t model, position_t position, rotation_t rotation,
862-
uint8_t alpha, uint8_t textureVariation, uint16_t lodDistance, uint32_t streamingDistance, uint32_t& id)
862+
uint8_t alpha, uint8_t textureVariation, uint16_t lodDistance, uint32_t streamingDistance, uint8_t isStatic, uint32_t& id)
863863
{
864864
alt::Position pos;
865865
pos.x = position.x;
@@ -871,7 +871,7 @@ alt::IObject* Core_CreateObject(alt::ICore* core, uint32_t model, position_t pos
871871
rot.pitch = rotation.pitch;
872872
rot.yaw = rotation.yaw;
873873

874-
auto networkObject = core->CreateObject(model, pos, rot, alpha, textureVariation, lodDistance, streamingDistance);
874+
auto networkObject = core->CreateObject(model, pos, rot, alpha, textureVariation, lodDistance, streamingDistance, isStatic);
875875
if (networkObject != nullptr) {
876876
id = networkObject->GetID();
877877
}
@@ -1154,7 +1154,11 @@ alt::IWebView* Core_CreateWebView3D(alt::ICore* core, alt::IResource* resource,
11541154
}
11551155

11561156
alt::IRmlDocument* Core_CreateRmlDocument(alt::ICore* core, alt::IResource* resource, const char* url, uint32_t &id) {
1157-
auto document = core->CreateDocument(url, resource->GetMain(), resource);
1157+
alt::IRmlDocument::CreateOptions options;
1158+
options.url = url;
1159+
options.currentPath = resource->GetMain();
1160+
1161+
auto document = core->CreateDocument(options, resource);
11581162
if (!document) return nullptr;
11591163

11601164
if (document != nullptr) {
@@ -2164,6 +2168,31 @@ uint8_t Core_ReloadVehiclePhysics(alt::ICore* core, uint32_t modelHash)
21642168
{
21652169
return core->ReloadVehiclePhysics(modelHash);
21662170
}
2171+
2172+
double Core_GetCPULoad(alt::ICore* core)
2173+
{
2174+
return core->GetCPULoad();
2175+
}
2176+
2177+
uint32_t Core_GetVideoMemoryUsage(alt::ICore* core)
2178+
{
2179+
return core->GetVideoMemoryUsage();
2180+
}
2181+
2182+
uint32_t Core_GetRAMUsage(alt::ICore* core)
2183+
{
2184+
return core->GetRAMUsage();
2185+
}
2186+
2187+
uint32_t Core_GetTotalRAM(alt::ICore* core)
2188+
{
2189+
return core->GetTotalRAM();
2190+
}
2191+
2192+
uint32_t Core_GetCurrentProcessRamUsage(alt::ICore* core)
2193+
{
2194+
return core->GetCurrentProcessRamUsage();
2195+
}
21672196
#endif
21682197

21692198
CAPI_END()

c-api/core.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ EXPORT_SERVER void Core_TriggerClientEventUnreliable(alt::ICore* core, alt::IPla
9292
EXPORT_SERVER void Core_TriggerClientEventUnreliableForSome(alt::ICore* core, alt::IPlayer* targets[], int targetsSize, const char* ev, alt::MValueConst* args[], int argsSize);
9393
EXPORT_SERVER void Core_TriggerClientEventUnreliableForAll(alt::ICore* core, const char* ev, alt::MValueConst* args[], int size);
9494

95-
EXPORT_SERVER alt::IVehicle* Core_CreateVehicle(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint32_t &id);
96-
EXPORT_SERVER alt::IPed* Core_CreatePed(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint32_t &id);
95+
EXPORT_SERVER alt::IVehicle* Core_CreateVehicle(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint8_t isStatic, uint32_t &id);
96+
EXPORT_SERVER alt::IPed* Core_CreatePed(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint8_t isStatic, uint32_t &id);
9797
#ifdef ALT_SERVER_API
9898
EXPORT_SERVER alt::ICheckpoint* Core_CreateCheckpoint(alt::ICore* core, uint8_t type, position_t pos, float radius, float height, rgba_t color, uint32_t streamingDistance, uint32_t &id);
9999
#endif
@@ -353,7 +353,7 @@ EXPORT_CLIENT alt::IFont* Core_RegisterFont(alt::ICore* core, alt::IResource* re
353353

354354
EXPORT_CLIENT uint8_t Core_IsFullScreen(alt::ICore* core);
355355

356-
EXPORT_SERVER alt::IObject* Core_CreateObject(alt::ICore* core, uint32_t model, position_t position, rotation_t rotation, uint8_t alpha, uint8_t textureVariation, uint16_t lodDistance, uint32_t streamingDistance, uint32_t& id);
356+
EXPORT_SERVER alt::IObject* Core_CreateObject(alt::ICore* core, uint32_t model, position_t position, rotation_t rotation, uint8_t alpha, uint8_t textureVariation, uint16_t lodDistance, uint32_t streamingDistance, uint8_t isStatic, uint32_t& id);
357357

358358
EXPORT_SERVER alt::Metric* Core_RegisterMetric(alt::ICore* core, const char* metricName, uint8_t type, const char* keys[], const char* values[], uint64_t size);
359359
EXPORT_SERVER void Core_UnregisterMetric(alt::ICore* core, alt::Metric* metric);
@@ -433,4 +433,10 @@ EXPORT_CLIENT void Core_UpdateClipContext(alt::ICore* core, const char* keys[],
433433

434434
EXPORT_CLIENT uint64_t Core_GetServerTime(alt::ICore* core);
435435

436-
EXPORT_CLIENT uint8_t Core_ReloadVehiclePhysics(alt::ICore* core, uint32_t modelHash);
436+
EXPORT_CLIENT uint8_t Core_ReloadVehiclePhysics(alt::ICore* core, uint32_t modelHash);
437+
438+
EXPORT_CLIENT double Core_GetCPULoad(alt::ICore* core);
439+
EXPORT_CLIENT uint32_t Core_GetVideoMemoryUsage(alt::ICore* core);
440+
EXPORT_CLIENT uint32_t Core_GetRAMUsage(alt::ICore* core);
441+
EXPORT_CLIENT uint32_t Core_GetTotalRAM(alt::ICore* core);
442+
EXPORT_CLIENT uint32_t Core_GetCurrentProcessRamUsage(alt::ICore* core);

c-api/entities/entity.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ void Entity_SetFrozen(alt::IEntity* entity, uint8_t state) {
6464
entity->SetFrozen(state);
6565
}
6666

67+
uint8_t Entity_IsStaticEntity(alt::IEntity* entity)
68+
{
69+
return entity->IsStaticEntity();
70+
}
71+
6772
#ifdef ALT_SERVER_API
6873
void Entity_SetNetOwner(alt::IEntity* entity, alt::IPlayer* networkOwnerPlayer, uint8_t disableMigration) {
6974
entity->SetNetworkOwner(networkOwnerPlayer, disableMigration);
@@ -150,6 +155,11 @@ void Entity_SetStreamingDistance(alt::IEntity* entity, uint32_t streamingDistanc
150155
{
151156
entity->SetStreamingDistance(streamingDistance);
152157
}
158+
159+
void Entity_SetStaticEntity(alt::IEntity* entity, uint8_t state)
160+
{
161+
entity->SetStaticEntity(state);
162+
}
153163
#endif
154164

155165
#ifdef ALT_CLIENT_API

c-api/entities/entity.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ EXPORT_SERVER uint32_t Entity_GetTimestamp(alt::IEntity* entity);
5757

5858
EXPORT_SERVER uint32_t Entity_GetStreamingDistance(alt::IEntity* entity);
5959
EXPORT_SERVER void Entity_SetStreamingDistance(alt::IEntity* entity, uint32_t streamingDistance);
60+
61+
EXPORT_SHARED uint8_t Entity_IsStaticEntity(alt::IEntity* entity);
62+
EXPORT_SERVER void Entity_SetStaticEntity(alt::IEntity* entity, uint8_t state);

c-api/func_table.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "func_table.h"
22

3-
inline uint64_t capiHash = 14533172368099836198UL;
3+
inline uint64_t capiHash = 13355773337791499424UL;
44
inline uint64_t capiHashes[] = {
55
0,
66
#ifdef ALT_CLIENT_API
@@ -136,6 +136,8 @@ inline uint64_t capiHashes[] = {
136136
17443733140958323295UL,
137137
10032718746164771334UL,
138138
9388016697579829930UL,
139+
17433238533551340777UL,
140+
11057751060762142005UL,
139141
15134150969197995835UL,
140142
18034315400823009421UL,
141143
16108636330639358203UL,
@@ -158,6 +160,7 @@ inline uint64_t capiHashes[] = {
158160
10058355141969516360UL,
159161
5989408698388544472UL,
160162
3048778071876483320UL,
163+
4140657370908896331UL,
161164
16078537130538515891UL,
162165
1389091625205062844UL,
163166
14148467334937601992UL,
@@ -175,6 +178,8 @@ inline uint64_t capiHashes[] = {
175178
14377981926026585630UL,
176179
6512224235646012609UL,
177180
16154816553672886942UL,
181+
12381751684834587200UL,
182+
3460591725549442471UL,
178183
2249875648683273533UL,
179184
14311678038566163090UL,
180185
15381961310249968205UL,
@@ -1132,6 +1137,7 @@ inline uint64_t capiHashes[] = {
11321137
15286200049861980882UL,
11331138
2664435930066837893UL,
11341139
7430146286071665147UL,
1140+
14301521857243827244UL,
11351141
2663061204279682928UL,
11361142
7991844148745066430UL,
11371143
11148172387419141388UL,
@@ -1388,9 +1394,9 @@ inline uint64_t capiHashes[] = {
13881394
6946126881626778655UL,
13891395
3410920088129362997UL,
13901396
9200413248217250533UL,
1391-
6778852446992337891UL,
1392-
16295351054968805916UL,
1393-
494948204560226296UL,
1397+
18049638355733736363UL,
1398+
5701654053984961760UL,
1399+
12711263914629824012UL,
13941400
16510685691058823138UL,
13951401
7933678493039322900UL,
13961402
11272860948152964480UL,
@@ -1472,6 +1478,7 @@ inline uint64_t capiHashes[] = {
14721478
10673322505892191972UL,
14731479
5985306302153035853UL,
14741480
6937824812303569788UL,
1481+
14961071524798922101UL,
14751482
6004628797499736605UL,
14761483
13173445283048314724UL,
14771484
12798418058428333585UL,
@@ -1958,6 +1965,8 @@ inline void* capiPointers[] = {
19581965
(void*) Core_GetCheckpointByGameID,
19591966
(void*) Core_GetClientPath,
19601967
(void*) Core_GetConfigFlag,
1968+
(void*) Core_GetCPULoad,
1969+
(void*) Core_GetCurrentProcessRamUsage,
19611970
(void*) Core_GetCursorPos,
19621971
(void*) Core_GetDiscordUser,
19631972
(void*) Core_GetFocusOverrideEntity,
@@ -1980,6 +1989,7 @@ inline void* capiPointers[] = {
19801989
(void*) Core_GetPoolCount,
19811990
(void*) Core_GetPoolEntities,
19821991
(void*) Core_GetPoolSize,
1992+
(void*) Core_GetRAMUsage,
19831993
(void*) Core_GetScreenResolution,
19841994
(void*) Core_GetServerIp,
19851995
(void*) Core_GetServerPort,
@@ -1997,6 +2007,8 @@ inline void* capiPointers[] = {
19972007
(void*) Core_GetStatUInt8,
19982008
(void*) Core_GetTotalPacketsLost,
19992009
(void*) Core_GetTotalPacketsSent,
2010+
(void*) Core_GetTotalRAM,
2011+
(void*) Core_GetVideoMemoryUsage,
20002012
(void*) Core_GetVoiceActivationKey,
20012013
(void*) Core_GetVoiceActivationLevel,
20022014
(void*) Core_GetVoiceFilter,
@@ -2954,6 +2966,7 @@ inline void* capiPointers[] = {
29542966
(void*) Entity_GetWorldObject,
29552967
(void*) Entity_HasStreamSyncedMetaData,
29562968
(void*) Entity_IsFrozen,
2969+
(void*) Entity_IsStaticEntity,
29572970
(void*) Entity_SetFrozen,
29582971
(void*) Entity_SetRotation,
29592972
(void*) Event_Cancel,
@@ -3294,6 +3307,7 @@ inline void* capiPointers[] = {
32943307
(void*) Entity_SetCollision,
32953308
(void*) Entity_SetMultipleStreamSyncedMetaData,
32963309
(void*) Entity_SetNetOwner,
3310+
(void*) Entity_SetStaticEntity,
32973311
(void*) Entity_SetStreamed,
32983312
(void*) Entity_SetStreamingDistance,
32993313
(void*) Entity_SetStreamSyncedMetaData,

0 commit comments

Comments
 (0)