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/ql
parent40b28b03c150b453e00c6bc4f8d6957caea59c51 (diff)
FORMAT: Run clang-format 10 on all C/CXX source-files
Diffstat (limited to 'plugins/ql')
-rw-r--r--plugins/ql/ql.cpp90
1 files changed, 42 insertions, 48 deletions
diff --git a/plugins/ql/ql.cpp b/plugins/ql/ql.cpp
index 0fd7d0ed8..c964dea3d 100644
--- a/plugins/ql/ql.cpp
+++ b/plugins/ql/ql.cpp
@@ -3,11 +3,12 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
-#include "../mumble_plugin_main.h" // Include standard plugin header.
+#include "../mumble_plugin_main.h" // Include standard plugin header.
#include "../mumble_plugin_utils.h" // Include plugin header for special functions, like "escape".
-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++) {
+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;
}
@@ -21,23 +22,26 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa
uint8_t team;
// Peekproc and assign game addresses to our containers, so we can retrieve positional data
- ok = peekProc(pModule + 0x0188248, &state, 1) && // Magical state value: 1 when in-game and 0 when in main menu.
- peekProc(pModule + 0x1041CAC, &spec, 1) && // Spectator state value: 1 when spectating and 0 when playing.
- peekProc(pModule + 0x0EB8950, avatar_pos_corrector, 12) && // Avatar Position values (X, Z and Y, respectively).
- peekProc(pModule + 0x0E6093C, camera_pos_corrector, 12) && // Camera Position values (X, Z and Y, respectively).
- peekProc(pModule + 0x0EC5B50, avatar_front_corrector, 12) && // Avatar front values (X, Z and Y, respectively).
- peekProc(pModule + 0x0EC5B68, avatar_top_corrector, 12) && // Avatar top values (X, Z and Y, respectively).
- peekProc(pModule + 0x0E4A638, host) && // Server value: "IP:Port" when in a remote server, "loopback" when on a local server.
- peekProc(pModule + 0x106E24B, servername) && // Server name.
- peekProc(pModule + 0x12DE8D8, map) && // Map name.
- peekProc(pModule + 0x106CE6C, team); // Team value: 0 when in a FFA game (no team); 1 when in Red team; 2 when in Blue team; 3 when in Spectators.
-
- if (! ok) {
+ ok =
+ peekProc(pModule + 0x0188248, &state, 1) && // Magical state value: 1 when in-game and 0 when in main menu.
+ peekProc(pModule + 0x1041CAC, &spec, 1) && // Spectator state value: 1 when spectating and 0 when playing.
+ peekProc(pModule + 0x0EB8950, avatar_pos_corrector, 12) && // Avatar Position values (X, Z and Y, respectively).
+ peekProc(pModule + 0x0E6093C, camera_pos_corrector, 12) && // Camera Position values (X, Z and Y, respectively).
+ peekProc(pModule + 0x0EC5B50, avatar_front_corrector, 12) && // Avatar front values (X, Z and Y, respectively).
+ peekProc(pModule + 0x0EC5B68, avatar_top_corrector, 12) && // Avatar top values (X, Z and Y, respectively).
+ peekProc(pModule + 0x0E4A638, host)
+ && // Server value: "IP:Port" when in a remote server, "loopback" when on a local server.
+ peekProc(pModule + 0x106E24B, servername) && // Server name.
+ peekProc(pModule + 0x12DE8D8, map) && // Map name.
+ peekProc(pModule + 0x106CE6C, team); // Team value: 0 when in a FFA game (no team); 1 when in Red team; 2 when
+ // in Blue team; 3 when in Spectators.
+
+ if (!ok) {
return false;
}
- if (! state) { // If not in-game
- context.clear(); // Clear context
+ if (!state) { // If not in-game
+ context.clear(); // Clear context
identity.clear(); // Clear identity
return true; // This results in all vectors beeing zero which tells Mumble to ignore them.
@@ -45,8 +49,8 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa
if (state && spec) { // If in-game as spectator
// Set to 0 avatar and camera values.
- 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;
+ 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;
}
// Set team to SPEC.
std::wostringstream oidentity;
@@ -60,7 +64,9 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa
escape(host, sizeof(host));
std::ostringstream ocontext;
ocontext << " {";
- if (strcmp(host, "") != 0 && !strstr(host, "loopback")) { // Only include host (IP:Port) if it is not empty and does not include the string "loopback" (which means it's a local server).
+ if (strcmp(host, "") != 0
+ && !strstr(host, "loopback")) { // Only include host (IP:Port) if it is not empty and does not include the
+ // string "loopback" (which means it's a local server).
ocontext << "\"Host\": \"" << host << "\""; // Set host address in identity.
} else {
ocontext << "\"Host\": null";
@@ -92,7 +98,8 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa
if (team == 2)
oidentity << std::endl << "\"Team\": \"Blue\""; // If team value is 2, set "Blue" as team in identity.
if (team == 3)
- oidentity << std::endl << "\"Team\": \"Spectators\""; // If team value is 3, set "Spectators" as team in identity.
+ oidentity << std::endl
+ << "\"Team\": \"Spectators\""; // If team value is 3, set "Spectators" as team in identity.
} else {
oidentity << std::endl << "\"Team\": null";
}
@@ -124,19 +131,18 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa
avatar_top[2] = avatar_top_corrector[1];
// Scale to meters
- for (int i=0;i<3;i++) {
+ for (int i = 0; i < 3; i++) {
camera_front[i] = avatar_front[i];
- camera_top[i] = avatar_top[i];
- avatar_pos[i]/=70.0f;
- camera_pos[i]/=70.0f;
+ camera_top[i] = avatar_top[i];
+ avatar_pos[i] /= 70.0f;
+ camera_pos[i] /= 70.0f;
}
return true;
}
-static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
-
- if (! initialize(pids, L"quakelive_steam.exe")) { // Retrieve game executable's memory address
+static int trylock(const std::multimap< std::wstring, unsigned long long int > &pids) {
+ if (!initialize(pids, L"quakelive_steam.exe")) { // Retrieve game executable's memory address
return false;
}
@@ -154,33 +160,21 @@ static int trylock(const std::multimap<std::wstring, unsigned long long int> &pi
}
static const std::wstring longdesc() {
- return std::wstring(L"Supports Quake Live version 1069 with context and identity support."); // Plugin long description
+ return std::wstring(
+ L"Supports Quake Live version 1069 with context and identity support."); // Plugin long description
}
static std::wstring description(L"Quake Live (v1069)"); // Plugin short description
-static std::wstring shortname(L"Quake Live"); // Plugin short name
+static std::wstring shortname(L"Quake Live"); // Plugin short name
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 qlplug = {
- MUMBLE_PLUGIN_MAGIC,
- description,
- shortname,
- nullptr,
- nullptr,
- trylock1,
- generic_unlock,
- longdesc,
- fetch
-};
-
-static MumblePlugin2 qlplug2 = {
- MUMBLE_PLUGIN_MAGIC_2,
- MUMBLE_PLUGIN_VERSION,
- trylock
-};
+static MumblePlugin qlplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, nullptr, nullptr, trylock1,
+ generic_unlock, longdesc, fetch };
+
+static MumblePlugin2 qlplug2 = { MUMBLE_PLUGIN_MAGIC_2, MUMBLE_PLUGIN_VERSION, trylock };
extern "C" MUMBLE_PLUGIN_EXPORT MumblePlugin *getMumblePlugin() {
return &qlplug;