summaryrefslogtreecommitdiffhomepage
path: root/proto-ft/ftnoir_protocol_ft.h
diff options
context:
space:
mode:
Diffstat (limited to 'proto-ft/ftnoir_protocol_ft.h')
-rw-r--r--proto-ft/ftnoir_protocol_ft.h69
1 files changed, 31 insertions, 38 deletions
diff --git a/proto-ft/ftnoir_protocol_ft.h b/proto-ft/ftnoir_protocol_ft.h
index e5a63e17..a07747d9 100644
--- a/proto-ft/ftnoir_protocol_ft.h
+++ b/proto-ft/ftnoir_protocol_ft.h
@@ -9,69 +9,59 @@
#pragma once
#include "ui_ftnoir_ftcontrols.h"
#include "api/plugin-api.hpp"
-#include <QMessageBox>
-#include <QSettings>
-#include <QLibrary>
+
#include <QProcess>
-#include <QDebug>
-#include <QFile>
#include <QString>
#include <QMutex>
-#include <QMutexLocker>
+
+#include <QDebug>
+
+#include <cinttypes>
+#include "freetrackclient/fttypes.h"
+
#include "compat/shm.h"
#include "options/options.hpp"
-#include "freetrackclient/fttypes.h"
+
#include <memory>
-#include "mutex.hpp"
using namespace options;
struct settings : opts {
- value<int> intUsedInterface;
- value<bool> useTIRViews, close_protocols_on_exit;
- settings() :
- opts("proto-freetrack"),
- intUsedInterface(b, "used-interfaces", 0),
- useTIRViews(b, "use-memory-hacks", false),
- close_protocols_on_exit(b, "close-protocols-on-exit", false)
- {}
+ enum enable_status : int { enable_both, enable_freetrack, enable_npclient, };
+ value<int> used_interface{b, "used-interfaces", (int)enable_both};
+ value<bool> ephemeral_library_location{b, "ephemeral-library-location", false};
+ value<bool> use_custom_location{b, "use-custom-location", false};
+ value<QString> custom_location_pathname{b, "custom-library-location", {}};
+ settings() : opts("proto-freetrack") {}
};
-typedef void (__stdcall *importTIRViewsStart)(void);
-typedef void (__stdcall *importTIRViewsStop)(void);
-
-class freetrack : public IProtocol
+class freetrack : TR, public IProtocol
{
+ Q_OBJECT
+
public:
- freetrack();
+ freetrack() = default;
~freetrack() override;
- bool correct();
- void pose( const double *headpose );
- QString game_name() override {
- QMutexLocker foo(&game_name_mutex);
- return connected_game;
- }
+ module_status initialize() override;
+ void pose(const double* pose, const double*) override;
+ QString game_name() override;
private:
settings s;
- PortableLockedShm shm;
- FTHeap *pMemData;
+ shm_wrapper shm { FREETRACK_HEAP, FREETRACK_MUTEX, sizeof(FTHeap) };
+ FTHeap* pMemData { (FTHeap*) shm.ptr() };
- QLibrary FTIRViewsLib;
QProcess dummyTrackIR;
- importTIRViewsStart viewsStart;
- importTIRViewsStop viewsStop;
- int intGameID;
+ int intGameID = -1;
QString connected_game;
QMutex game_name_mutex;
- static check_for_first_run runonce_check;
- void start_tirviews();
void start_dummy();
- static float degrees_to_rads(double degrees);
public:
- static void set_protocols(bool ft, bool npclient);
+ enum class status { starting, stopping };
+ [[nodiscard]] module_status set_protocols();
+ void clear_protocols();
};
class FTControls: public IProtocolDialog
@@ -88,11 +78,14 @@ private slots:
void selectDLL();
void doOK();
void doCancel();
+ void set_custom_location();
};
class freetrackDll : public Metadata
{
+ Q_OBJECT
+
public:
- QString name() { return QString(QCoreApplication::translate("freetrackDll", "freetrack 2.0 Enhanced")); }
+ QString name() { return tr("freetrack 2.0 Enhanced"); }
QIcon icon() { return QIcon(":/images/freetrack.png"); }
};