Subversion Repositories WoWGM

Rev

Rev 28 | Rev 32 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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