Subversion Repositories WoWGM

Rev

Rev 17 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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