-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.h
More file actions
129 lines (106 loc) · 3.62 KB
/
plugin.h
File metadata and controls
129 lines (106 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#pragma once
#include <stdint.h>
#include <stddef.h>
#include <windows.h>
#include <string>
#include <iosfwd>
#include <fstream>
#include <cassert>
#include <map>
#include <unordered_set>
#include <chrono>
#ifdef _WIN32
#ifdef PLUGIN_EXPORTS
#define PLUGIN_API extern "C" __declspec(dllexport)
#else
#define PLUGIN_API extern "C" __declspec(dllimport)
#endif
#else
#define PLUGIN_API extern "C"
#endif
// ------------------------------------------------------------
// Callback Types
// ------------------------------------------------------------
typedef void (*LoggingFunc)(const char*);
typedef void (*SendMessageViaTransportFunc)(uint32_t, const void*, uint32_t);
typedef void (*ACIntegrityViolationCallbackFunc)(
const char* violationString,
int violationID
);
typedef void (*ACPlayerActionRequiredCallbackFunc)(
uint32_t userId,
const char* reasonString,
int actionType,
int actionReason
);
typedef void (*ConnectionStateChangedCallbackFunc)(
uint32_t userId,
int connectionState
);
typedef void (*LoggingFunc)(const char*);
LoggingFunc g_fnLoggingFunc = nullptr;
LoggingFunc g_fnLobbyChatOutput = nullptr;
typedef void (*LoginCallback)(bool bSuccess);
// ------------------------------------------------------------
// Enums
// ------------------------------------------------------------
enum EPluginConnectionState
{
EConnectionState_Connecting = 0,
EConnectionState_Connected = 1,
EConnectionState_ConnectionClosed = 2
};
// ------------------------------------------------------------
// Exported API
// ------------------------------------------------------------
// Callback registration
PLUGIN_API void SetLoggingFunction(LoggingFunc cb);
PLUGIN_API void SetLobbyChatOutputFunction(LoggingFunc cb);
PLUGIN_API void SetACActionRequiredCallback(ACPlayerActionRequiredCallbackFunc cb);
PLUGIN_API void SetACIntegrityViolationOccurredCallback(ACIntegrityViolationCallbackFunc cb);
PLUGIN_API void SetSendMessageViaTransportCallback(SendMessageViaTransportFunc cb);
// Required plugin functions
PLUGIN_API void ACMessageArrivedViaTransport(uint32_t sourceUserID, void* data, uint32_t dataLen);
PLUGIN_API void Tick();
PLUGIN_API bool IsLoggedIn();
PLUGIN_API bool IsExternalProcessRunning();
// TODO: Call EOS_AntiCheatClient_RemoveNotifyMessage and other callbacks?
PLUGIN_API int GetAnticheatIdentifier();
PLUGIN_API bool GetMiddlewareAuthToken(char* buffer, size_t bufferSize);
PLUGIN_API int Initialize();
PLUGIN_API void Shutdown();
PLUGIN_API void BeginSession();
PLUGIN_API void EndSession();
PLUGIN_API bool RegisterPlayer(const char* middlewareUserID, uint32_t goUserID);
PLUGIN_API bool DeregisterPlayer(const char* middlewareUserID, uint32_t goUserID);
PLUGIN_API void Login(const char* gameToken, LoginCallback cb);
PLUGIN_API void RefreshToken(const char* gameToken, LoginCallback cb);
// ------------------------------------------------------------
// Vars
// ------------------------------------------------------------
uint32_t g_goUserID = -1;
ACIntegrityViolationCallbackFunc g_fnAnticheatIntegrityViolationOccurredCallback = nullptr;
ACPlayerActionRequiredCallbackFunc g_fnAnticheatActionCallback = nullptr;
SendMessageViaTransportFunc g_fnSendMessageViaTransport = nullptr;
// ------------------------------------------------------------
// Enums
// ------------------------------------------------------------
enum class EAnticheatActionType : int32_t
{
NONE = 0,
KICK = 1
};
enum class EAnticheatActionReason : int32_t
{
Unknown = 0,
InternalError = 1,
InvalidMessage = 2,
AuthFailure = 3,
ACNotRunning = 4,
HeartbeatTimedOut = 5,
ClientViolation = 6,
BackendViolation = 7,
TempCooldown = 8,
TempBanned = 9,
PermaBanned = 10
};