forked from citizenfx/fivem
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCrossLibraryInterfaces.h
More file actions
89 lines (63 loc) · 2.2 KB
/
CrossLibraryInterfaces.h
File metadata and controls
89 lines (63 loc) · 2.2 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
/*
* This file is part of the CitizenFX project - http://citizen.re/
*
* See LICENSE and MENTIONS in the root of the source tree for information
* regarding licensing.
*/
#pragma once
// library for game-specific network integration code to interface with the CitizenGame network library
class INetLibrary
{
public:
virtual uint16_t GetServerNetID() = 0;
virtual uint16_t GetServerSlotID() = 0;
virtual uint16_t GetHostNetID() = 0;
virtual uint32_t GetHostBase() = 0;
virtual const char* GetPlayerName() = 0;
virtual void SetPlayerName(const char* name) = 0;
virtual void SetBase(uint32_t base) = 0;
virtual void RunFrame() = 0;
virtual void Disconnect(const char* reason) = 0;
virtual bool DequeueRoutedPacket(char* buffer, size_t* length, uint16_t* netID) = 0;
virtual void RoutePacket(const char* buffer, size_t length, uint16_t netID) = 0;
virtual void SendReliableCommand(const char* type, const char* buffer, size_t length) = 0;
};
struct WNDPROCARGS
{
HWND hwnd;
UINT uMsg;
LPARAM lParam;
WPARAM wParam;
BOOL pass;
LRESULT lresult;
};
class IGameSpecToHooks
{
public:
virtual void SetHookCallback(uint32_t hookCallbackId, void(*callback)(void*)) = 0;
virtual void SetDisconnectSafeguard(bool enable) = 0;
virtual bool InstallRuntimeHook(const char* key) = 0;
virtual bool SetLimit(const char* limit, int value) = 0;
virtual bool SetWorldDefinition(const char* worldDefinition) = 0;
};
class HOOKS_EXPORT HooksDLLInterface
{
public:
static void PreGameLoad(bool* continueLoad, IGameSpecToHooks** hooksPtr);
static void PostGameLoad(HMODULE module, bool* continueLoad);
static void SetNetLibrary(INetLibrary* netLibrary);
};
class GAMESPEC_EXPORT GameSpecDLLInterface
{
public:
static void SetHooksDLLCallback(IGameSpecToHooks* callback);
static void SetNetLibrary(INetLibrary* netLibrary);
};
#if defined(COMPILING_HOOKS) || defined(COMPILING_GAMESPEC)
extern INetLibrary* g_netLibrary;
#endif
// the latter is just a temporary hack
#if defined(COMPILING_GAMESPEC) || defined(COMPILING_GAME) || defined(COMPILING_SCRT_LUA)
// hooks dll reverse callbacks
extern IGameSpecToHooks* g_hooksDLL;
#endif