summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormrsanchos <orokhovatskiy@gmail.com>2018-02-16 21:05:36 +0300
committermrsanchos <orokhovatskiy@gmail.com>2018-02-16 21:05:36 +0300
commitb52fd95f1cc86e86ecb696eab07c8d6b6a2e9f5d (patch)
treea8d5a8c98d8ca3b60b0805504049275a3311f59b
parent82c43da829fdac974b3d6adb8742715382ddd051 (diff)
parent7a973ae2ad396c8413405e40bcb2eaab67c95d15 (diff)
Merge branch 'unstable' of https://github.com/opentrack/opentrack into unstable
-rw-r--r--api/plugin-api.cpp2
-rw-r--r--api/plugin-support.hpp2
-rw-r--r--bin/NPClient.dllbin16384 -> 13824 bytes
-rw-r--r--bin/NPClient64.dllbin17408 -> 17408 bytes
-rw-r--r--bin/qt.conf2
-rw-r--r--cmake/opentrack-i18n.cmake20
-rw-r--r--compat/macros.hpp30
-rw-r--r--contrib/npclient/COMPILE.TXT18
-rw-r--r--contrib/npclient/npclient.c278
-rw-r--r--csv/csv.cpp4
-rw-r--r--csv/csv.h5
-rw-r--r--filter-accela/accela-settings.hpp4
-rw-r--r--filter-accela/ftnoir_filter_accela.cpp3
-rw-r--r--gui/init.cpp83
-rw-r--r--logic/pipeline.cpp7
-rw-r--r--logic/pipeline.hpp4
-rw-r--r--migration/20160906_00-mappings.cpp4
-rw-r--r--migration/20160906_01-axis-signs.cpp77
-rw-r--r--migration/20160906_02-modules.cpp22
-rw-r--r--migration/20170420_00-udp-naming.cpp8
-rw-r--r--migration/20171013_00-tracker-pt-threshold.cpp6
-rw-r--r--pose-widget/pose-widget.cpp16
-rw-r--r--proto-ft/ftnoir_protocol_ft.cpp7
-rw-r--r--proto-ft/ftnoir_protocol_ft.h1
-rw-r--r--proto-mouse/ftnoir_protocol_mouse.cpp14
-rw-r--r--proto-vjoystick/vjoystick.cpp10
-rw-r--r--proto-vjoystick/vjoystick.h10
-rw-r--r--spline/spline-widget.cpp2
-rw-r--r--spline/spline.cpp2
-rw-r--r--spline/spline.hpp3
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.cpp26
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.h29
-rw-r--r--tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp2
-rw-r--r--tracker-pt/ftnoir_tracker_pt.cpp21
-rw-r--r--tracker-pt/ftnoir_tracker_pt.h4
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.cpp2
-rw-r--r--tracker-pt/lang/nl_NL.ts7
-rw-r--r--tracker-pt/lang/ru_RU.ts7
-rw-r--r--tracker-pt/lang/stub.ts7
-rw-r--r--tracker-pt/lang/zh_CN.ts191
-rw-r--r--tracker-pt/module/camera.cpp33
-rw-r--r--tracker-pt/module/camera.h6
-rw-r--r--tracker-pt/point_tracker.cpp2
-rw-r--r--tracker-pt/point_tracker.h2
-rw-r--r--tracker-pt/pt-api.cpp1
-rw-r--r--tracker-pt/pt-api.hpp6
-rw-r--r--tracker-s2bot/ftnoir_tracker_s2bot.cpp18
-rw-r--r--tracker-tobii-eyex/tobii-eyex.hpp2
-rw-r--r--tracker-wii/lang/zh_CN.ts291
-rw-r--r--tracker-wii/wii_camera.cpp11
-rw-r--r--tracker-wii/wii_camera.h6
-rw-r--r--tracker-wii/wiiyourself/wiimote.cpp4
-rw-r--r--tracker-wii/wiiyourself/wiimote.h15
53 files changed, 516 insertions, 821 deletions
diff --git a/api/plugin-api.cpp b/api/plugin-api.cpp
index a8ede390..6c9a21bc 100644
--- a/api/plugin-api.cpp
+++ b/api/plugin-api.cpp
@@ -60,7 +60,7 @@ IExtensionDialog::~IExtensionDialog()
bool module_status::is_ok() const
{
- return error.isEmpty();
+ return error.isNull();
}
module_status::module_status(const QString& error) : error(error) {}
diff --git a/api/plugin-support.hpp b/api/plugin-support.hpp
index 36a8c2bf..8fc01b98 100644
--- a/api/plugin-support.hpp
+++ b/api/plugin-support.hpp
@@ -159,7 +159,7 @@ private:
in = in.mid(pfx_len);
in = in.left(in.size() - rst_len);
- static const char* names[] =
+ static constexpr const char* const names[] =
{
"opentrack-tracker-",
"opentrack-proto-",
diff --git a/bin/NPClient.dll b/bin/NPClient.dll
index 54a2d0f6..565c4ff2 100644
--- a/bin/NPClient.dll
+++ b/bin/NPClient.dll
Binary files differ
diff --git a/bin/NPClient64.dll b/bin/NPClient64.dll
index f8315d50..5fe264bd 100644
--- a/bin/NPClient64.dll
+++ b/bin/NPClient64.dll
Binary files differ
diff --git a/bin/qt.conf b/bin/qt.conf
index 015754bf..7d3a9f12 100644
--- a/bin/qt.conf
+++ b/bin/qt.conf
@@ -1,5 +1,5 @@
[Platforms]
-WindowsArguments = dpiawareness=2
+WindowsArguments = dpiawareness=1
[Paths]
Libraries = .
LibraryExecutables = .
diff --git a/cmake/opentrack-i18n.cmake b/cmake/opentrack-i18n.cmake
index 3d384595..bc468e8a 100644
--- a/cmake/opentrack-i18n.cmake
+++ b/cmake/opentrack-i18n.cmake
@@ -11,13 +11,13 @@ function(otr_i18n_for_target_directory n)
add_custom_command(OUTPUT "${t2}"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/lang"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/lang"
- COMMAND "${lupdate-binary}" .
+ COMMAND "${lupdate-binary}"
-I "${CMAKE_SOURCE_DIR}"
-silent
-recursive
-no-obsolete
-locations none
- -no-ui-lines
+ .
-ts "${t}"
COMMAND "${CMAKE_COMMAND}" -E copy "${t}" "${t2}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
@@ -48,23 +48,15 @@ function(otr_merge_translations)
set(qm-output "${CMAKE_CURRENT_BINARY_DIR}/${i}.qm")
list(APPEND all-qm-files "${qm-output}")
+
add_custom_command(OUTPUT "${qm-output}"
COMMAND "${lrelease-binary}" -nounfinished -silent ${ts-files} -qm "${qm-output}"
DEPENDS ${ts-files}
COMMENT "Running lrelease for ${i}")
- otr_escape_string(esc-qm-output "${qm-output}")
- otr_escape_string(esc-i18n-pfx "${opentrack-i18n-pfx}")
- otr_escape_string(esc-perms "${opentrack-perms-file}")
- # this is because with i18n update disabled,
- # the file may not exist when running `make i18n-lang-foo_FOO'
- install(CODE "
- if(EXISTS \"${esc-qm-output}\")
- file(INSTALL \"${esc-qm-output}\"
- DESTINATION \"${esc-i18n-pfx}\"
- FILE_PERMISSIONS ${esc-perms})
- endif()
- ")
+ install(FILES "${qm-output}"
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/${opentrack-i18n-pfx}"
+ PERMISSIONS ${opentrack-perms-file})
endforeach()
add_custom_target(i18n ALL DEPENDS ${all-qm-files})
diff --git a/compat/macros.hpp b/compat/macros.hpp
index 7c017d3e..df71b1f3 100644
--- a/compat/macros.hpp
+++ b/compat/macros.hpp
@@ -21,28 +21,14 @@
# define never_inline
#endif
-#if defined __GNUG__
+#if defined __cplusplus
# define restrict_ptr __restrict
-#elif defined _MSC_VER
-# define restrict_ptr __restrict
-#else
-# define restrict_ptr
-#endif
-
-#if defined _MSC_VER
-# define restrict_ref restrict_ptr
-#elif defined __GNUG__
-# define restrict_ref restrict_ptr
-#else
-# define restrict_ref
#endif
#if defined _MSC_VER
# define force_inline __forceinline
-#elif defined __GNUG__
-# define force_inline __attribute__((always_inline, gnu_inline)) inline
#else
-# define force_inline inline
+# define force_inline __attribute__((always_inline, gnu_inline)) inline
#endif
#ifdef Q_CREATOR_RUN
@@ -53,18 +39,6 @@
# define warn_result_unused __attribute__((warn_unused_result))
#endif
-#if defined __GNUG__
-# define unused(t, i) t __attribute__((unused)) i
-#else
-# define unused(t, i) t
-#endif
-
-#if defined _MSC_VER
-# define aligned_struct(x) struct __declspec(align(x))
-#else
-# define aligned_struct(x) struct __attribute__((__aligned__(x)))
-#endif
-
#if defined __GNUC__
# define likely(x) __builtin_expect(!!(x),1)
# define unlikely(x) __builtin_expect(!!(x),0)
diff --git a/contrib/npclient/COMPILE.TXT b/contrib/npclient/COMPILE.TXT
index d355fbcc..aee101d0 100644
--- a/contrib/npclient/COMPILE.TXT
+++ b/contrib/npclient/COMPILE.TXT
@@ -3,9 +3,19 @@
# This makes small binaries:
CC=clang
-CFLAGS='-Wall -Wextra -Wpedantic -Os -s -ffunction-sections -fdata-sections -Wl,--kill-at,--nxcompat,--dynamicbase,--as-needed,--gc-sections,--strip-all'
+
+CFLAGS=' \
+-Wall -Wextra -Wpedantic -Os -fomit-frame-pointer -mtune=generic \
+-ffunction-sections -fdata-sections -fvisibility=hidden \
+-Wl,--kill-at,--nxcompat,--dynamicbase,--as-needed,--gc-sections \
+-Wl,--no-insert-timestamp \
+-fno-math-errno -fno-trapping-math -fmerge-all-constants \
+-fno-stack-protector \
+'
+
+STRIP='strip --strip-all --remove-section=.eh_frame'
cd -- "$(dirname -- "$0")" &&
-PATH=/mingw32/bin:"$PATH" sh -c "$CC -m32 $CFLAGS -mdll -o NPClient.dll npclient.c" &&
-PATH=/mingw64/bin:"$PATH" sh -c "$CC -m64 $CFLAGS -mdll -o NPClient64.dll npclient.c" &&
-ls -l NPClient{64,}.dll && mv NPClient{64,}.dll ../../bin/
+PATH=/mingw32/bin:"$PATH" sh -c "$CC -m32 -march=pentium4 $CFLAGS -mdll -o NPClient.dll npclient.c && $STRIP NPClient.dll" &&
+PATH=/mingw64/bin:"$PATH" sh -c "$CC -m64 -Wl,--high-entropy-va $CFLAGS -mdll -o NPClient64.dll npclient.c && $STRIP NPClient64.dll" &&
+ls -l NPClient{,64}.dll && openssl md5 NPClient{,64}.dll && mv NPClient{,64}.dll ../../bin/
diff --git a/contrib/npclient/npclient.c b/contrib/npclient/npclient.c
index 71c5ec2a..45488e3b 100644
--- a/contrib/npclient/npclient.c
+++ b/contrib/npclient/npclient.c
@@ -3,9 +3,9 @@
#include <stdarg.h>
#include <stdlib.h>
#include <stdbool.h>
+#include <stdint.h>
#include <math.h>
#include <string.h>
-#include <stdio.h>
#include <windows.h>
@@ -39,44 +39,82 @@ typedef struct TFreeTrackData
float Y3;
float X4;
float Y4;
-} TFreeTrackData;
+} volatile TFreeTrackData;
typedef struct FTMemMap
{
TFreeTrackData data;
- __int32 GameId;
+ uint32_t GameId;
unsigned char table[8];
- __int32 GameId2;
-} FTMemMap;
-
-static bool bEncryptionChecked = false;
-static double r = 0, p = 0, y = 0, tx = 0, ty = 0, tz = 0;
+ uint32_t GameId2;
+} volatile FTMemMap;
#define NP_DECLSPEC __declspec(dllexport)
#define NP_EXPORT(t) t NP_DECLSPEC __stdcall
#define NP_AXIS_MAX 16383
-static bool FTCreateMapping(void);
-static void FTDestroyMapping(void);
-static __inline double clamp(double x, double xmin, double xmax);
-static __inline double clamp_(double x);
+static HANDLE hFTMemMap = 0;
+static FTMemMap* pMemData = 0;
+
+#if defined _MSC_VER
+# define force_inline __forceinline
+#else
+# define force_inline __attribute__((always_inline, gnu_inline)) inline
+#endif
-#if DEBUG
+#ifdef DEBUG
+# include <stdio.h>
+# define dbg_report(fmt, ...) do { if (debug_stream) { fprintf(debug_stream, fmt "\n", __VA_ARGS__); fflush(debug_stream); } } while (0)
static FILE *debug_stream;
-#define dbg_report(...) do { if (debug_stream) { fprintf(debug_stream, __VA_ARGS__); fflush(debug_stream); } } while(0);
#else
-#define dbg_report(...)
+# define dbg_report(...) do { (void)0; } while (0)
#endif
-typedef enum npclient_status_ {
- NPCLIENT_STATUS_OK,
- NPCLIENT_STATUS_DISABLED
-} npclient_status;
+static bool FTCreateMapping(void)
+{
+ if (pMemData)
+ return true;
-static HANDLE hFTMemMap = 0;
-static FTMemMap volatile * pMemData = 0;
-static bool bEncryption = false;
-static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ dbg_report("FTCreateMapping request (pMemData == NULL)");
+
+ HANDLE hFTMutex = CreateMutexA(NULL, FALSE, FREETRACK_MUTEX);
+ CloseHandle(hFTMutex);
+
+ hFTMemMap = CreateFileMappingA(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, sizeof(FTMemMap), FT_MM_DATA);
+ pMemData = (FTMemMap *) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof(FTMemMap));
+ if (pMemData != NULL)
+ pMemData->data.DataID = -1;
+ return pMemData != NULL;
+}
+
+static void FTDestroyMapping(void)
+{
+ if (pMemData != NULL)
+ {
+ InterlockedExchange((LONG volatile*) &pMemData->data.DataID, -1);
+ UnmapViewOfFile((void*)pMemData);
+ }
+
+ CloseHandle(hFTMemMap);
+ pMemData = 0;
+ hFTMemMap = 0;
+}
+
+static force_inline double clamp(double x, double xmin, double xmax)
+{
+ if (x > xmax)
+ return xmax;
+
+ if (x < xmin)
+ return xmin;
+
+ return x;
+}
+
+static force_inline double clamp_(double x)
+{
+ return clamp(x, -NP_AXIS_MAX, NP_AXIS_MAX);
+}
typedef struct tir_data
{
@@ -86,44 +124,46 @@ typedef struct tir_data
float roll, pitch, yaw;
float tx, ty, tz;
float padding[9];
-} tir_data_t;
+} tir_data;
typedef struct tir_signature
{
char DllSignature[200];
char AppSignature[200];
-} tir_signature_t;
+} tir_signature;
BOOL DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
- UNUSED(lpvReserved);
+ UNUSED(lpvReserved); UNUSED(hinstDLL);
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
-#if DEBUG
+#ifdef DEBUG
debug_stream = fopen("c:\\NPClient.log", "a");
#endif
+
#ifdef _WIN64
- dbg_report("\n= WIN64 =========================================================================================\n");
+ dbg_report("\n= WIN64 =========================================================================================");
#else
- dbg_report("\n= WIN32 =========================================================================================\n");
+ dbg_report("\n= WIN32 =========================================================================================");
#endif
- dbg_report("DllMain: (%p, %ld, %p)\n", (void*) hinstDLL, (long) fdwReason, lpvReserved);
- dbg_report("DllMain: Attach request\n");
- DisableThreadLibraryCalls(hinstDLL);
+ dbg_report("DllMain: (%p, %ld, %p)", (void*) hinstDLL, (long) fdwReason, lpvReserved);
+ dbg_report("DllMain: Attach request");
#if 0
+ DisableThreadLibraryCalls(hinstDLL);
timeBeginPeriod(1);
#endif
break;
case DLL_PROCESS_DETACH:
- dbg_report("DllMain: Detach\n");
+ dbg_report("DllMain: Detach");
dbg_report("DllMain: (%p, %ld, %p)\n", (void*) hinstDLL, (long) fdwReason, lpvReserved);
- dbg_report("==========================================================================================\n");
+ dbg_report("==========================================================================================");
#if 0
timeEndPeriod(1);
#endif
+
FTDestroyMapping();
break;
}
@@ -135,7 +175,7 @@ BOOL DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
NP_EXPORT(int) NPPriv_ClientNotify(void)
{
- dbg_report("stub\n");
+ dbg_report("stub");
/* @stub in .spec */
return 0;
}
@@ -145,7 +185,7 @@ NP_EXPORT(int) NPPriv_ClientNotify(void)
NP_EXPORT(int) NPPriv_GetLastError(void)
{
- dbg_report("stub\n");
+ dbg_report("stub");
/* @stub in .spec */
return 0;
}
@@ -155,7 +195,7 @@ NP_EXPORT(int) NPPriv_GetLastError(void)
NP_EXPORT(int) NPPriv_SetData(void)
{
- dbg_report("stub\n");
+ dbg_report("stub");
/* @stub in .spec */
return 0;
}
@@ -165,7 +205,7 @@ NP_EXPORT(int) NPPriv_SetData(void)
NP_EXPORT(int) NPPriv_SetLastError(void)
{
- dbg_report("stub\n");
+ dbg_report("stub");
/* @stub in .spec */
return 0;
}
@@ -175,7 +215,7 @@ NP_EXPORT(int) NPPriv_SetLastError(void)
NP_EXPORT(int) NPPriv_SetParameter(void)
{
- dbg_report("stub\n");
+ dbg_report("stub");
/* @stub in .spec */
return 0;
}
@@ -185,7 +225,7 @@ NP_EXPORT(int) NPPriv_SetParameter(void)
NP_EXPORT(int) NPPriv_SetSignature(void)
{
- dbg_report("stub\n");
+ dbg_report("stub");
/* @stub in .spec */
return 0;
}
@@ -195,7 +235,7 @@ NP_EXPORT(int) NPPriv_SetSignature(void)
NP_EXPORT(int) NPPriv_SetVersion(void)
{
- dbg_report("stub\n");
+ dbg_report("stub");
/* @stub in .spec */
return 0;
}
@@ -262,7 +302,7 @@ static unsigned cksum(unsigned char buf[], unsigned size)
return (unsigned)c;
}
-static __inline void enhance(unsigned char buf[], unsigned size, unsigned char table[], unsigned table_size)
+static inline void enhance(unsigned char buf[], unsigned size, unsigned char table[], unsigned table_size)
{
unsigned table_ptr = 0;
unsigned char var = 0x88;
@@ -288,24 +328,28 @@ static __inline void enhance(unsigned char buf[], unsigned size, unsigned char t
* NP_GetData (NPCLIENT.8)
*/
-NP_EXPORT(int) NP_GetData(tir_data_t * data)
+typedef enum npclient_status_ {
+ NPCLIENT_STATUS_OK,
+ NPCLIENT_STATUS_DISABLED
+} npclient_status;
+
+NP_EXPORT(int) NP_GetData(tir_data* data)
{
- static int frameno = 0;
- int i;
-#if DEBUG
- int recv = 0;
-#endif
+ static double r = 0, p = 0, y = 0, tx = 0, ty = 0, tz = 0;
+ static unsigned frameno = 0;
+ static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ static bool bEncryption = false;
+ static bool bEncryptionChecked = false;
+ int i, data_id = -1;
+
if (!FTCreateMapping())
{
- dbg_report("Can't open mapping\n");
- return 0;
+ dbg_report("Can't open mapping");
+ return NPCLIENT_STATUS_DISABLED;
}
- if (pMemData)
+ if (pMemData->GameId > 0 && pMemData->GameId == pMemData->GameId2)
{
-#if DEBUG
- recv = 1;
-#endif
y = pMemData->data.Yaw * NP_AXIS_MAX / M_PI;
p = pMemData->data.Pitch * NP_AXIS_MAX / M_PI;
r = pMemData->data.Roll * NP_AXIS_MAX / M_PI;
@@ -314,9 +358,9 @@ NP_EXPORT(int) NP_GetData(tir_data_t * data)
ty = pMemData->data.Y * NP_AXIS_MAX / 500.;
tz = pMemData->data.Z * NP_AXIS_MAX / 500.;
- if (pMemData->GameId == pMemData->GameId2 && !bEncryptionChecked)
+ if (!bEncryptionChecked)
{
- dbg_report("NP_GetData: game = %d\n", pMemData->GameId);
+ dbg_report("NP_GetData: game = %d", pMemData->GameId);
bEncryptionChecked = true;
memcpy(table, (void*)pMemData->table, 8);
for (i = 0; i < 8; i++)
@@ -325,15 +369,17 @@ NP_EXPORT(int) NP_GetData(tir_data_t * data)
bEncryption = true;
break;
}
- dbg_report("NP_GetData: Table = %02d %02d %02d %02d %02d %02d %02d %02d\n", table[0],table[1],table[2],table[3],table[4],table[5], table[6], table[7]);
+ dbg_report("NP_GetData: Table = %02d %02d %02d %02d %02d %02d %02d %02d", table[0],table[1],table[2],table[3],table[4],table[5], table[6], table[7]);
}
+
+ data_id = InterlockedCompareExchange((LONG volatile*) &pMemData->data.DataID, -1, -1);
}
frameno++;
+ frameno %= 1u << 16;
data->frame = frameno;
- int data_id = InterlockedCompareExchange((LONG volatile*) &pMemData->data.DataID, -1, -1);
- bool running;
+ bool running = false;
if (data_id == 0)
{
@@ -346,12 +392,6 @@ NP_EXPORT(int) NP_GetData(tir_data_t * data)
running = true;
(void)InterlockedCompareExchange((LONG volatile*) &pMemData->data.DataID, data_id - 1, data_id);
}
- else
- {
- running = false;
- // clamp to (-1) if still negative
- (void)InterlockedCompareExchange((LONG volatile*) &pMemData->data.DataID, -1, data_id);
- }
data->status = running ? NPCLIENT_STATUS_OK : NPCLIENT_STATUS_DISABLED;
data->cksum = 0;
@@ -364,17 +404,17 @@ NP_EXPORT(int) NP_GetData(tir_data_t * data)
data->ty = clamp_(ty);
data->tz = clamp_(tz);
- for(i = 0; i < 9; ++i)
- data->padding[i] = 0.0;
+ for (i = 0; i < 9; ++i)
+ data->padding[i] = 0;
-#if DEBUG
- dbg_report("GetData: rotation: %d %f %f %f\n", recv, data->yaw, data->pitch, data->roll);
+#ifdef DEBUG
+ dbg_report("GetData: rotation: %f %f %f", data->yaw, data->pitch, data->roll);
#endif
- data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t));
+ data->cksum = cksum((unsigned char*)data, sizeof(data));
if (bEncryption)
- enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table));
+ enhance((unsigned char*)data, sizeof(data), table, sizeof(table));
return running ? NPCLIENT_STATUS_OK : NPCLIENT_STATUS_DISABLED;
}
@@ -385,8 +425,8 @@ NP_EXPORT(int) NP_GetData(tir_data_t * data)
NP_EXPORT(int) NP_GetParameter(int arg0, int arg1)
{
UNUSED(arg0); UNUSED(arg1);
- dbg_report("GetParameter request: %d %d\n", arg0, arg1);
- return (int) 0;
+ dbg_report("GetParameter request: %d %d", arg0, arg1);
+ return 0;
}
/******************************************************************
@@ -395,7 +435,7 @@ NP_EXPORT(int) NP_GetParameter(int arg0, int arg1)
*
*/
-static unsigned char volatile const part2_2[200] = {
+static unsigned char volatile const part2_2[] = {
0xe3, 0xe5, 0x8e, 0xe8, 0x06, 0xd4, 0xab,
0xcf, 0xfa, 0x51, 0xa6, 0x84, 0x69, 0x52,
0x21, 0xde, 0x6b, 0x71, 0xe6, 0xac, 0xaa,
@@ -410,11 +450,10 @@ static unsigned char volatile const part2_2[200] = {
0xe4, 0xc0, 0xf1, 0x7f, 0x87, 0xd0, 0x70,
0xa4, 0x04, 0x07, 0x05, 0x69, 0x2a, 0x16,
0x15, 0x55, 0x85, 0xa6, 0x30, 0xc8, 0xb6,
- 0x00
};
-static unsigned char volatile const part1_2[200] = {
+static unsigned char volatile const part1_2[] = {
0x6d, 0x0b, 0xab, 0x56, 0x74, 0xe6, 0x1c,
0xff, 0x24, 0xe8, 0x34, 0x8f, 0x00, 0x63,
0xed, 0x47, 0x5d, 0x9b, 0xe1, 0xe0, 0x1d,
@@ -430,10 +469,10 @@ static unsigned char volatile const part1_2[200] = {
0x5d, 0x1a, 0xb4, 0x84, 0x9c, 0x29, 0xf0,
0xe6, 0x69, 0x73, 0x66, 0x0e, 0x4b, 0x3c,
0x7d, 0x99, 0x8b, 0x4e, 0x7d, 0xaf, 0x86,
- 0x92, 0xff
+ 0x92
};
-static volatile unsigned char part2_1[200] = {
+static unsigned char volatile const part2_1[] = {
0x8b, 0x84, 0xfc, 0x8c, 0x71, 0xb5, 0xd9,
0xaa, 0xda, 0x32, 0xc7, 0xe9, 0x0c, 0x20,
0x40, 0xd4, 0x4b, 0x02, 0x89, 0xca, 0xde,
@@ -448,10 +487,9 @@ static volatile unsigned char part2_1[200] = {
0x81, 0x83, 0x9e, 0x11, 0xf3, 0xa2, 0x1f,
0xc8, 0x24, 0x53, 0x60, 0x0a, 0x42, 0x78,
0x7a, 0x39, 0xea, 0xc1, 0x59, 0xad, 0xc5,
- 0x00
};
-static volatile unsigned char part1_1[200] = {
+static unsigned char volatile const part1_1[] = {
0x1d, 0x79, 0xce, 0x35, 0x1d, 0x95, 0x79,
0xdf, 0x4c, 0x8d, 0x55, 0xeb, 0x20, 0x17,
0x9f, 0x26, 0x3e, 0xf0, 0x88, 0x8e, 0x7a,
@@ -467,24 +505,30 @@ static volatile unsigned char part1_1[200] = {
0x24, 0x7f, 0xf7, 0xeb, 0xf2, 0x5d, 0x82,
0x89, 0x05, 0x53, 0x32, 0x6b, 0x28, 0x54,
0x13, 0xf6, 0xe7, 0x21, 0x1a, 0xc6, 0xe3,
- 0xe1, 0xff
+ 0xe1
};
-NP_EXPORT(int) NP_GetSignature(tir_signature_t * sig)
+NP_EXPORT(int) NP_GetSignature(tir_signature* sig)
{
- int i;
- dbg_report("GetSignature request\n");
+ unsigned i;
+ dbg_report("GetSignature request");
- for (i = 0; i < 200; i++)
+ for (i = 0; i < sizeof(part1_1); i++)
sig->DllSignature[i] = part1_2[i] ^ part1_1[i];
- for (i = 0; i < 200; i++)
+ for (; i < 200; i++)
+ sig->DllSignature[i] = '\0';
+
+ for (i = 0; i < sizeof(part2_1); i++)
sig->AppSignature[i] = part2_1[i] ^ part2_2[i];
+ for (; i < 200; i++)
+ sig->AppSignature[i] = '\0';
+
return 0;
}
-NP_EXPORT(int) NP_QueryVersion(unsigned short * version)
+NP_EXPORT(int) NP_QueryVersion(unsigned short* version)
{
- dbg_report("QueryVersion request\n");
+ dbg_report("QueryVersion request");
*version=0x0500;
return 0;
}
@@ -517,7 +561,7 @@ NP_EXPORT(int) NP_RegisterWindowHandle(HWND hwnd)
{
UNUSED(hwnd);
dbg_report("RegisterWindowHandle request: %p\n", (void*) hwnd);
- return (int) 0;
+ return 0;
}
/******************************************************************
* NP_RequestData (NPCLIENT.15)
@@ -527,7 +571,7 @@ NP_EXPORT(int) NP_RequestData(unsigned short req)
{
UNUSED(req);
dbg_report("RequestData request: %d\n", req);
- return (int) 0;
+ return 0;
}
/******************************************************************
* NP_SetParameter (NPCLIENT.16)
@@ -537,7 +581,7 @@ NP_EXPORT(int) NP_SetParameter(int arg0, int arg1)
{
UNUSED(arg0); UNUSED(arg1);
dbg_report("SetParameter request: %d %d\n", arg0, arg1);
- return (int) 0;
+ return 0;
}
/******************************************************************
* NP_StartCursor (NPCLIENT.17)
@@ -546,7 +590,7 @@ NP_EXPORT(int) NP_SetParameter(int arg0, int arg1)
NP_EXPORT(int) NP_StartCursor(void)
{
dbg_report("StartCursor request\n");
- return (int) 0;
+ return 0;
}
/******************************************************************
* NP_StartDataTransmission (NPCLIENT.18)
@@ -556,7 +600,7 @@ NP_EXPORT(int) NP_StartDataTransmission(void)
{
dbg_report("StartDataTransmission request.\n");
- return (int) 0;
+ return 0;
}
/******************************************************************
* NP_StopCursor (NPCLIENT.19)
@@ -565,7 +609,7 @@ NP_EXPORT(int) NP_StartDataTransmission(void)
NP_EXPORT(int) NP_StopCursor(void)
{
dbg_report("StopCursor request\n");
- return (int) 0;
+ return 0;
}
/******************************************************************
* NP_StopDataTransmission (NPCLIENT.20)
@@ -573,7 +617,7 @@ NP_EXPORT(int) NP_StopCursor(void)
NP_EXPORT(int) NP_StopDataTransmission(void)
{
- return (int) 0;
+ return 0;
}
/******************************************************************
* NP_UnregisterWindowHandle (NPCLIENT.21)
@@ -582,48 +626,6 @@ NP_EXPORT(int) NP_StopDataTransmission(void)
NP_EXPORT(int) NP_UnregisterWindowHandle(void)
{
dbg_report("UnregisterWindowHandle request\n");
- return (int) 0;
-}
-
-static bool FTCreateMapping(void)
-{
- if (pMemData)
- return true;
-
- dbg_report("FTCreateMapping request (pMemData == NULL).\n");
-
- HANDLE hFTMutex = CreateMutexA(NULL, FALSE, FREETRACK_MUTEX);
- CloseHandle(hFTMutex);
-
- hFTMemMap = CreateFileMappingA(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, sizeof(FTMemMap), (LPCSTR) FT_MM_DATA);
- pMemData = (FTMemMap *) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof(FTMemMap));
- if (pMemData != NULL)
- pMemData->data.DataID = 1;
- return pMemData != NULL;
-}
-
-static void FTDestroyMapping(void)
-{
- if (pMemData != NULL)
- UnmapViewOfFile((void*)pMemData);
-
- CloseHandle(hFTMemMap);
- pMemData = 0;
- hFTMemMap = 0;
-}
-
-static __inline double clamp(double x, double xmin, double xmax)
-{
- if (x > xmax)
- return xmax;
-
- if (x < xmin)
- return xmin;
-
- return x;
+ return 0;
}
-static __inline double clamp_(double x)
-{
- return clamp(x, -NP_AXIS_MAX, NP_AXIS_MAX);
-}
diff --git a/csv/csv.cpp b/csv/csv.cpp
index 189d05d9..8a5f5784 100644
--- a/csv/csv.cpp
+++ b/csv/csv.cpp
@@ -19,7 +19,7 @@
#include <utility>
#include <algorithm>
-const QTextCodec* CSV::m_codec = QTextCodec::codecForName("System");
+const QTextCodec* const CSV::m_codec = QTextCodec::codecForName("System");
const QRegExp CSV::m_rx = QRegExp(QString("((?:(?:[^;\\n]*;?)|(?:\"[^\"]*\";?))*)?\\n?"));
const QRegExp CSV::m_rx2 = QRegExp(QString("(?:\"([^\"]*)\";?)|(?:([^;]*);?)?"));
@@ -45,7 +45,7 @@ QString CSV::readLine()
}
else
{
- static const QChar lf(QChar::LineFeed);
+ const QChar lf(QChar::LineFeed);
while (m_pos < m_string.length())
if (m_string[m_pos++] == lf)
diff --git a/csv/csv.h b/csv/csv.h
index 34fa75d8..9e72b2bb 100644
--- a/csv/csv.h
+++ b/csv/csv.h
@@ -21,7 +21,6 @@ private:
QString m_string;
int m_pos;
- static const QTextCodec* m_codec;
- static const QRegExp m_rx;
- static const QRegExp m_rx2; // Silly M$ compiler! It will generate an error if both of these variables are declared on the same line! (M$ Visual Studio Community 2015, Update 3)
+ static QTextCodec const* const m_codec;
+ static const QRegExp m_rx, m_rx2;
};
diff --git a/filter-accela/accela-settings.hpp b/filter-accela/accela-settings.hpp
index 2fea2f33..63173aa8 100644
--- a/filter-accela/accela-settings.hpp
+++ b/filter-accela/accela-settings.hpp
@@ -19,7 +19,7 @@ struct settings_accela : opts
double x, y;
};
- static constexpr gains rot_gains[16] =
+ static constexpr inline gains const rot_gains[16] =
{
{ 9, 300 },
{ 8, 200 },
@@ -30,7 +30,7 @@ struct settings_accela : opts
{ .5, .4 },
};
- static constexpr gains pos_gains[16] =
+ static constexpr inline gains const pos_gains[16] =
{
{ 9, 200 },
{ 8, 150 },
diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp
index fc660d2c..23d71ef0 100644
--- a/filter-accela/ftnoir_filter_accela.cpp
+++ b/filter-accela/ftnoir_filter_accela.cpp
@@ -14,9 +14,6 @@
#include "compat/math-imports.hpp"
-constexpr settings_accela::gains settings_accela::rot_gains[16];
-constexpr settings_accela::gains settings_accela::pos_gains[16];
-
accela::accela() : first_run(true)
{
s.make_splines(spline_rot, spline_pos);
diff --git a/gui/init.cpp b/gui/init.cpp
index e648cfa0..51ffbf3e 100644
--- a/gui/init.cpp
+++ b/gui/init.cpp
@@ -61,7 +61,7 @@ void set_qt_style()
#if defined _WIN32 || defined __APPLE__
// our layouts on OSX make some control wrongly sized -sh 20160908
{
- const char* preferred[] { "fusion", "windowsvista", "macintosh" };
+ const char* const preferred[] { "fusion", "windowsvista", "macintosh" };
for (const char* style_name : preferred)
{
QStyle* s = QStyleFactory::create(style_name);
@@ -143,7 +143,29 @@ void add_win32_path()
}
}
-void attach_parent_console();
+#include <windows.h>
+
+void attach_parent_console()
+{
+ std::fflush(stdin);
+ std::fflush(stderr);
+
+ (void)qInstallMessageHandler(qdebug_to_console);
+
+ if (AttachConsole(ATTACH_PARENT_PROCESS))
+ {
+ _wfreopen(L"CON", L"w", stdout);
+ _wfreopen(L"CON", L"w", stderr);
+ _wfreopen(L"CON", L"r", stdin);
+ freopen("CON", "w", stdout);
+ freopen("CON", "w", stderr);
+ freopen("CON", "w", stderr);
+
+ // skip prompt in cmd.exe window
+ fprintf(stderr, "\n");
+ fflush(stderr);
+ }
+}
#endif
@@ -163,10 +185,6 @@ int run_window(QApplication& app, std::unique_ptr<QWidget> main_window)
int otr_main(int argc, char** argv, std::function<QWidget*()> make_main_window)
{
-#ifdef _WIN32
- attach_parent_console();
-#endif
-
#if defined OTR_HAS_DENORM_CONTROL
set_fp_mask();
#endif
@@ -178,55 +196,44 @@ int otr_main(int argc, char** argv, std::function<QWidget*()> make_main_window)
#ifdef _WIN32
add_win32_path();
+ attach_parent_console();
#endif
QDir::setCurrent(OPENTRACK_BASE_PATH);
-#if 0
-#if !defined(__linux) && !defined _WIN32
- // workaround QTBUG-38598
- QCoreApplication::addLibraryPath(".");
-#endif
-#endif
-
set_qt_style();
QTranslator t;
- // QLocale::setDefault(QLocale("ru_RU")); // force i18n for testing
-
- if (group::with_global_settings_object([&](QSettings& s) {
- return !s.value("disable-translation", false).toBool();
- }))
{
- (void) t.load(QLocale(), "", "", OPENTRACK_BASE_PATH + "/" OPENTRACK_I18N_PATH, ".qm");
- (void) QCoreApplication::installTranslator(&t);
+ const char* forced_locale = getenv("OTR_FORCE_LANG");
+
+ if (forced_locale)
+ {
+ QLocale::setDefault(QLocale(forced_locale)); // force i18n for testing
+ qDebug() << "locale:" << forced_locale;
+ }
+
+ const bool no_i18n = group::with_global_settings_object([](QSettings& s) {
+ return !s.value("disable-translation", false).toBool();
+ });
+
+ if (forced_locale || !no_i18n)
+ {
+ (void) t.load(QLocale(), "", "", OPENTRACK_BASE_PATH + "/" OPENTRACK_I18N_PATH, ".qm");
+ (void) QCoreApplication::installTranslator(&t);
+ }
}
int ret = run_window(app, std::unique_ptr<QWidget>(make_main_window()));
+#if 0
// msvc crashes in Qt plugin system's dtor
// Note: QLibrary::PreventUnloadHint seems to workaround it
-#if defined(_MSC_VER) && 0
- qDebug() << "exit: terminating";
+#if defined _MSC_VER
TerminateProcess(GetCurrentProcess(), 0);
#endif
+#endif
return ret;
}
-#if defined _WIN32
-#include <windows.h>
-
-void attach_parent_console()
-{
- if (AttachConsole(ATTACH_PARENT_PROCESS))
- {
- // XXX c++ iostreams aren't reopened
-
- _wfreopen(L"CON", L"w", stdout);
- _wfreopen(L"CON", L"w", stderr);
- _wfreopen(L"CON", L"r", stdin);
- }
- (void)qInstallMessageHandler(qdebug_to_console);
-}
-#endif
diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp
index d690b406..9059a251 100644
--- a/logic/pipeline.cpp
+++ b/logic/pipeline.cpp
@@ -190,8 +190,6 @@ static bool is_nan(const dmat<u,w>& r)
return false;
}
-constexpr double pipeline::c_mult;
-constexpr double pipeline::c_div;
template<typename x, typename y, typename... xs>
static inline bool nan_check_(const x& datum, const y& next, const xs&... rest)
{
@@ -480,8 +478,9 @@ void pipeline::run()
#endif
{
- static constexpr const char* posechannels[6] = { "TX", "TY", "TZ", "Yaw", "Pitch", "Roll" };
- static constexpr const char* datachannels[5] = { "dt", "raw", "corrected", "filtered", "mapped" };
+ static const char* const posechannels[6] = { "TX", "TY", "TZ", "Yaw", "Pitch", "Roll" };
+ static const char* const datachannels[5] = { "dt", "raw", "corrected", "filtered", "mapped" };
+
logger.write(datachannels[0]);
char buffer[128];
for (unsigned j = 1; j < 5; ++j)
diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp
index 0061e439..1e1919f4 100644
--- a/logic/pipeline.hpp
+++ b/logic/pipeline.hpp
@@ -114,8 +114,8 @@ private:
void run() override;
// note: float exponent base is 2
- static constexpr double c_mult = 16;
- static constexpr double c_div = 1./c_mult;
+ static constexpr inline double c_mult = 16;
+ static constexpr inline double c_div = 1./c_mult;
public:
pipeline(Mappings& m, runtime_libraries& libs, event_handler& ev, TrackLogger& logger);
~pipeline();
diff --git a/migration/20160906_00-mappings.cpp b/migration/20160906_00-mappings.cpp
index 0712afca..567fbdcb 100644
--- a/migration/20160906_00-mappings.cpp
+++ b/migration/20160906_00-mappings.cpp
@@ -20,7 +20,7 @@
using namespace migrations;
-static const char* old_names[] =
+static const char* const old_names[] =
{
"tx", "tx_alt",
"ty", "ty_alt",
@@ -30,7 +30,7 @@ static const char* old_names[] =
"rz", "rz_alt",
};
-static const char* new_names[] = {
+static const char* const new_names[] = {
"spline-X", "alt-spline-X",
"spline-Y", "alt-spline-Y",
"spline-Z", "alt-spline-Z",
diff --git a/migration/20160906_01-axis-signs.cpp b/migration/20160906_01-axis-signs.cpp
index 6dfa0d7c..7b0be70a 100644
--- a/migration/20160906_01-axis-signs.cpp
+++ b/migration/20160906_01-axis-signs.cpp
@@ -15,13 +15,18 @@
using namespace options;
using namespace migrations;
+const char* const axis_names[] =
+{
+ "yaw", "pitch", "roll",
+ "x", "y", "z",
+};
+
+const QString alt_sign_fmt = QStringLiteral("%1-alt-axis-sign");
+
struct axis_signs_split_rc11 : migration
{
axis_signs_split_rc11() = default;
- static const char* axis_names[6];
- static const QString fmt;
-
QString unique_date() const override
{
return "20160909_01";
@@ -32,47 +37,43 @@ struct axis_signs_split_rc11 : migration
return "asymmetric axis option to other section";
}
- bool should_run() const override
+ bool should_run() const override;
+ void run() override;
+};
+
+OPENTRACK_MIGRATION(axis_signs_split_rc11);
+
+bool axis_signs_split_rc11::should_run() const
+{
+ bundle new_bundle = make_bundle("opentrack-mappings");
+ bundle old_bundle = make_bundle("opentrack-ui");
+
+ for (const char* name : axis_names)
{
- bundle new_bundle = make_bundle("opentrack-mappings");
- bundle old_bundle = make_bundle("opentrack-ui");
-
- for (const char* name : axis_names)
- {
- // new present, already applied
- if (new_bundle->contains(fmt.arg(name)))
- return false;
- }
-
- for (const char* name : axis_names)
- {
- // old present
- if (old_bundle->contains(fmt.arg(name)))
- return true;
- }
-
- // nothing to copy
- return false;
+ // new present, already applied
+ if (new_bundle->contains(alt_sign_fmt.arg(name)))
+ return false;
}
- void run() override
+ for (const char* name : axis_names)
{
- bundle new_bundle = make_bundle("opentrack-mappings");
- bundle old_bundle = make_bundle("opentrack-ui");
-
- for (const char* name : axis_names)
- new_bundle->store_kv(fmt.arg(name), QVariant(old_bundle->get<bool>(fmt.arg(name))));
-
- new_bundle->save();
+ // old present
+ if (old_bundle->contains(alt_sign_fmt.arg(name)))
+ return true;
}
-};
-const char* axis_signs_split_rc11::axis_names[] =
+ // nothing to copy
+ return false;
+}
+
+void axis_signs_split_rc11::run()
{
- "yaw", "pitch", "roll",
- "x", "y", "z",
-};
+ bundle new_bundle = make_bundle("opentrack-mappings");
+ bundle old_bundle = make_bundle("opentrack-ui");
-const QString axis_signs_split_rc11::fmt = QStringLiteral("%1-alt-axis-sign");
+ for (const char* name : axis_names)
+ new_bundle->store_kv(alt_sign_fmt.arg(name),
+ QVariant(old_bundle->get<bool>(alt_sign_fmt.arg(name))));
-OPENTRACK_MIGRATION(axis_signs_split_rc11);
+ new_bundle->save();
+}
diff --git a/migration/20160906_02-modules.cpp b/migration/20160906_02-modules.cpp
index 0f0951f1..9ce2b9dc 100644
--- a/migration/20160906_02-modules.cpp
+++ b/migration/20160906_02-modules.cpp
@@ -15,12 +15,17 @@
using namespace options;
using namespace migrations;
+static const char* const module_names[3] =
+{
+ "tracker-dll",
+ "protocol-dll",
+ "filter-dll",
+};
+
struct split_modules_rc11 : migration
{
split_modules_rc11() = default;
- static const char* names[3];
-
QString unique_date() const override
{
return "20160909_02";
@@ -36,11 +41,11 @@ struct split_modules_rc11 : migration
bundle new_bundle = make_bundle("modules");
bundle old_bundle = make_bundle("opentrack-ui");
- for (const char* name : names)
+ for (const char* name : module_names)
if (new_bundle->contains(name))
return false;
- for (const char* name : names)
+ for (const char* name : module_names)
if (old_bundle->contains(name))
return true;
@@ -52,18 +57,11 @@ struct split_modules_rc11 : migration
bundle new_bundle = make_bundle("modules");
bundle old_bundle = make_bundle("opentrack-ui");
- for (const char* name : names)
+ for (const char* name : module_names)
new_bundle->store_kv(name, QVariant(old_bundle->get<QString>(name)));
new_bundle->save();
}
};
-const char* split_modules_rc11::names[3] =
-{
- "tracker-dll",
- "protocol-dll",
- "filter-dll",
-};
-
OPENTRACK_MIGRATION(split_modules_rc11);
diff --git a/migration/20170420_00-udp-naming.cpp b/migration/20170420_00-udp-naming.cpp
index de4674bd..0361b7b9 100644
--- a/migration/20170420_00-udp-naming.cpp
+++ b/migration/20170420_00-udp-naming.cpp
@@ -13,11 +13,11 @@
using namespace migrations;
using namespace options;
-static constexpr const char* old_tracker_name = "UDP sender";
-static constexpr const char* old_proto_name = "UDP Tracker";
+static const char* const old_tracker_name = "UDP sender";
+static const char* const old_proto_name = "UDP Tracker";
-static constexpr const char* new_tracker_name = "UDP over network";
-static constexpr const char* new_proto_name = "UDP over network";
+static const char* const new_tracker_name = "UDP over network";
+static const char* const new_proto_name = "UDP over network";
struct rename_udp_stuff : migration
{
diff --git a/migration/20171013_00-tracker-pt-threshold.cpp b/migration/20171013_00-tracker-pt-threshold.cpp
index 32e69f6d..aab64de7 100644
--- a/migration/20171013_00-tracker-pt-threshold.cpp
+++ b/migration/20171013_00-tracker-pt-threshold.cpp
@@ -13,9 +13,9 @@
using namespace options;
using namespace migrations;
-static constexpr const char* old_name = "threshold-primary";
-static constexpr const char* new_name = "threshold-slider";
-static constexpr const char* bundle_name = "tracker-pt";
+static const char* const old_name = "threshold-primary";
+static const char* const new_name = "threshold-slider";
+static const char* const bundle_name = "tracker-pt";
struct move_int_to_slider : migration
{
diff --git a/pose-widget/pose-widget.cpp b/pose-widget/pose-widget.cpp
index 69861b24..60d41aa5 100644
--- a/pose-widget/pose-widget.cpp
+++ b/pose-widget/pose-widget.cpp
@@ -287,7 +287,7 @@ void pose_transform::project_quad_texture()
const int orig_depth = tex.depth() / 8;
const int dest_depth = image.depth() / 8;
- static constexpr int const_depth = 4;
+ constexpr int const_depth = 4;
if (unlikely(orig_depth != const_depth || dest_depth != const_depth))
{
@@ -304,9 +304,9 @@ void pose_transform::project_quad_texture()
for (int y = 0; y < dist.y(); y++)
for (int x = 0; x < dist.x(); x++)
{
- uv_& restrict_ref uv = uv_vec[y * dist.x() + x];
- if (!t.barycentric_coords(vec2(x + min.x(), y + min.y()), uv.coords, uv.i))
- uv.i = -1;
+ uv_* restrict_ptr uv = &uv_vec[y * dist.x() + x];
+ if (!t.barycentric_coords(vec2(x + min.x(), y + min.y()), uv->coords, uv->i))
+ uv->i = -1;
}
const int ow = tex.width(), oh = tex.height();
@@ -330,14 +330,14 @@ void pose_transform::project_quad_texture()
for (int x_ = 0, dx = dist.x(); x_ < dx; x_++)
{
const int y = y_ + min.y(), x = x_ + min.x();
- uv_ const& restrict_ref uv__ = uv_vec[y_ * dx + x_];
+ const uv_* restrict_ptr uv__ = &uv_vec[y_ * dx + x_];
- if (uv__.i != -1)
+ if (uv__->i != -1)
{
using uc = unsigned char;
- vec2 const& uv = uv__.coords;
- int const i = uv__.i;
+ vec2 const& uv = uv__->coords;
+ int const i = uv__->i;
float fx = origs[i][0].x()
+ uv.x() * origs[i][2].x()
diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp
index ae8fe5a2..0c97ffd2 100644
--- a/proto-ft/ftnoir_protocol_ft.cpp
+++ b/proto-ft/ftnoir_protocol_ft.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2015, 2017 Stanislaw Halik <sthalik@misaki.pl>
+/* Copyright (c) 2013-2018 Stanislaw Halik <sthalik@misaki.pl>
* Copyright (c) 2015 Wim Vriend
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -97,7 +97,10 @@ void freetrack::pose(const double* headpose)
const std::int32_t id = load(ft->GameID);
- store(data->DataID, 60 * 10 + (rand() % 64));
+ 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);
diff --git a/proto-mouse/ftnoir_protocol_mouse.cpp b/proto-mouse/ftnoir_protocol_mouse.cpp
index ccc91e33..b4b27ea9 100644
--- a/proto-mouse/ftnoir_protocol_mouse.cpp
+++ b/proto-mouse/ftnoir_protocol_mouse.cpp
@@ -17,6 +17,12 @@
# define MOUSEEVENTF_MOVE_NOCOALESCE 0x2000
#endif
+static const double invert[] =
+{
+ 1., 1., 1.,
+ 1., -1., 1.
+};
+
void mouse::pose(const double *headpose)
{
const int axis_x = s.Mouse_X - 1;
@@ -24,12 +30,6 @@ void mouse::pose(const double *headpose)
int mouse_x = 0, mouse_y = 0;
- static constexpr double invert[] =
- {
- 1., 1., 1.,
- 1., -1., 1.
- };
-
if (axis_x >= 0 && axis_x < 6)
{
mouse_x = get_value(headpose[axis_x] * invert[axis_x],
@@ -76,7 +76,7 @@ int mouse::get_delta(int val, int prev)
int mouse::get_value(double val, double sensitivity, bool is_rotation)
{
- static constexpr double sgn[] = { 1e-2, 1 };
+ constexpr double sgn[] = { 1e-2, 1 };
constexpr double c = 1e-1;
return iround(val * c * sensitivity * sgn[unsigned(is_rotation)]);
diff --git a/proto-vjoystick/vjoystick.cpp b/proto-vjoystick/vjoystick.cpp
index 73cf74c6..e5e18157 100644
--- a/proto-vjoystick/vjoystick.cpp
+++ b/proto-vjoystick/vjoystick.cpp
@@ -39,7 +39,15 @@ const unsigned char handle::axis_ids[6] =
// HID_USAGE_WHL,
};
-constexpr double handle::val_minmax[6];
+static const double val_minmax[6] =
+{
+ 50,
+ 50,
+ 50,
+ 180,
+ 180,
+ 180
+};
void handle::init()
{
diff --git a/proto-vjoystick/vjoystick.h b/proto-vjoystick/vjoystick.h
index 6469a4e6..72dde0f0 100644
--- a/proto-vjoystick/vjoystick.h
+++ b/proto-vjoystick/vjoystick.h
@@ -30,16 +30,6 @@ private:
LONG axis_min[6];
LONG axis_max[6];
- static constexpr double val_minmax[6] =
- {
- 50,
- 50,
- 50,
- 180,
- 180,
- 180
- };
-
void init();
public:
handle();
diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp
index b797a907..638b67a7 100644
--- a/spline/spline-widget.cpp
+++ b/spline/spline-widget.cpp
@@ -223,7 +223,7 @@ void spline_widget::drawFunction()
painter.drawPath(path);
#else
- static constexpr int line_length_pixels = 3;
+ constexpr int line_length_pixels = 3;
const qreal max = _config->maxInput();
const qreal step = clamp(line_length_pixels / c.x(), 5e-2, max);
QPointF prev = point_to_pixel(QPoint(0, 0));
diff --git a/spline/spline.cpp b/spline/spline.cpp
index 823fd64f..fc77bf8b 100644
--- a/spline/spline.cpp
+++ b/spline/spline.cpp
@@ -27,8 +27,6 @@
using namespace spline_detail;
-constexpr std::size_t spline::value_count;
-
spline::spline(const QString& name, const QString& axis_name, Axis axis) :
axis(axis)
{
diff --git a/spline/spline.hpp b/spline/spline.hpp
index 0d080cef..a3532855 100644
--- a/spline/spline.hpp
+++ b/spline/spline.hpp
@@ -16,6 +16,7 @@ using namespace options;
#include "export.hpp"
+#include <cstddef>
#include <vector>
#include <limits>
#include <memory>
@@ -102,7 +103,7 @@ class OTR_SPLINE_EXPORT spline : public base_spline
std::shared_ptr<spline_detail::settings> s;
QMetaObject::Connection connection, conn_maxx, conn_maxy;
- static constexpr std::size_t value_count = 4096;
+ static constexpr inline std::size_t value_count = 4096;
std::vector<float> data = std::vector<float>(value_count, float(-16));
diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp
index c322d323..faa8bb44 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.cpp
+++ b/tracker-aruco/ftnoir_tracker_aruco.cpp
@@ -33,6 +33,32 @@
#include <algorithm>
#include <iterator>
+static const int adaptive_sizes[] =
+{
+#if defined USE_EXPERIMENTAL_CANNY
+ 10,
+ 30,
+ 80,
+#else
+ 7,
+ 9,
+ 13,
+#endif
+};
+
+struct resolution_tuple
+{
+ int width;
+ int height;
+};
+
+static const resolution_tuple resolution_choices[] =
+{
+ { 640, 480 },
+ { 320, 240 },
+ { 0, 0 }
+};
+
aruco_tracker::aruco_tracker()
{
cv::setBreakOnError(true);
diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h
index 3a98e9d1..b753fdec 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.h
+++ b/tracker-aruco/ftnoir_tracker_aruco.h
@@ -69,7 +69,7 @@ class aruco_tracker : protected virtual QThread, public ITracker
{
Q_OBJECT
friend class aruco_dialog;
- static constexpr float c_search_window = 1.3f;
+ static constexpr inline float c_search_window = 1.3f;
public:
aruco_tracker();
~aruco_tracker() override;
@@ -124,44 +124,17 @@ private:
unsigned adaptive_size_pos = 0;
bool use_otsu = false;
- struct resolution_tuple
- {
- int width;
- int height;
- };
-
- static constexpr inline const int adaptive_sizes[] =
- {
-#if defined USE_EXPERIMENTAL_CANNY
- 10,
- 30,
- 80,
-#else
- 7,
- 9,
- 13,
-#endif
- };
-
#if !defined USE_EXPERIMENTAL_CANNY
static constexpr inline int adaptive_thres = 6;
#else
static constexpr inline int adaptive_thres = 3;
#endif
- static constexpr inline const resolution_tuple resolution_choices[] =
- {
- { 640, 480 },
- { 320, 240 },
- { 0, 0 }
- };
-
#ifdef DEBUG_UNSHARP_MASKING
static constexpr inline double gauss_kernel_size = 3;
#endif
static constexpr inline double timeout = 1;
-
static constexpr inline double timeout_backoff_c = 4./11;
static constexpr inline float size_min = 0.05;
diff --git a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp
index 14498861..a93a22cb 100644
--- a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp
+++ b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp
@@ -75,7 +75,7 @@ void tracker_freepie::run() {
if (filled)
{
- static constexpr int add_cbx[] =
+ constexpr int add_cbx[] =
{
0,
90,
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp
index af086e5c..243fbd60 100644
--- a/tracker-pt/ftnoir_tracker_pt.cpp
+++ b/tracker-pt/ftnoir_tracker_pt.cpp
@@ -120,22 +120,12 @@ void Tracker_PT::run()
qDebug() << "pt: thread stopped";
}
-void Tracker_PT::maybe_reopen_camera()
+bool Tracker_PT::maybe_reopen_camera()
{
QMutexLocker l(&camera_mtx);
- pt_camera_open_status status = camera->start(camera_name_to_index(s.camera_name),
- s.cam_fps, s.cam_res_x, s.cam_res_y);
-
- switch (status)
- {
- case cam_open_error:
- break;
- case cam_open_ok_change:
- break;
- case cam_open_ok_no_change:
- break;
- }
+ return camera->start(camera_name_to_index(s.camera_name),
+ s.cam_fps, s.cam_res_x, s.cam_res_y);
}
void Tracker_PT::set_fov(int value)
@@ -156,11 +146,12 @@ module_status Tracker_PT::start_tracker(QFrame* video_frame)
//video_widget->resize(video_frame->width(), video_frame->height());
video_frame->show();
- maybe_reopen_camera();
+ if (!maybe_reopen_camera())
+ return { tr("Can't open camera") };
start(QThread::HighPriority);
- return status_ok();
+ return {};
}
void Tracker_PT::data(double *data)
diff --git a/tracker-pt/ftnoir_tracker_pt.h b/tracker-pt/ftnoir_tracker_pt.h
index d1f7e1d7..03812092 100644
--- a/tracker-pt/ftnoir_tracker_pt.h
+++ b/tracker-pt/ftnoir_tracker_pt.h
@@ -53,7 +53,7 @@ public:
int get_n_points();
bool get_cam_info(pt_camera_info* info);
public slots:
- void maybe_reopen_camera();
+ bool maybe_reopen_camera();
void set_fov(int value);
protected:
void run() override;
@@ -81,7 +81,7 @@ private:
std::atomic<unsigned> point_count = 0;
std::atomic<bool> ever_success = false;
- static constexpr f rad2deg = f(180/M_PI);
+ static constexpr inline f rad2deg = f(180/M_PI);
//static constexpr float deg2rad = float(M_PI/180);
};
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
index 10a2c6cb..5bd1a4c8 100644
--- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp
+++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
@@ -90,7 +90,7 @@ TrackerDialog_PT::TrackerDialog_PT(const QString& module_name) :
connect(this, &TrackerDialog_PT::poll_tracker_info, this, &TrackerDialog_PT::poll_tracker_info_impl, Qt::DirectConnection);
- static constexpr pt_color_type color_types[] = {
+ constexpr pt_color_type color_types[] = {
pt_color_average,
pt_color_natural,
pt_color_red_only,
diff --git a/tracker-pt/lang/nl_NL.ts b/tracker-pt/lang/nl_NL.ts
index 16aaa82e..34f88c88 100644
--- a/tracker-pt/lang/nl_NL.ts
+++ b/tracker-pt/lang/nl_NL.ts
@@ -276,4 +276,11 @@ Don&apos;t roll or change position.</source>
<translation type="unfinished"></translation>
</message>
</context>
+<context>
+ <name>pt_module::Tracker_PT</name>
+ <message>
+ <source>Can&apos;t open camera</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
</TS>
diff --git a/tracker-pt/lang/ru_RU.ts b/tracker-pt/lang/ru_RU.ts
index 88f3cb4a..63b4847a 100644
--- a/tracker-pt/lang/ru_RU.ts
+++ b/tracker-pt/lang/ru_RU.ts
@@ -281,4 +281,11 @@ ROLL или X/Y-смещения.</translation>
<translation>Параметры камеры:</translation>
</message>
</context>
+<context>
+ <name>pt_module::Tracker_PT</name>
+ <message>
+ <source>Can&apos;t open camera</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
</TS>
diff --git a/tracker-pt/lang/stub.ts b/tracker-pt/lang/stub.ts
index a3377c2e..e83487a9 100644
--- a/tracker-pt/lang/stub.ts
+++ b/tracker-pt/lang/stub.ts
@@ -276,4 +276,11 @@ Don&apos;t roll or change position.</source>
<translation type="unfinished"></translation>
</message>
</context>
+<context>
+ <name>pt_module::Tracker_PT</name>
+ <message>
+ <source>Can&apos;t open camera</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
</TS>
diff --git a/tracker-pt/lang/zh_CN.ts b/tracker-pt/lang/zh_CN.ts
index 2a8e9ca0..07d8c469 100644
--- a/tracker-pt/lang/zh_CN.ts
+++ b/tracker-pt/lang/zh_CN.ts
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.1">
+<TS version="2.1" language="zh_CN">
<context>
<name>TrackerDialog_PT</name>
<message>
@@ -29,7 +29,7 @@
</message>
<message>
<source>Start calibration</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">开始校准</translation>
</message>
<message>
<source>%1x%2 @ %3 FPS</source>
@@ -52,227 +52,234 @@
<name>UICPTClientControls</name>
<message>
<source>PointTracker Settings</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Status</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Extracted Points:</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Camera Info:</source>
- <translation type="unfinished"></translation>
+ <translation>PointTracker设置</translation>
</message>
<message>
<source>Camera</source>
- <translation type="unfinished"></translation>
+ <translation>摄像头</translation>
</message>
<message>
<source>Camera settings</source>
- <translation type="unfinished"></translation>
+ <translation>摄像头设置</translation>
</message>
<message>
<source>°</source>
- <translation type="unfinished"></translation>
+ <translation>度</translation>
</message>
<message>
<source>Diagonal field of view</source>
- <translation type="unfinished"></translation>
+ <translation>对角线</translation>
</message>
<message>
<source>Width</source>
- <translation type="unfinished"></translation>
+ <translation></translation>
</message>
<message>
<source>FPS</source>
- <translation type="unfinished"></translation>
+ <translation>帧数</translation>
</message>
<message>
<source>Desired capture height</source>
- <translation type="unfinished"></translation>
+ <translation>期望高度</translation>
</message>
<message>
<source> px</source>
- <translation type="unfinished"></translation>
+ <translation> 像素点</translation>
</message>
<message>
<source>Dynamic pose timeout</source>
- <translation type="unfinished"></translation>
+ <translation>动态姿态超时时间</translation>
</message>
<message>
<source>Desired capture framerate</source>
- <translation type="unfinished"></translation>
+ <translation>期望帧数</translation>
</message>
<message>
<source> Hz</source>
- <translation type="unfinished"></translation>
+ <translation> 赫兹</translation>
</message>
<message>
<source>Desired capture width</source>
- <translation type="unfinished"></translation>
+ <translation>期望宽度</translation>
</message>
<message>
<source>Height</source>
- <translation type="unfinished"></translation>
+ <translation>高度</translation>
</message>
<message>
<source> ms</source>
- <translation type="unfinished"></translation>
+ <translation> 毫秒</translation>
</message>
<message>
<source>Device</source>
- <translation type="unfinished"></translation>
+ <translation>设备名称</translation>
</message>
<message>
<source>Open</source>
- <translation type="unfinished"></translation>
+ <translation>打开</translation>
</message>
<message>
<source>Camera settings (when available)</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Color channels used</source>
- <translation type="unfinished"></translation>
+ <translation>摄像头设置 (连接时)</translation>
</message>
<message>
- <source>Average</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Natural</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Red only</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Blue only</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Dynamic pose (for caps only, never clips)</source>
- <translation type="unfinished"></translation>
+ <source>Point extraction</source>
+ <translation>跟踪点解析</translation>
</message>
<message>
- <source>Point extraction</source>
- <translation type="unfinished"></translation>
+ <source>Max size</source>
+ <translation>最大</translation>
</message>
<message>
<source>Threshold</source>
- <translation type="unfinished"></translation>
+ <translation>大小门限值</translation>
</message>
<message>
<source>Min size</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Max size</source>
- <translation type="unfinished"></translation>
+ <translation>最小</translation>
</message>
<message>
<source>Intensity threshold for point extraction</source>
- <translation type="unfinished"></translation>
+ <translation>点密度</translation>
</message>
<message>
- <source>Enable, slider sets point size</source>
- <translation type="unfinished"></translation>
+ <source>Automatic threshold</source>
+ <translation>自动门限值</translation>
</message>
<message>
- <source>Automatic threshold</source>
- <translation type="unfinished"></translation>
+ <source>Enable, slider sets point size</source>
+ <translation>激活,滑动,设置跟踪点大小</translation>
</message>
<message>
<source>Maximum point diameter</source>
- <translation type="unfinished"></translation>
+ <translation>最大点直径</translation>
</message>
<message>
<source>Minimum point diameter</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Value</source>
- <translation type="unfinished"></translation>
+ <translation>最小点直径</translation>
</message>
<message>
<source>Model</source>
- <translation type="unfinished"></translation>
+ <translation>点模式</translation>
</message>
<message>
<source>Clip</source>
- <translation type="unfinished"></translation>
+ <translation>夹子式</translation>
</message>
<message>
<source>Model Dimensions</source>
- <translation type="unfinished"></translation>
+ <translation>尺寸</translation>
</message>
<message>
<source> mm</source>
- <translation type="unfinished"></translation>
+ <translation> 毫米</translation>
</message>
<message>
<source>Side</source>
- <translation type="unfinished"></translation>
+ <translation>侧面</translation>
</message>
<message>
<source>Front</source>
- <translation type="unfinished"></translation>
+ <translation>正面</translation>
</message>
<message>
<source>Cap</source>
- <translation type="unfinished"></translation>
+ <translation>帽子式</translation>
</message>
<message>
<source>Custom</source>
- <translation type="unfinished"></translation>
+ <translation>自定义模式</translation>
</message>
<message>
<source>z:</source>
- <translation type="unfinished"></translation>
+ <translation>Z:</translation>
</message>
<message>
<source>x:</source>
- <translation type="unfinished"></translation>
+ <translation>X:</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Location of the two remaining model points&lt;br/&gt;with respect to the reference point in default pose&lt;/p&gt;&lt;p&gt;Use any units you want, not necessarily centimeters.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation type="unfinished"></translation>
+ <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;三点中的两点位置是相对第一个点的&lt;/p&gt;&lt;p&gt;单位不一定要用厘米&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source>y:</source>
- <translation type="unfinished"></translation>
+ <translation>Y:</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;P&lt;/span&gt;&lt;span style=&quot; font-size:16pt; vertical-align:sub;&quot;&gt;3&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation type="unfinished"></translation>
+ <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;P&lt;/span&gt;&lt;span style=&quot; font-size:16pt; vertical-align:sub;&quot;&gt;3&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;P&lt;/span&gt;&lt;span style=&quot; font-size:16pt; vertical-align:sub;&quot;&gt;2&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation type="unfinished"></translation>
+ <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;P&lt;/span&gt;&lt;span style=&quot; font-size:16pt; vertical-align:sub;&quot;&gt;2&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source>Model position</source>
+ <translation>姿态空间位置</translation>
+ </message>
+ <message>
+ <source>Start calibration</source>
+ <translation>开始校准</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>关于</translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;Manual (external)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;参考手册 (外部链接)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
+ </message>
+ <message>
+ <source>Status</source>
+ <translation>状态</translation>
+ </message>
+ <message>
+ <source>Extracted Points:</source>
+ <translation>解析出的点:</translation>
+ </message>
+ <message>
+ <source>Camera Info:</source>
+ <translation>设备信息:</translation>
+ </message>
+ <message>
+ <source>Color channels used</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Use only yaw and pitch while calibrating.
-Don&apos;t roll or change position.</source>
+ <source>Average</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Start calibration</source>
+ <source>Natural</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>About</source>
+ <source>Red only</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;Manual (external)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <source>Blue only</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Dynamic pose (for caps only, never clips)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Value</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Use only yaw and pitch while calibrating.
+Don&apos;t roll or change position.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>pt_module::Tracker_PT</name>
+ <message>
+ <source>Can&apos;t open camera</source>
<translation type="unfinished"></translation>
</message>
</context>
diff --git a/tracker-pt/module/camera.cpp b/tracker-pt/module/camera.cpp
index ba4583da..9c62e8a3 100644
--- a/tracker-pt/module/camera.cpp
+++ b/tracker-pt/module/camera.cpp
@@ -36,19 +36,18 @@ void Camera::show_camera_settings()
{
const int idx = camera_name_to_index(s.camera_name);
- if (bool(*this))
+ if (cap && cap->isOpened())
video_property_page::show_from_capture(*cap, idx);
else
- {
video_property_page::show(idx);
- }
}
Camera::result Camera::get_info() const
{
if (cam_info.res_x == 0 || cam_info.res_y == 0)
- return result(false, pt_camera_info());
- return result(true, cam_info);
+ return { false, pt_camera_info() };
+ else
+ return { true, cam_info };
}
Camera::result Camera::get_frame(pt_frame& frame_)
@@ -82,7 +81,7 @@ Camera::result Camera::get_frame(pt_frame& frame_)
return result(false, pt_camera_info());
}
-pt_camera_open_status Camera::start(int idx, int fps, int res_x, int res_y)
+bool Camera::start(int idx, int fps, int res_x, int res_y)
{
if (idx >= 0 && fps >= 0 && res_x >= 0 && res_y >= 0)
{
@@ -110,7 +109,7 @@ pt_camera_open_status Camera::start(int idx, int fps, int res_x, int res_y)
if (cam_desired.fps)
cap->set(cv::CAP_PROP_FPS, cam_desired.fps);
- if (cap->isOpened() && cap->grab())
+ if (cap->isOpened())
{
cam_info = pt_camera_info();
active_name = QString();
@@ -118,22 +117,24 @@ pt_camera_open_status Camera::start(int idx, int fps, int res_x, int res_y)
dt_mean = 0;
active_name = desired_name;
- t.start();
+ cv::Mat tmp;
- return cam_open_ok_change;
- }
- else
- {
- stop();
- return cam_open_error;
+ if (_get_frame(tmp))
+ {
+ t.start();
+ return true;
+ }
}
+
+ cap = nullptr;
+ return false;
}
- return cam_open_ok_no_change;
+ return true;
}
stop();
- return cam_open_error;
+ return false;
}
void Camera::stop()
diff --git a/tracker-pt/module/camera.h b/tracker-pt/module/camera.h
index 96234840..79e3dca0 100644
--- a/tracker-pt/module/camera.h
+++ b/tracker-pt/module/camera.h
@@ -26,7 +26,7 @@ struct Camera final : pt_camera
{
Camera(const QString& module_name);
- pt_camera_open_status start(int idx, int fps, int res_x, int res_y) override;
+ bool start(int idx, int fps, int res_x, int res_y) override;
void stop() override;
result get_frame(pt_frame& Frame) override;
@@ -36,8 +36,6 @@ struct Camera final : pt_camera
QString get_desired_name() const override;
QString get_active_name() const override;
- operator bool() const override { return cap && cap->isOpened(); }
-
void set_fov(double value) override { fov = value; }
void show_camera_settings() override;
@@ -45,9 +43,7 @@ private:
warn_result_unused bool _get_frame(cv::Mat& Frame);
double dt_mean = 0, fov = 30;
-
Timer t;
-
pt_camera_info cam_info;
pt_camera_info cam_desired;
QString desired_name, active_name;
diff --git a/tracker-pt/point_tracker.cpp b/tracker-pt/point_tracker.cpp
index 5efbbfe8..6116bec5 100644
--- a/tracker-pt/point_tracker.cpp
+++ b/tracker-pt/point_tracker.cpp
@@ -16,8 +16,6 @@ using namespace types;
#include <QDebug>
-constexpr unsigned PointModel::N_POINTS;
-
static void get_row(const mat33& m, int i, vec3& v)
{
v[0] = m(i,0);
diff --git a/tracker-pt/point_tracker.h b/tracker-pt/point_tracker.h
index 6abe5df9..5e741c75 100644
--- a/tracker-pt/point_tracker.h
+++ b/tracker-pt/point_tracker.h
@@ -32,7 +32,7 @@ using namespace types;
struct PointModel final
{
- static constexpr unsigned N_POINTS = 3;
+ static constexpr inline unsigned N_POINTS = 3;
vec3 M01; // M01 in model frame
vec3 M02; // M02 in model frame
diff --git a/tracker-pt/pt-api.cpp b/tracker-pt/pt-api.cpp
index 298f405a..596590dc 100644
--- a/tracker-pt/pt-api.cpp
+++ b/tracker-pt/pt-api.cpp
@@ -57,7 +57,6 @@ double pt_point_extractor::threshold_radius_value(int w, int h, int threshold)
return radius;
}
-
std::tuple<double, double> pt_pixel_pos_mixin::to_pixel_pos(double x, double y, int w, int h)
{
return std::make_tuple(w*(x+.5), .5*(h - 2*y*w));
diff --git a/tracker-pt/pt-api.hpp b/tracker-pt/pt-api.hpp
index e946c5d0..de097a04 100644
--- a/tracker-pt/pt-api.hpp
+++ b/tracker-pt/pt-api.hpp
@@ -30,8 +30,6 @@ struct OTR_PT_EXPORT pt_camera_info final
int idx = -1;
};
-enum pt_camera_open_status : unsigned { cam_open_error, cam_open_ok_no_change, cam_open_ok_change };
-
struct OTR_PT_EXPORT pt_pixel_pos_mixin
{
static std::tuple<double, double> to_pixel_pos(double x, double y, int w, int h);
@@ -73,7 +71,7 @@ struct OTR_PT_EXPORT pt_camera
pt_camera();
virtual ~pt_camera();
- virtual warn_result_unused pt_camera_open_status start(int idx, int fps, int res_x, int res_y) = 0;
+ virtual warn_result_unused bool start(int idx, int fps, int res_x, int res_y) = 0;
virtual void stop() = 0;
virtual warn_result_unused result get_frame(pt_frame& frame) = 0;
@@ -84,8 +82,6 @@ struct OTR_PT_EXPORT pt_camera
virtual QString get_active_name() const = 0;
virtual void set_fov(double value) = 0;
- virtual operator bool() const = 0;
-
virtual void show_camera_settings() = 0;
};
diff --git a/tracker-s2bot/ftnoir_tracker_s2bot.cpp b/tracker-s2bot/ftnoir_tracker_s2bot.cpp
index a7411fb7..44ae6132 100644
--- a/tracker-s2bot/ftnoir_tracker_s2bot.cpp
+++ b/tracker-s2bot/ftnoir_tracker_s2bot.cpp
@@ -18,6 +18,15 @@ tracker_s2bot::~tracker_s2bot()
wait();
}
+static constexpr int add_cbx[] =
+{
+ 0,
+ 90,
+ -90,
+ 180,
+ -180,
+};
+
void tracker_s2bot::run() {
if (s.freq == 0) s.freq = 10;
timer.setInterval(1000.0/s.freq);
@@ -44,15 +53,6 @@ void tracker_s2bot::run() {
clamp(s.idx_z, 0, 3),
};
- static constexpr int add_cbx[] =
- {
- 0,
- 90,
- -90,
- 180,
- -180,
- };
-
int add_indices[] = { s.add_yaw, s.add_pitch, s.add_roll, };
double orient[4] {};
diff --git a/tracker-tobii-eyex/tobii-eyex.hpp b/tracker-tobii-eyex/tobii-eyex.hpp
index 8583acf0..170e74c1 100644
--- a/tracker-tobii-eyex/tobii-eyex.hpp
+++ b/tracker-tobii-eyex/tobii-eyex.hpp
@@ -36,7 +36,7 @@ public:
return true;
}
private:
- static constexpr const char* client_id = "opentrack-tobii-eyex";
+ static constexpr inline const char* const client_id = "opentrack-tobii-eyex";
static void call_tx_deinit();
diff --git a/tracker-wii/lang/zh_CN.ts b/tracker-wii/lang/zh_CN.ts
index 3f3131d8..6401616d 100644
--- a/tracker-wii/lang/zh_CN.ts
+++ b/tracker-wii/lang/zh_CN.ts
@@ -1,293 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.1" language="zh_CN">
-<context>
- <name>PT_metadata</name>
- <message>
- <location filename="../../tracker-pt/ftnoir_tracker_pt.h" line="+95"/>
- <source>PointTracker 1.1</source>
- <translation type="unfinished"></translation>
- </message>
-</context>
-<context>
- <name>UICPTClientControls</name>
- <message>
- <location filename="../../tracker-pt/FTNoIR_PT_Controls.ui" line="+23"/>
- <source>PointTracker Settings</source>
- <translation>PointTracker设置</translation>
- </message>
- <message>
- <location line="+38"/>
- <source>Camera</source>
- <translation>摄像头</translation>
- </message>
- <message>
- <location line="+6"/>
- <source>Camera settings</source>
- <translation>摄像头设置</translation>
- </message>
- <message>
- <location line="+19"/>
- <source>°</source>
- <translation>度</translation>
- </message>
- <message>
- <location line="+22"/>
- <source>Diagonal field of view</source>
- <translation>对角线</translation>
- </message>
- <message>
- <location line="+13"/>
- <source>Width</source>
- <translation></translation>
- </message>
- <message>
- <location line="+13"/>
- <source>FPS</source>
- <translation>帧数</translation>
- </message>
- <message>
- <location line="+16"/>
- <source>Desired capture height</source>
- <translation>期望高度</translation>
- </message>
- <message>
- <location line="+3"/>
- <location line="+55"/>
- <location line="+175"/>
- <location line="+16"/>
- <source> px</source>
- <translation> 像素点</translation>
- </message>
- <message>
- <location line="-233"/>
- <source>Dynamic pose timeout</source>
- <translation>动态姿态超时时间</translation>
- </message>
- <message>
- <location line="+13"/>
- <source>Desired capture framerate</source>
- <translation>期望帧数</translation>
- </message>
- <message>
- <location line="+3"/>
- <source> Hz</source>
- <translation> 赫兹</translation>
- </message>
- <message>
- <location line="+23"/>
- <source>Desired capture width</source>
- <translation>期望宽度</translation>
- </message>
- <message>
- <location line="+22"/>
- <source>Height</source>
- <translation>高度</translation>
- </message>
- <message>
- <location line="+7"/>
- <source> ms</source>
- <translation> 毫秒</translation>
- </message>
- <message>
- <location line="+19"/>
- <source>Dynamic pose resolution</source>
- <translation>动态姿态分辨率</translation>
- </message>
- <message>
- <location line="+13"/>
- <source>Device</source>
- <translation>设备名称</translation>
- </message>
- <message>
- <location line="+16"/>
- <source>Open</source>
- <translation>打开</translation>
- </message>
- <message>
- <location line="+7"/>
- <source>Camera settings (when available)</source>
- <translation>摄像头设置 (连接时)</translation>
- </message>
- <message>
- <location line="+10"/>
- <source>Point extraction</source>
- <translation>跟踪点解析</translation>
- </message>
- <message>
- <location line="+6"/>
- <source>Max size</source>
- <translation>最大</translation>
- </message>
- <message>
- <location line="+10"/>
- <source>Threshold</source>
- <translation>大小门限值</translation>
- </message>
- <message>
- <location line="+10"/>
- <source>Min size</source>
- <translation>最小</translation>
- </message>
- <message>
- <location line="+16"/>
- <source>Intensity threshold for point extraction</source>
- <translation>点密度</translation>
- </message>
- <message>
- <location line="+25"/>
- <source>Automatic threshold</source>
- <translation>自动门限值</translation>
- </message>
- <message>
- <location line="+7"/>
- <source>Enable, slider sets point size</source>
- <translation>激活,滑动,设置跟踪点大小</translation>
- </message>
- <message>
- <location line="+7"/>
- <source>Maximum point diameter</source>
- <translation>最大点直径</translation>
- </message>
- <message>
- <location line="+16"/>
- <source>Minimum point diameter</source>
- <translation>最小点直径</translation>
- </message>
- <message>
- <location line="+20"/>
- <source>Model</source>
- <translation>点模式</translation>
- </message>
- <message>
- <location line="+28"/>
- <source>Clip</source>
- <translation>夹子式</translation>
- </message>
- <message>
- <location line="+18"/>
- <location line="+154"/>
- <location line="+129"/>
- <source>Model Dimensions</source>
- <translation>尺寸</translation>
- </message>
- <message>
- <location line="-271"/>
- <location line="+19"/>
- <location line="+48"/>
- <location line="+19"/>
- <location line="+97"/>
- <location line="+35"/>
- <location line="+32"/>
- <location line="+40"/>
- <location line="+26"/>
- <location line="+13"/>
- <location line="+13"/>
- <location line="+13"/>
- <location line="+26"/>
- <location line="+132"/>
- <location line="+26"/>
- <location line="+26"/>
- <source> mm</source>
- <translation> 毫米</translation>
- </message>
- <message>
- <location line="-511"/>
- <location line="+116"/>
- <source>Side</source>
- <translation>侧面</translation>
- </message>
- <message>
- <location line="-65"/>
- <location line="+132"/>
- <source>Front</source>
- <translation>正面</translation>
- </message>
- <message>
- <location line="-107"/>
- <source>Cap</source>
- <translation>帽子式</translation>
- </message>
- <message>
- <location line="+135"/>
- <source>Custom</source>
- <translation>自定义模式</translation>
- </message>
- <message>
- <location line="+18"/>
- <location line="+169"/>
- <location line="+106"/>
- <source>z:</source>
- <translation>Z:</translation>
- </message>
- <message>
- <location line="-249"/>
- <location line="+104"/>
- <location line="+93"/>
- <source>x:</source>
- <translation>X:</translation>
- </message>
- <message>
- <location line="-132"/>
- <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Location of the two remaining model points&lt;br/&gt;with respect to the reference point in default pose&lt;/p&gt;&lt;p&gt;Use any units you want, not necessarily centimeters.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;三点中的两点位置是相对第一个点的&lt;/p&gt;&lt;p&gt;单位不一定要用厘米&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
- </message>
- <message>
- <location line="+26"/>
- <location line="+65"/>
- <location line="+67"/>
- <source>y:</source>
- <translation>Y:</translation>
- </message>
- <message>
- <location line="-106"/>
- <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;P&lt;/span&gt;&lt;span style=&quot; font-size:16pt; vertical-align:sub;&quot;&gt;3&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;P&lt;/span&gt;&lt;span style=&quot; font-size:16pt; vertical-align:sub;&quot;&gt;3&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
- </message>
- <message>
- <location line="+13"/>
- <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;P&lt;/span&gt;&lt;span style=&quot; font-size:16pt; vertical-align:sub;&quot;&gt;2&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;P&lt;/span&gt;&lt;span style=&quot; font-size:16pt; vertical-align:sub;&quot;&gt;2&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
- </message>
- <message>
- <location line="+46"/>
- <source>Model position</source>
- <translation>姿态空间位置</translation>
- </message>
- <message>
- <location line="+105"/>
- <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/opentrack/opentrack/wiki/model-calibration-for-PT-and-Aruco-trackers&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Instructions on the opentrack wiki&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/opentrack/opentrack/wiki/model-calibration-for-PT-and-Aruco-trackers&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;参考opentrack维基&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
- </message>
- <message>
- <location line="+13"/>
- <source>Start calibration</source>
- <translation>开始校准</translation>
- </message>
- <message>
- <location line="+17"/>
- <source>About</source>
- <translation>关于</translation>
- </message>
- <message>
- <location line="+6"/>
- <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;Manual (external)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;参考手册 (外部链接)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
- </message>
- <message>
- <location line="+36"/>
- <source>Status</source>
- <translation>状态</translation>
- </message>
- <message>
- <location line="+6"/>
- <source>Extracted Points:</source>
- <translation>解析出的点:</translation>
- </message>
- <message>
- <location line="+7"/>
- <source>Camera Info:</source>
- <translation>设备信息:</translation>
- </message>
-</context>
+<TS version="2.1">
</TS>
diff --git a/tracker-wii/wii_camera.cpp b/tracker-wii/wii_camera.cpp
index 251ab33a..2af3eca3 100644
--- a/tracker-wii/wii_camera.cpp
+++ b/tracker-wii/wii_camera.cpp
@@ -33,7 +33,12 @@ WIICamera::WIICamera(const QString& module_name) : s { module_name }
cam_info.res_x = 1024;
cam_info.res_y = 768;
cam_info.fov = 42.0f;
- cam_info.idx = 0;
+ cam_info.idx = 0;
+}
+
+WIICamera::~WIICamera()
+{
+ stop();
}
QString WIICamera::get_desired_name() const
@@ -81,14 +86,14 @@ WIICamera::result WIICamera::get_frame(pt_frame& frame_)
return result(true, cam_info);
}
-pt_camera_open_status WIICamera::start(int idx, int fps, int res_x, int res_y)
+bool WIICamera::start(int idx, int fps, int res_x, int res_y)
{
m_pDev = std::make_unique<wiimote>();
m_pDev->ChangedCallback = on_state_change;
m_pDev->CallbackTriggerFlags = (state_change_flags)(CONNECTED |
EXTENSION_CHANGED |
MOTIONPLUS_CHANGED);
- return cam_open_ok_no_change;
+ return true;
}
void WIICamera::stop()
diff --git a/tracker-wii/wii_camera.h b/tracker-wii/wii_camera.h
index d0d7f6dd..55def206 100644
--- a/tracker-wii/wii_camera.h
+++ b/tracker-wii/wii_camera.h
@@ -29,8 +29,9 @@ namespace pt_module {
struct WIICamera final : pt_camera
{
WIICamera(const QString& module_name);
+ ~WIICamera() override;
- pt_camera_open_status start(int idx, int fps, int res_x, int res_y) override;
+ bool start(int idx, int fps, int res_x, int res_y) override;
void stop() override;
result get_frame(pt_frame& Frame) override;
@@ -40,12 +41,9 @@ struct WIICamera final : pt_camera
QString get_desired_name() const override;
QString get_active_name() const override;
- operator bool() const override { return m_pDev && (!m_pDev->ConnectionLost()); }
-
void set_fov(double value) override {}
void show_camera_settings() override;
-
private:
std::unique_ptr<wiimote> m_pDev;
static void on_state_change(wiimote &remote,
diff --git a/tracker-wii/wiiyourself/wiimote.cpp b/tracker-wii/wiiyourself/wiimote.cpp
index 956c4fc6..e1e49101 100644
--- a/tracker-wii/wiiyourself/wiimote.cpp
+++ b/tracker-wii/wiiyourself/wiimote.cpp
@@ -114,13 +114,13 @@ const unsigned wiimote::FreqLookup [TOTAL_FREQUENCIES] =
{ 0, 4200, 3920, 3640, 3360,
3130, 2940, 2760, 2610, 2470 };
-const TCHAR* wiimote::ButtonNameFromBit [TOTAL_BUTTON_BITS] =
+const TCHAR* const wiimote::ButtonNameFromBit [TOTAL_BUTTON_BITS] =
{ _T("Left") , _T("Right"), _T("Down"), _T("Up"),
_T("Plus") , _T("??") , _T("??") , _T("??") ,
_T("Two") , _T("One") , _T("B") , _T("A") ,
_T("Minus"), _T("??") , _T("??") , _T("Home") };
-const TCHAR* wiimote::ClassicButtonNameFromBit [TOTAL_BUTTON_BITS] =
+const TCHAR* const wiimote::ClassicButtonNameFromBit [TOTAL_BUTTON_BITS] =
{ _T("??") , _T("TrigR") , _T("Plus") , _T("Home"),
_T("Minus"), _T("TrigL") , _T("Down") , _T("Right") ,
_T("Up") , _T("Left") , _T("ZR") , _T("X") ,
diff --git a/tracker-wii/wiiyourself/wiimote.h b/tracker-wii/wiiyourself/wiimote.h
index 1db2c098..3588b7c7 100644
--- a/tracker-wii/wiiyourself/wiimote.h
+++ b/tracker-wii/wiiyourself/wiimote.h
@@ -8,12 +8,7 @@
//
// wiimote.h (tab = 4 spaces)
-#ifdef _MSC_VER // VC
-# pragma once
-#endif
-
-#ifndef _WIIMOTE_H
-# define _WIIMOTE_H
+#pragma once
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -165,7 +160,7 @@ class wiimote : public wiimote_state
const wiimote_state &new_state) {};
// get the button name from its bit index (some bits are unused)
- static const TCHAR* ButtonNameFromBit [TOTAL_BUTTON_BITS];
+ static const TCHAR* const ButtonNameFromBit [TOTAL_BUTTON_BITS];
static const TCHAR* GetButtonNameFromBit (unsigned index)
{
_ASSERT(index < TOTAL_BUTTON_BITS);
@@ -175,8 +170,8 @@ class wiimote : public wiimote_state
}
// same for the Classic Controller
- static const TCHAR* ClassicButtonNameFromBit [TOTAL_BUTTON_BITS];
- static const TCHAR* GetClassicButtonNameFromBit (unsigned index)
+ static const TCHAR* const ClassicButtonNameFromBit [TOTAL_BUTTON_BITS];
+ static const TCHAR* GetClassicButtonNameFromBit (unsigned index)
{
_ASSERT(index < TOTAL_BUTTON_BITS);
if(index >= TOTAL_BUTTON_BITS)
@@ -491,5 +486,3 @@ volatile int MotionPlusDetectCount; // waiting for the result
unsigned ExtTriggerFlags;// extension changes "
} Recording;
};
-
-#endif // _WIIMOTE_H \ No newline at end of file