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>
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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>
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#2455Fixes#2148Fixes#1594Fixes#2051Fixes#3742Fixes#4575Fixes#4751
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.
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.
The reason why the signature has to be stricter now is due to a very similar function being present at an earlier address:
il2cpp:10E99B02 83 C4 08 add esp, 8
il2cpp:10E99B05 84 C0 test al, al
il2cpp:10E99B07 74 39 jz short loc_10E99B42
il2cpp:10E99B09 A1 AC 7C C5 11 mov eax, HLBNNHFCNAJ__TypeInfo ; HLBNNHFCNAJ
il2cpp:10E99B0E 8B 40 5C mov eax, [eax+5Ch]
il2cpp:10E99B11 8B 38 mov edi, [eax]
il2cpp:112CC4B8 83 C4 08 add esp, 8
il2cpp:112CC4BB 84 C0 test al, al
il2cpp:112CC4BD 74 39 jz short loc_112CC4F8
il2cpp:112CC4BF A1 54 7F C5 11 mov eax, FMLLKEACGIO__TypeInfo ; FMLLKEACGIO
il2cpp:112CC4C4 8B 40 5C mov eax, [eax+5Ch]
il2cpp:112CC4C7 8B 00 mov eax, [eax]
FMLLKEACGIO is AmongUsClient, the object we need.
See https://wiki.weewoo.net/wiki/Translations for more info on the obfuscated names.
Remove CPack and previous WiX installer projects and sources
Add toolset and for WixSharp to facilitate client and server builds
individually or collectively.
Add multilanguage build with packaging=ON and translations=ON, and
standard build with packaging=ON. Builds are also aware of client and
server option settings.
Add correct LICENSE to installer
When building on CentOS 8 with default flags which includes Wall flag,
build stops because array n[3] is not initialized. Initialize it to have all
values to be zero.
Tested with v2020.10.22s and v2020.09.22s.
Unless the pattern we're searching for becomes invalid or the structures we're using change, the plugin should keep working.
searchInBuffer() searches for the specified pattern in the specified buffer. "?" is used as wildcard.
findPattern(), given a start address and the size of the area, reads memory in chunks of 32 KiB.
It stops when a match is found, the end is reached or an error is encountered (peek() fails).
There's also an overload which iterates through the specified module's readable regions.
The code was retrieving the wrong offset (GetLocalClient).
As a result, peek() always returned 0 and the player ID was always 1.
The plugin appeared to be working fine because the player ID is always 1 when playing locally.
Previously, only module() was present: it retrieved the base address of the specified module.
It worked fine, but it iterated through the process' modules every time it was called.
This commit replaces it with modules(), which returns an std::unordered_map containing all modules.
The map uses the module name as key and Module as value.
Aside from the performance improvement, the new code also provides info for each module region:
- Start address.
- Size.
- Whether it's readable, writable and/or executable.
"wchar_t" is usually 4 bytes big. That's not the case on Windows, where it's 2 bytes instead.
We cannot rely on that type on Linux because the target process could be native or running through Wine.
Also, it's possible that a game uses the same size for "wchar_t" on both Linux and Windows.
This commit introduces two variants of utf16ToUtf8():
1. Accepts std::u16string, for Windows processes.
2. Accepts std::u32string, for Linux processes.
The old variant, which accepted std::wstring, is removed to prevent misuses.
Toolhelp32ReadProcessMemory() takes the process ID, as opposed to ReadProcessMemory().
This allows us to read memory without the need for an handle (OpenProcess()).
Since most of the functions are already using C++, why not use classes as well?
This commit introduces the following classes:
- HostLinux: can only be compiled on Linux.
Implements peek() and module().
- HostWindows: can only be compiled on Windows.
Implements peek() and module().
- Process: abstract (cannot be instantiated directly).
Inherits from HostLinux on Linux and from HostWindows on Windows.
Provides functions that can be used with both Linux and Windows processes.
Pure virtual functions are implemented in the following classes:
- ProcessLinux: meant to be used with Linux processes, inherits from Process.
Only implements exportedSymbol(), due to the other functions being universal.
The constructor detects the architecture through the ELF header.
- ProcessWindows: meant to be used with Windows processes, inherits from Process.
Only implements exportedSymbol(), due to the other functions being universal.
The constructor detects the architecture through the NT header.
The new function is going to be used in a later commit.
readAll() is moved to mumble_plugin_utils.h and is renamed to readFile(), to make its purpose clearer.
This commit also moves the <math.h> include to mumble_plugin_utils.h, because that's where it's required.
Also, it's now included as <cmath>, as recommended for C++.
Installation paths can now be fine-tuned by setting the respective
MUMBLE_INSTALLATION_* variables when invoking cmake.
Additionally some components that only had install rules for a certain
OS are now installed on all OSes as these components should be needed
there as well.