summaryrefslogtreecommitdiffhomepage
path: root/proto-ft
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-02-16 12:39:32 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-02-16 12:56:49 +0100
commitd9b56a39bf966e3eddf35b02a9400a3556823750 (patch)
treedf3d9b85993647b31d3d275d8a25ba1addf0454d /proto-ft
parentc011007165a6dee12f0b856411a8c8deaeb2d289 (diff)
proto/ft: fix idempotent dataid for freetrackclient
It can cause problems for `freetrackclient.dll' consumers. This fix is better than modulo rand().
Diffstat (limited to 'proto-ft')
-rw-r--r--proto-ft/ftnoir_protocol_ft.cpp5
-rw-r--r--proto-ft/ftnoir_protocol_ft.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp
index d240cc8d..0c97ffd2 100644
--- a/proto-ft/ftnoir_protocol_ft.cpp
+++ b/proto-ft/ftnoir_protocol_ft.cpp
@@ -97,7 +97,10 @@ void freetrack::pose(const double* headpose)
const std::int32_t id = load(ft->GameID);
- store(data->DataID, 60 * 5);
+ data_id++;
+ data_id %= 128;
+
+ store(data->DataID, 60 * 5 + data_id);
if (intGameID != id)
{
diff --git a/proto-ft/ftnoir_protocol_ft.h b/proto-ft/ftnoir_protocol_ft.h
index ac82bbd9..843d1f34 100644
--- a/proto-ft/ftnoir_protocol_ft.h
+++ b/proto-ft/ftnoir_protocol_ft.h
@@ -54,6 +54,7 @@ private:
int intGameID = -1;
QString connected_game;
QMutex game_name_mutex;
+ unsigned data_id = 0;
void start_dummy();
static float degrees_to_rads(double degrees);