diff --git a/src/xbus/libxplanemp/CMakeLists.txt b/src/xbus/libxplanemp/CMakeLists.txt new file mode 100644 index 000000000..1800e0ad8 --- /dev/null +++ b/src/xbus/libxplanemp/CMakeLists.txt @@ -0,0 +1,54 @@ +cmake_minimum_required(VERSION 3.0) +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" ${CMAKE_MODULE_PATH}) +find_package(XPSDK REQUIRED) + + +if(CMAKE_SYSTEM_NAME MATCHES "Linux") + add_definitions(-DLIN=1) + find_package(PNG) + #set(XPMP_PLATFORM_SOURCES + # src/PlatformUtils.lin.cpp) +elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") + add_definitions(-DIBM=1) + #set(XPMP_PLATFORM_SOURCES + # src/PlatformUtils.win.cpp) +elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") + add_definitions(-DAPL=1) + #set(XPMP_PLATFORM_SOURCES + # src/PlatformUtils.mac.cpp) + find_library(OPENGL OpenGL) + set(XPMP_PLATFORM_LIBRARIES ${OPENGL}) +endif() +if(PNG_FOUND) + add_definitions(-DBITMAP_USE_PNG=1) +endif() + +add_definitions(-DXPLM200=1 -DXPLM210=1) + +add_library(xplanemp + ${XPMP_PLATFORM_SOURCES} + src/BitmapUtils.cpp + src/TexUtils.cpp + src/XObjDefs.cpp + src/XObjReadWrite.cpp + src/XOGLUtils.cpp + src/XPCAircraft.cpp + src/XPMPMultiplayer.cpp + src/XPMPMultiplayerCSL.cpp + src/XPMPMultiplayerObj8.cpp + src/XPMPMultiplayerObj.cpp + src/XPMPMultiplayerVars.cpp + src/XPMPPlaneRenderer.cpp + src/XUtils.cpp) +target_include_directories(xplanemp + PUBLIC + ${XPSDK_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${PNG_INCLUDE_DIRS}) +target_link_libraries(xplanemp + PUBLIC ${XPSDK_XPLM_LIBRARIES} + ${PNG_LIBRARIES} + ${XPMP_PLATFORM_LIBRARIES}) +target_compile_definitions(xplanemp PUBLIC XUTILS_EXCLUDE_MAC_CRAP=1) + diff --git a/src/xbus/libxplanemp/README.markdown b/src/xbus/libxplanemp/README.markdown index 5b6b6d195..361194924 100644 --- a/src/xbus/libxplanemp/README.markdown +++ b/src/xbus/libxplanemp/README.markdown @@ -42,7 +42,7 @@ Multiplayer as it existed on X-IvAp SourceForge: git checkout -b <new branch name> last_xivap_subversion Multiplayer as it existed on XSB/VATSIM git repository: -git checkout -b <posAge != now) { - XPMPPlaneCallbackResult result = - plane->dataFunc(plane, inDataType, &plane->pos, plane->ref); + result = plane->dataFunc(plane, inDataType, &plane->pos, plane->ref); if (result == xpmpData_NewData) plane->posAge = now; } XPMPPlanePosition_t * posD = (XPMPPlanePosition_t *) outData; memcpy(posD, &plane->pos, XPMP_TMIN(posD->size, plane->pos.size)); + result = xpmpData_Unchanged; - return plane->posAge; + break; } case xpmpDataType_Surfaces: { if (plane->surfaceAge != now) { - XPMPPlaneCallbackResult result = - plane->dataFunc(plane, inDataType, &plane->surface, plane->ref); + result = plane->dataFunc(plane, inDataType, &plane->surface, plane->ref); if (result == xpmpData_NewData) plane->surfaceAge = now; } XPMPPlaneSurfaces_t * surfD = (XPMPPlaneSurfaces_t *) outData; memcpy(surfD, &plane->surface, XPMP_TMIN(surfD->size, plane->surface.size)); - return plane->surfaceAge; + result = xpmpData_Unchanged; + + break; } case xpmpDataType_Radar: { if (plane->radarAge != now) { - XPMPPlaneCallbackResult result = - plane->dataFunc(plane, inDataType, &plane->radar, plane->ref); + result = plane->dataFunc(plane, inDataType, &plane->radar, plane->ref); if (result == xpmpData_NewData) plane->radarAge = now; } XPMPPlaneRadar_t * radD = (XPMPPlaneRadar_t *) outData; memcpy(radD, &plane->radar, XPMP_TMIN(radD->size, plane->radar.size)); - return plane->radarAge; + result = xpmpData_Unchanged; + + break; } } - return -1; + return result; } XPMPPlanePtr XPMPPlaneIsValid(XPMPPlaneID inID, XPMPPlaneVector::iterator * outIter) diff --git a/src/xbus/libxplanemp/src/XPMPMultiplayerCSL.cpp b/src/xbus/libxplanemp/src/XPMPMultiplayerCSL.cpp index ee37db4c8..8749dd874 100644 --- a/src/xbus/libxplanemp/src/XPMPMultiplayerCSL.cpp +++ b/src/xbus/libxplanemp/src/XPMPMultiplayerCSL.cpp @@ -42,7 +42,7 @@ using std::max; #endif // Set this to 1 to get TONS of diagnostics on what the lib is doing. -#define DEBUG_CSL_LOADING 1 +#define DEBUG_CSL_LOADING 0 // Set this to 1 to cause AIRLINE and LIVERY to create ICAO codes automatically #define USE_DEFAULTING 0 diff --git a/src/xbus/libxplanemp/src/XPMPMultiplayerObj.cpp b/src/xbus/libxplanemp/src/XPMPMultiplayerObj.cpp index 278b7ce8e..0aa050dbc 100644 --- a/src/xbus/libxplanemp/src/XPMPMultiplayerObj.cpp +++ b/src/xbus/libxplanemp/src/XPMPMultiplayerObj.cpp @@ -31,7 +31,8 @@ #include #include -#include +#include +#include #include "XPLMGraphics.h" #include "XPLMUtilities.h" @@ -345,8 +346,12 @@ int OBJ_LoadModel(const char * inFilePath) tex_path += sObjects.back().obj.texture; tex_path += ".png"; sObjects.back().texnum = OBJ_LoadTexture(tex_path.c_str(), false); - if(sObjects.back().texnum == 0) - printf("WARNING: %s failed to load for %s.\n", tex_path.c_str(),inFilePath); + if(sObjects.back().texnum == 0) { + char debug[500]; + snprintf(debug, 500, "WARNING: %s failed to load for %s.\n", tex_path.c_str(),inFilePath); + debug[499] = '\0'; + XPLMDebugString(debug); + } tex_path = path; p = tex_path.find_last_of("\\:/");//XPLMGetDirectorySeparator()); diff --git a/src/xbus/libxplanemp/src/XPMPPlaneRenderer.cpp b/src/xbus/libxplanemp/src/XPMPPlaneRenderer.cpp index 63b0c4b61..953d4d8ae 100644 --- a/src/xbus/libxplanemp/src/XPMPPlaneRenderer.cpp +++ b/src/xbus/libxplanemp/src/XPMPPlaneRenderer.cpp @@ -26,6 +26,7 @@ #include "XPMPMultiplayerCSL.h" #include "XPMPMultiplayerVars.h" #include "XPMPMultiplayerObj.h" +#include "XPMPMultiplayerObj8.h" #include "XPLMGraphics.h" #include "XPLMDisplay.h"