diff options
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | x-plane-plugin/plugin.c | 17 |
2 files changed, 10 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ec6dc54..4fb6e8d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,13 +199,13 @@ if(SDK_XPLANE) SET_TARGET_PROPERTIES(opentrack-xplane-plugin PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/x-plane-plugin/version-script.txt -shared -rdynamic -nodefaultlibs -undefined_warning -fPIC" - COMPILE_FLAGS "-Wall -O2 -pipe -fPIC -DLIN -DXPLM210" + COMPILE_FLAGS "-Wall -O2 -pipe -fPIC -DLIN -DXPLM200 -DXPLM210" LIBRARY_OUTPUT_NAME "opentrack.xpl" PREFIX "" SUFFIX "") endif() if(APPLE) SET_TARGET_PROPERTIES(opentrack-xplane-plugin PROPERTIES - COMPILE_FLAGS "-iframework ${SDK_XPLANE}/Libraries/Mac/ -DAPL -DXPLM210 -framework XPLM -framework XPWidgets" + COMPILE_FLAGS "-iframework ${SDK_XPLANE}/Libraries/Mac/ -DAPL -DXPLM200 -DXPLM210 -framework XPLM -framework XPWidgets" LINK_FLAGS "-F${SDK_XPLANE}/Libraries/Mac/ -framework XPLM -framework XPWidgets") endif() if(UNIX AND NOT APPLE) diff --git a/x-plane-plugin/plugin.c b/x-plane-plugin/plugin.c index 3958c895..eed3c774 100644 --- a/x-plane-plugin/plugin.c +++ b/x-plane-plugin/plugin.c @@ -8,9 +8,7 @@ #include <unistd.h> #include <XPLMPlugin.h> -#include <XPLMDisplay.h> #include <XPLMDataAccess.h> -#include <XPLMCamera.h> #include <XPLMProcessing.h> #ifndef PLUGIN_API @@ -87,10 +85,11 @@ void PortableLockedShm_unlock(PortableLockedShm* self) flock(self->fd, LOCK_UN); } -int write_head_position( - XPLMDrawingPhase OT_UNUSED(inPhase), - int OT_UNUSED(inIsBefore), - void * OT_UNUSED(inRefcon)) +float write_head_position( + float OT_UNUSED(inElapsedSinceLastCall), + float OT_UNUSED(inElapsedTimeSinceLastFlightLoop), + int OT_UNUSED(inCounter), + void * OT_UNUSED(inRefcon) ) { if (lck_posix != NULL && shm_posix != NULL) { PortableLockedShm_lock(lck_posix); @@ -101,7 +100,7 @@ int write_head_position( XPLMSetDataf(view_pitch, shm_posix->data[Pitch] * 180 / 3.141592654); PortableLockedShm_unlock(lck_posix); } - return 1; + return -1.0; } PLUGIN_API int XPluginStart ( char * outName, char * outSignature, char * outDescription ) { @@ -137,11 +136,11 @@ PLUGIN_API void XPluginStop ( void ) { } PLUGIN_API void XPluginEnable ( void ) { - XPLMRegisterDrawCallback(write_head_position, xplm_Phase_LastScene, 1, NULL); + XPLMRegisterFlightLoopCallback(write_head_position, -1.0, NULL); } PLUGIN_API void XPluginDisable ( void ) { - XPLMUnregisterDrawCallback(write_head_position, xplm_Phase_LastScene, 1, NULL); + XPLMUnregisterFlightLoopCallback(write_head_position, NULL); } PLUGIN_API void XPluginReceiveMessage( |