summaryrefslogtreecommitdiffhomepage
path: root/proto-ft/ftnoir_protocol_ft.h
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-04-06 15:56:01 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-04-06 15:56:01 +0200
commit5ac80f5ed0dfff50af05d064401c37f88a28f894 (patch)
tree6a69aaf5fff871b2531ca2dcf70ac4a0bd53b33a /proto-ft/ftnoir_protocol_ft.h
parentba64bc2432e1c903bfd99477d31736db227171b7 (diff)
proto/ft: don't make games think opentrack is running after it quits
Some background: Our dll's for freetrack and npclient protocols don't support indication whether opentrack is running or not. Worse yet, they're whitelisted on Arma's anticheat system so we can't modify them at arbitrary times. It's possible to run multiple opentrack instances at a time and we can't have multiple instances stepping upon each other's toes. It's kind of pointless to run multiple sessions but hey. Implementation: Guard with a mutex against multiple instances. Only the first instance (that uses the freetrack protocol at all) gets to control whether the dll's are accessible. Remove the registry keys after either freetrack protocol exits or software exits, but only if we're the first opentrack instance running freetrack protocol at all. Issue: #332
Diffstat (limited to 'proto-ft/ftnoir_protocol_ft.h')
-rwxr-xr-x[-rw-r--r--]proto-ft/ftnoir_protocol_ft.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/proto-ft/ftnoir_protocol_ft.h b/proto-ft/ftnoir_protocol_ft.h
index 9cf16f03..8940e5d8 100644..100755
--- a/proto-ft/ftnoir_protocol_ft.h
+++ b/proto-ft/ftnoir_protocol_ft.h
@@ -21,6 +21,8 @@
#include "opentrack-compat/shm.h"
#include "opentrack-compat/options.hpp"
#include "freetrackclient/fttypes.h"
+#include <memory>
+
using namespace options;
struct settings : opts {
@@ -36,6 +38,15 @@ struct settings : opts {
typedef void (__stdcall *importTIRViewsStart)(void);
typedef void (__stdcall *importTIRViewsStop)(void);
+// for runonce, see mutex.cpp
+struct runonce
+{
+ virtual void try_runonce() = 0;
+ virtual void try_exit() = 0;
+ virtual bool is_first_run() = 0;
+ virtual ~runonce() {}
+};
+
class FTNoIR_Protocol : public IProtocol
{
public:
@@ -61,9 +72,14 @@ private:
QString connected_game;
QMutex game_name_mutex;
+ static std::unique_ptr<runonce> runonce_check;
+
static inline double getRadsFromDegrees(double degrees) { return degrees * 0.017453; }
void start_tirviews();
void start_dummy();
+
+public:
+ static void set_protocols(bool ft, bool npclient);
};
class FTControls: public IProtocolDialog