summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_protocol_sc
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-04-09 11:29:36 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-04-09 11:29:36 +0200
commit5c2f5449e8eb8a3c6d564a16fc8e307996746c14 (patch)
tree7620ca12dbe844150409db8d22d93e858b517ce2 /ftnoir_protocol_sc
parentb78ac5d6535794967d5104bbc265b5079d0ac6b2 (diff)
Fix SimConnect (thanks Wim)
Diffstat (limited to 'ftnoir_protocol_sc')
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc.cpp34
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp2
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp2
3 files changed, 26 insertions, 12 deletions
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
index c01096bf..90ca3dba 100644
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
+++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
@@ -153,13 +153,13 @@ PDWORD_PTR MsgResult = 0;
//
bool FTNoIR_Protocol::checkServerInstallationOK()
{
- QString aFileName; // File Path and Name
-
- // Code to activate the context for the SimConnect DLL
- ACTCTX act = { 0 };
+ // Code to activate the context for the SimConnect DLL
+ ACTCTXA act;
HANDLE hctx;
ULONG_PTR ulCookie;
+ memset(&act, 0, sizeof(act));
+
qDebug() << "SCCheckClientDLL says: Starting Function";
try {
@@ -167,8 +167,9 @@ bool FTNoIR_Protocol::checkServerInstallationOK()
act.cbSize = sizeof(act);
act.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
char full_path[2048];
- strcpy(full_path, QCoreApplication::applicationDirPath().toLatin1().constData());
- strcat(full_path, "\\libftnoir-proto-simconnect.dll");
+ QByteArray foo = QCoreApplication::applicationDirPath().toLatin1();
+ strcpy(full_path, foo.constData());
+ strcat(full_path, "/ftnoir-proto-simconnect.dll");
act.lpSource = full_path;
act.lpResourceName = MAKEINTRESOURCEA(101);
@@ -199,10 +200,23 @@ bool FTNoIR_Protocol::checkServerInstallationOK()
return false;
}
- SCClientLib.setFileName(SC_CLIENT_FILENAME);
- if (SCClientLib.load() != true) {
- qDebug() << "SCCheckClientDLL says: Error loading SimConnect DLL";
- return false;
+ const char* simconnect_paths[] = {
+ "SimConnect.DLL",
+ "C:\\Windows\\WinSxS\\x86_microsoft.flightsimulator.simconnect_67c7c14424d61b5b_10.0.60905.0_none_dd92b94d8a196297\\SimConnect.DLL",
+ "C:\\Windows\\WinSxS\\x86_microsoft.flightsimulator.simconnect_67c7c14424d61b5b_10.0.61242.0_none_e079b46b85043c20\\SimConnect.DLL",
+ "C:\\Windows\\WinSxS\\x86_microsoft.flightsimulator.simconnect_67c7c14424d61b5b_10.0.61259.0_none_55f5ecdc14f60568\\SimConnect.DLL",
+ NULL
+ };
+
+ for (int i = 0; simconnect_paths[i]; i++)
+ {
+ SCClientLib.setFileName(simconnect_paths[i]);
+ if (!SCClientLib.load()) {
+ qDebug() << "SCCheckClientDLL says: Error loading SimConnect DLL";
+ qDebug() << SCClientLib.errorString();
+ continue;
+ }
+ break;
}
//
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp
index 32abf64a..ef9dd924 100644
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp
+++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp
@@ -150,7 +150,7 @@ void SCControls::save() {
// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
+//#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetDialog( )
{
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp
index 3d59ef48..72d63c5e 100644
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp
+++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp
@@ -49,7 +49,7 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
+//#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata()
{