summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--csv/csv.cpp15
-rw-r--r--csv/csv.h2
-rw-r--r--facetracknoir/ui.cpp12
-rw-r--r--freetrackclient/fttypes.h2
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.cpp11
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.cpp45
-rw-r--r--opentrack/plugin-support.hpp10
-rw-r--r--opentrack/shortcuts.cpp2
-rw-r--r--qfunctionconfigurator/functionconfig.h2
9 files changed, 52 insertions, 49 deletions
diff --git a/csv/csv.cpp b/csv/csv.cpp
index 4c754542..1ae567a4 100644
--- a/csv/csv.cpp
+++ b/csv/csv.cpp
@@ -92,7 +92,7 @@ QStringList CSV::parseLine(QString line){
return list;
}
-void CSV::getGameData( const int id, unsigned char* table, QString& gamename)
+bool CSV::getGameData( const int id, unsigned char* table, QString& gamename)
{
QString gameID = QString::number(id);
@@ -104,12 +104,11 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename)
QFile file(QCoreApplication::applicationDirPath() + "/settings/facetracknoir supported games.csv");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){
- return;
+ return false;
}
CSV csv(&file);
- gameLine = csv.parseLine();
- while (gameLine.count() > 2) {
+ while (gameLine = csv.parseLine(), gameLine.count() > 2) {
//qDebug() << "Column 0: " << gameLine.at(0); // No.
//qDebug() << "Column 1: " << gameLine.at(1); // Game Name
//qDebug() << "Column 2: " << gameLine.at(2); // Game Protocol
@@ -124,9 +123,11 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename)
QByteArray id = gameLine.at(7).toLatin1();
unsigned char tmp[8];
unsigned char fuzz[3];
+ bool ret = true;
if (gameLine.at(3) == QString("V160"))
{
qDebug() << "no table";
+ ret = false;
}
else if (sscanf(id.constData(),
"%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
@@ -143,6 +144,7 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename)
fuzz + 1) != 11)
{
qDebug() << "scanf failed" << fuzz[0] << fuzz[1] << fuzz[2];
+ ret = false;
}
else
for (int i = 0; i < 8; i++)
@@ -150,13 +152,12 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename)
qDebug() << gameID << "game-id" << gameLine.at(7);
gamename = gameLine.at(1);
file.close();
- return;
+ return ret;
}
}
-
- gameLine = csv.parseLine();
}
qDebug() << "Unknown game connected" << gameID;
file.close();
+ return false;
}
diff --git a/csv/csv.h b/csv/csv.h
index 80fbcac4..a896a076 100644
--- a/csv/csv.h
+++ b/csv/csv.h
@@ -14,7 +14,7 @@ public:
static QStringList parseLine(QString line);
void setCodec(const char* codecName);
- static void getGameData(const int gameID, unsigned char* table, QString& gamename);
+ static bool getGameData(const int gameID, unsigned char* table, QString& gamename);
private:
QIODevice *m_device;
QTextCodec *m_codec;
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp
index 43358f1b..b615ace7 100644
--- a/facetracknoir/ui.cpp
+++ b/facetracknoir/ui.cpp
@@ -21,13 +21,6 @@
# include <windows.h>
#endif
-template<typename t>
-static QList<t> sorted(QList<t> xs)
-{
- std::sort(xs.begin(), xs.end(), [&](const t& a, const t& b) { return a->name.toLower() < b->name.toLower(); });
- return xs;
-}
-
MainWindow::MainWindow() :
pose_update_timer(this),
kbd_quit(QKeySequence("Ctrl+Q"), this),
@@ -46,7 +39,7 @@ MainWindow::MainWindow() :
connect(ui.btnShortcuts, SIGNAL(clicked()), this, SLOT(show_options_dialog()));
connect(ui.btnShowServerControls, SIGNAL(clicked()), this, SLOT(showProtocolSettings()));
- for (auto x : sorted(modules.protocols()))
+ for (auto x : modules.protocols())
ui.iconcomboProtocol->addItem(x->icon, x->name);
refresh_config_list();
@@ -117,12 +110,11 @@ bool MainWindow::get_new_config_name_from_dialog(QString& ret)
MainWindow::~MainWindow()
{
- save_timer.stop();
+ maybe_save();
if (tray)
tray->hide();
stopTracker();
- maybe_save();
}
void MainWindow::set_working_directory()
diff --git a/freetrackclient/fttypes.h b/freetrackclient/fttypes.h
index 8611017a..050ffc02 100644
--- a/freetrackclient/fttypes.h
+++ b/freetrackclient/fttypes.h
@@ -31,7 +31,7 @@ typedef __int32 int32_t;
/* only 6 headpose floats and the data id are filled -sh */
typedef struct __FTData {
- volatile int DataID;
+ volatile unsigned int DataID;
volatile int CamWidth;
volatile int CamHeight;
/* virtual pose */
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
index 3fd7c421..5f058fc7 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
@@ -12,11 +12,12 @@
#include "opentrack/plugin-api.hpp"
static constexpr double rot_gains[][2] = {
- { 2.66, 105 },
- { 2.0, 47 },
- { 1.66, 25 },
- { 1.33, 11 },
- { 1, 3.5 },
+ { 2.66, 110 },
+ { 2.33, 80 },
+ { 2, 50 },
+ { 1.66, 30 },
+ { 1.33, 15 },
+ { 1, 5 },
{ .66, 1.4 },
{ .33, .4 },
{ 0, 0 },
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
index 97caaefc..d825afb1 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
@@ -66,8 +66,6 @@ void FTNoIR_Protocol::pose(const double* headpose) {
FTHeap* ft = pMemData;
FTData* data = &ft->data;
- shm.lock();
-
data->RawX = 0;
data->RawY = 0;
data->RawZ = 0;
@@ -98,9 +96,8 @@ void FTNoIR_Protocol::pose(const double* headpose) {
QString gamename;
{
unsigned char table[8];
- for (int i = 0; i < 8; i++) table[i] = pMemData->table[i];
- CSV::getGameData(id, table, gamename);
- for (int i = 0; i < 8; i++) pMemData->table[i] = table[i];
+ if (CSV::getGameData(id, table, gamename))
+ for (int i = 0; i < 8; i++) pMemData->table[i] = table[i];
}
ft->GameID2 = id;
intGameID = id;
@@ -109,8 +106,6 @@ void FTNoIR_Protocol::pose(const double* headpose) {
}
data->DataID += 1;
-
- shm.unlock();
}
void FTNoIR_Protocol::start_tirviews() {
@@ -148,8 +143,9 @@ void FTNoIR_Protocol::start_dummy() {
bool FTNoIR_Protocol::correct()
{
- QSettings settings("Freetrack", "FreetrackClient"); // Registry settings (in HK_USER)
- QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER)
+ // Registry settings (in HK_USER)
+ QSettings settings("Freetrack", "FreetrackClient");
+ QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location");
if (!shm.success())
return false;
@@ -157,20 +153,23 @@ bool FTNoIR_Protocol::correct()
QString aLocation = QCoreApplication::applicationDirPath() + "/";
switch (s.intUsedInterface) {
- case 0: // Use both interfaces
- settings.setValue( "Path" , aLocation );
- settingsTIR.setValue( "Path" , aLocation );
- break;
- case 1: // Use FreeTrack, disable TrackIR
- settings.setValue( "Path" , aLocation );
- settingsTIR.setValue( "Path" , "" );
- break;
- case 2: // Use TrackIR, disable FreeTrack
- settings.setValue( "Path" , "" );
- settingsTIR.setValue( "Path" , aLocation );
- break;
- default:
- break;
+ case 0:
+ // Use both interfaces
+ settings.setValue( "Path" , aLocation );
+ settingsTIR.setValue( "Path" , aLocation );
+ break;
+ case 1:
+ // Use FreeTrack, disable TrackIR
+ settings.setValue( "Path" , aLocation );
+ settingsTIR.setValue( "Path" , "" );
+ break;
+ case 2:
+ // Use TrackIR, disable FreeTrack
+ settings.setValue( "Path" , "" );
+ settingsTIR.setValue( "Path" , aLocation );
+ break;
+ default:
+ break;
}
if (s.useTIRViews) {
diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp
index cd7eb528..3a0a3420 100644
--- a/opentrack/plugin-support.hpp
+++ b/opentrack/plugin-support.hpp
@@ -20,6 +20,7 @@
#include <cstdio>
#include <cinttypes>
#include <iostream>
+#include <algorithm>
#include <QCoreApplication>
#include <QFile>
@@ -240,6 +241,12 @@ private:
QList<mem<dylib>> filter_modules;
QList<mem<dylib>> tracker_modules;
QList<mem<dylib>> protocol_modules;
+
+ template<typename t>
+ static void sort(QList<t>& xs)
+ {
+ std::sort(xs.begin(), xs.end(), [&](const t& a, const t& b) { return a->name.toLower() < b->name.toLower(); });
+ }
QList<mem<dylib>> filter(dylib::Type t)
{
@@ -247,6 +254,9 @@ private:
for (auto x : module_list)
if (x->type == t)
ret.push_back(x);
+
+ sort(ret);
+
return ret;
}
};
diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp
index e20fa1c0..a3c0773b 100644
--- a/opentrack/shortcuts.cpp
+++ b/opentrack/shortcuts.cpp
@@ -107,7 +107,7 @@ void KeybindingWorker::run() {
}
// keypresses get dropped with high values
- Sleep(15);
+ Sleep(8);
}
}
#endif
diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h
index d49a8f7b..d180928f 100644
--- a/qfunctionconfigurator/functionconfig.h
+++ b/qfunctionconfigurator/functionconfig.h
@@ -19,7 +19,7 @@
class Map {
private:
- static constexpr int value_count = 5000;
+ static constexpr int value_count = 10000;
using num = double;
using integral = std::uint16_t;
static constexpr integral integral_max = std::numeric_limits<integral>::max();