Skip to content

Commit 0cd39a7

Browse files
committed
BM 125 SDK
1 parent 6dc3db5 commit 0cd39a7

19 files changed

+205
-39
lines changed

include/bakkesmod/wrappers/GameEvent/ReplayWrapper.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ template<typename T> class StructArrayWrapper;
55
#include ".././Engine/ObjectWrapper.h"
66
class ActorWrapper;
77
class UnrealStringWrapper;
8-
8+
#ifdef __cpp_lib_filesystem
9+
#include <filesystem>
10+
#endif
911
#undef GetCurrentTime
1012

1113
class BAKKESMOD_PLUGIN_IMPORT ReplayWrapper : public ObjectWrapper {
@@ -82,6 +84,12 @@ class BAKKESMOD_PLUGIN_IMPORT ReplayWrapper : public ObjectWrapper {
8284
ReplayWrapper CreateCopy(float StartTime);
8385
void ImportReplay(std::string Path);
8486
void ExportReplay(std::string Path);
87+
#ifdef __cpp_lib_filesystem
88+
void ImportReplay(std::filesystem::path Path);
89+
void ExportReplay(std::filesystem::path Path);
90+
#endif
91+
92+
8593
void SkipToFrame(int frame, unsigned long bFlush);
8694
void SkipToTime(float Time, unsigned long bFlush);
8795
float GetReplayTimeSeconds();

include/bakkesmod/wrappers/GameEvent/SaveData/TrainingEditorSaveDataWrapper.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,17 @@ class BAKKESMOD_PLUGIN_IMPORT TrainingEditorSaveDataWrapper : public ObjectWrapp
2424
void SetCreatedAt(unsigned long long newCreatedAt);
2525
unsigned long long GetUpdatedAt();
2626
void SetUpdatedAt(unsigned long long newUpdatedAt);
27-
SteamID GetCreatorPlayerID();
27+
28+
[[deprecated("Use GetCreatorPlayerUniqueID instead")]]
29+
SteamID GetCreatorPlayerID(); //DEPRECATED
30+
2831
void SetCreatorPlayerID(SteamID newCreatorPlayerID);
2932

3033
//AUTO-GENERATED FUNCTION PROXIES
3134
void Init();
35+
36+
//SELF-IMPLEMENTED
37+
UniqueIDWrapper GetCreatorPlayerUniqueID();
3238
private:
3339
PIMPL
3440
};

include/bakkesmod/wrappers/GameObject/ClubDetailsWrapper.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
#include "../Engine/UnrealStringWrapper.h"
33
#include "../StructArrayWrapper.h"
44
#include "ClubSettingsWrapper.h"
5+
#include "../UniqueIDWrapper.h"
56

67
struct BAKKESMOD_PLUGIN_IMPORT ClubMember {
78
unsigned char paddingForReasons[72];
8-
SteamID GetSteamId();
9+
[[deprecated("Use GetUniqueID instead")]]
10+
SteamID GetSteamId(); //DEPRECATED
11+
UniqueIDWrapper GetUniqueID();
912
UnrealStringWrapper GetName();
1013
};
1114

@@ -23,11 +26,14 @@ class BAKKESMOD_PLUGIN_IMPORT ClubDetailsWrapper : public ClubSettingsWrapper {
2326

2427
//AUTO-GENERATED FROM FIELDS
2528
unsigned long long GetClubID();
26-
SteamID GetOwnerPlayerID();
29+
[[deprecated("Use GetOwnerPlayerUniqueID instead")]]
30+
SteamID GetOwnerPlayerID(); //DEPRECATED
31+
UniqueIDWrapper GetOwnerPlayerUniqueID();
2732
UnrealStringWrapper GetMotD();
2833
unsigned long GetbVerified();
2934
unsigned long long GetLastUpdatedTime();
3035
StructArrayWrapper<ClubMember> GetMembers();
36+
3137
//END AUTO-GENERATED FROM FIELDS
3238

3339
//AUTO-GENERATED FROM METHODS

include/bakkesmod/wrappers/GameObject/PlayerReplicationInfoWrapper.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
template<class T> class ArrayWrapper;
33
template<typename T> class StructArrayWrapper;
44
#include "../WrapperStructs.h"
5+
#include "../UniqueIDWrapper.h"
56
#include ".././Engine/ActorWrapper.h"
67
class UnrealStringWrapper;
78
class TeamInfoWrapper;
@@ -62,15 +63,22 @@ class BAKKESMOD_PLUGIN_IMPORT PlayerReplicationInfoWrapper : public ActorWrapper
6263
float GetExactPing();
6364
void SetExactPing(float newExactPing);
6465
UnrealStringWrapper GetSavedNetworkAddress();
65-
SteamID GetUniqueId();
66-
void SetUniqueId(SteamID newUniqueId);
66+
[[deprecated("Use GetUniqueIdWrapper instead")]]
67+
SteamID GetUniqueId();//DEPRECATED
68+
[[deprecated("Use SetUniqueId that takes UniqueIDWrapper instead")]]
69+
void SetUniqueId(SteamID newUniqueId);//DEPRECATED
70+
71+
UniqueIDWrapper GetUniqueIdWrapper();
72+
void SetUniqueId(UniqueIDWrapper newUniqueId);
6773

6874
//AUTO-GENERATED FUNCTION PROXIES
6975
void UnregisterPlayerFromSession();
7076
void RegisterPlayerWithSession();
7177
bool IsInvalidName();
7278
unsigned char GetTeamNum();
73-
void SetUniqueId2(SteamID& PlayerUniqueId);
79+
[[deprecated("Use SetUniqueId2 that takes UniqueIDWrapper instead")]]
80+
void SetUniqueId2(SteamID& PlayerUniqueId);//DEPRECATED
81+
void SetUniqueId2(UniqueIDWrapper& PlayerUniqueId);
7482
void SeamlessTravelTo(PlayerReplicationInfoWrapper NewPRI);
7583
void IncrementDeaths(int Amt);
7684
void CopyProperties(PlayerReplicationInfoWrapper PRI);

include/bakkesmod/wrappers/GameObject/PriWrapper.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class GameEventWrapper;
99
class FXActorWrapper;
1010
class AirControlComponentWrapper;
1111
class ClubDetailsWrapper;
12+
class UniqueIDWrapper;
1213

1314
class BAKKESMOD_PLUGIN_IMPORT PriWrapper : public PriXWrapper {
1415
public:
@@ -91,8 +92,15 @@ class BAKKESMOD_PLUGIN_IMPORT PriWrapper : public PriXWrapper {
9192
void SetPawnType(unsigned char newPawnType);
9293
unsigned char GetReplicatedWorstNetQualityBeyondLatency();
9394
void SetReplicatedWorstNetQualityBeyondLatency(unsigned char newReplicatedWorstNetQualityBeyondLatency);
94-
SteamID GetPartyLeader();
95-
void SetPartyLeader(SteamID newPartyLeader);
95+
96+
[[deprecated("Use GetPartyLeaderID instead")]]
97+
SteamID GetPartyLeader();//DEPRECATED
98+
[[deprecated("Use SetPartyLeader that takes UniqueIDWrapper instead")]]
99+
void SetPartyLeader(SteamID newPartyLeader);//DEPRECATED
100+
101+
UniqueIDWrapper GetPartyLeaderID();
102+
void SetPartyLeader(UniqueIDWrapper newPartyLeader);
103+
96104
int GetTotalXP();
97105
void SetTotalXP(int newTotalXP);
98106
int GetXpLevel();
@@ -213,8 +221,10 @@ class BAKKESMOD_PLUGIN_IMPORT PriWrapper : public PriXWrapper {
213221
void ServerSplitScreenStatusChanged(unsigned long bInSplitScreen);
214222
void UpdateSplitScreenStatus();
215223
void OnPartyLeaderChanged();
216-
void ServerSetPartyLeader(SteamID& InPartyLeader, unsigned long bInParty);
217-
void SetPartyLeader2(SteamID& InPartyLeader, unsigned long bInParty);
224+
[[deprecated("Function definition is empty and thus will not work")]]
225+
void ServerSetPartyLeader(SteamID& InPartyLeader, unsigned long bInParty);//DEPRECATED
226+
[[deprecated("Function definition is empty and thus will not work")]]
227+
void SetPartyLeader2(SteamID& InPartyLeader, unsigned long bInParty);//DEPRECATED
218228
void UpdatePartyStatus();
219229
void OnSkillTierChanged();
220230
void ReplicateSkillTier(int NewTier);

include/bakkesmod/wrappers/GameObject/PriXWrapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ class BAKKESMOD_PLUGIN_IMPORT PriXWrapper : public PlayerReplicationInfoWrapper
1414
//AUTO-GENERATED FUNCTION PROXIES
1515
void eventDestroyed();
1616
void OnUniqueIdChanged();
17-
void SetUniqueId(SteamID& PlayerUniqueId);
17+
[[deprecated("Function definition is empty and thus will not work")]]
18+
void SetUniqueId(SteamID& PlayerUniqueId);//DEPRECATED
1819
void UnregisterPlayerFromSession();
1920
void RegisterPlayerWithSession();
2021
void OnTeamChanged();

include/bakkesmod/wrappers/GameWrapper.h

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
#include <typeindex>
99
#include "canvaswrapper.h"
1010
#include "mmrwrapper.h"
11+
12+
#ifdef __cpp_lib_filesystem
13+
#include <filesystem>
14+
#endif
1115
class GameEventWrapper;
1216
class TutorialWrapper;
1317
class ServerWrapper;
@@ -23,6 +27,7 @@ class BindingsWrapper;
2327
class SequenceWrapper;
2428
class ItemsWrapper;
2529
class ClubDetailsWrapper;
30+
class UnrealStringWrapper;
2631

2732
class BAKKESMOD_PLUGIN_IMPORT GameWrapper
2833
{
@@ -41,7 +46,11 @@ class BAKKESMOD_PLUGIN_IMPORT GameWrapper
4146
bool IsSpectatingInOnlineGame();
4247

4348
bool IsPaused();
49+
bool IsUsingEpicVersion();
50+
bool IsUsingSteamVersion();
4451

52+
int GetSteamVersion();
53+
std::string GetPsyBuildID();
4554

4655
ServerWrapper GetOnlineGame();
4756
//TutorialWrapper GetGameEventAsTutorial();
@@ -79,7 +88,10 @@ class BAKKESMOD_PLUGIN_IMPORT GameWrapper
7988
Supported file formats: Whatever D3DXCreateTextureFromFile supports.
8089
*/
8190
void LoadToastTexture(std::string name, std::string path);
82-
91+
void LoadToastTexture(std::string name, std::wstring path);
92+
#ifdef __cpp_lib_filesystem
93+
void LoadToastTexture(std::string name, std::filesystem::path path);
94+
#endif
8395
/*
8496
Texture is the name of the texture given in LoadToastTexture, not the path! "default" will show the normal BakkesMod logo
8597
*/
@@ -90,7 +102,9 @@ class BAKKESMOD_PLUGIN_IMPORT GameWrapper
90102
std::string GetRandomMap();
91103
std::string GetCurrentMap();
92104
unsigned long long GetSteamID();
93-
class UnrealStringWrapper GetPlayerName();
105+
std::string GetEpicID();
106+
UniqueIDWrapper GetUniqueID();
107+
UnrealStringWrapper GetPlayerName();
94108
ClubDetailsWrapper GetLocalClub();
95109
SequenceWrapper GetMainSequence();
96110

@@ -100,6 +114,14 @@ class BAKKESMOD_PLUGIN_IMPORT GameWrapper
100114
unsigned int GetbMetric();
101115
UnrealStringWrapper GetUILanguage();
102116
bool GetbColorBlind();
117+
// Path utilities
118+
#ifdef __cpp_lib_filesystem
119+
std::filesystem::path GetBakkesModPath();
120+
std::filesystem::path GetDataFolder();
121+
std::filesystem::path FixRelativePath(std::filesystem::path path);
122+
#endif
123+
std::wstring GetBakkesModPathW();
124+
std::wstring GetDataFolderW();
103125

104126
template<typename T, typename std::enable_if<std::is_base_of<ObjectWrapper, T>::value>::type* = nullptr>
105127
void HookEventWithCaller(std::string eventName, std::function<void(T caller, void* params, std::string eventName)> callback);
@@ -123,4 +145,4 @@ extern template void BAKKESMOD_PLUGIN_IMPORT GameWrapper::HookEventWithCallerPos
123145
extern template void BAKKESMOD_PLUGIN_IMPORT GameWrapper::HookEventWithCallerPost<CarComponentWrapper>(std::string eventName, std::function<void(CarComponentWrapper caller, void* params, std::string eventName)> callback);
124146
extern template void BAKKESMOD_PLUGIN_IMPORT GameWrapper::HookEventWithCallerPost<PlayerControllerWrapper>(std::string eventName, std::function<void(PlayerControllerWrapper caller, void* params, std::string eventName)> callback);
125147
extern template void BAKKESMOD_PLUGIN_IMPORT GameWrapper::HookEventWithCallerPost<BallWrapper>(std::string eventName, std::function<void(BallWrapper caller, void* params, std::string eventName)> callback);
126-
#pragma warning(pop)
148+
#pragma warning(pop)

include/bakkesmod/wrappers/GuiManagerWrapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#pragma once
22
#include "./Engine/ObjectWrapper.h"
33
#include "wrapperstructs.h"
4-
#include "../imgui/imgui.h"
4+
//#include "../imgui/imgui.h"
55
#include <tuple>
6+
67
class BAKKESMOD_PLUGIN_IMPORT GuiManagerWrapper : public ObjectWrapper
78
{
89
public:

include/bakkesmod/wrappers/MMRWrapper.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,58 @@
11
#pragma once
22
#include "./Engine/ObjectWrapper.h"
33
#include "wrapperstructs.h"
4+
#include "UniqueIDWrapper.h"
5+
6+
class MMRWrapper;
7+
8+
struct BAKKESMOD_PLUGIN_IMPORT MMRNotifierToken
9+
{
10+
friend class MMRWrapper;
11+
// The deconstructor deregisters your plugin for MMR notifications.
12+
~MMRNotifierToken();
13+
14+
// Copying would break the deconstruction logic.
15+
MMRNotifierToken(const MMRNotifierToken& other) = delete;
16+
MMRNotifierToken& operator=(const MMRNotifierToken& other) = delete;
17+
// Move is OK
18+
MMRNotifierToken(MMRNotifierToken&& other) noexcept = default;
19+
MMRNotifierToken& operator=(MMRNotifierToken&& other) noexcept = default;
20+
21+
22+
private:
23+
explicit MMRNotifierToken(unsigned long long t);
24+
// Do we need pimpl here?
25+
unsigned long long token;
26+
};
27+
428
class BAKKESMOD_PLUGIN_IMPORT MMRWrapper : public ObjectWrapper
529
{
630
public:
731
CONSTRUCTORS(MMRWrapper);
32+
bool IsSyncing(UniqueIDWrapper playerID);
833
bool IsSyncing(SteamID playerID);
34+
bool IsSynced(UniqueIDWrapper playerID, int playlistID);
935
bool IsSynced(SteamID playerID, int playlistID);
1036
bool IsRanked(int playlistID);
37+
38+
SkillRating GetPlayerSkillRating(UniqueIDWrapper playerID, int playlistID);
39+
SkillRank GetPlayerRank(UniqueIDWrapper playerID, int playlistID);
40+
float GetPlayerMMR(UniqueIDWrapper playerID, int playlistID);
41+
1142
SkillRating GetPlayerSkillRating(SteamID playerID, int playlistID);
1243
SkillRank GetPlayerRank(SteamID playerID, int playlistID);
1344
float GetPlayerMMR(SteamID playerID, int playlistID);
1445
float CalculateMMR(SkillRating sr, bool disregardPlacements);
1546
int GetCurrentPlaylist();
47+
48+
/// <summary>
49+
/// Subscribe to MMR updates. The callback will receive a ID wrapper for the player that the MMR update is relevant for.
50+
/// </summary>
51+
/// <param name="notification_callback">The callback that will be called for each mmr update</param>
52+
/// <returns>a token whos lifetime controls your callback registration. When the token is destroyed, so is your registration. </returns>
53+
std::unique_ptr<MMRNotifierToken> RegisterMMRNotifier(std::function<void(UniqueIDWrapper id)>);
54+
55+
1656
private:
1757
PIMPL
1858
};
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#pragma once
2+
#pragma warning(push)
3+
#pragma warning(disable:4661)
4+
#include "WrapperStructs.h"
5+
6+
class BAKKESMOD_PLUGIN_IMPORT UniqueIDWrapper
7+
{
8+
public:
9+
//Empty constructor so it can be declared in classes and we can have 0 values
10+
UniqueIDWrapper();
11+
UniqueIDWrapper(std::uintptr_t mem);
12+
UniqueIDWrapper(const UniqueIDWrapper& other);
13+
UniqueIDWrapper& operator=(UniqueIDWrapper rhs);
14+
~UniqueIDWrapper();
15+
16+
OnlinePlatform GetPlatform() const;
17+
std::string GetEpicAccountID() const;
18+
unsigned long long GetUID() const;
19+
unsigned char GetSplitscreenID() const;
20+
21+
/*
22+
String representation of the ID.
23+
Will be the EpicID if nonempty. Uid otherwise
24+
*/
25+
std::string str() const;
26+
public:
27+
/*
28+
Not 100% with the internals here, think it depends on what the game reads.
29+
For some functionality you might get away with just the epicAccountID, others might rely on UID & platform.
30+
And some others you might even need both.
31+
AKA: it's best you just retrieve this wrapper from the game from existing players instead of using this function.
32+
This wrapper is an exception to most other wrappers, as in: you're allowed to store this one! woohoo
33+
*/
34+
static UniqueIDWrapper FromEpicAccountID(std::string epicAccountID, unsigned long long uid, OnlinePlatform platform, unsigned char splitscreenID = 0);
35+
36+
bool operator <(const UniqueIDWrapper& rhs) const;
37+
bool operator==(const UniqueIDWrapper& rhs) const;
38+
bool operator!=(const UniqueIDWrapper& rhs) const;
39+
protected:
40+
PIMPL
41+
};
42+
43+
#pragma warning(pop)

include/bakkesmod/wrappers/arraywrapper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "./GameObject/TeamWrapper.h"
1212
#include "./GameObject/GoalWrapper.h"
1313
#include "./GameObject/BoostPickupWrapper.h"
14+
1415
class ActorWrapper;
1516
class CarWrapper;
1617
class BallWrapper;
@@ -27,6 +28,7 @@ class PlayerControllerWrapper;
2728

2829
class SequenceWrapper;
2930
class SequenceObjectWrapper;
31+
class SequenceVariableWrapper;
3032

3133
class ProductWrapper;
3234
class OnlineProductWrapper;
@@ -111,6 +113,7 @@ template class BAKKESMOD_PLUGIN_IMPORT ArrayWrapper<PlayerControllerWrapper>;
111113
template class BAKKESMOD_PLUGIN_IMPORT ArrayWrapper<wchar_t>;
112114
template class BAKKESMOD_PLUGIN_IMPORT ArrayWrapper<SequenceWrapper>;
113115
template class BAKKESMOD_PLUGIN_IMPORT ArrayWrapper<SequenceObjectWrapper>;
116+
template class BAKKESMOD_PLUGIN_IMPORT ArrayWrapper<SequenceVariableWrapper>;
114117
template class BAKKESMOD_PLUGIN_IMPORT ArrayWrapper<ProductWrapper>;
115118
template class BAKKESMOD_PLUGIN_IMPORT ArrayWrapper<OnlineProductWrapper>;
116119
template class BAKKESMOD_PLUGIN_IMPORT ArrayWrapper<ProductAttributeWrapper>;

include/bakkesmod/wrappers/canvaswrapper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class BAKKESMOD_PLUGIN_IMPORT CanvasWrapper
2020
void FillTriangle(Vector2F p1, Vector2F p2, Vector2F p3, LinearColor color);
2121
void DrawString(std::string text);
2222
void DrawString(std::string text, float xScale, float yScale);
23+
void DrawString(std::string text, float xScale, float yScale, bool dropShadow, bool wrapText=false);
2324
Vector2F GetStringSize(std::string text, float xScale=1, float yScale=1);
2425
void DrawLine(Vector2F start, Vector2F end);
2526
void DrawLine(Vector2F start, Vector2F end, float width);

include/bakkesmod/wrappers/items/ItemsWrapper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ class BAKKESMOD_PLUGIN_IMPORT ItemsWrapper : public ObjectWrapper
3535
ItemsWrapper(const ItemsWrapper& other);
3636
ItemsWrapper& operator=(ItemsWrapper rhs);
3737
~ItemsWrapper();
38+
bool IsNull();
3839
ArrayWrapper<ProductWrapper> GetAllProducts();
3940
ProductWrapper GetProduct(int productId);
41+
[[deprecated("This will 99% for sure crash")]]
4042
ArrayWrapper<OnlineProductWrapper> GetUnlockedProducts();
43+
ArrayWrapper<ProductWrapper> GetCachedUnlockedProducts();
4144
ArrayWrapper<OnlineProductWrapper> GetOwnedProducts();
4245

4346
CertifiedStatDatabaseWrapper GetCertifiedStatDB();

0 commit comments

Comments
 (0)