From 0bc78d53028f5ac68b9ab454347b8ad453988c08 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 7 Apr 2017 21:36:10 +0200 Subject: rename several protocols from abbreviated names --- proto-fg/CMakeLists.txt | 1 - proto-fg/fg-protocol.qrc | 5 - proto-fg/ftnoir_fgcontrols.ui | 208 ------------------ proto-fg/ftnoir_protocol_fg.cpp | 33 --- proto-fg/ftnoir_protocol_fg.h | 76 ------- proto-fg/ftnoir_protocol_fg_dialog.cpp | 58 ------ proto-fg/images/flightgear.png | Bin 979 -> 0 bytes proto-fg/lang/nl_NL.ts | 38 ---- proto-fg/lang/ru_RU.ts | 38 ---- proto-fg/lang/stub.ts | 38 ---- proto-flightgear/CMakeLists.txt | 1 + proto-flightgear/fg-protocol.qrc | 5 + proto-flightgear/ftnoir_fgcontrols.ui | 208 ++++++++++++++++++ proto-flightgear/ftnoir_protocol_fg.cpp | 33 +++ proto-flightgear/ftnoir_protocol_fg.h | 76 +++++++ proto-flightgear/ftnoir_protocol_fg_dialog.cpp | 58 ++++++ proto-flightgear/images/flightgear.png | Bin 0 -> 979 bytes proto-flightgear/lang/nl_NL.ts | 38 ++++ proto-flightgear/lang/ru_RU.ts | 38 ++++ proto-flightgear/lang/stub.ts | 38 ++++ proto-ftn/CMakeLists.txt | 1 - proto-ftn/ftnoir_ftncontrols.ui | 266 ------------------------ proto-ftn/ftnoir_protocol_ftn.cpp | 34 --- proto-ftn/ftnoir_protocol_ftn.h | 69 ------ proto-ftn/ftnoir_protocol_ftn_dialog.cpp | 42 ---- proto-ftn/lang/nl_NL.ts | 58 ------ proto-ftn/lang/ru_RU.ts | 58 ------ proto-ftn/lang/stub.ts | 58 ------ proto-sc/CMakeLists.txt | 3 - proto-sc/ftnoir-protocol-sc.rc | 4 - proto-sc/ftnoir_protocol_sc.cpp | 193 ----------------- proto-sc/ftnoir_protocol_sc.h | 108 ---------- proto-sc/ftnoir_protocol_sc_dialog.cpp | 35 ---- proto-sc/ftnoir_sccontrols.ui | 109 ---------- proto-sc/images/fsx.png | Bin 813 -> 0 bytes proto-sc/images/fsx1.png | Bin 1920 -> 0 bytes proto-sc/lang/nl_NL.ts | 45 ---- proto-sc/lang/ru_RU.ts | 45 ---- proto-sc/lang/stub.ts | 45 ---- proto-sc/sc-protocol.qrc | 5 - proto-sc/scserver.manifest | 13 -- proto-sc/scserver_acceleration.manifest | 13 -- proto-sc/scserver_sp2.manifest | 13 -- proto-simconnect/CMakeLists.txt | 3 + proto-simconnect/ftnoir-protocol-sc.rc | 4 + proto-simconnect/ftnoir_protocol_sc.cpp | 193 +++++++++++++++++ proto-simconnect/ftnoir_protocol_sc.h | 108 ++++++++++ proto-simconnect/ftnoir_protocol_sc_dialog.cpp | 35 ++++ proto-simconnect/ftnoir_sccontrols.ui | 109 ++++++++++ proto-simconnect/images/fsx.png | Bin 0 -> 813 bytes proto-simconnect/images/fsx1.png | Bin 0 -> 1920 bytes proto-simconnect/lang/nl_NL.ts | 45 ++++ proto-simconnect/lang/ru_RU.ts | 45 ++++ proto-simconnect/lang/stub.ts | 45 ++++ proto-simconnect/sc-protocol.qrc | 5 + proto-simconnect/scserver.manifest | 13 ++ proto-simconnect/scserver_acceleration.manifest | 13 ++ proto-simconnect/scserver_sp2.manifest | 13 ++ proto-udp/CMakeLists.txt | 1 + proto-udp/ftnoir_ftncontrols.ui | 266 ++++++++++++++++++++++++ proto-udp/ftnoir_protocol_ftn.cpp | 34 +++ proto-udp/ftnoir_protocol_ftn.h | 69 ++++++ proto-udp/ftnoir_protocol_ftn_dialog.cpp | 42 ++++ proto-udp/lang/nl_NL.ts | 58 ++++++ proto-udp/lang/ru_RU.ts | 58 ++++++ proto-udp/lang/stub.ts | 58 ++++++ 66 files changed, 1712 insertions(+), 1712 deletions(-) delete mode 100644 proto-fg/CMakeLists.txt delete mode 100644 proto-fg/fg-protocol.qrc delete mode 100644 proto-fg/ftnoir_fgcontrols.ui delete mode 100644 proto-fg/ftnoir_protocol_fg.cpp delete mode 100644 proto-fg/ftnoir_protocol_fg.h delete mode 100644 proto-fg/ftnoir_protocol_fg_dialog.cpp delete mode 100644 proto-fg/images/flightgear.png delete mode 100644 proto-fg/lang/nl_NL.ts delete mode 100644 proto-fg/lang/ru_RU.ts delete mode 100644 proto-fg/lang/stub.ts create mode 100644 proto-flightgear/CMakeLists.txt create mode 100644 proto-flightgear/fg-protocol.qrc create mode 100644 proto-flightgear/ftnoir_fgcontrols.ui create mode 100644 proto-flightgear/ftnoir_protocol_fg.cpp create mode 100644 proto-flightgear/ftnoir_protocol_fg.h create mode 100644 proto-flightgear/ftnoir_protocol_fg_dialog.cpp create mode 100644 proto-flightgear/images/flightgear.png create mode 100644 proto-flightgear/lang/nl_NL.ts create mode 100644 proto-flightgear/lang/ru_RU.ts create mode 100644 proto-flightgear/lang/stub.ts delete mode 100644 proto-ftn/CMakeLists.txt delete mode 100644 proto-ftn/ftnoir_ftncontrols.ui delete mode 100644 proto-ftn/ftnoir_protocol_ftn.cpp delete mode 100644 proto-ftn/ftnoir_protocol_ftn.h delete mode 100644 proto-ftn/ftnoir_protocol_ftn_dialog.cpp delete mode 100644 proto-ftn/lang/nl_NL.ts delete mode 100644 proto-ftn/lang/ru_RU.ts delete mode 100644 proto-ftn/lang/stub.ts delete mode 100644 proto-sc/CMakeLists.txt delete mode 100644 proto-sc/ftnoir-protocol-sc.rc delete mode 100644 proto-sc/ftnoir_protocol_sc.cpp delete mode 100644 proto-sc/ftnoir_protocol_sc.h delete mode 100644 proto-sc/ftnoir_protocol_sc_dialog.cpp delete mode 100644 proto-sc/ftnoir_sccontrols.ui delete mode 100644 proto-sc/images/fsx.png delete mode 100644 proto-sc/images/fsx1.png delete mode 100644 proto-sc/lang/nl_NL.ts delete mode 100644 proto-sc/lang/ru_RU.ts delete mode 100644 proto-sc/lang/stub.ts delete mode 100644 proto-sc/sc-protocol.qrc delete mode 100644 proto-sc/scserver.manifest delete mode 100644 proto-sc/scserver_acceleration.manifest delete mode 100644 proto-sc/scserver_sp2.manifest create mode 100644 proto-simconnect/CMakeLists.txt create mode 100644 proto-simconnect/ftnoir-protocol-sc.rc create mode 100644 proto-simconnect/ftnoir_protocol_sc.cpp create mode 100644 proto-simconnect/ftnoir_protocol_sc.h create mode 100644 proto-simconnect/ftnoir_protocol_sc_dialog.cpp create mode 100644 proto-simconnect/ftnoir_sccontrols.ui create mode 100644 proto-simconnect/images/fsx.png create mode 100644 proto-simconnect/images/fsx1.png create mode 100644 proto-simconnect/lang/nl_NL.ts create mode 100644 proto-simconnect/lang/ru_RU.ts create mode 100644 proto-simconnect/lang/stub.ts create mode 100644 proto-simconnect/sc-protocol.qrc create mode 100644 proto-simconnect/scserver.manifest create mode 100644 proto-simconnect/scserver_acceleration.manifest create mode 100644 proto-simconnect/scserver_sp2.manifest create mode 100644 proto-udp/CMakeLists.txt create mode 100644 proto-udp/ftnoir_ftncontrols.ui create mode 100644 proto-udp/ftnoir_protocol_ftn.cpp create mode 100644 proto-udp/ftnoir_protocol_ftn.h create mode 100644 proto-udp/ftnoir_protocol_ftn_dialog.cpp create mode 100644 proto-udp/lang/nl_NL.ts create mode 100644 proto-udp/lang/ru_RU.ts create mode 100644 proto-udp/lang/stub.ts diff --git a/proto-fg/CMakeLists.txt b/proto-fg/CMakeLists.txt deleted file mode 100644 index cdfe18a6..00000000 --- a/proto-fg/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -otr_module(proto-fgfs) diff --git a/proto-fg/fg-protocol.qrc b/proto-fg/fg-protocol.qrc deleted file mode 100644 index 1c685437..00000000 --- a/proto-fg/fg-protocol.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - images/flightgear.png - - diff --git a/proto-fg/ftnoir_fgcontrols.ui b/proto-fg/ftnoir_fgcontrols.ui deleted file mode 100644 index 4c0a8314..00000000 --- a/proto-fg/ftnoir_fgcontrols.ui +++ /dev/null @@ -1,208 +0,0 @@ - - - UICFGControls - - - Qt::NonModal - - - - 0 - 0 - 342 - 100 - - - - FlightGear protocol settings - - - Qt::LeftToRight - - - false - - - - 0 - - - 2 - - - - - QFrame::Raised - - - - 0 - - - - - - 0 - 0 - - - - IP address - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - 255 - - - 1 - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - 255 - - - 1 - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - 255 - - - 1 - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - 255 - - - 1 - - - - - - - - - - QFrame::Raised - - - - 4 - - - - - - 10 - 0 - - - - Port - - - - - - - - 3 - 0 - - - - 1000 - - - 10000 - - - - - - - - - - - 0 - 0 - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok - - - - - - - - - startEngineClicked() - stopEngineClicked() - cameraSettingsClicked() - - diff --git a/proto-fg/ftnoir_protocol_fg.cpp b/proto-fg/ftnoir_protocol_fg.cpp deleted file mode 100644 index 3e0f955c..00000000 --- a/proto-fg/ftnoir_protocol_fg.cpp +++ /dev/null @@ -1,33 +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_fg.h" -#include "api/plugin-api.hpp" - -// For Todd and Arda Kutlu - -void flightgear::pose(const double* headpose) { - FlightData.x = -headpose[TX] * 1e-2; - FlightData.y = headpose[TY] * 1e-2; - FlightData.z = headpose[TZ] * 1e-2; - FlightData.p = headpose[Pitch]; - FlightData.h = -headpose[Yaw]; - FlightData.r = -headpose[Roll]; - FlightData.status = 1; - QHostAddress destIP(quint32(s.ip1 << 24 | s.ip2 << 16 | s.ip3 << 8 | s.ip4)); - (void) outSocket.writeDatagram(reinterpret_cast(&FlightData), sizeof(FlightData), destIP, static_cast(s.port)); -} - -bool flightgear::correct() -{ - return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); -} - -OPENTRACK_DECLARE_PROTOCOL(flightgear, FGControls, flightgearDll) diff --git a/proto-fg/ftnoir_protocol_fg.h b/proto-fg/ftnoir_protocol_fg.h deleted file mode 100644 index 48e5f1c1..00000000 --- a/proto-fg/ftnoir_protocol_fg.h +++ /dev/null @@ -1,76 +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 -#include "ui_ftnoir_fgcontrols.h" -#include -#include -#include -#include "api/plugin-api.hpp" -#include "options/options.hpp" -using namespace options; - -// x,y,z position in meters, heading, pitch and roll in degrees -#pragma pack(push, 1) -struct flightgear_datagram { - double x, y, z, h, p, r; - int status; -}; -#pragma pack(pop) - -struct settings : opts { - value ip1, ip2, ip3, ip4; - value port; - settings() : - opts("flightgear-proto"), - ip1(b, "ip1", 127), - ip2(b, "ip2", 0), - ip3(b, "ip3", 0), - ip4(b, "ip4", 1), - port(b, "port", 5542) - {} -}; - -class flightgear : public IProtocol -{ -public: - bool correct(); - void pose(const double *headpose); - QString game_name() { - return QCoreApplication::translate("flightgear", "FlightGear"); - } -private: - settings s; - flightgear_datagram FlightData; - QUdpSocket outSocket; -}; - -// Widget that has controls for FTNoIR protocol client-settings. -class FGControls: public IProtocolDialog -{ - Q_OBJECT -public: - FGControls(); - void register_protocol(IProtocol *) {} - void unregister_protocol() {} -private: - Ui::UICFGControls ui; - settings s; -private slots: - void doOK(); - void doCancel(); -}; - -class flightgearDll : public Metadata -{ -public: - QString name() { return QString(QCoreApplication::translate("flightgearDll", "FlightGear")); } - QIcon icon() { return QIcon(":/images/flightgear.png"); } -}; diff --git a/proto-fg/ftnoir_protocol_fg_dialog.cpp b/proto-fg/ftnoir_protocol_fg_dialog.cpp deleted file mode 100644 index 43a702f6..00000000 --- a/proto-fg/ftnoir_protocol_fg_dialog.cpp +++ /dev/null @@ -1,58 +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_fg.h" -#include "api/plugin-api.hpp" -#include "opentrack-library-path.h" - -#include -#include -#include -#include - -//******************************************************************************************************* -// FaceTrackNoIR Client Settings-dialog. -//******************************************************************************************************* - -// -// Constructor for server-settings-dialog -// -FGControls::FGControls() -{ - ui.setupUi( this ); - - tie_setting(s.ip1, ui.spinIPFirstNibble); - tie_setting(s.ip2, ui.spinIPSecondNibble); - tie_setting(s.ip3, ui.spinIPThirdNibble); - tie_setting(s.ip4, ui.spinIPFourthNibble); - tie_setting(s.port, ui.spinPortNumber); - - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - connect(ui.buttonBox, &QDialogButtonBox::helpRequested, - ui.buttonBox, []() - { - static const QString contrib_dir = "file:///" + QDir::toNativeSeparators(QStringLiteral("%1/%2/%3"). - arg(OPENTRACK_BASE_PATH, OPENTRACK_CONTRIB_PATH, "FlightGear")); - QDesktopServices::openUrl(contrib_dir); - }); -} - -void FGControls::doOK() -{ - s.b->save(); - close(); -} - -void FGControls::doCancel() -{ - close(); -} - diff --git a/proto-fg/images/flightgear.png b/proto-fg/images/flightgear.png deleted file mode 100644 index 2a546642..00000000 Binary files a/proto-fg/images/flightgear.png and /dev/null differ diff --git a/proto-fg/lang/nl_NL.ts b/proto-fg/lang/nl_NL.ts deleted file mode 100644 index 35ab5431..00000000 --- a/proto-fg/lang/nl_NL.ts +++ /dev/null @@ -1,38 +0,0 @@ - - - - - UICFGControls - - - FlightGear protocol settings - - - - - IP-address remote PC - - - - - Port-number - - - - - flightgear - - - FlightGear - - - - - flightgearDll - - - FlightGear - - - - diff --git a/proto-fg/lang/ru_RU.ts b/proto-fg/lang/ru_RU.ts deleted file mode 100644 index 916f5e2d..00000000 --- a/proto-fg/lang/ru_RU.ts +++ /dev/null @@ -1,38 +0,0 @@ - - - - - UICFGControls - - - FlightGear protocol settings - - - - - IP-address remote PC - - - - - Port-number - - - - - flightgear - - - FlightGear - - - - - flightgearDll - - - FlightGear - - - - diff --git a/proto-fg/lang/stub.ts b/proto-fg/lang/stub.ts deleted file mode 100644 index e94d44f2..00000000 --- a/proto-fg/lang/stub.ts +++ /dev/null @@ -1,38 +0,0 @@ - - - - - UICFGControls - - - FlightGear protocol settings - - - - - IP-address remote PC - - - - - Port-number - - - - - flightgear - - - FlightGear - - - - - flightgearDll - - - FlightGear - - - - diff --git a/proto-flightgear/CMakeLists.txt b/proto-flightgear/CMakeLists.txt new file mode 100644 index 00000000..cdfe18a6 --- /dev/null +++ b/proto-flightgear/CMakeLists.txt @@ -0,0 +1 @@ +otr_module(proto-fgfs) diff --git a/proto-flightgear/fg-protocol.qrc b/proto-flightgear/fg-protocol.qrc new file mode 100644 index 00000000..1c685437 --- /dev/null +++ b/proto-flightgear/fg-protocol.qrc @@ -0,0 +1,5 @@ + + + images/flightgear.png + + diff --git a/proto-flightgear/ftnoir_fgcontrols.ui b/proto-flightgear/ftnoir_fgcontrols.ui new file mode 100644 index 00000000..4c0a8314 --- /dev/null +++ b/proto-flightgear/ftnoir_fgcontrols.ui @@ -0,0 +1,208 @@ + + + UICFGControls + + + Qt::NonModal + + + + 0 + 0 + 342 + 100 + + + + FlightGear protocol settings + + + Qt::LeftToRight + + + false + + + + 0 + + + 2 + + + + + QFrame::Raised + + + + 0 + + + + + + 0 + 0 + + + + IP address + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + 255 + + + 1 + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + 255 + + + 1 + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + 255 + + + 1 + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + 255 + + + 1 + + + + + + + + + + QFrame::Raised + + + + 4 + + + + + + 10 + 0 + + + + Port + + + + + + + + 3 + 0 + + + + 1000 + + + 10000 + + + + + + + + + + + 0 + 0 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok + + + + + + + + + startEngineClicked() + stopEngineClicked() + cameraSettingsClicked() + + diff --git a/proto-flightgear/ftnoir_protocol_fg.cpp b/proto-flightgear/ftnoir_protocol_fg.cpp new file mode 100644 index 00000000..3e0f955c --- /dev/null +++ b/proto-flightgear/ftnoir_protocol_fg.cpp @@ -0,0 +1,33 @@ +/* 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_fg.h" +#include "api/plugin-api.hpp" + +// For Todd and Arda Kutlu + +void flightgear::pose(const double* headpose) { + FlightData.x = -headpose[TX] * 1e-2; + FlightData.y = headpose[TY] * 1e-2; + FlightData.z = headpose[TZ] * 1e-2; + FlightData.p = headpose[Pitch]; + FlightData.h = -headpose[Yaw]; + FlightData.r = -headpose[Roll]; + FlightData.status = 1; + QHostAddress destIP(quint32(s.ip1 << 24 | s.ip2 << 16 | s.ip3 << 8 | s.ip4)); + (void) outSocket.writeDatagram(reinterpret_cast(&FlightData), sizeof(FlightData), destIP, static_cast(s.port)); +} + +bool flightgear::correct() +{ + return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); +} + +OPENTRACK_DECLARE_PROTOCOL(flightgear, FGControls, flightgearDll) diff --git a/proto-flightgear/ftnoir_protocol_fg.h b/proto-flightgear/ftnoir_protocol_fg.h new file mode 100644 index 00000000..48e5f1c1 --- /dev/null +++ b/proto-flightgear/ftnoir_protocol_fg.h @@ -0,0 +1,76 @@ +/* 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 +#include "ui_ftnoir_fgcontrols.h" +#include +#include +#include +#include "api/plugin-api.hpp" +#include "options/options.hpp" +using namespace options; + +// x,y,z position in meters, heading, pitch and roll in degrees +#pragma pack(push, 1) +struct flightgear_datagram { + double x, y, z, h, p, r; + int status; +}; +#pragma pack(pop) + +struct settings : opts { + value ip1, ip2, ip3, ip4; + value port; + settings() : + opts("flightgear-proto"), + ip1(b, "ip1", 127), + ip2(b, "ip2", 0), + ip3(b, "ip3", 0), + ip4(b, "ip4", 1), + port(b, "port", 5542) + {} +}; + +class flightgear : public IProtocol +{ +public: + bool correct(); + void pose(const double *headpose); + QString game_name() { + return QCoreApplication::translate("flightgear", "FlightGear"); + } +private: + settings s; + flightgear_datagram FlightData; + QUdpSocket outSocket; +}; + +// Widget that has controls for FTNoIR protocol client-settings. +class FGControls: public IProtocolDialog +{ + Q_OBJECT +public: + FGControls(); + void register_protocol(IProtocol *) {} + void unregister_protocol() {} +private: + Ui::UICFGControls ui; + settings s; +private slots: + void doOK(); + void doCancel(); +}; + +class flightgearDll : public Metadata +{ +public: + QString name() { return QString(QCoreApplication::translate("flightgearDll", "FlightGear")); } + QIcon icon() { return QIcon(":/images/flightgear.png"); } +}; diff --git a/proto-flightgear/ftnoir_protocol_fg_dialog.cpp b/proto-flightgear/ftnoir_protocol_fg_dialog.cpp new file mode 100644 index 00000000..43a702f6 --- /dev/null +++ b/proto-flightgear/ftnoir_protocol_fg_dialog.cpp @@ -0,0 +1,58 @@ +/* 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_fg.h" +#include "api/plugin-api.hpp" +#include "opentrack-library-path.h" + +#include +#include +#include +#include + +//******************************************************************************************************* +// FaceTrackNoIR Client Settings-dialog. +//******************************************************************************************************* + +// +// Constructor for server-settings-dialog +// +FGControls::FGControls() +{ + ui.setupUi( this ); + + tie_setting(s.ip1, ui.spinIPFirstNibble); + tie_setting(s.ip2, ui.spinIPSecondNibble); + tie_setting(s.ip3, ui.spinIPThirdNibble); + tie_setting(s.ip4, ui.spinIPFourthNibble); + tie_setting(s.port, ui.spinPortNumber); + + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + connect(ui.buttonBox, &QDialogButtonBox::helpRequested, + ui.buttonBox, []() + { + static const QString contrib_dir = "file:///" + QDir::toNativeSeparators(QStringLiteral("%1/%2/%3"). + arg(OPENTRACK_BASE_PATH, OPENTRACK_CONTRIB_PATH, "FlightGear")); + QDesktopServices::openUrl(contrib_dir); + }); +} + +void FGControls::doOK() +{ + s.b->save(); + close(); +} + +void FGControls::doCancel() +{ + close(); +} + diff --git a/proto-flightgear/images/flightgear.png b/proto-flightgear/images/flightgear.png new file mode 100644 index 00000000..2a546642 Binary files /dev/null and b/proto-flightgear/images/flightgear.png differ diff --git a/proto-flightgear/lang/nl_NL.ts b/proto-flightgear/lang/nl_NL.ts new file mode 100644 index 00000000..35ab5431 --- /dev/null +++ b/proto-flightgear/lang/nl_NL.ts @@ -0,0 +1,38 @@ + + + + + UICFGControls + + + FlightGear protocol settings + + + + + IP-address remote PC + + + + + Port-number + + + + + flightgear + + + FlightGear + + + + + flightgearDll + + + FlightGear + + + + diff --git a/proto-flightgear/lang/ru_RU.ts b/proto-flightgear/lang/ru_RU.ts new file mode 100644 index 00000000..916f5e2d --- /dev/null +++ b/proto-flightgear/lang/ru_RU.ts @@ -0,0 +1,38 @@ + + + + + UICFGControls + + + FlightGear protocol settings + + + + + IP-address remote PC + + + + + Port-number + + + + + flightgear + + + FlightGear + + + + + flightgearDll + + + FlightGear + + + + diff --git a/proto-flightgear/lang/stub.ts b/proto-flightgear/lang/stub.ts new file mode 100644 index 00000000..e94d44f2 --- /dev/null +++ b/proto-flightgear/lang/stub.ts @@ -0,0 +1,38 @@ + + + + + UICFGControls + + + FlightGear protocol settings + + + + + IP-address remote PC + + + + + Port-number + + + + + flightgear + + + FlightGear + + + + + flightgearDll + + + FlightGear + + + + diff --git a/proto-ftn/CMakeLists.txt b/proto-ftn/CMakeLists.txt deleted file mode 100644 index abba4f52..00000000 --- a/proto-ftn/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -otr_module(proto-udp) diff --git a/proto-ftn/ftnoir_ftncontrols.ui b/proto-ftn/ftnoir_ftncontrols.ui deleted file mode 100644 index 28f8ccdf..00000000 --- a/proto-ftn/ftnoir_ftncontrols.ui +++ /dev/null @@ -1,266 +0,0 @@ - - - UICFTNControls - - - Qt::NonModal - - - - 0 - 0 - 411 - 169 - - - - UDP protocol settings - - - - :/images/facetracknoir.png:/images/facetracknoir.png - - - Qt::LeftToRight - - - false - - - - - - - - - 60 - 16777215 - - - - 255 - - - 1 - - - - - - - - 60 - 16777215 - - - - 255 - - - 1 - - - - - - - - 60 - 16777215 - - - - 255 - - - 1 - - - - - - - - 60 - 16777215 - - - - 255 - - - 1 - - - - - - - IP-address remote PC - - - - - - - Port-number - - - - - - - 1000 - - - 10000 - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Enter IP-address and port-number for the remote PC. - - - true - - - - - - - Remember: you may have to change firewall-settings too! - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QLayout::SetDefaultConstraint - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - OK - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Cancel - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - - spinIPFirstNibble - spinIPSecondNibble - spinIPThirdNibble - spinIPFourthNibble - spinPortNumber - btnOK - btnCancel - - - - - - - startEngineClicked() - stopEngineClicked() - cameraSettingsClicked() - - diff --git a/proto-ftn/ftnoir_protocol_ftn.cpp b/proto-ftn/ftnoir_protocol_ftn.cpp deleted file mode 100644 index b659e3b5..00000000 --- a/proto-ftn/ftnoir_protocol_ftn.cpp +++ /dev/null @@ -1,34 +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_ftn.h" -#include -#include "api/plugin-api.hpp" - -udp::udp() -{ -} - -void udp::pose(const double *headpose) { - int destPort = s.port; - QHostAddress destIP(QString("%1.%2.%3.%4").arg( - QString::number(static_cast(s.ip1)), - QString::number(static_cast(s.ip2)), - QString::number(static_cast(s.ip3)), - QString::number(static_cast(s.ip4)))); - outSocket.writeDatagram((const char *) headpose, sizeof( double[6] ), destIP, destPort); -} - -bool udp::correct() -{ - return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); -} - -OPENTRACK_DECLARE_PROTOCOL(udp, FTNControls, udpDll) diff --git a/proto-ftn/ftnoir_protocol_ftn.h b/proto-ftn/ftnoir_protocol_ftn.h deleted file mode 100644 index 383b4ed7..00000000 --- a/proto-ftn/ftnoir_protocol_ftn.h +++ /dev/null @@ -1,69 +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 - -#include "ui_ftnoir_ftncontrols.h" -#include -#include -#include -#include -#include "api/plugin-api.hpp" -#include "options/options.hpp" -using namespace options; - -struct settings : opts { - value ip1, ip2, ip3, ip4, port; - settings() : - opts("udp-proto"), - ip1(b, "ip1", 192), - ip2(b, "ip2", 168), - ip3(b, "ip3", 0), - ip4(b, "ip4", 2), - port(b, "port", 4242) - {} -}; - -class udp : public IProtocol -{ -public: - udp(); - bool correct(); - void pose(const double *headpose); - QString game_name() { - return QCoreApplication::translate("udp", "UDP Tracker"); - } -private: - QUdpSocket outSocket; - settings s; -}; - -// Widget that has controls for FTNoIR protocol client-settings. -class FTNControls: public IProtocolDialog -{ - Q_OBJECT -public: - FTNControls(); - void register_protocol(IProtocol *) {} - void unregister_protocol() {} -private: - Ui::UICFTNControls ui; - settings s; -private slots: - void doOK(); - void doCancel(); -}; - -class udpDll : public Metadata -{ -public: - QString name() { return QString(QCoreApplication::translate("udpDll", "UDP receiver")); } - QIcon icon() { return QIcon(":/images/facetracknoir.png"); } -}; diff --git a/proto-ftn/ftnoir_protocol_ftn_dialog.cpp b/proto-ftn/ftnoir_protocol_ftn_dialog.cpp deleted file mode 100644 index 70416a69..00000000 --- a/proto-ftn/ftnoir_protocol_ftn_dialog.cpp +++ /dev/null @@ -1,42 +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_ftn.h" -#include "api/plugin-api.hpp" - -FTNControls::FTNControls() -{ - ui.setupUi( this ); - - tie_setting(s.ip1, ui.spinIPFirstNibble); - tie_setting(s.ip2, ui.spinIPSecondNibble); - tie_setting(s.ip3, ui.spinIPThirdNibble); - tie_setting(s.ip4, ui.spinIPFourthNibble); - tie_setting(s.port, ui.spinPortNumber); - - connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); -} - -// -// OK clicked on server-dialog -// -void FTNControls::doOK() { - s.b->save(); - close(); -} - -// -// Cancel clicked on server-dialog -// -void FTNControls::doCancel() -{ - close(); -} diff --git a/proto-ftn/lang/nl_NL.ts b/proto-ftn/lang/nl_NL.ts deleted file mode 100644 index 989194c5..00000000 --- a/proto-ftn/lang/nl_NL.ts +++ /dev/null @@ -1,58 +0,0 @@ - - - - - UICFTNControls - - - UDP protocol settings - - - - - IP-address remote PC - - - - - Port-number - - - - - Enter IP-address and port-number for the remote PC. - - - - - Remember: you may have to change firewall-settings too! - - - - - OK - - - - - Cancel - - - - - udp - - - UDP Tracker - - - - - udpDll - - - UDP receiver - - - - diff --git a/proto-ftn/lang/ru_RU.ts b/proto-ftn/lang/ru_RU.ts deleted file mode 100644 index c489ebf5..00000000 --- a/proto-ftn/lang/ru_RU.ts +++ /dev/null @@ -1,58 +0,0 @@ - - - - - UICFTNControls - - - UDP protocol settings - - - - - IP-address remote PC - - - - - Port-number - - - - - Enter IP-address and port-number for the remote PC. - - - - - Remember: you may have to change firewall-settings too! - - - - - OK - - - - - Cancel - - - - - udp - - - UDP Tracker - - - - - udpDll - - - UDP receiver - - - - diff --git a/proto-ftn/lang/stub.ts b/proto-ftn/lang/stub.ts deleted file mode 100644 index 9ef5380e..00000000 --- a/proto-ftn/lang/stub.ts +++ /dev/null @@ -1,58 +0,0 @@ - - - - - UICFTNControls - - - UDP protocol settings - - - - - IP-address remote PC - - - - - Port-number - - - - - Enter IP-address and port-number for the remote PC. - - - - - Remember: you may have to change firewall-settings too! - - - - - OK - - - - - Cancel - - - - - udp - - - UDP Tracker - - - - - udpDll - - - UDP receiver - - - - diff --git a/proto-sc/CMakeLists.txt b/proto-sc/CMakeLists.txt deleted file mode 100644 index 26047b6f..00000000 --- a/proto-sc/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -if(WIN32) - otr_module(proto-simconnect) -endif() diff --git a/proto-sc/ftnoir-protocol-sc.rc b/proto-sc/ftnoir-protocol-sc.rc deleted file mode 100644 index c89eb9a7..00000000 --- a/proto-sc/ftnoir-protocol-sc.rc +++ /dev/null @@ -1,4 +0,0 @@ -#include -142 RT_MANIFEST scserver.manifest -143 RT_MANIFEST scserver_sp2.manifest -144 RT_MANIFEST scserver_acceleration.manifest \ No newline at end of file diff --git a/proto-sc/ftnoir_protocol_sc.cpp b/proto-sc/ftnoir_protocol_sc.cpp deleted file mode 100644 index c8df0443..00000000 --- a/proto-sc/ftnoir_protocol_sc.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* Homepage http://facetracknoir.sourceforge.net/home/default.htm * - * * - * ISC License (ISC) * - * * - * Copyright (c) 2015, Wim Vriend - * Copyright (c) 2014, Stanislaw Halik - * * - * 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_sc.h" -#include "api/plugin-api.hpp" -#include "opentrack-library-path.h" - -simconnect::simconnect() : should_stop(false), hSimConnect(nullptr) -{ -} - -simconnect::~simconnect() -{ - should_stop = true; - wait(); -} - -void simconnect::run() -{ - HANDLE event = CreateEvent(NULL, FALSE, FALSE, nullptr); - - if (event == nullptr) - { - qDebug() << "simconnect: event create" << GetLastError(); - return; - } - - while (!should_stop) - { - if (SUCCEEDED(simconnect_open(&hSimConnect, "opentrack", NULL, 0, event, 0))) - { - simconnect_subscribetosystemevent(hSimConnect, 0, "Frame"); - - while (!should_stop) - { - if (WaitForSingleObject(event, 10) == WAIT_OBJECT_0) - { - if (FAILED(simconnect_calldispatch(hSimConnect, processNextSimconnectEvent, reinterpret_cast(this)))) - break; - } - } - - (void) simconnect_close(hSimConnect); - } - - if (!should_stop) - Sleep(100); - } - - CloseHandle(event); -} - -void simconnect::pose( const double *headpose ) { - // euler degrees - virtSCRotX = float(-headpose[Pitch]); - virtSCRotY = float(headpose[Yaw]); - virtSCRotZ = float(headpose[Roll]); - - // cm to meters - virtSCPosX = float(-headpose[TX]/100); - virtSCPosY = float(headpose[TY]/100); - virtSCPosZ = float(-headpose[TZ]/100); -} - -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif - -class ActivationContext { -public: - ActivationContext(const int resid) : ok(false) { - hactctx = INVALID_HANDLE_VALUE; - actctx_cookie = 0; - ACTCTXA actx = {0}; - actx.cbSize = sizeof(ACTCTXA); - actx.lpResourceName = MAKEINTRESOURCEA(resid); - actx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; -#ifdef _MSC_VER -# define PREFIX "" -#else -# define PREFIX "lib" -#endif - static const QString prefix = OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH; - QString path = prefix + PREFIX "opentrack-proto-simconnect.dll"; - QByteArray name = QFile::encodeName(path); - actx.lpSource = name.constData(); - hactctx = CreateActCtxA(&actx); - actctx_cookie = 0; - if (hactctx != INVALID_HANDLE_VALUE) { - if (!ActivateActCtx(hactctx, &actctx_cookie)) { - qDebug() << "SC: can't set win32 activation context" << GetLastError(); - ReleaseActCtx(hactctx); - hactctx = INVALID_HANDLE_VALUE; - } - else - ok = true; - } else { - qDebug() << "SC: can't create win32 activation context" << GetLastError(); - } - } - ~ActivationContext() { - if (hactctx != INVALID_HANDLE_VALUE) - { - DeactivateActCtx(0, actctx_cookie); - ReleaseActCtx(hactctx); - } - } - bool is_ok() { return ok; } -private: - ULONG_PTR actctx_cookie; - HANDLE hactctx; - bool ok; -}; - -bool simconnect::correct() -{ - if (!SCClientLib.isLoaded()) - { - ActivationContext ctx(142 + static_cast(s.sxs_manifest)); - - if (ctx.is_ok()) - { - SCClientLib.setFileName("SimConnect.dll"); - if (!SCClientLib.load()) { - qDebug() << "SC load" << SCClientLib.errorString(); - return false; - } - } - else - return false; - } - - simconnect_open = (importSimConnect_Open) SCClientLib.resolve("SimConnect_Open"); - if (simconnect_open == NULL) { - qDebug() << "simconnect::correct() says: SimConnect_Open function not found in DLL!"; - return false; - } - simconnect_set6DOF = (importSimConnect_CameraSetRelative6DOF) SCClientLib.resolve("SimConnect_CameraSetRelative6DOF"); - if (simconnect_set6DOF == NULL) { - qDebug() << "simconnect::correct() says: SimConnect_CameraSetRelative6DOF function not found in DLL!"; - return false; - } - simconnect_close = (importSimConnect_Close) SCClientLib.resolve("SimConnect_Close"); - if (simconnect_close == NULL) { - qDebug() << "simconnect::correct() says: SimConnect_Close function not found in DLL!"; - return false; - } - - simconnect_calldispatch = (importSimConnect_CallDispatch) SCClientLib.resolve("SimConnect_CallDispatch"); - if (simconnect_calldispatch == NULL) { - qDebug() << "simconnect::correct() says: SimConnect_CallDispatch function not found in DLL!"; - return false; - } - - simconnect_subscribetosystemevent = (importSimConnect_SubscribeToSystemEvent) SCClientLib.resolve("SimConnect_SubscribeToSystemEvent"); - if (simconnect_subscribetosystemevent == NULL) { - qDebug() << "simconnect::correct() says: SimConnect_SubscribeToSystemEvent function not found in DLL!"; - return false; - } - - start(); - - return true; -} - -void simconnect::handle() -{ - (void) simconnect_set6DOF(hSimConnect, virtSCPosX, virtSCPosY, virtSCPosZ, virtSCRotX, virtSCRotZ, virtSCRotY); -} - -void CALLBACK simconnect::processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD, void *self_) -{ - simconnect& self = *reinterpret_cast(self_); - - switch(pData->dwID) - { - default: - break; - case SIMCONNECT_RECV_ID_EVENT_FRAME: - self.handle(); - break; - } -} - -OPENTRACK_DECLARE_PROTOCOL(simconnect, SCControls, simconnectDll) diff --git a/proto-sc/ftnoir_protocol_sc.h b/proto-sc/ftnoir_protocol_sc.h deleted file mode 100644 index ff664351..00000000 --- a/proto-sc/ftnoir_protocol_sc.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Homepage http://facetracknoir.sourceforge.net/home/default.htm * - * * - * ISC License (ISC) * - * * - * Copyright (c) 2015, Wim Vriend * - * Copyright (c) 2014, Stanislaw Halik * - * * - * 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 "api/plugin-api.hpp" - -#include "ui_ftnoir_sccontrols.h" -#include -#include -#include -#include -#include -#include -#include -#include "options/options.hpp" -using namespace options; -#include - -struct settings : opts { - value sxs_manifest; - settings() : - opts("proto-simconnect"), - sxs_manifest(b, "sxs-manifest-version", 0) - {} -}; - -class simconnect : public IProtocol, private QThread -{ -public: - simconnect(); - ~simconnect() override; - bool correct(); - void pose(const double* headpose); - void handle(); - QString game_name() { - return "FS2004/FSX"; - } -private: - enum { SIMCONNECT_RECV_ID_EVENT_FRAME = 7 }; - - #pragma pack(push, 1) - struct SIMCONNECT_RECV - { - DWORD dwSize; - DWORD dwVersion; - DWORD dwID; - }; - #pragma pack(pop) - - typedef void (CALLBACK *DispatchProc)(SIMCONNECT_RECV*, DWORD, void*); - - typedef HRESULT (WINAPI *importSimConnect_Open)(HANDLE * phSimConnect, LPCSTR szName, HWND hWnd, DWORD UserEventWin32, HANDLE hEventHandle, DWORD ConfigIndex); - typedef HRESULT (WINAPI *importSimConnect_Close)(HANDLE hSimConnect); - typedef HRESULT (WINAPI *importSimConnect_CameraSetRelative6DOF)(HANDLE hSimConnect, float fDeltaX, float fDeltaY, float fDeltaZ, float fPitchDeg, float fBankDeg, float fHeadingDeg); - typedef HRESULT (WINAPI *importSimConnect_CallDispatch)(HANDLE hSimConnect, DispatchProc pfcnDispatch, void * pContext); - typedef HRESULT (WINAPI *importSimConnect_SubscribeToSystemEvent)(HANDLE hSimConnect, DWORD EventID, const char * SystemEventName); - - void run() override; - volatile bool should_stop; - - volatile float virtSCPosX; - volatile float virtSCPosY; - volatile float virtSCPosZ; - volatile float virtSCRotX; - volatile float virtSCRotY; - volatile float virtSCRotZ; - - importSimConnect_Open simconnect_open; - importSimConnect_Close simconnect_close; - importSimConnect_CameraSetRelative6DOF simconnect_set6DOF; - importSimConnect_CallDispatch simconnect_calldispatch; - importSimConnect_SubscribeToSystemEvent simconnect_subscribetosystemevent; - - HANDLE hSimConnect; - static void CALLBACK processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext); - settings s; - QLibrary SCClientLib; -}; - -class SCControls: public IProtocolDialog -{ - Q_OBJECT -public: - SCControls(); - void register_protocol(IProtocol *) {} - void unregister_protocol() {} -private: - Ui::UICSCControls ui; - settings s; -private slots: - void doOK(); - void doCancel(); -}; - -class simconnectDll : public Metadata -{ -public: - QString name() { return QString(QCoreApplication::translate("simconnectDll", "Microsoft FSX SimConnect")); } - QIcon icon() { return QIcon(":/images/fsx.png"); } -}; diff --git a/proto-sc/ftnoir_protocol_sc_dialog.cpp b/proto-sc/ftnoir_protocol_sc_dialog.cpp deleted file mode 100644 index a14c6b44..00000000 --- a/proto-sc/ftnoir_protocol_sc_dialog.cpp +++ /dev/null @@ -1,35 +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_sc.h" -#include -#include "api/plugin-api.hpp" - -SCControls::SCControls() -{ - ui.setupUi( this ); - - // Connect Qt signals to member-functions - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - - tie_setting(s.sxs_manifest, ui.comboBox); -} - -void SCControls::doOK() { - s.b->save(); - close(); -} - -void SCControls::doCancel() -{ - close(); -} - diff --git a/proto-sc/ftnoir_sccontrols.ui b/proto-sc/ftnoir_sccontrols.ui deleted file mode 100644 index 887d6d80..00000000 --- a/proto-sc/ftnoir_sccontrols.ui +++ /dev/null @@ -1,109 +0,0 @@ - - - UICSCControls - - - Qt::NonModal - - - - 0 - 0 - 346 - 148 - - - - Protocol settings - - - - images/FaceTrackNoIR.pngimages/FaceTrackNoIR.png - - - Qt::LeftToRight - - - false - - - - - - - 0 - 0 - - - - - - - FSX version - - - - - - - - 0 - 0 - - - - - SP1 - - - - - SP2 - - - - - Acceleration - - - - - - - - - - - - 0 - 0 - - - - You need to install SimConnect SDK for your FSX version. For the Steam version, choose SP1 in the above combo box. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - startEngineClicked() - stopEngineClicked() - cameraSettingsClicked() - - diff --git a/proto-sc/images/fsx.png b/proto-sc/images/fsx.png deleted file mode 100644 index 16b072a1..00000000 Binary files a/proto-sc/images/fsx.png and /dev/null differ diff --git a/proto-sc/images/fsx1.png b/proto-sc/images/fsx1.png deleted file mode 100644 index a1f0f188..00000000 Binary files a/proto-sc/images/fsx1.png and /dev/null differ diff --git a/proto-sc/lang/nl_NL.ts b/proto-sc/lang/nl_NL.ts deleted file mode 100644 index f01f6d88..00000000 --- a/proto-sc/lang/nl_NL.ts +++ /dev/null @@ -1,45 +0,0 @@ - - - - - UICSCControls - - - Protocol settings - - - - - FSX version - - - - - SP1 - - - - - SP2 - - - - - Acceleration - - - - - You need to install SimConnect SDK for your FSX version. For the Steam version, choose SP1 in the above combo box. - - - - - simconnectDll - - - Microsoft FSX SimConnect - - - - diff --git a/proto-sc/lang/ru_RU.ts b/proto-sc/lang/ru_RU.ts deleted file mode 100644 index 3d49c8b8..00000000 --- a/proto-sc/lang/ru_RU.ts +++ /dev/null @@ -1,45 +0,0 @@ - - - - - UICSCControls - - - Protocol settings - - - - - FSX version - - - - - SP1 - - - - - SP2 - - - - - Acceleration - - - - - You need to install SimConnect SDK for your FSX version. For the Steam version, choose SP1 in the above combo box. - - - - - simconnectDll - - - Microsoft FSX SimConnect - - - - diff --git a/proto-sc/lang/stub.ts b/proto-sc/lang/stub.ts deleted file mode 100644 index 522fc4e8..00000000 --- a/proto-sc/lang/stub.ts +++ /dev/null @@ -1,45 +0,0 @@ - - - - - UICSCControls - - - Protocol settings - - - - - FSX version - - - - - SP1 - - - - - SP2 - - - - - Acceleration - - - - - You need to install SimConnect SDK for your FSX version. For the Steam version, choose SP1 in the above combo box. - - - - - simconnectDll - - - Microsoft FSX SimConnect - - - - diff --git a/proto-sc/sc-protocol.qrc b/proto-sc/sc-protocol.qrc deleted file mode 100644 index 127d5180..00000000 --- a/proto-sc/sc-protocol.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - images/fsx.png - - diff --git a/proto-sc/scserver.manifest b/proto-sc/scserver.manifest deleted file mode 100644 index d342cfda..00000000 --- a/proto-sc/scserver.manifest +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/proto-sc/scserver_acceleration.manifest b/proto-sc/scserver_acceleration.manifest deleted file mode 100644 index 06459587..00000000 --- a/proto-sc/scserver_acceleration.manifest +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/proto-sc/scserver_sp2.manifest b/proto-sc/scserver_sp2.manifest deleted file mode 100644 index 3020d16c..00000000 --- a/proto-sc/scserver_sp2.manifest +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/proto-simconnect/CMakeLists.txt b/proto-simconnect/CMakeLists.txt new file mode 100644 index 00000000..26047b6f --- /dev/null +++ b/proto-simconnect/CMakeLists.txt @@ -0,0 +1,3 @@ +if(WIN32) + otr_module(proto-simconnect) +endif() diff --git a/proto-simconnect/ftnoir-protocol-sc.rc b/proto-simconnect/ftnoir-protocol-sc.rc new file mode 100644 index 00000000..c89eb9a7 --- /dev/null +++ b/proto-simconnect/ftnoir-protocol-sc.rc @@ -0,0 +1,4 @@ +#include +142 RT_MANIFEST scserver.manifest +143 RT_MANIFEST scserver_sp2.manifest +144 RT_MANIFEST scserver_acceleration.manifest \ No newline at end of file diff --git a/proto-simconnect/ftnoir_protocol_sc.cpp b/proto-simconnect/ftnoir_protocol_sc.cpp new file mode 100644 index 00000000..c8df0443 --- /dev/null +++ b/proto-simconnect/ftnoir_protocol_sc.cpp @@ -0,0 +1,193 @@ +/* Homepage http://facetracknoir.sourceforge.net/home/default.htm * + * * + * ISC License (ISC) * + * * + * Copyright (c) 2015, Wim Vriend + * Copyright (c) 2014, Stanislaw Halik + * * + * 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_sc.h" +#include "api/plugin-api.hpp" +#include "opentrack-library-path.h" + +simconnect::simconnect() : should_stop(false), hSimConnect(nullptr) +{ +} + +simconnect::~simconnect() +{ + should_stop = true; + wait(); +} + +void simconnect::run() +{ + HANDLE event = CreateEvent(NULL, FALSE, FALSE, nullptr); + + if (event == nullptr) + { + qDebug() << "simconnect: event create" << GetLastError(); + return; + } + + while (!should_stop) + { + if (SUCCEEDED(simconnect_open(&hSimConnect, "opentrack", NULL, 0, event, 0))) + { + simconnect_subscribetosystemevent(hSimConnect, 0, "Frame"); + + while (!should_stop) + { + if (WaitForSingleObject(event, 10) == WAIT_OBJECT_0) + { + if (FAILED(simconnect_calldispatch(hSimConnect, processNextSimconnectEvent, reinterpret_cast(this)))) + break; + } + } + + (void) simconnect_close(hSimConnect); + } + + if (!should_stop) + Sleep(100); + } + + CloseHandle(event); +} + +void simconnect::pose( const double *headpose ) { + // euler degrees + virtSCRotX = float(-headpose[Pitch]); + virtSCRotY = float(headpose[Yaw]); + virtSCRotZ = float(headpose[Roll]); + + // cm to meters + virtSCPosX = float(-headpose[TX]/100); + virtSCPosY = float(headpose[TY]/100); + virtSCPosZ = float(-headpose[TZ]/100); +} + +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +class ActivationContext { +public: + ActivationContext(const int resid) : ok(false) { + hactctx = INVALID_HANDLE_VALUE; + actctx_cookie = 0; + ACTCTXA actx = {0}; + actx.cbSize = sizeof(ACTCTXA); + actx.lpResourceName = MAKEINTRESOURCEA(resid); + actx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; +#ifdef _MSC_VER +# define PREFIX "" +#else +# define PREFIX "lib" +#endif + static const QString prefix = OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH; + QString path = prefix + PREFIX "opentrack-proto-simconnect.dll"; + QByteArray name = QFile::encodeName(path); + actx.lpSource = name.constData(); + hactctx = CreateActCtxA(&actx); + actctx_cookie = 0; + if (hactctx != INVALID_HANDLE_VALUE) { + if (!ActivateActCtx(hactctx, &actctx_cookie)) { + qDebug() << "SC: can't set win32 activation context" << GetLastError(); + ReleaseActCtx(hactctx); + hactctx = INVALID_HANDLE_VALUE; + } + else + ok = true; + } else { + qDebug() << "SC: can't create win32 activation context" << GetLastError(); + } + } + ~ActivationContext() { + if (hactctx != INVALID_HANDLE_VALUE) + { + DeactivateActCtx(0, actctx_cookie); + ReleaseActCtx(hactctx); + } + } + bool is_ok() { return ok; } +private: + ULONG_PTR actctx_cookie; + HANDLE hactctx; + bool ok; +}; + +bool simconnect::correct() +{ + if (!SCClientLib.isLoaded()) + { + ActivationContext ctx(142 + static_cast(s.sxs_manifest)); + + if (ctx.is_ok()) + { + SCClientLib.setFileName("SimConnect.dll"); + if (!SCClientLib.load()) { + qDebug() << "SC load" << SCClientLib.errorString(); + return false; + } + } + else + return false; + } + + simconnect_open = (importSimConnect_Open) SCClientLib.resolve("SimConnect_Open"); + if (simconnect_open == NULL) { + qDebug() << "simconnect::correct() says: SimConnect_Open function not found in DLL!"; + return false; + } + simconnect_set6DOF = (importSimConnect_CameraSetRelative6DOF) SCClientLib.resolve("SimConnect_CameraSetRelative6DOF"); + if (simconnect_set6DOF == NULL) { + qDebug() << "simconnect::correct() says: SimConnect_CameraSetRelative6DOF function not found in DLL!"; + return false; + } + simconnect_close = (importSimConnect_Close) SCClientLib.resolve("SimConnect_Close"); + if (simconnect_close == NULL) { + qDebug() << "simconnect::correct() says: SimConnect_Close function not found in DLL!"; + return false; + } + + simconnect_calldispatch = (importSimConnect_CallDispatch) SCClientLib.resolve("SimConnect_CallDispatch"); + if (simconnect_calldispatch == NULL) { + qDebug() << "simconnect::correct() says: SimConnect_CallDispatch function not found in DLL!"; + return false; + } + + simconnect_subscribetosystemevent = (importSimConnect_SubscribeToSystemEvent) SCClientLib.resolve("SimConnect_SubscribeToSystemEvent"); + if (simconnect_subscribetosystemevent == NULL) { + qDebug() << "simconnect::correct() says: SimConnect_SubscribeToSystemEvent function not found in DLL!"; + return false; + } + + start(); + + return true; +} + +void simconnect::handle() +{ + (void) simconnect_set6DOF(hSimConnect, virtSCPosX, virtSCPosY, virtSCPosZ, virtSCRotX, virtSCRotZ, virtSCRotY); +} + +void CALLBACK simconnect::processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD, void *self_) +{ + simconnect& self = *reinterpret_cast(self_); + + switch(pData->dwID) + { + default: + break; + case SIMCONNECT_RECV_ID_EVENT_FRAME: + self.handle(); + break; + } +} + +OPENTRACK_DECLARE_PROTOCOL(simconnect, SCControls, simconnectDll) diff --git a/proto-simconnect/ftnoir_protocol_sc.h b/proto-simconnect/ftnoir_protocol_sc.h new file mode 100644 index 00000000..ff664351 --- /dev/null +++ b/proto-simconnect/ftnoir_protocol_sc.h @@ -0,0 +1,108 @@ +/* Homepage http://facetracknoir.sourceforge.net/home/default.htm * + * * + * ISC License (ISC) * + * * + * Copyright (c) 2015, Wim Vriend * + * Copyright (c) 2014, Stanislaw Halik * + * * + * 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 "api/plugin-api.hpp" + +#include "ui_ftnoir_sccontrols.h" +#include +#include +#include +#include +#include +#include +#include +#include "options/options.hpp" +using namespace options; +#include + +struct settings : opts { + value sxs_manifest; + settings() : + opts("proto-simconnect"), + sxs_manifest(b, "sxs-manifest-version", 0) + {} +}; + +class simconnect : public IProtocol, private QThread +{ +public: + simconnect(); + ~simconnect() override; + bool correct(); + void pose(const double* headpose); + void handle(); + QString game_name() { + return "FS2004/FSX"; + } +private: + enum { SIMCONNECT_RECV_ID_EVENT_FRAME = 7 }; + + #pragma pack(push, 1) + struct SIMCONNECT_RECV + { + DWORD dwSize; + DWORD dwVersion; + DWORD dwID; + }; + #pragma pack(pop) + + typedef void (CALLBACK *DispatchProc)(SIMCONNECT_RECV*, DWORD, void*); + + typedef HRESULT (WINAPI *importSimConnect_Open)(HANDLE * phSimConnect, LPCSTR szName, HWND hWnd, DWORD UserEventWin32, HANDLE hEventHandle, DWORD ConfigIndex); + typedef HRESULT (WINAPI *importSimConnect_Close)(HANDLE hSimConnect); + typedef HRESULT (WINAPI *importSimConnect_CameraSetRelative6DOF)(HANDLE hSimConnect, float fDeltaX, float fDeltaY, float fDeltaZ, float fPitchDeg, float fBankDeg, float fHeadingDeg); + typedef HRESULT (WINAPI *importSimConnect_CallDispatch)(HANDLE hSimConnect, DispatchProc pfcnDispatch, void * pContext); + typedef HRESULT (WINAPI *importSimConnect_SubscribeToSystemEvent)(HANDLE hSimConnect, DWORD EventID, const char * SystemEventName); + + void run() override; + volatile bool should_stop; + + volatile float virtSCPosX; + volatile float virtSCPosY; + volatile float virtSCPosZ; + volatile float virtSCRotX; + volatile float virtSCRotY; + volatile float virtSCRotZ; + + importSimConnect_Open simconnect_open; + importSimConnect_Close simconnect_close; + importSimConnect_CameraSetRelative6DOF simconnect_set6DOF; + importSimConnect_CallDispatch simconnect_calldispatch; + importSimConnect_SubscribeToSystemEvent simconnect_subscribetosystemevent; + + HANDLE hSimConnect; + static void CALLBACK processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext); + settings s; + QLibrary SCClientLib; +}; + +class SCControls: public IProtocolDialog +{ + Q_OBJECT +public: + SCControls(); + void register_protocol(IProtocol *) {} + void unregister_protocol() {} +private: + Ui::UICSCControls ui; + settings s; +private slots: + void doOK(); + void doCancel(); +}; + +class simconnectDll : public Metadata +{ +public: + QString name() { return QString(QCoreApplication::translate("simconnectDll", "Microsoft FSX SimConnect")); } + QIcon icon() { return QIcon(":/images/fsx.png"); } +}; diff --git a/proto-simconnect/ftnoir_protocol_sc_dialog.cpp b/proto-simconnect/ftnoir_protocol_sc_dialog.cpp new file mode 100644 index 00000000..a14c6b44 --- /dev/null +++ b/proto-simconnect/ftnoir_protocol_sc_dialog.cpp @@ -0,0 +1,35 @@ +/* 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_sc.h" +#include +#include "api/plugin-api.hpp" + +SCControls::SCControls() +{ + ui.setupUi( this ); + + // Connect Qt signals to member-functions + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + + tie_setting(s.sxs_manifest, ui.comboBox); +} + +void SCControls::doOK() { + s.b->save(); + close(); +} + +void SCControls::doCancel() +{ + close(); +} + diff --git a/proto-simconnect/ftnoir_sccontrols.ui b/proto-simconnect/ftnoir_sccontrols.ui new file mode 100644 index 00000000..887d6d80 --- /dev/null +++ b/proto-simconnect/ftnoir_sccontrols.ui @@ -0,0 +1,109 @@ + + + UICSCControls + + + Qt::NonModal + + + + 0 + 0 + 346 + 148 + + + + Protocol settings + + + + images/FaceTrackNoIR.pngimages/FaceTrackNoIR.png + + + Qt::LeftToRight + + + false + + + + + + + 0 + 0 + + + + + + + FSX version + + + + + + + + 0 + 0 + + + + + SP1 + + + + + SP2 + + + + + Acceleration + + + + + + + + + + + + 0 + 0 + + + + You need to install SimConnect SDK for your FSX version. For the Steam version, choose SP1 in the above combo box. + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + startEngineClicked() + stopEngineClicked() + cameraSettingsClicked() + + diff --git a/proto-simconnect/images/fsx.png b/proto-simconnect/images/fsx.png new file mode 100644 index 00000000..16b072a1 Binary files /dev/null and b/proto-simconnect/images/fsx.png differ diff --git a/proto-simconnect/images/fsx1.png b/proto-simconnect/images/fsx1.png new file mode 100644 index 00000000..a1f0f188 Binary files /dev/null and b/proto-simconnect/images/fsx1.png differ diff --git a/proto-simconnect/lang/nl_NL.ts b/proto-simconnect/lang/nl_NL.ts new file mode 100644 index 00000000..f01f6d88 --- /dev/null +++ b/proto-simconnect/lang/nl_NL.ts @@ -0,0 +1,45 @@ + + + + + UICSCControls + + + Protocol settings + + + + + FSX version + + + + + SP1 + + + + + SP2 + + + + + Acceleration + + + + + You need to install SimConnect SDK for your FSX version. For the Steam version, choose SP1 in the above combo box. + + + + + simconnectDll + + + Microsoft FSX SimConnect + + + + diff --git a/proto-simconnect/lang/ru_RU.ts b/proto-simconnect/lang/ru_RU.ts new file mode 100644 index 00000000..3d49c8b8 --- /dev/null +++ b/proto-simconnect/lang/ru_RU.ts @@ -0,0 +1,45 @@ + + + + + UICSCControls + + + Protocol settings + + + + + FSX version + + + + + SP1 + + + + + SP2 + + + + + Acceleration + + + + + You need to install SimConnect SDK for your FSX version. For the Steam version, choose SP1 in the above combo box. + + + + + simconnectDll + + + Microsoft FSX SimConnect + + + + diff --git a/proto-simconnect/lang/stub.ts b/proto-simconnect/lang/stub.ts new file mode 100644 index 00000000..522fc4e8 --- /dev/null +++ b/proto-simconnect/lang/stub.ts @@ -0,0 +1,45 @@ + + + + + UICSCControls + + + Protocol settings + + + + + FSX version + + + + + SP1 + + + + + SP2 + + + + + Acceleration + + + + + You need to install SimConnect SDK for your FSX version. For the Steam version, choose SP1 in the above combo box. + + + + + simconnectDll + + + Microsoft FSX SimConnect + + + + diff --git a/proto-simconnect/sc-protocol.qrc b/proto-simconnect/sc-protocol.qrc new file mode 100644 index 00000000..127d5180 --- /dev/null +++ b/proto-simconnect/sc-protocol.qrc @@ -0,0 +1,5 @@ + + + images/fsx.png + + diff --git a/proto-simconnect/scserver.manifest b/proto-simconnect/scserver.manifest new file mode 100644 index 00000000..d342cfda --- /dev/null +++ b/proto-simconnect/scserver.manifest @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/proto-simconnect/scserver_acceleration.manifest b/proto-simconnect/scserver_acceleration.manifest new file mode 100644 index 00000000..06459587 --- /dev/null +++ b/proto-simconnect/scserver_acceleration.manifest @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/proto-simconnect/scserver_sp2.manifest b/proto-simconnect/scserver_sp2.manifest new file mode 100644 index 00000000..3020d16c --- /dev/null +++ b/proto-simconnect/scserver_sp2.manifest @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/proto-udp/CMakeLists.txt b/proto-udp/CMakeLists.txt new file mode 100644 index 00000000..abba4f52 --- /dev/null +++ b/proto-udp/CMakeLists.txt @@ -0,0 +1 @@ +otr_module(proto-udp) diff --git a/proto-udp/ftnoir_ftncontrols.ui b/proto-udp/ftnoir_ftncontrols.ui new file mode 100644 index 00000000..28f8ccdf --- /dev/null +++ b/proto-udp/ftnoir_ftncontrols.ui @@ -0,0 +1,266 @@ + + + UICFTNControls + + + Qt::NonModal + + + + 0 + 0 + 411 + 169 + + + + UDP protocol settings + + + + :/images/facetracknoir.png:/images/facetracknoir.png + + + Qt::LeftToRight + + + false + + + + + + + + + 60 + 16777215 + + + + 255 + + + 1 + + + + + + + + 60 + 16777215 + + + + 255 + + + 1 + + + + + + + + 60 + 16777215 + + + + 255 + + + 1 + + + + + + + + 60 + 16777215 + + + + 255 + + + 1 + + + + + + + IP-address remote PC + + + + + + + Port-number + + + + + + + 1000 + + + 10000 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Enter IP-address and port-number for the remote PC. + + + true + + + + + + + Remember: you may have to change firewall-settings too! + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + QLayout::SetDefaultConstraint + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + OK + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Cancel + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + + spinIPFirstNibble + spinIPSecondNibble + spinIPThirdNibble + spinIPFourthNibble + spinPortNumber + btnOK + btnCancel + + + + + + + startEngineClicked() + stopEngineClicked() + cameraSettingsClicked() + + diff --git a/proto-udp/ftnoir_protocol_ftn.cpp b/proto-udp/ftnoir_protocol_ftn.cpp new file mode 100644 index 00000000..b659e3b5 --- /dev/null +++ b/proto-udp/ftnoir_protocol_ftn.cpp @@ -0,0 +1,34 @@ +/* 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_ftn.h" +#include +#include "api/plugin-api.hpp" + +udp::udp() +{ +} + +void udp::pose(const double *headpose) { + int destPort = s.port; + QHostAddress destIP(QString("%1.%2.%3.%4").arg( + QString::number(static_cast(s.ip1)), + QString::number(static_cast(s.ip2)), + QString::number(static_cast(s.ip3)), + QString::number(static_cast(s.ip4)))); + outSocket.writeDatagram((const char *) headpose, sizeof( double[6] ), destIP, destPort); +} + +bool udp::correct() +{ + return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); +} + +OPENTRACK_DECLARE_PROTOCOL(udp, FTNControls, udpDll) diff --git a/proto-udp/ftnoir_protocol_ftn.h b/proto-udp/ftnoir_protocol_ftn.h new file mode 100644 index 00000000..383b4ed7 --- /dev/null +++ b/proto-udp/ftnoir_protocol_ftn.h @@ -0,0 +1,69 @@ +/* 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 + +#include "ui_ftnoir_ftncontrols.h" +#include +#include +#include +#include +#include "api/plugin-api.hpp" +#include "options/options.hpp" +using namespace options; + +struct settings : opts { + value ip1, ip2, ip3, ip4, port; + settings() : + opts("udp-proto"), + ip1(b, "ip1", 192), + ip2(b, "ip2", 168), + ip3(b, "ip3", 0), + ip4(b, "ip4", 2), + port(b, "port", 4242) + {} +}; + +class udp : public IProtocol +{ +public: + udp(); + bool correct(); + void pose(const double *headpose); + QString game_name() { + return QCoreApplication::translate("udp", "UDP Tracker"); + } +private: + QUdpSocket outSocket; + settings s; +}; + +// Widget that has controls for FTNoIR protocol client-settings. +class FTNControls: public IProtocolDialog +{ + Q_OBJECT +public: + FTNControls(); + void register_protocol(IProtocol *) {} + void unregister_protocol() {} +private: + Ui::UICFTNControls ui; + settings s; +private slots: + void doOK(); + void doCancel(); +}; + +class udpDll : public Metadata +{ +public: + QString name() { return QString(QCoreApplication::translate("udpDll", "UDP receiver")); } + QIcon icon() { return QIcon(":/images/facetracknoir.png"); } +}; diff --git a/proto-udp/ftnoir_protocol_ftn_dialog.cpp b/proto-udp/ftnoir_protocol_ftn_dialog.cpp new file mode 100644 index 00000000..70416a69 --- /dev/null +++ b/proto-udp/ftnoir_protocol_ftn_dialog.cpp @@ -0,0 +1,42 @@ +/* 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_ftn.h" +#include "api/plugin-api.hpp" + +FTNControls::FTNControls() +{ + ui.setupUi( this ); + + tie_setting(s.ip1, ui.spinIPFirstNibble); + tie_setting(s.ip2, ui.spinIPSecondNibble); + tie_setting(s.ip3, ui.spinIPThirdNibble); + tie_setting(s.ip4, ui.spinIPFourthNibble); + tie_setting(s.port, ui.spinPortNumber); + + connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); + connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); +} + +// +// OK clicked on server-dialog +// +void FTNControls::doOK() { + s.b->save(); + close(); +} + +// +// Cancel clicked on server-dialog +// +void FTNControls::doCancel() +{ + close(); +} diff --git a/proto-udp/lang/nl_NL.ts b/proto-udp/lang/nl_NL.ts new file mode 100644 index 00000000..989194c5 --- /dev/null +++ b/proto-udp/lang/nl_NL.ts @@ -0,0 +1,58 @@ + + + + + UICFTNControls + + + UDP protocol settings + + + + + IP-address remote PC + + + + + Port-number + + + + + Enter IP-address and port-number for the remote PC. + + + + + Remember: you may have to change firewall-settings too! + + + + + OK + + + + + Cancel + + + + + udp + + + UDP Tracker + + + + + udpDll + + + UDP receiver + + + + diff --git a/proto-udp/lang/ru_RU.ts b/proto-udp/lang/ru_RU.ts new file mode 100644 index 00000000..c489ebf5 --- /dev/null +++ b/proto-udp/lang/ru_RU.ts @@ -0,0 +1,58 @@ + + + + + UICFTNControls + + + UDP protocol settings + + + + + IP-address remote PC + + + + + Port-number + + + + + Enter IP-address and port-number for the remote PC. + + + + + Remember: you may have to change firewall-settings too! + + + + + OK + + + + + Cancel + + + + + udp + + + UDP Tracker + + + + + udpDll + + + UDP receiver + + + + diff --git a/proto-udp/lang/stub.ts b/proto-udp/lang/stub.ts new file mode 100644 index 00000000..9ef5380e --- /dev/null +++ b/proto-udp/lang/stub.ts @@ -0,0 +1,58 @@ + + + + + UICFTNControls + + + UDP protocol settings + + + + + IP-address remote PC + + + + + Port-number + + + + + Enter IP-address and port-number for the remote PC. + + + + + Remember: you may have to change firewall-settings too! + + + + + OK + + + + + Cancel + + + + + udp + + + UDP Tracker + + + + + udpDll + + + UDP receiver + + + + -- cgit v1.2.3