| 32 |
tristanc |
1 |
#include "pch.h"
|
|
|
2 |
#pragma hdrstop
|
|
|
3 |
|
|
|
4 |
#include "ClientServices.h"
|
|
|
5 |
|
|
|
6 |
|
| 36 |
tristanc |
7 |
/******************************************************************************
|
| 32 |
tristanc |
8 |
*
|
|
|
9 |
* Client memory addresses
|
|
|
10 |
*
|
| 3 |
tristanc |
11 |
***/
|
|
|
12 |
|
| 32 |
tristanc |
13 |
#define CLIENTCONNECTION__GETCHARACTERLIST 0x006B14C0
|
|
|
14 |
#define CLIENTSERVICES_REPORT 0x006B22A0
|
| 31 |
tristanc |
15 |
#define CLIENTSERVICES_SEND 0x00406F40
|
| 32 |
tristanc |
16 |
#define CLIENTSERVICES__SENDONCONNECTION 0x006B0B50
|
| 36 |
tristanc |
17 |
#define CLIENTSERVICES_INITIALIZE 0x006B2200
|
| 32 |
tristanc |
18 |
#define CLIENTSERVICES_DESTROY 0x005AB3D0
|
|
|
19 |
#define CLIENTSERVICES_SETMESSAGEHANDLER 0x006B0B80
|
|
|
20 |
#define CLIENTSERVICES_CLEARMESSAGEHANDLER 0x006B0BC0
|
|
|
21 |
|
|
|
22 |
|
| 36 |
tristanc |
23 |
/******************************************************************************
|
| 32 |
tristanc |
24 |
*
|
|
|
25 |
* Client function pointers
|
|
|
26 |
*
|
|
|
27 |
***/
|
|
|
28 |
|
| 31 |
tristanc |
29 |
void (*ClientConnection__GetCharacterListPtr)(void*) = *(void(*)(void*))CLIENTCONNECTION__GETCHARACTERLIST;
|
| 32 |
tristanc |
30 |
|
|
|
31 |
void (*ClientServices_InitializePtr)() = *(void(*)())CLIENTSERVICES_INITIALIZE;
|
|
|
32 |
|
|
|
33 |
void (*ClientServices_DestroyPtr)() = *(void(*)())CLIENTSERVICES_DESTROY;
|
|
|
34 |
|
|
|
35 |
BOOL (*ClientServices_ReportPtr)(unsigned int,LPCSTR) = *(BOOL(*)(unsigned int,LPCSTR))CLIENTSERVICES_REPORT;
|
|
|
36 |
|
| 31 |
tristanc |
37 |
void (*ClientServices_SendPtr)(CDataStore*) = *(void(*)(CDataStore*))CLIENTSERVICES_SEND;
|
| 32 |
tristanc |
38 |
|
| 31 |
tristanc |
39 |
void (*ClientServices_SendOnConnectionPtr)(CDataStore*) = *(void(*)(CDataStore*))CLIENTSERVICES__SENDONCONNECTION;
|
| 32 |
tristanc |
40 |
|
|
|
41 |
void (*ClientServices_SetMessageHandlerPtr)(NETMESSAGE,int (*)(void*,NETMESSAGE,unsigned int,CDataStore*),void*) = *(void(*)(NETMESSAGE,int (*)(void*,NETMESSAGE,unsigned int,CDataStore*),void*))CLIENTSERVICES_SETMESSAGEHANDLER;
|
|
|
42 |
|
|
|
43 |
void (*ClientServices_ClearMessageHandlerPtr)(NETMESSAGE) = *(void(*)(NETMESSAGE))CLIENTSERVICES_CLEARMESSAGEHANDLER;
|
|
|
44 |
|
|
|
45 |
|
| 36 |
tristanc |
46 |
/******************************************************************************
|
| 32 |
tristanc |
47 |
*
|
|
|
48 |
* Private
|
|
|
49 |
*
|
| 3 |
tristanc |
50 |
***/
|
|
|
51 |
|
| 36 |
tristanc |
52 |
//=============================================================================
|
| 32 |
tristanc |
53 |
void ClientServices_InternalInitialize () {
|
|
|
54 |
ClientServices_InitializePtr();
|
| 3 |
tristanc |
55 |
}
|
|
|
56 |
|
| 36 |
tristanc |
57 |
//=============================================================================
|
| 32 |
tristanc |
58 |
void ClientServices_InternalDestroy () {
|
|
|
59 |
ClientServices_DestroyPtr();
|
| 3 |
tristanc |
60 |
}
|
|
|
61 |
|
| 32 |
tristanc |
62 |
|
| 36 |
tristanc |
63 |
/******************************************************************************
|
| 32 |
tristanc |
64 |
*
|
|
|
65 |
* External
|
|
|
66 |
*
|
|
|
67 |
***/
|
|
|
68 |
|
|
|
69 |
void ClientConnection::GetCharacterList () {
|
|
|
70 |
ClientConnection__GetCharacterListPtr(ClientServices_Connection());
|
|
|
71 |
}
|
|
|
72 |
|
| 36 |
tristanc |
73 |
//=============================================================================
|
| 32 |
tristanc |
74 |
void ClientServices_Initialize () {
|
|
|
75 |
DETOUR_INIT;
|
|
|
76 |
DETOUR_ATTACH(ClientServices_InitializePtr,ClientServices_InternalInitialize);
|
|
|
77 |
DETOUR_COMMIT;
|
|
|
78 |
}
|
|
|
79 |
|
| 36 |
tristanc |
80 |
//=============================================================================
|
| 32 |
tristanc |
81 |
void* ClientServices_Connection () {
|
|
|
82 |
return (void*)0x00C79CF4; //TODO: ClientConnection::s_currentConnection
|
|
|
83 |
}
|
|
|
84 |
|
| 36 |
tristanc |
85 |
//=============================================================================
|
| 32 |
tristanc |
86 |
void ClientServices_Destroy () {
|
|
|
87 |
DETOUR_INIT;
|
|
|
88 |
DETOUR_DETACH(ClientServices_DestroyPtr,ClientServices_InternalDestroy);
|
|
|
89 |
DETOUR_COMMIT;
|
|
|
90 |
}
|
|
|
91 |
|
| 36 |
tristanc |
92 |
//=============================================================================
|
| 32 |
tristanc |
93 |
BOOL ClientServices_Report (unsigned int category, char const* title) {
|
|
|
94 |
return ClientServices_ReportPtr(category, title);
|
|
|
95 |
}
|
|
|
96 |
|
| 36 |
tristanc |
97 |
//=============================================================================
|
| 32 |
tristanc |
98 |
void ClientServices_Send (CDataStore *netMessage) {
|
|
|
99 |
ClientServices_SendPtr(netMessage);
|
|
|
100 |
}
|
|
|
101 |
|
| 36 |
tristanc |
102 |
//=============================================================================
|
| 32 |
tristanc |
103 |
void ClientServices_SendOnConnection (CDataStore* msg) {
|
|
|
104 |
ClientServices_SendOnConnectionPtr(msg);
|
|
|
105 |
}
|
|
|
106 |
|
| 36 |
tristanc |
107 |
//=============================================================================
|
| 32 |
tristanc |
108 |
void ClientServices_SetMessageHandler (NETMESSAGE msgID,
|
|
|
109 |
int (*handler)(void*,NETMESSAGE,unsigned int,CDataStore*),
|
|
|
110 |
void* param) {
|
|
|
111 |
|
|
|
112 |
ClientServices_SetMessageHandlerPtr(msgID,handler,param);
|
|
|
113 |
}
|
|
|
114 |
|
| 36 |
tristanc |
115 |
//=============================================================================
|
| 32 |
tristanc |
116 |
void ClientServices_ClearMessageHandler (NETMESSAGE msgID) {
|
|
|
117 |
ClientServices_ClearMessageHandlerPtr(msgID);
|
|
|
118 |
}
|
|
|
119 |
|