summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_protocol_fsuipc
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-10-30 07:37:41 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-10-30 08:39:32 +0100
commitaa066bdd4622d4f6824fee864f6be6806813f04d (patch)
tree3df328b8b364cba2373a85827191b259bd78d546 /ftnoir_protocol_fsuipc
parentd6a54431d178632a2bf466c9904f74abd143afe6 (diff)
move to subdirectory-based build system
Closes #224
Diffstat (limited to 'ftnoir_protocol_fsuipc')
-rw-r--r--ftnoir_protocol_fsuipc/fsuipc-protocol.qrc5
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui134
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp149
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h90
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp43
-rw-r--r--ftnoir_protocol_fsuipc/images/fs9.pngbin758 -> 0 bytes
-rw-r--r--ftnoir_protocol_fsuipc/images/fs91.pngbin1644 -> 0 bytes
7 files changed, 0 insertions, 421 deletions
diff --git a/ftnoir_protocol_fsuipc/fsuipc-protocol.qrc b/ftnoir_protocol_fsuipc/fsuipc-protocol.qrc
deleted file mode 100644
index 34756f84..00000000
--- a/ftnoir_protocol_fsuipc/fsuipc-protocol.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>images/fs9.png</file>
- </qresource>
-</RCC>
diff --git a/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui b/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui
deleted file mode 100644
index 637e4dba..00000000
--- a/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui
+++ /dev/null
@@ -1,134 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>UICFSUIPCControls</class>
- <widget class="QWidget" name="UICFSUIPCControls">
- <property name="windowModality">
- <enum>Qt::NonModal</enum>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>512</width>
- <height>100</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>FSUIPC settings FaceTrackNoIR</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>images/FaceTrackNoIR.png</normaloff>images/FaceTrackNoIR.png</iconset>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="2" column="1">
- <widget class="QPushButton" name="btnCancel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>Cancel</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="txtLocationOfDLL">
- <property name="minimumSize">
- <size>
- <width>230</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Location of FSUIPC.dll</string>
- </property>
- <property name="frameShape">
- <enum>QFrame::Box</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <property name="lineWidth">
- <number>1</number>
- </property>
- <property name="text">
- <string>Location of FSUIPC.dll</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>The DLL should be located in the Modules/ directory of MS FS 2004</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QPushButton" name="btnOK">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>OK</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QPushButton" name="btnFindDLL">
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
- <slots>
- <slot>startEngineClicked()</slot>
- <slot>stopEngineClicked()</slot>
- <slot>cameraSettingsClicked()</slot>
- </slots>
-</ui>
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp
deleted file mode 100644
index 702a92d4..00000000
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp
+++ /dev/null
@@ -1,149 +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_fsuipc.h"
-#include "opentrack/plugin-api.hpp"
-
-FTNoIR_Protocol::FTNoIR_Protocol()
-{
- prevPosX = 0.0f;
- prevPosY = 0.0f;
- prevPosZ = 0.0f;
- prevRotX = 0.0f;
- prevRotY = 0.0f;
- prevRotZ = 0.0f;
-}
-
-FTNoIR_Protocol::~FTNoIR_Protocol()
-{
- FSUIPC_Close();
- FSUIPCLib.unload();
-}
-
-int FTNoIR_Protocol::scale2AnalogLimits( float x, float min_x, float max_x ) {
-double y;
-double local_x;
-
- local_x = x;
- if (local_x > max_x) {
- local_x = max_x;
- }
- if (local_x < min_x) {
- local_x = min_x;
- }
- y = ( 16383 * local_x ) / max_x;
-
- return (int) y;
-}
-
-void FTNoIR_Protocol::pose(const double *headpose ) {
- DWORD result;
- TFSState pitch;
- TFSState yaw;
- TFSState roll;
- WORD FSZoom;
-
- float virtPosX;
- float virtPosY;
- float virtPosZ;
-
- float virtRotX;
- float virtRotY;
- float virtRotZ;
-
-// qDebug() << "FSUIPCServer::run() says: started!";
-
- virtRotX = -headpose[Pitch]; // degrees
- virtRotY = headpose[Yaw];
- virtRotZ = headpose[Roll];
-
- virtPosX = 0.0f; // cm, X and Y are not working for FS2002/2004!
- virtPosY = 0.0f;
- virtPosZ = headpose[TZ];
-
- //
- // Init. the FSUIPC offsets (derived from Free-track...)
- //
- pitch.Control = 66503;
- yaw.Control = 66504;
- roll.Control = 66505;
-
- //
- // Only do this when the data has changed. This way, the HAT-switch can be used when tracking is OFF.
- //
- if ((prevPosX != virtPosX) || (prevPosY != virtPosY) || (prevPosZ != virtPosZ) ||
- (prevRotX != virtRotX) || (prevRotY != virtRotY) || (prevRotZ != virtRotZ)) {
- //
- // Open the connection
- //
- FSUIPC_Open(SIM_ANY, &result);
-
- //
- // Check the FS-version
- //
- if (((result == FSUIPC_ERR_OK) || (result == FSUIPC_ERR_OPEN)) &&
- ((FSUIPC_FS_Version == SIM_FS2K2) || (FSUIPC_FS_Version == SIM_FS2K4))) {
-// qDebug() << "FSUIPCServer::run() says: FSUIPC opened succesfully";
- //
- // Write the 4! DOF-data to FS. Only rotations and zoom are possible.
- //
- pitch.Value = scale2AnalogLimits(virtRotX, -180, 180);
- FSUIPC_Write(0x3110, 8, &pitch, &result);
-
- yaw.Value = scale2AnalogLimits(virtRotY, -180, 180);
- FSUIPC_Write(0x3110, 8, &yaw, &result);
-
- roll.Value = scale2AnalogLimits(virtRotZ, -180, 180);
- FSUIPC_Write(0x3110, 8, &roll, &result);
-
- FSZoom = (WORD) (64/50) * virtPosZ + 64;
- FSUIPC_Write(0x832E, 2, &FSZoom, &result);
-
- //
- // Write the data, in one go!
- //
- FSUIPC_Process(&result);
- if (result == FSUIPC_ERR_SENDMSG) {
- // FSUIPC checks for already open connections and returns FSUIPC_ERR_OPEN in that case
- // the connection scope is global for the process. this is why above code doesn't
- // leak resources or have logic errors. see: http://www.purebasic.fr/english/viewtopic.php?t=31112
- FSUIPC_Close();
- }
- }
- }
-
- prevPosX = virtPosX;
- prevPosY = virtPosY;
- prevPosZ = virtPosZ;
- prevRotX = virtRotX;
- prevRotY = virtRotY;
- prevRotZ = virtRotZ;
-}
-
-bool FTNoIR_Protocol::correct()
-{
- qDebug() << "correct says: Starting Function";
-
- //
- // Load the DLL.
- //
- FSUIPCLib.setFileName( s.LocationOfDLL );
- if (FSUIPCLib.load() != true) {
- qDebug() << "correct says: Error loading FSUIPC DLL";
- return false;
- }
- else {
- qDebug() << "correct says: FSUIPC DLL loaded.";
- }
-
- return true;
-}
-
-OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, FSUIPCControls, FTNoIR_ProtocolDll)
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h
deleted file mode 100644
index c8e91a42..00000000
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h
+++ /dev/null
@@ -1,90 +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. *
- */
-#pragma once
-#ifndef INCLUDED_FSUIPCSERVER_H
-#define INCLUDED_FSUIPCSERVER_H
-
-#include <windows.h>
-#include <stdlib.h>
-#include "FSUIPC_User.h"
-#include "opentrack/plugin-api.hpp"
-#include "ui_ftnoir_fsuipccontrols.h"
-#include <QMessageBox>
-#include <QSettings>
-#include <QLibrary>
-#include <QProcess>
-#include <QDebug>
-#include <QFile>
-#include <QFileDialog>
-#include "opentrack/options.hpp"
-using namespace options;
-
-#define FSUIPC_FILENAME "C:\\Program Files\\Microsoft Games\\Flight Simulator 9\\Modules\\FSUIPC.dll"
-
-struct settings : opts {
- value<QString> LocationOfDLL;
- settings() :
- opts("proto-fsuipc"),
- LocationOfDLL(b, "dll-location", FSUIPC_FILENAME)
- {}
-};
-
-#pragma pack(push,1) // All fields in structure must be byte aligned.
-typedef struct
-{
- int Control; // Control identifier
- int Value; // Value of DOF
-} TFSState;
-#pragma pack(pop)
-
-class FTNoIR_Protocol : public IProtocol
-{
-public:
- FTNoIR_Protocol();
- ~FTNoIR_Protocol() override;
- bool correct();
- void pose(const double* headpose);
- QString game_name() {
- return "Microsoft Flight Simulator X";
- }
-private:
- QLibrary FSUIPCLib;
- double prevPosX, prevPosY, prevPosZ, prevRotX, prevRotY, prevRotZ;
- static int scale2AnalogLimits( float x, float min_x, float max_x );
- settings s;
-};
-
-class FSUIPCControls: public IProtocolDialog
-{
- Q_OBJECT
-public:
- FSUIPCControls();
- void register_protocol(IProtocol *) {}
- void unregister_protocol() {}
-private:
- Ui::UICFSUIPCControls ui;
- settings s;
-private slots:
- void doOK();
- void doCancel();
- void getLocationOfDLL();
-};
-
-class FTNoIR_ProtocolDll : public Metadata
-{
-public:
- QString name() { return QString("FSUIPC -- Microsoft FS2002/FS2004"); }
- QIcon icon() { return QIcon(":/images/fs9.png"); }
-};
-
-
-#endif//INCLUDED_FSUIPCSERVER_H
-//END
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp
deleted file mode 100644
index d573420a..00000000
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp
+++ /dev/null
@@ -1,43 +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_fsuipc.h"
-#include "opentrack/plugin-api.hpp"
-
-FSUIPCControls::FSUIPCControls()
-{
- ui.setupUi( this );
- connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
- connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
- connect(ui.btnFindDLL, SIGNAL(clicked()), this, SLOT(getLocationOfDLL()));
-
- tie_setting(s.LocationOfDLL, ui.txtLocationOfDLL);
-}
-
-void FSUIPCControls::doOK() {
- s.b->save();
- this->close();
-}
-
-void FSUIPCControls::doCancel() {
- s.b->reload();
- close();
-}
-
-void FSUIPCControls::getLocationOfDLL()
-{
- QString fileName = QFileDialog::getOpenFileName(this, tr("Locate file"),
- ui.txtLocationOfDLL->text(),
- tr("FSUIPC DLL file (FSUIPC*.dll);;All Files (*)"));
- if (!fileName.isEmpty()) {
- s.LocationOfDLL = fileName;
- }
-}
-
diff --git a/ftnoir_protocol_fsuipc/images/fs9.png b/ftnoir_protocol_fsuipc/images/fs9.png
deleted file mode 100644
index 914c9dcb..00000000
--- a/ftnoir_protocol_fsuipc/images/fs9.png
+++ /dev/null
Binary files differ
diff --git a/ftnoir_protocol_fsuipc/images/fs91.png b/ftnoir_protocol_fsuipc/images/fs91.png
deleted file mode 100644
index f9540d1d..00000000
--- a/ftnoir_protocol_fsuipc/images/fs91.png
+++ /dev/null
Binary files differ