summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_protocol_ft
diff options
context:
space:
mode:
Diffstat (limited to 'ftnoir_protocol_ft')
-rw-r--r--ftnoir_protocol_ft/ft-protocol.qrc5
-rw-r--r--ftnoir_protocol_ft/ftnoir_ftcontrols.ui182
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.cpp166
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.h90
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp60
-rw-r--r--ftnoir_protocol_ft/images/freetrack.pngbin1773 -> 0 bytes
6 files changed, 0 insertions, 503 deletions
diff --git a/ftnoir_protocol_ft/ft-protocol.qrc b/ftnoir_protocol_ft/ft-protocol.qrc
deleted file mode 100644
index c04959f0..00000000
--- a/ftnoir_protocol_ft/ft-protocol.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>images/freetrack.png</file>
- </qresource>
-</RCC>
diff --git a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui b/ftnoir_protocol_ft/ftnoir_ftcontrols.ui
deleted file mode 100644
index 5356d2e5..00000000
--- a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui
+++ /dev/null
@@ -1,182 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>UICFTControls</class>
- <widget class="QWidget" name="UICFTControls">
- <property name="windowModality">
- <enum>Qt::NonModal</enum>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>422</width>
- <height>305</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>freetrack protocol settings</string>
- </property>
- <property name="windowIcon">
- <iconset resource="ft-protocol.qrc">
- <normaloff>:/images/freetrack.png</normaloff>:/images/freetrack.png</iconset>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QGroupBox" name="groupBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>TIRViews</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignJustify|Qt::AlignTop</set>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- <layout class="QFormLayout" name="formLayout_2">
- <item row="0" column="0">
- <widget class="QCheckBox" name="chkTIRViews">
- <property name="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
- <property name="text">
- <string>Memory hacks</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Only for very old and buggy old games such as CFS3.</string>
- </property>
- <property name="scaledContents">
- <bool>false</bool>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QGroupBox" name="groupBox_4">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>Repair NPClient location</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignJustify|Qt::AlignTop</set>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QPushButton" name="bntLocateNPClient">
- <property name="text">
- <string>Locate DLL</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_10">
- <property name="text">
- <string>Replace the registry entry if you want to use other software with the NPClient protocol and it doesn't work automatically.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QGroupBox" name="groupBox_3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>Select interface</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignJustify|Qt::AlignTop</set>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <widget class="QComboBox" name="cbxSelectInterface"/>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Disable one of the protocols if game is confused by presence of both at the same time.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <resources>
- <include location="ft-protocol.qrc"/>
- </resources>
- <connections/>
- <slots>
- <slot>startEngineClicked()</slot>
- <slot>stopEngineClicked()</slot>
- <slot>cameraSettingsClicked()</slot>
- </slots>
-</ui>
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
deleted file mode 100644
index 05253174..00000000
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Copyright (c) 2013-2015 Stanislaw Halik <sthalik@misaki.pl>
- * Copyright (c) 2015 Wim Vriend
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- */
-
-#include "ftnoir_protocol_ft.h"
-#include "csv/csv.h"
-
-FTNoIR_Protocol::FTNoIR_Protocol() :
- shm(FREETRACK_HEAP, FREETRACK_MUTEX, sizeof(FTHeap)),
- pMemData((FTHeap*) shm.ptr()),
- viewsStart(nullptr),
- viewsStop(nullptr),
- intGameID(0)
-{
-}
-
-FTNoIR_Protocol::~FTNoIR_Protocol()
-{
- if (viewsStop != NULL) {
- viewsStop();
- FTIRViewsLib.unload();
- }
- dummyTrackIR.terminate();
- dummyTrackIR.kill();
- dummyTrackIR.waitForFinished(50);
-}
-
-void FTNoIR_Protocol::pose(const double* headpose) {
- float yaw = -getRadsFromDegrees(headpose[Yaw]);
- float pitch = -getRadsFromDegrees(headpose[Pitch]);
- float roll = getRadsFromDegrees(headpose[Roll]);
- float tx = headpose[TX] * 10.f;
- float ty = headpose[TY] * 10.f;
- float tz = headpose[TZ] * 10.f;
-
- FTHeap* ft = pMemData;
- FTData* data = &ft->data;
-
- data->RawX = 0;
- data->RawY = 0;
- data->RawZ = 0;
- data->RawPitch = 0;
- data->RawYaw = 0;
- data->RawRoll = 0;
-
- data->X = tx;
- data->Y = ty;
- data->Z = tz;
- data->Yaw = yaw;
- data->Pitch = pitch;
- data->Roll = roll;
-
- data->X1 = data->DataID;
- data->X2 = 0;
- data->X3 = 0;
- data->X4 = 0;
- data->Y1 = 0;
- data->Y2 = 0;
- data->Y3 = 0;
- data->Y4 = 0;
-
- int32_t id = ft->GameID;
-
- if (intGameID != id)
- {
- QString gamename;
- {
- unsigned char table[8];
- if (CSV::getGameData(id, table, gamename))
- for (int i = 0; i < 8; i++) pMemData->table[i] = table[i];
- }
- ft->GameID2 = id;
- intGameID = id;
- QMutexLocker foo(&this->game_name_mutex);
- connected_game = gamename;
- }
-
- data->DataID += 1;
-}
-
-void FTNoIR_Protocol::start_tirviews() {
- QString aFileName = QCoreApplication::applicationDirPath() + "/TIRViews.dll";
- if ( QFile::exists( aFileName )) {
- FTIRViewsLib.setFileName(aFileName);
- FTIRViewsLib.load();
-
- viewsStart = (importTIRViewsStart) FTIRViewsLib.resolve("TIRViewsStart");
- if (viewsStart == NULL) {
- qDebug() << "FTServer::run() says: TIRViewsStart function not found in DLL!";
- }
- else {
- qDebug() << "FTServer::run() says: TIRViewsStart executed!";
- viewsStart();
- }
-
- //
- // Load the Stop function from TIRViews.dll. Call it when terminating the thread.
- //
- viewsStop = (importTIRViewsStop) FTIRViewsLib.resolve("TIRViewsStop");
- if (viewsStop == NULL) {
- qDebug() << "FTServer::run() says: TIRViewsStop function not found in DLL!";
- }
- }
-}
-
-void FTNoIR_Protocol::start_dummy() {
-
-
- QString program = QCoreApplication::applicationDirPath() + "/TrackIR.exe";
- dummyTrackIR.setProgram("\"" + program + "\"");
- dummyTrackIR.start();
-}
-
-bool FTNoIR_Protocol::correct()
-{
- // Registry settings (in HK_USER)
- QSettings settings("Freetrack", "FreetrackClient");
- QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location");
-
- if (!shm.success())
- return false;
-
- 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;
- }
-
- if (s.useTIRViews) {
- start_tirviews();
- }
-
- // more games need the dummy executable than previously thought
- start_dummy();
-
- pMemData->data.DataID = 1;
- pMemData->data.CamWidth = 100;
- pMemData->data.CamHeight = 250;
- pMemData->GameID2 = 0;
- for (int i = 0; i < 8; i++)
- pMemData->table[i] = 0;
-
- return true;
-}
-
-OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, FTControls, FTNoIR_ProtocolDll)
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h
deleted file mode 100644
index 8e50f1cb..00000000
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (c) 2013-2015 Stanislaw Halik <sthalik@misaki.pl>
- * Copyright (c) 2015 Wim Vriend
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- */
-
-#pragma once
-#include "ui_ftnoir_ftcontrols.h"
-#include "opentrack/plugin-api.hpp"
-#include <QMessageBox>
-#include <QSettings>
-#include <QLibrary>
-#include <QProcess>
-#include <QDebug>
-#include <QFile>
-#include <QString>
-#include <QMutex>
-#include <QMutexLocker>
-#include "opentrack-compat/shm.h"
-#include "opentrack/options.hpp"
-#include "freetrackclient/fttypes.h"
-using namespace options;
-
-struct settings : opts {
- value<int> intUsedInterface;
- value<bool> useTIRViews;
- settings() :
- opts("proto-freetrack"),
- intUsedInterface(b, "used-interfaces", 0),
- useTIRViews(b, "use-memory-hacks", false)
- {}
-};
-
-typedef void (__stdcall *importTIRViewsStart)(void);
-typedef void (__stdcall *importTIRViewsStop)(void);
-
-class FTNoIR_Protocol : public IProtocol
-{
-public:
- FTNoIR_Protocol();
- ~FTNoIR_Protocol() override;
- bool correct();
- void pose( const double *headpose );
- QString game_name() override {
- QMutexLocker foo(&game_name_mutex);
- return connected_game;
- }
-private:
- settings s;
- PortableLockedShm shm;
- FTHeap *pMemData;
-
- QLibrary FTIRViewsLib;
- QProcess dummyTrackIR;
- importTIRViewsStart viewsStart;
- importTIRViewsStop viewsStop;
-
- int intGameID;
- QString connected_game;
- QMutex game_name_mutex;
-
- static inline double getRadsFromDegrees(double degrees) { return degrees * 0.017453; }
- void start_tirviews();
- void start_dummy();
-};
-
-class FTControls: public IProtocolDialog
-{
- Q_OBJECT
-public:
- FTControls();
- void register_protocol(IProtocol *) {}
- void unregister_protocol() {}
-private:
- Ui::UICFTControls ui;
- settings s;
-private slots:
- void selectDLL();
- void doOK();
- void doCancel();
-};
-
-class FTNoIR_ProtocolDll : public Metadata
-{
-public:
- QString name() { return QString("freetrack 2.0 Enhanced"); }
- QIcon icon() { return QIcon(":/images/freetrack.png"); }
-};
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp
deleted file mode 100644
index 25f3a4cb..00000000
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Homepage http://facetracknoir.sourceforge.net/home/default.htm *
- * *
- * ISC License (ISC) *
- * *
- * Copyright (c) 2015, Wim Vriend *
- * *
- * Permission to use, copy, modify, and/or distribute this software for any *
- * purpose with or without fee is hereby granted, provided that the above *
- * copyright notice and this permission notice appear in all copies. *
- */
-#include "ftnoir_protocol_ft.h"
-#include <QDebug>
-#include <QFileDialog>
-
-FTControls::FTControls()
-{
- ui.setupUi( this );
-
- connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));
- connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
- connect(ui.bntLocateNPClient, SIGNAL(clicked()), this, SLOT(selectDLL()));
-
- tie_setting(s.useTIRViews, ui.chkTIRViews);
-
- ui.cbxSelectInterface->addItem("Enable both");
- ui.cbxSelectInterface->addItem("Use FreeTrack, hide TrackIR");
- ui.cbxSelectInterface->addItem("Use TrackIR, hide FreeTrack");
-
- tie_setting(s.intUsedInterface, ui.cbxSelectInterface);
-
- QFile memhacks_pathname(QCoreApplication::applicationDirPath() + "/TIRViews.dll");
- if (!memhacks_pathname.exists()) {
- ui.chkTIRViews->setChecked( false );
- ui.chkTIRViews->setEnabled ( false );
- }
- else {
- ui.chkTIRViews->setEnabled ( true );
- }
-}
-
-void FTControls::doOK() {
- s.b->save();
- this->close();
-}
-
-void FTControls::doCancel() {
- s.b->reload();
- this->close();
-}
-
-void FTControls::selectDLL() {
- QString filename = QFileDialog::getOpenFileName( this, tr("Select the desired NPClient DLL"), QCoreApplication::applicationDirPath() + "/NPClient.dll", tr("Dll file (*.dll);;All Files (*)"));
-
- if (! filename.isEmpty() ) {
- QSettings node("NaturalPoint", "NATURALPOINT\\NPClient Location");
- QFileInfo dllname(filename);
- node.setValue( "Path" , dllname.dir().path() );
- }
-}
-
diff --git a/ftnoir_protocol_ft/images/freetrack.png b/ftnoir_protocol_ft/images/freetrack.png
deleted file mode 100644
index c184dc88..00000000
--- a/ftnoir_protocol_ft/images/freetrack.png
+++ /dev/null
Binary files differ