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:
authorRobert <krzmbrzl@gmail.com>2020-09-11 19:29:33 +0300
committerRobert <krzmbrzl@gmail.com>2020-09-11 19:29:33 +0300
commitaf7dac72f4063dd8d4dac71973ea51c25896089a (patch)
tree35558695aea94d48fd9e77d164d63fd8b7c76e90 /plugins/blacklight
parent40b28b03c150b453e00c6bc4f8d6957caea59c51 (diff)
FORMAT: Run clang-format 10 on all C/CXX source-files
Diffstat (limited to 'plugins/blacklight')
-rw-r--r--plugins/blacklight/blacklight.cpp81
1 files changed, 35 insertions, 46 deletions
diff --git a/plugins/blacklight/blacklight.cpp b/plugins/blacklight/blacklight.cpp
index 338f4f300..977a6912d 100644
--- a/plugins/blacklight/blacklight.cpp
+++ b/plugins/blacklight/blacklight.cpp
@@ -13,13 +13,13 @@
are met:
- Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 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.
+ 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.
+ 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
@@ -36,11 +36,12 @@
#include "../mumble_plugin_main.h"
-/*
- Arrays of bytes to find addresses accessed by respective functions so we don't have to blindly search for addresses after every update
- Remember to disable scanning only the writable memory in CE! We're searching for functions here, not values!
- This is not the final version and it doesn't distinguish camera and avatar positions. No identity support yet.
-
+/*
+ Arrays of bytes to find addresses accessed by respective functions so we don't have to blindly search for addresses
+ after every update Remember to disable scanning only the writable memory in CE! We're searching for functions here,
+ not values! This is not the final version and it doesn't distinguish camera and avatar positions. No identity support
+ yet.
+
Camera front vector function: 89 16 8B 54 24 20 89 46 04 8B 44 24 24
Host IP:PORT changes to 'bot' when not ingame
@@ -51,12 +52,13 @@
Camera position vector address: +0x18 (offset, not pointer)
Host IP:PORT address: pbcl.dll + 0xB8C57
- TODO: Find Avatar position, front, top vectors, protect against version change (find a random pointer to check), distinguish spectator and normal mode
+ TODO: Find Avatar position, front, top vectors, protect against version change (find a random pointer to check),
+ distinguish spectator and normal mode
*/
static procptr_t camfrontptr = 0x141bc20;
-static procptr_t camtopptr = camfrontptr + 0xC;
-static procptr_t camptr = camfrontptr + 0x18;
+static procptr_t camtopptr = camfrontptr + 0xC;
+static procptr_t camptr = camfrontptr + 0x18;
static procptr_t hostipportptr;
static std::string prev_hostipport;
@@ -66,9 +68,9 @@ static char state = 0; // 1 if connected to a server, 0 if not
static bool calcout(float *cam, float *camfront, float *camtop, float *ocam, float *ocamfront, float *ocamtop) {
// Seems Blacklight is in centimeters? ;o Well it's not inches for sure :)
for (int i = 0; i < 3; i++) {
- ocam[i] = cam[i] / 100.00f;
+ ocam[i] = cam[i] / 100.00f;
ocamfront[i] = camfront[i];
- ocamtop[i] = camtop[i];
+ ocamtop[i] = camtop[i];
}
return true;
@@ -82,7 +84,8 @@ static bool refreshPointers(void) {
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*/) {
+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;
@@ -90,14 +93,12 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa
bool ok;
char hostipport[22];
- ok = peekProc(camfrontptr, camfront, 12) &&
- peekProc(camtopptr, camtop, 12) &&
- peekProc(hostipportptr, hostipport) &&
- peekProc(camptr, cam);
+ ok = peekProc(camfrontptr, camfront, 12) && peekProc(camtopptr, camtop, 12) && peekProc(hostipportptr, hostipport)
+ && peekProc(camptr, cam);
if (!ok)
return false;
-
+
hostipport[sizeof(hostipport) - 1] = '\0';
if (hostipport != prev_hostipport) {
context.clear();
@@ -117,18 +118,18 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa
if (!state) // report positional data only when on a server!
return true;
- calcout(cam, camfront, camtop, camera_pos, camera_front, camera_top); //calculate proper position values
- for (int i=0;i<3;i++) {
+ calcout(cam, camfront, camtop, camera_pos, camera_front, camera_top); // calculate proper position values
+ for (int i = 0; i < 3; i++) {
avatar_front[i] = camera_front[i];
- avatar_pos[i] = camera_pos[i];
- avatar_top[i] = camera_top[i]; // copy values since we don't know avatar's vectors
+ avatar_pos[i] = camera_pos[i];
+ avatar_top[i] = camera_top[i]; // copy values since we don't know avatar's vectors
}
return true;
}
-static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
- if (! initialize(pids, L"BLR.exe", L"pbcl.dll"))
+static int trylock(const std::multimap< std::wstring, unsigned long long int > &pids) {
+ if (!initialize(pids, L"BLR.exe", L"pbcl.dll"))
return false;
if (refreshPointers()) { // unlink plugin if this fails
@@ -139,7 +140,8 @@ static int trylock(const std::multimap<std::wstring, unsigned long long int> &pi
std::wstring identity;
if (fetch(avatar_pos, avatar_front, avatar_top, camera_pos, camera_front, camera_top, context, identity)) {
- prev_hostipport.clear(); // we need to do this again since fetch() above overwrites this (which results in empty context until next change)
+ prev_hostipport.clear(); // we need to do this again since fetch() above overwrites this (which results in
+ // empty context until next change)
return true;
}
}
@@ -156,26 +158,13 @@ static std::wstring description(L"Blacklight: Retribution (v0.9.8.0)");
static std::wstring shortname(L"Blacklight: Retribution");
static int trylock1() {
- return trylock(std::multimap<std::wstring, unsigned long long int>());
+ return trylock(std::multimap< std::wstring, unsigned long long int >());
}
-static MumblePlugin blacklightplug = {
- MUMBLE_PLUGIN_MAGIC,
- description,
- shortname,
- nullptr,
- nullptr,
- trylock1,
- generic_unlock,
- longdesc,
- fetch
-};
-
-static MumblePlugin2 blacklightplug2 = {
- MUMBLE_PLUGIN_MAGIC_2,
- MUMBLE_PLUGIN_VERSION,
- trylock
-};
+static MumblePlugin blacklightplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, nullptr, nullptr, trylock1,
+ generic_unlock, longdesc, fetch };
+
+static MumblePlugin2 blacklightplug2 = { MUMBLE_PLUGIN_MAGIC_2, MUMBLE_PLUGIN_VERSION, trylock };
extern "C" MUMBLE_PLUGIN_EXPORT MumblePlugin *getMumblePlugin() {
return &blacklightplug;