Subversion Repositories WoWGM

Rev

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

Rev 3 Rev 7
Line 4... Line 4...
4
#include "CGlueMgr.h"
4
#include "CGlueMgr.h"
5
#include <Engine/Base/CDataStore.h>
5
#include <Engine/Base/CDataStore.h>
6
#include <Console/ConsoleClient.h>
6
#include <Console/ConsoleClient.h>
7
#include <FrameScript/FrameScript.h>
7
#include <FrameScript/FrameScript.h>
8
#include <WowSvcs/ClientServices.h>
8
#include <WowSvcs/ClientServices.h>
-
 
9
#include <DB/WowClientDB.h>
-
 
10
 
-
 
11
 
-
 
12
CVar* g_password = NULL;
-
 
13
 
9
 
14
 
10
/****************************************************************************
15
/****************************************************************************
11
*
16
*
12
*	 Memory addresses
17
*	 Memory addresses
13
*
18
*
14
***/
19
***/
15
 
20
 
-
 
21
#define  CGLUEMGR_NETDISCONNECTHANDLER	0x004DA9D0
16
#define  CGLUEMGR__RESUME										0x004DA5F0
22
#define  CGLUEMGR__RESUME				0x004DA5F0
17
#define  CGLUEMGR__SUSPEND										0x004D8930
23
#define  CGLUEMGR__SUSPEND				0x004D8930
18
#define  CGLUEMGR__SHUTDOWN										0x004DBBC0
24
#define  CGLUEMGR__SHUTDOWN				0x004DBBC0
19
 
25
 
20
 
26
 
21
/****************************************************************************
27
/****************************************************************************
22
*
28
*
23
*	 Function pointers
29
*	 Function pointers
24
*
30
*
25
***/
31
***/
26
 
32
 
-
 
33
void (*NetDisconnectHandlerPtr) (void const *, void *) = *(void(*)(void const *, void *))CGLUEMGR_NETDISCONNECTHANDLER;
27
void (__cdecl* ResumePtr) (int unknown) = *(void (__cdecl*)(int))CGLUEMGR__RESUME;
34
void (__cdecl* ResumePtr) (int unknown) = *(void (__cdecl*)(int))CGLUEMGR__RESUME;
28
void (__cdecl* SuspendPtr) () = *(void (__cdecl*)())CGLUEMGR__SUSPEND;
35
void (__cdecl* SuspendPtr) () = *(void (__cdecl*)())CGLUEMGR__SUSPEND;
29
void (__cdecl* ShutdownPtr) () = *(void (__cdecl*)())CGLUEMGR__SHUTDOWN;
36
void (__cdecl* ShutdownPtr) () = *(void (__cdecl*)())CGLUEMGR__SHUTDOWN;
30
 
37
 
31
 
38
 
Line 37... Line 44...
37
 
44
 
38
//===========================================================================
45
//===========================================================================
39
void WowGM::CGlueMgr::Initialize () {
46
void WowGM::CGlueMgr::Initialize () {
40
	DETOUR_INIT;
47
	DETOUR_INIT;
41
 
48
 
-
 
49
	DETOUR_ATTACH(NetDisconnectHandlerPtr,::CGlueMgr::NetDisconnectHandler);
42
	DETOUR_ATTACH(ResumePtr,::CGlueMgr::Resume);
50
	DETOUR_ATTACH(ResumePtr,::CGlueMgr::Resume);
43
	DETOUR_ATTACH(SuspendPtr,::CGlueMgr::Suspend);
51
	DETOUR_ATTACH(SuspendPtr,::CGlueMgr::Suspend);
44
	DETOUR_ATTACH(ShutdownPtr,::CGlueMgr::Shutdown);
52
	DETOUR_ATTACH(ShutdownPtr,::CGlueMgr::Shutdown);
45
	
53
	
46
	DETOUR_COMMIT;
54
	DETOUR_COMMIT;
Line 48... Line 56...
48
 
56
 
49
//===========================================================================
57
//===========================================================================
50
void WowGM::CGlueMgr::Shutdown () {
58
void WowGM::CGlueMgr::Shutdown () {
51
	DETOUR_INIT;
59
	DETOUR_INIT;
52
 
60
 
-
 
61
	DETOUR_DETACH(NetDisconnectHandlerPtr,::CGlueMgr::NetDisconnectHandler);
53
	DETOUR_DETACH(ResumePtr,::CGlueMgr::Resume);
62
	DETOUR_DETACH(ResumePtr,::CGlueMgr::Resume);
54
	DETOUR_DETACH(SuspendPtr,::CGlueMgr::Suspend);
63
	DETOUR_DETACH(SuspendPtr,::CGlueMgr::Suspend);
55
	DETOUR_DETACH(ShutdownPtr,::CGlueMgr::Shutdown);
64
	DETOUR_DETACH(ShutdownPtr,::CGlueMgr::Shutdown);
56
	
65
	
57
	DETOUR_COMMIT;
66
	DETOUR_COMMIT;
Line 110... Line 119...
110
  return 0;
119
  return 0;
111
}
120
}
112
 
121
 
113
//===========================================================================
122
//===========================================================================
114
int __cdecl Script_DebugTest (lua_State* L) {
123
int __cdecl Script_DebugTest (lua_State* L) {
115
	ConsoleWrite("Hello from Script_DebugTest!",ADMIN_COLOR);
124
	ConsoleWrite("Hello from Script_DebugTest!",DEFAULT_COLOR);
116
	return TRUE;
125
	return TRUE;
117
}
126
}
118
 
127
 
119
 
128
 
120
/****************************************************************************
129
/****************************************************************************
Line 122... Line 131...
122
*	CGlueMgr class implementation
131
*	CGlueMgr class implementation
123
*
132
*
124
***/
133
***/
125
 
134
 
126
//===========================================================================
135
//===========================================================================
-
 
136
int CGlueMgr::NetDisconnectHandler(void const *a1, void *a2) {
-
 
137
	NetDisconnectHandlerPtr(a1, a2);
-
 
138
	WowGM::CGlueMgr::SetLoginPassword();
-
 
139
	return 1;
-
 
140
}
-
 
141
 
-
 
142
//===========================================================================
127
void __cdecl CGlueMgr::Resume (int initialized) {
143
void __cdecl CGlueMgr::Resume (int initialized) {
128
	ResumePtr(initialized);
144
	ResumePtr(initialized);
129
	RegisterConsoleCommands();
145
	RegisterConsoleCommands();
130
}
146
}
131
 
147
 
132
//===========================================================================
148
//===========================================================================
-
 
149
void WowGM::CGlueMgr::SetLoginPassword()
-
 
150
{
-
 
151
	char command[256] = {};
-
 
152
 
-
 
153
	// TODO: Call SStrPrintF here
-
 
154
	sprintf_s(command,
-
 
155
		sizeof(command),
-
 
156
		"AccountLoginPasswordEdit:SetText(\"%s\")",
-
 
157
		g_password->m_stringValue.m_string);
-
 
158
	FrameScript_Execute(command,command,NULL);
-
 
159
}
-
 
160
 
-
 
161
//===========================================================================
133
void __cdecl CGlueMgr::Suspend () {
162
void __cdecl CGlueMgr::Suspend () {
134
	SuspendPtr();
163
	SuspendPtr();
135
	UnregisterConsoleCommands();
164
	UnregisterConsoleCommands();
136
}
165
}
137
 
166