Commit Graph

643 Commits

Author SHA1 Message Date
Sergei Trofimovich
36398fb3b2 BUILD(positional-audio): Fix missing <memory> include
Without the change the build fails on upcoming gcc-12 as:

    /build/mumble/plugins/gtav/gtav.cpp:13:13:
      error: 'unique_ptr' in namespace 'std' does not name a template type
       13 | static std::unique_ptr< Game > game;
          |             ^~~~~~~~~~
    /build/mumble/plugins/gtav/gtav.cpp:12:1:
      note: 'std::unique_ptr' is defined in header '<memory>';
        did you forget to '#include <memory>'?
       11 | #include <cstring>
      +++ |+#include <memory>
       12 |
2022-02-27 17:24:07 +00:00
Magnus Groß
f0d7381e49
FIX(positional-audio): Update GTAV plugin to version 1.58.2545 2022-01-27 23:21:34 +01:00
Magnus Groß
31a9522a0f
REFAC(positional-audio): Remove useless memory locations in GTAV
These addresses provide no additional meaningful data. The identity
context is supposed to identify an user, not provide meaningless info
about unrelated ingame objects.

Remove these unnecessary variables, as they only increase the amount of
work needed when reverse-engineering positional audio.

The username is already alone an unique identity, so instead of setting
the identity to a JSON of multiple values, we now set the identity to
just the username.
2022-01-27 23:21:18 +01:00
Sören Tempel
b47eb5055b BUILD: include libgen.h for files which use basename(3)
As per POSIX, basename(3) is defined in libgen.h. Without including
this header file the code presently does not compile (on musl) due to
`-Werror` and a `-Wimplicit-function-declaration` warning.
2022-01-19 11:28:15 +01:00
Robert Adam
d100ff1467 MAINT: Update copyright to 2022 2022-01-04 20:17:33 +01:00
Robert Adam
d816fb5688 BUILD(windows): Fix debug build
When performing a debug build, the "deadlock plugin" will be included
in the build, which uses the thread functionality of the std. However,
during compiling there would be an error about a symbol in thread.hpp
not being found (_beginthreadex). As it turns out, this was due to us
having a header file called Process.h, which would shadow the windows-
specific header file defining the mentioned symbol.

Therefore, in this commit we rename the Process base class to
AbstractProcess and rename the files accordingly, fixing that error.

See also: https://stackoverflow.com/q/27230258
2021-12-23 21:47:54 +01:00
Davide Beatrici
9c4ff543be FIX(positional-audio): Update Among Us plugin to work with v2021.12.15s (1421)
https://store.steampowered.com/news/app/945360/view/5918290951261475310
2021-12-19 21:59:47 +01:00
Davide Beatrici
cf8c941b2a FIX(positional-audio): Update Among Us plugin to work with v2021.11.9.5s
https://store.steampowered.com/news/app/945360/view/3097907147121066176
https://store.steampowered.com/news/app/945360/view/3097908416252836584
2021-12-11 23:33:16 +01:00
Robert Adam
a4b6b8e84d
Merge PR #5316: FIX(client): Link plugin incompatibility
This PR performs multiple things, all related to the Link plugin. For details, see the
individual commit messages.

Among other things, the Link plugin was ported to the new plugin API and the
different implementations for Windows as Posix where unified into a single implementation.

Fixes #5217
2021-11-28 18:35:31 +01:00
Robert Adam
16956afa22 FIX(client): Error if API call can't work due to server
The sendData API call requires the server to be of version 1.4.0 or
newer to work. Thus, when calling this API function while connected to
an older server, we can already tell that this won't work. Previously
this was silently ignored.

This commit introduces a new API error that will inform the user about
this problem. This should clear up the confusion as to why the sendData
call is apparently not doing anything.

Fixes #5331

Co-authored-by: Davide Beatrici <github@davidebeatrici.dev>
2021-11-26 12:41:49 +01:00
Robert Adam
e981827de5 MAINT: Add Link plugin tester
This commit adds a small CLI program that just connects to the Link
plugin and sends random positions to it. It is meant to be used as a
test-case for the Link plugin.
2021-11-18 19:25:28 +01:00
Robert Adam
658b33e4c8 REFAC(plugins): Unify Link plugin implementations
This commit merges the two separate Link plugin implementations that
were previously used (one for Posix and one for Windows systems) and
merges them into a single one (abstracting away the platform differences
at most places).

While doing so, this commit ports the "Link" plugin to the new plugin
API (introduced with Mumble 1.4.0), such that it can make use of the
possibility to set a custom context prefix. Thus, this prefix is no
longer dependent on the plugin name (in Link's case it is set to
whatever the linked application declares as its name).

Fixes #5217
2021-11-18 19:25:28 +01:00
Robert Adam
bed0fa57fa REFAC(plugins): Add SharedMemory class
This abstracts away the platform differences between Posix and Windows
systems when it comes to managing shared memory.
2021-11-18 19:25:28 +01:00
Robert Adam
86375de2a6 FEAT(plugins): Add option to use context prefix
With the new plugin function, plugins can choose a custom prefix for use
in the positional audio context.
2021-11-18 19:25:28 +01:00
Robert Adam
3d142ac238 REFAC(plugins): Add plugin function version specifier 2021-11-18 19:25:28 +01:00
Robert Adam
60888caadc FEAT(plugins): Add typedef for API type
This typedef can be used by plugins that don't want to hard-code the
type of the Mumble API type (which contains the API's version) into
their source code.

If this typedef is used, a newer API can be used simply by including a
different API header.
2021-11-18 19:25:28 +01:00
Robert Adam
fea949767a TEST(client): Add plugin to test deadlock prevention
This plugin tests the built-in deadlock prevention of the Mumble plugin
API.
2021-11-09 08:51:18 +01:00
Davide Beatrici
4c24e862b0 FIX(positional-audio): Update Source Engine plugin to work with L4D2 2.2.2.0
https://store.steampowered.com/news/app/550/view/2990935241286354880
https://store.steampowered.com/news/app/550/view/2990936690600094237
2021-07-14 09:56:03 +02:00
Davide Beatrici
7aabb14836 FIX(positional-audio): Update Among Us plugin to work with v2021.6.30s
https://steamcommunity.com/games/945360/announcements/detail/2994312940971770701

This commit also updates the name of a few variables.
2021-07-14 06:35:42 +02:00
Robert Adam
524e43b6aa
Merge PR #5161: FIX(client): Potential deadlocks in plugins
Using the API functions from outside the "main thread" would cause them
to block until the request can be processed on the main thread. This
could easily produce a deadlock if used without caution.

These changes add a timeout for this waiting turning preventing
deadlocks because the calling thread won't be blocked indefinitely. In
case of a timeout, a special error code is returned.
2021-07-04 16:25:51 +02:00
Robert Adam
fc5c31341d FIX(client): Potential deadlocks in plugins
Using the API functions from outside the "main thread" would cause them
to block until the request can be processed on the main thread. This
could easily produce a deadlock if used without caution.

These changes add a timeout for this waiting turning preventing
deadlocks because the calling thread won't be blocked indefinitely. In
case of a timeout, a special error code is returned.
2021-07-04 15:37:30 +02:00
Magnus Groß
696c47b50c
REFAC(positional-audio): Port GTA5 to new Plugin API 2021-07-01 12:58:41 +02:00
Magnus Groß
cf998316a1
REFAC(positional-audio): Remove unused context code 2021-06-30 10:32:30 +02:00
Magnus Groß
732d9b3831
FIX(positional-audio): Update GTA5 plugin
This works with the latest Steam version 1.54 Build 2245.
2021-06-30 10:32:26 +02:00
Davide Beatrici
2e93212d74 FIX(positional-audio): Update Source Engine plugin to work with L4D2 2.2.1.3
This commit makes the plugin work again with the Linux version of the game.

The game update didn't break support for the Windows version.

https://steamcommunity.com/games/L4D2/announcements/detail/4625740823862061052
2021-06-17 01:38:29 +02:00
Robert Adam
9b50fd7a12 BUILD(cmake): Reorganize how plugins are handled
Instead of excluding all plugins but the link one on OSes other than
Windows and Linux, the new approach allows for a more granular control
by introducing a list of plugins that is supported on the different
platforms.

This replaces the globbing approach which means that new plugins have
now to be included in this list explicitly.

The advantage of this is that this allows for a much greater flexibility
for handling plugins on different OS.

Furthermore the plugin's own directory is no longer added to the
include-path by default. If a plugin wishes to do this, it should do so
explicitly. This should help make the plugins easier to move around in
the future.
2021-06-16 19:24:25 +02:00
Davide Beatrici
40f03e5a3a
Merge PR #5126: FIX(positional-audio): Update Among Us plugin to work with v2021.6.15s 2021-06-16 08:47:47 +02:00
Davide Beatrici
1f609561a6 FIX(positional-audio): Update Among Us plugin to work with v2021.6.15s
https://steamcommunity.com/games/945360/announcements/detail/3055110270127094252
2021-06-16 06:00:49 +02:00
Davide Beatrici
9d3e53152a FEAT(positional-audio): Add support for DT_GNU_HASH, to locate exported symbols
Our Source Engine plugin retrieves the interfaces on Linux through "s_pInterfaceRegs", an exported symbol.

Left 4 Dead 2 just received a big update and the binaries don't have the DT_HASH table anymore.
As a result, the plugin was not finding the symbol anymore.

This is basically a follow-up to 6f19d7ebfd, which implemented support for DT_GNU_HASH in the overlay code.
2021-06-16 05:19:35 +02:00
Robert Adam
6bbcc63101
Merge PR #5113: FIX(client, plugin-api): requestLocalUserTransmissionMode
This particular API function was implemented to only set the respective
settings variable. However this would not notify any other code part
about the change resulting in a potential inconsistency between the UI
and the actual settings.

Therefore the implementation now delegates the actual setting of the
transmission mode to MainWindow::setTransmission mode that takes care of
emitting the appropriate signal and informs the user about a change in
transmission mode.
2021-06-12 20:12:20 +02:00
Robert Adam
0f3c42ca31 FIX(client, plugin-api): requestLocalUserTransmissionMode
This particular API function was implemented to only set the respective
settings variable. However this would not notify any other code part
about the change resulting in a potential inconsistency between the UI
and the actual settings.

Therefore the implementation now delegates the actual setting of the
transmission mode to MainWindow::setTransmission mode that takes care of
emitting the appropriate signal and informs the user about a change in
transmission mode.
2021-06-12 17:42:06 +02:00
Davide Beatrici
32d101f090 REFAC(positional-audio): Use new plugin API in Among Us plugin
Full functionality is retained.
2021-06-12 08:33:44 +02:00
Robert Adam
9afa06622f REFAC(plugins): Streamline include guards for plugin headers 2021-06-03 16:36:14 +02:00
Robert Adam
e9f0f71195 REFAC(plugins): Avoid name clashes by prefixing
There were a few types left that were not prefixed with "Mumble" in one
way or another. In order to avoid name clashes, this was now changed.
Especially enum values are now also prefixed. This is because these are
not enum classes (C doesn't know those) and as such the enum values are
used without a namespace (thus they are effectively global names).

Furthermore the macros STATUS_OK and VERSION_UNKNOWN were turned into
constant variables in order to use the preprocessor as little as
possible.
2021-06-03 16:36:14 +02:00
Robert Adam
4476a247c3 BUILD(plugins): Make API header compile with C again
constexpr is C++ and not C and thus the header would not compile using a
C compiler anymore.
2021-06-03 15:52:18 +02:00
Davide Beatrici
9d5feb54e6
Merge PR #5087: FIX(client): Use ReadProcessMemory() instead of Toolhelp32ReadProcessMemory() 2021-06-02 19:22:59 +02:00
Robert Adam
6fc8de5f31
Merge PR #5084: REFAC(client): Remove unnecessary include
The windows header was included for the definition of M_PI. However
given that we define _USE_MATH_DEFINES globally for all source files and
cmath is included already, this symbol is defined by cmath, making the
windows-specific header superfluous.
2021-06-02 11:20:55 +02:00
Davide Beatrici
198621f19c FIX(client): Use ReadProcessMemory() instead of Toolhelp32ReadProcessMemory()
I was wrong in d7f0302ce7.

Turns out Toolhelp32ReadProcessMemory() is simply a wrapper for ReadProcessMemory() that takes care of opening an handle to the process and closing it.

For reference: https://github.com/MicrosoftDocs/sdk-api/pull/793
2021-06-02 02:56:05 +02:00
Robert Adam
3a4d9df4ea REFAC(client): Remove unnecessary include
The windows header was included for the definition of M_PI. However
given that we define _USE_MATH_DEFINES globally for all source files and
cmath is included already, this symbol is defined by cmath, making the
windows-specific header superfluous.
2021-06-01 21:10:09 +02:00
jisopo
f9ded8415c BUILD(windows): Fix missing include
some of overlay source files such as: amongus, cod2 and se uses
std::unique_ptr
which requires include <memory>
2021-06-01 08:13:16 +02:00
Robert Adam
e9aa3c728a REFAC(plugin): Rename plugin ID parameter
Instead of passing the type name directly we pass the alias instead in
order to make code more easily portable between API versions.
2021-05-26 12:33:17 +02:00
Septarius
5f5024f723
BUILD(plugin): Add QT_CORE_LIB to QT_VERSION Check
PluginComponents uses this check to determine if Qt library is already used so we don't want to force a Qt include.
Unity build triggered this since I believe it moved the header into a different compilation unit or compiled it first.

QT_VERSION requires #include <QtGlobal> before using it.
From: https://stackoverflow.com/questions/24899558/how-to-check-qt-version-to-include-different-header

QT_CORE_LIB is set by CMake
From: https://stackoverflow.com/questions/30840176/what-preprocessor-can-i-used-to-detect-if-qt-is-used-to-build-my-codes

Alternate solution could be using __if_include per https://forum.qt.io/post/564320 . But that appears to require C++17 mode.

Error log:
In file included from src/mumble/CMakeFiles/mumble.dir/Unity/unity_1_cxx.cxx:4:
... /src/mumble/PluginInstaller.cpp: In member function ‘void PluginInstaller::init()’:
... /src/mumble/PluginInstaller.cpp:149:92: error: no matching function for call to ‘QString::QString(mumble_version_t&)’
  149 |    .arg(pluginVersion == VERSION_UNKNOWN ? "Unknown" : static_cast< QString >(pluginVersion))

Co-authored-by: Robert Adam <dev@robert-adam.de>
2021-05-18 16:26:28 -06:00
Robert Adam
923045ac60 FORMAT: Run clang-format 10 on all source files 2021-04-16 21:05:52 +02:00
Robert Adam
27dbee8e62 FEAT(client): Plugin framework
This commit introduces a new plugin framework into the codebase of the
Mumble client. Note that "plugin" here really refers to a (more or less)
general purpose plugin and is therefore not to be confused with the
previously available positional data plugins (only responsible for
fetching positional data from a running game and passing that to
Mumble).

The plugin interface is written in C, removing the compiler-dependence
the old "plugins" had. Instead plugins can now be written in an
arbitrary language as long as that language is capable of being compiled
into a shared library and also being capable of being C-compatible.

As already indicated a plugin is essentially a shared library that
provides certain functions that allow Mumble to interface with it.

Inside Mumble the so-called PluginManager is responsible for managing
the plugins and relaying events to the respective callbacks. Plugins
themselves can also interact with Mumble on their own initiative by
using the provided API functions.

Fixes #2455
Fixes #2148
Fixes #1594
Fixes #2051
Fixes #3742
Fixes #4575
Fixes #4751
2021-04-16 20:15:44 +02:00
Robert
56db3410c5 MAINT: Update copyright notice to 2021 (Part II)
Apparently the first commit (59ae429972)
did not include all files.

Furthermore the used script tended to produce funny results in certain
cases. This has been fixed and as a result thereof a few more changes
were made in this second run.
2021-04-09 15:41:49 +02:00
Davide Beatrici
6ceeef39ae FIX(positional-audio): Update Among Us plugin to work with v2021.3.31.3s
https://store.steampowered.com/news/app/945360/view/3021326294554201922
2021-04-03 07:26:02 +02:00
Davide Beatrici
ea69658bba FIX(positional-audio): Fix and revamp Call of Duty 2 plugin
It was not working because the camera position values were all set to 0.

This commit fixes the issue while also revamping the code.
2021-03-17 08:07:27 +01:00
Davide Beatrici
e152fa7603 FIX(positional-audio): Update Among Us plugin to work with v2021.3.5s
https://store.steampowered.com/news/app/945360/view/3050597789009577255
2021-03-15 07:47:26 +01:00
Robert Adam
678e872c21 BUILD(cmake): Always define _USE_MATH_DEFINES
This is needed in order for the <cmath> header to also define constants
like M_PI. Instead of manually defining the macro every time before
including <cmath>, the macro is now defined via cmake and thus always
defined.
2021-03-06 18:57:22 +01:00
Robert Adam
59ae429972 MAINT: Update copyright notice to 2021
This was done by running scripts/updateLicenseHeaders.py and then
manually editing the LICENSE file.
2021-03-02 10:15:01 +01:00