diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-06-16 12:34:31 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-06-16 12:35:51 +0200 |
commit | 0760fe011114fa440275b487eaf766b015f40e5b (patch) | |
tree | a0141fb291b7dc1e38d16dd0eb2c767ec93b310a /x-plane-plugin | |
parent | 60460f56cabe0155996adf8ba5e9f6730ef0b203 (diff) |
all: split "api" into "api" and "logic"
Here, the "logic" module has all the stuff for building one's own
graphical user interface.
The "api" module has stuff used by other trackers.
While at it, each of "api", "logic", and "compat" need their own export
headers. This is because of preprocessor symbol clashes.
This is all because a change in the "gui"-only dependency required a
relink of all the trackers, protocols, and flters. It takes too long
when building in the release configuration. With the split, only the
"gui" module gets rebuilt. Since it has close to no static dependencies,
it's fast enough.
Diffstat (limited to 'x-plane-plugin')
-rw-r--r-- | x-plane-plugin/plugin.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/x-plane-plugin/plugin.c b/x-plane-plugin/plugin.c index 4d4c6c92..b0a41414 100644 --- a/x-plane-plugin/plugin.c +++ b/x-plane-plugin/plugin.c @@ -22,18 +22,21 @@ #define WINE_SHM_NAME "facetracknoir-wine-shm" #define WINE_MTX_NAME "facetracknoir-wine-mtx" +#define BUILD_compat #include "../opentrack-compat/export.hpp" enum Axis { TX = 0, TY, TZ, Yaw, Pitch, Roll }; -typedef struct PortableLockedShm { +typedef struct PortableLockedShm +{ void* mem; int fd, size; } PortableLockedShm; -typedef struct WineSHM { +typedef struct WineSHM +{ double data[6]; int gameid, gameid2; unsigned char table[8]; @@ -68,7 +71,7 @@ PortableLockedShm* PortableLockedShm_init(const char *shmName, const char *OT_UN strncpy(shm_filename+1, shmName, NAME_MAX-2); shm_filename[NAME_MAX-1] = '\0'; /* (void) shm_unlink(shm_filename); */ - + self->fd = shm_open(shm_filename, O_RDWR | O_CREAT, 0600); (void) ftruncate(self->fd, mapSize); self->mem = mmap(NULL, mapSize, PROT_READ|PROT_WRITE, MAP_SHARED, self->fd, (off_t)0); @@ -149,7 +152,7 @@ static int TranslationToggleHandler( XPLMCommandRef inCommand, return 0; } -PLUGIN_API OPENTRACK_EXPORT int XPluginStart ( char * outName, char * outSignature, char * outDescription ) { +PLUGIN_API OPENTRACK_COMPAT_EXPORT int XPluginStart ( char * outName, char * outSignature, char * outDescription ) { view_x = XPLMFindDataRef("sim/aircraft/view/acf_peX"); view_y = XPLMFindDataRef("sim/aircraft/view/acf_peY"); view_z = XPLMFindDataRef("sim/aircraft/view/acf_peZ"); @@ -187,7 +190,7 @@ PLUGIN_API OPENTRACK_EXPORT int XPluginStart ( char * outName, char * outSignatu return 0; } -PLUGIN_API OPENTRACK_EXPORT void XPluginStop ( void ) { +PLUGIN_API OPENTRACK_COMPAT_EXPORT void XPluginStop ( void ) { if (lck_posix) { PortableLockedShm_free(lck_posix); @@ -196,17 +199,17 @@ PLUGIN_API OPENTRACK_EXPORT void XPluginStop ( void ) { } } -PLUGIN_API OPENTRACK_EXPORT void XPluginEnable ( void ) { +PLUGIN_API OPENTRACK_COMPAT_EXPORT void XPluginEnable ( void ) { XPLMRegisterFlightLoopCallback(write_head_position, -1.0, NULL); track_disabled = 0; } -PLUGIN_API OPENTRACK_EXPORT void XPluginDisable ( void ) { +PLUGIN_API OPENTRACK_COMPAT_EXPORT void XPluginDisable ( void ) { XPLMUnregisterFlightLoopCallback(write_head_position, NULL); track_disabled = 1; } -PLUGIN_API OPENTRACK_EXPORT void XPluginReceiveMessage( +PLUGIN_API OPENTRACK_COMPAT_EXPORT void XPluginReceiveMessage( XPLMPluginID OT_UNUSED(inFromWho), int OT_UNUSED(inMessage), void * OT_UNUSED(inParam)) |