Subversion Repositories WoWGM

Rev

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