Subversion Repositories WoWGM

Rev

Rev 32 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32 Rev 36
Line 10... Line 10...
10
 
10
 
11
 
11
 
12
CVar* g_password = NULL;
12
CVar* g_password = NULL;
13
 
13
 
14
 
14
 
15
/****************************************************************************
15
/******************************************************************************
16
*
16
*
17
*   Client memory addresses
17
*   Client memory addresses
18
*
18
*
19
***/
19
***/
20
 
20
 
Line 22... Line 22...
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
*   Client function pointers
29
*   Client function pointers
30
*
30
*
31
***/
31
***/
32
 
32
 
Line 37... Line 37...
37
void (*SuspendPtr)() = *(void (*)())CGLUEMGR__SUSPEND;
37
void (*SuspendPtr)() = *(void (*)())CGLUEMGR__SUSPEND;
38
 
38
 
39
void (*ShutdownPtr)() = *(void (*)())CGLUEMGR__SHUTDOWN;
39
void (*ShutdownPtr)() = *(void (*)())CGLUEMGR__SHUTDOWN;
40
 
40
 
41
 
41
 
42
/****************************************************************************
42
/******************************************************************************
43
*
43
*
44
*   Detours setup
44
*   Detours setup
45
*
45
*
46
***/
46
***/
47
 
47
 
48
//===========================================================================
48
//=============================================================================
49
void WowGM::CGlueMgr::Shutdown () {
49
void WowGM::CGlueMgr::Shutdown () {
50
	DETOUR_INIT;
50
	DETOUR_INIT;
51
 
51
 
52
	DETOUR_DETACH(NetDisconnectHandlerPtr,::CGlueMgr::NetDisconnectHandler);
52
	DETOUR_DETACH(NetDisconnectHandlerPtr,::CGlueMgr::NetDisconnectHandler);
53
	DETOUR_DETACH(ResumePtr,::CGlueMgr::Resume);
53
	DETOUR_DETACH(ResumePtr,::CGlueMgr::Resume);
Line 55... Line 55...
55
	DETOUR_DETACH(ShutdownPtr,::CGlueMgr::Shutdown);
55
	DETOUR_DETACH(ShutdownPtr,::CGlueMgr::Shutdown);
56
	
56
	
57
	DETOUR_COMMIT;
57
	DETOUR_COMMIT;
58
}
58
}
59
 
59
 
60
//===========================================================================
60
//=============================================================================
61
void WowGM::CGlueMgr::RegisterConsoleCommands () {
61
void WowGM::CGlueMgr::RegisterConsoleCommands () {
62
	::CGlueMgr::RegisterConsoleCommands();
62
	::CGlueMgr::RegisterConsoleCommands();
63
}
63
}
64
 
64
 
65
//===========================================================================
65
//=============================================================================
66
void WowGM::CGlueMgr::UnregisterConsoleCommands () {
66
void WowGM::CGlueMgr::UnregisterConsoleCommands () {
67
	::CGlueMgr::UnregisterConsoleCommands();
67
	::CGlueMgr::UnregisterConsoleCommands();
68
}
68
}
69
 
69
 
70
 
70
 
71
/****************************************************************************
71
/******************************************************************************
72
*
72
*
73
*   Console commands and scripts
73
*   Console commands and scripts
74
*
74
*
75
***/
75
***/
76
 
76
 
77
//===========================================================================
77
//=============================================================================
78
int CCommand_Script2 (char const* cmd, char const* arguments) {
78
int CCommand_Script2 (char const* cmd, char const* arguments) {
79
	FrameScript_Execute(arguments, arguments, NULL);
79
	FrameScript_Execute(arguments, arguments, NULL);
80
	return 0;
80
	return 0;
81
}
81
}
82
 
82
 
83
//===========================================================================
83
//=============================================================================
84
int CCommand_MoveCharacter (char const* command, char const* arguments) {
84
int CCommand_MoveCharacter (char const* command, char const* arguments) {
85
  if ((*(int*)0x00B6A9E0)) {  // CGlueMgr::m_currentScreen == 2
85
  if ((*(int*)0x00B6A9E0)) {  // CGlueMgr::m_currentScreen == 2
86
    int characterIndex = (*(int*)0x00AC436C); //CCharacterSelection::s_selectionIndex
86
    int characterIndex = (*(int*)0x00AC436C); //CCharacterSelection::s_selectionIndex
87
    int numCharacters = (*(int*)0x00B6B23C);
87
    int numCharacters = (*(int*)0x00B6B23C);
88
    int sumtingwong = (*(int*)0xB6B240);
88
    int sumtingwong = (*(int*)0xB6B240);
Line 109... Line 109...
109
    ConsoleWrite("You can only use this command on the character selection screen", ERROR_COLOR);
109
    ConsoleWrite("You can only use this command on the character selection screen", ERROR_COLOR);
110
 
110
 
111
  return 0;
111
  return 0;
112
}
112
}
113
 
113
 
114
//===========================================================================
114
//=============================================================================
115
int Script_DebugTest (lua_State* L) {
115
int Script_DebugTest (lua_State* L) {
116
	ConsoleWrite("Hello from Script_DebugTest!",DEFAULT_COLOR);
116
	ConsoleWrite("Hello from Script_DebugTest!",DEFAULT_COLOR);
117
	return TRUE;
117
	return TRUE;
118
}
118
}
119
 
119
 
120
 
120
 
121
/****************************************************************************
121
/******************************************************************************
122
*
122
*
123
*   CGlueMgr class implementation
123
*   CGlueMgr class implementation
124
*
124
*
125
***/
125
***/
126
 
126
 
127
//===========================================================================
127
//=============================================================================
128
void CGlueMgr::Initialize () {
128
void CGlueMgr::Initialize () {
129
  DETOUR_INIT;
129
  DETOUR_INIT;
130
  DETOUR_ATTACH(NetDisconnectHandlerPtr,CGlueMgr::NetDisconnectHandler);
130
  DETOUR_ATTACH(NetDisconnectHandlerPtr,CGlueMgr::NetDisconnectHandler);
131
  DETOUR_ATTACH(ResumePtr,CGlueMgr::Resume);
131
  DETOUR_ATTACH(ResumePtr,CGlueMgr::Resume);
132
  DETOUR_ATTACH(SuspendPtr,CGlueMgr::Suspend);
132
  DETOUR_ATTACH(SuspendPtr,CGlueMgr::Suspend);
133
  DETOUR_ATTACH(ShutdownPtr,CGlueMgr::Shutdown);
133
  DETOUR_ATTACH(ShutdownPtr,CGlueMgr::Shutdown);
134
  DETOUR_COMMIT;
134
  DETOUR_COMMIT;
135
}
135
}
136
 
136
 
137
//===========================================================================
137
//=============================================================================
138
int CGlueMgr::NetDisconnectHandler (void const* a1, void* a2) {
138
int CGlueMgr::NetDisconnectHandler (void const* a1, void* a2) {
139
	NetDisconnectHandlerPtr(a1, a2);
139
	NetDisconnectHandlerPtr(a1, a2);
140
	WowGM::CGlueMgr::SetLoginPassword();
140
	WowGM::CGlueMgr::SetLoginPassword();
141
	return 1;
141
	return 1;
142
}
142
}
143
 
143
 
144
//===========================================================================
144
//=============================================================================
145
void CGlueMgr::Resume (int initialized) {
145
void CGlueMgr::Resume (int initialized) {
146
	ResumePtr(initialized);
146
	ResumePtr(initialized);
147
	RegisterConsoleCommands();
147
	RegisterConsoleCommands();
148
}
148
}
149
 
149
 
150
//===========================================================================
150
//=============================================================================
151
void WowGM::CGlueMgr::SetLoginPassword () {
151
void WowGM::CGlueMgr::SetLoginPassword () {
152
	char command[256] = {};
152
	char command[256] = {};
153
 
153
 
154
	// TODO: Call SStrPrintF here
154
	// TODO: Call SStrPrintF here
155
	sprintf_s(command,
155
	sprintf_s(command,
Line 158... Line 158...
158
						g_password->m_stringValue.m_string);
158
						g_password->m_stringValue.m_string);
159
 
159
 
160
	FrameScript_Execute(command,command,NULL);
160
	FrameScript_Execute(command,command,NULL);
161
}
161
}
162
 
162
 
163
//===========================================================================
163
//=============================================================================
164
void CGlueMgr::Suspend () {
164
void CGlueMgr::Suspend () {
165
	SuspendPtr();
165
	SuspendPtr();
166
	UnregisterConsoleCommands();
166
	UnregisterConsoleCommands();
167
}
167
}
168
 
168
 
169
//===========================================================================
169
//=============================================================================
170
void CGlueMgr::Shutdown () {
170
void CGlueMgr::Shutdown () {
171
	ShutdownPtr();
171
	ShutdownPtr();
172
}
172
}
173
 
173
 
174
//===========================================================================
174
//=============================================================================
175
void CGlueMgr::RegisterConsoleCommands ()  {
175
void CGlueMgr::RegisterConsoleCommands ()  {
176
	ConsoleCommandRegister("script", CCommand_Script2, DEFAULT, 0);
176
	ConsoleCommandRegister("script", CCommand_Script2, DEFAULT, 0);
177
  ConsoleCommandRegister("movecharacter", CCommand_MoveCharacter, GAME, NOHELP);
177
  ConsoleCommandRegister("movecharacter", CCommand_MoveCharacter, GAME, NOHELP);
178
  ConsoleCommandRegister("worldport", CCommand_MoveCharacter, GAME, NOHELP);
178
  ConsoleCommandRegister("worldport", CCommand_MoveCharacter, GAME, NOHELP);
179
 
179
 
180
	// TODO: Move the below line under FrameScript.cpp (see FrameScript_Initialize)
180
	// TODO: Move the below line under FrameScript.cpp (see FrameScript_Initialize)
181
	//ConsoleCommandRegister("signalevent", CCommand_SignalEvent, DEFAULT, 0);
181
	//ConsoleCommandRegister("signalevent", CCommand_SignalEvent, DEFAULT, 0);
182
	FrameScript_RegisterFunction("debugtest",Script_DebugTest);
182
	FrameScript_RegisterFunction("debugtest",Script_DebugTest);
183
}
183
}
184
 
184
 
185
//===========================================================================
185
//=============================================================================
186
void CGlueMgr::UnregisterConsoleCommands () {
186
void CGlueMgr::UnregisterConsoleCommands () {
187
	ConsoleCommandUnregister("script");
187
	ConsoleCommandUnregister("script");
188
  ConsoleCommandUnregister("movecharacter");
188
  ConsoleCommandUnregister("movecharacter");
189
  ConsoleCommandUnregister("worldport");
189
  ConsoleCommandUnregister("worldport");
190
 
190