diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-04-06 16:25:05 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-04-06 16:25:05 +0200 |
commit | 926b2b16c8df2e7c54de10780860176d2277e9b1 (patch) | |
tree | 3424a07f6ef6e226a59f4006777c6d6bd620fc05 /proto-ft/mutex.cpp | |
parent | 5ac80f5ed0dfff50af05d064401c37f88a28f894 (diff) |
proto/ft: make clear registry path on quit optional
Make clearing the dll path optional, defaulting to false. See previous
commit.
It has a side effect of games started before opentrack not seeing any
dll path, and loading nothing. That is, opentrack only functions when
tracking is started before a game is started.
Issue: #332
Diffstat (limited to 'proto-ft/mutex.cpp')
-rwxr-xr-x | proto-ft/mutex.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/proto-ft/mutex.cpp b/proto-ft/mutex.cpp index 0d50c9bd..34f5f518 100755 --- a/proto-ft/mutex.cpp +++ b/proto-ft/mutex.cpp @@ -5,6 +5,7 @@ class check_for_first_run : public runonce { bool checked_for_first_run; bool is_first_instance; + bool enabled; public: bool is_first_run() override @@ -12,11 +13,17 @@ public: return checked_for_first_run && is_first_instance; } + void set_enabled(bool flag) override + { + enabled = flag; + qDebug() << "ft runonce:" << "enabled" << flag; + } + void try_runonce() override { constexpr const char* name = "opentrack-freetrack-runonce"; - if (checked_for_first_run) + if (checked_for_first_run || !enabled) return; // just leak it, no issue @@ -44,7 +51,7 @@ public: void try_exit() override { - if (is_first_instance) + if (is_first_instance && enabled) { qDebug() << "ft runonce: removing registry keys"; FTNoIR_Protocol::set_protocols(false, false); @@ -52,9 +59,10 @@ public: } public: - check_for_first_run() : checked_for_first_run(false), is_first_instance(false) + check_for_first_run() : checked_for_first_run(false), is_first_instance(false), enabled(false) { } + ~check_for_first_run() { try_exit(); |