Skip to content

Commit

Permalink
1.1.6 MacOS Build and ArrayDrefs now support conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
mokny committed Dec 4, 2017
1 parent 61de43e commit df3aca2
Show file tree
Hide file tree
Showing 33 changed files with 354 additions and 54 deletions.
Binary file modified bin/FFA320Connector/64/mac.xpl
Binary file not shown.
Binary file modified bin/FFA320Connector/64/win.xpl
Binary file not shown.
12 changes: 9 additions & 3 deletions bin/FFA320Connector/config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,15 @@ DATAREF;INT;Aircraft.Cockpit.Overhead.LightBeacon.Target;-1;sim/cockpit/electric
DATAREF;INT;Aircraft.Cockpit.Overhead.LightLogo.Target;-1;sim/cockpit/electrical/nav_lights_on;INT;DEFAULT;1;=;0;0;
DATAREF;INT;Aircraft.Cockpit.Overhead.LightLogo.Target;-1;sim/cockpit/electrical/nav_lights_on;INT;DEFAULT;1;>=;1;1;

# Sync Landing lights (Won't work until released by A320)
DATAREF;INT;Aircraft.Cockpit.Overhead.LightLandL.Target;-1;sim/cockpit/electrical/landing_lights_on;INT;DEFAULT;1;=;0;0;
DATAREF;INT;Aircraft.Cockpit.Overhead.LightLandL.Target;-1;sim/cockpit/electrical/landing_lights_on;INT;DEFAULT;1;>=;1;1;
# Sync Landing lights
DATAREF;INT;Aircraft.Cockpit.Overhead.LightLandL.Target;-1;sim/cockpit/electrical/landing_lights_on;INT;DEFAULT;1;<;2;0;
DATAREF;INT;Aircraft.Cockpit.Overhead.LightLandL.Target;-1;sim/cockpit/electrical/landing_lights_on;INT;DEFAULT;1;>=;2;1;

DATAREF;INT;Aircraft.Cockpit.Overhead.LightLandL.Target;-1;sim/cockpit2/switches/landing_lights_switch[1];FLOAT;DEFAULT;1;<;2;0;
DATAREF;INT;Aircraft.Cockpit.Overhead.LightLandL.Target;-1;sim/cockpit2/switches/landing_lights_switch[1];FLOAT;DEFAULT;1;=;2;1;

DATAREF;INT;Aircraft.Cockpit.Overhead.LightLandR.Target;-1;sim/cockpit2/switches/landing_lights_switch[2];FLOAT;DEFAULT;1;<;2;0;
DATAREF;INT;Aircraft.Cockpit.Overhead.LightLandR.Target;-1;sim/cockpit2/switches/landing_lights_switch[2];FLOAT;DEFAULT;1;=;2;1;

# Sync N1 Values
DATAREF;FLOAT;Aircraft.PowerPlant.EngineL.RateLP1;-1;sim/flightmodel/engine/ENGN_N1_[0];FLOAT;
Expand Down
124 changes: 110 additions & 14 deletions src/FFA320Connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ void ffAPIUpdateCallback(double step, void *tag) {
XPLMSetDatai(iDataObjects->DREF, (int)(size_t)curval * iDataObjects->DataRefMultiplier);
}
else {
int idata = (int)curval * iDataObjects->DataRefMultiplier;
int idata = (int)(size_t)curval * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
Expand All @@ -1175,7 +1175,7 @@ void ffAPIUpdateCallback(double step, void *tag) {
XPLMSetDataf(iDataObjects->DREF, (float)icurval * iDataObjects->DataRefMultiplier);
}
else {
float idata = (float)icurval * iDataObjects->DataRefMultiplier;
float idata = (float)(size_t)icurval * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
Expand Down Expand Up @@ -1203,43 +1203,139 @@ void ffAPIUpdateCallback(double step, void *tag) {

if (iDataObjects->DatarefCondition == CONDITION_EQUALS) {
if ((int)(size_t)curval == iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

if (iDataObjects->DatarefCondition == CONDITION_GREATER) {
if ((int)(size_t)curval > iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

if (iDataObjects->DatarefCondition == CONDITION_LOWER) {
if ((int)(size_t)curval < iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

if (iDataObjects->DatarefCondition == CONDITION_NOTEQUAL) {
if ((int)(size_t)curval != iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

if (iDataObjects->DatarefCondition == CONDITION_GREATER_EQUAL) {
if ((int)(size_t)curval >= iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

if (iDataObjects->DatarefCondition == CONDITION_LOWER_EQUAL) {
if ((int)(size_t)curval <= iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

Expand Down
124 changes: 110 additions & 14 deletions src_vs2013/FFA320Connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ void ffAPIUpdateCallback(double step, void *tag) {
XPLMSetDatai(iDataObjects->DREF, (int)(size_t)curval * iDataObjects->DataRefMultiplier);
}
else {
int idata = (int)curval * iDataObjects->DataRefMultiplier;
int idata = (int)(size_t)curval * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
Expand All @@ -1175,7 +1175,7 @@ void ffAPIUpdateCallback(double step, void *tag) {
XPLMSetDataf(iDataObjects->DREF, (float)icurval * iDataObjects->DataRefMultiplier);
}
else {
float idata = (float)icurval * iDataObjects->DataRefMultiplier;
float idata = (float)(size_t)icurval * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
Expand Down Expand Up @@ -1203,43 +1203,139 @@ void ffAPIUpdateCallback(double step, void *tag) {

if (iDataObjects->DatarefCondition == CONDITION_EQUALS) {
if ((int)(size_t)curval == iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

if (iDataObjects->DatarefCondition == CONDITION_GREATER) {
if ((int)(size_t)curval > iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

if (iDataObjects->DatarefCondition == CONDITION_LOWER) {
if ((int)(size_t)curval < iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

if (iDataObjects->DatarefCondition == CONDITION_NOTEQUAL) {
if ((int)(size_t)curval != iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

if (iDataObjects->DatarefCondition == CONDITION_GREATER_EQUAL) {
if ((int)(size_t)curval >= iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

if (iDataObjects->DatarefCondition == CONDITION_LOWER_EQUAL) {
if ((int)(size_t)curval <= iDataObjects->DatarefConditionValue) {
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
if (iDataObjects->DataRefValueType == VALUE_TYPE_INT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDatai(iDataObjects->DREF, iDataObjects->Value * iDataObjects->DataRefMultiplier);
}
else {
int idata = iDataObjects->Value * iDataObjects->DataRefMultiplier;
XPLMSetDatavi(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
if (iDataObjects->DataRefValueType == VALUE_TYPE_FLOAT) {
if (iDataObjects->DataRefOffset < 0) {
XPLMSetDataf(iDataObjects->DREF, iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier);
}
else {
float idata = iDataObjects->ValueFloat * iDataObjects->DataRefMultiplier;
XPLMSetDatavf(iDataObjects->DREF, &idata, iDataObjects->DataRefOffset, 1);
}
}
}
}

Expand Down
Binary file modified src_vs2013/FFA320Connector.sdf
Binary file not shown.
Binary file modified src_vs2013/FFA320Connector.v12.suo
Binary file not shown.
Binary file modified src_vs2013/Release/64/Custom-Command-with-Custom-DataRef.exp
Binary file not shown.
Binary file modified src_vs2013/Release/64/Custom-Command-with-Custom-DataRef.lib
Binary file not shown.
Loading

0 comments on commit df3aca2

Please sign in to comment.