Repository navigation
Expand file tree
/
Copy pathplugin_eac.h
More file actions
152 lines (124 loc) · 4.28 KB
/
Copy pathplugin_eac.h
File metadata and controls
152 lines (124 loc) · 4.28 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#pragma once
#include <stdint.h>
#include <stddef.h>
#include <windows.h>
#include <string>
#include <iosfwd>
#include <fstream>
#include <filesystem>
#include <cassert>
#include <map>
#include <unordered_set>
#include <chrono>
#include <mutex>
// Epic SDK
#include "EOS/Include/eos_types.h"
#include "EOS/Include/eos_base.h"
#include "EOS/Include/eos_integratedplatform_types.h"
#include "EOS/Include/eos_init.h"
#include "EOS/Include/eos_integratedplatform.h"
#include "EOS/Include/Windows/eos_Windows.h"
#include "EOS/Include/eos_logging.h"
#include "EOS/Include/eos_sdk.h"
#include "EOS/Include/eos_anticheatclient.h"
#include "EOS/Include/eos_anticheatcommon_types.h"
#pragma comment(lib, "../EOS/Lib/EOSSDK-Win32-Shipping.lib")
#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 (*ACPlayerActionRequiredCallbackFunc)(
uint32_t userId,
const char* reasonString,
int actionType,
int actionReason
);
typedef void (*ACIntegrityViolationCallbackFunc)(
const char* violationString,
int violationID
);
typedef void (*ConnectionStateChangedCallbackFunc)(
uint32_t userId,
int connectionState
);
typedef void (*LoggingFunc)(const char*);
LoggingFunc g_fnLoggingFunc = nullptr;
LoggingFunc g_fnLobbyChatOutput = nullptr;
EOS_HPlatform g_EOSPlatformHandle = nullptr;
typedef void (*LoginCallback)(bool bSuccess);
// Thread synchronization for global state
std::recursive_mutex g_StateMutex;
// ------------------------------------------------------------
// Enums (mirroring plugin.cpp)
// ------------------------------------------------------------
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();
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
// ------------------------------------------------------------
EOS_ProductUserId g_EOSUserID = nullptr;
uint32_t g_goUserID = 0;
ACIntegrityViolationCallbackFunc g_fnAnticheatIntegrityViolationOccurredCallback = nullptr;
ACPlayerActionRequiredCallbackFunc g_fnAnticheatActionCallback = nullptr;
SendMessageViaTransportFunc g_fnSendMessageViaTransport = nullptr;
bool g_bEventsHooked = false;
// ------------------------------------------------------------
// 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
};