Subversion Repositories WoWGM

Rev

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

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