diff options
-rw-r--r-- | compat/math-imports.hpp | 45 | ||||
-rw-r--r-- | proto-simconnect/fsx_p3d_sp2_xpack.manifest (renamed from proto-simconnect/scserver.manifest) | 5 | ||||
-rw-r--r-- | proto-simconnect/fsx_rtm.manifest | 8 | ||||
-rw-r--r-- | proto-simconnect/fsx_sp1.manifest | 8 | ||||
-rw-r--r-- | proto-simconnect/fsx_sp2.manifest | 8 | ||||
-rw-r--r-- | proto-simconnect/fsx_steam_last.manifest | 8 | ||||
-rw-r--r-- | proto-simconnect/fsx_steam_orig.manifest | 8 | ||||
-rw-r--r-- | proto-simconnect/ftnoir-protocol-sc.rc | 9 | ||||
-rw-r--r-- | proto-simconnect/ftnoir_protocol_sc.cpp | 66 | ||||
-rw-r--r-- | proto-simconnect/ftnoir_protocol_sc.h | 4 | ||||
-rw-r--r-- | proto-simconnect/ftnoir_sccontrols.ui | 19 | ||||
-rw-r--r-- | proto-simconnect/manifest-template.in | 8 | ||||
-rw-r--r-- | proto-simconnect/scserver_acceleration.manifest | 13 | ||||
-rw-r--r-- | proto-simconnect/scserver_sp2.manifest | 13 |
14 files changed, 151 insertions, 71 deletions
diff --git a/compat/math-imports.hpp b/compat/math-imports.hpp new file mode 100644 index 00000000..ad70f361 --- /dev/null +++ b/compat/math-imports.hpp @@ -0,0 +1,45 @@ +#pragma once + +#include <cmath> +#include <cinttypes> + +namespace otr_math +{ + +using std::copysign; + +using std::sqrt; +using std::pow; + +using std::fabs; +using std::fmin; +using std::fmax; + +using std::atan; +using std::atan2; +using std::asin; +using std::acos; + +using std::sin; +using std::cos; +using std::tan; + +using std::round; +using std::fmod; + +using std::uintptr_t; +using std::intptr_t; + +using std::int64_t; +using std::int32_t; + +using std::uint64_t; +using std::uint32_t; + +template <typename T> +static inline constexpr auto signum(T x) +{ + return (T() < x) - (x < T()); +} + +} // ns otr_math diff --git a/proto-simconnect/scserver.manifest b/proto-simconnect/fsx_p3d_sp2_xpack.manifest index d342cfda..25a62765 100644 --- a/proto-simconnect/scserver.manifest +++ b/proto-simconnect/fsx_p3d_sp2_xpack.manifest @@ -5,9 +5,4 @@ <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect' version='10.0.61259.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' /> </dependentAssembly> </dependency> - <dependency> - <dependentAssembly> - <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> - </dependentAssembly> - </dependency> </assembly> diff --git a/proto-simconnect/fsx_rtm.manifest b/proto-simconnect/fsx_rtm.manifest new file mode 100644 index 00000000..760de973 --- /dev/null +++ b/proto-simconnect/fsx_rtm.manifest @@ -0,0 +1,8 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes'?> +<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> + <dependency> + <dependentAssembly> + <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect' version='10.0.60905.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' /> + </dependentAssembly> + </dependency> +</assembly> diff --git a/proto-simconnect/fsx_sp1.manifest b/proto-simconnect/fsx_sp1.manifest new file mode 100644 index 00000000..ee746740 --- /dev/null +++ b/proto-simconnect/fsx_sp1.manifest @@ -0,0 +1,8 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes'?> +<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> + <dependency> + <dependentAssembly> + <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect' version='10.0.61242.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' /> + </dependentAssembly> + </dependency> +</assembly> diff --git a/proto-simconnect/fsx_sp2.manifest b/proto-simconnect/fsx_sp2.manifest new file mode 100644 index 00000000..25a62765 --- /dev/null +++ b/proto-simconnect/fsx_sp2.manifest @@ -0,0 +1,8 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes'?> +<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> + <dependency> + <dependentAssembly> + <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect' version='10.0.61259.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' /> + </dependentAssembly> + </dependency> +</assembly> diff --git a/proto-simconnect/fsx_steam_last.manifest b/proto-simconnect/fsx_steam_last.manifest new file mode 100644 index 00000000..b8cbaca4 --- /dev/null +++ b/proto-simconnect/fsx_steam_last.manifest @@ -0,0 +1,8 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes'?> +<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> + <dependency> + <dependentAssembly> + <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect' version='10.0.62615.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' /> + </dependentAssembly> + </dependency> +</assembly> diff --git a/proto-simconnect/fsx_steam_orig.manifest b/proto-simconnect/fsx_steam_orig.manifest new file mode 100644 index 00000000..f1b3314c --- /dev/null +++ b/proto-simconnect/fsx_steam_orig.manifest @@ -0,0 +1,8 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes'?> +<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> + <dependency> + <dependentAssembly> + <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect' version='10.0.62607.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' /> + </dependentAssembly> + </dependency> +</assembly> diff --git a/proto-simconnect/ftnoir-protocol-sc.rc b/proto-simconnect/ftnoir-protocol-sc.rc index c89eb9a7..5f47a5c9 100644 --- a/proto-simconnect/ftnoir-protocol-sc.rc +++ b/proto-simconnect/ftnoir-protocol-sc.rc @@ -1,4 +1,7 @@ #include <winuser.h> -142 RT_MANIFEST scserver.manifest -143 RT_MANIFEST scserver_sp2.manifest -144 RT_MANIFEST scserver_acceleration.manifest
\ No newline at end of file +142 RT_MANIFEST fsx_rtm.manifest +143 RT_MANIFEST fsx_sp1.manifest +144 RT_MANIFEST fsx_sp2.manifest +145 RT_MANIFEST fsx_p3d_sp2_xpack.manifest +146 RT_MANIFEST fsx_steam_orig.manifest +147 RT_MANIFEST fsx_steam_last.manifest diff --git a/proto-simconnect/ftnoir_protocol_sc.cpp b/proto-simconnect/ftnoir_protocol_sc.cpp index be0c23c4..cfe973a7 100644 --- a/proto-simconnect/ftnoir_protocol_sc.cpp +++ b/proto-simconnect/ftnoir_protocol_sc.cpp @@ -26,7 +26,7 @@ simconnect::~simconnect() void simconnect::run() { - HANDLE event = CreateEvent(NULL, FALSE, FALSE, nullptr); + HANDLE event = CreateEventA(NULL, FALSE, FALSE, nullptr); if (event == nullptr) { @@ -38,60 +38,57 @@ void simconnect::run() { HRESULT hr; - qDebug() << "simconnect: starting"; - if (SUCCEEDED(hr = simconnect_open(&hSimConnect, "opentrack", nullptr, 0, event, 0))) { if (!SUCCEEDED(hr = simconnect_subscribetosystemevent(hSimConnect, 0, "Frame"))) { qDebug() << "simconnect: can't subscribe to frame event:" << hr; - - should_reconnect = true; // will free simconnect handle and continue the loop } Timer tm; - int idle_seconds = 0; + should_reconnect = false; - while (!isInterruptionRequested()) - { - if (should_reconnect) + if (SUCCEEDED(hr)) + while (!isInterruptionRequested()) { - should_reconnect = false; - break; - } - - if (WaitForSingleObject(event, 10) == WAIT_OBJECT_0) - { - tm.start(); - idle_seconds = 0; + if (should_reconnect) + break; - if (!SUCCEEDED(hr = simconnect_calldispatch(hSimConnect, processNextSimconnectEvent, reinterpret_cast<void*>(this)))) + if (WaitForSingleObject(event, 100) == WAIT_OBJECT_0) { - qDebug() << "simconnect: calldispatch failed:" << hr; - break; + tm.start(); + + if (!SUCCEEDED(hr = simconnect_calldispatch(hSimConnect, processNextSimconnectEvent, reinterpret_cast<void*>(this)))) + { + qDebug() << "simconnect: calldispatch failed:" << hr; + break; + } } - } - else - { - if (int(tm.elapsed_seconds()) > idle_seconds) + else { - idle_seconds++; - qDebug() << "simconnect: can't process event for" << int(tm.elapsed_seconds()) << "seconds"; + const int idle_seconds = tm.elapsed_seconds(); + + static constexpr int max_idle_seconds = 2; + + if (idle_seconds >= max_idle_seconds) + { + qDebug() << "simconnect: reconnect"; + break; + } } } - } (void) simconnect_close(hSimConnect); } else - { qDebug() << "simconnect: can't open handle:" << hr; - } if (!isInterruptionRequested()) - Sleep(100); + Sleep(3000); } + qDebug() << "simconnect: exit"; + CloseHandle(event); } @@ -120,8 +117,8 @@ public: { hactctx = INVALID_HANDLE_VALUE; actctx_cookie = 0; - ACTCTXA actx = {0}; - actx.cbSize = sizeof(ACTCTXA); + ACTCTXA actx = {}; + actx.cbSize = sizeof(actx); actx.lpResourceName = MAKEINTRESOURCEA(resid); actx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; #ifdef _MSC_VER @@ -229,9 +226,12 @@ void CALLBACK simconnect::processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWO default: break; case SIMCONNECT_RECV_ID_EXCEPTION: + qDebug() << "simconnect: got exception"; + //self.should_reconnect = true; + break; case SIMCONNECT_RECV_ID_QUIT: + qDebug() << "simconnect: got quit event"; self.should_reconnect = true; - qDebug() << "simconnect: received ID_QUIT event"; break; case SIMCONNECT_RECV_ID_EVENT_FRAME: self.handle(); diff --git a/proto-simconnect/ftnoir_protocol_sc.h b/proto-simconnect/ftnoir_protocol_sc.h index 93376885..151dd741 100644 --- a/proto-simconnect/ftnoir_protocol_sc.h +++ b/proto-simconnect/ftnoir_protocol_sc.h @@ -3,7 +3,7 @@ * ISC License (ISC) * * * * Copyright (c) 2015, Wim Vriend * - * Copyright (c) 2014, Stanislaw Halik * + * Copyright (c) 2014, 2017 Stanislaw Halik * * * * Permission to use, copy, modify, and/or distribute this software for any * * purpose with or without fee is hereby granted, provided that the above * @@ -30,7 +30,7 @@ struct settings : opts { value<int> sxs_manifest; settings() : opts("proto-simconnect"), - sxs_manifest(b, "sxs-manifest-version", 0) + sxs_manifest(b, "simconnect-manifest", 2) {} }; diff --git a/proto-simconnect/ftnoir_sccontrols.ui b/proto-simconnect/ftnoir_sccontrols.ui index 887d6d80..7a607096 100644 --- a/proto-simconnect/ftnoir_sccontrols.ui +++ b/proto-simconnect/ftnoir_sccontrols.ui @@ -53,17 +53,32 @@ </property> <item> <property name="text"> + <string>RTM</string> + </property> + </item> + <item> + <property name="text"> <string>SP1</string> </property> </item> <item> <property name="text"> - <string>SP2</string> + <string>SP2 -- Acceleration</string> + </property> + </item> + <item> + <property name="text"> + <string>Prepar3d SP2 XPACK</string> + </property> + </item> + <item> + <property name="text"> + <string>Steam FSX (older)</string> </property> </item> <item> <property name="text"> - <string>Acceleration</string> + <string>Steam FSX (new)</string> </property> </item> </widget> diff --git a/proto-simconnect/manifest-template.in b/proto-simconnect/manifest-template.in new file mode 100644 index 00000000..fdf2c74a --- /dev/null +++ b/proto-simconnect/manifest-template.in @@ -0,0 +1,8 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
+<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect' version='VERSION' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' />
+ </dependentAssembly>
+ </dependency>
+</assembly>
diff --git a/proto-simconnect/scserver_acceleration.manifest b/proto-simconnect/scserver_acceleration.manifest deleted file mode 100644 index 06459587..00000000 --- a/proto-simconnect/scserver_acceleration.manifest +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version='1.0' encoding='UTF-8' standalone='yes'?> -<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> - <dependency> - <dependentAssembly> - <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect ' version='10.0.61242.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' /> - </dependentAssembly> - </dependency> - <dependency> - <dependentAssembly> - <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> - </dependentAssembly> - </dependency> -</assembly> diff --git a/proto-simconnect/scserver_sp2.manifest b/proto-simconnect/scserver_sp2.manifest deleted file mode 100644 index 3020d16c..00000000 --- a/proto-simconnect/scserver_sp2.manifest +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version='1.0' encoding='UTF-8' standalone='yes'?> -<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> - <dependency> - <dependentAssembly> - <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect ' version='10.0.60905.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' /> - </dependentAssembly> - </dependency> - <dependency> - <dependentAssembly> - <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> - </dependentAssembly> - </dependency> -</assembly> |