diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-28 03:19:56 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-01-16 07:48:18 +0100 |
commit | 70048a925a7e34e1307c7ca501671f0bd75ec817 (patch) | |
tree | ab611d9e5023b50cc64a8a8a2ff64200b1729702 /proto-fsuipc | |
parent | 74b401e24b9b3c9333f6e435860e1bc1f44a3b6f (diff) |
proto/fsuipc: don't look for unrelated .dll
This .dll seems to be unrelated. Unless it performs some side effects in
the background, there seems to be no reason whatsoever to look for it.
This is completely untested.
Diffstat (limited to 'proto-fsuipc')
-rw-r--r-- | proto-fsuipc/ftnoir_fsuipccontrols.ui | 104 | ||||
-rw-r--r-- | proto-fsuipc/ftnoir_protocol_fsuipc.cpp | 73 | ||||
-rw-r--r-- | proto-fsuipc/ftnoir_protocol_fsuipc.h | 20 | ||||
-rw-r--r-- | proto-fsuipc/ftnoir_protocol_fsuipc_dialog.cpp | 13 | ||||
-rw-r--r-- | proto-fsuipc/lang/nl_NL.ts | 22 | ||||
-rw-r--r-- | proto-fsuipc/lang/ru_RU.ts | 22 | ||||
-rw-r--r-- | proto-fsuipc/lang/stub.ts | 22 | ||||
-rw-r--r-- | proto-fsuipc/lang/zh_CN.ts | 22 |
8 files changed, 64 insertions, 234 deletions
diff --git a/proto-fsuipc/ftnoir_fsuipccontrols.ui b/proto-fsuipc/ftnoir_fsuipccontrols.ui index 4c85c91c..5a28aad2 100644 --- a/proto-fsuipc/ftnoir_fsuipccontrols.ui +++ b/proto-fsuipc/ftnoir_fsuipccontrols.ui @@ -9,12 +9,12 @@ <rect> <x>0</x> <y>0</y> - <width>512</width> - <height>100</height> + <width>248</width> + <height>34</height> </rect> </property> <property name="windowTitle"> - <string>FSUIPC settings FaceTrackNoIR</string> + <string>FSUIPC</string> </property> <property name="windowIcon"> <iconset> @@ -26,99 +26,11 @@ <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> + <layout class="QVBoxLayout" name="verticalLayout"> + <item alignment="Qt::AlignTop"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Ok</set> </property> </widget> </item> diff --git a/proto-fsuipc/ftnoir_protocol_fsuipc.cpp b/proto-fsuipc/ftnoir_protocol_fsuipc.cpp index 7ba466a8..678262fa 100644 --- a/proto-fsuipc/ftnoir_protocol_fsuipc.cpp +++ b/proto-fsuipc/ftnoir_protocol_fsuipc.cpp @@ -13,24 +13,18 @@ #include <cmath> -fsuipc::fsuipc() -{ - prevPosX = 0.0f; - prevPosY = 0.0f; - prevPosZ = 0.0f; - prevRotX = 0.0f; - prevRotY = 0.0f; - prevRotZ = 0.0f; -} +fsuipc::fsuipc() = default; fsuipc::~fsuipc() { FSUIPC_Close(); +#if 0 FSUIPCLib.unload(); +#endif } template<typename t> -int fsuipc::scale2AnalogLimits(t x, t min_x, t max_x) +int fsuipc::scale(t x, t min_x, t max_x) { t local_x = x; @@ -48,58 +42,44 @@ int fsuipc::scale2AnalogLimits(t x, t min_x, t max_x) return (int) y; } +#if 0 template<typename t> -static inline bool check_float_fresh(t x, t y) +static bool check_float_fresh(t x, t y) { constexpr t eps = t(1e-4); return std::fabs(x - y) >= eps; } +#endif -void fsuipc::pose(const double *headpose ) { +void fsuipc::pose(const double *headpose) +{ DWORD result; - TFSState pitch; - TFSState yaw; - TFSState roll; WORD FSZoom; - double virtPosX; - double virtPosY; - double virtPosZ; - - double virtRotX; - double virtRotY; - double 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]; + // cm, X and Y are not working for FS2002/2004! + double pos_z = headpose[TZ]; + state pitch, yaw, roll; // NOLINT(cppcoreguidelines-pro-type-member-init) - // - // Init. the FSUIPC offsets (derived from Free-track...) - // + // offsets derived from freetrack pitch.Control = 66503; + pitch.Value = scale(-headpose[Pitch], -180., 180.); // degrees + yaw.Control = 66504; + yaw.Value = scale(headpose[Yaw], -180., 180.); + roll.Control = 66505; + roll.Value = scale(headpose[Roll], -180., 180.); - // +#if 0 // Only do this when the data has changed. This way, the HAT-switch can be used when tracking is OFF. - // if (check_float_fresh(prevRotX, virtRotX) || check_float_fresh(prevRotY, virtRotY) || check_float_fresh(prevRotZ, virtRotZ) || check_float_fresh(prevPosX, virtPosX) || check_float_fresh(prevPosY, virtPosY) || check_float_fresh(prevPosZ, virtPosZ)) +#endif { - // - // Open the connection - // FSUIPC_Open(SIM_ANY, &result); // @@ -110,16 +90,11 @@ void fsuipc::pose(const double *headpose ) { { // 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(virtPosZ + 64); + FSZoom = WORD(pos_z + 64); FSUIPC_Write(0x832E, 2, &FSZoom, &result); // @@ -136,16 +111,19 @@ void fsuipc::pose(const double *headpose ) { } } +#if 0 prevPosX = virtPosX; prevPosY = virtPosY; prevPosZ = virtPosZ; prevRotX = virtRotX; prevRotY = virtRotY; prevRotZ = virtRotZ; +#endif } module_status fsuipc::initialize() { +#if 0 FSUIPCLib.setFileName( s.LocationOfDLL ); FSUIPCLib.setLoadHints(QLibrary::PreventUnloadHint); @@ -153,6 +131,9 @@ module_status fsuipc::initialize() return error(tr("Can't load fsuipc at '%1'").arg(s.LocationOfDLL)); else return status_ok(); +#else + return {}; +#endif } OPENTRACK_DECLARE_PROTOCOL(fsuipc, FSUIPCControls, fsuipcDll) diff --git a/proto-fsuipc/ftnoir_protocol_fsuipc.h b/proto-fsuipc/ftnoir_protocol_fsuipc.h index 93e73e7f..62238032 100644 --- a/proto-fsuipc/ftnoir_protocol_fsuipc.h +++ b/proto-fsuipc/ftnoir_protocol_fsuipc.h @@ -27,6 +27,7 @@ #include "options/options.hpp" using namespace options; +#if 0 #define FSUIPC_FILENAME "C:\\Program Files\\Microsoft Games\\Flight Simulator 9\\Modules\\FSUIPC.dll" struct settings : opts { @@ -36,13 +37,14 @@ struct settings : opts { LocationOfDLL(b, "dll-location", FSUIPC_FILENAME) {} }; +#endif #pragma pack(push,1) // All fields in structure must be unaligned -typedef struct +struct state { int Control; // Control identifier int Value; // Value of DOF -} TFSState; +}; #pragma pack(pop) class fsuipc : public TR, public IProtocol @@ -56,12 +58,16 @@ public: void pose(const double* headpose) override; QString game_name() override { return tr("Microsoft Flight Simulator X"); } private: +#if 0 QLibrary FSUIPCLib; - double prevPosX, prevPosY, prevPosZ, prevRotX, prevRotY, prevRotZ; + + double prevPosX = 0, prevPosY = 0, prevPosZ = 0, + prevRotX = 0, prevRotY = 0, prevRotZ = 0; settings s; +#endif template<typename t> - static int scale2AnalogLimits(t x, t min_x, t max_x ); + static int scale(t x, t min_x, t max_x); }; class FSUIPCControls: public IProtocolDialog @@ -73,11 +79,15 @@ public: void unregister_protocol() override {} private: Ui::UICFSUIPCControls ui; +#if 0 settings s; +#endif private slots: - void doOK(); void doCancel(); +#if 0 + void doOK(); void getLocationOfDLL(); +#endif }; class fsuipcDll : public Metadata diff --git a/proto-fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/proto-fsuipc/ftnoir_protocol_fsuipc_dialog.cpp index 07507cfb..122c9383 100644 --- a/proto-fsuipc/ftnoir_protocol_fsuipc_dialog.cpp +++ b/proto-fsuipc/ftnoir_protocol_fsuipc_dialog.cpp @@ -14,23 +14,30 @@ FSUIPCControls::FSUIPCControls() { ui.setupUi( this ); +#if 0 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); +#else + connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &FSUIPCControls::doCancel); +#endif } -void FSUIPCControls::doOK() { +#if 0 +void FSUIPCControls::doOK() +{ s.b->save(); close(); } +#endif void FSUIPCControls::doCancel() { close(); } +#if 0 void FSUIPCControls::getLocationOfDLL() { QString fileName = QFileDialog::getOpenFileName(this, tr("Locate file"), @@ -40,4 +47,4 @@ void FSUIPCControls::getLocationOfDLL() s.LocationOfDLL = fileName; } } - +#endif diff --git a/proto-fsuipc/lang/nl_NL.ts b/proto-fsuipc/lang/nl_NL.ts index dd7d7942..4a7578e9 100644 --- a/proto-fsuipc/lang/nl_NL.ts +++ b/proto-fsuipc/lang/nl_NL.ts @@ -15,27 +15,7 @@ <context> <name>UICFSUIPCControls</name> <message> - <source>FSUIPC settings FaceTrackNoIR</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Cancel</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Location of FSUIPC.dll</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>The DLL should be located in the Modules/ directory of MS FS 2004</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>OK</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>...</source> + <source>FSUIPC</source> <translation type="unfinished"></translation> </message> </context> diff --git a/proto-fsuipc/lang/ru_RU.ts b/proto-fsuipc/lang/ru_RU.ts index 29f52f79..dd26dd22 100644 --- a/proto-fsuipc/lang/ru_RU.ts +++ b/proto-fsuipc/lang/ru_RU.ts @@ -15,27 +15,7 @@ <context> <name>UICFSUIPCControls</name> <message> - <source>FSUIPC settings FaceTrackNoIR</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Cancel</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Location of FSUIPC.dll</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>The DLL should be located in the Modules/ directory of MS FS 2004</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>OK</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>...</source> + <source>FSUIPC</source> <translation type="unfinished"></translation> </message> </context> diff --git a/proto-fsuipc/lang/stub.ts b/proto-fsuipc/lang/stub.ts index 16662c44..031e1916 100644 --- a/proto-fsuipc/lang/stub.ts +++ b/proto-fsuipc/lang/stub.ts @@ -15,27 +15,7 @@ <context> <name>UICFSUIPCControls</name> <message> - <source>FSUIPC settings FaceTrackNoIR</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Cancel</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Location of FSUIPC.dll</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>The DLL should be located in the Modules/ directory of MS FS 2004</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>OK</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>...</source> + <source>FSUIPC</source> <translation type="unfinished"></translation> </message> </context> diff --git a/proto-fsuipc/lang/zh_CN.ts b/proto-fsuipc/lang/zh_CN.ts index 16662c44..031e1916 100644 --- a/proto-fsuipc/lang/zh_CN.ts +++ b/proto-fsuipc/lang/zh_CN.ts @@ -15,27 +15,7 @@ <context> <name>UICFSUIPCControls</name> <message> - <source>FSUIPC settings FaceTrackNoIR</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Cancel</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>Location of FSUIPC.dll</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>The DLL should be located in the Modules/ directory of MS FS 2004</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>OK</source> - <translation type="unfinished"></translation> - </message> - <message> - <source>...</source> + <source>FSUIPC</source> <translation type="unfinished"></translation> </message> </context> |