summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc.h39
2 files changed, 23 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7046c549..14fd87b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -302,10 +302,8 @@ if(SDK_FSUIPC)
#target_link_directories(${SDK_FSUIPC})
endif()
-if(SDK_SIMCONNECT)
+if(WIN32)
opentrack_library(opentrack-proto-simconnect ftnoir_protocol_sc)
- target_link_libraries(opentrack-proto-simconnect ${SDK_SIMCONNECT}/lib/SimConnect.lib)
- include_directories(opentrack-proto-simconnect SYSTEM PUBLIC ${SDK_SIMCONNECT}/inc)
endif()
if(WIN32)
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h
index cbdee7de..034a8e09 100644
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h
+++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h
@@ -27,16 +27,7 @@
* must be treated as such... *
********************************************************************************/
#pragma once
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0502
#include "opentrack/plugin-api.hpp"
-//
-// Prevent the SimConnect manifest from being merged in the application-manifest
-// This is necessary to run FaceTrackNoIR on a PC without FSX
-//
-#define SIMCONNECT_H_NOMANIFEST
-#include <windows.h>
-#include <SimConnect.h>
#include "ui_ftnoir_sccontrols.h"
#include <QThread>
@@ -48,12 +39,7 @@
#include <QFile>
#include "opentrack/options.hpp"
using namespace options;
-
-typedef HRESULT (WINAPI *importSimConnect_Open)(HANDLE * phSimConnect, LPCSTR szName, HWND hWnd, DWORD UserEventWin32, HANDLE hEventHandle, DWORD ConfigIndex);
-typedef HRESULT (WINAPI *importSimConnect_Close)(HANDLE hSimConnect);
-typedef HRESULT (WINAPI *importSimConnect_CameraSetRelative6DOF)(HANDLE hSimConnect, float fDeltaX, float fDeltaY, float fDeltaZ, float fPitchDeg, float fBankDeg, float fHeadingDeg);
-typedef HRESULT (WINAPI *importSimConnect_CallDispatch)(HANDLE hSimConnect, DispatchProc pfcnDispatch, void * pContext);
-typedef HRESULT (WINAPI *importSimConnect_SubscribeToSystemEvent)(HANDLE hSimConnect, SIMCONNECT_CLIENT_EVENT_ID EventID, const char * SystemEventName);
+#include <windows.h>
struct settings : opts {
value<int> sxs_manifest;
@@ -75,6 +61,25 @@ public:
return "FS2004/FSX";
}
private:
+ enum { SIMCONNECT_RECV_ID_EVENT_FRAME = 7 };
+
+ #pragma pack(push, 1)
+ struct SIMCONNECT_RECV
+ {
+ DWORD dwSize;
+ DWORD dwVersion;
+ DWORD dwID;
+ };
+ #pragma pack(pop)
+
+ typedef void (CALLBACK *DispatchProc)(SIMCONNECT_RECV*, DWORD, void*);
+
+ typedef HRESULT (WINAPI *importSimConnect_Open)(HANDLE * phSimConnect, LPCSTR szName, HWND hWnd, DWORD UserEventWin32, HANDLE hEventHandle, DWORD ConfigIndex);
+ typedef HRESULT (WINAPI *importSimConnect_Close)(HANDLE hSimConnect);
+ typedef HRESULT (WINAPI *importSimConnect_CameraSetRelative6DOF)(HANDLE hSimConnect, float fDeltaX, float fDeltaY, float fDeltaZ, float fPitchDeg, float fBankDeg, float fHeadingDeg);
+ typedef HRESULT (WINAPI *importSimConnect_CallDispatch)(HANDLE hSimConnect, DispatchProc pfcnDispatch, void * pContext);
+ typedef HRESULT (WINAPI *importSimConnect_SubscribeToSystemEvent)(HANDLE hSimConnect, DWORD EventID, const char * SystemEventName);
+
void run() override;
volatile bool should_stop;
@@ -85,13 +90,13 @@ private:
volatile float virtSCRotY;
volatile float virtSCRotZ;
- importSimConnect_Open simconnect_open; // SimConnect function(s) in DLL
+ importSimConnect_Open simconnect_open;
importSimConnect_Close simconnect_close;
importSimConnect_CameraSetRelative6DOF simconnect_set6DOF;
importSimConnect_CallDispatch simconnect_calldispatch;
importSimConnect_SubscribeToSystemEvent simconnect_subscribetosystemevent;
- HANDLE hSimConnect; // Handle to SimConnect
+ HANDLE hSimConnect;
static void CALLBACK processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext);
settings s;
QLibrary SCClientLib;