diff options
author | Stefan Hacker <dd0t@users.sourceforge.net> | 2013-01-12 00:11:32 +0400 |
---|---|---|
committer | Stefan Hacker <dd0t@users.sourceforge.net> | 2013-01-14 01:37:11 +0400 |
commit | 8678a0c37ed369fb1d65e75137f7b215940ba650 (patch) | |
tree | f6c5b8de4e50576fb60317810c0b39caa51e7db7 /plugins | |
parent | 8e790418fe936058a70d86efdbc8b3f213276e1d (diff) |
Introduce concept of NULL plugin to retract plugins.
* NULL plugins have a shortname of L"Retracted" which excludes them
from being listed as a plugin in Mumble >= 1.2.4
* NULL plugins are valid plugins that always return false on trylock
so Mumble <= 1.2.3 gets behavior close to what recent Mumble has.
* NULL css, dods, tf2 and hl2dm plugins as they have been replaced by link support in the source engine.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/css/css.cpp | 227 | ||||
-rw-r--r-- | plugins/css/css.pro | 5 | ||||
-rw-r--r-- | plugins/dods/dods.cpp | 202 | ||||
-rw-r--r-- | plugins/dods/dods.pro | 5 | ||||
-rw-r--r-- | plugins/hl2dm/hl2dm.cpp | 200 | ||||
-rw-r--r-- | plugins/hl2dm/hl2dm.pro | 3 | ||||
-rw-r--r-- | plugins/null_plugin.cpp | 69 | ||||
-rw-r--r-- | plugins/tf2/tf2.cpp | 199 | ||||
-rw-r--r-- | plugins/tf2/tf2.pro | 3 |
9 files changed, 77 insertions, 836 deletions
diff --git a/plugins/css/css.cpp b/plugins/css/css.cpp deleted file mode 100644 index 9c6bed63d..000000000 --- a/plugins/css/css.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/* Copyright (C) 2009-2012, Snares <snares@users.sourceforge.net> - Copyright (C) 2005-2012, Thorvald Natvig <thorvald@natvig.com> - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the Mumble Developers nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "../mumble_plugin_win32.h" - -using namespace std; - -BYTE *posptr; -BYTE *rotptr; -BYTE *serverstateptr; -BYTE *spawnstateptr; -BYTE *hostptr; -//BYTE *teamptr; - -static bool calcout(float *pos, float *rot, float *opos, float *front, float *top) { - float h = rot[0]; - float v = rot[1]; - - if ((v < -360.0f) || (v > 360.0f) || (h < -360.0f) || (h > 360.0f)) - return false; - - h *= static_cast<float>(M_PI / 180.0f); - v *= static_cast<float>(M_PI / 180.0f); - - // Seems CSS is in inches. INCHES?!? - opos[0] = pos[0] / 39.37f; - opos[1] = pos[2] / 39.37f; - opos[2] = pos[1] / 39.37f; - - front[0] = cos(v) * cos(h); - front[1] = -sin(h); - front[2] = sin(v) * cos(h); - - h -= static_cast<float>(M_PI / 2.0f); - - top[0] = cos(v) * cos(h); - top[1] = -sin(h); - top[2] = sin(v) * cos(h); - - 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 &) { - for (int i=0;i<3;i++) - avatar_pos[i] = avatar_front[i] = avatar_top[i] = camera_pos[i] = camera_front[i] = camera_top[i] = 0.0f; - - float ipos[3], rot[3]; - bool ok; - char serverstate; - char spawnstate; - char chHostStr[40]; - string sHost; - //BYTE bTeam; - //string sTeam; - wostringstream new_identity; - ostringstream new_context; - - ok = peekProc(posptr, ipos, 12) && - peekProc(rotptr, rot, 12) && - peekProc(serverstateptr, &serverstate, 1) && - peekProc(spawnstateptr, &spawnstate, 1) && - peekProc(hostptr, chHostStr, 40); //&& - //peekProc(teamptr, &bTeam, 1); - if (!ok) - return false; - - chHostStr[39] = 0; - - sHost.assign(chHostStr); - if (sHost.find(':')==string::npos) - sHost.append(":27015"); - - /* switch (bTeam) { - case 60: - sTeam = "Terrorists"; - break; - case 61: - sTeam = "Counter Terrorists"; - break; - default: - sTeam = "Unknown"; - break; - } - */ - - new_context << "<context>" - << "<game>css</game>" - << "<hostport>" << sHost << "</hostport>" - << "</context>"; - context = new_context.str(); - - //<< "<team>" << sTeam << "</team>" - - /* TODO - new_identity << "<identity>" - << "<name>" << "SAS" << "</name>" - << "</identity>"; - identity = new_identity.str(); */ - - // Check to see if you are in a server and spawned - if (serverstate == 0 || spawnstate == 1) - return true; // Deactivate plugin - - ok = calcout(ipos, rot, avatar_pos, avatar_front, avatar_top); - if (ok) { - 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 true; - } - - return false; -} - -static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) { - posptr = rotptr = NULL; - - if (! initialize(pids, L"hl2.exe", L"client.dll")) - return false; - - BYTE *mod_engine=getModuleAddr(L"engine.dll"); - if (!mod_engine) - return false; - - // Check if we really have CSS running - /* - position tuple: client.dll+0x00709148 (x,y,z, float) - orientation tuple: client.dll+0x007090BC (v,h float) - ID string: client.dll+0x0070A06D = "CSSpectatorGUI@@" (16 characters, text) - server state: engine.dll+0x00397C2C (0 in main menu or loading screen, 1 when fully in-game) - spawn state: client.dll+0x0077C5F0 (0 when alive, 1 when observering or dead) - ip:port string engine.dll+0x0042C94C (zero terminated ip:port, string) - team state: client.dll+0x3aa133 (60 when T, 61 when CT, byte) - */ - // Remember addresses for later - posptr = pModule + 0x00709148; - rotptr = pModule + 0x007090BC; - serverstateptr = mod_engine + 0x00397C2C; - spawnstateptr = pModule + 0x0077C5F0; - hostptr = mod_engine + 0x0042C94C; - //teamptr = pModule + 0x3aa133; - - //Gamecheck - char sMagic[16]; - if (!peekProc(pModule + 0x0070A06D, sMagic, 16) || strncmp("CSSpectatorGUI@@", sMagic, 16)!=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; - - if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) { - return true; - } else { - generic_unlock(); - return false; - } -} - -static const std::wstring longdesc() { - return std::wstring(L"Supports CSS build 5066. No identity support yet."); -} - -static std::wstring description(L"Counter-Strike: Source (Build 5066)"); -static std::wstring shortname(L"Counter-Strike: Source"); - -static int trylock1() { - return trylock(std::multimap<std::wstring, unsigned long long int>()); -} - -static MumblePlugin cssplug = { - MUMBLE_PLUGIN_MAGIC, - description, - shortname, - NULL, - NULL, - trylock1, - generic_unlock, - longdesc, - fetch -}; - -static MumblePlugin2 cssplug2 = { - MUMBLE_PLUGIN_MAGIC_2, - MUMBLE_PLUGIN_VERSION, - trylock -}; - -extern "C" __declspec(dllexport) MumblePlugin *getMumblePlugin() { - return &cssplug; -} - -extern "C" __declspec(dllexport) MumblePlugin2 *getMumblePlugin2() { - return &cssplug2; -} diff --git a/plugins/css/css.pro b/plugins/css/css.pro index 7623526b3..fca92e1bc 100644 --- a/plugins/css/css.pro +++ b/plugins/css/css.pro @@ -1,7 +1,6 @@ include(../plugins.pri) +DEFINES += "NULL_DESC=\"L\\\"CounterStrike : Source (Retracted, now using link)\\\"\"" TARGET = css -SOURCES = css.cpp +SOURCES = ../null_plugin.cpp LIBS += -luser32 - - diff --git a/plugins/dods/dods.cpp b/plugins/dods/dods.cpp deleted file mode 100644 index 16920f3cd..000000000 --- a/plugins/dods/dods.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* Copyright (C) 2009-2012, Snares <snares@users.sourceforge.net> - Copyright (C) 2005-2012, Thorvald Natvig <thorvald@natvig.com> - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the Mumble Developers nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "../mumble_plugin_win32.h" - -using namespace std; - -BYTE *posptr; -BYTE *rotptr; -BYTE *stateptr; -BYTE *hostptr; - -static bool calcout(float *pos, float *rot, float *opos, float *front, float *top) { - float h = rot[0]; - float v = rot[1]; - - if ((v < -360.0f) || (v > 360.0f) || (h < -360.0f) || (h > 360.0f)) - return false; - - h *= static_cast<float>(M_PI / 180.0f); - v *= static_cast<float>(M_PI / 180.0f); - - // Seems DODS is in inches. INCHES?!? - opos[0] = pos[0] / 39.37f; - opos[1] = pos[2] / 39.37f; - opos[2] = pos[1] / 39.37f; - - front[0] = cos(v) * cos(h); - front[1] = -sin(h); - front[2] = sin(v) * cos(h); - - h -= static_cast<float>(M_PI / 2.0f); - - top[0] = cos(v) * cos(h); - top[1] = -sin(h); - top[2] = sin(v) * cos(h); - - 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 &) { - for (int i=0;i<3;i++) - avatar_pos[i] = avatar_front[i] = avatar_top[i] = camera_pos[i] = camera_front[i] = camera_top[i] = 0.0f; - - float ipos[3], rot[3]; - bool ok; - char state; - char chHostStr[40]; - string sHost; - 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; - - sHost.assign(chHostStr); - if (sHost.find(':')==string::npos) - sHost.append(":27015"); - - new_context << "<context>" - << "<game>dods</game>" - << "<hostport>" << sHost << "</hostport>" - << "</context>"; - context = new_context.str(); - - /* TODO - new_identity << "<identity>" - << "<name>" << "SAS" << "</name>" - << "</identity>"; - identity = new_identity.str(); */ - - // Check to see if you are in a server - if (state == 0 || state == 1 || state == 2) - return true; // Deactivate plugin - - ok = calcout(ipos, rot, avatar_pos, avatar_front, avatar_top); - if (ok) { - 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 true; - } - - return false; -} - -static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) { - posptr = rotptr = NULL; - - if (! initialize(pids, L"hl2.exe", L"client.dll")) - return false; - - BYTE *mod_engine=getModuleAddr(L"engine.dll"); - if (!mod_engine) - return false; - - // Check if we really have DODS running - /* - position tuple: client.dll+0x3f62a0 (x,y,z, float) - orientation tuple: client.dll+0x3f6220 (v,h float) - ID string: client.dll+0x3f6d91 = "DODSpectatorGUI@@" (17 characters, text) - spawn state: client.dll+0x3e2b94 (0 when at main menu, 2 when at team selection menu or when not spawned, and between 5 and 6 when spawned, byte) - host string: client.dll+0x<address> (ip:port zero-terminated string) - */ - - // Remember addresses for later - posptr = pModule + 0x4183F8; - rotptr = pModule + 0x4183B8; - stateptr = pModule + 0x404C24; - hostptr = mod_engine + 0x3D3E94; - - // Gamecheck - char sMagic[17]; - if (!peekProc(pModule + 0x418ED1, sMagic, 17) || strncmp("DODSpectatorGUI@@", sMagic, 17)!=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; - - if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) { - return true; - } else { - generic_unlock(); - return false; - } -} - -static const std::wstring longdesc() { - return std::wstring(L"Supports DODS build 4426. No identity support yet."); -} - -static std::wstring description(L"Day of Defeat: Source (Build 4426)"); -static std::wstring shortname(L"Day of Defeat: Source"); - -static int trylock1() { - return trylock(std::multimap<std::wstring, unsigned long long int>()); -} - -static MumblePlugin dodsplug = { - MUMBLE_PLUGIN_MAGIC, - description, - shortname, - NULL, - NULL, - trylock1, - generic_unlock, - longdesc, - fetch -}; - -static MumblePlugin2 dodsplug2 = { - MUMBLE_PLUGIN_MAGIC_2, - MUMBLE_PLUGIN_VERSION, - trylock -}; - -extern "C" __declspec(dllexport) MumblePlugin *getMumblePlugin() { - return &dodsplug; -} - -extern "C" __declspec(dllexport) MumblePlugin2 *getMumblePlugin2() { - return &dodsplug2; -} diff --git a/plugins/dods/dods.pro b/plugins/dods/dods.pro index 2933d17f1..6651124c9 100644 --- a/plugins/dods/dods.pro +++ b/plugins/dods/dods.pro @@ -1,7 +1,6 @@ include(../plugins.pri) +DEFINES += "NULL_DESC=\"L\\\"Day of Defeat : Source (Retracted, now using link)\\\"\"" TARGET = dods -SOURCES = dods.cpp +SOURCES = ../null_plugin.cpp LIBS += -luser32 - - diff --git a/plugins/hl2dm/hl2dm.cpp b/plugins/hl2dm/hl2dm.cpp deleted file mode 100644 index 5dfbbec1e..000000000 --- a/plugins/hl2dm/hl2dm.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* Copyright (C) 2009-2012, Snares <snares@users.sourceforge.net> - Copyright (C) 2005-2012, Thorvald Natvig <thorvald@natvig.com> - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the Mumble Developers nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "../mumble_plugin_win32.h" - -using namespace std; - -BYTE *posptr; -BYTE *rotptr; -BYTE *stateptr; -BYTE *hostptr; - -static bool calcout(float *pos, float *rot, float *opos, float *front, float *top) { - float h = rot[0]; - float v = rot[1]; - - if ((v < -360.0f) || (v > 360.0f) || (h < -360.0f) || (h > 360.0f)) - return false; - - h *= static_cast<float>(M_PI / 180.0f); - v *= static_cast<float>(M_PI / 180.0f); - - // Seems HL2DM is in inches. INCHES?!? - opos[0] = pos[0] / 39.37f; - opos[1] = pos[2] / 39.37f; - opos[2] = pos[1] / 39.37f; - - front[0] = cos(v) * cos(h); - front[1] = -sin(h); - front[2] = sin(v) * cos(h); - - h -= static_cast<float>(M_PI / 2.0f); - - top[0] = cos(v) * cos(h); - top[1] = -sin(h); - top[2] = sin(v) * cos(h); - - 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 &) { - for (int i=0;i<3;i++) - avatar_pos[i] = avatar_front[i] = avatar_top[i] = camera_pos[i] = camera_front[i] = camera_top[i] = 0.0f; - - float ipos[3], rot[3]; - bool ok; - char state; - char chHostStr[40]; - string sHost; - 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; - - sHost.assign(chHostStr); - if (sHost.find(':')==string::npos) - sHost.append(":27015"); - - new_context << "<context>" - << "<game>hl2dm</game>" - << "<hostport>" << sHost << "</hostport>" - << "</context>"; - context = new_context.str(); - - /* TODO - new_identity << "<identity>" - << "<name>" << "Gordon Freeman" << "</name>" - << "</identity>"; - identity = new_identity.str(); */ - - // Check if the player is spawned - if (state == 0 || state == 2) - return true; // Deactivate plugin by leaving position as 0,0,0 - - if (calcout(ipos, rot, avatar_pos, avatar_front, avatar_top)) { - 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 true; - } - - return false; -} - -static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) { - posptr = rotptr = NULL; - - if (! initialize(pids, L"hl2.exe", L"client.dll")) - return false; - - BYTE *mod_engine=getModuleAddr(L"engine.dll"); - if (!mod_engine) - return false; - - // Check if we really have HL2DM running - /* - position tuple: client.dll+0x3dcad4 (x,y,z, float) - orientation tuple: client.dll+0x3dcae0 (v,h float) - ID string: client.dll+0x3a5674 = "Dm/$" (4 characters, text) - spawn state: client.dll+0x37e180 (0 when at main menu, 2 when not spawned, 7 when spawned, byte) - ip:port string engine.dll+0x3909c4 (zero terminated ip:port, string) - */ - // Remember addresses for later - posptr = pModule + 0x445820; - rotptr = pModule + 0x3F6E34; - stateptr = pModule + 0x3E3ACC; - hostptr = mod_engine + 0x383C8E; - - // Check if we are really running hl2dm - char sMagic[17]; - if (!peekProc(mod_engine + 0x3782D0, sMagic, 17) || strncmp(".?AVIEngineVGui@@", sMagic, 17) !=0) - return false; - - // Check if we can get meaningfull data from it - float apos[3], afront[3], atop[3]; - float cpos[3], cfront[3], ctop[3]; - wstring sidentity; - string scontext; - - if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) { - return true; - } else { - generic_unlock(); - return false; - } -} - -static const wstring longdesc() { - return wstring(L"Supports HL2DM build 4421. No identity support yet."); -} - -static wstring description(L"Half-Life 2: Deathmatch (Build 4421)"); -static wstring shortname(L"Half-Life 2: Deathmatch"); - -static int trylock1() { - return trylock(std::multimap<std::wstring, unsigned long long int>()); -} - -static MumblePlugin hl2dmplug = { - MUMBLE_PLUGIN_MAGIC, - description, - shortname, - NULL, - NULL, - trylock1, - generic_unlock, - longdesc, - fetch -}; - -static MumblePlugin2 hl2dmplug2 = { - MUMBLE_PLUGIN_MAGIC_2, - MUMBLE_PLUGIN_VERSION, - trylock -}; - -extern "C" __declspec(dllexport) MumblePlugin *getMumblePlugin() { - return &hl2dmplug; -} - -extern "C" __declspec(dllexport) MumblePlugin2 *getMumblePlugin2() { - return &hl2dmplug2; -} diff --git a/plugins/hl2dm/hl2dm.pro b/plugins/hl2dm/hl2dm.pro index a25e8d69c..dc36ec4f2 100644 --- a/plugins/hl2dm/hl2dm.pro +++ b/plugins/hl2dm/hl2dm.pro @@ -1,7 +1,8 @@ include(../plugins.pri) +DEFINES += "NULL_DESC=\"L\\\"Half Life 2 Death Match (Retracted, now using link)\\\"\"" TARGET = hl2dm -SOURCES = hl2dm.cpp +SOURCES = ../null_plugin.cpp LIBS += -luser32 diff --git a/plugins/null_plugin.cpp b/plugins/null_plugin.cpp new file mode 100644 index 000000000..d77596984 --- /dev/null +++ b/plugins/null_plugin.cpp @@ -0,0 +1,69 @@ +/* Copyright (C) 2005-2012, Thorvald Natvig <thorvald@natvig.com> + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + - Neither the name of the Mumble Developers nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "mumble_plugin_win32.h" + +#ifndef NULL_DESC +#define NULL_DESC L"Retracted plugin" +#endif // NULL_DESC + +static int fetch(float *, float *, float *, float *, float *, float *, std::string &, std::wstring &) { + // Empty + return false; +} + +static int trylock() { + // Empty + return false; +} + +static const std::wstring longdesc() { + return std::wstring(L"NULL plugin for retracted plugin. This should not be visible in Mumble >= 1.2.4"); +} + +static std::wstring description(NULL_DESC); +static std::wstring shortname(L"Retracted"); + +static MumblePlugin nullplug = { + MUMBLE_PLUGIN_MAGIC, + description, + shortname, + NULL, + NULL, + trylock, + generic_unlock, + longdesc, + fetch +}; + +extern "C" __declspec(dllexport) MumblePlugin *getMumblePlugin() { + return &nullplug; +} + diff --git a/plugins/tf2/tf2.cpp b/plugins/tf2/tf2.cpp deleted file mode 100644 index 7b4f7a036..000000000 --- a/plugins/tf2/tf2.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* Copyright (C) 2012, dark_skeleton (d-rez) <dark.skeleton@gmail.com> - Copyright (C) 2009-2012, Snares <snares@users.sourceforge.net> - Copyright (C) 2005-2012, Thorvald Natvig <thorvald@natvig.com> - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the Mumble Developers nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "../mumble_plugin_win32.h" - -static BYTE *posrotptr; -static BYTE *stateptr; -static BYTE *hostptr; - -/* - note that these are just examples of memory values, and may not be updated or correct - position tuple: client.dll+0x... (x,y,z, float) - orientation tuple: client.dll+0x... (v,h float) - spawn state: client.dll+0x... (0 when at main menu, 1 when spectator, 3 when at team selection menu, and 6 or 9 when on a team (or 4,5,8 etc. depending on the team side and gamemode), byte) - host string: client.dll+0x... (ip:port or loopback:0 when created own server or blank when not ingame) - ID string: client.dll+0x... = "Demoman" (13 characters, text - somerhing that lets us know it's TF2 and not for example HL2) - note that memory addresses in this comment are for example only; the real ones are defined below - - note: the spec_pos console command is rather useful - note: so is the cl_showpos command - NOTE: from my experience, using engine.dll module is a rather bad idea since it's very dynamic. And since we can get everything we need from client.dll, it is no longer required :) -*/ - -static bool calcout(float *pos, float *rot, float *opos, float *front, float *top) { - float h = rot[0]; - float v = rot[1]; - - if ((v < -360.0f) || (v > 360.0f) || (h < -360.0f) || (h > 360.0f)) - return false; - - h *= static_cast<float>(M_PI / 180.0f); - v *= static_cast<float>(M_PI / 180.0f); - - // Seems TF2 is in inches. INCHES?!? - opos[0] = pos[0] / 39.37f; - opos[1] = pos[2] / 39.37f; - opos[2] = pos[1] / 39.37f; - - // h rotation angle up-down, positive in down direction starting from x-axis - // v rotation angle left-right, positive to the left starting from x-axis - front[0] = cosf(h) * cosf(v); - front[1] = -sinf(h); - front[2] = cosf(h) * sinf(v); - // sin(h - 1/2pi) = -cos(h) and cos(h - 1/2pi) = sin(h) - top[0] = sinf(h) * cosf(v); - top[1] = cosf(h); - top[2] = sinf(h) * sinf(v); - - return true; -} - -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] = camera_pos[i] = camera_front[i] = camera_top[i] = 0.0f; - - bool ok; - float posrot[5]; - char state; - char chHostStr[21]; // We just need 21 [xxx.xxx.xxx.xxx:yyyyy] - - ok = peekProc(posrotptr, posrot) && - peekProc(stateptr, state) && - peekProc(hostptr, chHostStr); - - if (!ok) - return false; - - chHostStr[sizeof(chHostStr) - 1] = '\0'; // Ensure zero termination - std::string sHost(chHostStr); - - // Possible values of chHostStr: - // xxx.yyy.zzz.aaa:ccccc (or shorter, e.g. x.y.z.a:cc - but it doesn't really change anything) - // loopback:0 (when a local server is started) - if (!sHost.empty()) - { - if (sHost.find("loopback") == std::string::npos) - { - std::ostringstream newcontext; - newcontext << "{\"ipport\": \"" << sHost << "\"}"; - context = newcontext.str(); - } - } - - //TODO: Implement identity - - // Check to see if you are in a server and spawned - if (state == 0 || state == 1 || state == 3) { - if (state == 0) context = std::string(""); // clear context if not connected to server - return true; // Deactivate plugin - } - - ok = calcout(posrot, posrot+3, avatar_pos, avatar_front, avatar_top); - if (ok) { - 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 true; - } - - return false; -} - -static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) { - posrotptr = stateptr = hostptr = NULL; - - if (! initialize(pids, L"hl2.exe", L"client.dll")) - return false; - - // Remember addresses for later - posrotptr = pModule + 0x8F9334; - stateptr = pModule + 0x869034; - hostptr = pModule + 0x918044; - - // Gamecheck - check if we're looking at the right game - char sMagic[7]; - if (!peekProc(pModule + 0x882CE2, sMagic) || strncmp("Demoman", sMagic, sizeof(sMagic))!=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]; - std::wstring sidentity; - std::string scontext; - - if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) { - return true; - } else { - generic_unlock(); - return false; - } -} - -static const std::wstring longdesc() { - return std::wstring(L"Supports TF2 build 4934 with context. No identity support yet."); -} - -static std::wstring description(L"Team Fortress 2 (Build 4934)"); -static std::wstring shortname(L"Team Fortress 2"); - -static int trylock1() { - return trylock(std::multimap<std::wstring, unsigned long long int>()); -} - -static MumblePlugin tf2plug = { - MUMBLE_PLUGIN_MAGIC, - description, - shortname, - NULL, - NULL, - trylock1, - generic_unlock, - longdesc, - fetch -}; - -static MumblePlugin2 tf2plug2 = { - MUMBLE_PLUGIN_MAGIC_2, - MUMBLE_PLUGIN_VERSION, - trylock -}; - -extern "C" __declspec(dllexport) MumblePlugin *getMumblePlugin() { - return &tf2plug; -} - -extern "C" __declspec(dllexport) MumblePlugin2 *getMumblePlugin2() { - return &tf2plug2; -} diff --git a/plugins/tf2/tf2.pro b/plugins/tf2/tf2.pro index 891b35250..8c8dae502 100644 --- a/plugins/tf2/tf2.pro +++ b/plugins/tf2/tf2.pro @@ -1,7 +1,8 @@ include(../plugins.pri) +DEFINES += "NULL_DESC=\"L\\\"Team Fortress 2 (Retracted, now using link)\\\"\"" TARGET = tf2 -SOURCES = tf2.cpp +SOURCES = ../null_plugin.cpp LIBS += -luser32 |