Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuck Therebelos <snares@users.sourceforge.net>2009-12-04 23:36:09 +0300
committerTuck Therebelos <snares@users.sourceforge.net>2009-12-04 23:36:32 +0300
commite77beae648db6e570ea3331f6468ca12de7d42a4 (patch)
treee5b48746ede2b9e352b9c0673baaf8c44fb90a73 /plugins/dys
parentacb7642f45e3dcead1cfd8448457ce433b3f0bbd (diff)
AOC, CSS string updates; Dys, Insurgenccy, TF2 IP:Port context support. DODS IP:Port+Team context support; CoD4 context fix; Manual plugin shortname fix
Diffstat (limited to 'plugins/dys')
-rw-r--r--plugins/dys/dys.cpp116
1 files changed, 73 insertions, 43 deletions
diff --git a/plugins/dys/dys.cpp b/plugins/dys/dys.cpp
index d969ac326..ef0cedcd6 100644
--- a/plugins/dys/dys.cpp
+++ b/plugins/dys/dys.cpp
@@ -2,16 +2,21 @@
#include <stdlib.h>
#include <windows.h>
#include <tlhelp32.h>
+#include <string>
+#include <sstream>
#define _USE_MATH_DEFINES
#include <math.h>
#include "../mumble_plugin.h"
+using namespace std;
+
HANDLE h;
BYTE *posptr;
BYTE *rotptr;
BYTE *stateptr;
+BYTE *hostptr;
static DWORD getProcess(const wchar_t *exename) {
PROCESSENTRY32 pe;
@@ -93,6 +98,56 @@ static bool calcout(float *pos, float *rot, float *opos, float *front, float *to
return true;
}
+static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, string &context, wstring &identity) {
+ for (int i=0;i<3;i++)
+ avatar_pos[i] = avatar_front[i] = avatar_top[i] = 0;
+
+ float ipos[3], rot[3];
+ bool ok;
+ char state;
+ char chHostStr[40];
+ wostringstream new_identity;
+ ostringstream new_context;
+
+ ok = peekProc(posptr, ipos, 12) &&
+ peekProc(rotptr, rot, 12) &&
+ peekProc(stateptr, &state, 1) &&
+ peekProc(hostptr, chHostStr, 40);
+ if (!ok)
+ return false;
+ chHostStr[39] = 0;
+
+ new_context << "<context>"
+ << "<game>dys</game>"
+ << "<hostport>" << chHostStr << "</hostport>"
+ << "</context>";
+ context = new_context.str();
+
+ /* TODO
+ new_identity << "<identity>"
+ << "<name>" << "SAS" << "</name>"
+ << "</identity>";
+ identity = new_identity.str(); */
+
+ // Check to see if you are spawned
+ if (state == 0 || state == 2)
+ return true; // Deactivate plugin
+
+ if (ok) {
+ int res = calcout(ipos, rot, avatar_pos, avatar_front, avatar_top);
+ if (res) {
+ for (int i=0;i<3;++i) {
+ camera_pos[i] = avatar_pos[i];
+ camera_front[i] = avatar_front[i];
+ camera_top[i] = avatar_top[i];
+ }
+ return res;
+ }
+ }
+
+ return false;
+}
+
static int trylock() {
h = NULL;
@@ -104,6 +159,10 @@ static int trylock() {
BYTE *mod=getModuleAddr(pid, L"client.dll");
if (!mod)
return false;
+ BYTE *mod=getModuleAddr(pid, L"client.dll");
+ if (!mod)
+ return false;
+
h=OpenProcess(PROCESS_VM_READ, false, pid);
if (!h)
return false;
@@ -114,25 +173,29 @@ static int trylock() {
orientation tuple: client.dll+0x423924 (v,h float)
ID string: client.dll+0x3c948e = "DysObjective@@" (14 characters, text)
spawn state: client.dll+0x3c6270 (0 when at main menu, 2 when not spawned, 6 when spawned, byte)
+ host string: engine.dll+0x3909c4 (ip:port zero-terminated string)
*/
- char sMagic[14];
- if (!peekProc(mod + 0x3c948e, sMagic, 14) || strncmp("DysObjective@@", sMagic, 14)!=0)
- return false;
// Remember addresses for later
posptr = mod + 0x423990;
rotptr = mod + 0x423924;
stateptr = mod + 0x3c6270;
+ hostptr = mod_engine + 0x3909c4;
- float pos[3];
- float rot[3];
- float opos[3], top[3], front[3];
+ //Gamecheck
+ char sMagic[14];
+ if (!peekProc(mod + 0x3c948e, sMagic, 14) || strncmp("DysObjective@@", sMagic, 14)!=0)
+ return false;
+
+ // Check if we can get meaningful data from it
+ float apos[3], afront[3], atop[3];
+ float cpos[3], cfront[3], ctop[3];
+ wstring sidentity;
+ string scontext;
- bool ok = peekProc(posptr, pos, 12) &&
- peekProc(rotptr, rot, 12);
+ if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity))
+ return true;
- if (ok)
- return calcout(pos, rot, opos, top, front);
// If it failed clean up
CloseHandle(h);
h = NULL;
@@ -147,39 +210,6 @@ static void unlock() {
return;
}
-static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &context, std::wstring &identity) {
- for (int i=0;i<3;i++)
- avatar_pos[i] = avatar_front[i] = avatar_top[i] = 0;
-
- float ipos[3], rot[3];
- bool ok;
- char state;
-
- ok = peekProc(posptr, ipos, 12) &&
- peekProc(rotptr, rot, 12) &&
- peekProc(stateptr, &state, 1);
- if (!ok)
- return false;
-
- // Check to see if you are spawned
- if (state == 0 || state == 2)
- return true; // Deactivate plugin
-
- if (ok) {
- int res = calcout(ipos, rot, avatar_pos, avatar_front, avatar_top);
- if (res) {
- for (int i=0;i<3;++i) {
- camera_pos[i] = avatar_pos[i];
- camera_front[i] = avatar_front[i];
- camera_top[i] = avatar_top[i];
- }
- return res;
- }
- }
-
- return false;
-}
-
static const std::wstring longdesc() {
return std::wstring(L"Supports Dystopia build 3945. No identity or context support yet.");
}