Skip to content

Commit 44d5764

Browse files
committed
Added inlining of Api utils functions and fixes
1 parent d9ff146 commit 44d5764

4 files changed

Lines changed: 35 additions & 35 deletions

File tree

lib/libMinHook.x64.lib

10.4 KB
Binary file not shown.

out_lib/ArkApi.lib

0 Bytes
Binary file not shown.

version/Core/Public/API/ARK/Actor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7995,7 +7995,7 @@ struct ADroppedItemEgg : ADroppedItem
79957995
void Stasis() { NativeCall<void>(this, "ADroppedItemEgg.Stasis"); }
79967996
void NetSpawnDinoEmitter() { NativeCall<void>(this, "ADroppedItemEgg.NetSpawnDinoEmitter"); }
79977997
void NetSpawnDinoEmitter_Implementation() { NativeCall<void>(this, "ADroppedItemEgg.NetSpawnDinoEmitter_Implementation"); }
7998-
static UClass* GetPrivateStaticClass(const wchar_t* Package) { return NativeCall<UClass*, const wchar_t*>(nullptr, "ADroppedItemEgg.GetPrivateStaticClass", Package); }
7998+
static UClass* GetPrivateStaticClass() { return NativeCall<UClass*>(nullptr, "ADroppedItemEgg.GetPrivateStaticClass"); }
79997999
void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>* OutLifetimeProps) { NativeCall<void, TArray<FLifetimeProperty>*>(this, "ADroppedItemEgg.GetLifetimeReplicatedProps", OutLifetimeProps); }
80008000
void CalcInsulation() { NativeCall<void>(this, "ADroppedItemEgg.CalcInsulation"); }
80018001
void BeginPlay() { NativeCall<void>(this, "ADroppedItemEgg.BeginPlay"); }

version/Core/Public/Ark/ArkApiUtils.h

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace ArkApi
4242
* \param args Optional arguments
4343
*/
4444
template <typename T, typename... Args>
45-
void SendServerMessage(AShooterPlayerController* player_controller, FLinearColor msg_color, const T* msg,
45+
FORCEINLINE void SendServerMessage(AShooterPlayerController* player_controller, FLinearColor msg_color, const T* msg,
4646
Args&&... args)
4747
{
4848
if (player_controller)
@@ -65,7 +65,7 @@ namespace ArkApi
6565
* \param args Optional arguments
6666
*/
6767
template <typename T, typename... Args>
68-
void SendNotification(AShooterPlayerController* player_controller, FLinearColor color, float display_scale,
68+
FORCEINLINE void SendNotification(AShooterPlayerController* player_controller, FLinearColor color, float display_scale,
6969
float display_time, UTexture2D* icon, const T* msg, Args&&... args)
7070
{
7171
if (player_controller)
@@ -87,7 +87,7 @@ namespace ArkApi
8787
* \param args Optional arguments
8888
*/
8989
template <typename T, typename... Args>
90-
void SendChatMessage(AShooterPlayerController* player_controller, const FString& sender_name, const T* msg,
90+
FORCEINLINE void SendChatMessage(AShooterPlayerController* player_controller, const FString& sender_name, const T* msg,
9191
Args&&... args)
9292
{
9393
if (player_controller)
@@ -111,7 +111,7 @@ namespace ArkApi
111111
* \param args Optional arguments
112112
*/
113113
template <typename T, typename... Args>
114-
void SendServerMessageToAll(FLinearColor msg_color, const T* msg,
114+
FORCEINLINE void SendServerMessageToAll(FLinearColor msg_color, const T* msg,
115115
Args&&... args)
116116
{
117117
FString text(FString::Format(msg, std::forward<Args>(args)...));
@@ -139,7 +139,7 @@ namespace ArkApi
139139
* \param args Optional arguments
140140
*/
141141
template <typename T, typename... Args>
142-
void SendNotificationToAll(FLinearColor color, float display_scale,
142+
FORCEINLINE void SendNotificationToAll(FLinearColor color, float display_scale,
143143
float display_time, UTexture2D* icon, const T* msg, Args&&... args)
144144
{
145145
FString text(FString::Format(msg, std::forward<Args>(args)...));
@@ -165,7 +165,7 @@ namespace ArkApi
165165
* \param args Optional arguments
166166
*/
167167
template <typename T, typename... Args>
168-
void SendChatMessageToAll(const FString& sender_name, const T* msg, Args&&... args)
168+
FORCEINLINE void SendChatMessageToAll(const FString& sender_name, const T* msg, Args&&... args)
169169
{
170170
const FString text(FString::Format(msg, std::forward<Args>(args)...));
171171

@@ -187,7 +187,7 @@ namespace ArkApi
187187
/**
188188
* \brief Returns Steam ID from player controller
189189
*/
190-
static uint64 GetSteamIdFromController(AController* controller)
190+
static FORCEINLINE uint64 GetSteamIdFromController(AController* controller)
191191
{
192192
uint64 steam_id = 0;
193193

@@ -205,7 +205,7 @@ namespace ArkApi
205205
* \param steam_name Steam name
206206
* \return Pointer to AShooterPlayerController
207207
*/
208-
AShooterPlayerController* FindPlayerFromSteamName(const FString& steam_name) const
208+
FORCEINLINE AShooterPlayerController* FindPlayerFromSteamName(const FString& steam_name) const
209209
{
210210
AShooterPlayerController* result = nullptr;
211211

@@ -230,7 +230,7 @@ namespace ArkApi
230230
* \param character Player character
231231
* \return Pointer to AShooterPlayerController
232232
*/
233-
AShooterPlayerController* FindControllerFromCharacter(AShooterCharacter* character) const
233+
FORCEINLINE AShooterPlayerController* FindControllerFromCharacter(AShooterCharacter* character) const
234234
{
235235
AShooterPlayerController* result = nullptr;
236236

@@ -253,7 +253,7 @@ namespace ArkApi
253253
* \param full_match Will match the full length of the string if true
254254
* \return Array of AShooterPlayerController*
255255
*/
256-
TArray<AShooterPlayerController*> FindPlayerFromCharacterName(const FString& character_name,
256+
FORCEINLINE TArray<AShooterPlayerController*> FindPlayerFromCharacterName(const FString& character_name,
257257
ESearchCase::Type search,
258258
bool full_match) const
259259
{
@@ -280,7 +280,7 @@ namespace ArkApi
280280
* \brief Returns the character name of player
281281
* \param player_controller Player
282282
*/
283-
static FString GetCharacterName(AShooterPlayerController* player_controller)
283+
static FORCEINLINE FString GetCharacterName(AShooterPlayerController* player_controller)
284284
{
285285
if (player_controller != nullptr)
286286
{
@@ -296,7 +296,7 @@ namespace ArkApi
296296
* \brief Returns the steam name of player
297297
* \param player_controller Player
298298
*/
299-
static FString GetSteamName(AController* player_controller)
299+
static FORCEINLINE FString GetSteamName(AController* player_controller)
300300
{
301301
return player_controller != nullptr ? player_controller->PlayerStateField()->PlayerNameField() : "";
302302
}
@@ -306,7 +306,7 @@ namespace ArkApi
306306
* \param steam_id Steam id
307307
* \return Pointer to AShooterPlayerController
308308
*/
309-
inline AShooterPlayerController* FindPlayerFromSteamId(uint64 steam_id) const
309+
FORCEINLINE AShooterPlayerController* FindPlayerFromSteamId(uint64 steam_id) const
310310
{
311311
return FindPlayerFromSteamId_Internal(steam_id);
312312
}
@@ -322,7 +322,7 @@ namespace ArkApi
322322
* \param life_span Life span
323323
* \return Returns true if drop was spawned, false otherwise
324324
*/
325-
bool SpawnDrop(const wchar_t* blueprint, FVector pos, int amount, float item_quality = 0.0f,
325+
FORCEINLINE bool SpawnDrop(const wchar_t* blueprint, FVector pos, int amount, float item_quality = 0.0f,
326326
bool force_blueprint = false, float life_span = 0.0f) const
327327
{
328328
APlayerController* player = GetWorld()->GetFirstPlayerController();
@@ -377,7 +377,7 @@ namespace ArkApi
377377
* \param neutered Neuter dino
378378
* \return Spawned dino or null
379379
*/
380-
APrimalDinoCharacter* SpawnDino(AShooterPlayerController* player, FString blueprint, FVector* location, int lvl,
380+
FORCEINLINE APrimalDinoCharacter* SpawnDino(AShooterPlayerController* player, FString blueprint, FVector* location, int lvl,
381381
bool force_tame, bool neutered) const
382382
{
383383
if (player == nullptr)
@@ -435,7 +435,7 @@ namespace ArkApi
435435
* \brief Returns true if character is riding a dino, false otherwise
436436
* \param player_controller Player
437437
*/
438-
static bool IsRidingDino(AShooterPlayerController* player_controller)
438+
static FORCEINLINE bool IsRidingDino(AShooterPlayerController* player_controller)
439439
{
440440
return player_controller != nullptr && player_controller->GetPlayerCharacter() != nullptr
441441
&& player_controller->GetPlayerCharacter()->GetRidingDino() != nullptr;
@@ -446,7 +446,7 @@ namespace ArkApi
446446
* \param player_controller Player
447447
* \return APrimalDinoCharacter*
448448
*/
449-
static APrimalDinoCharacter* GetRidingDino(AShooterPlayerController* player_controller)
449+
static FORCEINLINE APrimalDinoCharacter* GetRidingDino(AShooterPlayerController* player_controller)
450450
{
451451
return player_controller != nullptr && player_controller->GetPlayerCharacter() != nullptr
452452
? player_controller->GetPlayerCharacter()->GetRidingDino()
@@ -458,7 +458,7 @@ namespace ArkApi
458458
* \param player_controller Player
459459
* \return FVector
460460
*/
461-
static FVector GetPosition(APlayerController* player_controller)
461+
static FORCEINLINE FVector GetPosition(APlayerController* player_controller)
462462
{
463463
return player_controller != nullptr ? player_controller->DefaultActorLocationField() : FVector{ 0, 0, 0 };
464464
}
@@ -470,7 +470,7 @@ namespace ArkApi
470470
* \param check_for_dino If set true prevents players teleporting with dino's or teleporting to a player on a dino
471471
* \param max_dist Is the max distance the characters can be away from each other -1 is disabled
472472
*/
473-
static std::optional<FString> TeleportToPlayer(AShooterPlayerController* me, AShooterPlayerController* him,
473+
static FORCEINLINE std::optional<FString> TeleportToPlayer(AShooterPlayerController* me, AShooterPlayerController* him,
474474
bool check_for_dino, float max_dist)
475475
{
476476
if (!(me != nullptr && him != nullptr && me->GetPlayerCharacter() != nullptr && him->
@@ -504,7 +504,7 @@ namespace ArkApi
504504
* \param player_controller Player
505505
* \param pos New position
506506
*/
507-
static bool TeleportToPos(AShooterPlayerController* player_controller, const FVector& pos)
507+
static FORCEINLINE bool TeleportToPos(AShooterPlayerController* player_controller, const FVector& pos)
508508
{
509509
if (player_controller != nullptr && !IsPlayerDead(player_controller))
510510
{
@@ -521,7 +521,7 @@ namespace ArkApi
521521
* \param item_name The name of the item you want to count the quantity of
522522
* \return On success, the function returns amount of items player has. Returns -1 if the function has failed.
523523
*/
524-
static int GetInventoryItemCount(AShooterPlayerController* player_controller, const FString& item_name)
524+
static FORCEINLINE int GetInventoryItemCount(AShooterPlayerController* player_controller, const FString& item_name)
525525
{
526526
if (player_controller == nullptr)
527527
{
@@ -554,7 +554,7 @@ namespace ArkApi
554554
/**
555555
* \brief Returns IP address of player
556556
*/
557-
static FString GetIPAddress(AShooterPlayerController* player)
557+
static FORCEINLINE FString GetIPAddress(AShooterPlayerController* player)
558558
{
559559
return player && player->GetNetConnection() && !player->GetNetConnection()->ClientGivenIPField().IsEmpty() ? player->GetNetConnection()->ClientGivenIPField() : "";
560560
}
@@ -570,7 +570,7 @@ namespace ArkApi
570570
/**
571571
* \brief Returns true if player is dead, false otherwise
572572
*/
573-
static bool IsPlayerDead(AShooterPlayerController* player)
573+
static FORCEINLINE bool IsPlayerDead(AShooterPlayerController* player)
574574
{
575575
if (player == nullptr || player->GetPlayerCharacter() == nullptr)
576576
{
@@ -580,21 +580,21 @@ namespace ArkApi
580580
return player->GetPlayerCharacter()->IsDead();
581581
}
582582

583-
static uint64 GetPlayerID(APrimalCharacter* character)
583+
static FORCEINLINE uint64 GetPlayerID(APrimalCharacter* character)
584584
{
585585
auto* shooter_character = static_cast<AShooterCharacter*>(character);
586586
return shooter_character != nullptr && shooter_character->GetPlayerData() != nullptr
587587
? shooter_character->GetPlayerData()->MyDataField()->PlayerDataIDField()
588588
: -1;
589589
}
590590

591-
static uint64 GetPlayerID(AController* controller)
591+
static FORCEINLINE uint64 GetPlayerID(AController* controller)
592592
{
593593
auto* player = static_cast<AShooterPlayerController*>(controller);
594594
return player != nullptr ? player->LinkedPlayerIDField() : 0;
595595
}
596596

597-
uint64 GetSteamIDForPlayerID(int player_id) const
597+
FORCEINLINE uint64 GetSteamIDForPlayerID(int player_id) const
598598
{
599599
uint64 steam_id = GetShooterGameMode()->GetSteamIDForPlayerID(player_id);
600600
if (steam_id == 0)
@@ -637,7 +637,7 @@ namespace ArkApi
637637
if (the_class != nullptr)
638638
{
639639
FString path;
640-
UVictoryCore::ClassToStringReference(&path, the_class);
640+
UVictoryCore::ClassToStringReference(&path, TSubclassOf<UObject>(the_class));
641641
return "Blueprint'" + path.LeftChop(2) + "'";
642642
}
643643

@@ -647,15 +647,15 @@ namespace ArkApi
647647
/**
648648
* \brief Get Shooter Game State
649649
*/
650-
AShooterGameState* GetGameState()
650+
FORCEINLINE AShooterGameState* GetGameState()
651651
{
652652
return static_cast<AShooterGameState*>(GetWorld()->GameStateField());
653653
}
654654

655655
/**
656656
* \brief Get UShooterCheatManager* of player controller
657657
*/
658-
static UShooterCheatManager* GetCheatManagerByPC(AShooterPlayerController* SPC)
658+
static FORCEINLINE UShooterCheatManager* GetCheatManagerByPC(AShooterPlayerController* SPC)
659659
{
660660
if (!SPC) return nullptr;
661661

@@ -672,7 +672,7 @@ namespace ArkApi
672672
/**
673673
* \brief Get Tribe ID of player controller
674674
*/
675-
static int GetTribeID(AShooterPlayerController* player_controller)
675+
static FORCEINLINE int GetTribeID(AShooterPlayerController* player_controller)
676676
{
677677
int team = 0;
678678

@@ -687,7 +687,7 @@ namespace ArkApi
687687
/**
688688
* \brief Get Tribe ID of character
689689
*/
690-
static int GetTribeID(AShooterCharacter* player_character)
690+
static FORCEINLINE int GetTribeID(AShooterCharacter* player_character)
691691
{
692692
int team = 0;
693693

@@ -702,7 +702,7 @@ namespace ArkApi
702702
/**
703703
* \brief Returns pointer to Primal Game Data
704704
*/
705-
UPrimalGameData* GetGameData()
705+
FORCEINLINE UPrimalGameData* GetGameData()
706706
{
707707
UPrimalGlobals* singleton = static_cast<UPrimalGlobals*>(Globals::GEngine()()->GameSingletonField());
708708
return (singleton->PrimalGameDataOverrideField() != nullptr) ? singleton->PrimalGameDataOverrideField() : singleton->PrimalGameDataField();
@@ -711,7 +711,7 @@ namespace ArkApi
711711
/**
712712
* \brief Gets all actors in radius at location
713713
*/
714-
TArray<AActor*> GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType)
714+
FORCEINLINE TArray<AActor*> GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType)
715715
{
716716
TArray<AActor*> out_actors;
717717

@@ -723,7 +723,7 @@ namespace ArkApi
723723
/**
724724
* \brief Gets all actors in radius at location, with ignore actors
725725
*/
726-
TArray<AActor*> GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType, TArray<AActor*> ignores)
726+
FORCEINLINE TArray<AActor*> GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType, TArray<AActor*> ignores)
727727
{
728728
TArray<AActor*> out_actors;
729729

0 commit comments

Comments
 (0)