Subversion Repositories WoWGM

Rev

Rev 17 | Rev 31 | Go to most recent revision | Details | Compare with Previous | 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;
28 tristanc 13
#define  CLIENTSERVICES_REPORT              0x006B22A0;
3 tristanc 14
#define  CLIENTSERVICES_SEND								0x00406F40
15
#define  CLIENTSERVICES__SENDONCONNECTION   0x006B0B50
16
#define  CLIENTSERVICES_INITIALIZE					0x005AB1D0
17
#define  CLIENTSERVICES_DESTROY							0x005AB3D0
17 tristanc 18
#define  CLIENTSERVICES_SETMESSAGEHANDLER	0x006B0B80
19
#define  CLIENTSERVICES_CLEARMESSAGEHANDLER	0x006B0BC0
3 tristanc 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
//===========================================================================
28 tristanc 32
BOOL (*ClientServices_ReportPtr) (unsigned int category, LPCSTR title) = *(BOOL(*)(unsigned int,LPCSTR))CLIENTSERVICES_REPORT;
33
 
34
//===========================================================================
3 tristanc 35
void (__cdecl* ClientServices_SendPtr) (CDataStore* netMessage) = *(void(__cdecl*)(CDataStore*))CLIENTSERVICES_SEND;
36
 
37
//===========================================================================
38
void(__cdecl* ClientServices_SendOnConnectionPtr) (CDataStore* msg) = *(void(__cdecl*)(CDataStore*))CLIENTSERVICES__SENDONCONNECTION;
39
 
40
//===========================================================================
41
void (__cdecl* ClientServices_SetMessageHandlerPtr) (NETMESSAGE	msgID,
42
																										 int				(__cdecl* handler)(void*,
43
																																									 NETMESSAGE,
44
																																									 unsigned int,
45
																																									 CDataStore*),
46
																										 void*			param) = *(void(*)(NETMESSAGE,
47
																																									 int (__cdecl*)(void*,
48
																																																	NETMESSAGE,
49
																																																	unsigned int,
50
																																																	CDataStore*),
51
																																									 void*))CLIENTSERVICES_SETMESSAGEHANDLER;
52
 
53
//===========================================================================
54
void (__cdecl* ClientServices_ClearMessageHandlerPtr) (NETMESSAGE msgID) = *(void(*)(NETMESSAGE))CLIENTSERVICES_CLEARMESSAGEHANDLER;
55
 
56
 
57
//===========================================================================
58
void ClientServices_InternalInitialize () {
59
	ClientServices_InitializePtr();
60
}
61
 
62
//===========================================================================
63
void ClientServices_InternalDestroy () {
64
	ClientServices_DestroyPtr();
65
}
66
 
67
 
68
/****************************************************************************
69
*
70
*  External functions
71
*
72
***/
73
 
74
void __cdecl ClientConnection::GetCharacterList () {
75
  ClientConnection__GetCharacterListPtr(ClientServices_Connection());
76
}
77
 
78
 
79
//===========================================================================
80
void ClientServices_Initialize () {
81
	DETOUR_INIT;
82
 
83
	DETOUR_ATTACH(ClientServices_InitializePtr,ClientServices_InternalInitialize);
84
	DETOUR_COMMIT;
85
}
86
 
87
//===========================================================================
88
void* ClientServices_Connection () {
89
  return (void*)0x00C79CF4;  // ClientConnection::s_currentConnection
90
}
91
 
92
//===========================================================================
93
void ClientServices_Destroy () {
94
	DETOUR_INIT;
95
 
96
	DETOUR_DETACH(ClientServices_DestroyPtr,ClientServices_InternalDestroy);
97
	DETOUR_COMMIT;
98
}
99
 
100
//===========================================================================
28 tristanc 101
BOOL ClientServices_Report (unsigned int category, char const* title) {
102
  return ClientServices_ReportPtr(category, title);
103
}
104
 
105
//===========================================================================
3 tristanc 106
void ClientServices_Send (CDataStore *netMessage) {
107
	ClientServices_SendPtr(netMessage);
108
}
109
 
110
//===========================================================================
111
void ClientServices_SendOnConnection(CDataStore* msg) {
112
  ClientServices_SendOnConnectionPtr(msg);
113
}
114
 
115
//===========================================================================
116
void ClientServices_SetMessageHandler (NETMESSAGE msgID,
17 tristanc 117
									   int(*handler)(void*,NETMESSAGE,unsigned int,CDataStore*),
118
									   void* param)
119
{
3 tristanc 120
	ClientServices_SetMessageHandlerPtr(msgID,handler,param);
121
}
122
 
123
//===========================================================================
124
void ClientServices_ClearMessageHandler (NETMESSAGE msgID) {
125
	ClientServices_ClearMessageHandlerPtr(msgID);
126
}