summaryrefslogtreecommitdiffhomepage
path: root/proto-simconnect
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-12-03 22:23:08 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-12-04 12:19:26 +0100
commitb256886a5cb9f2ae3ebda70a2045b19ed9f4233e (patch)
tree4fa1e46de224cf834a05824dc1eb86001bdb3300 /proto-simconnect
parente89709a801e7874bc02c66848c638c6a0ccc85c1 (diff)
api: add status check for modules
Diffstat (limited to 'proto-simconnect')
-rw-r--r--proto-simconnect/ftnoir_protocol_sc.cpp27
-rw-r--r--proto-simconnect/ftnoir_protocol_sc.h2
2 files changed, 11 insertions, 18 deletions
diff --git a/proto-simconnect/ftnoir_protocol_sc.cpp b/proto-simconnect/ftnoir_protocol_sc.cpp
index c37fa91c..787cf0e3 100644
--- a/proto-simconnect/ftnoir_protocol_sc.cpp
+++ b/proto-simconnect/ftnoir_protocol_sc.cpp
@@ -161,7 +161,7 @@ private:
bool ok;
};
-bool simconnect::correct()
+module_status simconnect::check_status()
{
if (!SCClientLib.isLoaded())
{
@@ -170,46 +170,39 @@ bool simconnect::correct()
if (ctx.is_ok())
{
SCClientLib.setFileName("SimConnect.dll");
- if (!SCClientLib.load()) {
- qDebug() << "simconnect: dll load failed --" << SCClientLib.errorString();
- return false;
- }
+ if (!SCClientLib.load())
+ return error(tr("dll load failed -- %1").arg(SCClientLib.errorString()));
}
else
- return false;
+ return error("can't load SDK -- check selected simconnect version");
}
simconnect_open = (importSimConnect_Open) SCClientLib.resolve("SimConnect_Open");
if (simconnect_open == NULL) {
- qDebug() << "simconnect: SimConnect_Open function not found in DLL!";
- return false;
+ return error("simconnect: SimConnect_Open function not found in DLL!");
}
simconnect_set6DOF = (importSimConnect_CameraSetRelative6DOF) SCClientLib.resolve("SimConnect_CameraSetRelative6DOF");
if (simconnect_set6DOF == NULL) {
- qDebug() << "simconnect: SimConnect_CameraSetRelative6DOF function not found in DLL!";
- return false;
+ return error("simconnect: SimConnect_CameraSetRelative6DOF function not found in DLL!");
}
simconnect_close = (importSimConnect_Close) SCClientLib.resolve("SimConnect_Close");
if (simconnect_close == NULL) {
- qDebug() << "simconnect: SimConnect_Close function not found in DLL!";
- return false;
+ return error("simconnect: SimConnect_Close function not found in DLL!");
}
simconnect_calldispatch = (importSimConnect_CallDispatch) SCClientLib.resolve("SimConnect_CallDispatch");
if (simconnect_calldispatch == NULL) {
- qDebug() << "simconnect: SimConnect_CallDispatch function not found in DLL!";
- return false;
+ return error("simconnect: SimConnect_CallDispatch function not found in DLL!");
}
simconnect_subscribetosystemevent = (importSimConnect_SubscribeToSystemEvent) SCClientLib.resolve("SimConnect_SubscribeToSystemEvent");
if (simconnect_subscribetosystemevent == NULL) {
- qDebug() << "simconnect: SimConnect_SubscribeToSystemEvent function not found in DLL!";
- return false;
+ return error("simconnect: SimConnect_SubscribeToSystemEvent function not found in DLL!");
}
start();
- return true;
+ return status_ok();
}
void simconnect::handle()
diff --git a/proto-simconnect/ftnoir_protocol_sc.h b/proto-simconnect/ftnoir_protocol_sc.h
index 151dd741..4174bc0c 100644
--- a/proto-simconnect/ftnoir_protocol_sc.h
+++ b/proto-simconnect/ftnoir_protocol_sc.h
@@ -39,7 +39,7 @@ class simconnect : public IProtocol, private QThread
public:
simconnect();
~simconnect() override;
- bool correct();
+ module_status check_status() override;
void pose(const double* headpose);
void handle();
QString game_name() {