diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-06 07:19:21 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-06 07:19:21 +0200 |
commit | 555d0555e990a99c2061570dcebd0d868f1334b8 (patch) | |
tree | a1702776ed614df99f0f4071ddce391cff20a8e4 /ftnoir_protocol_sc | |
parent | e21853bff477cd90c5c60ba1a4ef9304df7538fe (diff) |
simconnect: get rid of redundant logic
Diffstat (limited to 'ftnoir_protocol_sc')
-rw-r--r-- | ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 40 | ||||
-rw-r--r-- | ftnoir_protocol_sc/ftnoir_protocol_sc.h | 14 |
2 files changed, 1 insertions, 53 deletions
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index 30590715..c9b0541a 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -144,9 +144,6 @@ bool FTNoIR_Protocol::correct() return false; } - // - // Get the functions from the DLL. - // simconnect_open = (importSimConnect_Open) SCClientLib.resolve("SimConnect_Open"); if (simconnect_open == NULL) { qDebug() << "FTNoIR_Protocol::correct() says: SimConnect_Open function not found in DLL!"; @@ -163,8 +160,6 @@ bool FTNoIR_Protocol::correct() return false; } - //return true; - simconnect_calldispatch = (importSimConnect_CallDispatch) SCClientLib.resolve("SimConnect_CallDispatch"); if (simconnect_calldispatch == NULL) { qDebug() << "FTNoIR_Protocol::correct() says: SimConnect_CallDispatch function not found in DLL!"; @@ -177,24 +172,6 @@ bool FTNoIR_Protocol::correct() return false; } - simconnect_mapclienteventtosimevent = (importSimConnect_MapClientEventToSimEvent) SCClientLib.resolve("SimConnect_MapClientEventToSimEvent"); - if (simconnect_subscribetosystemevent == NULL) { - qDebug() << "FTNoIR_Protocol::correct() says: SimConnect_MapClientEventToSimEvent function not found in DLL!"; - return false; - } - - simconnect_addclienteventtonotificationgroup = (importSimConnect_AddClientEventToNotificationGroup) SCClientLib.resolve("SimConnect_AddClientEventToNotificationGroup"); - if (simconnect_subscribetosystemevent == NULL) { - qDebug() << "FTNoIR_Protocol::correct() says: SimConnect_AddClientEventToNotificationGroup function not found in DLL!"; - return false; - } - - simconnect_setnotificationgrouppriority = (importSimConnect_SetNotificationGroupPriority) SCClientLib.resolve("SimConnect_SetNotificationGroupPriority"); - if (simconnect_subscribetosystemevent == NULL) { - qDebug() << "FTNoIR_Protocol::correct() says: SimConnect_SetNotificationGroupPriority function not found in DLL!"; - return false; - } - qDebug() << "FTNoIR_Protocol::correct() says: SimConnect functions resolved in DLL!"; start(); @@ -204,22 +181,7 @@ bool FTNoIR_Protocol::correct() void FTNoIR_Protocol::handle() { - if (prevSCPosX != virtSCPosX || - prevSCPosY != virtSCPosY || - prevSCPosZ != virtSCPosZ || - prevSCRotX != virtSCRotX || - prevSCRotY != virtSCRotY || - prevSCRotZ != virtSCRotZ) - { - (void) simconnect_set6DOF(hSimConnect, virtSCPosX, virtSCPosY, virtSCPosZ, virtSCRotX, virtSCRotZ, virtSCRotY); - } - - prevSCPosX = virtSCPosX; - prevSCPosY = virtSCPosY; - prevSCPosZ = virtSCPosZ; - prevSCRotX = virtSCRotX; - prevSCRotY = virtSCRotY; - prevSCRotZ = virtSCRotZ; + (void) simconnect_set6DOF(hSimConnect, virtSCPosX, virtSCPosY, virtSCPosZ, virtSCRotX, virtSCRotZ, virtSCRotY); } void CALLBACK FTNoIR_Protocol::processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD, void *self_) diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h index e0fb7574..7c32d014 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h @@ -54,9 +54,6 @@ 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); -typedef HRESULT (WINAPI *importSimConnect_MapClientEventToSimEvent)(HANDLE hSimConnect, SIMCONNECT_CLIENT_EVENT_ID EventID, const char * EventName); -typedef HRESULT (WINAPI *importSimConnect_AddClientEventToNotificationGroup)(HANDLE hSimConnect, SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, SIMCONNECT_CLIENT_EVENT_ID EventID, BOOL bMaskable); -typedef HRESULT (WINAPI *importSimConnect_SetNotificationGroupPriority)(HANDLE hSimConnect, SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, DWORD uPriority); struct settings : opts { value<int> sxs_manifest; @@ -88,22 +85,11 @@ private: volatile float virtSCRotY; volatile float virtSCRotZ; - float prevSCPosX; - float prevSCPosY; - float prevSCPosZ; - - float prevSCRotX; - float prevSCRotY; - float prevSCRotZ; - importSimConnect_Open simconnect_open; // SimConnect function(s) in DLL importSimConnect_Close simconnect_close; importSimConnect_CameraSetRelative6DOF simconnect_set6DOF; importSimConnect_CallDispatch simconnect_calldispatch; importSimConnect_SubscribeToSystemEvent simconnect_subscribetosystemevent; - importSimConnect_MapClientEventToSimEvent simconnect_mapclienteventtosimevent; - importSimConnect_AddClientEventToNotificationGroup simconnect_addclienteventtonotificationgroup; - importSimConnect_SetNotificationGroupPriority simconnect_setnotificationgrouppriority; HANDLE hSimConnect; // Handle to SimConnect static void CALLBACK processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext); |