Subversion Repositories WoWGM

Rev

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

Rev 7 Rev 31
Line 12... Line 12...
12
CVar* g_password = NULL;
12
CVar* g_password = NULL;
13
 
13
 
14
 
14
 
15
/****************************************************************************
15
/****************************************************************************
16
*
16
*
17
*	 Memory addresses
17
*   Client memory addresses
18
*
18
*
19
***/
19
***/
20
 
20
 
21
#define  CGLUEMGR_NETDISCONNECTHANDLER	0x004DA9D0
21
#define  CGLUEMGR_NETDISCONNECTHANDLER  0x004DA9D0
22
#define  CGLUEMGR__RESUME				0x004DA5F0
22
#define  CGLUEMGR__RESUME               0x004DA5F0
23
#define  CGLUEMGR__SUSPEND				0x004D8930
23
#define  CGLUEMGR__SUSPEND              0x004D8930
24
#define  CGLUEMGR__SHUTDOWN				0x004DBBC0
24
#define  CGLUEMGR__SHUTDOWN             0x004DBBC0
25
 
25
 
26
 
26
 
27
/****************************************************************************
27
/****************************************************************************
28
*
28
*
29
*	 Function pointers
29
*   Client function pointers
30
*
30
*
31
***/
31
***/
32
 
32
 
33
void (*NetDisconnectHandlerPtr) (void const *, void *) = *(void(*)(void const *, void *))CGLUEMGR_NETDISCONNECTHANDLER;
33
void (*NetDisconnectHandlerPtr)(void const*,void*) = *(void(*)(void const*,void*))CGLUEMGR_NETDISCONNECTHANDLER;
-
 
34
 
34
void (__cdecl* ResumePtr) (int unknown) = *(void (__cdecl*)(int))CGLUEMGR__RESUME;
35
void (*ResumePtr)(int) = *(void (*)(int))CGLUEMGR__RESUME;
-
 
36
 
35
void (__cdecl* SuspendPtr) () = *(void (__cdecl*)())CGLUEMGR__SUSPEND;
37
void (*SuspendPtr)() = *(void (*)())CGLUEMGR__SUSPEND;
-
 
38
 
36
void (__cdecl* ShutdownPtr) () = *(void (__cdecl*)())CGLUEMGR__SHUTDOWN;
39
void (*ShutdownPtr)() = *(void (*)())CGLUEMGR__SHUTDOWN;
37
 
40
 
38
 
41
 
39
/****************************************************************************
42
/****************************************************************************
40
*
43
*
41
*	 Detours setup
44
*   Detours setup
42
*
45
*
43
***/
46
***/
44
 
47
 
45
//===========================================================================
48
//===========================================================================
46
void WowGM::CGlueMgr::Initialize () {
49
void WowGM::CGlueMgr::Initialize () {
Line 77... Line 80...
77
}
80
}
78
 
81
 
79
 
82
 
80
/****************************************************************************
83
/****************************************************************************
81
*
84
*
82
*	Commands
85
*   Console commands and scripts
83
*
86
*
84
***/
87
***/
85
 
88
 
86
//===========================================================================
89
//===========================================================================
87
int __cdecl CCommand_Script2 (const char* cmd,
90
int CCommand_Script2 (const char* cmd, char const* arguments) {
88
																 const char* arguments) {
-
 
89
	FrameScript_Execute(arguments, arguments, NULL);
91
	FrameScript_Execute(arguments, arguments, NULL);
90
	return 0;
92
	return 0;
91
}
93
}
92
 
94
 
-
 
95
//===========================================================================
93
int __cdecl CCommand_MoveCharacter (const char* command, const char* arguments) {
96
int CCommand_MoveCharacter (const char* command, const char* arguments) {
94
  if ((*(int*)0x00B6A9E0)) {  // CGlueMgr::m_currentScreen == 2
97
  if ((*(int*)0x00B6A9E0)) {  // CGlueMgr::m_currentScreen == 2
95
    int characterIndex = (*(int*)0x00AC436C); //CCharacterSelection::s_selectionIndex
98
    int characterIndex = (*(int*)0x00AC436C); //CCharacterSelection::s_selectionIndex
96
    int numCharacters = (*(int*)0x00B6B23C);
99
    int numCharacters = (*(int*)0x00B6B23C);
97
    int sumtingwong = (*(int*)0xB6B240);
100
    int sumtingwong = (*(int*)0xB6B240);
98
 
101
 
Line 118... Line 121...
118
 
121
 
119
  return 0;
122
  return 0;
120
}
123
}
121
 
124
 
122
//===========================================================================
125
//===========================================================================
123
int __cdecl Script_DebugTest (lua_State* L) {
126
int Script_DebugTest (lua_State* L) {
124
	ConsoleWrite("Hello from Script_DebugTest!",DEFAULT_COLOR);
127
	ConsoleWrite("Hello from Script_DebugTest!",DEFAULT_COLOR);
125
	return TRUE;
128
	return TRUE;
126
}
129
}
127
 
130
 
128
 
131
 
129
/****************************************************************************
132
/****************************************************************************
130
*
133
*
131
*	CGlueMgr class implementation
134
*   CGlueMgr class implementation
132
*
135
*
133
***/
136
***/
134
 
137
 
135
//===========================================================================
138
//===========================================================================
136
int CGlueMgr::NetDisconnectHandler(void const *a1, void *a2) {
139
int CGlueMgr::NetDisconnectHandler (void const *a1, void *a2) {
137
	NetDisconnectHandlerPtr(a1, a2);
140
	NetDisconnectHandlerPtr(a1, a2);
138
	WowGM::CGlueMgr::SetLoginPassword();
141
	WowGM::CGlueMgr::SetLoginPassword();
139
	return 1;
142
	return 1;
140
}
143
}
141
 
144
 
142
//===========================================================================
145
//===========================================================================
143
void __cdecl CGlueMgr::Resume (int initialized) {
146
void CGlueMgr::Resume (int initialized) {
144
	ResumePtr(initialized);
147
	ResumePtr(initialized);
145
	RegisterConsoleCommands();
148
	RegisterConsoleCommands();
146
}
149
}
147
 
150
 
148
//===========================================================================
151
//===========================================================================
149
void WowGM::CGlueMgr::SetLoginPassword()
152
void WowGM::CGlueMgr::SetLoginPassword() {
150
{
-
 
151
	char command[256] = {};
153
	char command[256] = {};
152
 
154
 
153
	// TODO: Call SStrPrintF here
155
	// TODO: Call SStrPrintF here
154
	sprintf_s(command,
156
	sprintf_s(command,
155
		sizeof(command),
157
		sizeof(command),
Line 157... Line 159...
157
		g_password->m_stringValue.m_string);
159
		g_password->m_stringValue.m_string);
158
	FrameScript_Execute(command,command,NULL);
160
	FrameScript_Execute(command,command,NULL);
159
}
161
}
160
 
162
 
161
//===========================================================================
163
//===========================================================================
162
void __cdecl CGlueMgr::Suspend () {
164
void CGlueMgr::Suspend () {
163
	SuspendPtr();
165
	SuspendPtr();
164
	UnregisterConsoleCommands();
166
	UnregisterConsoleCommands();
165
}
167
}
166
 
168
 
167
//===========================================================================
169
//===========================================================================
168
void __cdecl CGlueMgr::Shutdown () {
170
void CGlueMgr::Shutdown () {
169
	ShutdownPtr();
171
	ShutdownPtr();
170
}
172
}
171
 
173
 
172
//===========================================================================
174
//===========================================================================
173
void __cdecl CGlueMgr::RegisterConsoleCommands()
175
void CGlueMgr::RegisterConsoleCommands ()  {
174
{
-
 
175
	ConsoleCommandRegister("script", CCommand_Script2, DEFAULT, 0);
176
	ConsoleCommandRegister("script", CCommand_Script2, DEFAULT, 0);
176
  ConsoleCommandRegister("movecharacter", CCommand_MoveCharacter, GAME, NOHELP);
177
  ConsoleCommandRegister("movecharacter", CCommand_MoveCharacter, GAME, NOHELP);
177
  ConsoleCommandRegister("worldport", CCommand_MoveCharacter, GAME, NOHELP);
178
  ConsoleCommandRegister("worldport", CCommand_MoveCharacter, GAME, NOHELP);
178
 
179
 
179
	// TODO: Move the below line under FrameScript.cpp (see FrameScript_Initialize)
180
	// TODO: Move the below line under FrameScript.cpp (see FrameScript_Initialize)
180
	//ConsoleCommandRegister("signalevent", CCommand_SignalEvent, DEFAULT, 0);
181
	//ConsoleCommandRegister("signalevent", CCommand_SignalEvent, DEFAULT, 0);
181
	FrameScript_RegisterFunction("debugtest",Script_DebugTest);
182
	FrameScript_RegisterFunction("debugtest",Script_DebugTest);
182
}
183
}
183
 
184
 
184
//===========================================================================
185
//===========================================================================
185
void __cdecl CGlueMgr::UnregisterConsoleCommands() {
186
void CGlueMgr::UnregisterConsoleCommands () {
186
	ConsoleCommandUnregister("script");
187
	ConsoleCommandUnregister("script");
187
  ConsoleCommandUnregister("movecharacter");
188
  ConsoleCommandUnregister("movecharacter");
188
  ConsoleCommandUnregister("worldport");
189
  ConsoleCommandUnregister("worldport");
189
 
190
 
190
	//ConsoleCommandUnregister("signalevent");
191
	//ConsoleCommandUnregister("signalevent");