From 46401fcd2e4e5437e74ca9fca04c7521432566aa Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 17 Sep 2014 03:10:31 +0200 Subject: ctor brevity --- facetracknoir/tracker_types.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'facetracknoir/tracker_types.h') diff --git a/facetracknoir/tracker_types.h b/facetracknoir/tracker_types.h index a367371e..043c0420 100644 --- a/facetracknoir/tracker_types.h +++ b/facetracknoir/tracker_types.h @@ -7,10 +7,7 @@ struct T6DOF { public: double axes[6]; - T6DOF() { - for (int i = 0; i < 6; i++) - axes[i] = 0; - } + T6DOF() : axes {0,0,0, 0,0,0 } {} }; T6DOF operator-(const T6DOF& A, const T6DOF& B); // get new pose with respect to reference pose B -- cgit v1.2.3 From 1c07a40d12aee0dc1a0167fbfcfe62a2d7142d79 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 22 Sep 2014 09:39:40 +0200 Subject: core: plugin-api.hpp now exclusively provides interface --- facetracknoir/facetracknoir.h | 4 - facetracknoir/main-settings.hpp | 1 - facetracknoir/plugin-api.hpp | 87 ++++++++++++++++++++++ facetracknoir/plugin-support.h | 21 +----- facetracknoir/tracker.h | 1 - facetracknoir/tracker_types.cpp | 1 + facetracknoir/tracker_types.h | 7 +- ftnoir_filter_base/ftnoir_filter_base.h | 19 ----- ftnoir_filter_base/ftnoir_filter_base_global.h | 4 - ftnoir_posewidget/glwidget.h | 10 +-- ftnoir_protocol_base/ftnoir_protocol_base.h | 20 ----- ftnoir_protocol_base/ftnoir_protocol_base_global.h | 4 - ftnoir_tracker_base/ftnoir_tracker_base.h | 21 ------ ftnoir_tracker_base/ftnoir_tracker_base_global.h | 18 ----- ftnoir_tracker_base/ftnoir_tracker_types.h | 4 - qfunctionconfigurator/functionconfig.h | 4 +- qfunctionconfigurator/qfunctionconfigurator.h | 4 +- 17 files changed, 98 insertions(+), 132 deletions(-) create mode 100644 facetracknoir/plugin-api.hpp delete mode 100644 ftnoir_filter_base/ftnoir_filter_base.h delete mode 100644 ftnoir_filter_base/ftnoir_filter_base_global.h delete mode 100644 ftnoir_protocol_base/ftnoir_protocol_base.h delete mode 100644 ftnoir_protocol_base/ftnoir_protocol_base_global.h delete mode 100644 ftnoir_tracker_base/ftnoir_tracker_base.h delete mode 100644 ftnoir_tracker_base/ftnoir_tracker_base_global.h delete mode 100644 ftnoir_tracker_base/ftnoir_tracker_types.h (limited to 'facetracknoir/tracker_types.h') diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 50f68825..bdec333f 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -52,10 +52,6 @@ using namespace options; #include "tracker.h" #include "facetracknoir/shortcuts.h" -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "ftnoir_filter_base/ftnoir_filter_base.h" - class Tracker; // pre-define class to avoid circular includes class FaceTrackNoIR; diff --git a/facetracknoir/main-settings.hpp b/facetracknoir/main-settings.hpp index b45c5d9c..0a1fb968 100644 --- a/facetracknoir/main-settings.hpp +++ b/facetracknoir/main-settings.hpp @@ -2,7 +2,6 @@ #include #include "facetracknoir/options.h" -#include "ftnoir_tracker_base/ftnoir_tracker_types.h" using namespace options; struct key_opts { diff --git a/facetracknoir/plugin-api.hpp b/facetracknoir/plugin-api.hpp new file mode 100644 index 00000000..1610c5d8 --- /dev/null +++ b/facetracknoir/plugin-api.hpp @@ -0,0 +1,87 @@ +#pragma once + +#include +#include + +#if defined(_WIN32) +# define CALLING_CONVENTION __stdcall +#else +# define CALLING_CONVENTION +#endif + +enum Axis { + TX = 0, TY, TZ, Yaw, Pitch, Roll +}; + +struct Metadata +{ + Metadata() {} + virtual ~Metadata() {} + + virtual void getFullName(QString *strToBeFilled) = 0; + virtual void getShortName(QString *strToBeFilled) = 0; + virtual void getDescription(QString *strToBeFilled) = 0; + virtual void getIcon(QIcon *icon) = 0; +}; + +struct IFilter +{ + virtual ~IFilter() = 0; + virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; + virtual void reset() = 0; +}; + +inline IFilter::~IFilter() {} + +struct IFilterDialog +{ + virtual ~IFilterDialog() {} + virtual void registerFilter(IFilter* tracker) = 0; + virtual void unregisterFilter() = 0; +}; + +struct IProtocol +{ + virtual ~IProtocol() = 0; + virtual bool checkServerInstallationOK() = 0; + virtual void sendHeadposeToGame( const double* headpose ) = 0; + virtual QString getGameName() = 0; +}; + +inline IProtocol::~IProtocol() {} + +struct IProtocolDialog +{ + virtual ~IProtocolDialog() {} + virtual void registerProtocol(IProtocol *protocol) = 0; + virtual void unRegisterProtocol() = 0; +}; + +struct ITracker +{ + virtual ~ITracker() = 0; + virtual void StartTracker( QFrame* frame ) = 0; + virtual void GetHeadPoseData(double *data) = 0; + virtual int preferredHz() { return 200; } +}; + +inline ITracker::~ITracker() {} + +struct ITrackerDialog +{ + virtual ~ITrackerDialog() {} + virtual void registerTracker(ITracker *tracker) = 0; + virtual void unRegisterTracker() = 0; +}; + +#ifndef OPENTRACK_EXPORT +# ifdef IN_OPENTRACK +# if !defined(_MSC_VER) +# define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) Q_DECL_EXPORT +# else +# error "MSVC support removed" +# endif +# else +# define OPENTRACK_EXPORT Q_DECL_IMPORT +# endif +#endif diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index 931f0fa1..bb7b3c02 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -1,5 +1,7 @@ #pragma once +#include "facetracknoir/plugin-api.hpp" + #if defined(_WIN32) # define CALLING_CONVENTION_SUFFIX_VOID_FUNCTION "@0" # ifdef _MSC_VER @@ -19,15 +21,6 @@ #include #include #include -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "ftnoir_filter_base/ftnoir_filter_base.h" -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" - -#if defined(_WIN32) -# define CALLING_CONVENTION __stdcall -#else -# define CALLING_CONVENTION -#endif class IDynamicLibraryProvider; @@ -66,16 +59,6 @@ private: #endif }; -struct Metadata -{ - Metadata() {} - virtual ~Metadata() {} - - virtual void getFullName(QString *strToBeFilled) = 0; - virtual void getShortName(QString *strToBeFilled) = 0; - virtual void getDescription(QString *strToBeFilled) = 0; - virtual void getIcon(QIcon *icon) = 0; -}; // merely to break a circular header dependency -sh class IDynamicLibraryProvider { diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index d06ac9d2..54350164 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -11,7 +11,6 @@ #include #include #include "plugin-support.h" -#include #include #include diff --git a/facetracknoir/tracker_types.cpp b/facetracknoir/tracker_types.cpp index ba3ac552..2d7ec45a 100644 --- a/facetracknoir/tracker_types.cpp +++ b/facetracknoir/tracker_types.cpp @@ -1,5 +1,6 @@ #include "tracker_types.h" #include "rotation.h" +#include "facetracknoir/plugin-api.hpp" #define PI 3.14159265358979323846264 #define D2R PI/180.0 diff --git a/facetracknoir/tracker_types.h b/facetracknoir/tracker_types.h index 043c0420..80b74759 100644 --- a/facetracknoir/tracker_types.h +++ b/facetracknoir/tracker_types.h @@ -1,7 +1,4 @@ -#ifndef __TRACKER_TYPES_H__ -#define __TRACKER_TYPES_H__ - -#include "ftnoir_tracker_base/ftnoir_tracker_types.h" +#pragma once struct T6DOF { public: @@ -12,5 +9,3 @@ public: T6DOF operator-(const T6DOF& A, const T6DOF& B); // get new pose with respect to reference pose B T6DOF operator+(const T6DOF& A, const T6DOF& B); // get new pose with respect to reference pose B^-1 - -#endif //__TRACKER_TYPES_H__ diff --git a/ftnoir_filter_base/ftnoir_filter_base.h b/ftnoir_filter_base/ftnoir_filter_base.h deleted file mode 100644 index 366ff149..00000000 --- a/ftnoir_filter_base/ftnoir_filter_base.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "ftnoir_filter_base_global.h" -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" - -struct IFilter -{ - virtual ~IFilter() = 0; - virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; - virtual void reset() = 0; -}; - -inline IFilter::~IFilter() { } - -struct IFilterDialog -{ - virtual ~IFilterDialog() {} - virtual void registerFilter(IFilter* tracker) = 0; - virtual void unregisterFilter() = 0; -}; diff --git a/ftnoir_filter_base/ftnoir_filter_base_global.h b/ftnoir_filter_base/ftnoir_filter_base_global.h deleted file mode 100644 index 09172756..00000000 --- a/ftnoir_filter_base/ftnoir_filter_base_global.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" - -#define FTNOIR_FILTER_BASE_EXPORT FTNOIR_TRACKER_BASE_EXPORT diff --git a/ftnoir_posewidget/glwidget.h b/ftnoir_posewidget/glwidget.h index c4b2e09d..eef238ec 100644 --- a/ftnoir_posewidget/glwidget.h +++ b/ftnoir_posewidget/glwidget.h @@ -5,12 +5,11 @@ * copyright notice and this permission notice appear in all copies. */ -#ifndef GLWIDGET_H -#define GLWIDGET_H +#pragma once #include #include -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#include "facetracknoir/plugin-api.hpp" struct Point { Point(int x, int y) : @@ -48,7 +47,7 @@ struct Vec2f { } }; -class FTNOIR_TRACKER_BASE_EXPORT GLWidget : public QWidget +class OPENTRACK_EXPORT GLWidget : public QWidget { Q_OBJECT @@ -56,7 +55,6 @@ public: GLWidget(QWidget *parent); ~GLWidget(); void rotateBy(double xAngle, double yAngle, double zAngle); - protected: void paintEvent ( QPaintEvent * event ); @@ -93,5 +91,3 @@ private: QImage back; QImage texture; }; - -#endif diff --git a/ftnoir_protocol_base/ftnoir_protocol_base.h b/ftnoir_protocol_base/ftnoir_protocol_base.h deleted file mode 100644 index 84f1c0e5..00000000 --- a/ftnoir_protocol_base/ftnoir_protocol_base.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "ftnoir_protocol_base_global.h" -#include "ftnoir_tracker_base/ftnoir_tracker_types.h" - -struct IProtocol -{ - virtual ~IProtocol() = 0; - virtual bool checkServerInstallationOK() = 0; - virtual void sendHeadposeToGame( const double* headpose ) = 0; - virtual QString getGameName() = 0; -}; - -inline IProtocol::~IProtocol() { } - -struct IProtocolDialog -{ - virtual ~IProtocolDialog() {} - virtual void registerProtocol(IProtocol *protocol) = 0; - virtual void unRegisterProtocol() = 0; -}; diff --git a/ftnoir_protocol_base/ftnoir_protocol_base_global.h b/ftnoir_protocol_base/ftnoir_protocol_base_global.h deleted file mode 100644 index 24f3f6c9..00000000 --- a/ftnoir_protocol_base/ftnoir_protocol_base_global.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" - -#define FTNOIR_PROTOCOL_BASE_EXPORT FTNOIR_TRACKER_BASE_EXPORT diff --git a/ftnoir_tracker_base/ftnoir_tracker_base.h b/ftnoir_tracker_base/ftnoir_tracker_base.h deleted file mode 100644 index 8415e38c..00000000 --- a/ftnoir_tracker_base/ftnoir_tracker_base.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "ftnoir_tracker_base_global.h" -#include "ftnoir_tracker_types.h" -#include - -struct ITracker -{ - virtual ~ITracker() = 0; - virtual void StartTracker( QFrame* frame ) = 0; - virtual void GetHeadPoseData(double *data) = 0; - virtual int preferredHz() { return 200; } -}; - -inline ITracker::~ITracker() { } - -struct ITrackerDialog -{ - virtual ~ITrackerDialog() {} - virtual void registerTracker(ITracker *tracker) = 0; - virtual void unRegisterTracker() = 0; -}; diff --git a/ftnoir_tracker_base/ftnoir_tracker_base_global.h b/ftnoir_tracker_base/ftnoir_tracker_base_global.h deleted file mode 100644 index 5b53ba82..00000000 --- a/ftnoir_tracker_base/ftnoir_tracker_base_global.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef FTNOIR_TRACKER_BASE_GLOBAL_H -#define FTNOIR_TRACKER_BASE_GLOBAL_H - -#include - -#ifndef FTNOIR_TRACKER_BASE_EXPORT -# ifdef IN_OPENTRACK -# if !defined(_MSC_VER) -# define FTNOIR_TRACKER_BASE_EXPORT __attribute__ ((visibility ("default"))) Q_DECL_EXPORT -# else -# error "MSVC support removed" -# endif -# else -# define FTNOIR_TRACKER_BASE_EXPORT Q_DECL_IMPORT -# endif -#endif - -#endif // FTNOIR_TRACKER_BASE_GLOBAL_H diff --git a/ftnoir_tracker_base/ftnoir_tracker_types.h b/ftnoir_tracker_base/ftnoir_tracker_types.h deleted file mode 100644 index d38baee4..00000000 --- a/ftnoir_tracker_base/ftnoir_tracker_types.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -enum Axis { - TX = 0, TY, TZ, Yaw, Pitch, Roll -}; diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index ee2087a0..66e7f3e8 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -13,7 +13,7 @@ #include #include #include -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#include "facetracknoir/plugin-api.hpp" #include #define MEMOIZE_PRECISION 100 @@ -52,7 +52,7 @@ public: } }; -class FTNOIR_TRACKER_BASE_EXPORT FunctionConfig { +class OPENTRACK_EXPORT FunctionConfig { private: void reload(); float getValueInternal(int x); diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index bb2f09ce..facc5bbe 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -11,9 +11,9 @@ #include #include #include "qfunctionconfigurator/functionconfig.h" -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#include "facetracknoir/plugin-api.hpp" -class FTNOIR_TRACKER_BASE_EXPORT QFunctionConfigurator : public QWidget +class OPENTRACK_EXPORT QFunctionConfigurator : public QWidget { Q_OBJECT Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier) -- cgit v1.2.3 From 97bd173ee4b6f30c12ca590e213b21bbc83f8617 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 4 Oct 2014 17:28:49 +0200 Subject: flush before windows breaks and data lossage --- CMakeLists.txt | 14 +- .../README-CREDIT.txt | 6 + .../ft_tester/Makefile.am | 54 +++ .../ft_tester/Makefile.in | 491 ++++++++++++++++++++ .../ft_tester/fttester.rc.in | 67 +++ .../ft_tester/main.cpp | 211 +++++++++ .../ft_tester/resource.h | 27 ++ .../important-stuff/NPClient.h | 17 + .../important-stuff/NPClient.spec | 23 + .../important-stuff/NPClient_dll.h | 58 +++ .../important-stuff/NPClient_main.c | 444 ++++++++++++++++++ .../important-stuff/game_data.c | 149 ++++++ .../important-stuff/game_data.h | 17 + .../tester/Makefile.am | 78 ++++ .../tester/Makefile.in | 512 +++++++++++++++++++++ .../tester/main.cpp | 100 ++++ .../tester/npifc.c | 302 ++++++++++++ .../tester/npifc.h | 66 +++ .../tester/npview.rc.in | 49 ++ .../tester/resource.h | 23 + .../tester/rest.c | 1 + .../tester/rest.h | 1 + facetracknoir/curve-config.cpp | 71 +-- facetracknoir/curve-config.h | 8 +- facetracknoir/facetracknoir.cpp | 213 ++++----- facetracknoir/facetracknoir.h | 59 ++- facetracknoir/mappings.hpp | 79 ++++ facetracknoir/plugin-qt-api.hpp | 8 +- facetracknoir/plugin-support.h | 2 +- facetracknoir/qcopyable-mutex.hpp | 37 ++ facetracknoir/rotation.h | 19 +- facetracknoir/tracker.cpp | 82 ++-- facetracknoir/tracker.h | 77 +--- facetracknoir/tracker_types.cpp | 43 -- facetracknoir/tracker_types.h | 65 ++- freetrackclient/freetrackclient.c | 38 +- ftnoir_filter_kalman/ftnoir_filter_kalman.h | 11 +- ftnoir_protocol_ft/fttypes.h | 10 +- qfunctionconfigurator/functionconfig.cpp | 24 +- qfunctionconfigurator/functionconfig.h | 81 +--- qfunctionconfigurator/qfunctionconfigurator.cpp | 2 +- qfunctionconfigurator/qfunctionconfigurator.h | 6 +- 42 files changed, 3173 insertions(+), 472 deletions(-) create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h create mode 120000 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c create mode 120000 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h create mode 100644 facetracknoir/mappings.hpp create mode 100644 facetracknoir/qcopyable-mutex.hpp delete mode 100644 facetracknoir/tracker_types.cpp (limited to 'facetracknoir/tracker_types.h') diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ceffd54..655d70c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.11) cmake_policy(SET CMP0020 NEW) if(MSVC) - message(FATAL_ERROR "Support for MSVC removed due to incomplete C++11 support") + message(FATAL_ERROR "Support for MSVC removed due to incomplete C++11 support") endif() include(CMakeParseArguments) @@ -131,9 +131,9 @@ endif() set(EXTRA-MOCS "${CMAKE_SOURCE_DIR}/facetracknoir/options.h") function(link_with_dinput8 n) - if(WIN32) - target_link_libraries(${n} dinput8 dxguid strmiids) - endif() + if(WIN32) + target_link_libraries(${n} dinput8 dxguid strmiids) + endif() endfunction() macro(opentrack_module n dir) @@ -376,9 +376,9 @@ if(SDK_RIFT) target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" winmm setupapi ws2_32 imagehlp wbemuuid) else() if(NOT APPLE) - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" udev Xinerama) + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" udev Xinerama) else() - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a") + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a") endif() endif() endif() @@ -426,7 +426,7 @@ if(UNIX OR APPLE) SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES COMPILE_FLAGS "-DBUILD_QXT_CORE=42 -DBUILD_QXT_WIDGETS=42 -DBUILD_QXT_GUI=42") target_link_libraries(opentrack-qxt-mini ${MY_QT_LIBS}) if(NOT APPLE) - target_link_libraries(opentrack-qxt-mini X11) + target_link_libraries(opentrack-qxt-mini X11) endif() endif() diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt b/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt new file mode 100644 index 00000000..82214139 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt @@ -0,0 +1,6 @@ +The contents of the directory written by one and only, uglyDwarf. + +Obtained at epoch time 1412397452 from the mithril-mine's shaft, where +the elite dwarves reside. + +For the latest happenings, visit diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am new file mode 100644 index 00000000..02747edb --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am @@ -0,0 +1,54 @@ +noinst_SCRIPTS = +if WINE_PLUGIN + noinst_SCRIPTS += ftc.exe.so +endif #WINE_PLUGIN + +if DARWIN + LDFLAGS += -Wl,-no_arch_warnings +else + LDFLAGS += -Wl,--no-warn-search-mismatch +endif + +CC = winegcc + +CXX = wineg++ + +SUFFIXES = .o .cpp .c .rc + +.cpp.o : + $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< + +CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +ftc.exe.so : main.o fttester.o + wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +fttester.o : fttester.rc resource.h config.h + +main.o : main.cpp + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +EXTRA_DIST = resource.h fttester.rc main.cpp + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in new file mode 100644 index 00000000..d1fff34d --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in @@ -0,0 +1,491 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WINE_PLUGIN_TRUE@am__append_1 = ftc.exe.so +@DARWIN_TRUE@am__append_2 = -Wl,-no_arch_warnings +@DARWIN_FALSE@am__append_3 = -Wl,--no-warn-search-mismatch +subdir = src/wine_bridge/ft_tester +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/fttester.rc.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = fttester.rc +CONFIG_CLEAN_VPATH_FILES = +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON = @BISON@ +CC = winegcc +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = wineg++ +CXXCPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ $(am__append_2) $(am__append_3) +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIB32DIR = @LIB32DIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENCV_CFLAGS = @OPENCV_CFLAGS@ +OPENCV_LIBS = @OPENCV_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +QMAKE_PATH = @QMAKE_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINE64_LIBS = @WINE64_LIBS@ +WINE_LIBS = @WINE_LIBS@ +XPL_CPPFLAGS = @XPL_CPPFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_makensis = @with_makensis@ +with_wine64 = @with_wine64@ +noinst_SCRIPTS = $(am__append_1) +SUFFIXES = .o .cpp .c .rc +CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +EXTRA_DIST = resource.h fttester.rc main.cpp +all: all-am + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .rc +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +fttester.rc: $(top_builddir)/config.status $(srcdir)/fttester.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distclean-local distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + + +.cpp.o : + $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +ftc.exe.so : main.o fttester.o + wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +fttester.o : fttester.rc resource.h config.h + +main.o : main.cpp + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in new file mode 100644 index 00000000..332f3c73 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in @@ -0,0 +1,67 @@ +// Generated by ResEdit 1.5.9 +// Copyright (C) 2006-2011 +// http://www.resedit.net + +#include +#include +#include +#include "resource.h" + +#ifdef HAVE_CONFIG_H + #include "../../../config.h" +#endif + + + + +// +// Dialog resources +// +//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOGEX 0, 0, 333, 183 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "FreeTrack client test utility v@PACKAGE_VERSION@" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "Quit", IDQUIT, 262, 153, 50, 14 + PUSHBUTTON "Start", IDC_START, 199, 153, 50, 14 + EDITTEXT IDC_YAW, 38, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Yaw", IDC_STATIC, 12, 17, 21, 14, SS_RIGHT + EDITTEXT IDC_PITCH, 38, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Pitch", IDC_STATIC, 16, 40, 17, 14, SS_RIGHT + EDITTEXT IDC_ROLL, 38, 61, 48, 14, ES_AUTOHSCROLL + RTEXT "Roll", IDC_STATIC, 20, 63, 13, 14, SS_RIGHT + EDITTEXT IDC_X, 38, 84, 48, 14, ES_AUTOHSCROLL + RTEXT "X", IDC_STATIC, 27, 86, 6, 14, SS_RIGHT + EDITTEXT IDC_Y, 38, 107, 48, 14, ES_AUTOHSCROLL + RTEXT "Y", IDC_STATIC, 27, 109, 6, 14, SS_RIGHT + EDITTEXT IDC_Z, 38, 130, 48, 14, ES_AUTOHSCROLL + RTEXT "Z", IDC_STATIC, 27, 132, 6, 14, SS_RIGHT + EDITTEXT IDC_RYAW, 137, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Yaw", IDC_STATIC, 101, 17, 32, 8, SS_RIGHT + EDITTEXT IDC_RPITCH, 137, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Pitch", IDC_STATIC, 99, 40, 34, 8, SS_RIGHT + EDITTEXT IDC_RROLL, 137, 61, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Roll", IDC_STATIC, 103, 63, 30, 8, SS_RIGHT + EDITTEXT IDC_RX, 137, 84, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw X", IDC_STATIC, 111, 86, 22, 8, SS_RIGHT + EDITTEXT IDC_RY, 137, 107, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Y", IDC_STATIC, 111, 109, 22, 8, SS_RIGHT + EDITTEXT IDC_RZ, 137, 130, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Z", IDC_STATIC, 111, 132, 22, 8, SS_RIGHT + EDITTEXT IDC_NUM, 264, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Frame Number", IDC_STATIC, 212, 17, 47, 8, SS_RIGHT + EDITTEXT IDC_RES, 264, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Camera Resolution", IDC_STATIC, 199, 40, 60, 8, SS_RIGHT + EDITTEXT IDC_PT0, 227, 61, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 1", IDC_STATIC, 199, 63, 23, 8, SS_RIGHT + EDITTEXT IDC_PT1, 227, 84, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 2", IDC_STATIC, 199, 86, 23, 8, SS_RIGHT + EDITTEXT IDC_PT2, 227, 107, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 3", IDC_STATIC, 199, 109, 23, 8, SS_RIGHT + EDITTEXT IDC_PT3, 227, 130, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 4", IDC_STATIC, 199, 132, 23, 8, SS_RIGHT + EDITTEXT IDC_TITLE, 38, 153, 147, 14, ES_AUTOHSCROLL + RTEXT "Title", IDC_STATIC, 19, 155, 14, 8, SS_RIGHT +} + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp new file mode 100644 index 00000000..a737f88f --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp @@ -0,0 +1,211 @@ +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include +#include +#include + +#include "resource.h" + +HINSTANCE hInst; +UINT_PTR timer = 0; + +HMODULE ftclient; + +typedef struct +{ + unsigned int dataID; + int res_x; int res_y; + float yaw; // positive yaw to the left + float pitch;// positive pitch up + float roll;// positive roll to the left + float x; + float y; + float z; + // raw pose with no smoothing, sensitivity, response curve etc. + float ryaw; + float rpitch; + float rroll; + float rx; + float ry; + float rz; + // raw points, sorted by Y, origin top left corner + float x0, y0; + float x1, y1; + float x2, y2; + float x3, y3; +}FreeTrackData; + + +typedef bool (WINAPI *importGetData)(FreeTrackData * data); +typedef char *(WINAPI *importGetDllVersion)(void); +typedef void (WINAPI *importReportName)(char *name); +typedef char *(WINAPI *importProvider)(void); + +importGetData getData; +importGetDllVersion getDllVersion; +importReportName reportName; +importProvider provider; + + +char *client_path() +{ + HKEY hkey = 0; + RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Freetrack\\FreetrackClient", 0, + KEY_QUERY_VALUE, &hkey); + if(!hkey){ + printf("Can't open registry key\n"); + return NULL; + } + + BYTE path[1024]; + DWORD buf_len = 1024; + LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); + char *full_path = (char *)malloc(2048); + if(result == ERROR_SUCCESS && buf_len > 0){ + sprintf(full_path, "%s\\FreeTrackClient.dll", path); + } + RegCloseKey(hkey); + return full_path; +} + + +bool start(HWND hwnd) +{ + char *libname = client_path(); + if(libname == NULL){ + printf("Freetrack client not found!\n"); + return false; + } + ftclient = LoadLibrary(libname); + if(ftclient == NULL){ + printf("Couldn't load Freetrack client library '%s'!\n", libname); + return false; + } + printf("Freetrack client library %s loaded.\n", client_path()); + + + getData = (importGetData)GetProcAddress(ftclient, "FTGetData"); + getDllVersion = (importGetDllVersion)GetProcAddress(ftclient, "FTGetDllVersion"); + reportName = (importReportName)GetProcAddress(ftclient, "FTReportName"); + provider = (importProvider)GetProcAddress(ftclient, "FTProvider"); + + if((getData == NULL) || (getDllVersion == NULL) || (reportName == NULL) || (provider == NULL)){ + printf("Couldn't load Freetrack client functions!\n"); + FreeLibrary(ftclient); + return false; + } + + printf("Dll version: %s\n", getDllVersion()); + printf("Provider: %s\n", provider()); + char title[1024]; + GetDlgItemText(hwnd, IDC_TITLE, title, 1020); + reportName(title); + return true; +} + +void reportError(std::string msg) +{ + MessageBoxA(0, "FreeTrack client test", msg.c_str(), 0); +} +VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + (void) uMsg; + (void) idEvent; + (void) dwTime; + FreeTrackData d; + getData(&d); + SetDlgItemInt(hwnd, IDC_PITCH, d.pitch, true); + SetDlgItemInt(hwnd, IDC_ROLL, d.roll, true); + SetDlgItemInt(hwnd, IDC_YAW, d.yaw, true); + + SetDlgItemInt(hwnd, IDC_X, d.x, true); + SetDlgItemInt(hwnd, IDC_Y, d.y, true); + SetDlgItemInt(hwnd, IDC_Z, d.z, true); + + SetDlgItemInt(hwnd, IDC_RPITCH, d.rpitch, true); + SetDlgItemInt(hwnd, IDC_RROLL, d.rroll, true); + SetDlgItemInt(hwnd, IDC_RYAW, d.ryaw, true); + + SetDlgItemInt(hwnd, IDC_RX, d.rx, true); + SetDlgItemInt(hwnd, IDC_RY, d.ry, true); + SetDlgItemInt(hwnd, IDC_RZ, d.rz, true); + + std::ostringstream s; + s.str(std::string()); + s<<"("< +#include "rest.h" +//#include "config.h" +#define __WINESRC__ + +#include +#include +#include +#include +#include +#include +#include "windef.h" +#include "winbase.h" +#include "NPClient_dll.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(NPClient); + +bool crypted = false; +static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static int dbg_flag; + +static void dbg_report(const char *msg,...) +{ + static FILE *f = NULL; + if(dbg_flag){ + if(f == NULL){ + f = fopen("NPClient.log", "w"); + } + va_list ap; + va_start(ap,msg); + vfprintf(f, msg, ap); + fflush(f); + va_end(ap); + } +} + + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return TRUE; + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + dbg_flag = getDebugFlag('w'); + dbg_report("Attach request\n"); + break; + case DLL_PROCESS_DETACH: + linuxtrack_shutdown(); + break; + } + + return TRUE; +} +/****************************************************************** + * NPPriv_ClientNotify (NPCLIENT.1) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_ClientNotify() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_GetLastError (NPCLIENT.2) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_GetLastError() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetData (NPCLIENT.3) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetData() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetLastError (NPCLIENT.4) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetLastError() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetParameter (NPCLIENT.5) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetParameter() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetSignature (NPCLIENT.6) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetSignature() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetVersion (NPCLIENT.7) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetVersion() +{ + /* @stub in .spec */ +} +#endif + +static float limit_num(float min, float val, float max) +{ + if(val < min) return min; + if(val > max) return max; + return val; +} + +static unsigned int cksum(unsigned char buf[], unsigned int size) +{ + if((size == 0) || (buf == NULL)){ + return 0; + } + + int rounds = size >> 2; + int rem = size % 4; + + int c = size; + int a0, a2; +// printf("Orig: "); +//for(a0 = 0; a0 < (int)size; ++a0) +//{ +// printf("%02X", buf[a0]); +//} +//printf("\n"); + while(rounds != 0){ + a0 = *(short int*)buf; + a2 = *(short int*)(buf+2); + buf += 4; + c += a0; + a2 ^= (c << 5); + a2 <<= 11; + c ^= a2; + c += (c >> 11); + --rounds; + } + switch(rem){ + case 3: + a0 = *(short int*)buf; + a2 = *(signed char*)(buf+2); + c += a0; + a2 = (a2 << 2) ^ c; + c ^= (a2 << 16); + a2 = (c >> 11); + break; + case 2: + a2 = *(short int*)buf; + c += a2; + c ^= (c << 11); + a2 = (c >> 17); + break; + case 1: + a2 = *(signed char*)(buf); + c += a2; + c ^= (c << 10); + a2 = (c >> 1); + break; + default: + break; + } + if(rem != 0){ + c+=a2; + } + + c ^= (c << 3); + c += (c >> 5); + c ^= (c << 4); + c += (c >> 17); + c ^= (c << 25); + c += (c >> 6); + + return (unsigned int)c; +} + +static void enhance(unsigned char buf[], unsigned int size, + unsigned char codetable[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (codetable == NULL)){ + return; + } + do{ + tmp = buf[--size]; + buf[size] = tmp ^ codetable[table_ptr] ^ var; + var += size + tmp; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + + +/****************************************************************** + * NP_GetData (NPCLIENT.8) + * + * + */ +int __stdcall NPCLIENT_NP_GetData(tir_data_t * data) +{ + float r, p, y, tx, ty, tz; + unsigned int frame; + int res = linuxtrack_get_pose(&y, &p, &r, &tx, &ty, &tz, &frame); + memset((char *)data, 0, sizeof(tir_data_t)); + data->status = (linuxtrack_get_tracking_state() == RUNNING) ? 0 : 1; + data->frame = frame & 0xFFFF; + data->cksum = 0; + data->roll = r / 180.0 * 16383; + data->pitch = -p / 180.0 * 16383; + data->yaw = y / 180.0 * 16383; + data->tx = -limit_num(-16383.0, 15 * tx, 16383); + data->ty = limit_num(-16383.0, 15 * ty, 16383); + data->tz = limit_num(-16383.0, 15 * tz, 16383); + data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t)); + //printf("Cksum: %04X\n", data->cksum); + if(crypted){ + enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table)); + } + return (res >= 0) ? 0: 1; +} +/****************************************************************** + * NP_GetParameter (NPCLIENT.9) + * + * + */ +int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1) +{ + dbg_report("GetParameter request: %d %d\n", arg0, arg1); + TRACE("(void): stub\n"); + return (int) 0; +} + +/****************************************************************** + * NP_GetSignature (NPCLIENT.10) + * + * + */ +int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig) +{ + dbg_report("GetSignature request\n"); + if(getSomeSeriousPoetry(sig->DllSignature, sig->AppSignature)){ + printf("Signature result: OK\n"); + return 0; + }else{ + printf("Signature result: NOT OK!\n"); + return 1; + } +} +/****************************************************************** + * NP_QueryVersion (NPCLIENT.11) + * + * + */ +int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version) +{ + dbg_report("QueryVersion request\n"); + *version=0x0500; + return 0; +} +/****************************************************************** + * NP_ReCenter (NPCLIENT.12) + * + * + */ +int __stdcall NPCLIENT_NP_ReCenter(void) +{ + dbg_report("ReCenter request\n"); + linuxtrack_recenter(); + return 0; +} + +/****************************************************************** + * NP_RegisterProgramProfileID (NPCLIENT.13) + * + * + */ +int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id) +{ + dbg_report("RegisterProgramProfileID request: %d\n", id); + game_desc_t gd; + if(game_data_get_desc(id, &gd)){ + printf("Application ID: %d - %s!!!\n", id, gd.name); + if(game_data_get_desc(id, &gd)){ + crypted = gd.encrypted; + if(gd.encrypted){ + printf("Table: %02X %02X %02X %02X %02X %02X %02X %02X\n", table[0],table[1],table[2],table[3],table[4], + table[5], table[6], table[7]); + table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + } + } + if(linuxtrack_init(gd.name) != 0){ + return 1; + } + }else{ + if(!linuxtrack_init("Default")){ + return 1; + } + } + linuxtrack_suspend(); + return 0; +} +/****************************************************************** + * NP_RegisterWindowHandle (NPCLIENT.14) + * + * + */ +int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd) +{ + dbg_report("RegisterWindowHandle request: 0x%X\n", hwnd); + TRACE("((HWND)%p): stub\n",hwnd); + return (int) 0; +} +/****************************************************************** + * NP_RequestData (NPCLIENT.15) + * + * + */ +int __stdcall NPCLIENT_NP_RequestData(unsigned short req) +{ + dbg_report("RequestData request: %d\n", req); + TRACE("((unsigned short)%d): stub\n",req); + return (int) 0; +} +/****************************************************************** + * NP_SetParameter (NPCLIENT.16) + * + * + */ +int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1) +{ + dbg_report("SetParameter request: %d %d\n", arg0, arg1); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StartCursor (NPCLIENT.17) + * + * + */ +int __stdcall NPCLIENT_NP_StartCursor(void) +{ + dbg_report("StartCursor request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StartDataTransmission (NPCLIENT.18) + * + * + */ +int __stdcall NPCLIENT_NP_StartDataTransmission(void) +{ + dbg_report("StartDataTransmission request\n"); + linuxtrack_wakeup(); + return 0; +} +/****************************************************************** + * NP_StopCursor (NPCLIENT.19) + * + * + */ +int __stdcall NPCLIENT_NP_StopCursor(void) +{ + dbg_report("StopCursor request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StopDataTransmission (NPCLIENT.20) + * + * + */ +int __stdcall NPCLIENT_NP_StopDataTransmission(void) +{ + dbg_report("StopDataTransmission request\n"); + linuxtrack_suspend(); + return 0; +} +/****************************************************************** + * NP_UnregisterWindowHandle (NPCLIENT.21) + * + * + */ +int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void) +{ + dbg_report("UnregisterWindowHandle request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c new file mode 100644 index 00000000..3197ba37 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c @@ -0,0 +1,149 @@ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include + + +//First 5 bytes is MD5 hash of "NaturalPoint" +static uint8_t secret_key[] = {0x0e, 0x9a, 0x63, 0x71, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static uint8_t S[256] = {0}; + +static char *decoded = NULL; + +static mxml_node_t *xml = NULL; +static mxml_node_t *tree = NULL; + +static void ksa(uint8_t key[], size_t len) +{ + unsigned int i, j; + for(i = 0; i < 256; ++i){ + S[i] = i; + } + j = 0; + for(i = 0; i < 256; ++i){ + j = (j + S[i] + key[i % len]) % 256; + uint8_t tmp = S[i]; + S[i] = S[j]; + S[j] = tmp; + } +} + +static uint8_t rc4() +{ + static uint8_t i = 0; + static uint8_t j = 0; + + i += 1; + j += S[i]; + uint8_t tmp = S[i]; + S[i] = S[j]; + S[j] = tmp; + return S[(S[i] + S[j]) % 256]; +} + +static bool decrypt_file(const char *fname, bool from_update) +{ + uint32_t header[5]; + size_t datlen; + ksa(secret_key, 16); + FILE *inp; + struct stat fst; + + if((inp = fopen(fname, "rb")) == NULL){ + printf("Can't open input file '%s'", fname); + return false; + } + + if(fstat(fileno(inp), &fst) != 0){ + fclose(inp); + printf("Cannot stat file '%s'\n", fname); + return false; + } + + if(from_update){ + if(fread(&header, sizeof(uint32_t), 5, inp) != 5){ + fclose(inp); + printf("Can't read the header - file '%s' is less than 20 bytes long?\n", fname); + return false; + } + datlen = header[4]; + }else{ + datlen = fst.st_size; + } + if((decoded = (char *)malloc(datlen+1)) == NULL){ + printf("malloc failed!\n"); + return false; + } + memset(decoded, 0, datlen+1); + size_t i; + size_t len = fread(decoded, 1, datlen, inp); + (void) len; + for(i = 0; i < datlen; ++i) decoded[i] ^= rc4(); + fclose(inp); + + //inp = fopen("tmp.dump", "w"); + //fwrite(decoded, 1, datlen, inp); + //fclose(inp); + + return true; +} + +static bool game_data_init(const char *fname, bool from_update) +{ + static bool initialized = false; + if(initialized){ + return true; + } + if(!decrypt_file(fname, from_update)){ + printf("Error decrypting file!\n"); + return false; + } + xml = mxmlNewXML("1.0"); + tree = mxmlLoadString(xml, decoded, MXML_TEXT_CALLBACK); + return (tree != NULL); +} + +static void game_data_close() +{ + mxmlDelete(tree); + free(decoded); +} + +bool get_game_data(const char *input_fname, const char *output_fname, bool from_update) +{ + FILE *outfile = NULL; + if((outfile = fopen(output_fname, "w")) == NULL){ + ltr_int_log_message("Can't open the output file '%s'!\n", output_fname); + return false; + } + if(!game_data_init(input_fname, from_update)){ + ltr_int_log_message("Can't process the data file '%s'!\n", input_fname); + return false; + } + + mxml_node_t *game; + const char *name; + const char *id; + for(game = mxmlFindElement(tree, tree, "Game", NULL, NULL, MXML_DESCEND); + game != NULL; + game = mxmlFindElement(game, tree, "Game", NULL, NULL, MXML_DESCEND)){ + name = mxmlElementGetAttr(game, "Name"); + id = mxmlElementGetAttr(game, "Id"); + + mxml_node_t *appid = mxmlFindElement(game, game, "ApplicationID", NULL, NULL, MXML_DESCEND); + if(appid == NULL){ + fprintf(outfile, "%s \"%s\"\n", id, name); + }else{ + fprintf(outfile, "%s \"%s\" (%s)\n", id, name, appid->child->value.text.string); + } + } + fclose(outfile); + game_data_close(); + return true; +} + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h new file mode 100644 index 00000000..b71f7a15 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h @@ -0,0 +1,17 @@ +#ifndef GAME_DATA__H +#define GAME_DATA__H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +bool get_game_data(const char *input_fname, const char *output_fname, bool from_update); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am new file mode 100644 index 00000000..e025209a --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am @@ -0,0 +1,78 @@ +noinst_SCRIPTS = +if WINE_PLUGIN + noinst_SCRIPTS += Tester.exe +if WINE64 + noinst_SCRIPTS += Tester64.exe +endif #WINE64 +endif #WINE_PLUGIN + +if DARWIN + LDFLAGS += -Wl,-no_arch_warnings +else + LDFLAGS += -Wl,--no-warn-search-mismatch +endif + +CC = winegcc + +CXX = wineg++ + +SUFFIXES = .o .cpp .c .rc 64.o + +.cpp.o : + $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS) -m32 -o $@ $< + +.cpp64.o : + $(CXX) -c $(CXXFLAGS) -o $@ $< + +.c64.o : + $(CC) -c $(CFLAGS) -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< + +CXXFLAGS += -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS += -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + + +Tester64.exe : main64.o rest64.o npifc64.o npview.o + wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ + +Tester.exe : main.o npview.o rest.o npifc.o + wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +main.o : main.cpp Makefile + +main64.o : main.cpp Makefile + +npview.o : npview.rc + +rest.o : rest.c rest.h Makefile + +rest64.o : rest.c rest.h Makefile + +npifc.o : npifc.c npifc.h Makefile + +npifc64.o : CFLAGS+="-DFOR_WIN64=1" +npifc64.o : npifc.c npifc.h Makefile + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in new file mode 100644 index 00000000..cc49d754 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in @@ -0,0 +1,512 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WINE_PLUGIN_TRUE@am__append_1 = Tester.exe +@WINE64_TRUE@@WINE_PLUGIN_TRUE@am__append_2 = Tester64.exe +@DARWIN_TRUE@am__append_3 = -Wl,-no_arch_warnings +@DARWIN_FALSE@am__append_4 = -Wl,--no-warn-search-mismatch +subdir = src/wine_bridge/tester +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/npview.rc.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = npview.rc +CONFIG_CLEAN_VPATH_FILES = +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON = @BISON@ +CC = winegcc +CFLAGS = @CFLAGS@ -g -I../.. -I../../.. -DHAVE_CONFIG_H \ + -I@srcdir@/../.. -I@top_builddir@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = wineg++ +CXXCPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ -g -DHAVE_CONFIG_H -I../../.. -I. \ + -I@srcdir@/../.. -I@top_builddir@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ $(am__append_3) $(am__append_4) +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIB32DIR = @LIB32DIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENCV_CFLAGS = @OPENCV_CFLAGS@ +OPENCV_LIBS = @OPENCV_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +QMAKE_PATH = @QMAKE_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINE64_LIBS = @WINE64_LIBS@ +WINE_LIBS = @WINE_LIBS@ +XPL_CPPFLAGS = @XPL_CPPFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_makensis = @with_makensis@ +with_wine64 = @with_wine64@ +noinst_SCRIPTS = $(am__append_1) $(am__append_2) +SUFFIXES = .o .cpp .c .rc 64.o +RCFLAGS = -I @srcdir@ +EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .rc 64.o +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +npview.rc: $(top_builddir)/config.status $(srcdir)/npview.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distclean-local distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + + +.cpp.o : + $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS) -m32 -o $@ $< + +.cpp64.o : + $(CXX) -c $(CXXFLAGS) -o $@ $< + +.c64.o : + $(CC) -c $(CFLAGS) -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +Tester64.exe : main64.o rest64.o npifc64.o npview.o + wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ + +Tester.exe : main.o npview.o rest.o npifc.o + wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +main.o : main.cpp Makefile + +main64.o : main.cpp Makefile + +npview.o : npview.rc + +rest.o : rest.c rest.h Makefile + +rest64.o : rest.c rest.h Makefile + +npifc.o : npifc.c npifc.h Makefile + +npifc64.o : CFLAGS+="-DFOR_WIN64=1" +npifc64.o : npifc.c npifc.h Makefile + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp new file mode 100644 index 00000000..95ca0d9b --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp @@ -0,0 +1,100 @@ +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include "resource.h" +#include "rest.h" +#include "npifc.h" + +HINSTANCE hInst; +UINT_PTR timer = 0; + +VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + (void) uMsg; + (void) idEvent; + (void) dwTime; + tir_data_t td; + npifc_getdata(&td); + SetDlgItemInt(hwnd, IDC_PITCH, td.pitch, true); + SetDlgItemInt(hwnd, IDC_ROLL, td.roll, true); + SetDlgItemInt(hwnd, IDC_YAW, td.yaw, true); + + SetDlgItemInt(hwnd, IDC_X1, td.tx, true); + SetDlgItemInt(hwnd, IDC_Y1, td.ty, true); + SetDlgItemInt(hwnd, IDC_Z1, td.tz, true); + + SetDlgItemInt(hwnd, IDC_X2, td.padding[0], true); + SetDlgItemInt(hwnd, IDC_Y2, td.padding[1], true); + SetDlgItemInt(hwnd, IDC_Z2, td.padding[2], true); + SetDlgItemInt(hwnd, IDC_X3, td.padding[3], true); + SetDlgItemInt(hwnd, IDC_Y3, td.padding[4], true); + SetDlgItemInt(hwnd, IDC_Z3, td.padding[5], true); + SetDlgItemInt(hwnd, IDC_S, td.status, true); + SetDlgItemInt(hwnd, IDC_F, td.frame, true); +} + +BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + (void) lParam; + switch(uMsg) + { + case WM_INITDIALOG: + SetDlgItemInt(hwndDlg, IDC_APPID, 2307, true); + return TRUE; + + case WM_CLOSE: + EndDialog(hwndDlg, 0); + return TRUE; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + /* + * TODO: Add more control ID's, when needed. + */ + case IDQUIT: + npifc_close(); + EndDialog(hwndDlg, 0); + return TRUE; + case IDSTART: + int ok; + int num = GetDlgItemInt(hwndDlg, IDC_APPID, (BOOL*)&ok, false); + if(!ok){ + num = 2307; + } + game_desc_t gd; + if(timer != 0){ + KillTimer(hwndDlg, timer); + timer = 0; + } + if(game_data_get_desc(num, &gd)){ + printf("Application ID: %d - %s\n", num, gd.name); + if(npifc_init(hwndDlg, num)){ + timer = SetTimer(hwndDlg, 0, 50, TimerProcedure); + } + }else{ + printf("Unknown Application ID: %d\n", num); + } + break; + + } + } + + return FALSE; +} + + +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) +{ + (void) hPrevInstance; + (void) lpCmdLine; + (void) nShowCmd; + hInst = hInstance; + + // The user interface is a modal dialog box + return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); +} + + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c new file mode 100644 index 00000000..b036464e --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c @@ -0,0 +1,302 @@ +#define _GNU_SOURCE +#include +#include +#define WIN32_LEAN_AND_MEAN +#include +#include "npifc.h" +#include "rest.h" + + +tir_signature_t ts; +HMODULE npclient; +/* +typedef int (*NP_RegisterWindowHandle_t)(HWND hwnd); +typedef int (*NP_UnregisterWindowHandle_t)(void); +typedef int (*NP_RegisterProgramProfileID_t)(unsigned short id); +typedef int (*NP_QueryVersion_t)(unsigned short *version); +typedef int (*NP_RequestData_t)(unsigned short req); +typedef int (*NP_GetSignature_t)(tir_signature_t *sig); +typedef int (*NP_GetData_t)(tir_data_t *data); +typedef int (*NP_GetParameter_t)(void); +typedef int (*NP_SetParameter_t)(void); +typedef int (*NP_StartCursor_t)(void); +typedef int (*NP_StopCursor_t)(void); +typedef int (*NP_ReCenter_t)(void); +typedef int (*NP_StartDataTransmission_t)(void); +typedef int (*NP_StopDataTransmission_t)(void); +*/ +NP_RegisterWindowHandle_t NP_RegisterWindowHandle = NULL; +NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle = NULL; +NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID = NULL; +NP_QueryVersion_t NP_QueryVersion = NULL; +NP_RequestData_t NP_RequestData = NULL; +NP_GetSignature_t NP_GetSignature = NULL; +NP_GetData_t NP_GetData = NULL; +NP_GetParameter_t NP_GetParameter = NULL; +NP_SetParameter_t NP_SetParameter = NULL; +NP_StartCursor_t NP_StartCursor = NULL; +NP_StopCursor_t NP_StopCursor = NULL; +NP_ReCenter_t NP_ReCenter = NULL; +NP_StartDataTransmission_t NP_StartDataTransmission = NULL; +NP_StopDataTransmission_t NP_StopDataTransmission = NULL; + +bool crypted = false; + + + +unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +char *client_path() +{ + HKEY hkey = 0; + RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", 0, + KEY_QUERY_VALUE, &hkey); + if(!hkey){ + printf("Can't open registry key\n"); + return NULL; + } + + BYTE path[1024]; + DWORD buf_len = 1024; + LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); + char *full_path = NULL; + int res = -1; + if(result == ERROR_SUCCESS && buf_len > 0){ +#ifdef FOR_WIN64 + res = asprintf(&full_path, "%s/NPClient64.dll", path); +#else + res = asprintf(&full_path, "%s/NPClient.dll", path); +#endif + } + RegCloseKey(hkey); + if(res > 0){ + return full_path; + }else{ + return NULL; + } +} + +bool initialized = false; + +bool npifc_init(HWND wnd, int id) +{ + //table[] = {0xb3, 0x16, 0x36, 0xeb, 0xb9, 0x05, 0x4f, 0xa4}; + game_desc_t gd; + if(game_data_get_desc(id, &gd)){ + crypted = gd.encrypted; + if(gd.encrypted){ + table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + } + } + printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + table[0], table[1], table[2], table[3], + table[4], table[5], table[6], table[7]); + + char *client = client_path(); + if(client == NULL){ + printf("Couldn't obtain client path!\n"); + return false; + } + npclient = LoadLibrary(client); + if(!npclient){ + printf("Can't load client %s\n", client); + return false; + } + + NP_RegisterWindowHandle = (NP_RegisterWindowHandle_t)GetProcAddress(npclient, "NP_RegisterWindowHandle"); + NP_UnregisterWindowHandle = (NP_UnregisterWindowHandle_t)GetProcAddress(npclient, "NP_UnregisterWindowHandle"); + NP_RegisterProgramProfileID = (NP_RegisterProgramProfileID_t)GetProcAddress(npclient, "NP_RegisterProgramProfileID"); + NP_QueryVersion = (NP_QueryVersion_t)GetProcAddress(npclient, "NP_QueryVersion"); + NP_RequestData = (NP_RequestData_t)GetProcAddress(npclient, "NP_RequestData"); + NP_GetSignature = (NP_GetSignature_t)GetProcAddress(npclient, "NP_GetSignature"); + NP_GetData = (NP_GetData_t)GetProcAddress(npclient, "NP_GetData"); + NP_GetParameter = (NP_GetParameter_t)GetProcAddress(npclient, "NP_GetParameter"); + NP_SetParameter = (NP_SetParameter_t)GetProcAddress(npclient, "NP_SetParameter"); + NP_StartCursor = (NP_StartCursor_t)GetProcAddress(npclient, "NP_StartCursor"); + NP_StopCursor = (NP_StopCursor_t)GetProcAddress(npclient, "NP_StopCursor"); + NP_ReCenter = (NP_ReCenter_t)GetProcAddress(npclient, "NP_ReCenter"); + NP_StartDataTransmission = (NP_StartDataTransmission_t)GetProcAddress(npclient, "NP_StartDataTransmission"); + NP_StopDataTransmission = (NP_StopDataTransmission_t)GetProcAddress(npclient, "NP_StopDataTransmission"); + if((NP_RegisterWindowHandle == NULL) || (NP_UnregisterWindowHandle == NULL) + || (NP_RegisterProgramProfileID == NULL) || (NP_QueryVersion == NULL) || (NP_RequestData == NULL) + || (NP_GetSignature == NULL) || (NP_GetData == NULL) || (NP_GetParameter == NULL) + || (NP_SetParameter == NULL) || (NP_StartCursor == NULL) || (NP_StopCursor == NULL) + || (NP_ReCenter == NULL) || (NP_StartDataTransmission == NULL) || (NP_StopDataTransmission == NULL)){ + printf("Couldn't bind all necessary functions!\n"); + return false; + } + tir_signature_t sig; + int res; + if((res = NP_GetSignature(&sig)) != 0){ + printf("Error retrieving signature! %d\n", res); + return false; + } + printf("Dll Sig:%s\nApp Sig2:%s\n", sig.DllSignature, sig.AppSignature); + NP_RegisterWindowHandle(wnd); + if(NP_RegisterProgramProfileID(id) != 0){ + printf("Couldn't register profile id!\n"); + return false; + } + printf("Program profile registered!\n"); + NP_RequestData(65535); + NP_StopCursor(); + NP_StartDataTransmission(); + initialized = true; + return true; +} + +void npifc_close() +{ + if(initialized){ + NP_StopDataTransmission(); + NP_StartCursor(); + NP_UnregisterWindowHandle(); + } + initialized = false; +} + +void c_encrypt(unsigned char buf[], unsigned int size, + unsigned char code_table[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (code_table == NULL)) + return; + do{ + tmp = buf[--size]; + buf[size] = tmp ^ code_table[table_ptr] ^ var; + var += size + tmp; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + + + +void decrypt(unsigned char buf[], unsigned int size, + unsigned char code_table[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (code_table == NULL)){ + return; + } + do{ + tmp = buf[--size]; + buf[size] = tmp ^ code_table[table_ptr] ^ var; + var += size + buf[size]; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + +unsigned int cksum(unsigned char buf[], unsigned int size) +{ + if((size == 0) || (buf == NULL)){ + return 0; + } + int rounds = size >> 2; + int rem = size % 4; + + int c = size; + int a0 = 0; + int a2 = 0; + + while(rounds != 0){ + a0 = *(short int*)buf; + a2 = *(short int*)(buf+2); + buf += 4; + c += a0; + a2 ^= (c << 5); + a2 <<= 11; + c ^= a2; + c += (c >> 11); + --rounds; + } + switch(rem){ + case 3: + a0 = *(short int*)buf; + a2 = *(signed char*)(buf+2); + c += a0; + a2 = (a2 << 2) ^ c; + c ^= (a2 << 16); + a2 = (c >> 11); + break; + case 2: + a2 = *(short int*)buf; + c += a2; + c ^= (c << 11); + a2 = (c >> 17); + break; + case 1: + a2 = *(signed char*)(buf); + c += a2; + c ^= (c << 10); + a2 = (c >> 1); + break; + default: + break; + } + if(rem != 0){ + c+=a2; + } + + c ^= (c << 3); + c += (c >> 5); + c ^= (c << 4); + c += (c >> 17); + c ^= (c << 25); + c += (c >> 6); + + return (unsigned int)c; +} + +int decode_frame(tir_data_t *td) +{ + //printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + // table[0], table[1], table[2], table[3], + // table[4], table[5], table[6], table[7]); + unsigned int csum; + decrypt((unsigned char*)td, sizeof(*td), table, sizeof(table)); + csum = td->cksum; + td->cksum = 0; + if(csum != cksum((unsigned char*)td, sizeof(*td))){ + printf("Problem with frame!\n"); + //int a0; + //printf("Dec: "); + //for(a0 = 0; a0 < (int)sizeof(tir_data_t); ++a0) + //{ + // printf("%02X", ((unsigned char *)td)[a0]); + //} + //printf("\n"); + //printf("Cksum: %04X vs computed: %04X\n", csum, cksum((unsigned char*)td, sizeof(*td))); + return -1; + } + //printf("Frame OK!\n"); + return 0; +} + +int npifc_getdata(tir_data_t *data) +{ + int res = NP_GetData(data); + if(crypted){ + decode_frame(data); + } + return res; +} + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h new file mode 100644 index 00000000..d580e16d --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h @@ -0,0 +1,66 @@ +#ifndef NPIFC__H +#define NPIFC__H + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + bool npifc_init(HWND wnd, int id); + void npifc_close(); + +#pragma pack(1) +typedef struct tir_data{ + short status; + short frame; + unsigned int cksum; + float roll, pitch, yaw; + float tx, ty, tz; + float padding[9]; +} tir_data_t; + +typedef struct tir_signature{ + char DllSignature[200]; + char AppSignature[200]; +} tir_signature_t; +#pragma pack(0) + +int npifc_getdata(tir_data_t *data); + +typedef int __stdcall (*NP_RegisterWindowHandle_t)(HWND hwnd); +typedef int __stdcall (*NP_UnregisterWindowHandle_t)(void); +typedef int __stdcall (*NP_RegisterProgramProfileID_t)(unsigned short id); +typedef int __stdcall (*NP_QueryVersion_t)(unsigned short *version); +typedef int __stdcall (*NP_RequestData_t)(unsigned short req); +typedef int __stdcall (*NP_GetSignature_t)(tir_signature_t *sig); +typedef int __stdcall (*NP_GetData_t)(tir_data_t *data); +typedef int __stdcall (*NP_GetParameter_t)(void); +typedef int __stdcall (*NP_SetParameter_t)(void); +typedef int __stdcall (*NP_StartCursor_t)(void); +typedef int __stdcall (*NP_StopCursor_t)(void); +typedef int __stdcall (*NP_ReCenter_t)(void); +typedef int __stdcall (*NP_StartDataTransmission_t)(void); +typedef int __stdcall (*NP_StopDataTransmission_t)(void); + +extern NP_RegisterWindowHandle_t NP_RegisterWindowHandle; +extern NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle; +extern NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID; +extern NP_QueryVersion_t NP_QueryVersion; +extern NP_RequestData_t NP_RequestData; +extern NP_GetSignature_t NP_GetSignature; +extern NP_GetData_t NP_GetData; +extern NP_GetParameter_t NP_GetParameter; +extern NP_SetParameter_t NP_SetParameter; +extern NP_StartCursor_t NP_StartCursor; +extern NP_StopCursor_t NP_StopCursor; +extern NP_ReCenter_t NP_ReCenter; +extern NP_StartDataTransmission_t NP_StartDataTransmission; +extern NP_StopDataTransmission_t NP_StopDataTransmission; + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in new file mode 100644 index 00000000..231002f1 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in @@ -0,0 +1,49 @@ +// Generated by ResEdit 1.5.9 +// Copyright (C) 2006-2011 +// http://www.resedit.net + +#include +#include +#include +#include "resource.h" + +#ifdef HAVE_CONFIG_H + #include "../../../config.h" +#endif + + + +// +// Dialog resources +// +//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOGEX 0, 0, 379, 124 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "NPTest v@PACKAGE_VERSION@" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "Quit", IDQUIT, 262, 102, 50, 14 + DEFPUSHBUTTON "Start", IDSTART, 7, 102, 50, 14 + EDITTEXT IDC_PITCH, 32, 32, 51, 14, ES_AUTOHSCROLL + LTEXT "Pitch", IDC_STATIC, 11, 34, 20, 8, SS_LEFT + LTEXT "Yaw", IDC_STATIC, 11, 59, 20, 8, SS_LEFT + EDITTEXT IDC_YAW, 32, 57, 51, 14, ES_AUTOHSCROLL + LTEXT "Roll", IDC_STATIC, 11, 84, 20, 8, SS_LEFT + EDITTEXT IDC_ROLL, 32, 82, 51, 14, ES_AUTOHSCROLL + LTEXT "X", IDC_STATIC, 101, 35, 6, 8, SS_LEFT + EDITTEXT IDC_X1, 112, 32, 51, 14, ES_AUTOHSCROLL + LTEXT "Y", IDC_STATIC, 101, 60, 6, 8, SS_LEFT + EDITTEXT IDC_Y1, 112, 57, 51, 14, ES_AUTOHSCROLL + LTEXT "Z", IDC_STATIC, 101, 85, 6, 8, SS_LEFT + EDITTEXT IDC_Z1, 112, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_X2, 172, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Y2, 172, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Z2, 172, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_X3, 232, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Y3, 232, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Z3, 232, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_S, 292, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_F, 292, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_APPID, 32, 12, 51, 12, ES_AUTOHSCROLL + LTEXT "ID", IDC_STATIC, 17, 14, 8, 8, SS_LEFT +} diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h new file mode 100644 index 00000000..328d9cb7 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h @@ -0,0 +1,23 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_DIALOG1 100 +#define IDQUIT 1002 +#define IDSTART 1003 +#define IDC_APPID 1016 +#define IDC_PITCH 1017 +#define IDC_YAW 1018 +#define IDC_ROLL 1019 +#define IDC_X1 1020 +#define IDC_X2 1021 +#define IDC_X3 1022 +#define IDC_Y1 1023 +#define IDC_Y2 1024 +#define IDC_Y3 1025 +#define IDC_Z1 1026 +#define IDC_Z2 1027 +#define IDC_Z3 1028 +#define IDC_S 1029 +#define IDC_F 1030 + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c new file mode 120000 index 00000000..663c21a9 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c @@ -0,0 +1 @@ +../client/rest.c \ No newline at end of file diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h new file mode 120000 index 00000000..6dca182a --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h @@ -0,0 +1 @@ +../client/rest.h \ No newline at end of file diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index abf03a5e..886e40fa 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -1,12 +1,13 @@ -#include "facetracknoir/facetracknoir.h" -#include "facetracknoir/curve-config.h" -CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidget *parent) : - QWidget( parent, Qt::Dialog ), mainApp(ftnoir) +#include "./facetracknoir.h" +#include "./curve-config.h" +#include "./main-settings.hpp" +CurveConfigurationDialog::CurveConfigurationDialog(Mappings& m, main_settings& s, QWidget *parent) : QWidget(parent, Qt::Dialog), + m(m) { ui.setupUi( this ); // rest of mapping settings taken care of by options::value - mainApp->load_mappings(); + m.load_mappings(); { struct { @@ -34,8 +35,8 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge for (int i = 0; qfcs[i].qfc; i++) { const bool altp = qfcs[i].altp; - THeadPoseDOF& axis = mainApp->axis(qfcs[i].axis); - FunctionConfig* conf = altp ? &axis.curveAlt : &axis.curve; + Mapping& axis = m(qfcs[i].axis); + Map* conf = altp ? &axis.curveAlt : &axis.curve; const auto& name = qfcs[i].altp ? axis.name2 : axis.name1; qfcs[i].qfc->setConfig(conf, name); @@ -49,36 +50,36 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - tie_setting(mainApp->s.a_x.altp, ui.tx_altp); - tie_setting(mainApp->s.a_y.altp, ui.ty_altp); - tie_setting(mainApp->s.a_z.altp, ui.tz_altp); - tie_setting(mainApp->s.a_yaw.altp, ui.rx_altp); - tie_setting(mainApp->s.a_pitch.altp, ui.ry_altp); - tie_setting(mainApp->s.a_roll.altp, ui.rz_altp); + tie_setting(s.a_x.altp, ui.tx_altp); + tie_setting(s.a_y.altp, ui.ty_altp); + tie_setting(s.a_z.altp, ui.tz_altp); + tie_setting(s.a_yaw.altp, ui.rx_altp); + tie_setting(s.a_pitch.altp, ui.ry_altp); + tie_setting(s.a_roll.altp, ui.rz_altp); - tie_setting(mainApp->s.tcomp_p, ui.tcomp_enable); - tie_setting(mainApp->s.tcomp_tz, ui.tcomp_rz); + tie_setting(s.tcomp_p, ui.tcomp_enable); + tie_setting(s.tcomp_tz, ui.tcomp_rz); - tie_setting(mainApp->s.a_x.zero, ui.pos_tx); - tie_setting(mainApp->s.a_y.zero, ui.pos_ty); - tie_setting(mainApp->s.a_z.zero, ui.pos_tz); - tie_setting(mainApp->s.a_yaw.zero, ui.pos_rx); - tie_setting(mainApp->s.a_pitch.zero, ui.pos_ry); - tie_setting(mainApp->s.a_roll.zero, ui.pos_rz); + tie_setting(s.a_x.zero, ui.pos_tx); + tie_setting(s.a_y.zero, ui.pos_ty); + tie_setting(s.a_z.zero, ui.pos_tz); + tie_setting(s.a_yaw.zero, ui.pos_rx); + tie_setting(s.a_pitch.zero, ui.pos_ry); + tie_setting(s.a_roll.zero, ui.pos_rz); - tie_setting(mainApp->s.a_yaw.invert, ui.invert_yaw); - tie_setting(mainApp->s.a_pitch.invert, ui.invert_pitch); - tie_setting(mainApp->s.a_roll.invert, ui.invert_roll); - tie_setting(mainApp->s.a_x.invert, ui.invert_x); - tie_setting(mainApp->s.a_y.invert, ui.invert_y); - tie_setting(mainApp->s.a_z.invert, ui.invert_z); + tie_setting(s.a_yaw.invert, ui.invert_yaw); + tie_setting(s.a_pitch.invert, ui.invert_pitch); + tie_setting(s.a_roll.invert, ui.invert_roll); + tie_setting(s.a_x.invert, ui.invert_x); + tie_setting(s.a_y.invert, ui.invert_y); + tie_setting(s.a_z.invert, ui.invert_z); - tie_setting(mainApp->s.a_yaw.src, ui.src_yaw); - tie_setting(mainApp->s.a_pitch.src, ui.src_pitch); - tie_setting(mainApp->s.a_roll.src, ui.src_roll); - tie_setting(mainApp->s.a_x.src, ui.src_x); - tie_setting(mainApp->s.a_y.src, ui.src_y); - tie_setting(mainApp->s.a_z.src, ui.src_z); + tie_setting(s.a_yaw.src, ui.src_yaw); + tie_setting(s.a_pitch.src, ui.src_pitch); + tie_setting(s.a_roll.src, ui.src_roll); + tie_setting(s.a_x.src, ui.src_x); + tie_setting(s.a_y.src, ui.src_y); + tie_setting(s.a_z.src, ui.src_z); } void CurveConfigurationDialog::doOK() { @@ -87,10 +88,10 @@ void CurveConfigurationDialog::doOK() { } void CurveConfigurationDialog::doCancel() { - mainApp->load_mappings(); + m.load_mappings(); this->close(); } void CurveConfigurationDialog::save() { - mainApp->save_mappings(); + m.save_mappings(); } diff --git a/facetracknoir/curve-config.h b/facetracknoir/curve-config.h index 49aba7bd..67a588e2 100644 --- a/facetracknoir/curve-config.h +++ b/facetracknoir/curve-config.h @@ -1,19 +1,17 @@ #pragma once #include -#include +#include "./mappings.hpp" #include "ui_ftnoir_curves.h" -class FaceTrackNoIR; - class CurveConfigurationDialog: public QWidget { Q_OBJECT public: - CurveConfigurationDialog( FaceTrackNoIR *ftnoir, QWidget *parent ); + CurveConfigurationDialog(Mappings &m, main_settings &s, QWidget *parent ); private: Ui::UICCurveConfigurationDialog ui; + Mappings& m; void save(); - FaceTrackNoIR *mainApp; private slots: void doOK(); void doCancel(); diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 868b6dbf..af76f09b 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -75,8 +75,8 @@ static void fill_combobox(const QString& filter, QList& list, Q } } -FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : - QMainWindow(parent), +FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : QMainWindow(parent), + tracker(nullptr), #if defined(_WIN32) keybindingWorker(NULL), #else @@ -87,34 +87,21 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : s(b), pose(std::vector{&s.a_x, &s.a_y, &s.a_z, &s.a_yaw, &s.a_pitch, &s.a_roll}), timUpdateHeadPose(this), - pTrackerDialog(NULL), - pProtocolDialog(NULL), - pFilterDialog(NULL), + pTrackerDialog(nullptr), + pProtocolDialog(nullptr), + pFilterDialog(nullptr), + shortcuts_widget(nullptr), + mapping_widget(new CurveConfigurationDialog(pose, s, this)), kbd_quit(QKeySequence("Ctrl+Q"), this), looping(0), video_frame_layout(new QVBoxLayout()), no_feed_pixmap(":/uielements/no-feed.png") -{ +{ ui.setupUi(this); setFixedSize(size()); ui.video_frame_label->setPixmap(no_feed_pixmap); updateButtonState(false, false); - _keyboard_shortcuts = 0; - _curve_config = 0; - - tracker = 0; - - CurveConfigurationDialog* ccd; - - if (!_curve_config) - { - ccd = new CurveConfigurationDialog( this, this ); - _curve_config = ccd; - } else { - ccd = dynamic_cast(_curve_config); - } - QDir::setCurrent(QCoreApplication::applicationDirPath()); fill_profile_cbx(); @@ -157,7 +144,7 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : FaceTrackNoIR::~FaceTrackNoIR() { - stopTracker(); + stopTracker(); save(); if (Libraries) delete Libraries; @@ -171,38 +158,26 @@ QFrame* FaceTrackNoIR::get_video_widget() { void FaceTrackNoIR::open() { QFileDialog dialog(this); dialog.setFileMode(QFileDialog::ExistingFile); - - QString fileName = dialog.getOpenFileName( - this, + + QString fileName = dialog.getOpenFileName( + this, tr("Open the settings file"), - QCoreApplication::applicationDirPath() + "/settings/", + QCoreApplication::applicationDirPath() + "/settings/", tr("Settings file (*.ini);;All Files (*)"), NULL); - if (! fileName.isEmpty() ) { + if (! fileName.isEmpty() ) { { QSettings settings("opentrack"); settings.setValue ("SettingsFile", QFileInfo(fileName).absoluteFilePath()); } fill_profile_cbx(); - loadSettings(); + loadSettings(); } } void FaceTrackNoIR::save_mappings() { - QSettings settings("opentrack"); - - QString currentFile = - settings.value("SettingsFile", - QCoreApplication::applicationDirPath() + "/settings/default.ini") - .toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - - for (int i = 0; i < 6; i++) - { - axis(i).curve.saveSettings(iniFile, axis(i).name1); - axis(i).curveAlt.saveSettings(iniFile, axis(i).name2); - } + pose.save_mappings(); } #if defined(__unix) || defined(__linux) || defined(__APPLE__) @@ -212,7 +187,7 @@ void FaceTrackNoIR::save_mappings() { void FaceTrackNoIR::save() { b->save(); save_mappings(); - + #if defined(__unix) || defined(__linux) QSettings settings("opentrack"); const QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); @@ -229,27 +204,27 @@ void FaceTrackNoIR::save() { void FaceTrackNoIR::saveAs() { looping++; - QSettings settings("opentrack"); - QString oldFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + QSettings settings("opentrack"); + QString oldFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"), - oldFile, + QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"), + oldFile, tr("Settings file (*.ini);;All Files (*)")); - if (!fileName.isEmpty()) { + if (!fileName.isEmpty()) { - QFileInfo newFileInfo ( fileName ); - if ((newFileInfo.exists()) && (oldFile != fileName)) { - QFile newFileFile ( fileName ); - newFileFile.remove(); - } + QFileInfo newFileInfo ( fileName ); + if ((newFileInfo.exists()) && (oldFile != fileName)) { + QFile newFileFile ( fileName ); + newFileFile.remove(); + } - QFileInfo oldFileInfo ( oldFile ); - if (oldFileInfo.exists()) { - QFile oldFileFile ( oldFile ); - oldFileFile.copy( fileName ); - } + QFileInfo oldFileInfo ( oldFile ); + if (oldFileInfo.exists()) { + QFile oldFileFile ( oldFile ); + oldFileFile.copy( fileName ); + } - settings.setValue ("SettingsFile", fileName); + settings.setValue ("SettingsFile", fileName); save(); } @@ -258,15 +233,7 @@ void FaceTrackNoIR::saveAs() } void FaceTrackNoIR::load_mappings() { - QSettings settings("opentrack"); - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - - for (int i = 0; i < 6; i++) - { - axis(i).curve.loadSettings(iniFile, axis(i).name1); - axis(i).curveAlt.loadSettings(iniFile, axis(i).name2); - } + pose.load_mappings(); } void FaceTrackNoIR::loadSettings() { @@ -303,7 +270,7 @@ void FaceTrackNoIR::startTracker( ) { stopTracker(); return; } - + #if defined(_WIN32) keybindingWorker = new KeybindingWorker(*this, keyCenter, keyToggle); keybindingWorker->start(); @@ -313,15 +280,15 @@ void FaceTrackNoIR::startTracker( ) { delete tracker; } - tracker = new Tracker ( this, s ); + tracker = new Tracker(s, pose); if (pTrackerDialog && Libraries->pTracker) { pTrackerDialog->registerTracker( Libraries->pTracker ); - } - + } + if (pFilterDialog && Libraries->pFilter) pFilterDialog->registerFilter(Libraries->pFilter); - + tracker->start(); ui.video_frame->show(); @@ -345,7 +312,7 @@ void FaceTrackNoIR::stopTracker( ) { keybindingWorker = NULL; } #endif - timUpdateHeadPose.stop(); + timUpdateHeadPose.stop(); ui.pose_display->rotateBy(0, 0, 0); if (pTrackerDialog) { @@ -366,44 +333,41 @@ void FaceTrackNoIR::stopTracker( ) { } if ( tracker ) { - delete tracker; - tracker = 0; + delete tracker; + tracker = 0; if (Libraries) { delete Libraries; Libraries = NULL; } - } + } updateButtonState(false, false); } -void FaceTrackNoIR::showHeadPose() { - double newdata[6]; - - tracker->getHeadPose(newdata); - ui.lcdNumX->display(newdata[TX]); - ui.lcdNumY->display(newdata[TY]); - ui.lcdNumZ->display(newdata[TZ]); - +void FaceTrackNoIR::showHeadPose() +{ + double mapped[6], raw[6]; - ui.lcdNumRotX->display(newdata[Yaw]); - ui.lcdNumRotY->display(newdata[Pitch]); - ui.lcdNumRotZ->display(newdata[Roll]); + tracker->get_raw_and_mapped_poses(mapped, raw); - tracker->getOutputHeadPose(newdata); + ui.pose_display->rotateBy(mapped[Yaw], mapped[Roll], mapped[Pitch]); - ui.pose_display->rotateBy(newdata[Yaw], newdata[Roll], newdata[Pitch]); + if (mapping_widget) + mapping_widget->update(); - ui.lcdNumOutputPosX->display(newdata[TX]); - ui.lcdNumOutputPosY->display(newdata[TY]); - ui.lcdNumOutputPosZ->display(newdata[TZ]); + ui.lcdNumX->display(raw[TX]); + ui.lcdNumY->display(raw[TY]); + ui.lcdNumZ->display(raw[TZ]); + ui.lcdNumRotX->display(raw[Yaw]); + ui.lcdNumRotY->display(raw[Pitch]); + ui.lcdNumRotZ->display(raw[Roll]); - ui.lcdNumOutputRotX->display(newdata[Yaw]); - ui.lcdNumOutputRotY->display(newdata[Pitch]); - ui.lcdNumOutputRotZ->display(newdata[Roll]); + ui.lcdNumOutputPosX->display(mapped[TX]); + ui.lcdNumOutputPosY->display(mapped[TY]); + ui.lcdNumOutputPosZ->display(mapped[TZ]); + ui.lcdNumOutputRotX->display(mapped[Yaw]); + ui.lcdNumOutputRotY->display(mapped[Pitch]); + ui.lcdNumOutputRotZ->display(mapped[Roll]); - if (_curve_config) { - _curve_config->update(); - } if (Libraries->pProtocol) { const QString name = Libraries->pProtocol->getGameName(); @@ -411,11 +375,12 @@ void FaceTrackNoIR::showHeadPose() { } } -void FaceTrackNoIR::showTrackerSettings() { - if (pTrackerDialog) { - delete pTrackerDialog; - pTrackerDialog = NULL; - } +void FaceTrackNoIR::showTrackerSettings() +{ + if (pTrackerDialog) { + delete pTrackerDialog; + pTrackerDialog = NULL; + } DynamicLibrary* lib = dlopen_trackers.value(ui.iconcomboTrackerSource->currentIndex(), (DynamicLibrary*) NULL); @@ -470,24 +435,24 @@ void FaceTrackNoIR::showFilterControls() { } void FaceTrackNoIR::showKeyboardShortcuts() { - if (!_keyboard_shortcuts) + if (!shortcuts_widget) { - _keyboard_shortcuts = new KeyboardShortcutDialog( this, this ); + shortcuts_widget = new KeyboardShortcutDialog( this, this ); } - _keyboard_shortcuts->show(); - _keyboard_shortcuts->raise(); + shortcuts_widget->show(); + shortcuts_widget->raise(); } -void FaceTrackNoIR::showCurveConfiguration() { - if (!_curve_config) - _curve_config = new CurveConfigurationDialog( this, this ); - - _curve_config->show(); - _curve_config->raise(); +void FaceTrackNoIR::showCurveConfiguration() { + if (!mapping_widget) + mapping_widget = new CurveConfigurationDialog(pose, s, this); + + mapping_widget->show(); + mapping_widget->raise(); } void FaceTrackNoIR::exit() { - QCoreApplication::exit(0); + QCoreApplication::exit(0); } extern "C" volatile const char* opentrack_version; @@ -515,11 +480,11 @@ void FaceTrackNoIR::fill_profile_cbx() void FaceTrackNoIR::profileSelected(int index) { - QSettings settings("opentrack"); - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + QSettings settings("opentrack"); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QFileInfo pathInfo ( currentFile ); settings.setValue ("SettingsFile", pathInfo.absolutePath() + "/" + ui.iconcomboProfile->itemText(index)); - loadSettings(); + loadSettings(); } #if !defined(_WIN32) @@ -542,8 +507,8 @@ void FaceTrackNoIR::bind_keyboard_shortcut(QxtGlobalShortcut& key, key_opts& k) key.setShortcut(QKeySequence::fromString(seq, QKeySequence::PortableText)); key.setEnabled(); } else { - key.setDisabled(); - } + key.setDisabled(); + } } } #else @@ -590,20 +555,18 @@ void FaceTrackNoIR::bindKeyboardShortcuts() void FaceTrackNoIR::shortcutRecentered() { + qDebug() << "Center"; if (s.dingp) QApplication::beep(); - - qDebug() << "Center"; if (tracker) - tracker->do_center = true; + tracker->center(); } void FaceTrackNoIR::shortcutToggled() { + qDebug() << "Toggle"; if (s.dingp) QApplication::beep(); - - qDebug() << "Toggle"; if (tracker) - tracker->enabled = !tracker->enabled; + tracker->toggle_enabled(); } diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index c722ad5c..09f96147 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -44,31 +44,29 @@ #include "ui_facetracknoir.h" -#include "facetracknoir/options.h" -using namespace options; - -#include "facetracknoir/main-settings.hpp" - -#include "facetracknoir/plugin-support.h" -#include "tracker.h" -#include "facetracknoir/shortcuts.h" +#include "./options.h" +#include "./main-settings.hpp" +#include "./plugin-support.h" +#include "./tracker.h" +#include "./shortcuts.h" +#include "./curve-config.h" -class Tracker; // pre-define class to avoid circular includes -class FaceTrackNoIR; - -class KeybindingWorker; +using namespace options; class FaceTrackNoIR : public QMainWindow, IDynamicLibraryProvider { - Q_OBJECT + Q_OBJECT public: FaceTrackNoIR(QWidget *parent = 0); - ~FaceTrackNoIR(); + ~FaceTrackNoIR(); QFrame *get_video_widget(); Tracker *tracker; void bindKeyboardShortcuts(); + + // XXX this shit stinks -sh 20141004 + // TODO move to separate class representing running tracker state DynamicLibrary* current_tracker1() override { return dlopen_trackers.value(ui.iconcomboTrackerSource->currentIndex(), (DynamicLibrary*) NULL); } @@ -78,15 +76,12 @@ public: DynamicLibrary* current_filter() override { return dlopen_filters.value(ui.iconcomboFilter->currentIndex(), (DynamicLibrary*) NULL); } - THeadPoseDOF& axis(int idx) { - return pose.axes[idx]; - } #if defined(_WIN32) Key keyCenter; Key keyToggle; KeybindingWorker* keybindingWorker; -#else +#else QxtGlobalShortcut keyCenter; QxtGlobalShortcut keyToggle; #endif @@ -95,22 +90,20 @@ public: public slots: void shortcutRecentered(); void shortcutToggled(); - private: - HeadPoseData pose; + Mappings pose; Ui::OpentrackUI ui; - QTimer timUpdateHeadPose; + QTimer timUpdateHeadPose; ITrackerDialog* pTrackerDialog; IProtocolDialog* pProtocolDialog; IFilterDialog* pFilterDialog; - QWidget *_keyboard_shortcuts; - QWidget *_curve_config; + QWidget *shortcuts_widget; + CurveConfigurationDialog* mapping_widget; - void createIconGroupBox(); - - void loadSettings(); + void createIconGroupBox(); + void loadSettings(); void updateButtonState(bool running, bool inertialp); QList dlopen_filters; @@ -118,33 +111,33 @@ private: QList dlopen_protocols; QShortcut kbd_quit; int looping; - + QLayout* video_frame_layout; QPixmap no_feed_pixmap; #ifndef _WIN32 void bind_keyboard_shortcut(QxtGlobalShortcut&, key_opts& k); #endif void fill_profile_cbx(); - + private slots: void open(); void save(); void saveAs(); void exit(); void profileSelected(int index); - + void showTrackerSettings(); - + void showServerControls(); void showFilterControls(); void showKeyboardShortcuts(); void showCurveConfiguration(); - + void showHeadPose(); - + void startTracker(); void stopTracker(); - + public: void save_mappings(); void load_mappings(); diff --git a/facetracknoir/mappings.hpp b/facetracknoir/mappings.hpp new file mode 100644 index 00000000..4dae7a90 --- /dev/null +++ b/facetracknoir/mappings.hpp @@ -0,0 +1,79 @@ +#pragma once + +#include +#include "options.h" +using namespace options; +#include "../qfunctionconfigurator/functionconfig.h" +#include "main-settings.hpp" + +class Mapping { +public: + Mapping(QString primary, + QString secondary, + int maxInput1, + int maxOutput1, + int maxInput2, + int maxOutput2, + axis_opts& opts) : + curve(maxInput1, maxOutput1), + curveAlt(maxInput2, maxOutput2), + opts(opts), + name1(primary), + name2(secondary) + { + // XXX TODO move all this qsettings boilerplate into a single header -sh 20141004 + QSettings settings("opentrack"); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + QSettings iniFile(currentFile, QSettings::IniFormat); + curve.loadSettings(iniFile, primary); + curveAlt.loadSettings(iniFile, secondary); + } + Map curve; + Map curveAlt; + axis_opts& opts; + QString name1, name2; +}; + +class Mappings { +private: + Mapping axes[6]; +public: + Mappings(std::vector opts) : + axes { + Mapping("tx","tx_alt", 100, 100, 100, 100, *opts[TX]), + Mapping("ty","ty_alt", 100, 100, 100, 100, *opts[TY]), + Mapping("tz","tz_alt", 100, 100, 100, 100, *opts[TZ]), + Mapping("rx", "rx_alt", 180, 180, 180, 180, *opts[Yaw]), + Mapping("ry", "ry_alt", 90, 90, 90, 90, *opts[Pitch]), + Mapping("rz", "rz_alt", 180, 180, 180, 180, *opts[Roll]) + } + {} + + inline Mapping& operator()(int i) { return axes[i]; } + inline const Mapping& operator()(int i) const { return axes[i]; } + + void load_mappings() + { + QSettings settings("opentrack"); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + QSettings iniFile( currentFile, QSettings::IniFormat ); + + for (int i = 0; i < 6; i++) + { + axes[i].curve.loadSettings(iniFile, axes[i].name1); + axes[i].curveAlt.loadSettings(iniFile, axes[i].name2); + } + } + void save_mappings() + { + QSettings settings("opentrack"); + QString currentFile = settings.value("SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini").toString(); + QSettings iniFile(currentFile, QSettings::IniFormat); + + for (int i = 0; i < 6; i++) + { + axes[i].curve.saveSettings(iniFile, axes[i].name1); + axes[i].curveAlt.saveSettings(iniFile, axes[i].name2); + } + } +}; diff --git a/facetracknoir/plugin-qt-api.hpp b/facetracknoir/plugin-qt-api.hpp index a8dd153b..0e2e3c32 100644 --- a/facetracknoir/plugin-qt-api.hpp +++ b/facetracknoir/plugin-qt-api.hpp @@ -14,11 +14,15 @@ struct Metadata virtual void getIcon(QIcon *icon) = 0; }; +// XXX TODO get rid of QString/QFrame to fix ABI woes +// will lead plugins from different C++ runtimes working -sh 20141004 + +// XXX TODO make virtual public the mess -sh 20141004 + struct IFilter { virtual ~IFilter() = 0; virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; - virtual void reset() = 0; }; inline IFilter::~IFilter() {} @@ -62,4 +66,4 @@ struct ITrackerDialog virtual void registerTracker(ITracker *tracker) = 0; virtual void unRegisterTracker() = 0; }; -inline ITrackerDialog::~ITrackerDialog() {} \ No newline at end of file +inline ITrackerDialog::~ITrackerDialog() {} diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index 3924fc09..c3914cfb 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -45,7 +45,7 @@ private: }; -// merely to break a circular header dependency -sh +// TODO it can die if running tracker state separated into class -sh 20141004 class IDynamicLibraryProvider { public: virtual DynamicLibrary* current_tracker1() = 0; diff --git a/facetracknoir/qcopyable-mutex.hpp b/facetracknoir/qcopyable-mutex.hpp new file mode 100644 index 00000000..f7f36f93 --- /dev/null +++ b/facetracknoir/qcopyable-mutex.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include + +class MyMutex { +private: + QMutex inner; + +public: + QMutex* operator->() { return &inner; } + QMutex* operator->() const { return &const_cast(this)->inner; } + + MyMutex operator=(const MyMutex& datum) + { + auto mode = + datum->isRecursive() + ? QMutex::Recursive + : QMutex::NonRecursive; + + return MyMutex(mode); + } + + MyMutex(const MyMutex& datum) + { + *this = datum; + } + + MyMutex(QMutex::RecursionMode mode = QMutex::NonRecursive) : + inner(mode) + { + } + + QMutex* operator&() + { + return &inner; + } +}; diff --git a/facetracknoir/rotation.h b/facetracknoir/rotation.h index 5ff5ce61..b3bb891e 100644 --- a/facetracknoir/rotation.h +++ b/facetracknoir/rotation.h @@ -8,18 +8,17 @@ #pragma once #include -class RotationType { +class Quat { public: - RotationType() : a(1.0),b(0.0),c(0.0),d(0.0) {} - RotationType(double yaw, double pitch, double roll) { fromEuler(yaw, pitch, roll); } - RotationType(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} + Quat() : a(1.0),b(0.0),c(0.0),d(0.0) {} + Quat(double yaw, double pitch, double roll) { fromEuler(yaw, pitch, roll); } + Quat(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} - RotationType inv(){ - return RotationType(a,-b,-c, -d); + Quat inv(){ + return Quat(a,-b,-c, -d); } - // conversions // see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles void fromEuler(double yaw, double pitch, double roll) @@ -45,10 +44,10 @@ public: yaw = atan2(2.0*(a*d + b*c), 1.0 - 2.0*(c*c + d*d)); } - const RotationType operator*(const RotationType& B) const + const Quat operator*(const Quat& B) const { - const RotationType& A = *this; - return RotationType(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication + const Quat& A = *this; + return Quat(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 17f1af5f..0c2d289f 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -22,12 +22,12 @@ # include #endif -Tracker::Tracker(FaceTrackNoIR *parent , main_settings& s) : - mainApp(parent), +Tracker::Tracker(main_settings& s, Mappings &m) : s(s), - should_quit(false), - do_center(false), - enabled(true) + m(m), + centerp(false), + enabledp(true), + should_quit(false) { } @@ -37,7 +37,7 @@ Tracker::~Tracker() wait(); } -static void get_curve(double pos, double& out, THeadPoseDOF& axis) { +void Tracker::get_curve(double pos, double& out, Mapping& axis) { bool altp = (pos < 0) && axis.opts.altp; axis.curve.setTrackingActive( !altp ); axis.curveAlt.setTrackingActive( altp ); @@ -83,7 +83,7 @@ static void t_compensate(double* input, double* output, bool rz) } void Tracker::run() { - T6DOF offset_camera; + T6DOF pose_offset, unstopped_pose; double newpose[6] = {0}; int sleep_ms = 15; @@ -113,52 +113,42 @@ void Tracker::run() { for (int i = 0; i < 6; i++) { - raw_6dof.axes[i] = newpose[i]; - - auto& axis = mainApp->axis(i); - + auto& axis = m(i); int k = axis.opts.src; if (k < 0 || k >= 6) continue; - - axis.headPos = newpose[k]; + // not really raw, after axis remap -sh + raw_6dof(i) = newpose[k]; } - if (do_center) { - for (int i = 0; i < 6; i++) - offset_camera.axes[i] = mainApp->axis(i).headPos; - - do_center = false; - - if (Libraries->pFilter) - Libraries->pFilter->reset(); + if (centerp) { + centerp = false; + pose_offset = raw_6dof; } - T6DOF target_camera, target_camera2, new_camera; + { + if (enabledp) + unstopped_pose = raw_6dof; - if (!enabled) - target_camera = raw_6dof; - else - for (int i = 0; i < 6; i++) - target_camera.axes[i] = mainApp->axis(i).headPos; + { - target_camera2 = target_camera - offset_camera; + if (Libraries->pFilter) + Libraries->pFilter->FilterHeadPoseData(unstopped_pose, output_pose); + else + output_pose = unstopped_pose; - if (Libraries->pFilter) { - Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes); - } else { - new_camera = target_camera2; - } + output_pose = output_pose - pose_offset; + } - for (int i = 0; i < 6; i++) { - get_curve(new_camera.axes[i], output_camera.axes[i], mainApp->axis(i)); + for (int i = 0; i < 6; i++) + get_curve(output_pose(i), output_pose(i), m(i)); } - if (mainApp->s.tcomp_p) - t_compensate(output_camera.axes, output_camera.axes, mainApp->s.tcomp_tz); + if (s.tcomp_p) + t_compensate(output_pose, output_pose, s.tcomp_tz); if (Libraries->pProtocol) { - Libraries->pProtocol->sendHeadposeToGame(output_camera.axes); + Libraries->pProtocol->sendHeadposeToGame(output_pose); } } @@ -172,21 +162,17 @@ void Tracker::run() { for (int i = 0; i < 6; i++) { - mainApp->axis(i).curve.setTrackingActive(false); - mainApp->axis(i).curveAlt.setTrackingActive(false); + m(i).curve.setTrackingActive(false); + m(i).curveAlt.setTrackingActive(false); } } -void Tracker::getHeadPose( double *data ) { - QMutexLocker foo(&mtx); +void Tracker::get_raw_and_mapped_poses(double* mapped, double* raw) const { + QMutexLocker foo(&const_cast(*this).mtx); for (int i = 0; i < 6; i++) { - data[i] = raw_6dof.axes[i]; + raw[i] = raw_6dof(i); + mapped[i] = output_pose(i); } } -void Tracker::getOutputHeadPose( double *data ) { - QMutexLocker foo(&mtx); - for (int i = 0; i < 6; i++) - data[i] = output_camera.axes[i]; -} diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 54350164..05ae4180 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -11,85 +11,42 @@ #include #include #include "plugin-support.h" +#include "mappings.hpp" + #include +#include #include #include "tracker_types.h" #include "facetracknoir/main-settings.hpp" #include "facetracknoir/options.h" #include "facetracknoir/timer.hpp" -using namespace options; -class THeadPoseDOF { -public: - THeadPoseDOF(QString primary, - QString secondary, - int maxInput1, - int maxOutput1, - int maxInput2, - int maxOutput2, - axis_opts* opts) : - headPos(0), - curve(maxInput1, maxOutput1), - curveAlt(maxInput2, maxOutput2), - opts(*opts), - name1(primary), - name2(secondary) - { - QSettings settings("opentrack"); - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - curve.loadSettings(iniFile, primary); - curveAlt.loadSettings(iniFile, secondary); - } - volatile double headPos; - FunctionConfig curve; - FunctionConfig curveAlt; - axis_opts& opts; - QString name1, name2; -}; -class FaceTrackNoIR; class Tracker : protected QThread { - Q_OBJECT - + Q_OBJECT private: - FaceTrackNoIR *mainApp; QMutex mtx; main_settings& s; - volatile bool should_quit; + // XXX can be const-cast when functionconfig const-correct -sh 20141004 + Mappings& m; Timer t; -protected: - void run(); + T6DOF output_pose, raw_6dof; + std::atomic centerp; + std::atomic enabledp; + std::atomic should_quit; + static void get_curve(double pos, double& out, Mapping& axis); +protected: + void run() override; public: - Tracker( FaceTrackNoIR *parent, main_settings& s); + Tracker(main_settings& s, Mappings& m); ~Tracker(); - void getHeadPose(double *data); - void getOutputHeadPose(double *data); - volatile bool do_center; - volatile bool enabled; - - T6DOF output_camera, raw_6dof; - + void get_raw_and_mapped_poses(double* mapped, double* raw) const; void start() { QThread::start(); } + void center() { centerp.store(true); } + void toggle_enabled() { enabledp.store(!enabledp.load()); } }; - -class HeadPoseData { -public: - THeadPoseDOF axes[6]; - HeadPoseData(std::vector opts) : - axes { - THeadPoseDOF("tx","tx_alt", 100, 100, 100, 100, opts[TX]), - THeadPoseDOF("ty","ty_alt", 100, 100, 100, 100, opts[TY]), - THeadPoseDOF("tz","tz_alt", 100, 100, 100, 100, opts[TZ]), - THeadPoseDOF("rx", "rx_alt", 180, 180, 180, 180, opts[Yaw]), - THeadPoseDOF("ry", "ry_alt", 90, 90, 90, 90, opts[Pitch]), - THeadPoseDOF("rz", "rz_alt", 180, 180, 180, 180, opts[Roll]) - } - {} -}; - #endif diff --git a/facetracknoir/tracker_types.cpp b/facetracknoir/tracker_types.cpp deleted file mode 100644 index 2d7ec45a..00000000 --- a/facetracknoir/tracker_types.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "tracker_types.h" -#include "rotation.h" -#include "facetracknoir/plugin-api.hpp" - -#define PI 3.14159265358979323846264 -#define D2R PI/180.0 -#define R2D 180.0/PI - -T6DOF operator-(const T6DOF& A, const T6DOF& B) -{ - RotationType R_A(A.axes[Yaw]*D2R, A.axes[Pitch]*D2R, A.axes[Roll]*D2R); - RotationType R_B(B.axes[Yaw]*D2R, B.axes[Pitch]*D2R, B.axes[Roll]*D2R); - RotationType R_C = R_A * R_B.inv(); - - T6DOF C; - R_C.toEuler(C.axes[Yaw], C.axes[Pitch], C.axes[Roll]); - C.axes[Yaw] *= R2D; - C.axes[Pitch] *= R2D; - C.axes[Roll] *= R2D; - - C.axes[TX] = A.axes[TX] - B.axes[TX]; - C.axes[TY] = A.axes[TY] - B.axes[TY]; - C.axes[TZ] = A.axes[TZ] - B.axes[TZ]; - return C; -} - -T6DOF operator+(const T6DOF& A, const T6DOF& B) -{ - RotationType R_A(A.axes[Yaw]*D2R, A.axes[Pitch]*D2R, A.axes[Roll]*D2R); - RotationType R_B(B.axes[Yaw]*D2R, B.axes[Pitch]*D2R, B.axes[Roll]*D2R); - RotationType R_C = R_A * R_B; - - T6DOF C; - R_C.toEuler(C.axes[Yaw], C.axes[Pitch], C.axes[Roll]); - C.axes[Yaw] *= R2D; - C.axes[Pitch] *= R2D; - C.axes[Roll] *= R2D; - - C.axes[TX] = A.axes[TX] + B.axes[TX]; - C.axes[TY] = A.axes[TY] + B.axes[TY]; - C.axes[TZ] = A.axes[TZ] + B.axes[TZ]; - return C; -} diff --git a/facetracknoir/tracker_types.h b/facetracknoir/tracker_types.h index 80b74759..c667498e 100644 --- a/facetracknoir/tracker_types.h +++ b/facetracknoir/tracker_types.h @@ -1,11 +1,66 @@ #pragma once +#include +#include +#include "rotation.h" +#include "plugin-api.hpp" + struct T6DOF { -public: - double axes[6]; +private: + static constexpr double PI = 3.14159265358979323846264; + static constexpr double D2R = PI/180.0; + static constexpr double R2D = 180.0/PI; + double axes[6]; +public: T6DOF() : axes {0,0,0, 0,0,0 } {} -}; -T6DOF operator-(const T6DOF& A, const T6DOF& B); // get new pose with respect to reference pose B -T6DOF operator+(const T6DOF& A, const T6DOF& B); // get new pose with respect to reference pose B^-1 + inline operator double*() { return axes; } + inline operator const double*() const { return axes; } + + inline double& operator()(int i) { return axes[i]; } + inline double operator()(int i) const { return axes[i]; } + + Quat quat() const + { + return Quat(axes[Yaw]*D2R, axes[Pitch]*D2R, axes[Roll]*D2R); + } + + static T6DOF fromQuat(const Quat& q) + { + T6DOF ret; + q.toEuler(ret(Yaw), ret(Pitch), ret(Roll)); + return ret; + } + + T6DOF operator-(const T6DOF& B) const + { + const Quat q = (quat() * B.quat().inv()); + T6DOF ret = fromQuat(q); + for (int i = TX; i < Yaw; i++) + ret(i) = B(i); + return ret; + } + + T6DOF operator+(const T6DOF& B) const + { + const Quat q = (quat() * B.quat().inv()); + T6DOF ret = fromQuat(q); + for (int i = TX; i < Yaw; i++) + ret(i) = B(i); + return ret; + } + + T6DOF operator|(const T6DOF& replacement) const + { + T6DOF ret = *this; + for (int i = 0; i < 6; i++) + { + static constexpr double eps = 1e-5; + // NB replace zero-valued elements with argument's + if (std::abs(ret(i)) < eps) + ret(i) = replacement(i); + } + return ret; + } +}; diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index 5323bcae..200242b9 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -27,27 +27,27 @@ #include #include -#include "ftnoir_protocol_ft/fttypes.h" +#include "../ftnoir_protocol_ft/fttypes.h" #define FT_EXPORT(t) __declspec(dllexport) t __stdcall #if 0 -#include +# include static FILE *debug_stream = fopen("c:\\FreeTrackClient.log", "a"); -#define dbg_report(...) if (debug_stream) { fprintf(debug_stream, __VA_ARGS__); fflush(debug_stream); } +# define dbg_report(...) if (debug_stream) { fprintf(debug_stream, __VA_ARGS__); fflush(debug_stream); } #else #define dbg_report(...) ((void)0) #endif static HANDLE hFTMemMap = 0; -static FTHeap *pMemData = 0; -static HANDLE hFTMutex = 0; +static FTHeap* ipc_heap = 0; +static HANDLE ipc_mutex = 0; static const char* dllVersion = "1.0.0.0"; static const char* dllProvider = "FreeTrack"; -static bool FTCreateMapping(void) +static bool impl_create_mapping(void) { - if (pMemData != NULL) + if (ipc_heap != NULL) return true; hFTMemMap = CreateFileMappingA(INVALID_HANDLE_VALUE, @@ -58,26 +58,27 @@ static bool FTCreateMapping(void) (LPCSTR) FREETRACK_HEAP); if (hFTMemMap == NULL) - return (pMemData = NULL), false; + return (ipc_heap = NULL), false; - pMemData = (FTHeap*) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof(FTHeap)); - hFTMutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); + ipc_heap = (FTHeap*) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof(FTHeap)); + ipc_mutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); return true; } +#pragma comment (linker, "/export:FTGetData") FT_EXPORT(bool) FTGetData(FTData* data) { - if (FTCreateMapping() == false) + if (impl_create_mapping() == false) return false; - if (hFTMutex && WaitForSingleObject(hFTMutex, 16) == WAIT_OBJECT_0) { - if (pMemData) { - if (pMemData->data.DataID > (1 << 29)) - pMemData->data.DataID = 0; - data->DataID = pMemData->data.DataID; + if (ipc_mutex && WaitForSingleObject(ipc_mutex, 16) == WAIT_OBJECT_0) { + if (ipc_heap) { + if (ipc_heap->data.DataID > (1 << 29)) + ipc_heap->data.DataID = 0; + data->DataID = ipc_heap->data.DataID; } - ReleaseMutex(hFTMutex); + ReleaseMutex(ipc_mutex); } return true; } @@ -87,17 +88,20 @@ FT_EXPORT(bool) FTGetData(FTData* data) // The Delphi-code from the FreeTrack repo suggest a char * as argument, so it cost me an afternoon to figure it out (and keep ArmA2 from crashing). // Thanks guys! */ +#pragma comment (linker, "/export:FTReportName") FT_EXPORT(void) FTReportName( int name ) { dbg_report("FTReportName request (ID = %d).\n", name); } +#pragma comment (linker, "/export:FTGetDllVersion") FT_EXPORT(const char*) FTGetDllVersion(void) { dbg_report("FTGetDllVersion request.\n"); return dllVersion; } +#pragma comment (linker, "/export:FTProvider") FT_EXPORT(const char*) FTProvider(void) { dbg_report("FTProvider request.\n"); diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h index a47ebf4f..cbe728ab 100755 --- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h +++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h @@ -1,6 +1,6 @@ #pragma once /* Copyright (c) 2013 Stanisław 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. @@ -10,13 +10,12 @@ #include "ui_ftnoir_kalman_filtercontrols.h" #include "facetracknoir/plugin-api.hpp" -#include +#include +#include #include #include -#include -#include #include -#include +#include #include "facetracknoir/options.h" using namespace options; @@ -24,7 +23,7 @@ class OPENTRACK_EXPORT FTNoIR_Filter : public IFilter { public: FTNoIR_Filter(); - void reset() override; + void reset(); void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) override; cv::KalmanFilter kalman; diff --git a/ftnoir_protocol_ft/fttypes.h b/ftnoir_protocol_ft/fttypes.h index 0558f881..f41350c8 100644 --- a/ftnoir_protocol_ft/fttypes.h +++ b/ftnoir_protocol_ft/fttypes.h @@ -19,7 +19,11 @@ #pragma once -#include +#ifndef _MSC_VER +# include +#else +typedef unsigned __int32 uint32_t; +#endif #define FREETRACK_HEAP "FT_SharedMem" #define FREETRACK_MUTEX "FT_Mutext" @@ -54,7 +58,9 @@ typedef struct __FTData { float Y4; } FTData; -typedef struct __FTAlloc { +/* we add some shit at the end for other legacy proto, sadly */ + +typedef struct __FTHeap { FTData data; int32_t GameID; unsigned char table[8]; diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 159f350e..f39562c1 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -17,12 +17,12 @@ #include #include -void FunctionConfig::setTrackingActive(bool blnActive) +void Map::setTrackingActive(bool blnActive) { activep = blnActive; } -FunctionConfig::FunctionConfig() : +Map::Map() : _mutex(QMutex::Recursive), data(0), activep(false), @@ -31,7 +31,7 @@ FunctionConfig::FunctionConfig() : { } -float FunctionConfig::getValue(float x) { +float Map::getValue(float x) { QMutexLocker foo(&_mutex); int x2 = (int) (std::min(std::max(x, -360), 360) * MEMOIZE_PRECISION); float ret = getValueInternal(x2); @@ -40,13 +40,13 @@ float FunctionConfig::getValue(float x) { return ret; } -bool FunctionConfig::getLastPoint(QPointF& point ) { +bool Map::getLastPoint(QPointF& point ) { QMutexLocker foo(&_mutex); point = last_input_value; return activep; } -float FunctionConfig::getValueInternal(int x) { +float Map::getValueInternal(int x) { float sign = x < 0 ? -1 : 1; x = x < 0 ? -x : x; float ret; @@ -75,7 +75,7 @@ static bool sortFn(const QPointF& one, const QPointF& two) { return one.x() < two.x(); } -void FunctionConfig::reload() { +void Map::reload() { if (input.size()) qStableSort(input.begin(), input.end(), sortFn); @@ -132,7 +132,7 @@ void FunctionConfig::reload() { } } -void FunctionConfig::removePoint(int i) { +void Map::removePoint(int i) { QMutexLocker foo(&_mutex); if (i >= 0 && i < input.size()) { @@ -141,13 +141,13 @@ void FunctionConfig::removePoint(int i) { } } -void FunctionConfig::addPoint(QPointF pt) { +void Map::addPoint(QPointF pt) { QMutexLocker foo(&_mutex); input.append(pt); reload(); } -void FunctionConfig::movePoint(int idx, QPointF pt) { +void Map::movePoint(int idx, QPointF pt) { QMutexLocker foo(&_mutex); if (idx >= 0 && idx < input.size()) { @@ -156,13 +156,13 @@ void FunctionConfig::movePoint(int idx, QPointF pt) { } } -const QList FunctionConfig::getPoints() { +const QList Map::getPoints() { QMutexLocker foo(&_mutex); // NB can't pass by reference return input; } -void FunctionConfig::loadSettings(QSettings& settings, const QString& title) { +void Map::loadSettings(QSettings& settings, const QString& title) { QMutexLocker foo(&_mutex); QPointF newPoint; @@ -187,7 +187,7 @@ void FunctionConfig::loadSettings(QSettings& settings, const QString& title) { reload(); } -void FunctionConfig::saveSettings(QSettings& settings, const QString& title) { +void Map::saveSettings(QSettings& settings, const QString& title) { QMutexLocker foo(&_mutex); settings.beginGroup(QString("Curves-%1").arg(title)); int max = input.size(); diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index 66e7f3e8..ccfd1ba3 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -13,88 +13,55 @@ #include #include #include -#include "facetracknoir/plugin-api.hpp" #include +#include "../facetracknoir/plugin-api.hpp" +#include "../facetracknoir/qcopyable-mutex.hpp" #define MEMOIZE_PRECISION 100 -class MyMutex { -private: - QMutex inner; - -public: - QMutex* operator->() { return &inner; } - QMutex* operator->() const { return &const_cast(this)->inner; } - - MyMutex operator=(const MyMutex& datum) - { - auto mode = - datum->isRecursive() - ? QMutex::Recursive - : QMutex::NonRecursive; - - return MyMutex(mode); - } - - MyMutex(const MyMutex& datum) - { - *this = datum; - } - - MyMutex(QMutex::RecursionMode mode = QMutex::NonRecursive) : - inner(mode) - { - } - - QMutex* operator&() - { - return &inner; - } -}; - -class OPENTRACK_EXPORT FunctionConfig { +class OPENTRACK_EXPORT Map { private: void reload(); float getValueInternal(int x); - + MyMutex _mutex; - QList input; + QList input; std::vector data; - QPointF last_input_value; + QPointF last_input_value; volatile bool activep; - int max_x; - int max_y; + int max_x; + int max_y; public: int maxInput() const { return max_x; } int maxOutput() const { return max_y; } - FunctionConfig(); - FunctionConfig(int maxx, int maxy) + Map(); + Map(int maxx, int maxy) { setMaxInput(maxx); setMaxOutput(maxy); } float getValue(float x); - bool getLastPoint(QPointF& point); - void removePoint(int i); + bool getLastPoint(QPointF& point); + void removePoint(int i); void removeAllPoints() { QMutexLocker foo(&_mutex); input.clear(); reload(); } - void addPoint(QPointF pt); - void movePoint(int idx, QPointF pt); - const QList getPoints(); - void setMaxInput(int MaxInput) { - max_x = MaxInput; - } - void setMaxOutput(int MaxOutput) { - max_y = MaxOutput; - } + void addPoint(QPointF pt); + void movePoint(int idx, QPointF pt); + const QList getPoints(); + void setMaxInput(int MaxInput) { + max_x = MaxInput; + } + void setMaxOutput(int MaxOutput) { + max_y = MaxOutput; + } - void saveSettings(QSettings& settings, const QString& title); - void loadSettings(QSettings& settings, const QString& title); + void saveSettings(QSettings& settings, const QString& title); + void loadSettings(QSettings& settings, const QString& title); - void setTrackingActive(bool blnActive); + void setTrackingActive(bool blnActive); }; diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index 1e5b957c..57d1500a 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -37,7 +37,7 @@ QFunctionConfigurator::QFunctionConfigurator(QWidget *parent) : setMouseTracking(true); } -void QFunctionConfigurator::setConfig(FunctionConfig* config, const QString& name) { +void QFunctionConfigurator::setConfig(Map* config, const QString& name) { QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index facc5bbe..e35d0bc3 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -20,8 +20,8 @@ class OPENTRACK_EXPORT QFunctionConfigurator : public QWidget public: QFunctionConfigurator(QWidget *parent = 0); - FunctionConfig* config(); - void setConfig(FunctionConfig* config, const QString &name); + Map* config(); + void setConfig(Map* config, const QString &name); QColor colorBezier() const { @@ -65,7 +65,7 @@ private: QPointF pixel_coord_to_point (const QPointF& point); QPointF point_to_pixel (const QPointF& point); - FunctionConfig* _config; + Map* _config; // bounds of the rectangle user can interact with QRectF pixel_bounds; -- cgit v1.2.3 From cfffa29e29db6b2234c7f534b1ebcd612b7f4914 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 5 Oct 2014 01:22:11 +0200 Subject: flush --- CMakeLists.txt | 3 +- facetracknoir/quat.hpp | 66 ++++++++++ facetracknoir/rotation.h | 58 -------- facetracknoir/tracker.h | 2 - facetracknoir/tracker_types.h | 14 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 148 ++++++++++----------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 13 +- ftnoir_tracker_aruco/include/aruco.h | 29 ++-- ftnoir_tracker_aruco/include/arucofidmarkers.h | 15 +-- ftnoir_tracker_aruco/include/board.h | 168 ------------------------ ftnoir_tracker_aruco/include/boarddetector.h | 139 -------------------- ftnoir_tracker_aruco/include/cameraparameters.h | 6 +- ftnoir_tracker_aruco/include/cvdrawingutils.h | 19 +-- ftnoir_tracker_aruco/include/exports.h | 6 +- ftnoir_tracker_aruco/include/marker.h | 16 +-- ftnoir_tracker_aruco/include/markerdetector.h | 56 ++++---- ftnoir_tracker_aruco/trans_calib.h | 2 +- ftnoir_tracker_pt/camera.h | 2 +- ftnoir_tracker_pt/ftnoir_tracker_pt.h | 54 ++++---- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 88 ++++++------- ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 4 +- ftnoir_tracker_pt/point_extractor.h | 4 +- ftnoir_tracker_pt/point_tracker.h | 74 +++++------ ftnoir_tracker_pt/pt_video_widget.h | 2 +- ftnoir_tracker_pt/trans_calib.h | 2 +- 25 files changed, 338 insertions(+), 652 deletions(-) create mode 100644 facetracknoir/quat.hpp delete mode 100644 facetracknoir/rotation.h delete mode 100644 ftnoir_tracker_aruco/include/board.h delete mode 100644 ftnoir_tracker_aruco/include/boarddetector.h (limited to 'facetracknoir/tracker_types.h') diff --git a/CMakeLists.txt b/CMakeLists.txt index 655d70c3..2de8856d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,7 +344,6 @@ opentrack_library(opentrack-tracker-ht) target_link_libraries(opentrack-tracker-ht opentrack-compat) if(SDK_ARUCO_LIBPATH) - include_directories(${CMAKE_SOURCE_DIR}/ftnoir_tracker_aruco/include) opentrack_library(opentrack-tracker-aruco) target_link_libraries(opentrack-tracker-aruco ${SDK_ARUCO_LIBPATH} ${OpenCV_LIBS}) endif() @@ -477,7 +476,7 @@ install(DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty-notices" DESTINATION .) install(FILES "${CMAKE_SOURCE_DIR}/bin/NPClient.dll" "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe" DESTINATION .) install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/settings" "${CMAKE_SOURCE_DIR}/facetracknoir/clientfiles" DESTINATION .) -if(NOT WIN32 AND SDK_WINE_PREFIX) +if(NOT WIN32 AND SDK_WINE_PREFIX AND NOT SDK_WINE_NO_WRAPPER) install(FILES "${CMAKE_BINARY_DIR}/opentrack-wrapper-wine.exe.so" DESTINATION .) endif() diff --git a/facetracknoir/quat.hpp b/facetracknoir/quat.hpp new file mode 100644 index 00000000..1e268963 --- /dev/null +++ b/facetracknoir/quat.hpp @@ -0,0 +1,66 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 + +class Quat { +private: + static constexpr double pi = 3.141592653; + static constexpr double r2d = 180./pi; + double a,b,c,d; // quaternion coefficients +public: + Quat() : a(1.0),b(0.0),c(0.0),d(0.0) {} + Quat(double yaw, double pitch, double roll) { from_euler_rads(yaw, pitch, roll); } + Quat(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} + + Quat inv(){ + return Quat(a,-b,-c, -d); + } + + // conversions + // see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles + void from_euler_rads(double yaw, double pitch, double roll) + { + + double sin_phi = sin(roll/2.0); + double cos_phi = cos(roll/2.0); + double sin_the = sin(pitch/2.0); + double cos_the = cos(pitch/2.0); + double sin_psi = sin(yaw/2.0); + double cos_psi = cos(yaw/2.0); + + a = cos_phi*cos_the*cos_psi + sin_phi*sin_the*sin_psi; + b = sin_phi*cos_the*cos_psi - cos_phi*sin_the*sin_psi; + c = cos_phi*sin_the*cos_psi + sin_phi*cos_the*sin_psi; + d = cos_phi*cos_the*sin_psi - sin_phi*sin_the*cos_psi; + } + + void to_euler_rads(double& yaw, double& pitch, double& roll) const + { + roll = atan2(2.0*(a*b + c*d), 1.0 - 2.0*(b*b + c*c)); + pitch = asin(2.0*(a*c - b*d)); + yaw = atan2(2.0*(a*d + b*c), 1.0 - 2.0*(c*c + d*d)); + } + + void to_euler_degrees(double& yaw, double& pitch, double& roll) const + { + to_euler_rads(yaw, pitch, roll); + yaw *= r2d; + pitch *= r2d; + roll *= r2d; + } + + const Quat operator*(const Quat& B) const + { + const Quat& A = *this; + return Quat(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication + A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, + A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, + A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); + } +}; diff --git a/facetracknoir/rotation.h b/facetracknoir/rotation.h deleted file mode 100644 index b3bb891e..00000000 --- a/facetracknoir/rotation.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 - -class Quat { - -public: - Quat() : a(1.0),b(0.0),c(0.0),d(0.0) {} - Quat(double yaw, double pitch, double roll) { fromEuler(yaw, pitch, roll); } - Quat(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} - - Quat inv(){ - return Quat(a,-b,-c, -d); - } - - // conversions - // see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles - void fromEuler(double yaw, double pitch, double roll) - { - - double sin_phi = sin(roll/2.0); - double cos_phi = cos(roll/2.0); - double sin_the = sin(pitch/2.0); - double cos_the = cos(pitch/2.0); - double sin_psi = sin(yaw/2.0); - double cos_psi = cos(yaw/2.0); - - a = cos_phi*cos_the*cos_psi + sin_phi*sin_the*sin_psi; - b = sin_phi*cos_the*cos_psi - cos_phi*sin_the*sin_psi; - c = cos_phi*sin_the*cos_psi + sin_phi*cos_the*sin_psi; - d = cos_phi*cos_the*sin_psi - sin_phi*sin_the*cos_psi; - } - - void toEuler(double& yaw, double& pitch, double& roll) const - { - roll = atan2(2.0*(a*b + c*d), 1.0 - 2.0*(b*b + c*c)); - pitch = asin(2.0*(a*c - b*d)); - yaw = atan2(2.0*(a*d + b*c), 1.0 - 2.0*(c*c + d*d)); - } - - const Quat operator*(const Quat& B) const - { - const Quat& A = *this; - return Quat(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication - A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, - A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, - A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); - } - -private: - double a,b,c,d; // quaternion coefficients -}; diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 05ae4180..3d9a3858 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -22,8 +22,6 @@ #include "facetracknoir/options.h" #include "facetracknoir/timer.hpp" - - class Tracker : protected QThread { Q_OBJECT private: diff --git a/facetracknoir/tracker_types.h b/facetracknoir/tracker_types.h index c667498e..02aacdcf 100644 --- a/facetracknoir/tracker_types.h +++ b/facetracknoir/tracker_types.h @@ -2,14 +2,14 @@ #include #include -#include "rotation.h" -#include "plugin-api.hpp" +#include "./quat.hpp" +#include "./plugin-api.hpp" struct T6DOF { private: - static constexpr double PI = 3.14159265358979323846264; - static constexpr double D2R = PI/180.0; - static constexpr double R2D = 180.0/PI; + static constexpr double pi = 3.141592653; + static constexpr double d2r = pi/180.0; + static constexpr double r2d = 180./pi; double axes[6]; public: @@ -23,13 +23,13 @@ public: Quat quat() const { - return Quat(axes[Yaw]*D2R, axes[Pitch]*D2R, axes[Roll]*D2R); + return Quat(axes[Yaw]*d2r, axes[Pitch]*d2r, axes[Roll]*d2r); } static T6DOF fromQuat(const Quat& q) { T6DOF ret; - q.toEuler(ret(Yaw), ret(Pitch), ret(Roll)); + q.to_euler_rads(ret(Yaw), ret(Pitch), ret(Roll)); return ret; } diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index e216d319..a1e15721 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -8,13 +8,13 @@ #include "ftnoir_tracker_aruco.h" #include "ui_aruco-trackercontrols.h" #include "facetracknoir/plugin-api.hpp" -#include #include -#include -#include -#include +#include "include/markerdetector.h" +#include +#include #include #include +#include #if defined(_WIN32) # undef NOMINMAX @@ -29,51 +29,51 @@ static QList get_camera_names(void) { QList ret; #if defined(_WIN32) - // Create the System Device Enumerator. - HRESULT hr; - ICreateDevEnum *pSysDevEnum = NULL; - hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); - if (FAILED(hr)) - { - return ret; - } - // Obtain a class enumerator for the video compressor category. - IEnumMoniker *pEnumCat = NULL; - hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); - - if (hr == S_OK) { - // Enumerate the monikers. - IMoniker *pMoniker = NULL; - ULONG cFetched; - while (pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK) { - IPropertyBag *pPropBag; - hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); - if (SUCCEEDED(hr)) { - // To retrieve the filter's friendly name, do the following: - VARIANT varName; - VariantInit(&varName); - hr = pPropBag->Read(L"FriendlyName", &varName, 0); - if (SUCCEEDED(hr)) - { - // Display the name in your UI somehow. - QString str((QChar*)varName.bstrVal, wcslen(varName.bstrVal)); - ret.append(str); - } - VariantClear(&varName); - - ////// To create an instance of the filter, do the following: - ////IBaseFilter *pFilter; - ////hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter, - //// (void**)&pFilter); - // Now add the filter to the graph. - //Remember to release pFilter later. - pPropBag->Release(); - } - pMoniker->Release(); - } - pEnumCat->Release(); - } - pSysDevEnum->Release(); + // Create the System Device Enumerator. + HRESULT hr; + ICreateDevEnum *pSysDevEnum = NULL; + hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); + if (FAILED(hr)) + { + return ret; + } + // Obtain a class enumerator for the video compressor category. + IEnumMoniker *pEnumCat = NULL; + hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); + + if (hr == S_OK) { + // Enumerate the monikers. + IMoniker *pMoniker = NULL; + ULONG cFetched; + while (pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK) { + IPropertyBag *pPropBag; + hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); + if (SUCCEEDED(hr)) { + // To retrieve the filter's friendly name, do the following: + VARIANT varName; + VariantInit(&varName); + hr = pPropBag->Read(L"FriendlyName", &varName, 0); + if (SUCCEEDED(hr)) + { + // Display the name in your UI somehow. + QString str((QChar*)varName.bstrVal, wcslen(varName.bstrVal)); + ret.append(str); + } + VariantClear(&varName); + + ////// To create an instance of the filter, do the following: + ////IBaseFilter *pFilter; + ////hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter, + //// (void**)&pFilter); + // Now add the filter to the graph. + //Remember to release pFilter later. + pPropBag->Release(); + } + pMoniker->Release(); + } + pEnumCat->Release(); + } + pSysDevEnum->Release(); #else for (int i = 0; i < 16; i++) { char buf[128]; @@ -89,15 +89,15 @@ static QList get_camera_names(void) { } typedef struct { - int width; - int height; + int width; + int height; } resolution_tuple; static resolution_tuple resolution_choices[] = { - { 640, 480 }, - { 320, 240 }, - { 320, 200 }, - { 0, 0 } + { 640, 480 }, + { 320, 240 }, + { 320, 200 }, + { 0, 0 } }; Tracker::Tracker() : stop(false), layout(nullptr), videoWidget(nullptr) @@ -108,8 +108,8 @@ Tracker::~Tracker() { stop = true; wait(); - if (videoWidget) - delete videoWidget; + if (videoWidget) + delete videoWidget; if(layout) delete layout; qDebug() << "releasing camera, brace for impact"; @@ -178,7 +178,7 @@ void Tracker::run() } if (fps) camera.set(CV_CAP_PROP_FPS, fps); - + aruco::MarkerDetector detector; detector.setDesiredSpeed(3); @@ -187,7 +187,7 @@ void Tracker::run() cv::Mat color, color_, grayscale, rvec, tvec; const double stateful_coeff = 0.88; - + if (!camera.isOpened()) { fprintf(stderr, "aruco tracker: can't open camera\n"); @@ -214,7 +214,7 @@ void Tracker::run() grayscale = channel[2]; } else cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); - + gain.tick(camera, grayscale); const int scale = frame.cols > 480 ? 2 : 1; @@ -280,11 +280,11 @@ void Tracker::run() cv::putText(frame, buf, cv::Point(10, 32), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(0, 255, 0), scale); ::sprintf(buf, "Jiffies: %ld", (long) (10000 * (time - tm) / freq)); cv::putText(frame, buf, cv::Point(10, 54), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(80, 255, 0), scale); - + if (markers.size() == 1 && markers[0].size() == 4) { const auto& m = markers.at(0); const float size = 40; - + const double p = s.marker_pitch; const double sq = sin(p * HT_PI / 180); const double cq = cos(p * HT_PI / 180); @@ -380,7 +380,7 @@ void Tracker::run() void Tracker::GetHeadPoseData(double *data) { QMutexLocker lck(&mtx); - + data[Yaw] = pose[Yaw]; data[Pitch] = pose[Pitch]; data[Roll] = pose[Roll]; @@ -391,11 +391,11 @@ void Tracker::GetHeadPoseData(double *data) class TrackerDll : public Metadata { - // ITrackerDll interface - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); + // ITrackerDll interface + void getFullName(QString *strToBeFilled); + void getShortName(QString *strToBeFilled); + void getDescription(QString *strToBeFilled); + void getIcon(QIcon *icon); }; //----------------------------------------------------------------------------- @@ -406,12 +406,12 @@ void TrackerDll::getFullName(QString *strToBeFilled) void TrackerDll::getShortName(QString *strToBeFilled) { - *strToBeFilled = "aruco"; + *strToBeFilled = "aruco"; } void TrackerDll::getDescription(QString *strToBeFilled) { - *strToBeFilled = ""; + *strToBeFilled = ""; } void TrackerDll::getIcon(QIcon *icon) @@ -425,7 +425,7 @@ void TrackerDll::getIcon(QIcon *icon) extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { - return new TrackerDll; + return new TrackerDll; } //#pragma comment(linker, "/export:GetTracker=_GetTracker@0") @@ -444,11 +444,11 @@ TrackerControls::TrackerControls() { tracker = nullptr; calib_timer.setInterval(200); - ui.setupUi(this); + ui.setupUi(this); setAttribute(Qt::WA_NativeWindow, true); ui.cameraName->addItems(get_camera_names()); tie_setting(s.camera_index, ui.cameraName); - tie_setting(s.resolution, ui.resolution); + tie_setting(s.resolution, ui.resolution); tie_setting(s.force_fps, ui.cameraFPS); tie_setting(s.fov, ui.cameraFOV); tie_setting(s.headpos_x, ui.cx); @@ -500,7 +500,7 @@ void TrackerControls::doOK() s.b->save(); if (tracker) tracker->reload(); - this->close(); + this->close(); } void TrackerControls::doCancel() diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 5416bb52..9ac57417 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -16,12 +16,9 @@ #include #include #include -#include -#include #include "facetracknoir/options.h" #include "ftnoir_tracker_aruco/trans_calib.h" #include "facetracknoir/plugin-api.hpp" - #include "facetracknoir/gain-control.hpp" using namespace options; @@ -50,7 +47,7 @@ class Tracker : protected QThread, public ITracker { Q_OBJECT public: - Tracker(); + Tracker(); ~Tracker() override; void StartTracker(QFrame* frame); void GetHeadPoseData(double *data); @@ -61,7 +58,7 @@ private: QMutex mtx; volatile bool stop; QHBoxLayout* layout; - ArucoVideoWidget* videoWidget; + ArucoVideoWidget* videoWidget; settings s; double pose[6]; cv::Mat frame; @@ -83,14 +80,14 @@ public: tracker = nullptr; } private: - Ui::Form ui; + Ui::Form ui; Tracker* tracker; settings s; TranslationCalibrator calibrator; QTimer calib_timer; private slots: - void doOK(); - void doCancel(); + void doOK(); + void doCancel(); void toggleCalibrate(); void cleanupCalib(); void update_tracker_calibration(); diff --git a/ftnoir_tracker_aruco/include/aruco.h b/ftnoir_tracker_aruco/include/aruco.h index 569b95fb..8ea583a8 100644 --- a/ftnoir_tracker_aruco/include/aruco.h +++ b/ftnoir_tracker_aruco/include/aruco.h @@ -26,12 +26,12 @@ The views and conclusions contained in the software and documentation are those authors and should not be interpreted as representing official policies, either expressed or implied, of Rafael Muñoz Salinas. - - + + \mainpage ArUco: Augmented Reality library from the University of Cordoba -ArUco is a minimal C++ library for detection of Augmented Reality markers based on OpenCv exclusively. +ArUco is a minimal C++ library for detection of Augmented Reality markers based on OpenCv exclusively. It is an educational project to show student how to detect augmented reality markers and it is provided under BSD license. @@ -54,11 +54,11 @@ Aruco allows the possibility to employ board. Boards are markers composed by an The library comes with five applications that will help you to learn how to use the library: - aruco_create_marker: which creates marker and saves it in a jpg file you can print. - - aruco_simple : simple test aplication that detects the markers in a image + - aruco_simple : simple test aplication that detects the markers in a image - aruco_test: this is the main application for detection. It reads images either from the camera of from a video and detect markers. Additionally, if you provide the intrinsics of the camera(obtained by OpenCv calibration) and the size of the marker in meters, the library calculates the marker intrinsics so that you can easily create your AR applications. - aruco_test_gl: shows how to use the library AR applications using OpenGL for rendering - aruco_create_board: application that helps you to create a board - - aruco_simple_board: simple test aplication that detects a board of markers in a image + - aruco_simple_board: simple test aplication that detects a board of markers in a image - aruco_test_board: application that detects boards - aruco_test_board_gl: application that detects boards and uses OpenGL to draw @@ -66,7 +66,7 @@ The library comes with five applications that will help you to learn how to use The ArUco library contents are divided in two main directories. The src directory, which contains the library itself. And the utils directory which contains the applications. -The library main classes are: +The library main classes are: - aruco::CameraParameters: represent the information of the camera that captures the images. Here you must set the calibration info. - aruco::Marker: which represent a marker detected in the image - aruco::MarkerDetector: that is in charge of deteting the markers in a image Detection is done by simple calling the member funcion ArMarkerDetector::detect(). Additionally, the classes contain members to create the required matrices for rendering using OpenGL. See aruco_test_gl for details @@ -101,34 +101,33 @@ The library has been compiled using MinGW and codeblocks. Below I describe the b -# Download the source code and compile it using cmake and codeblocks. Note: install the library in C:\ if you want it to be easily detected by cmake afterwards - step 4) aruco -# Download and decompress. - -# Open cmake gui application and set the path to the main library directory and also set a path where the project is going to be built. + -# Open cmake gui application and set the path to the main library directory and also set a path where the project is going to be built. -# Generate the codeblock project. -# Open the project with codeblock and compile then, install. The programs will be probably generated into the bin directory OpenGL: by default, the mingw version installed has not the glut library. So, the opengl programs are not compiled. If you want to compile with OpenGL support, you must install glut, or prefereably freeglut. -Thus, - - Download the library (http://www.martinpayne.me.uk/software/development/GLUT/freeglut-MinGW.zip) for mingw. - - Decompress in a directory X. +Thus, + - Download the library (http://www.martinpayne.me.uk/software/development/GLUT/freeglut-MinGW.zip) for mingw. + - Decompress in a directory X. - Then, rerun cmake setting the variable GLU_PATH to that directory (>cmake .. -DGLUT_PATH="C:\X") - Finally, recompile and test. Indeed, you should move the freeglut.dll to the directory with the binaries or to any other place in the PATH. CONCLUSION: Move to Linux, things are simpler :P - -\section Testing + +\section Testing For testing the applications, the library provides videos and the corresponding camera parameters of these videos. Into the directories you will find information on how to run the examples. - + \section Final Notes - REQUIREMENTS: OpenCv >= 2.1.0. and OpenGL for (aruco_test_gl and aruco_test_board_gl) - CONTACT: Rafael Munoz-Salinas: rmsalinas@uco.es - This libary is free software and come with no guaratee! - + */ #include "markerdetector.h" -#include "boarddetector.h" #include "cvdrawingutils.h" diff --git a/ftnoir_tracker_aruco/include/arucofidmarkers.h b/ftnoir_tracker_aruco/include/arucofidmarkers.h index 7dad4672..15eb8e4c 100644 --- a/ftnoir_tracker_aruco/include/arucofidmarkers.h +++ b/ftnoir_tracker_aruco/include/arucofidmarkers.h @@ -31,7 +31,6 @@ or implied, of Rafael Muñoz Salinas. #include #include "exports.h" #include "marker.h" -#include "board.h" namespace aruco { class ARUCO_EXPORTS FiducidalMarkers { @@ -80,7 +79,7 @@ public: * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels * @param MarkerDistance distance between the markers - * @param TInfo output + * @param TInfo output * @param excludedIds set of ids excluded from the board */ static cv::Mat createBoardImage( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,vector *excludedIds=NULL ) throw (cv::Exception); @@ -89,24 +88,24 @@ public: /**Creates a printable image of a board in chessboard_like manner * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels - * @param TInfo output + * @param TInfo output * @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner - * + * */ static cv::Mat createBoardImage_ChessBoard( cv::Size gridSize,int MarkerSize, BoardConfiguration& TInfo ,bool setDataCentered=true ,vector *excludedIds=NULL) throw (cv::Exception); - /**Creates a printable image of a board in a frame fashion + /**Creates a printable image of a board in a frame fashion * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels * @param MarkerDistance distance between the markers - * @param TInfo output + * @param TInfo output * @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner - * + * */ static cv::Mat createBoardImage_Frame( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,bool setDataCentered=true,vector *excludedIds=NULL ) throw (cv::Exception); private: - + static vector getListOfValidMarkersIds_random(int nMarkers,vector *excluded) throw (cv::Exception); static cv::Mat rotate(const cv::Mat & in); static int hammDistMarker(cv::Mat bits); diff --git a/ftnoir_tracker_aruco/include/board.h b/ftnoir_tracker_aruco/include/board.h deleted file mode 100644 index c1d79292..00000000 --- a/ftnoir_tracker_aruco/include/board.h +++ /dev/null @@ -1,168 +0,0 @@ -/***************************** -Copyright 2011 Rafael Muñoz Salinas. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of - conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list - of conditions and the following disclaimer in the documentation and/or other materials - provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those of the -authors and should not be interpreted as representing official policies, either expressed -or implied, of Rafael Muñoz Salinas. -********************************/ -#ifndef _Aruco_board_h -#define _Aruco_board_h -#include -#include -#include -#include "exports.h" -#include "marker.h" -using namespace std; -namespace aruco { -/** - * 3d representation of a marker - */ -struct ARUCO_EXPORTS MarkerInfo:public vector { - MarkerInfo() {} - MarkerInfo(int _id) {id=_id; } - MarkerInfo(const MarkerInfo&MI): vector(MI){id=MI.id; } - MarkerInfo & operator=(const MarkerInfo&MI){ - vector ::operator=(MI); - id=MI.id; - return *this; - } - int id;//maker id -}; - -/**\brief This class defines a board with several markers. - * A Board contains several markers so that they are more robustly detected. - * - * In general, a board is a set of markers. So BoardConfiguration is only a list - * of the id of the markers along with the position of their corners. - * - * The position of the corners can be specified either in pixels (in a non-specific size) or in meters. - * The first is the typical case in which you generate the image of board and the print it. Since you do not know in advance the real - * size of the markers, their corners are specified in pixels, and then, the translation to meters can be made once you know the real size. - * - * On the other hand, you may want to have the information of your boards in meters. The BoardConfiguration allows you to do so. - * - * The point is in the mInfoType variable. It can be either PIX or METERS according to your needs. - * -*/ - - -class ARUCO_EXPORTS BoardConfiguration: public vector -{ - friend class Board; -public: - enum MarkerInfoType {NONE=-1,PIX=0,METERS=1};//indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally - //variable indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally - int mInfoType; - /** - */ - BoardConfiguration(); - - /** - */ - BoardConfiguration(const BoardConfiguration &T); - - /** - */ - BoardConfiguration & operator=(const BoardConfiguration &T); - /**Saves the board info to a file - */ - void saveToFile(string sfile)throw (cv::Exception); - /**Reads board info from a file - */ - void readFromFile(string sfile)throw (cv::Exception); - /**Indicates if the corners are expressed in meters - */ - bool isExpressedInMeters()const { - return mInfoType==METERS; - } - /**Indicates if the corners are expressed in meters - */ - bool isExpressedInPixels()const { - return mInfoType==PIX; - } - /**Returns the index of the marker with id indicated, if is in the list - */ - int getIndexOfMarkerId(int id)const; - /**Returns the Info of the marker with id specified. If not in the set, throws exception - */ - const MarkerInfo& getMarkerInfo(int id)const throw (cv::Exception); - /**Set in the list passed the set of the ids - */ - void getIdList(vector &ids,bool append=true)const; -private: - /**Saves the board info to a file - */ - void saveToFile(cv::FileStorage &fs)throw (cv::Exception); - /**Reads board info from a file - */ - void readFromFile(cv::FileStorage &fs)throw (cv::Exception); -}; - -/** -*/ -class ARUCO_EXPORTS Board:public vector -{ - -public: - BoardConfiguration conf; - //matrices of rotation and translation respect to the camera - cv::Mat Rvec,Tvec; - /** - */ - Board() - { - Rvec.create(3,1,CV_32FC1); - Tvec.create(3,1,CV_32FC1); - for (int i=0;i<3;i++) - Tvec.at(i,0)=Rvec.at(i,0)=-999999; - } - - /**Given the extrinsic camera parameters returns the GL_MODELVIEW matrix for opengl. - * Setting this matrix, the reference corrdinate system will be set in this board - */ - void glGetModelViewMatrix(double modelview_matrix[16])throw(cv::Exception); - - /** - * Returns position vector and orientation quaternion for an Ogre scene node or entity. - * Use: - * ... - * Ogre::Vector3 ogrePos (position[0], position[1], position[2]); - * Ogre::Quaternion ogreOrient (orientation[0], orientation[1], orientation[2], orientation[3]); - * mySceneNode->setPosition( ogrePos ); - * mySceneNode->setOrientation( ogreOrient ); - * ... - */ - void OgreGetPoseParameters( double position[3], double orientation[4] )throw(cv::Exception); - - - /**Save this from a file - */ - void saveToFile(string filePath)throw(cv::Exception); - /**Read this from a file - */ - void readFromFile(string filePath)throw(cv::Exception); - -}; -} - -#endif diff --git a/ftnoir_tracker_aruco/include/boarddetector.h b/ftnoir_tracker_aruco/include/boarddetector.h deleted file mode 100644 index 4770b5c9..00000000 --- a/ftnoir_tracker_aruco/include/boarddetector.h +++ /dev/null @@ -1,139 +0,0 @@ -/***************************** -Copyright 2011 Rafael Muñoz Salinas. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of - conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list - of conditions and the following disclaimer in the documentation and/or other materials - provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those of the -authors and should not be interpreted as representing official policies, either expressed -or implied, of Rafael Muñoz Salinas. -********************************/ -#ifndef _Aruco_BoardDetector_H -#define _Aruco_BoardDetector_H -#include -#include "exports.h" -#include "board.h" -#include "cameraparameters.h" -#include "markerdetector.h" -using namespace std; - -namespace aruco -{ - -/**\brief This class detects AR boards - * Version 1.2 - * There are two modes for board detection. - * First, the old way. (You first detect markers with MarkerDetector and then call to detect in this class. - * - * Second: New mode, marker detection is included in the class - * \code - - CameraParameters CP; - CP.readFromFile(path_cp) - BoardConfiguration BC; - BC.readFromFile(path_bc); - BoardDetector BD; - BD.setParams(BC,CP); //or only BD.setParams(BC) - //capture image - cv::Mat im; - capture_image(im); - - float prob=BD.detect(im); - if (prob>0.3) - CvDrawingUtils::draw3DAxis(im,BD.getDetectedBoard(),CP); - - \endcode - * -*/ -class ARUCO_EXPORTS BoardDetector -{ -public: - /** See discussion in @see enableRotateXAxis. - * Do not change unless you know what you are doing - */ - BoardDetector(bool setYPerperdicular=true); - - - /** - * Use if you plan to let this class to perform marker detection too - */ - void setParams(const BoardConfiguration &bc,const CameraParameters &cp, float markerSizeMeters=-1); - void setParams(const BoardConfiguration &bc); - /** - * Detect markers, and then, look for the board indicated in setParams() - * @return value indicating the likelihood of having found the marker - */ - float detect(const cv::Mat &im)throw (cv::Exception); - /**Returns a reference to the board detected - */ - Board & getDetectedBoard(){return _boardDetected;} - /**Returns a reference to the internal marker detector - */ - MarkerDetector &getMarkerDetector(){return _mdetector;} - /**Returns the vector of markers detected - */ - vector &getDetectedMarkers(){return _vmarkers;} - - - //ALTERNATIVE DETECTION METHOD, BASED ON MARKERS PREVIOUSLY DETECTED - - /** Given the markers detected, determines if there is the board passed - * @param detectedMarkers result provided by aruco::ArMarkerDetector - * @param BConf the board you want to see if is present - * @param Bdetected output information of the detected board - * @param camMatrix camera matrix with intrinsics - * @param distCoeff camera distorsion coeff - * @param camMatrix intrinsic camera information. - * @param distCoeff camera distorsion coefficient. If set Mat() if is assumed no camera distorion - * @param markerSizeMeters size of the marker sides expressed in meters - * @return value indicating the likelihood of having found the marker - */ - float detect(const vector &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected, cv::Mat camMatrix=cv::Mat(),cv::Mat distCoeff=cv::Mat(), float markerSizeMeters=-1 )throw (cv::Exception); - float detect(const vector &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected,const CameraParameters &cp, float markerSizeMeters=-1 )throw (cv::Exception); - - - /** - * By default, the Y axis is set to point up. However this is not the default - * operation mode of opencv, which produces the Z axis pointing up instead. - * So, to achieve this change, we have to rotate the X axis. - */ - void setYPerperdicular(bool enable){_setYPerperdicular=enable;} - - - - -private: - void rotateXAxis(cv::Mat &rotation); - bool _setYPerperdicular; - - //-- Functionality to detect markers inside - bool _areParamsSet; - BoardConfiguration _bconf; - Board _boardDetected; - float _markerSize; - CameraParameters _camParams; - MarkerDetector _mdetector;//internal markerdetector - vector _vmarkers;//markers detected in the call to : float detect(const cv::Mat &im); - -}; - -} -#endif - diff --git a/ftnoir_tracker_aruco/include/cameraparameters.h b/ftnoir_tracker_aruco/include/cameraparameters.h index c3381a74..a419afbe 100644 --- a/ftnoir_tracker_aruco/include/cameraparameters.h +++ b/ftnoir_tracker_aruco/include/cameraparameters.h @@ -28,7 +28,7 @@ or implied, of Rafael Muñoz Salinas. #ifndef _Aruco_CameraParameters_H #define _Aruco_CameraParameters_H #include "exports.h" -#include +#include #include using namespace std; namespace aruco @@ -105,7 +105,7 @@ public: * @param invert: indicates if the output projection matrix has to yield a horizontally inverted image because image data has not been stored in the order of glDrawPixels: bottom-to-top. */ void glGetProjectionMatrix( cv::Size orgImgSize, cv::Size size,double proj_matrix[16],double gnear,double gfar,bool invert=false )throw(cv::Exception); - + /** * setup camera for an Ogre project. * Use: @@ -117,7 +117,7 @@ public: * As in OpenGL, it assumes no camera distorsion */ void OgreGetProjectionMatrix( cv::Size orgImgSize, cv::Size size,double proj_matrix[16],double gnear,double gfar,bool invert=false )throw(cv::Exception); - + private: //GL routines diff --git a/ftnoir_tracker_aruco/include/cvdrawingutils.h b/ftnoir_tracker_aruco/include/cvdrawingutils.h index 38e9986e..24bfe630 100644 --- a/ftnoir_tracker_aruco/include/cvdrawingutils.h +++ b/ftnoir_tracker_aruco/include/cvdrawingutils.h @@ -33,19 +33,12 @@ namespace aruco { /**\brief A set of functions to draw in opencv images */ - class ARUCO_EXPORTS CvDrawingUtils - { - public: - - static void draw3dAxis(cv::Mat &Image,Marker &m,const CameraParameters &CP); - - static void draw3dCube(cv::Mat &Image,Marker &m,const CameraParameters &CP); - - static void draw3dAxis(cv::Mat &Image,Board &m,const CameraParameters &CP); - - static void draw3dCube(cv::Mat &Image,Board &m,const CameraParameters &CP); - - }; + class ARUCO_EXPORTS CvDrawingUtils + { + public: + static void draw3dAxis(cv::Mat &Image,Marker &m,const CameraParameters &CP); + static void draw3dCube(cv::Mat &Image,Marker &m,const CameraParameters &CP); + }; } #endif diff --git a/ftnoir_tracker_aruco/include/exports.h b/ftnoir_tracker_aruco/include/exports.h index 154605ec..044a1367 100644 --- a/ftnoir_tracker_aruco/include/exports.h +++ b/ftnoir_tracker_aruco/include/exports.h @@ -25,7 +25,7 @@ The views and conclusions contained in the software and documentation are those authors and should not be interpreted as representing official policies, either expressed or implied, of Rafael Muñoz Salinas. ********************************/ - + #ifndef __OPENARUCO_CORE_TYPES_H__ @@ -37,9 +37,9 @@ or implied, of Rafael Muñoz Salinas. #if (defined WIN32 || defined _WIN32 || defined WINCE) && defined DSO_EXPORTS - #define ARUCO_EXPORTS __declspec(dllexport) + #define ARUCO_EXPORTS __declspec(dllexport) __attribute__((visibility ("default"))) #else - #define ARUCO_EXPORTS + #define ARUCO_EXPORTS __attribute__((visibility ("default"))) #endif diff --git a/ftnoir_tracker_aruco/include/marker.h b/ftnoir_tracker_aruco/include/marker.h index dc6bb28c..89961002 100644 --- a/ftnoir_tracker_aruco/include/marker.h +++ b/ftnoir_tracker_aruco/include/marker.h @@ -29,7 +29,7 @@ or implied, of Rafael Muñoz Salinas. #define _Aruco_Marker_H #include #include -#include +#include #include "exports.h" #include "cameraparameters.h" using namespace std; @@ -81,12 +81,12 @@ public: * @param setYPerperdicular If set the Y axis will be perpendicular to the surface. Otherwise, it will be the Z axis */ void calculateExtrinsics(float markerSize,cv::Mat CameraMatrix,cv::Mat Distorsion=cv::Mat(),bool setYPerperdicular=true)throw(cv::Exception); - + /**Given the extrinsic camera parameters returns the GL_MODELVIEW matrix for opengl. * Setting this matrix, the reference coordinate system will be set in this marker */ void glGetModelViewMatrix( double modelview_matrix[16])throw(cv::Exception); - + /** * Returns position vector and orientation quaternion for an Ogre scene node or entity. * Use: @@ -97,8 +97,8 @@ public: * mySceneNode->setOrientation( ogreOrient ); * ... */ - void OgreGetPoseParameters( double position[3], double orientation[4] )throw(cv::Exception); - + void OgreGetPoseParameters( double position[3], double orientation[4] )throw(cv::Exception); + /**Returns the centroid of the marker */ cv::Point2f getCenter()const; @@ -132,11 +132,11 @@ public: return str; } - - + + private: void rotateXAxis(cv::Mat &rotation); - + }; } diff --git a/ftnoir_tracker_aruco/include/markerdetector.h b/ftnoir_tracker_aruco/include/markerdetector.h index 4d6e7b90..a4656527 100644 --- a/ftnoir_tracker_aruco/include/markerdetector.h +++ b/ftnoir_tracker_aruco/include/markerdetector.h @@ -27,7 +27,7 @@ or implied, of Rafael Muñoz Salinas. ********************************/ #ifndef _ARUCO_MarkerDetector_H #define _ARUCO_MarkerDetector_H -#include +#include #include #include #include "cameraparameters.h" @@ -47,7 +47,7 @@ class ARUCO_EXPORTS MarkerDetector class MarkerCandidate: public Marker{ public: MarkerCandidate(){} - MarkerCandidate(const Marker &M): Marker(M){} + MarkerCandidate(const Marker &M): Marker(M){} MarkerCandidate(const MarkerCandidate &M): Marker(M){ contour=M.contour; idx=M.idx; @@ -60,20 +60,20 @@ class ARUCO_EXPORTS MarkerDetector idx=M.idx; return M; } - + vector contour;//all the points of its contour int idx;//index position in the global contour list }; public: /** - * See + * See */ - MarkerDetector(); + MarkerDetector() {} /** */ - ~MarkerDetector(); + ~MarkerDetector() {} /**Detects the markers in the image passed * @@ -161,17 +161,17 @@ public: * of cols and rows. * @param min size of the contour to consider a possible marker as valid (0,1] * @param max size of the contour to consider a possible marker as valid [0,1) - * + * */ void setMinMaxSize(float min=0.03,float max=0.5)throw(cv::Exception); - + /**reads the min and max sizes employed * @param min output size of the contour to consider a possible marker as valid (0,1] * @param max output size of the contour to consider a possible marker as valid [0,1) - * + * */ void getMinMaxSize(float &min,float &max){min=_minSize;max=_maxSize;} - + /**Enables/Disables erosion process that is REQUIRED for chessboard like boards. * By default, this property is enabled */ @@ -210,10 +210,10 @@ public: markerIdDetector_ptrfunc=markerdetector_func; } - /** Use an smaller version of the input image for marker detection. + /** Use an smaller version of the input image for marker detection. * If your marker is small enough, you can employ an smaller image to perform the detection without noticeable reduction in the precision. * Internally, we are performing a pyrdown operation - * + * * @param level number of times the image size is divided by 2. Internally, we are performing a pyrdown. */ void pyrDown(unsigned int level){pyrdown_level=level;} @@ -247,17 +247,17 @@ public: * @return true if the operation succeed */ bool warp(cv::Mat &in,cv::Mat &out,cv::Size size, std::vector points)throw (cv::Exception); - - - + + + /** Refine MarkerCandidate Corner using LINES method * @param candidate candidate to refine corners */ - void refineCandidateLines(MarkerCandidate &candidate); - - + void refineCandidateLines(MarkerCandidate &candidate); + + /**DEPRECATED!!! Use the member function in CameraParameters - * + * * Given the intrinsic camera parameters returns the GL_PROJECTION matrix for opengl. * PLease NOTE that when using OpenGL, it is assumed no camera distorsion! So, if it is not true, you should have * undistor image @@ -308,26 +308,26 @@ private: */ int perimeter(std::vector &a); - + // //GL routines -// +// // static void argConvGLcpara2( double cparam[3][4], int width, int height, double gnear, double gfar, double m[16], bool invert )throw(cv::Exception); // static int arParamDecompMat( double source[3][4], double cpara[3][4], double trans[3][4] )throw(cv::Exception); // static double norm( double a, double b, double c ); // static double dot( double a1, double a2, double a3, // double b1, double b2, double b3 ); -// +// //detection of the void findBestCornerInRegion_harris(const cv::Mat & grey,vector & Corners,int blockSize); - - + + // auxiliar functions to perform LINES refinement void interpolate2Dline( const vector< cv::Point > &inPoints, cv::Point3f &outLine); - cv::Point2f getCrossPoint(const cv::Point3f& line1, const cv::Point3f& line2); - - - /**Given a vector vinout with elements and a boolean vector indicating the lements from it to remove, + cv::Point2f getCrossPoint(const cv::Point3f& line1, const cv::Point3f& line2); + + + /**Given a vector vinout with elements and a boolean vector indicating the lements from it to remove, * this function remove the elements * @param vinout * @param toRemove diff --git a/ftnoir_tracker_aruco/trans_calib.h b/ftnoir_tracker_aruco/trans_calib.h index 5c321b2c..c2c02b38 100644 --- a/ftnoir_tracker_aruco/trans_calib.h +++ b/ftnoir_tracker_aruco/trans_calib.h @@ -8,7 +8,7 @@ #ifndef TRANSCALIB_H #define TRANSCALIB_H -#include +#include //----------------------------------------------------------------------------- // Calibrates the translation from head to model = t_MH diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/camera.h index 7ebbcb67..889bf2d3 100644 --- a/ftnoir_tracker_pt/camera.h +++ b/ftnoir_tracker_pt/camera.h @@ -8,7 +8,7 @@ #ifndef CAMERA_H #define CAMERA_H -#include +#include #ifndef OPENTRACK_API # include #else diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 5bcfd37d..fff8d4ab 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #ifndef OPENTRACK_API # include @@ -36,53 +36,53 @@ class Tracker : public ITracker, protected QThread { public: - Tracker(); + Tracker(); ~Tracker() override; void StartTracker(QFrame* parent_window) override; void GetHeadPoseData(double* data) override; void apply(settings& s); - void apply_inner(); - void center(); - void reset(); // reset the trackers internal state variables + void apply_inner(); + void center(); + void reset(); // reset the trackers internal state variables - void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); } - int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); } - void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); } + void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); } + int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); } + void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); } protected: void run() override; private: - QMutex mutex; - // thread commands - enum Command { - ABORT = 1<<0 - }; - void set_command(Command command); - void reset_command(Command command); + QMutex mutex; + // thread commands + enum Command { + ABORT = 1<<0 + }; + void set_command(Command command); + void reset_command(Command command); volatile int commands; CVCamera camera; - FrameRotation frame_rotation; - PointExtractor point_extractor; - PointTracker point_tracker; + FrameRotation frame_rotation; + PointExtractor point_extractor; + PointTracker point_tracker; - FrameTrafo X_GH_0; // for centering - cv::Vec3f t_MH; // translation from model frame to head frame - cv::Matx33f R_GC; // rotation from opengl reference frame to camera frame + FrameTrafo X_GH_0; // for centering + cv::Vec3f t_MH; // translation from model frame to head frame + cv::Matx33f R_GC; // rotation from opengl reference frame to camera frame - // --- ui --- - cv::Mat frame; // the output frame for display + // --- ui --- + cv::Mat frame; // the output frame for display PTVideoWidget* video_widget; - QFrame* video_frame; - + QFrame* video_frame; + settings s; std::atomic new_settings; Timer time; - + static constexpr double rad2deg = 180.0/3.14159265; static constexpr double deg2rad = 3.14159265/180.0; - + PointModel model; }; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index 6cd6135c..3af7b560 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #ifndef OPENTRACK_API # include #else @@ -25,14 +25,14 @@ TrackerDialog::TrackerDialog() timer(this), trans_calib_running(false) { - ui.setupUi( this ); + ui.setupUi( this ); vector device_names; - get_camera_device_names(device_names); + get_camera_device_names(device_names); for (vector::iterator iter = device_names.begin(); iter != device_names.end(); ++iter) - { - ui.camdevice_combo->addItem(iter->c_str()); - } + { + ui.camdevice_combo->addItem(iter->c_str()); + } ui.camroll_combo->addItem("-90"); ui.camroll_combo->addItem("0"); @@ -82,7 +82,7 @@ TrackerDialog::TrackerDialog() connect(ui.model_tabs, SIGNAL(currentChanged(int)), this, SLOT(set_model(int))); connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); - timer.start(100); + timer.start(100); connect(ui.buttonBox_2, SIGNAL(clicked(QAbstractButton*)), this, SLOT(do_apply_without_saving(QAbstractButton*))); } @@ -96,7 +96,7 @@ void TrackerDialog::set_model_clip() s.m02_y = -static_cast(s.clip_by); s.m02_z = -static_cast(s.clip_bz); - settings_changed(); + settings_changed(); } void TrackerDialog::set_model_cap() @@ -108,12 +108,12 @@ void TrackerDialog::set_model_cap() s.m02_y = -static_cast(s.cap_y); s.m02_z = -static_cast(s.cap_z); - settings_changed(); + settings_changed(); } void TrackerDialog::set_model_custom() { - settings_changed(); + settings_changed(); } void TrackerDialog::set_model(int val) @@ -123,38 +123,38 @@ void TrackerDialog::set_model(int val) void TrackerDialog::startstop_trans_calib(bool start) { - if (start) - { - qDebug()<<"TrackerDialog:: Starting translation calibration"; - trans_calib.reset(); - trans_calib_running = true; - } - else - { - qDebug()<<"TrackerDialog:: Stoppping translation calibration"; - trans_calib_running = false; + if (start) + { + qDebug()<<"TrackerDialog:: Starting translation calibration"; + trans_calib.reset(); + trans_calib_running = true; + } + else + { + qDebug()<<"TrackerDialog:: Stoppping translation calibration"; + trans_calib_running = false; { auto tmp = trans_calib.get_estimate(); s.t_MH_x = tmp[0]; s.t_MH_y = tmp[1]; s.t_MH_z = tmp[2]; } - settings_changed(); - } + settings_changed(); + } } void TrackerDialog::poll_tracker_info() { if (tracker) - { + { QString to_print; - + // display caminfo CamInfo info; tracker->get_cam_info(&info); to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS"; ui.caminfo_label->setText(to_print); - + // display pointinfo int n_points = tracker->get_n_points(); to_print = QString::number(n_points); @@ -163,7 +163,7 @@ void TrackerDialog::poll_tracker_info() else to_print += " BAD!"; ui.pointinfo_label->setText(to_print); - + // update calibration if (trans_calib_running) trans_calib_step(); } @@ -177,16 +177,16 @@ void TrackerDialog::poll_tracker_info() void TrackerDialog::trans_calib_step() { - if (tracker) - { - FrameTrafo X_CM; - tracker->get_pose(&X_CM); - trans_calib.update(X_CM.R, X_CM.t); - cv::Vec3f t_MH = trans_calib.get_estimate(); + if (tracker) + { + FrameTrafo X_CM; + tracker->get_pose(&X_CM); + trans_calib.update(X_CM.R, X_CM.t); + cv::Vec3f t_MH = trans_calib.get_estimate(); s.t_MH_x = t_MH[0]; s.t_MH_y = t_MH[1]; s.t_MH_z = t_MH[2]; - } + } } void TrackerDialog::settings_changed() @@ -203,7 +203,7 @@ void TrackerDialog::save() void TrackerDialog::doOK() { save(); - close(); + close(); } void TrackerDialog::do_apply_without_saving(QAbstractButton*) @@ -225,7 +225,7 @@ void TrackerDialog::do_apply_without_saving(QAbstractButton*) void TrackerDialog::doApply() { - save(); + save(); } void TrackerDialog::doCancel() @@ -236,23 +236,23 @@ void TrackerDialog::doCancel() void TrackerDialog::registerTracker(ITracker *t) { - qDebug()<<"TrackerDialog:: Tracker registered"; - tracker = static_cast(t); + qDebug()<<"TrackerDialog:: Tracker registered"; + tracker = static_cast(t); if (isVisible() & s.b->modifiedp()) tracker->apply(s); - ui.tcalib_button->setEnabled(true); - //ui.center_button->setEnabled(true); + ui.tcalib_button->setEnabled(true); + //ui.center_button->setEnabled(true); } void TrackerDialog::unRegisterTracker() { - qDebug()<<"TrackerDialog:: Tracker un-registered"; - tracker = NULL; - ui.tcalib_button->setEnabled(false); - //ui.center_button->setEnabled(false); + qDebug()<<"TrackerDialog:: Tracker un-registered"; + tracker = NULL; + ui.tcalib_button->setEnabled(false); + //ui.center_button->setEnabled(false); } extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( ) { - return new TrackerDialog; + return new TrackerDialog; } diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index 365776e4..e8cac679 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -8,7 +8,7 @@ #ifndef FTNOIR_TRACKER_PT_SETTINGS_H #define FTNOIR_TRACKER_PT_SETTINGS_H -#include +#include #include "point_tracker.h" #include "facetracknoir/options.h" @@ -36,7 +36,7 @@ struct settings value clip_ty, clip_tz, clip_by, clip_bz; value active_model_panel, cap_x, cap_y, cap_z; - + // XXX todo red channel only, good for crapola CCD sensors -sh 20140922 settings() : diff --git a/ftnoir_tracker_pt/point_extractor.h b/ftnoir_tracker_pt/point_extractor.h index 3ef82900..5252b68d 100644 --- a/ftnoir_tracker_pt/point_extractor.h +++ b/ftnoir_tracker_pt/point_extractor.h @@ -8,8 +8,8 @@ #ifndef POINTEXTRACTOR_H #define POINTEXTRACTOR_H -#include -#include +#include +#include // ---------------------------------------------------------------------------- // Extracts points from an opencv image diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index c8212538..d65494a4 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -8,7 +8,7 @@ #ifndef POINTTRACKER_H #define POINTTRACKER_H -#include +#include #ifndef OPENTRACK_API # include #else @@ -21,31 +21,31 @@ class FrameTrafo { public: - FrameTrafo() : R(cv::Matx33f::eye()), t(0,0,0) {} - FrameTrafo(const cv::Matx33f& R, const cv::Vec3f& t) : R(R),t(t) {} + FrameTrafo() : R(cv::Matx33f::eye()), t(0,0,0) {} + FrameTrafo(const cv::Matx33f& R, const cv::Vec3f& t) : R(R),t(t) {} - cv::Matx33f R; - cv::Vec3f t; + cv::Matx33f R; + cv::Vec3f t; }; inline FrameTrafo operator*(const FrameTrafo& X, const FrameTrafo& Y) { - return FrameTrafo(X.R*Y.R, X.R*Y.t + X.t); + return FrameTrafo(X.R*Y.R, X.R*Y.t + X.t); } inline FrameTrafo operator*(const cv::Matx33f& X, const FrameTrafo& Y) { - return FrameTrafo(X*Y.R, X*Y.t); + return FrameTrafo(X*Y.R, X*Y.t); } inline FrameTrafo operator*(const FrameTrafo& X, const cv::Matx33f& Y) { - return FrameTrafo(X.R*Y, X.t); + return FrameTrafo(X.R*Y, X.t); } inline cv::Vec3f operator*(const FrameTrafo& X, const cv::Vec3f& v) { - return X.R*v + X.t; + return X.R*v + X.t; } @@ -55,28 +55,28 @@ inline cv::Vec3f operator*(const FrameTrafo& X, const cv::Vec3f& v) // [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] class PointModel { - friend class PointTracker; + friend class PointTracker; public: - static constexpr int N_POINTS = 3; + static constexpr int N_POINTS = 3; - PointModel(cv::Vec3f M01, cv::Vec3f M02); + PointModel(cv::Vec3f M01, cv::Vec3f M02); PointModel(); - inline const cv::Vec3f& get_M01() const { return M01; } - inline const cv::Vec3f& get_M02() const { return M02; } + inline const cv::Vec3f& get_M01() const { return M01; } + inline const cv::Vec3f& get_M02() const { return M02; } private: - cv::Vec3f M01; // M01 in model frame - cv::Vec3f M02; // M02 in model frame + cv::Vec3f M01; // M01 in model frame + cv::Vec3f M02; // M02 in model frame - cv::Vec3f u; // unit vector perpendicular to M01,M02-plane + cv::Vec3f u; // unit vector perpendicular to M01,M02-plane - cv::Matx22f P; + cv::Matx22f P; - cv::Vec2f d; // determinant vector for point correspondence - int d_order[3]; // sorting of projected model points with respect to d scalar product + cv::Vec2f d; // determinant vector for point correspondence + int d_order[3]; // sorting of projected model points with respect to d scalar product - void get_d_order(const std::vector& points, int d_order[]) const; + void get_d_order(const std::vector& points, int d_order[]) const; }; // ---------------------------------------------------------------------------- @@ -86,29 +86,29 @@ private: class PointTracker { public: - PointTracker(); - // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) - // f : (focal length)/(sensor width) - // dt : time since last call - void track(const std::vector& projected_points, const PointModel& model); - FrameTrafo get_pose() const { return X_CM; } - void reset(); + PointTracker(); + // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) + // f : (focal length)/(sensor width) + // dt : time since last call + void track(const std::vector& projected_points, const PointModel& model); + FrameTrafo get_pose() const { return X_CM; } + void reset(); private: // the points in model order typedef struct { cv::Vec2f points[PointModel::N_POINTS]; } PointOrder; - static constexpr float focal_length = 1.0f; - - inline cv::Vec2f project(const cv::Vec3f& v_M) - { - cv::Vec3f v_C = X_CM * v_M; - return cv::Vec2f(focal_length*v_C[0]/v_C[2], focal_length*v_C[1]/v_C[2]); - } + static constexpr float focal_length = 1.0f; + + inline cv::Vec2f project(const cv::Vec3f& v_M) + { + cv::Vec3f v_C = X_CM * v_M; + return cv::Vec2f(focal_length*v_C[0]/v_C[2], focal_length*v_C[1]/v_C[2]); + } PointOrder find_correspondences(const std::vector& projected_points, const PointModel &model); int POSIT(const PointModel& point_model, const PointOrder& order); // The POSIT algorithm, returns the number of iterations - - FrameTrafo X_CM; // trafo from model to camera + + FrameTrafo X_CM; // trafo from model to camera }; #endif //POINTTRACKER_H diff --git a/ftnoir_tracker_pt/pt_video_widget.h b/ftnoir_tracker_pt/pt_video_widget.h index de2c7efb..f2b41d63 100644 --- a/ftnoir_tracker_pt/pt_video_widget.h +++ b/ftnoir_tracker_pt/pt_video_widget.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #ifndef OPENTRACK_API # include # include diff --git a/ftnoir_tracker_pt/trans_calib.h b/ftnoir_tracker_pt/trans_calib.h index 5c321b2c..c2c02b38 100644 --- a/ftnoir_tracker_pt/trans_calib.h +++ b/ftnoir_tracker_pt/trans_calib.h @@ -8,7 +8,7 @@ #ifndef TRANSCALIB_H #define TRANSCALIB_H -#include +#include //----------------------------------------------------------------------------- // Calibrates the translation from head to model = t_MH -- cgit v1.2.3 From f4754d23984126de847279f4abad4ae713d9e386 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 5 Oct 2014 19:55:05 +0200 Subject: flush and push --- .../README-CREDIT.txt | 6 - .../ft_tester/Makefile.am | 54 --- .../ft_tester/Makefile.in | 491 -------------------- .../ft_tester/fttester.rc.in | 67 --- .../ft_tester/main.cpp | 211 --------- .../ft_tester/resource.h | 27 -- .../important-stuff/NPClient.h | 17 - .../important-stuff/NPClient.spec | 23 - .../important-stuff/NPClient_dll.h | 58 --- .../important-stuff/NPClient_main.c | 444 ------------------ .../important-stuff/game_data.c | 149 ------ .../important-stuff/game_data.h | 17 - .../tester/Makefile.am | 78 ---- .../tester/Makefile.in | 512 --------------------- .../tester/main.cpp | 100 ---- .../tester/npifc.c | 302 ------------ .../tester/npifc.h | 66 --- .../tester/npview.rc.in | 49 -- .../tester/resource.h | 23 - .../tester/rest.c | 1 - .../tester/rest.h | 1 - facetracknoir/clientfiles/make-csv.pl | 72 +++ .../very-important-source-code/README-CREDIT.txt | 6 + .../ft_tester/Makefile.am | 54 +++ .../ft_tester/Makefile.in | 491 ++++++++++++++++++++ .../ft_tester/fttester.rc.in | 67 +++ .../very-important-source-code/ft_tester/main.cpp | 211 +++++++++ .../ft_tester/resource.h | 27 ++ .../important-stuff/NPClient.h | 17 + .../important-stuff/NPClient.spec | 23 + .../important-stuff/NPClient_dll.h | 58 +++ .../important-stuff/NPClient_main.c | 444 ++++++++++++++++++ .../important-stuff/game_data.c | 150 ++++++ .../important-stuff/game_data.h | 17 + .../very-important-source-code/tester/Makefile.am | 78 ++++ .../very-important-source-code/tester/Makefile.in | 512 +++++++++++++++++++++ .../very-important-source-code/tester/main.cpp | 100 ++++ .../very-important-source-code/tester/npifc.c | 302 ++++++++++++ .../very-important-source-code/tester/npifc.h | 66 +++ .../very-important-source-code/tester/npview.rc.in | 49 ++ .../very-important-source-code/tester/resource.h | 23 + .../very-important-source-code/tester/rest.c | 1 + .../very-important-source-code/tester/rest.h | 1 + facetracknoir/plugin-qt-api.hpp | 1 - facetracknoir/pose.hpp | 66 +++ facetracknoir/quat.hpp | 26 +- facetracknoir/tracker.cpp | 40 +- facetracknoir/tracker.h | 9 +- facetracknoir/tracker_types.h | 66 --- freetrackclient/build-msvc.sh | 33 ++ freetrackclient/freetrackclient.c | 4 + ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 11 +- ftnoir_tracker_aruco/include/aruco.h | 29 +- ftnoir_tracker_aruco/include/arucofidmarkers.h | 15 +- ftnoir_tracker_aruco/include/board.h | 168 +++++++ ftnoir_tracker_aruco/include/boarddetector.h | 139 ++++++ ftnoir_tracker_aruco/include/cvdrawingutils.h | 21 +- ftnoir_tracker_aruco/include/exports.h | 4 +- ftnoir_tracker_aruco/include/markerdetector.h | 16 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 19 +- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 33 +- 61 files changed, 3289 insertions(+), 2876 deletions(-) delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h delete mode 120000 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c delete mode 120000 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h create mode 100755 facetracknoir/clientfiles/make-csv.pl create mode 100644 facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt create mode 100644 facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am create mode 100644 facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in create mode 100644 facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in create mode 100644 facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp create mode 100644 facetracknoir/clientfiles/very-important-source-code/ft_tester/resource.h create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.h create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.spec create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_dll.h create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_main.c create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/main.cpp create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/npifc.c create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/npifc.h create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/resource.h create mode 120000 facetracknoir/clientfiles/very-important-source-code/tester/rest.c create mode 120000 facetracknoir/clientfiles/very-important-source-code/tester/rest.h create mode 100644 facetracknoir/pose.hpp delete mode 100644 facetracknoir/tracker_types.h create mode 100644 freetrackclient/build-msvc.sh create mode 100644 ftnoir_tracker_aruco/include/board.h create mode 100644 ftnoir_tracker_aruco/include/boarddetector.h (limited to 'facetracknoir/tracker_types.h') diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt b/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt deleted file mode 100644 index 82214139..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt +++ /dev/null @@ -1,6 +0,0 @@ -The contents of the directory written by one and only, uglyDwarf. - -Obtained at epoch time 1412397452 from the mithril-mine's shaft, where -the elite dwarves reside. - -For the latest happenings, visit diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am deleted file mode 100644 index 02747edb..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -noinst_SCRIPTS = -if WINE_PLUGIN - noinst_SCRIPTS += ftc.exe.so -endif #WINE_PLUGIN - -if DARWIN - LDFLAGS += -Wl,-no_arch_warnings -else - LDFLAGS += -Wl,--no-warn-search-mismatch -endif - -CC = winegcc - -CXX = wineg++ - -SUFFIXES = .o .cpp .c .rc - -.cpp.o : - $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< - -CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ -CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ -RCFLAGS = -I @srcdir@ -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - -ftc.exe.so : main.o fttester.o - wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -fttester.o : fttester.rc resource.h config.h - -main.o : main.cpp - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -EXTRA_DIST = resource.h fttester.rc main.cpp - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in deleted file mode 100644 index d1fff34d..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in +++ /dev/null @@ -1,491 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@WINE_PLUGIN_TRUE@am__append_1 = ftc.exe.so -@DARWIN_TRUE@am__append_2 = -Wl,-no_arch_warnings -@DARWIN_FALSE@am__append_3 = -Wl,--no-warn-search-mismatch -subdir = src/wine_bridge/ft_tester -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(srcdir)/fttester.rc.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = fttester.rc -CONFIG_CLEAN_VPATH_FILES = -SCRIPTS = $(noinst_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -depcomp = -am__depfiles_maybe = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON = @BISON@ -CC = winegcc -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = wineg++ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ $(am__append_2) $(am__append_3) -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIB32DIR = @LIB32DIR@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJC = @OBJC@ -OBJCFLAGS = @OBJCFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPENCV_CFLAGS = @OPENCV_CFLAGS@ -OPENCV_LIBS = @OPENCV_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -QMAKE_PATH = @QMAKE_PATH@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -WINE64_LIBS = @WINE64_LIBS@ -WINE_LIBS = @WINE_LIBS@ -XPL_CPPFLAGS = @XPL_CPPFLAGS@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_OBJC = @ac_ct_OBJC@ -am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -with_makensis = @with_makensis@ -with_wine64 = @with_wine64@ -noinst_SCRIPTS = $(am__append_1) -SUFFIXES = .o .cpp .c .rc -CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ -CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ -RCFLAGS = -I @srcdir@ -EXTRA_DIST = resource.h fttester.rc main.cpp -all: all-am - -.SUFFIXES: -.SUFFIXES: .o .cpp .c .rc -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -fttester.rc: $(top_builddir)/config.status $(srcdir)/fttester.rc.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(SCRIPTS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-local - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distclean-local distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am - - -.cpp.o : - $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - -ftc.exe.so : main.o fttester.o - wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -fttester.o : fttester.rc resource.h config.h - -main.o : main.cpp - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in deleted file mode 100644 index 332f3c73..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by ResEdit 1.5.9 -// Copyright (C) 2006-2011 -// http://www.resedit.net - -#include -#include -#include -#include "resource.h" - -#ifdef HAVE_CONFIG_H - #include "../../../config.h" -#endif - - - - -// -// Dialog resources -// -//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDD_DIALOG1 DIALOGEX 0, 0, 333, 183 -STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU -CAPTION "FreeTrack client test utility v@PACKAGE_VERSION@" -FONT 8, "Ms Shell Dlg", 400, 0, 1 -{ - DEFPUSHBUTTON "Quit", IDQUIT, 262, 153, 50, 14 - PUSHBUTTON "Start", IDC_START, 199, 153, 50, 14 - EDITTEXT IDC_YAW, 38, 15, 48, 14, ES_AUTOHSCROLL - RTEXT "Yaw", IDC_STATIC, 12, 17, 21, 14, SS_RIGHT - EDITTEXT IDC_PITCH, 38, 38, 48, 14, ES_AUTOHSCROLL - RTEXT "Pitch", IDC_STATIC, 16, 40, 17, 14, SS_RIGHT - EDITTEXT IDC_ROLL, 38, 61, 48, 14, ES_AUTOHSCROLL - RTEXT "Roll", IDC_STATIC, 20, 63, 13, 14, SS_RIGHT - EDITTEXT IDC_X, 38, 84, 48, 14, ES_AUTOHSCROLL - RTEXT "X", IDC_STATIC, 27, 86, 6, 14, SS_RIGHT - EDITTEXT IDC_Y, 38, 107, 48, 14, ES_AUTOHSCROLL - RTEXT "Y", IDC_STATIC, 27, 109, 6, 14, SS_RIGHT - EDITTEXT IDC_Z, 38, 130, 48, 14, ES_AUTOHSCROLL - RTEXT "Z", IDC_STATIC, 27, 132, 6, 14, SS_RIGHT - EDITTEXT IDC_RYAW, 137, 15, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Yaw", IDC_STATIC, 101, 17, 32, 8, SS_RIGHT - EDITTEXT IDC_RPITCH, 137, 38, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Pitch", IDC_STATIC, 99, 40, 34, 8, SS_RIGHT - EDITTEXT IDC_RROLL, 137, 61, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Roll", IDC_STATIC, 103, 63, 30, 8, SS_RIGHT - EDITTEXT IDC_RX, 137, 84, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw X", IDC_STATIC, 111, 86, 22, 8, SS_RIGHT - EDITTEXT IDC_RY, 137, 107, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Y", IDC_STATIC, 111, 109, 22, 8, SS_RIGHT - EDITTEXT IDC_RZ, 137, 130, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Z", IDC_STATIC, 111, 132, 22, 8, SS_RIGHT - EDITTEXT IDC_NUM, 264, 15, 48, 14, ES_AUTOHSCROLL - RTEXT "Frame Number", IDC_STATIC, 212, 17, 47, 8, SS_RIGHT - EDITTEXT IDC_RES, 264, 38, 48, 14, ES_AUTOHSCROLL - RTEXT "Camera Resolution", IDC_STATIC, 199, 40, 60, 8, SS_RIGHT - EDITTEXT IDC_PT0, 227, 61, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 1", IDC_STATIC, 199, 63, 23, 8, SS_RIGHT - EDITTEXT IDC_PT1, 227, 84, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 2", IDC_STATIC, 199, 86, 23, 8, SS_RIGHT - EDITTEXT IDC_PT2, 227, 107, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 3", IDC_STATIC, 199, 109, 23, 8, SS_RIGHT - EDITTEXT IDC_PT3, 227, 130, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 4", IDC_STATIC, 199, 132, 23, 8, SS_RIGHT - EDITTEXT IDC_TITLE, 38, 153, 147, 14, ES_AUTOHSCROLL - RTEXT "Title", IDC_STATIC, 19, 155, 14, 8, SS_RIGHT -} - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp deleted file mode 100644 index a737f88f..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp +++ /dev/null @@ -1,211 +0,0 @@ -#define WIN32_LEAN_AND_MEAN - -#include -#include -#include -#include -#include -#include - -#include "resource.h" - -HINSTANCE hInst; -UINT_PTR timer = 0; - -HMODULE ftclient; - -typedef struct -{ - unsigned int dataID; - int res_x; int res_y; - float yaw; // positive yaw to the left - float pitch;// positive pitch up - float roll;// positive roll to the left - float x; - float y; - float z; - // raw pose with no smoothing, sensitivity, response curve etc. - float ryaw; - float rpitch; - float rroll; - float rx; - float ry; - float rz; - // raw points, sorted by Y, origin top left corner - float x0, y0; - float x1, y1; - float x2, y2; - float x3, y3; -}FreeTrackData; - - -typedef bool (WINAPI *importGetData)(FreeTrackData * data); -typedef char *(WINAPI *importGetDllVersion)(void); -typedef void (WINAPI *importReportName)(char *name); -typedef char *(WINAPI *importProvider)(void); - -importGetData getData; -importGetDllVersion getDllVersion; -importReportName reportName; -importProvider provider; - - -char *client_path() -{ - HKEY hkey = 0; - RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Freetrack\\FreetrackClient", 0, - KEY_QUERY_VALUE, &hkey); - if(!hkey){ - printf("Can't open registry key\n"); - return NULL; - } - - BYTE path[1024]; - DWORD buf_len = 1024; - LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); - char *full_path = (char *)malloc(2048); - if(result == ERROR_SUCCESS && buf_len > 0){ - sprintf(full_path, "%s\\FreeTrackClient.dll", path); - } - RegCloseKey(hkey); - return full_path; -} - - -bool start(HWND hwnd) -{ - char *libname = client_path(); - if(libname == NULL){ - printf("Freetrack client not found!\n"); - return false; - } - ftclient = LoadLibrary(libname); - if(ftclient == NULL){ - printf("Couldn't load Freetrack client library '%s'!\n", libname); - return false; - } - printf("Freetrack client library %s loaded.\n", client_path()); - - - getData = (importGetData)GetProcAddress(ftclient, "FTGetData"); - getDllVersion = (importGetDllVersion)GetProcAddress(ftclient, "FTGetDllVersion"); - reportName = (importReportName)GetProcAddress(ftclient, "FTReportName"); - provider = (importProvider)GetProcAddress(ftclient, "FTProvider"); - - if((getData == NULL) || (getDllVersion == NULL) || (reportName == NULL) || (provider == NULL)){ - printf("Couldn't load Freetrack client functions!\n"); - FreeLibrary(ftclient); - return false; - } - - printf("Dll version: %s\n", getDllVersion()); - printf("Provider: %s\n", provider()); - char title[1024]; - GetDlgItemText(hwnd, IDC_TITLE, title, 1020); - reportName(title); - return true; -} - -void reportError(std::string msg) -{ - MessageBoxA(0, "FreeTrack client test", msg.c_str(), 0); -} -VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) -{ - (void) uMsg; - (void) idEvent; - (void) dwTime; - FreeTrackData d; - getData(&d); - SetDlgItemInt(hwnd, IDC_PITCH, d.pitch, true); - SetDlgItemInt(hwnd, IDC_ROLL, d.roll, true); - SetDlgItemInt(hwnd, IDC_YAW, d.yaw, true); - - SetDlgItemInt(hwnd, IDC_X, d.x, true); - SetDlgItemInt(hwnd, IDC_Y, d.y, true); - SetDlgItemInt(hwnd, IDC_Z, d.z, true); - - SetDlgItemInt(hwnd, IDC_RPITCH, d.rpitch, true); - SetDlgItemInt(hwnd, IDC_RROLL, d.rroll, true); - SetDlgItemInt(hwnd, IDC_RYAW, d.ryaw, true); - - SetDlgItemInt(hwnd, IDC_RX, d.rx, true); - SetDlgItemInt(hwnd, IDC_RY, d.ry, true); - SetDlgItemInt(hwnd, IDC_RZ, d.rz, true); - - std::ostringstream s; - s.str(std::string()); - s<<"("< -#include "rest.h" -//#include "config.h" -#define __WINESRC__ - -#include -#include -#include -#include -#include -#include -#include "windef.h" -#include "winbase.h" -#include "NPClient_dll.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(NPClient); - -bool crypted = false; -static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static int dbg_flag; - -static void dbg_report(const char *msg,...) -{ - static FILE *f = NULL; - if(dbg_flag){ - if(f == NULL){ - f = fopen("NPClient.log", "w"); - } - va_list ap; - va_start(ap,msg); - vfprintf(f, msg, ap); - fflush(f); - va_end(ap); - } -} - - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); - - switch (fdwReason) - { - case DLL_WINE_PREATTACH: - return TRUE; - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hinstDLL); - dbg_flag = getDebugFlag('w'); - dbg_report("Attach request\n"); - break; - case DLL_PROCESS_DETACH: - linuxtrack_shutdown(); - break; - } - - return TRUE; -} -/****************************************************************** - * NPPriv_ClientNotify (NPCLIENT.1) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_ClientNotify() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_GetLastError (NPCLIENT.2) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_GetLastError() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetData (NPCLIENT.3) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetData() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetLastError (NPCLIENT.4) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetLastError() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetParameter (NPCLIENT.5) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetParameter() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetSignature (NPCLIENT.6) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetSignature() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetVersion (NPCLIENT.7) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetVersion() -{ - /* @stub in .spec */ -} -#endif - -static float limit_num(float min, float val, float max) -{ - if(val < min) return min; - if(val > max) return max; - return val; -} - -static unsigned int cksum(unsigned char buf[], unsigned int size) -{ - if((size == 0) || (buf == NULL)){ - return 0; - } - - int rounds = size >> 2; - int rem = size % 4; - - int c = size; - int a0, a2; -// printf("Orig: "); -//for(a0 = 0; a0 < (int)size; ++a0) -//{ -// printf("%02X", buf[a0]); -//} -//printf("\n"); - while(rounds != 0){ - a0 = *(short int*)buf; - a2 = *(short int*)(buf+2); - buf += 4; - c += a0; - a2 ^= (c << 5); - a2 <<= 11; - c ^= a2; - c += (c >> 11); - --rounds; - } - switch(rem){ - case 3: - a0 = *(short int*)buf; - a2 = *(signed char*)(buf+2); - c += a0; - a2 = (a2 << 2) ^ c; - c ^= (a2 << 16); - a2 = (c >> 11); - break; - case 2: - a2 = *(short int*)buf; - c += a2; - c ^= (c << 11); - a2 = (c >> 17); - break; - case 1: - a2 = *(signed char*)(buf); - c += a2; - c ^= (c << 10); - a2 = (c >> 1); - break; - default: - break; - } - if(rem != 0){ - c+=a2; - } - - c ^= (c << 3); - c += (c >> 5); - c ^= (c << 4); - c += (c >> 17); - c ^= (c << 25); - c += (c >> 6); - - return (unsigned int)c; -} - -static void enhance(unsigned char buf[], unsigned int size, - unsigned char codetable[], unsigned int table_size) -{ - unsigned int table_ptr = 0; - unsigned char var = 0x88; - unsigned char tmp; - if((size <= 0) || (table_size <= 0) || - (buf == NULL) || (codetable == NULL)){ - return; - } - do{ - tmp = buf[--size]; - buf[size] = tmp ^ codetable[table_ptr] ^ var; - var += size + tmp; - ++table_ptr; - if(table_ptr >= table_size){ - table_ptr -= table_size; - } - }while(size != 0); -} - - -/****************************************************************** - * NP_GetData (NPCLIENT.8) - * - * - */ -int __stdcall NPCLIENT_NP_GetData(tir_data_t * data) -{ - float r, p, y, tx, ty, tz; - unsigned int frame; - int res = linuxtrack_get_pose(&y, &p, &r, &tx, &ty, &tz, &frame); - memset((char *)data, 0, sizeof(tir_data_t)); - data->status = (linuxtrack_get_tracking_state() == RUNNING) ? 0 : 1; - data->frame = frame & 0xFFFF; - data->cksum = 0; - data->roll = r / 180.0 * 16383; - data->pitch = -p / 180.0 * 16383; - data->yaw = y / 180.0 * 16383; - data->tx = -limit_num(-16383.0, 15 * tx, 16383); - data->ty = limit_num(-16383.0, 15 * ty, 16383); - data->tz = limit_num(-16383.0, 15 * tz, 16383); - data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t)); - //printf("Cksum: %04X\n", data->cksum); - if(crypted){ - enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table)); - } - return (res >= 0) ? 0: 1; -} -/****************************************************************** - * NP_GetParameter (NPCLIENT.9) - * - * - */ -int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1) -{ - dbg_report("GetParameter request: %d %d\n", arg0, arg1); - TRACE("(void): stub\n"); - return (int) 0; -} - -/****************************************************************** - * NP_GetSignature (NPCLIENT.10) - * - * - */ -int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig) -{ - dbg_report("GetSignature request\n"); - if(getSomeSeriousPoetry(sig->DllSignature, sig->AppSignature)){ - printf("Signature result: OK\n"); - return 0; - }else{ - printf("Signature result: NOT OK!\n"); - return 1; - } -} -/****************************************************************** - * NP_QueryVersion (NPCLIENT.11) - * - * - */ -int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version) -{ - dbg_report("QueryVersion request\n"); - *version=0x0500; - return 0; -} -/****************************************************************** - * NP_ReCenter (NPCLIENT.12) - * - * - */ -int __stdcall NPCLIENT_NP_ReCenter(void) -{ - dbg_report("ReCenter request\n"); - linuxtrack_recenter(); - return 0; -} - -/****************************************************************** - * NP_RegisterProgramProfileID (NPCLIENT.13) - * - * - */ -int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id) -{ - dbg_report("RegisterProgramProfileID request: %d\n", id); - game_desc_t gd; - if(game_data_get_desc(id, &gd)){ - printf("Application ID: %d - %s!!!\n", id, gd.name); - if(game_data_get_desc(id, &gd)){ - crypted = gd.encrypted; - if(gd.encrypted){ - printf("Table: %02X %02X %02X %02X %02X %02X %02X %02X\n", table[0],table[1],table[2],table[3],table[4], - table[5], table[6], table[7]); - table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - } - } - if(linuxtrack_init(gd.name) != 0){ - return 1; - } - }else{ - if(!linuxtrack_init("Default")){ - return 1; - } - } - linuxtrack_suspend(); - return 0; -} -/****************************************************************** - * NP_RegisterWindowHandle (NPCLIENT.14) - * - * - */ -int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd) -{ - dbg_report("RegisterWindowHandle request: 0x%X\n", hwnd); - TRACE("((HWND)%p): stub\n",hwnd); - return (int) 0; -} -/****************************************************************** - * NP_RequestData (NPCLIENT.15) - * - * - */ -int __stdcall NPCLIENT_NP_RequestData(unsigned short req) -{ - dbg_report("RequestData request: %d\n", req); - TRACE("((unsigned short)%d): stub\n",req); - return (int) 0; -} -/****************************************************************** - * NP_SetParameter (NPCLIENT.16) - * - * - */ -int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1) -{ - dbg_report("SetParameter request: %d %d\n", arg0, arg1); - TRACE("(void): stub\n"); - return (int) 0; -} -/****************************************************************** - * NP_StartCursor (NPCLIENT.17) - * - * - */ -int __stdcall NPCLIENT_NP_StartCursor(void) -{ - dbg_report("StartCursor request\n"); - TRACE("(void): stub\n"); - return (int) 0; -} -/****************************************************************** - * NP_StartDataTransmission (NPCLIENT.18) - * - * - */ -int __stdcall NPCLIENT_NP_StartDataTransmission(void) -{ - dbg_report("StartDataTransmission request\n"); - linuxtrack_wakeup(); - return 0; -} -/****************************************************************** - * NP_StopCursor (NPCLIENT.19) - * - * - */ -int __stdcall NPCLIENT_NP_StopCursor(void) -{ - dbg_report("StopCursor request\n"); - TRACE("(void): stub\n"); - return (int) 0; -} -/****************************************************************** - * NP_StopDataTransmission (NPCLIENT.20) - * - * - */ -int __stdcall NPCLIENT_NP_StopDataTransmission(void) -{ - dbg_report("StopDataTransmission request\n"); - linuxtrack_suspend(); - return 0; -} -/****************************************************************** - * NP_UnregisterWindowHandle (NPCLIENT.21) - * - * - */ -int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void) -{ - dbg_report("UnregisterWindowHandle request\n"); - TRACE("(void): stub\n"); - return (int) 0; -} - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c deleted file mode 100644 index 3197ba37..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c +++ /dev/null @@ -1,149 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include - - -//First 5 bytes is MD5 hash of "NaturalPoint" -static uint8_t secret_key[] = {0x0e, 0x9a, 0x63, 0x71, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static uint8_t S[256] = {0}; - -static char *decoded = NULL; - -static mxml_node_t *xml = NULL; -static mxml_node_t *tree = NULL; - -static void ksa(uint8_t key[], size_t len) -{ - unsigned int i, j; - for(i = 0; i < 256; ++i){ - S[i] = i; - } - j = 0; - for(i = 0; i < 256; ++i){ - j = (j + S[i] + key[i % len]) % 256; - uint8_t tmp = S[i]; - S[i] = S[j]; - S[j] = tmp; - } -} - -static uint8_t rc4() -{ - static uint8_t i = 0; - static uint8_t j = 0; - - i += 1; - j += S[i]; - uint8_t tmp = S[i]; - S[i] = S[j]; - S[j] = tmp; - return S[(S[i] + S[j]) % 256]; -} - -static bool decrypt_file(const char *fname, bool from_update) -{ - uint32_t header[5]; - size_t datlen; - ksa(secret_key, 16); - FILE *inp; - struct stat fst; - - if((inp = fopen(fname, "rb")) == NULL){ - printf("Can't open input file '%s'", fname); - return false; - } - - if(fstat(fileno(inp), &fst) != 0){ - fclose(inp); - printf("Cannot stat file '%s'\n", fname); - return false; - } - - if(from_update){ - if(fread(&header, sizeof(uint32_t), 5, inp) != 5){ - fclose(inp); - printf("Can't read the header - file '%s' is less than 20 bytes long?\n", fname); - return false; - } - datlen = header[4]; - }else{ - datlen = fst.st_size; - } - if((decoded = (char *)malloc(datlen+1)) == NULL){ - printf("malloc failed!\n"); - return false; - } - memset(decoded, 0, datlen+1); - size_t i; - size_t len = fread(decoded, 1, datlen, inp); - (void) len; - for(i = 0; i < datlen; ++i) decoded[i] ^= rc4(); - fclose(inp); - - //inp = fopen("tmp.dump", "w"); - //fwrite(decoded, 1, datlen, inp); - //fclose(inp); - - return true; -} - -static bool game_data_init(const char *fname, bool from_update) -{ - static bool initialized = false; - if(initialized){ - return true; - } - if(!decrypt_file(fname, from_update)){ - printf("Error decrypting file!\n"); - return false; - } - xml = mxmlNewXML("1.0"); - tree = mxmlLoadString(xml, decoded, MXML_TEXT_CALLBACK); - return (tree != NULL); -} - -static void game_data_close() -{ - mxmlDelete(tree); - free(decoded); -} - -bool get_game_data(const char *input_fname, const char *output_fname, bool from_update) -{ - FILE *outfile = NULL; - if((outfile = fopen(output_fname, "w")) == NULL){ - ltr_int_log_message("Can't open the output file '%s'!\n", output_fname); - return false; - } - if(!game_data_init(input_fname, from_update)){ - ltr_int_log_message("Can't process the data file '%s'!\n", input_fname); - return false; - } - - mxml_node_t *game; - const char *name; - const char *id; - for(game = mxmlFindElement(tree, tree, "Game", NULL, NULL, MXML_DESCEND); - game != NULL; - game = mxmlFindElement(game, tree, "Game", NULL, NULL, MXML_DESCEND)){ - name = mxmlElementGetAttr(game, "Name"); - id = mxmlElementGetAttr(game, "Id"); - - mxml_node_t *appid = mxmlFindElement(game, game, "ApplicationID", NULL, NULL, MXML_DESCEND); - if(appid == NULL){ - fprintf(outfile, "%s \"%s\"\n", id, name); - }else{ - fprintf(outfile, "%s \"%s\" (%s)\n", id, name, appid->child->value.text.string); - } - } - fclose(outfile); - game_data_close(); - return true; -} - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h deleted file mode 100644 index b71f7a15..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GAME_DATA__H -#define GAME_DATA__H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -bool get_game_data(const char *input_fname, const char *output_fname, bool from_update); - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am deleted file mode 100644 index e025209a..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am +++ /dev/null @@ -1,78 +0,0 @@ -noinst_SCRIPTS = -if WINE_PLUGIN - noinst_SCRIPTS += Tester.exe -if WINE64 - noinst_SCRIPTS += Tester64.exe -endif #WINE64 -endif #WINE_PLUGIN - -if DARWIN - LDFLAGS += -Wl,-no_arch_warnings -else - LDFLAGS += -Wl,--no-warn-search-mismatch -endif - -CC = winegcc - -CXX = wineg++ - -SUFFIXES = .o .cpp .c .rc 64.o - -.cpp.o : - $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS) -m32 -o $@ $< - -.cpp64.o : - $(CXX) -c $(CXXFLAGS) -o $@ $< - -.c64.o : - $(CC) -c $(CFLAGS) -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< - -CXXFLAGS += -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ -CFLAGS += -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ -RCFLAGS = -I @srcdir@ -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - - -Tester64.exe : main64.o rest64.o npifc64.o npview.o - wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ - -Tester.exe : main.o npview.o rest.o npifc.o - wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -main.o : main.cpp Makefile - -main64.o : main.cpp Makefile - -npview.o : npview.rc - -rest.o : rest.c rest.h Makefile - -rest64.o : rest.c rest.h Makefile - -npifc.o : npifc.c npifc.h Makefile - -npifc64.o : CFLAGS+="-DFOR_WIN64=1" -npifc64.o : npifc.c npifc.h Makefile - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in deleted file mode 100644 index cc49d754..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in +++ /dev/null @@ -1,512 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@WINE_PLUGIN_TRUE@am__append_1 = Tester.exe -@WINE64_TRUE@@WINE_PLUGIN_TRUE@am__append_2 = Tester64.exe -@DARWIN_TRUE@am__append_3 = -Wl,-no_arch_warnings -@DARWIN_FALSE@am__append_4 = -Wl,--no-warn-search-mismatch -subdir = src/wine_bridge/tester -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(srcdir)/npview.rc.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = npview.rc -CONFIG_CLEAN_VPATH_FILES = -SCRIPTS = $(noinst_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -depcomp = -am__depfiles_maybe = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON = @BISON@ -CC = winegcc -CFLAGS = @CFLAGS@ -g -I../.. -I../../.. -DHAVE_CONFIG_H \ - -I@srcdir@/../.. -I@top_builddir@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = wineg++ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -g -DHAVE_CONFIG_H -I../../.. -I. \ - -I@srcdir@/../.. -I@top_builddir@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ $(am__append_3) $(am__append_4) -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIB32DIR = @LIB32DIR@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJC = @OBJC@ -OBJCFLAGS = @OBJCFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPENCV_CFLAGS = @OPENCV_CFLAGS@ -OPENCV_LIBS = @OPENCV_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -QMAKE_PATH = @QMAKE_PATH@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -WINE64_LIBS = @WINE64_LIBS@ -WINE_LIBS = @WINE_LIBS@ -XPL_CPPFLAGS = @XPL_CPPFLAGS@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_OBJC = @ac_ct_OBJC@ -am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -with_makensis = @with_makensis@ -with_wine64 = @with_wine64@ -noinst_SCRIPTS = $(am__append_1) $(am__append_2) -SUFFIXES = .o .cpp .c .rc 64.o -RCFLAGS = -I @srcdir@ -EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h -all: all-am - -.SUFFIXES: -.SUFFIXES: .o .cpp .c .rc 64.o -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -npview.rc: $(top_builddir)/config.status $(srcdir)/npview.rc.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(SCRIPTS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-local - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distclean-local distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am - - -.cpp.o : - $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS) -m32 -o $@ $< - -.cpp64.o : - $(CXX) -c $(CXXFLAGS) -o $@ $< - -.c64.o : - $(CC) -c $(CFLAGS) -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - -Tester64.exe : main64.o rest64.o npifc64.o npview.o - wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ - -Tester.exe : main.o npview.o rest.o npifc.o - wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -main.o : main.cpp Makefile - -main64.o : main.cpp Makefile - -npview.o : npview.rc - -rest.o : rest.c rest.h Makefile - -rest64.o : rest.c rest.h Makefile - -npifc.o : npifc.c npifc.h Makefile - -npifc64.o : CFLAGS+="-DFOR_WIN64=1" -npifc64.o : npifc.c npifc.h Makefile - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp deleted file mode 100644 index 95ca0d9b..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#define WIN32_LEAN_AND_MEAN - -#include -#include -#include -#include "resource.h" -#include "rest.h" -#include "npifc.h" - -HINSTANCE hInst; -UINT_PTR timer = 0; - -VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) -{ - (void) uMsg; - (void) idEvent; - (void) dwTime; - tir_data_t td; - npifc_getdata(&td); - SetDlgItemInt(hwnd, IDC_PITCH, td.pitch, true); - SetDlgItemInt(hwnd, IDC_ROLL, td.roll, true); - SetDlgItemInt(hwnd, IDC_YAW, td.yaw, true); - - SetDlgItemInt(hwnd, IDC_X1, td.tx, true); - SetDlgItemInt(hwnd, IDC_Y1, td.ty, true); - SetDlgItemInt(hwnd, IDC_Z1, td.tz, true); - - SetDlgItemInt(hwnd, IDC_X2, td.padding[0], true); - SetDlgItemInt(hwnd, IDC_Y2, td.padding[1], true); - SetDlgItemInt(hwnd, IDC_Z2, td.padding[2], true); - SetDlgItemInt(hwnd, IDC_X3, td.padding[3], true); - SetDlgItemInt(hwnd, IDC_Y3, td.padding[4], true); - SetDlgItemInt(hwnd, IDC_Z3, td.padding[5], true); - SetDlgItemInt(hwnd, IDC_S, td.status, true); - SetDlgItemInt(hwnd, IDC_F, td.frame, true); -} - -BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - (void) lParam; - switch(uMsg) - { - case WM_INITDIALOG: - SetDlgItemInt(hwndDlg, IDC_APPID, 2307, true); - return TRUE; - - case WM_CLOSE: - EndDialog(hwndDlg, 0); - return TRUE; - - case WM_COMMAND: - switch(LOWORD(wParam)) - { - /* - * TODO: Add more control ID's, when needed. - */ - case IDQUIT: - npifc_close(); - EndDialog(hwndDlg, 0); - return TRUE; - case IDSTART: - int ok; - int num = GetDlgItemInt(hwndDlg, IDC_APPID, (BOOL*)&ok, false); - if(!ok){ - num = 2307; - } - game_desc_t gd; - if(timer != 0){ - KillTimer(hwndDlg, timer); - timer = 0; - } - if(game_data_get_desc(num, &gd)){ - printf("Application ID: %d - %s\n", num, gd.name); - if(npifc_init(hwndDlg, num)){ - timer = SetTimer(hwndDlg, 0, 50, TimerProcedure); - } - }else{ - printf("Unknown Application ID: %d\n", num); - } - break; - - } - } - - return FALSE; -} - - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) -{ - (void) hPrevInstance; - (void) lpCmdLine; - (void) nShowCmd; - hInst = hInstance; - - // The user interface is a modal dialog box - return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); -} - - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c deleted file mode 100644 index b036464e..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c +++ /dev/null @@ -1,302 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#define WIN32_LEAN_AND_MEAN -#include -#include "npifc.h" -#include "rest.h" - - -tir_signature_t ts; -HMODULE npclient; -/* -typedef int (*NP_RegisterWindowHandle_t)(HWND hwnd); -typedef int (*NP_UnregisterWindowHandle_t)(void); -typedef int (*NP_RegisterProgramProfileID_t)(unsigned short id); -typedef int (*NP_QueryVersion_t)(unsigned short *version); -typedef int (*NP_RequestData_t)(unsigned short req); -typedef int (*NP_GetSignature_t)(tir_signature_t *sig); -typedef int (*NP_GetData_t)(tir_data_t *data); -typedef int (*NP_GetParameter_t)(void); -typedef int (*NP_SetParameter_t)(void); -typedef int (*NP_StartCursor_t)(void); -typedef int (*NP_StopCursor_t)(void); -typedef int (*NP_ReCenter_t)(void); -typedef int (*NP_StartDataTransmission_t)(void); -typedef int (*NP_StopDataTransmission_t)(void); -*/ -NP_RegisterWindowHandle_t NP_RegisterWindowHandle = NULL; -NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle = NULL; -NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID = NULL; -NP_QueryVersion_t NP_QueryVersion = NULL; -NP_RequestData_t NP_RequestData = NULL; -NP_GetSignature_t NP_GetSignature = NULL; -NP_GetData_t NP_GetData = NULL; -NP_GetParameter_t NP_GetParameter = NULL; -NP_SetParameter_t NP_SetParameter = NULL; -NP_StartCursor_t NP_StartCursor = NULL; -NP_StopCursor_t NP_StopCursor = NULL; -NP_ReCenter_t NP_ReCenter = NULL; -NP_StartDataTransmission_t NP_StartDataTransmission = NULL; -NP_StopDataTransmission_t NP_StopDataTransmission = NULL; - -bool crypted = false; - - - -unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -char *client_path() -{ - HKEY hkey = 0; - RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", 0, - KEY_QUERY_VALUE, &hkey); - if(!hkey){ - printf("Can't open registry key\n"); - return NULL; - } - - BYTE path[1024]; - DWORD buf_len = 1024; - LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); - char *full_path = NULL; - int res = -1; - if(result == ERROR_SUCCESS && buf_len > 0){ -#ifdef FOR_WIN64 - res = asprintf(&full_path, "%s/NPClient64.dll", path); -#else - res = asprintf(&full_path, "%s/NPClient.dll", path); -#endif - } - RegCloseKey(hkey); - if(res > 0){ - return full_path; - }else{ - return NULL; - } -} - -bool initialized = false; - -bool npifc_init(HWND wnd, int id) -{ - //table[] = {0xb3, 0x16, 0x36, 0xeb, 0xb9, 0x05, 0x4f, 0xa4}; - game_desc_t gd; - if(game_data_get_desc(id, &gd)){ - crypted = gd.encrypted; - if(gd.encrypted){ - table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - } - } - printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", - table[0], table[1], table[2], table[3], - table[4], table[5], table[6], table[7]); - - char *client = client_path(); - if(client == NULL){ - printf("Couldn't obtain client path!\n"); - return false; - } - npclient = LoadLibrary(client); - if(!npclient){ - printf("Can't load client %s\n", client); - return false; - } - - NP_RegisterWindowHandle = (NP_RegisterWindowHandle_t)GetProcAddress(npclient, "NP_RegisterWindowHandle"); - NP_UnregisterWindowHandle = (NP_UnregisterWindowHandle_t)GetProcAddress(npclient, "NP_UnregisterWindowHandle"); - NP_RegisterProgramProfileID = (NP_RegisterProgramProfileID_t)GetProcAddress(npclient, "NP_RegisterProgramProfileID"); - NP_QueryVersion = (NP_QueryVersion_t)GetProcAddress(npclient, "NP_QueryVersion"); - NP_RequestData = (NP_RequestData_t)GetProcAddress(npclient, "NP_RequestData"); - NP_GetSignature = (NP_GetSignature_t)GetProcAddress(npclient, "NP_GetSignature"); - NP_GetData = (NP_GetData_t)GetProcAddress(npclient, "NP_GetData"); - NP_GetParameter = (NP_GetParameter_t)GetProcAddress(npclient, "NP_GetParameter"); - NP_SetParameter = (NP_SetParameter_t)GetProcAddress(npclient, "NP_SetParameter"); - NP_StartCursor = (NP_StartCursor_t)GetProcAddress(npclient, "NP_StartCursor"); - NP_StopCursor = (NP_StopCursor_t)GetProcAddress(npclient, "NP_StopCursor"); - NP_ReCenter = (NP_ReCenter_t)GetProcAddress(npclient, "NP_ReCenter"); - NP_StartDataTransmission = (NP_StartDataTransmission_t)GetProcAddress(npclient, "NP_StartDataTransmission"); - NP_StopDataTransmission = (NP_StopDataTransmission_t)GetProcAddress(npclient, "NP_StopDataTransmission"); - if((NP_RegisterWindowHandle == NULL) || (NP_UnregisterWindowHandle == NULL) - || (NP_RegisterProgramProfileID == NULL) || (NP_QueryVersion == NULL) || (NP_RequestData == NULL) - || (NP_GetSignature == NULL) || (NP_GetData == NULL) || (NP_GetParameter == NULL) - || (NP_SetParameter == NULL) || (NP_StartCursor == NULL) || (NP_StopCursor == NULL) - || (NP_ReCenter == NULL) || (NP_StartDataTransmission == NULL) || (NP_StopDataTransmission == NULL)){ - printf("Couldn't bind all necessary functions!\n"); - return false; - } - tir_signature_t sig; - int res; - if((res = NP_GetSignature(&sig)) != 0){ - printf("Error retrieving signature! %d\n", res); - return false; - } - printf("Dll Sig:%s\nApp Sig2:%s\n", sig.DllSignature, sig.AppSignature); - NP_RegisterWindowHandle(wnd); - if(NP_RegisterProgramProfileID(id) != 0){ - printf("Couldn't register profile id!\n"); - return false; - } - printf("Program profile registered!\n"); - NP_RequestData(65535); - NP_StopCursor(); - NP_StartDataTransmission(); - initialized = true; - return true; -} - -void npifc_close() -{ - if(initialized){ - NP_StopDataTransmission(); - NP_StartCursor(); - NP_UnregisterWindowHandle(); - } - initialized = false; -} - -void c_encrypt(unsigned char buf[], unsigned int size, - unsigned char code_table[], unsigned int table_size) -{ - unsigned int table_ptr = 0; - unsigned char var = 0x88; - unsigned char tmp; - if((size <= 0) || (table_size <= 0) || - (buf == NULL) || (code_table == NULL)) - return; - do{ - tmp = buf[--size]; - buf[size] = tmp ^ code_table[table_ptr] ^ var; - var += size + tmp; - ++table_ptr; - if(table_ptr >= table_size){ - table_ptr -= table_size; - } - }while(size != 0); -} - - - -void decrypt(unsigned char buf[], unsigned int size, - unsigned char code_table[], unsigned int table_size) -{ - unsigned int table_ptr = 0; - unsigned char var = 0x88; - unsigned char tmp; - if((size <= 0) || (table_size <= 0) || - (buf == NULL) || (code_table == NULL)){ - return; - } - do{ - tmp = buf[--size]; - buf[size] = tmp ^ code_table[table_ptr] ^ var; - var += size + buf[size]; - ++table_ptr; - if(table_ptr >= table_size){ - table_ptr -= table_size; - } - }while(size != 0); -} - -unsigned int cksum(unsigned char buf[], unsigned int size) -{ - if((size == 0) || (buf == NULL)){ - return 0; - } - int rounds = size >> 2; - int rem = size % 4; - - int c = size; - int a0 = 0; - int a2 = 0; - - while(rounds != 0){ - a0 = *(short int*)buf; - a2 = *(short int*)(buf+2); - buf += 4; - c += a0; - a2 ^= (c << 5); - a2 <<= 11; - c ^= a2; - c += (c >> 11); - --rounds; - } - switch(rem){ - case 3: - a0 = *(short int*)buf; - a2 = *(signed char*)(buf+2); - c += a0; - a2 = (a2 << 2) ^ c; - c ^= (a2 << 16); - a2 = (c >> 11); - break; - case 2: - a2 = *(short int*)buf; - c += a2; - c ^= (c << 11); - a2 = (c >> 17); - break; - case 1: - a2 = *(signed char*)(buf); - c += a2; - c ^= (c << 10); - a2 = (c >> 1); - break; - default: - break; - } - if(rem != 0){ - c+=a2; - } - - c ^= (c << 3); - c += (c >> 5); - c ^= (c << 4); - c += (c >> 17); - c ^= (c << 25); - c += (c >> 6); - - return (unsigned int)c; -} - -int decode_frame(tir_data_t *td) -{ - //printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", - // table[0], table[1], table[2], table[3], - // table[4], table[5], table[6], table[7]); - unsigned int csum; - decrypt((unsigned char*)td, sizeof(*td), table, sizeof(table)); - csum = td->cksum; - td->cksum = 0; - if(csum != cksum((unsigned char*)td, sizeof(*td))){ - printf("Problem with frame!\n"); - //int a0; - //printf("Dec: "); - //for(a0 = 0; a0 < (int)sizeof(tir_data_t); ++a0) - //{ - // printf("%02X", ((unsigned char *)td)[a0]); - //} - //printf("\n"); - //printf("Cksum: %04X vs computed: %04X\n", csum, cksum((unsigned char*)td, sizeof(*td))); - return -1; - } - //printf("Frame OK!\n"); - return 0; -} - -int npifc_getdata(tir_data_t *data) -{ - int res = NP_GetData(data); - if(crypted){ - decode_frame(data); - } - return res; -} - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h deleted file mode 100644 index d580e16d..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef NPIFC__H -#define NPIFC__H - - -#include - -#ifdef __cplusplus -extern "C" { -#endif - bool npifc_init(HWND wnd, int id); - void npifc_close(); - -#pragma pack(1) -typedef struct tir_data{ - short status; - short frame; - unsigned int cksum; - float roll, pitch, yaw; - float tx, ty, tz; - float padding[9]; -} tir_data_t; - -typedef struct tir_signature{ - char DllSignature[200]; - char AppSignature[200]; -} tir_signature_t; -#pragma pack(0) - -int npifc_getdata(tir_data_t *data); - -typedef int __stdcall (*NP_RegisterWindowHandle_t)(HWND hwnd); -typedef int __stdcall (*NP_UnregisterWindowHandle_t)(void); -typedef int __stdcall (*NP_RegisterProgramProfileID_t)(unsigned short id); -typedef int __stdcall (*NP_QueryVersion_t)(unsigned short *version); -typedef int __stdcall (*NP_RequestData_t)(unsigned short req); -typedef int __stdcall (*NP_GetSignature_t)(tir_signature_t *sig); -typedef int __stdcall (*NP_GetData_t)(tir_data_t *data); -typedef int __stdcall (*NP_GetParameter_t)(void); -typedef int __stdcall (*NP_SetParameter_t)(void); -typedef int __stdcall (*NP_StartCursor_t)(void); -typedef int __stdcall (*NP_StopCursor_t)(void); -typedef int __stdcall (*NP_ReCenter_t)(void); -typedef int __stdcall (*NP_StartDataTransmission_t)(void); -typedef int __stdcall (*NP_StopDataTransmission_t)(void); - -extern NP_RegisterWindowHandle_t NP_RegisterWindowHandle; -extern NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle; -extern NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID; -extern NP_QueryVersion_t NP_QueryVersion; -extern NP_RequestData_t NP_RequestData; -extern NP_GetSignature_t NP_GetSignature; -extern NP_GetData_t NP_GetData; -extern NP_GetParameter_t NP_GetParameter; -extern NP_SetParameter_t NP_SetParameter; -extern NP_StartCursor_t NP_StartCursor; -extern NP_StopCursor_t NP_StopCursor; -extern NP_ReCenter_t NP_ReCenter; -extern NP_StartDataTransmission_t NP_StartDataTransmission; -extern NP_StopDataTransmission_t NP_StopDataTransmission; - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in deleted file mode 100644 index 231002f1..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in +++ /dev/null @@ -1,49 +0,0 @@ -// Generated by ResEdit 1.5.9 -// Copyright (C) 2006-2011 -// http://www.resedit.net - -#include -#include -#include -#include "resource.h" - -#ifdef HAVE_CONFIG_H - #include "../../../config.h" -#endif - - - -// -// Dialog resources -// -//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDD_DIALOG1 DIALOGEX 0, 0, 379, 124 -STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU -CAPTION "NPTest v@PACKAGE_VERSION@" -FONT 8, "Ms Shell Dlg", 400, 0, 1 -{ - DEFPUSHBUTTON "Quit", IDQUIT, 262, 102, 50, 14 - DEFPUSHBUTTON "Start", IDSTART, 7, 102, 50, 14 - EDITTEXT IDC_PITCH, 32, 32, 51, 14, ES_AUTOHSCROLL - LTEXT "Pitch", IDC_STATIC, 11, 34, 20, 8, SS_LEFT - LTEXT "Yaw", IDC_STATIC, 11, 59, 20, 8, SS_LEFT - EDITTEXT IDC_YAW, 32, 57, 51, 14, ES_AUTOHSCROLL - LTEXT "Roll", IDC_STATIC, 11, 84, 20, 8, SS_LEFT - EDITTEXT IDC_ROLL, 32, 82, 51, 14, ES_AUTOHSCROLL - LTEXT "X", IDC_STATIC, 101, 35, 6, 8, SS_LEFT - EDITTEXT IDC_X1, 112, 32, 51, 14, ES_AUTOHSCROLL - LTEXT "Y", IDC_STATIC, 101, 60, 6, 8, SS_LEFT - EDITTEXT IDC_Y1, 112, 57, 51, 14, ES_AUTOHSCROLL - LTEXT "Z", IDC_STATIC, 101, 85, 6, 8, SS_LEFT - EDITTEXT IDC_Z1, 112, 82, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_X2, 172, 32, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Y2, 172, 57, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Z2, 172, 82, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_X3, 232, 32, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Y3, 232, 57, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Z3, 232, 82, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_S, 292, 32, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_F, 292, 57, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_APPID, 32, 12, 51, 12, ES_AUTOHSCROLL - LTEXT "ID", IDC_STATIC, 17, 14, 8, 8, SS_LEFT -} diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h deleted file mode 100644 index 328d9cb7..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef IDC_STATIC -#define IDC_STATIC (-1) -#endif - -#define IDD_DIALOG1 100 -#define IDQUIT 1002 -#define IDSTART 1003 -#define IDC_APPID 1016 -#define IDC_PITCH 1017 -#define IDC_YAW 1018 -#define IDC_ROLL 1019 -#define IDC_X1 1020 -#define IDC_X2 1021 -#define IDC_X3 1022 -#define IDC_Y1 1023 -#define IDC_Y2 1024 -#define IDC_Y3 1025 -#define IDC_Z1 1026 -#define IDC_Z2 1027 -#define IDC_Z3 1028 -#define IDC_S 1029 -#define IDC_F 1030 - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c deleted file mode 120000 index 663c21a9..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c +++ /dev/null @@ -1 +0,0 @@ -../client/rest.c \ No newline at end of file diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h deleted file mode 120000 index 6dca182a..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h +++ /dev/null @@ -1 +0,0 @@ -../client/rest.h \ No newline at end of file diff --git a/facetracknoir/clientfiles/make-csv.pl b/facetracknoir/clientfiles/make-csv.pl new file mode 100755 index 00000000..ee60364e --- /dev/null +++ b/facetracknoir/clientfiles/make-csv.pl @@ -0,0 +1,72 @@ +#!/usr/bin/env perl + +use strict; +use List::Util qw'reduce'; + +sub get_games_1 { + my @games; + + open my $fd, "<", $ARGV[1] or die "open: $!"; + <$fd>; + + while (defined(my $line = <$fd>)) { + chomp $line; + if ($line !~ /^(\d+)\s+"([^"]+)"(?:\s+\(([0-9A-F]{16})\))?$/) { + warn "Broken line"; + next; + } + push @games, +{ id => $1, name => $2, key => defined $3 ? (sprintf "%04X", $1) . $3 . '00' : undef}; + } + + [@games]; +} + +sub get_games_2 { + open my $fd, "<", $ARGV[0] or die "open: $!"; + <$fd>; + my @games; + while (defined(my $line = <$fd>)) { + chomp $line; + my @line = split/;/, $line; + if (@line != 8) { + warn "Broken line"; + next; + } + my @cols = qw'no name proto since verified by id key'; + push @games, +{ map { $cols[$_] => $line[$_] } 0..$#cols }; + } + [@games]; +} + +sub merge { + my ($new_games, $old_games) = @_; + my $no = (reduce { $a->{no} > $b->{no} ? $a : $b } +{id=>0}, @$old_games)->{no} + 1; + my %game_hash = map { $_->{name} => $_ } @$old_games; + my %ids = map { $_->{id} => 1 } @$old_games; + for my $g (@$new_games) { + if (!exists $game_hash{$g->{name}} && !exists $ids{$g->{id}}) { + $game_hash{$g->{name}} = +{ + no => $no++, + name => $g->{name}, + proto => 'FreeTrack20', + since => (defined $g->{key} ? 'V170' : 'V160'), + verified => '', + by => '', + id => $g->{id}, + key => $g->{key} + }; + } + } + print "No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID\n"; + for (sort { lc($a->{name}) cmp lc($b->{name}) } values %game_hash) { + my $g = {%$_}; + if (!defined $g->{key}) { + $g->{key} = (sprintf "%04X", $g->{no}) . (join"", map { sprintf "%02X", int rand 256 } 0 .. 7) . '00'; + } + my @cols = qw'no name proto since verified by id key'; + print join";", map { $g->{$_} } @cols; + print "\n"; + } +} + +merge(get_games_1(), get_games_2()); diff --git a/facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt b/facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt new file mode 100644 index 00000000..82214139 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt @@ -0,0 +1,6 @@ +The contents of the directory written by one and only, uglyDwarf. + +Obtained at epoch time 1412397452 from the mithril-mine's shaft, where +the elite dwarves reside. + +For the latest happenings, visit diff --git a/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am new file mode 100644 index 00000000..02747edb --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am @@ -0,0 +1,54 @@ +noinst_SCRIPTS = +if WINE_PLUGIN + noinst_SCRIPTS += ftc.exe.so +endif #WINE_PLUGIN + +if DARWIN + LDFLAGS += -Wl,-no_arch_warnings +else + LDFLAGS += -Wl,--no-warn-search-mismatch +endif + +CC = winegcc + +CXX = wineg++ + +SUFFIXES = .o .cpp .c .rc + +.cpp.o : + $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< + +CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +ftc.exe.so : main.o fttester.o + wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +fttester.o : fttester.rc resource.h config.h + +main.o : main.cpp + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +EXTRA_DIST = resource.h fttester.rc main.cpp + diff --git a/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in new file mode 100644 index 00000000..d1fff34d --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in @@ -0,0 +1,491 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WINE_PLUGIN_TRUE@am__append_1 = ftc.exe.so +@DARWIN_TRUE@am__append_2 = -Wl,-no_arch_warnings +@DARWIN_FALSE@am__append_3 = -Wl,--no-warn-search-mismatch +subdir = src/wine_bridge/ft_tester +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/fttester.rc.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = fttester.rc +CONFIG_CLEAN_VPATH_FILES = +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON = @BISON@ +CC = winegcc +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = wineg++ +CXXCPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ $(am__append_2) $(am__append_3) +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIB32DIR = @LIB32DIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENCV_CFLAGS = @OPENCV_CFLAGS@ +OPENCV_LIBS = @OPENCV_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +QMAKE_PATH = @QMAKE_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINE64_LIBS = @WINE64_LIBS@ +WINE_LIBS = @WINE_LIBS@ +XPL_CPPFLAGS = @XPL_CPPFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_makensis = @with_makensis@ +with_wine64 = @with_wine64@ +noinst_SCRIPTS = $(am__append_1) +SUFFIXES = .o .cpp .c .rc +CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +EXTRA_DIST = resource.h fttester.rc main.cpp +all: all-am + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .rc +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +fttester.rc: $(top_builddir)/config.status $(srcdir)/fttester.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distclean-local distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + + +.cpp.o : + $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +ftc.exe.so : main.o fttester.o + wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +fttester.o : fttester.rc resource.h config.h + +main.o : main.cpp + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in b/facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in new file mode 100644 index 00000000..332f3c73 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in @@ -0,0 +1,67 @@ +// Generated by ResEdit 1.5.9 +// Copyright (C) 2006-2011 +// http://www.resedit.net + +#include +#include +#include +#include "resource.h" + +#ifdef HAVE_CONFIG_H + #include "../../../config.h" +#endif + + + + +// +// Dialog resources +// +//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOGEX 0, 0, 333, 183 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "FreeTrack client test utility v@PACKAGE_VERSION@" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "Quit", IDQUIT, 262, 153, 50, 14 + PUSHBUTTON "Start", IDC_START, 199, 153, 50, 14 + EDITTEXT IDC_YAW, 38, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Yaw", IDC_STATIC, 12, 17, 21, 14, SS_RIGHT + EDITTEXT IDC_PITCH, 38, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Pitch", IDC_STATIC, 16, 40, 17, 14, SS_RIGHT + EDITTEXT IDC_ROLL, 38, 61, 48, 14, ES_AUTOHSCROLL + RTEXT "Roll", IDC_STATIC, 20, 63, 13, 14, SS_RIGHT + EDITTEXT IDC_X, 38, 84, 48, 14, ES_AUTOHSCROLL + RTEXT "X", IDC_STATIC, 27, 86, 6, 14, SS_RIGHT + EDITTEXT IDC_Y, 38, 107, 48, 14, ES_AUTOHSCROLL + RTEXT "Y", IDC_STATIC, 27, 109, 6, 14, SS_RIGHT + EDITTEXT IDC_Z, 38, 130, 48, 14, ES_AUTOHSCROLL + RTEXT "Z", IDC_STATIC, 27, 132, 6, 14, SS_RIGHT + EDITTEXT IDC_RYAW, 137, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Yaw", IDC_STATIC, 101, 17, 32, 8, SS_RIGHT + EDITTEXT IDC_RPITCH, 137, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Pitch", IDC_STATIC, 99, 40, 34, 8, SS_RIGHT + EDITTEXT IDC_RROLL, 137, 61, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Roll", IDC_STATIC, 103, 63, 30, 8, SS_RIGHT + EDITTEXT IDC_RX, 137, 84, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw X", IDC_STATIC, 111, 86, 22, 8, SS_RIGHT + EDITTEXT IDC_RY, 137, 107, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Y", IDC_STATIC, 111, 109, 22, 8, SS_RIGHT + EDITTEXT IDC_RZ, 137, 130, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Z", IDC_STATIC, 111, 132, 22, 8, SS_RIGHT + EDITTEXT IDC_NUM, 264, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Frame Number", IDC_STATIC, 212, 17, 47, 8, SS_RIGHT + EDITTEXT IDC_RES, 264, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Camera Resolution", IDC_STATIC, 199, 40, 60, 8, SS_RIGHT + EDITTEXT IDC_PT0, 227, 61, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 1", IDC_STATIC, 199, 63, 23, 8, SS_RIGHT + EDITTEXT IDC_PT1, 227, 84, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 2", IDC_STATIC, 199, 86, 23, 8, SS_RIGHT + EDITTEXT IDC_PT2, 227, 107, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 3", IDC_STATIC, 199, 109, 23, 8, SS_RIGHT + EDITTEXT IDC_PT3, 227, 130, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 4", IDC_STATIC, 199, 132, 23, 8, SS_RIGHT + EDITTEXT IDC_TITLE, 38, 153, 147, 14, ES_AUTOHSCROLL + RTEXT "Title", IDC_STATIC, 19, 155, 14, 8, SS_RIGHT +} + diff --git a/facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp b/facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp new file mode 100644 index 00000000..a737f88f --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp @@ -0,0 +1,211 @@ +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include +#include +#include + +#include "resource.h" + +HINSTANCE hInst; +UINT_PTR timer = 0; + +HMODULE ftclient; + +typedef struct +{ + unsigned int dataID; + int res_x; int res_y; + float yaw; // positive yaw to the left + float pitch;// positive pitch up + float roll;// positive roll to the left + float x; + float y; + float z; + // raw pose with no smoothing, sensitivity, response curve etc. + float ryaw; + float rpitch; + float rroll; + float rx; + float ry; + float rz; + // raw points, sorted by Y, origin top left corner + float x0, y0; + float x1, y1; + float x2, y2; + float x3, y3; +}FreeTrackData; + + +typedef bool (WINAPI *importGetData)(FreeTrackData * data); +typedef char *(WINAPI *importGetDllVersion)(void); +typedef void (WINAPI *importReportName)(char *name); +typedef char *(WINAPI *importProvider)(void); + +importGetData getData; +importGetDllVersion getDllVersion; +importReportName reportName; +importProvider provider; + + +char *client_path() +{ + HKEY hkey = 0; + RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Freetrack\\FreetrackClient", 0, + KEY_QUERY_VALUE, &hkey); + if(!hkey){ + printf("Can't open registry key\n"); + return NULL; + } + + BYTE path[1024]; + DWORD buf_len = 1024; + LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); + char *full_path = (char *)malloc(2048); + if(result == ERROR_SUCCESS && buf_len > 0){ + sprintf(full_path, "%s\\FreeTrackClient.dll", path); + } + RegCloseKey(hkey); + return full_path; +} + + +bool start(HWND hwnd) +{ + char *libname = client_path(); + if(libname == NULL){ + printf("Freetrack client not found!\n"); + return false; + } + ftclient = LoadLibrary(libname); + if(ftclient == NULL){ + printf("Couldn't load Freetrack client library '%s'!\n", libname); + return false; + } + printf("Freetrack client library %s loaded.\n", client_path()); + + + getData = (importGetData)GetProcAddress(ftclient, "FTGetData"); + getDllVersion = (importGetDllVersion)GetProcAddress(ftclient, "FTGetDllVersion"); + reportName = (importReportName)GetProcAddress(ftclient, "FTReportName"); + provider = (importProvider)GetProcAddress(ftclient, "FTProvider"); + + if((getData == NULL) || (getDllVersion == NULL) || (reportName == NULL) || (provider == NULL)){ + printf("Couldn't load Freetrack client functions!\n"); + FreeLibrary(ftclient); + return false; + } + + printf("Dll version: %s\n", getDllVersion()); + printf("Provider: %s\n", provider()); + char title[1024]; + GetDlgItemText(hwnd, IDC_TITLE, title, 1020); + reportName(title); + return true; +} + +void reportError(std::string msg) +{ + MessageBoxA(0, "FreeTrack client test", msg.c_str(), 0); +} +VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + (void) uMsg; + (void) idEvent; + (void) dwTime; + FreeTrackData d; + getData(&d); + SetDlgItemInt(hwnd, IDC_PITCH, d.pitch, true); + SetDlgItemInt(hwnd, IDC_ROLL, d.roll, true); + SetDlgItemInt(hwnd, IDC_YAW, d.yaw, true); + + SetDlgItemInt(hwnd, IDC_X, d.x, true); + SetDlgItemInt(hwnd, IDC_Y, d.y, true); + SetDlgItemInt(hwnd, IDC_Z, d.z, true); + + SetDlgItemInt(hwnd, IDC_RPITCH, d.rpitch, true); + SetDlgItemInt(hwnd, IDC_RROLL, d.rroll, true); + SetDlgItemInt(hwnd, IDC_RYAW, d.ryaw, true); + + SetDlgItemInt(hwnd, IDC_RX, d.rx, true); + SetDlgItemInt(hwnd, IDC_RY, d.ry, true); + SetDlgItemInt(hwnd, IDC_RZ, d.rz, true); + + std::ostringstream s; + s.str(std::string()); + s<<"("< +#include "rest.h" +//#include "config.h" +#define __WINESRC__ + +#include +#include +#include +#include +#include +#include +#include "windef.h" +#include "winbase.h" +#include "NPClient_dll.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(NPClient); + +bool crypted = false; +static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static int dbg_flag; + +static void dbg_report(const char *msg,...) +{ + static FILE *f = NULL; + if(dbg_flag){ + if(f == NULL){ + f = fopen("NPClient.log", "w"); + } + va_list ap; + va_start(ap,msg); + vfprintf(f, msg, ap); + fflush(f); + va_end(ap); + } +} + + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return TRUE; + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + dbg_flag = getDebugFlag('w'); + dbg_report("Attach request\n"); + break; + case DLL_PROCESS_DETACH: + linuxtrack_shutdown(); + break; + } + + return TRUE; +} +/****************************************************************** + * NPPriv_ClientNotify (NPCLIENT.1) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_ClientNotify() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_GetLastError (NPCLIENT.2) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_GetLastError() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetData (NPCLIENT.3) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetData() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetLastError (NPCLIENT.4) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetLastError() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetParameter (NPCLIENT.5) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetParameter() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetSignature (NPCLIENT.6) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetSignature() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetVersion (NPCLIENT.7) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetVersion() +{ + /* @stub in .spec */ +} +#endif + +static float limit_num(float min, float val, float max) +{ + if(val < min) return min; + if(val > max) return max; + return val; +} + +static unsigned int cksum(unsigned char buf[], unsigned int size) +{ + if((size == 0) || (buf == NULL)){ + return 0; + } + + int rounds = size >> 2; + int rem = size % 4; + + int c = size; + int a0, a2; +// printf("Orig: "); +//for(a0 = 0; a0 < (int)size; ++a0) +//{ +// printf("%02X", buf[a0]); +//} +//printf("\n"); + while(rounds != 0){ + a0 = *(short int*)buf; + a2 = *(short int*)(buf+2); + buf += 4; + c += a0; + a2 ^= (c << 5); + a2 <<= 11; + c ^= a2; + c += (c >> 11); + --rounds; + } + switch(rem){ + case 3: + a0 = *(short int*)buf; + a2 = *(signed char*)(buf+2); + c += a0; + a2 = (a2 << 2) ^ c; + c ^= (a2 << 16); + a2 = (c >> 11); + break; + case 2: + a2 = *(short int*)buf; + c += a2; + c ^= (c << 11); + a2 = (c >> 17); + break; + case 1: + a2 = *(signed char*)(buf); + c += a2; + c ^= (c << 10); + a2 = (c >> 1); + break; + default: + break; + } + if(rem != 0){ + c+=a2; + } + + c ^= (c << 3); + c += (c >> 5); + c ^= (c << 4); + c += (c >> 17); + c ^= (c << 25); + c += (c >> 6); + + return (unsigned int)c; +} + +static void enhance(unsigned char buf[], unsigned int size, + unsigned char codetable[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (codetable == NULL)){ + return; + } + do{ + tmp = buf[--size]; + buf[size] = tmp ^ codetable[table_ptr] ^ var; + var += size + tmp; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + + +/****************************************************************** + * NP_GetData (NPCLIENT.8) + * + * + */ +int __stdcall NPCLIENT_NP_GetData(tir_data_t * data) +{ + float r, p, y, tx, ty, tz; + unsigned int frame; + int res = linuxtrack_get_pose(&y, &p, &r, &tx, &ty, &tz, &frame); + memset((char *)data, 0, sizeof(tir_data_t)); + data->status = (linuxtrack_get_tracking_state() == RUNNING) ? 0 : 1; + data->frame = frame & 0xFFFF; + data->cksum = 0; + data->roll = r / 180.0 * 16383; + data->pitch = -p / 180.0 * 16383; + data->yaw = y / 180.0 * 16383; + data->tx = -limit_num(-16383.0, 15 * tx, 16383); + data->ty = limit_num(-16383.0, 15 * ty, 16383); + data->tz = limit_num(-16383.0, 15 * tz, 16383); + data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t)); + //printf("Cksum: %04X\n", data->cksum); + if(crypted){ + enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table)); + } + return (res >= 0) ? 0: 1; +} +/****************************************************************** + * NP_GetParameter (NPCLIENT.9) + * + * + */ +int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1) +{ + dbg_report("GetParameter request: %d %d\n", arg0, arg1); + TRACE("(void): stub\n"); + return (int) 0; +} + +/****************************************************************** + * NP_GetSignature (NPCLIENT.10) + * + * + */ +int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig) +{ + dbg_report("GetSignature request\n"); + if(getSomeSeriousPoetry(sig->DllSignature, sig->AppSignature)){ + printf("Signature result: OK\n"); + return 0; + }else{ + printf("Signature result: NOT OK!\n"); + return 1; + } +} +/****************************************************************** + * NP_QueryVersion (NPCLIENT.11) + * + * + */ +int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version) +{ + dbg_report("QueryVersion request\n"); + *version=0x0500; + return 0; +} +/****************************************************************** + * NP_ReCenter (NPCLIENT.12) + * + * + */ +int __stdcall NPCLIENT_NP_ReCenter(void) +{ + dbg_report("ReCenter request\n"); + linuxtrack_recenter(); + return 0; +} + +/****************************************************************** + * NP_RegisterProgramProfileID (NPCLIENT.13) + * + * + */ +int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id) +{ + dbg_report("RegisterProgramProfileID request: %d\n", id); + game_desc_t gd; + if(game_data_get_desc(id, &gd)){ + printf("Application ID: %d - %s!!!\n", id, gd.name); + if(game_data_get_desc(id, &gd)){ + crypted = gd.encrypted; + if(gd.encrypted){ + printf("Table: %02X %02X %02X %02X %02X %02X %02X %02X\n", table[0],table[1],table[2],table[3],table[4], + table[5], table[6], table[7]); + table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + } + } + if(linuxtrack_init(gd.name) != 0){ + return 1; + } + }else{ + if(!linuxtrack_init("Default")){ + return 1; + } + } + linuxtrack_suspend(); + return 0; +} +/****************************************************************** + * NP_RegisterWindowHandle (NPCLIENT.14) + * + * + */ +int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd) +{ + dbg_report("RegisterWindowHandle request: 0x%X\n", hwnd); + TRACE("((HWND)%p): stub\n",hwnd); + return (int) 0; +} +/****************************************************************** + * NP_RequestData (NPCLIENT.15) + * + * + */ +int __stdcall NPCLIENT_NP_RequestData(unsigned short req) +{ + dbg_report("RequestData request: %d\n", req); + TRACE("((unsigned short)%d): stub\n",req); + return (int) 0; +} +/****************************************************************** + * NP_SetParameter (NPCLIENT.16) + * + * + */ +int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1) +{ + dbg_report("SetParameter request: %d %d\n", arg0, arg1); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StartCursor (NPCLIENT.17) + * + * + */ +int __stdcall NPCLIENT_NP_StartCursor(void) +{ + dbg_report("StartCursor request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StartDataTransmission (NPCLIENT.18) + * + * + */ +int __stdcall NPCLIENT_NP_StartDataTransmission(void) +{ + dbg_report("StartDataTransmission request\n"); + linuxtrack_wakeup(); + return 0; +} +/****************************************************************** + * NP_StopCursor (NPCLIENT.19) + * + * + */ +int __stdcall NPCLIENT_NP_StopCursor(void) +{ + dbg_report("StopCursor request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StopDataTransmission (NPCLIENT.20) + * + * + */ +int __stdcall NPCLIENT_NP_StopDataTransmission(void) +{ + dbg_report("StopDataTransmission request\n"); + linuxtrack_suspend(); + return 0; +} +/****************************************************************** + * NP_UnregisterWindowHandle (NPCLIENT.21) + * + * + */ +int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void) +{ + dbg_report("UnregisterWindowHandle request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} + diff --git a/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c new file mode 100644 index 00000000..f80a7d44 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c @@ -0,0 +1,150 @@ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include + +//First 5 bytes is MD5 hash of "NaturalPoint" +static uint8_t secret_key[] = {0x0e, 0x9a, 0x63, 0x71, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static uint8_t S[256] = {0}; + +static char *decoded = NULL; + +static mxml_node_t *xml = NULL; +static mxml_node_t *tree = NULL; + +static void ksa(uint8_t key[], size_t len) +{ + unsigned int i, j; + for(i = 0; i < 256; ++i){ + S[i] = i; + } + j = 0; + for(i = 0; i < 256; ++i){ + j = (j + S[i] + key[i % len]) % 256; + uint8_t tmp = S[i]; + S[i] = S[j]; + S[j] = tmp; + } +} + +static uint8_t rc4() +{ + static uint8_t i = 0; + static uint8_t j = 0; + + i += 1; + j += S[i]; + uint8_t tmp = S[i]; + S[i] = S[j]; + S[j] = tmp; + return S[(S[i] + S[j]) % 256]; +} + +static bool decrypt_file(const char *fname, bool from_update) +{ + uint32_t header[5]; + size_t datlen; + ksa(secret_key, 16); + FILE *inp; + struct stat fst; + + if((inp = fopen(fname, "rb")) == NULL){ + printf("Can't open input file '%s'", fname); + return false; + } + + if(fstat(fileno(inp), &fst) != 0){ + fclose(inp); + printf("Cannot stat file '%s'\n", fname); + return false; + } + + if(from_update){ + if(fread(&header, sizeof(uint32_t), 5, inp) != 5){ + fclose(inp); + printf("Can't read the header - file '%s' is less than 20 bytes long?\n", fname); + return false; + } + datlen = header[4]; + }else{ + datlen = fst.st_size; + } + if((decoded = (char *)malloc(datlen+1)) == NULL){ + printf("malloc failed!\n"); + return false; + } + memset(decoded, 0, datlen+1); + size_t i; + size_t len = fread(decoded, 1, datlen, inp); + (void) len; + for(i = 0; i < datlen; ++i) decoded[i] ^= rc4(); + fclose(inp); + + //inp = fopen("tmp.dump", "w"); + //fwrite(decoded, 1, datlen, inp); + //fclose(inp); + + return true; +} + +static bool game_data_init(const char *fname, bool from_update) +{ + static bool initialized = false; + if(initialized){ + return true; + } + if(!decrypt_file(fname, from_update)){ + printf("Error decrypting file!\n"); + return false; + } + xml = mxmlNewXML("1.0"); + tree = mxmlLoadString(xml, decoded, MXML_TEXT_CALLBACK); + return (tree != NULL); +} + +static void game_data_close() +{ + mxmlDelete(tree); + free(decoded); +} + +#define ltr_int_log_message(...) fprintf(stderr, __VA_ARGS__) + +bool get_game_data(const char *input_fname, const char *output_fname, bool from_update) +{ + FILE *outfile = NULL; + if((outfile = (output_fname ? fopen(output_fname, "w") : stdout)) == NULL){ + ltr_int_log_message("Can't open the output file '%s'!\n", output_fname); + return false; + } + if(!game_data_init(input_fname, from_update)){ + ltr_int_log_message("Can't process the data file '%s'!\n", input_fname); + return false; + } + + mxml_node_t *game; + const char *name; + const char *id; + for(game = mxmlFindElement(tree, tree, "Game", NULL, NULL, MXML_DESCEND); + game != NULL; + game = mxmlFindElement(game, tree, "Game", NULL, NULL, MXML_DESCEND)){ + name = mxmlElementGetAttr(game, "Name"); + id = mxmlElementGetAttr(game, "Id"); + + mxml_node_t *appid = mxmlFindElement(game, game, "ApplicationID", NULL, NULL, MXML_DESCEND); + if(appid == NULL){ + fprintf(outfile, "%s \"%s\"\n", id, name); + }else{ + fprintf(outfile, "%s \"%s\" (%s)\n", id, name, appid->child->value.text.string); + } + } + fclose(outfile); + game_data_close(); + return true; +} + +int main(int argc, char** argv) { return argc > 1 && get_game_data(argv[1], NULL, false); } diff --git a/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h new file mode 100644 index 00000000..b71f7a15 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h @@ -0,0 +1,17 @@ +#ifndef GAME_DATA__H +#define GAME_DATA__H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +bool get_game_data(const char *input_fname, const char *output_fname, bool from_update); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am new file mode 100644 index 00000000..e025209a --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am @@ -0,0 +1,78 @@ +noinst_SCRIPTS = +if WINE_PLUGIN + noinst_SCRIPTS += Tester.exe +if WINE64 + noinst_SCRIPTS += Tester64.exe +endif #WINE64 +endif #WINE_PLUGIN + +if DARWIN + LDFLAGS += -Wl,-no_arch_warnings +else + LDFLAGS += -Wl,--no-warn-search-mismatch +endif + +CC = winegcc + +CXX = wineg++ + +SUFFIXES = .o .cpp .c .rc 64.o + +.cpp.o : + $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS) -m32 -o $@ $< + +.cpp64.o : + $(CXX) -c $(CXXFLAGS) -o $@ $< + +.c64.o : + $(CC) -c $(CFLAGS) -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< + +CXXFLAGS += -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS += -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + + +Tester64.exe : main64.o rest64.o npifc64.o npview.o + wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ + +Tester.exe : main.o npview.o rest.o npifc.o + wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +main.o : main.cpp Makefile + +main64.o : main.cpp Makefile + +npview.o : npview.rc + +rest.o : rest.c rest.h Makefile + +rest64.o : rest.c rest.h Makefile + +npifc.o : npifc.c npifc.h Makefile + +npifc64.o : CFLAGS+="-DFOR_WIN64=1" +npifc64.o : npifc.c npifc.h Makefile + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h + diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in new file mode 100644 index 00000000..cc49d754 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in @@ -0,0 +1,512 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WINE_PLUGIN_TRUE@am__append_1 = Tester.exe +@WINE64_TRUE@@WINE_PLUGIN_TRUE@am__append_2 = Tester64.exe +@DARWIN_TRUE@am__append_3 = -Wl,-no_arch_warnings +@DARWIN_FALSE@am__append_4 = -Wl,--no-warn-search-mismatch +subdir = src/wine_bridge/tester +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/npview.rc.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = npview.rc +CONFIG_CLEAN_VPATH_FILES = +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON = @BISON@ +CC = winegcc +CFLAGS = @CFLAGS@ -g -I../.. -I../../.. -DHAVE_CONFIG_H \ + -I@srcdir@/../.. -I@top_builddir@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = wineg++ +CXXCPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ -g -DHAVE_CONFIG_H -I../../.. -I. \ + -I@srcdir@/../.. -I@top_builddir@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ $(am__append_3) $(am__append_4) +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIB32DIR = @LIB32DIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENCV_CFLAGS = @OPENCV_CFLAGS@ +OPENCV_LIBS = @OPENCV_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +QMAKE_PATH = @QMAKE_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINE64_LIBS = @WINE64_LIBS@ +WINE_LIBS = @WINE_LIBS@ +XPL_CPPFLAGS = @XPL_CPPFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_makensis = @with_makensis@ +with_wine64 = @with_wine64@ +noinst_SCRIPTS = $(am__append_1) $(am__append_2) +SUFFIXES = .o .cpp .c .rc 64.o +RCFLAGS = -I @srcdir@ +EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .rc 64.o +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +npview.rc: $(top_builddir)/config.status $(srcdir)/npview.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distclean-local distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + + +.cpp.o : + $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS) -m32 -o $@ $< + +.cpp64.o : + $(CXX) -c $(CXXFLAGS) -o $@ $< + +.c64.o : + $(CC) -c $(CFLAGS) -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +Tester64.exe : main64.o rest64.o npifc64.o npview.o + wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ + +Tester.exe : main.o npview.o rest.o npifc.o + wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +main.o : main.cpp Makefile + +main64.o : main.cpp Makefile + +npview.o : npview.rc + +rest.o : rest.c rest.h Makefile + +rest64.o : rest.c rest.h Makefile + +npifc.o : npifc.c npifc.h Makefile + +npifc64.o : CFLAGS+="-DFOR_WIN64=1" +npifc64.o : npifc.c npifc.h Makefile + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/main.cpp b/facetracknoir/clientfiles/very-important-source-code/tester/main.cpp new file mode 100644 index 00000000..95ca0d9b --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/main.cpp @@ -0,0 +1,100 @@ +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include "resource.h" +#include "rest.h" +#include "npifc.h" + +HINSTANCE hInst; +UINT_PTR timer = 0; + +VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + (void) uMsg; + (void) idEvent; + (void) dwTime; + tir_data_t td; + npifc_getdata(&td); + SetDlgItemInt(hwnd, IDC_PITCH, td.pitch, true); + SetDlgItemInt(hwnd, IDC_ROLL, td.roll, true); + SetDlgItemInt(hwnd, IDC_YAW, td.yaw, true); + + SetDlgItemInt(hwnd, IDC_X1, td.tx, true); + SetDlgItemInt(hwnd, IDC_Y1, td.ty, true); + SetDlgItemInt(hwnd, IDC_Z1, td.tz, true); + + SetDlgItemInt(hwnd, IDC_X2, td.padding[0], true); + SetDlgItemInt(hwnd, IDC_Y2, td.padding[1], true); + SetDlgItemInt(hwnd, IDC_Z2, td.padding[2], true); + SetDlgItemInt(hwnd, IDC_X3, td.padding[3], true); + SetDlgItemInt(hwnd, IDC_Y3, td.padding[4], true); + SetDlgItemInt(hwnd, IDC_Z3, td.padding[5], true); + SetDlgItemInt(hwnd, IDC_S, td.status, true); + SetDlgItemInt(hwnd, IDC_F, td.frame, true); +} + +BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + (void) lParam; + switch(uMsg) + { + case WM_INITDIALOG: + SetDlgItemInt(hwndDlg, IDC_APPID, 2307, true); + return TRUE; + + case WM_CLOSE: + EndDialog(hwndDlg, 0); + return TRUE; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + /* + * TODO: Add more control ID's, when needed. + */ + case IDQUIT: + npifc_close(); + EndDialog(hwndDlg, 0); + return TRUE; + case IDSTART: + int ok; + int num = GetDlgItemInt(hwndDlg, IDC_APPID, (BOOL*)&ok, false); + if(!ok){ + num = 2307; + } + game_desc_t gd; + if(timer != 0){ + KillTimer(hwndDlg, timer); + timer = 0; + } + if(game_data_get_desc(num, &gd)){ + printf("Application ID: %d - %s\n", num, gd.name); + if(npifc_init(hwndDlg, num)){ + timer = SetTimer(hwndDlg, 0, 50, TimerProcedure); + } + }else{ + printf("Unknown Application ID: %d\n", num); + } + break; + + } + } + + return FALSE; +} + + +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) +{ + (void) hPrevInstance; + (void) lpCmdLine; + (void) nShowCmd; + hInst = hInstance; + + // The user interface is a modal dialog box + return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); +} + + diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/npifc.c b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.c new file mode 100644 index 00000000..b036464e --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.c @@ -0,0 +1,302 @@ +#define _GNU_SOURCE +#include +#include +#define WIN32_LEAN_AND_MEAN +#include +#include "npifc.h" +#include "rest.h" + + +tir_signature_t ts; +HMODULE npclient; +/* +typedef int (*NP_RegisterWindowHandle_t)(HWND hwnd); +typedef int (*NP_UnregisterWindowHandle_t)(void); +typedef int (*NP_RegisterProgramProfileID_t)(unsigned short id); +typedef int (*NP_QueryVersion_t)(unsigned short *version); +typedef int (*NP_RequestData_t)(unsigned short req); +typedef int (*NP_GetSignature_t)(tir_signature_t *sig); +typedef int (*NP_GetData_t)(tir_data_t *data); +typedef int (*NP_GetParameter_t)(void); +typedef int (*NP_SetParameter_t)(void); +typedef int (*NP_StartCursor_t)(void); +typedef int (*NP_StopCursor_t)(void); +typedef int (*NP_ReCenter_t)(void); +typedef int (*NP_StartDataTransmission_t)(void); +typedef int (*NP_StopDataTransmission_t)(void); +*/ +NP_RegisterWindowHandle_t NP_RegisterWindowHandle = NULL; +NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle = NULL; +NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID = NULL; +NP_QueryVersion_t NP_QueryVersion = NULL; +NP_RequestData_t NP_RequestData = NULL; +NP_GetSignature_t NP_GetSignature = NULL; +NP_GetData_t NP_GetData = NULL; +NP_GetParameter_t NP_GetParameter = NULL; +NP_SetParameter_t NP_SetParameter = NULL; +NP_StartCursor_t NP_StartCursor = NULL; +NP_StopCursor_t NP_StopCursor = NULL; +NP_ReCenter_t NP_ReCenter = NULL; +NP_StartDataTransmission_t NP_StartDataTransmission = NULL; +NP_StopDataTransmission_t NP_StopDataTransmission = NULL; + +bool crypted = false; + + + +unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +char *client_path() +{ + HKEY hkey = 0; + RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", 0, + KEY_QUERY_VALUE, &hkey); + if(!hkey){ + printf("Can't open registry key\n"); + return NULL; + } + + BYTE path[1024]; + DWORD buf_len = 1024; + LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); + char *full_path = NULL; + int res = -1; + if(result == ERROR_SUCCESS && buf_len > 0){ +#ifdef FOR_WIN64 + res = asprintf(&full_path, "%s/NPClient64.dll", path); +#else + res = asprintf(&full_path, "%s/NPClient.dll", path); +#endif + } + RegCloseKey(hkey); + if(res > 0){ + return full_path; + }else{ + return NULL; + } +} + +bool initialized = false; + +bool npifc_init(HWND wnd, int id) +{ + //table[] = {0xb3, 0x16, 0x36, 0xeb, 0xb9, 0x05, 0x4f, 0xa4}; + game_desc_t gd; + if(game_data_get_desc(id, &gd)){ + crypted = gd.encrypted; + if(gd.encrypted){ + table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + } + } + printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + table[0], table[1], table[2], table[3], + table[4], table[5], table[6], table[7]); + + char *client = client_path(); + if(client == NULL){ + printf("Couldn't obtain client path!\n"); + return false; + } + npclient = LoadLibrary(client); + if(!npclient){ + printf("Can't load client %s\n", client); + return false; + } + + NP_RegisterWindowHandle = (NP_RegisterWindowHandle_t)GetProcAddress(npclient, "NP_RegisterWindowHandle"); + NP_UnregisterWindowHandle = (NP_UnregisterWindowHandle_t)GetProcAddress(npclient, "NP_UnregisterWindowHandle"); + NP_RegisterProgramProfileID = (NP_RegisterProgramProfileID_t)GetProcAddress(npclient, "NP_RegisterProgramProfileID"); + NP_QueryVersion = (NP_QueryVersion_t)GetProcAddress(npclient, "NP_QueryVersion"); + NP_RequestData = (NP_RequestData_t)GetProcAddress(npclient, "NP_RequestData"); + NP_GetSignature = (NP_GetSignature_t)GetProcAddress(npclient, "NP_GetSignature"); + NP_GetData = (NP_GetData_t)GetProcAddress(npclient, "NP_GetData"); + NP_GetParameter = (NP_GetParameter_t)GetProcAddress(npclient, "NP_GetParameter"); + NP_SetParameter = (NP_SetParameter_t)GetProcAddress(npclient, "NP_SetParameter"); + NP_StartCursor = (NP_StartCursor_t)GetProcAddress(npclient, "NP_StartCursor"); + NP_StopCursor = (NP_StopCursor_t)GetProcAddress(npclient, "NP_StopCursor"); + NP_ReCenter = (NP_ReCenter_t)GetProcAddress(npclient, "NP_ReCenter"); + NP_StartDataTransmission = (NP_StartDataTransmission_t)GetProcAddress(npclient, "NP_StartDataTransmission"); + NP_StopDataTransmission = (NP_StopDataTransmission_t)GetProcAddress(npclient, "NP_StopDataTransmission"); + if((NP_RegisterWindowHandle == NULL) || (NP_UnregisterWindowHandle == NULL) + || (NP_RegisterProgramProfileID == NULL) || (NP_QueryVersion == NULL) || (NP_RequestData == NULL) + || (NP_GetSignature == NULL) || (NP_GetData == NULL) || (NP_GetParameter == NULL) + || (NP_SetParameter == NULL) || (NP_StartCursor == NULL) || (NP_StopCursor == NULL) + || (NP_ReCenter == NULL) || (NP_StartDataTransmission == NULL) || (NP_StopDataTransmission == NULL)){ + printf("Couldn't bind all necessary functions!\n"); + return false; + } + tir_signature_t sig; + int res; + if((res = NP_GetSignature(&sig)) != 0){ + printf("Error retrieving signature! %d\n", res); + return false; + } + printf("Dll Sig:%s\nApp Sig2:%s\n", sig.DllSignature, sig.AppSignature); + NP_RegisterWindowHandle(wnd); + if(NP_RegisterProgramProfileID(id) != 0){ + printf("Couldn't register profile id!\n"); + return false; + } + printf("Program profile registered!\n"); + NP_RequestData(65535); + NP_StopCursor(); + NP_StartDataTransmission(); + initialized = true; + return true; +} + +void npifc_close() +{ + if(initialized){ + NP_StopDataTransmission(); + NP_StartCursor(); + NP_UnregisterWindowHandle(); + } + initialized = false; +} + +void c_encrypt(unsigned char buf[], unsigned int size, + unsigned char code_table[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (code_table == NULL)) + return; + do{ + tmp = buf[--size]; + buf[size] = tmp ^ code_table[table_ptr] ^ var; + var += size + tmp; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + + + +void decrypt(unsigned char buf[], unsigned int size, + unsigned char code_table[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (code_table == NULL)){ + return; + } + do{ + tmp = buf[--size]; + buf[size] = tmp ^ code_table[table_ptr] ^ var; + var += size + buf[size]; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + +unsigned int cksum(unsigned char buf[], unsigned int size) +{ + if((size == 0) || (buf == NULL)){ + return 0; + } + int rounds = size >> 2; + int rem = size % 4; + + int c = size; + int a0 = 0; + int a2 = 0; + + while(rounds != 0){ + a0 = *(short int*)buf; + a2 = *(short int*)(buf+2); + buf += 4; + c += a0; + a2 ^= (c << 5); + a2 <<= 11; + c ^= a2; + c += (c >> 11); + --rounds; + } + switch(rem){ + case 3: + a0 = *(short int*)buf; + a2 = *(signed char*)(buf+2); + c += a0; + a2 = (a2 << 2) ^ c; + c ^= (a2 << 16); + a2 = (c >> 11); + break; + case 2: + a2 = *(short int*)buf; + c += a2; + c ^= (c << 11); + a2 = (c >> 17); + break; + case 1: + a2 = *(signed char*)(buf); + c += a2; + c ^= (c << 10); + a2 = (c >> 1); + break; + default: + break; + } + if(rem != 0){ + c+=a2; + } + + c ^= (c << 3); + c += (c >> 5); + c ^= (c << 4); + c += (c >> 17); + c ^= (c << 25); + c += (c >> 6); + + return (unsigned int)c; +} + +int decode_frame(tir_data_t *td) +{ + //printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + // table[0], table[1], table[2], table[3], + // table[4], table[5], table[6], table[7]); + unsigned int csum; + decrypt((unsigned char*)td, sizeof(*td), table, sizeof(table)); + csum = td->cksum; + td->cksum = 0; + if(csum != cksum((unsigned char*)td, sizeof(*td))){ + printf("Problem with frame!\n"); + //int a0; + //printf("Dec: "); + //for(a0 = 0; a0 < (int)sizeof(tir_data_t); ++a0) + //{ + // printf("%02X", ((unsigned char *)td)[a0]); + //} + //printf("\n"); + //printf("Cksum: %04X vs computed: %04X\n", csum, cksum((unsigned char*)td, sizeof(*td))); + return -1; + } + //printf("Frame OK!\n"); + return 0; +} + +int npifc_getdata(tir_data_t *data) +{ + int res = NP_GetData(data); + if(crypted){ + decode_frame(data); + } + return res; +} + diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/npifc.h b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.h new file mode 100644 index 00000000..d580e16d --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.h @@ -0,0 +1,66 @@ +#ifndef NPIFC__H +#define NPIFC__H + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + bool npifc_init(HWND wnd, int id); + void npifc_close(); + +#pragma pack(1) +typedef struct tir_data{ + short status; + short frame; + unsigned int cksum; + float roll, pitch, yaw; + float tx, ty, tz; + float padding[9]; +} tir_data_t; + +typedef struct tir_signature{ + char DllSignature[200]; + char AppSignature[200]; +} tir_signature_t; +#pragma pack(0) + +int npifc_getdata(tir_data_t *data); + +typedef int __stdcall (*NP_RegisterWindowHandle_t)(HWND hwnd); +typedef int __stdcall (*NP_UnregisterWindowHandle_t)(void); +typedef int __stdcall (*NP_RegisterProgramProfileID_t)(unsigned short id); +typedef int __stdcall (*NP_QueryVersion_t)(unsigned short *version); +typedef int __stdcall (*NP_RequestData_t)(unsigned short req); +typedef int __stdcall (*NP_GetSignature_t)(tir_signature_t *sig); +typedef int __stdcall (*NP_GetData_t)(tir_data_t *data); +typedef int __stdcall (*NP_GetParameter_t)(void); +typedef int __stdcall (*NP_SetParameter_t)(void); +typedef int __stdcall (*NP_StartCursor_t)(void); +typedef int __stdcall (*NP_StopCursor_t)(void); +typedef int __stdcall (*NP_ReCenter_t)(void); +typedef int __stdcall (*NP_StartDataTransmission_t)(void); +typedef int __stdcall (*NP_StopDataTransmission_t)(void); + +extern NP_RegisterWindowHandle_t NP_RegisterWindowHandle; +extern NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle; +extern NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID; +extern NP_QueryVersion_t NP_QueryVersion; +extern NP_RequestData_t NP_RequestData; +extern NP_GetSignature_t NP_GetSignature; +extern NP_GetData_t NP_GetData; +extern NP_GetParameter_t NP_GetParameter; +extern NP_SetParameter_t NP_SetParameter; +extern NP_StartCursor_t NP_StartCursor; +extern NP_StopCursor_t NP_StopCursor; +extern NP_ReCenter_t NP_ReCenter; +extern NP_StartDataTransmission_t NP_StartDataTransmission; +extern NP_StopDataTransmission_t NP_StopDataTransmission; + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in b/facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in new file mode 100644 index 00000000..231002f1 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in @@ -0,0 +1,49 @@ +// Generated by ResEdit 1.5.9 +// Copyright (C) 2006-2011 +// http://www.resedit.net + +#include +#include +#include +#include "resource.h" + +#ifdef HAVE_CONFIG_H + #include "../../../config.h" +#endif + + + +// +// Dialog resources +// +//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOGEX 0, 0, 379, 124 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "NPTest v@PACKAGE_VERSION@" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "Quit", IDQUIT, 262, 102, 50, 14 + DEFPUSHBUTTON "Start", IDSTART, 7, 102, 50, 14 + EDITTEXT IDC_PITCH, 32, 32, 51, 14, ES_AUTOHSCROLL + LTEXT "Pitch", IDC_STATIC, 11, 34, 20, 8, SS_LEFT + LTEXT "Yaw", IDC_STATIC, 11, 59, 20, 8, SS_LEFT + EDITTEXT IDC_YAW, 32, 57, 51, 14, ES_AUTOHSCROLL + LTEXT "Roll", IDC_STATIC, 11, 84, 20, 8, SS_LEFT + EDITTEXT IDC_ROLL, 32, 82, 51, 14, ES_AUTOHSCROLL + LTEXT "X", IDC_STATIC, 101, 35, 6, 8, SS_LEFT + EDITTEXT IDC_X1, 112, 32, 51, 14, ES_AUTOHSCROLL + LTEXT "Y", IDC_STATIC, 101, 60, 6, 8, SS_LEFT + EDITTEXT IDC_Y1, 112, 57, 51, 14, ES_AUTOHSCROLL + LTEXT "Z", IDC_STATIC, 101, 85, 6, 8, SS_LEFT + EDITTEXT IDC_Z1, 112, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_X2, 172, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Y2, 172, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Z2, 172, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_X3, 232, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Y3, 232, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Z3, 232, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_S, 292, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_F, 292, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_APPID, 32, 12, 51, 12, ES_AUTOHSCROLL + LTEXT "ID", IDC_STATIC, 17, 14, 8, 8, SS_LEFT +} diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/resource.h b/facetracknoir/clientfiles/very-important-source-code/tester/resource.h new file mode 100644 index 00000000..328d9cb7 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/resource.h @@ -0,0 +1,23 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_DIALOG1 100 +#define IDQUIT 1002 +#define IDSTART 1003 +#define IDC_APPID 1016 +#define IDC_PITCH 1017 +#define IDC_YAW 1018 +#define IDC_ROLL 1019 +#define IDC_X1 1020 +#define IDC_X2 1021 +#define IDC_X3 1022 +#define IDC_Y1 1023 +#define IDC_Y2 1024 +#define IDC_Y3 1025 +#define IDC_Z1 1026 +#define IDC_Z2 1027 +#define IDC_Z3 1028 +#define IDC_S 1029 +#define IDC_F 1030 + diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/rest.c b/facetracknoir/clientfiles/very-important-source-code/tester/rest.c new file mode 120000 index 00000000..663c21a9 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/rest.c @@ -0,0 +1 @@ +../client/rest.c \ No newline at end of file diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/rest.h b/facetracknoir/clientfiles/very-important-source-code/tester/rest.h new file mode 120000 index 00000000..6dca182a --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/rest.h @@ -0,0 +1 @@ +../client/rest.h \ No newline at end of file diff --git a/facetracknoir/plugin-qt-api.hpp b/facetracknoir/plugin-qt-api.hpp index 0e2e3c32..1697d8e7 100644 --- a/facetracknoir/plugin-qt-api.hpp +++ b/facetracknoir/plugin-qt-api.hpp @@ -56,7 +56,6 @@ struct ITracker virtual ~ITracker() = 0; virtual void StartTracker( QFrame* frame ) = 0; virtual void GetHeadPoseData(double *data) = 0; - virtual int preferredHz() { return 200; } }; inline ITracker::~ITracker() {} diff --git a/facetracknoir/pose.hpp b/facetracknoir/pose.hpp new file mode 100644 index 00000000..ec9faaa3 --- /dev/null +++ b/facetracknoir/pose.hpp @@ -0,0 +1,66 @@ +#pragma once + +#include +#include +#include "./quat.hpp" +#include "./plugin-api.hpp" + +class Pose { +private: + static constexpr double pi = 3.141592653; + static constexpr double d2r = pi/180.0; + static constexpr double r2d = 180./pi; + + double axes[6]; +public: + Pose() : axes {0,0,0, 0,0,0 } {} + + inline operator double*() { return axes; } + inline operator const double*() const { return axes; } + + inline double& operator()(int i) { return axes[i]; } + inline double operator()(int i) const { return axes[i]; } + + Quat quat() const + { + return Quat(axes[Yaw]*d2r, axes[Pitch]*d2r, axes[Roll]*d2r); + } + + static Pose fromQuat(const Quat& q) + { + Pose ret; + q.to_euler_degrees(ret(Yaw), ret(Pitch), ret(Roll)); + return ret; + } + + Pose operator-(const Pose& B) const + { + const Quat q = (quat() * B.quat().inv()); + Pose ret = fromQuat(q); + for (int i = TX; i < Yaw; i++) + ret(i) = B(i); + return ret; + } + + Pose operator+(const Pose& B) const + { + const Quat q = (quat() * B.quat().inv()); + Pose ret = fromQuat(q); + for (int i = TX; i < Yaw; i++) + ret(i) = B(i); + return ret; + } + + Pose operator|(const Pose& replacement) const + { + Pose ret = *this; + for (int i = 0; i < 6; i++) + { + static constexpr double eps = 1e-5; + // NB replace zero-valued elements with argument's + if (std::abs(ret(i)) < eps) + ret(i) = replacement(i); + } + return ret; + } +}; diff --git a/facetracknoir/quat.hpp b/facetracknoir/quat.hpp index 1e268963..6d777b28 100644 --- a/facetracknoir/quat.hpp +++ b/facetracknoir/quat.hpp @@ -14,7 +14,7 @@ private: static constexpr double r2d = 180./pi; double a,b,c,d; // quaternion coefficients public: - Quat() : a(1.0),b(0.0),c(0.0),d(0.0) {} + Quat() : a(1.),b(0.),c(0.),d(0.) {} Quat(double yaw, double pitch, double roll) { from_euler_rads(yaw, pitch, roll); } Quat(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} @@ -27,12 +27,12 @@ public: void from_euler_rads(double yaw, double pitch, double roll) { - double sin_phi = sin(roll/2.0); - double cos_phi = cos(roll/2.0); - double sin_the = sin(pitch/2.0); - double cos_the = cos(pitch/2.0); - double sin_psi = sin(yaw/2.0); - double cos_psi = cos(yaw/2.0); + const double sin_phi = sin(roll/2.); + const double cos_phi = cos(roll/2.); + const double sin_the = sin(pitch/2.); + const double cos_the = cos(pitch/2.); + const double sin_psi = sin(yaw/2.); + const double cos_psi = cos(yaw/2.); a = cos_phi*cos_the*cos_psi + sin_phi*sin_the*sin_psi; b = sin_phi*cos_the*cos_psi - cos_phi*sin_the*sin_psi; @@ -42,9 +42,9 @@ public: void to_euler_rads(double& yaw, double& pitch, double& roll) const { - roll = atan2(2.0*(a*b + c*d), 1.0 - 2.0*(b*b + c*c)); - pitch = asin(2.0*(a*c - b*d)); - yaw = atan2(2.0*(a*d + b*c), 1.0 - 2.0*(c*c + d*d)); + roll = atan2(2.*(a*b + c*d), 1. - 2.*(b*b + c*c)); + pitch = asin(2.*(a*c - b*d)); + yaw = atan2(2.*(a*d + b*c), 1. - 2.*(c*c + d*d)); } void to_euler_degrees(double& yaw, double& pitch, double& roll) const @@ -59,8 +59,8 @@ public: { const Quat& A = *this; return Quat(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication - A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, - A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, - A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); + A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, + A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, + A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); } }; diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 0c2d289f..e1f86294 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -12,8 +12,7 @@ * originally written by Wim Vriend. */ -#include "tracker.h" -#include "facetracknoir.h" +#include "./tracker.h" #include #include #include @@ -49,9 +48,10 @@ void Tracker::get_curve(double pos, double& out, Mapping& axis) { static void t_compensate(double* input, double* output, bool rz) { - const auto H = input[Yaw] * M_PI / -180; - const auto P = input[Pitch] * M_PI / -180; - const auto B = input[Roll] * M_PI / 180; + static constexpr double pi = 3.141592653; + const auto H = input[Yaw] * pi / -180; + const auto P = input[Pitch] * pi / -180; + const auto B = input[Roll] * pi / 180; const auto cosH = cos(H); const auto sinH = sin(H); @@ -83,15 +83,10 @@ static void t_compensate(double* input, double* output, bool rz) } void Tracker::run() { - T6DOF pose_offset, unstopped_pose; + Pose pose_offset, unstopped_pose; double newpose[6] = {0}; - int sleep_ms = 15; - - if (Libraries->pTracker) - sleep_ms = std::min(sleep_ms, 1000 / Libraries->pTracker->preferredHz()); - - qDebug() << "tracker Hz:" << 1000 / sleep_ms; + const int sleep_ms = 3; #if defined(_WIN32) (void) timeBeginPeriod(1); @@ -104,9 +99,7 @@ void Tracker::run() { if (should_quit) break; - if (Libraries->pTracker) { - Libraries->pTracker->GetHeadPoseData(newpose); - } + Libraries->pTracker->GetHeadPoseData(newpose); { QMutexLocker foo(&mtx); @@ -130,15 +123,12 @@ void Tracker::run() { if (enabledp) unstopped_pose = raw_6dof; - { + if (Libraries->pFilter) + Libraries->pFilter->FilterHeadPoseData(unstopped_pose, output_pose); + else + output_pose = unstopped_pose; - if (Libraries->pFilter) - Libraries->pFilter->FilterHeadPoseData(unstopped_pose, output_pose); - else - output_pose = unstopped_pose; - - output_pose = output_pose - pose_offset; - } + output_pose = output_pose - pose_offset; for (int i = 0; i < 6; i++) get_curve(output_pose(i), output_pose(i), m(i)); @@ -147,9 +137,7 @@ void Tracker::run() { if (s.tcomp_p) t_compensate(output_pose, output_pose, s.tcomp_tz); - if (Libraries->pProtocol) { - Libraries->pProtocol->sendHeadposeToGame(output_pose); - } + Libraries->pProtocol->sendHeadposeToGame(output_pose); } const long q = std::max(0L, sleep_ms * 1000L - std::max(0L, t.elapsed())); diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 3d9a3858..8a4ecb1f 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -10,14 +10,15 @@ #include #include #include -#include "plugin-support.h" -#include "mappings.hpp" +#include "./plugin-support.h" +#include "./mappings.hpp" +#include "./pose.hpp" #include #include #include -#include "tracker_types.h" +#include "./quat.hpp" #include "facetracknoir/main-settings.hpp" #include "facetracknoir/options.h" #include "facetracknoir/timer.hpp" @@ -30,7 +31,7 @@ private: // XXX can be const-cast when functionconfig const-correct -sh 20141004 Mappings& m; Timer t; - T6DOF output_pose, raw_6dof; + Pose output_pose, raw_6dof; std::atomic centerp; std::atomic enabledp; std::atomic should_quit; diff --git a/facetracknoir/tracker_types.h b/facetracknoir/tracker_types.h deleted file mode 100644 index 02aacdcf..00000000 --- a/facetracknoir/tracker_types.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#include -#include -#include "./quat.hpp" -#include "./plugin-api.hpp" - -struct T6DOF { -private: - static constexpr double pi = 3.141592653; - static constexpr double d2r = pi/180.0; - static constexpr double r2d = 180./pi; - - double axes[6]; -public: - T6DOF() : axes {0,0,0, 0,0,0 } {} - - inline operator double*() { return axes; } - inline operator const double*() const { return axes; } - - inline double& operator()(int i) { return axes[i]; } - inline double operator()(int i) const { return axes[i]; } - - Quat quat() const - { - return Quat(axes[Yaw]*d2r, axes[Pitch]*d2r, axes[Roll]*d2r); - } - - static T6DOF fromQuat(const Quat& q) - { - T6DOF ret; - q.to_euler_rads(ret(Yaw), ret(Pitch), ret(Roll)); - return ret; - } - - T6DOF operator-(const T6DOF& B) const - { - const Quat q = (quat() * B.quat().inv()); - T6DOF ret = fromQuat(q); - for (int i = TX; i < Yaw; i++) - ret(i) = B(i); - return ret; - } - - T6DOF operator+(const T6DOF& B) const - { - const Quat q = (quat() * B.quat().inv()); - T6DOF ret = fromQuat(q); - for (int i = TX; i < Yaw; i++) - ret(i) = B(i); - return ret; - } - - T6DOF operator|(const T6DOF& replacement) const - { - T6DOF ret = *this; - for (int i = 0; i < 6; i++) - { - static constexpr double eps = 1e-5; - // NB replace zero-valued elements with argument's - if (std::abs(ret(i)) < eps) - ret(i) = replacement(i); - } - return ret; - } -}; diff --git a/freetrackclient/build-msvc.sh b/freetrackclient/build-msvc.sh new file mode 100644 index 00000000..4fd303a0 --- /dev/null +++ b/freetrackclient/build-msvc.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +export PATH="/bin:/usr/bin:$PATH" + +case "$(uname -s 2>/dev/null)" in +*CYG*|*MING*|'') wrap= ;; +*) wrap=wine ;; +esac + +c_src=".\\freetrackclient.c" +c_bin="..\\facetracknoir\\clientfiles\\freetrackclient.dll" +opt_link="-nologo -LTCG -SAFESEH:NO -OPT:REF,ICF" +opt_cl=" +-nologo -arch:SSE2 -fp:fast -EHc -EH- -GL -GR- -GS- -Gw -LD -MT -O1 +-Ob2 -Og -Oi -Ot -Oy -QIfist -volatile:iso -Ze -Fe\"${c_bin}\" +" + +MSVC="VS140COMNTOOLS" + +test -z "$MSVC" && { + echo "uh-oh, no MSVC" >&2 + exit 1 +} + +sep="\&" + +cd "$(dirname "$0")" + +$wrap cmd.exe /C $(echo " + del /F /Q $c_bin $sep + call %${MSVC}%/vsvars32.bat 2>nul >nul $sep + cl $opt_cl $c_src -link $opt_link + " | tr '\n' ' ') diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index 200242b9..4bc39d67 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -18,6 +18,10 @@ * * created by the FreeTrack developers. * */ +#ifndef _MSC_VER +# warning "expect misnamed symbols" +#endif + #pragma GCC diagnostic ignored "-Wvariadic-macros" #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index a1e15721..1787ef2b 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -5,16 +5,15 @@ * copyright notice and this permission notice appear in all copies. */ +#include +#include +#include +#include +#include "./include/markerdetector.h" #include "ftnoir_tracker_aruco.h" -#include "ui_aruco-trackercontrols.h" #include "facetracknoir/plugin-api.hpp" -#include -#include "include/markerdetector.h" #include #include -#include -#include -#include #if defined(_WIN32) # undef NOMINMAX diff --git a/ftnoir_tracker_aruco/include/aruco.h b/ftnoir_tracker_aruco/include/aruco.h index 8ea583a8..569b95fb 100644 --- a/ftnoir_tracker_aruco/include/aruco.h +++ b/ftnoir_tracker_aruco/include/aruco.h @@ -26,12 +26,12 @@ The views and conclusions contained in the software and documentation are those authors and should not be interpreted as representing official policies, either expressed or implied, of Rafael Muñoz Salinas. - - + + \mainpage ArUco: Augmented Reality library from the University of Cordoba -ArUco is a minimal C++ library for detection of Augmented Reality markers based on OpenCv exclusively. +ArUco is a minimal C++ library for detection of Augmented Reality markers based on OpenCv exclusively. It is an educational project to show student how to detect augmented reality markers and it is provided under BSD license. @@ -54,11 +54,11 @@ Aruco allows the possibility to employ board. Boards are markers composed by an The library comes with five applications that will help you to learn how to use the library: - aruco_create_marker: which creates marker and saves it in a jpg file you can print. - - aruco_simple : simple test aplication that detects the markers in a image + - aruco_simple : simple test aplication that detects the markers in a image - aruco_test: this is the main application for detection. It reads images either from the camera of from a video and detect markers. Additionally, if you provide the intrinsics of the camera(obtained by OpenCv calibration) and the size of the marker in meters, the library calculates the marker intrinsics so that you can easily create your AR applications. - aruco_test_gl: shows how to use the library AR applications using OpenGL for rendering - aruco_create_board: application that helps you to create a board - - aruco_simple_board: simple test aplication that detects a board of markers in a image + - aruco_simple_board: simple test aplication that detects a board of markers in a image - aruco_test_board: application that detects boards - aruco_test_board_gl: application that detects boards and uses OpenGL to draw @@ -66,7 +66,7 @@ The library comes with five applications that will help you to learn how to use The ArUco library contents are divided in two main directories. The src directory, which contains the library itself. And the utils directory which contains the applications. -The library main classes are: +The library main classes are: - aruco::CameraParameters: represent the information of the camera that captures the images. Here you must set the calibration info. - aruco::Marker: which represent a marker detected in the image - aruco::MarkerDetector: that is in charge of deteting the markers in a image Detection is done by simple calling the member funcion ArMarkerDetector::detect(). Additionally, the classes contain members to create the required matrices for rendering using OpenGL. See aruco_test_gl for details @@ -101,33 +101,34 @@ The library has been compiled using MinGW and codeblocks. Below I describe the b -# Download the source code and compile it using cmake and codeblocks. Note: install the library in C:\ if you want it to be easily detected by cmake afterwards - step 4) aruco -# Download and decompress. - -# Open cmake gui application and set the path to the main library directory and also set a path where the project is going to be built. + -# Open cmake gui application and set the path to the main library directory and also set a path where the project is going to be built. -# Generate the codeblock project. -# Open the project with codeblock and compile then, install. The programs will be probably generated into the bin directory OpenGL: by default, the mingw version installed has not the glut library. So, the opengl programs are not compiled. If you want to compile with OpenGL support, you must install glut, or prefereably freeglut. -Thus, - - Download the library (http://www.martinpayne.me.uk/software/development/GLUT/freeglut-MinGW.zip) for mingw. - - Decompress in a directory X. +Thus, + - Download the library (http://www.martinpayne.me.uk/software/development/GLUT/freeglut-MinGW.zip) for mingw. + - Decompress in a directory X. - Then, rerun cmake setting the variable GLU_PATH to that directory (>cmake .. -DGLUT_PATH="C:\X") - Finally, recompile and test. Indeed, you should move the freeglut.dll to the directory with the binaries or to any other place in the PATH. CONCLUSION: Move to Linux, things are simpler :P - -\section Testing + +\section Testing For testing the applications, the library provides videos and the corresponding camera parameters of these videos. Into the directories you will find information on how to run the examples. - + \section Final Notes - REQUIREMENTS: OpenCv >= 2.1.0. and OpenGL for (aruco_test_gl and aruco_test_board_gl) - CONTACT: Rafael Munoz-Salinas: rmsalinas@uco.es - This libary is free software and come with no guaratee! - + */ #include "markerdetector.h" +#include "boarddetector.h" #include "cvdrawingutils.h" diff --git a/ftnoir_tracker_aruco/include/arucofidmarkers.h b/ftnoir_tracker_aruco/include/arucofidmarkers.h index 15eb8e4c..7dad4672 100644 --- a/ftnoir_tracker_aruco/include/arucofidmarkers.h +++ b/ftnoir_tracker_aruco/include/arucofidmarkers.h @@ -31,6 +31,7 @@ or implied, of Rafael Muñoz Salinas. #include #include "exports.h" #include "marker.h" +#include "board.h" namespace aruco { class ARUCO_EXPORTS FiducidalMarkers { @@ -79,7 +80,7 @@ public: * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels * @param MarkerDistance distance between the markers - * @param TInfo output + * @param TInfo output * @param excludedIds set of ids excluded from the board */ static cv::Mat createBoardImage( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,vector *excludedIds=NULL ) throw (cv::Exception); @@ -88,24 +89,24 @@ public: /**Creates a printable image of a board in chessboard_like manner * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels - * @param TInfo output + * @param TInfo output * @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner - * + * */ static cv::Mat createBoardImage_ChessBoard( cv::Size gridSize,int MarkerSize, BoardConfiguration& TInfo ,bool setDataCentered=true ,vector *excludedIds=NULL) throw (cv::Exception); - /**Creates a printable image of a board in a frame fashion + /**Creates a printable image of a board in a frame fashion * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels * @param MarkerDistance distance between the markers - * @param TInfo output + * @param TInfo output * @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner - * + * */ static cv::Mat createBoardImage_Frame( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,bool setDataCentered=true,vector *excludedIds=NULL ) throw (cv::Exception); private: - + static vector getListOfValidMarkersIds_random(int nMarkers,vector *excluded) throw (cv::Exception); static cv::Mat rotate(const cv::Mat & in); static int hammDistMarker(cv::Mat bits); diff --git a/ftnoir_tracker_aruco/include/board.h b/ftnoir_tracker_aruco/include/board.h new file mode 100644 index 00000000..c1d79292 --- /dev/null +++ b/ftnoir_tracker_aruco/include/board.h @@ -0,0 +1,168 @@ +/***************************** +Copyright 2011 Rafael Muñoz Salinas. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of + conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those of the +authors and should not be interpreted as representing official policies, either expressed +or implied, of Rafael Muñoz Salinas. +********************************/ +#ifndef _Aruco_board_h +#define _Aruco_board_h +#include +#include +#include +#include "exports.h" +#include "marker.h" +using namespace std; +namespace aruco { +/** + * 3d representation of a marker + */ +struct ARUCO_EXPORTS MarkerInfo:public vector { + MarkerInfo() {} + MarkerInfo(int _id) {id=_id; } + MarkerInfo(const MarkerInfo&MI): vector(MI){id=MI.id; } + MarkerInfo & operator=(const MarkerInfo&MI){ + vector ::operator=(MI); + id=MI.id; + return *this; + } + int id;//maker id +}; + +/**\brief This class defines a board with several markers. + * A Board contains several markers so that they are more robustly detected. + * + * In general, a board is a set of markers. So BoardConfiguration is only a list + * of the id of the markers along with the position of their corners. + * + * The position of the corners can be specified either in pixels (in a non-specific size) or in meters. + * The first is the typical case in which you generate the image of board and the print it. Since you do not know in advance the real + * size of the markers, their corners are specified in pixels, and then, the translation to meters can be made once you know the real size. + * + * On the other hand, you may want to have the information of your boards in meters. The BoardConfiguration allows you to do so. + * + * The point is in the mInfoType variable. It can be either PIX or METERS according to your needs. + * +*/ + + +class ARUCO_EXPORTS BoardConfiguration: public vector +{ + friend class Board; +public: + enum MarkerInfoType {NONE=-1,PIX=0,METERS=1};//indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally + //variable indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally + int mInfoType; + /** + */ + BoardConfiguration(); + + /** + */ + BoardConfiguration(const BoardConfiguration &T); + + /** + */ + BoardConfiguration & operator=(const BoardConfiguration &T); + /**Saves the board info to a file + */ + void saveToFile(string sfile)throw (cv::Exception); + /**Reads board info from a file + */ + void readFromFile(string sfile)throw (cv::Exception); + /**Indicates if the corners are expressed in meters + */ + bool isExpressedInMeters()const { + return mInfoType==METERS; + } + /**Indicates if the corners are expressed in meters + */ + bool isExpressedInPixels()const { + return mInfoType==PIX; + } + /**Returns the index of the marker with id indicated, if is in the list + */ + int getIndexOfMarkerId(int id)const; + /**Returns the Info of the marker with id specified. If not in the set, throws exception + */ + const MarkerInfo& getMarkerInfo(int id)const throw (cv::Exception); + /**Set in the list passed the set of the ids + */ + void getIdList(vector &ids,bool append=true)const; +private: + /**Saves the board info to a file + */ + void saveToFile(cv::FileStorage &fs)throw (cv::Exception); + /**Reads board info from a file + */ + void readFromFile(cv::FileStorage &fs)throw (cv::Exception); +}; + +/** +*/ +class ARUCO_EXPORTS Board:public vector +{ + +public: + BoardConfiguration conf; + //matrices of rotation and translation respect to the camera + cv::Mat Rvec,Tvec; + /** + */ + Board() + { + Rvec.create(3,1,CV_32FC1); + Tvec.create(3,1,CV_32FC1); + for (int i=0;i<3;i++) + Tvec.at(i,0)=Rvec.at(i,0)=-999999; + } + + /**Given the extrinsic camera parameters returns the GL_MODELVIEW matrix for opengl. + * Setting this matrix, the reference corrdinate system will be set in this board + */ + void glGetModelViewMatrix(double modelview_matrix[16])throw(cv::Exception); + + /** + * Returns position vector and orientation quaternion for an Ogre scene node or entity. + * Use: + * ... + * Ogre::Vector3 ogrePos (position[0], position[1], position[2]); + * Ogre::Quaternion ogreOrient (orientation[0], orientation[1], orientation[2], orientation[3]); + * mySceneNode->setPosition( ogrePos ); + * mySceneNode->setOrientation( ogreOrient ); + * ... + */ + void OgreGetPoseParameters( double position[3], double orientation[4] )throw(cv::Exception); + + + /**Save this from a file + */ + void saveToFile(string filePath)throw(cv::Exception); + /**Read this from a file + */ + void readFromFile(string filePath)throw(cv::Exception); + +}; +} + +#endif diff --git a/ftnoir_tracker_aruco/include/boarddetector.h b/ftnoir_tracker_aruco/include/boarddetector.h new file mode 100644 index 00000000..a0ee2361 --- /dev/null +++ b/ftnoir_tracker_aruco/include/boarddetector.h @@ -0,0 +1,139 @@ +/***************************** +Copyright 2011 Rafael Muñoz Salinas. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of + conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those of the +authors and should not be interpreted as representing official policies, either expressed +or implied, of Rafael Muñoz Salinas. +********************************/ +#ifndef _Aruco_BoardDetector_H +#define _Aruco_BoardDetector_H +#include +#include "exports.h" +#include "board.h" +#include "cameraparameters.h" +#include "markerdetector.h" +using namespace std; + +namespace aruco +{ + +/**\brief This class detects AR boards + * Version 1.2 + * There are two modes for board detection. + * First, the old way. (You first detect markers with MarkerDetector and then call to detect in this class. + * + * Second: New mode, marker detection is included in the class + * \code + + CameraParameters CP; + CP.readFromFile(path_cp) + BoardConfiguration BC; + BC.readFromFile(path_bc); + BoardDetector BD; + BD.setParams(BC,CP); //or only BD.setParams(BC) + //capture image + cv::Mat im; + capture_image(im); + + float prob=BD.detect(im); + if (prob>0.3) + CvDrawingUtils::draw3DAxis(im,BD.getDetectedBoard(),CP); + + \endcode + * +*/ +class ARUCO_EXPORTS BoardDetector +{ +public: + /** See discussion in @see enableRotateXAxis. + * Do not change unless you know what you are doing + */ + BoardDetector(bool setYPerperdicular=true); + + + /** + * Use if you plan to let this class to perform marker detection too + */ + void setParams(const BoardConfiguration &bc,const CameraParameters &cp, float markerSizeMeters=-1); + void setParams(const BoardConfiguration &bc); + /** + * Detect markers, and then, look for the board indicated in setParams() + * @return value indicating the likelihood of having found the marker + */ + float detect(const cv::Mat &im)throw (cv::Exception); + /**Returns a reference to the board detected + */ + Board & getDetectedBoard(){return _boardDetected;} + /**Returns a reference to the internal marker detector + */ + MarkerDetector &getMarkerDetector(){return _mdetector;} + /**Returns the vector of markers detected + */ + vector &getDetectedMarkers(){return _vmarkers;} + + + //ALTERNATIVE DETECTION METHOD, BASED ON MARKERS PREVIOUSLY DETECTED + + /** Given the markers detected, determines if there is the board passed + * @param detectedMarkers result provided by aruco::ArMarkerDetector + * @param BConf the board you want to see if is present + * @param Bdetected output information of the detected board + * @param camMatrix camera matrix with intrinsics + * @param distCoeff camera distorsion coeff + * @param camMatrix intrinsic camera information. + * @param distCoeff camera distorsion coefficient. If set Mat() if is assumed no camera distorion + * @param markerSizeMeters size of the marker sides expressed in meters + * @return value indicating the likelihood of having found the marker + */ + float detect(const vector &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected, cv::Mat camMatrix=cv::Mat(),cv::Mat distCoeff=cv::Mat(), float markerSizeMeters=-1 )throw (cv::Exception); + float detect(const vector &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected,const CameraParameters &cp, float markerSizeMeters=-1 )throw (cv::Exception); + + + /** + * By default, the Y axis is set to point up. However this is not the default + * operation mode of opencv, which produces the Z axis pointing up instead. + * So, to achieve this change, we have to rotate the X axis. + */ + void setYPerperdicular(bool enable){_setYPerperdicular=enable;} + + + + +private: + void rotateXAxis(cv::Mat &rotation); + bool _setYPerperdicular; + + //-- Functionality to detect markers inside + bool _areParamsSet; + BoardConfiguration _bconf; + Board _boardDetected; + float _markerSize; + CameraParameters _camParams; + MarkerDetector _mdetector;//internal markerdetector + vector _vmarkers;//markers detected in the call to : float detect(const cv::Mat &im); + +}; + +}; +#endif + diff --git a/ftnoir_tracker_aruco/include/cvdrawingutils.h b/ftnoir_tracker_aruco/include/cvdrawingutils.h index 24bfe630..ff67242f 100644 --- a/ftnoir_tracker_aruco/include/cvdrawingutils.h +++ b/ftnoir_tracker_aruco/include/cvdrawingutils.h @@ -33,13 +33,20 @@ namespace aruco { /**\brief A set of functions to draw in opencv images */ - class ARUCO_EXPORTS CvDrawingUtils - { - public: - static void draw3dAxis(cv::Mat &Image,Marker &m,const CameraParameters &CP); - static void draw3dCube(cv::Mat &Image,Marker &m,const CameraParameters &CP); - }; -} + class ARUCO_EXPORTS CvDrawingUtils + { + public: + + static void draw3dAxis(cv::Mat &Image,Marker &m,const CameraParameters &CP); + + static void draw3dCube(cv::Mat &Image,Marker &m,const CameraParameters &CP); + + static void draw3dAxis(cv::Mat &Image,Board &m,const CameraParameters &CP); + + static void draw3dCube(cv::Mat &Image,Board &m,const CameraParameters &CP); + + }; +}; #endif diff --git a/ftnoir_tracker_aruco/include/exports.h b/ftnoir_tracker_aruco/include/exports.h index 044a1367..aaeb94e4 100644 --- a/ftnoir_tracker_aruco/include/exports.h +++ b/ftnoir_tracker_aruco/include/exports.h @@ -37,9 +37,9 @@ or implied, of Rafael Muñoz Salinas. #if (defined WIN32 || defined _WIN32 || defined WINCE) && defined DSO_EXPORTS - #define ARUCO_EXPORTS __declspec(dllexport) __attribute__((visibility ("default"))) + #define ARUCO_EXPORTS __declspec(dllexport) #else - #define ARUCO_EXPORTS __attribute__((visibility ("default"))) + #define ARUCO_EXPORTS __attribute__ ((visibility ("default"))) #endif diff --git a/ftnoir_tracker_aruco/include/markerdetector.h b/ftnoir_tracker_aruco/include/markerdetector.h index a4656527..6f489c34 100644 --- a/ftnoir_tracker_aruco/include/markerdetector.h +++ b/ftnoir_tracker_aruco/include/markerdetector.h @@ -52,13 +52,11 @@ class ARUCO_EXPORTS MarkerDetector contour=M.contour; idx=M.idx; } - MarkerCandidate operator=(const MarkerCandidate &M){ - if (this == &M) - return *this; + MarkerCandidate & operator=(const MarkerCandidate &M){ (*(Marker*)this)=(*(Marker*)&M); contour=M.contour; idx=M.idx; - return M; + return *this; } vector contour;//all the points of its contour @@ -69,11 +67,11 @@ public: /** * See */ - MarkerDetector() {} + MarkerDetector(); /** */ - ~MarkerDetector() {} + ~MarkerDetector(); /**Detects the markers in the image passed * @@ -353,5 +351,9 @@ private: void draw(cv::Mat out,const std::vector &markers ); }; -} + + + + +}; #endif diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 1e4c6683..672efa28 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -13,11 +13,10 @@ struct settings { class Hydra_Tracker : public ITracker { public: - Hydra_Tracker(); + Hydra_Tracker(); ~Hydra_Tracker(); void StartTracker(QFrame *) override; void GetHeadPoseData(double *data) override; - int preferredHz() override { return 250; } volatile bool should_quit; private: settings s; @@ -28,23 +27,23 @@ class TrackerControls: public QWidget, public ITrackerDialog { Q_OBJECT public: - explicit TrackerControls(); + explicit TrackerControls(); void registerTracker(ITracker *) {} void unRegisterTracker() {} private: settings s; - Ui::UIHydraControls ui; + Ui::UIHydraControls ui; private slots: - void doOK(); - void doCancel(); + void doOK(); + void doCancel(); }; class FTNoIR_TrackerDll : public Metadata { public: - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); + void getFullName(QString *strToBeFilled); + void getShortName(QString *strToBeFilled); + void getDescription(QString *strToBeFilled); + void getIcon(QIcon *icon); }; diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index eb21f7bc..158229a6 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -25,15 +25,14 @@ struct settings { class Rift_Tracker : public ITracker { public: - Rift_Tracker(); + Rift_Tracker(); ~Rift_Tracker() override; void StartTracker(QFrame *) override; void GetHeadPoseData(double *data) override; - int preferredHz() override { return 250; } volatile bool should_quit; protected: - void run(); // qthread override run method + void run(); // qthread override run method private: double old_yaw; @@ -45,32 +44,32 @@ class TrackerControls: public QWidget, public ITrackerDialog { Q_OBJECT public: - explicit TrackerControls(); + explicit TrackerControls(); void registerTracker(ITracker *) {} - void unRegisterTracker() {} + void unRegisterTracker() {} private: - Ui::UIRiftControls ui; + Ui::UIRiftControls ui; settings s; private slots: - void doOK(); - void doCancel(); + void doOK(); + void doCancel(); }; class FTNoIR_TrackerDll : public Metadata { public: - FTNoIR_TrackerDll(); - ~FTNoIR_TrackerDll(); - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); + FTNoIR_TrackerDll(); + ~FTNoIR_TrackerDll(); + void getFullName(QString *strToBeFilled); + void getShortName(QString *strToBeFilled); + void getDescription(QString *strToBeFilled); + void getIcon(QIcon *icon); private: - QString trackerFullName; // Trackers' name and description - QString trackerShortName; - QString trackerDescription; + QString trackerFullName; // Trackers' name and description + QString trackerShortName; + QString trackerDescription; }; -- cgit v1.2.3