summaryrefslogtreecommitdiffhomepage
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
parentb78ac5d6535794967d5104bbc265b5079d0ac6b2 (diff)
Fix SimConnect (thanks Wim)
-rw-r--r--CMakeLists.txt4
-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
4 files changed, 29 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54bb79fd..5c41f652 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -203,7 +203,6 @@ if(NOT SDK_FACEAPI_ONLY)
QT4_WRAP_UI(ftnoir-proto-win32-mouse-uih ${ftnoir-proto-win32-mouse-ui})
QT4_ADD_RESOURCES(ftnoir-proto-win32-mouse-rcc ${ftnoir-proto-win32-mouse-rc})
-# TODO manifest problems :(
file(GLOB ftnoir-proto-simconnect-c "ftnoir_protocol_sc/*.cpp")
file(GLOB ftnoir-proto-simconnect-h "ftnoir_protocol_sc/*.h")
QT4_WRAP_CPP(ftnoir-proto-simconnect-moc ${ftnoir-proto-simconnect-h})
@@ -344,6 +343,9 @@ endif()
if(SDK_FSUIPC)
add_library(ftnoir-proto-fsuipc SHARED ${ftnoir-proto-fsuipc-c} ${ftnoir-proto-fsuipc-moc} ${ftnoir-proto-fsuipc-uih} ${ftnoir-proto-fsuipc-rcc})
target_link_libraries(ftnoir-proto-fsuipc ${MY_QT_LIBS} "${SDK_FSUIPC}/FSUIPC_User.lib")
+ if(MSVC)
+ set_target_properties(ftnoir-proto-fsuipc PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc")
+ endif()
endif()
if(SDK_SIMCONNECT)
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()
{