Skip to content

Commit

Permalink
Update/XPMP2: relOp.txt, Multicast across interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
TwinFan committed Jan 16, 2024
1 parent 72387d2 commit bf8f56b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ else()
endif()

project(XPMP2RemoteClient
VERSION 3.1.0
VERSION 3.4.0
DESCRIPTION "XPMP2-Remote client plugin for X-Plane")

# Provide compile macros from the above project version definition
Expand Down
4 changes: 2 additions & 2 deletions XPMP2-Remote.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@
);
XPLANE11_ROOT = "$(USER_APPS_DIR)/X-Plane/11";
XPMP2_RC_VER_MAJOR = 3;
XPMP2_RC_VER_MINOR = 1;
XPMP2_RC_VER_MINOR = 4;
XPMP2_RC_VER_PATCH = 0;
XPSDK_ROOT = lib/XPMP2/lib/SDK;
};
Expand Down Expand Up @@ -472,7 +472,7 @@
);
XPLANE11_ROOT = "$(USER_APPS_DIR)/X-Plane/11";
XPMP2_RC_VER_MAJOR = 3;
XPMP2_RC_VER_MINOR = 1;
XPMP2_RC_VER_MINOR = 4;
XPMP2_RC_VER_PATCH = 0;
XPSDK_ROOT = lib/XPMP2/lib/SDK;
};
Expand Down
4 changes: 4 additions & 0 deletions XPMP2-Remote.xcodeproj/xcshareddata/xcschemes/XPMP2.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<PathRunnable
runnableDebuggingMode = "0"
FilePath = "/Users/birger/Applications/X-Plane/11/X-Plane.app">
</PathRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
2 changes: 1 addition & 1 deletion lib/XPMP2
Submodule XPMP2 updated 277 files
10 changes: 3 additions & 7 deletions src/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,9 @@ void ClientToggleActive (int nForce)
{
// Need to start?
if (nForce > 0 ||
XPMP2::RemoteGetStatus() == XPMP2::REMOTE_OFF)
(nForce == 0 && XPMP2::RemoteGetStatus() == XPMP2::REMOTE_OFF))
{
// Try already to get TCAS control so we have it before others can snatch it away.
// This is not in accordance with what is laid out in "TCAS Override"
// https://developer.x-plane.com/article/overriding-tcas-and-providing-traffic-information/#Plugin_coordination
// but we serve a good deed here: We can combine several plugins' TCAS needs,
// but only if we are in control:
// Try (potentially again) to get AI control
ClientTryGetAI();

// Start the listener to receive message
Expand All @@ -626,7 +622,7 @@ void ClientToggleActive (int nForce)
}
// Need to stop?
else if (nForce < 0 ||
XPMP2::RemoteGetStatus() != XPMP2::REMOTE_OFF)
(nForce == 0 && XPMP2::RemoteGetStatus() != XPMP2::REMOTE_OFF))
{
// Release the data access lock, just a safety measure so that we don't hinder shutdown in case we f--- up
try { glockDataMain.unlock(); }
Expand Down
23 changes: 21 additions & 2 deletions src/XPMP2-Remote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,25 @@ void MenuLabelsCB (void* /*inMenuRef*/, void* inItemRef)

/// ID of our flight loop callback for regular tasks
XPLMFlightLoopID flId = nullptr;
/// Flag to perform one-time init in flight loop
static bool bDoOneTimeInit = false;

/// Regular tasks, called by flight loop
float FlightLoopCallback(float, float, int, void*)
{
// entry point into plugin...catch exceptions latest here
try {
GetMiscNetwTime(); // update rcGlob.now, e.g. for logging from worker threads

// --- One Time Init
if (bDoOneTimeInit) {
bDoOneTimeInit = false;
// Activate the listener
ClientToggleActive();
}

// --- Regular Tasks

// if there aren't any planes yet then the XPMP2 library won't call ClientFlightLoopBegins(), instead we do
if (XPMPCountPlanes() == 0) {
try {
Expand Down Expand Up @@ -403,8 +415,15 @@ PLUGIN_API int XPluginEnable(void)
flId = XPLMCreateFlightLoop(&flParams);
XPLMScheduleFlightLoop(flId, 1.0f, true);

// Activate the listener
ClientToggleActive();
// Try already to get TCAS control so we have it before others can snatch it away.
// This is not in accordance with what is laid out in "TCAS Override"
// https://developer.x-plane.com/article/overriding-tcas-and-providing-traffic-information/#Plugin_coordination
// but we serve a good deed here: We can combine several plugins' TCAS needs,
// but only if we are in control:
ClientTryGetAI();

// Activate the listener in the first flight loop callback
bDoOneTimeInit = true;
MenuUpdateCheckmarks();

// Success
Expand Down

0 comments on commit bf8f56b

Please sign in to comment.