From 24e560e6684728596f7a7f41f47358d16219f01b Mon Sep 17 00:00:00 2001 From: Zodiac Date: Mon, 10 Feb 2025 14:49:41 -0500 Subject: [PATCH] fix: build --- XPMP2-Sample.xcodeproj/project.pbxproj | 34 ++++++++++++++----- components/aircraft.cpp => aircraft.cpp | 0 components/aircraft.h => aircraft.h | 0 appState.cpp | 2 +- appState.h | 20 +++++------ .../interpolator.cpp => interpolator.cpp | 2 +- components/interpolator.h => interpolator.h | 6 ++-- components/menu.cpp => menu.cpp | 0 components/menu.h => menu.h | 2 +- components/websocket.cpp => websocket.cpp | 0 components/websocket.h => websocket.h | 0 11 files changed, 41 insertions(+), 25 deletions(-) rename components/aircraft.cpp => aircraft.cpp (100%) rename components/aircraft.h => aircraft.h (100%) rename components/interpolator.cpp => interpolator.cpp (98%) rename components/interpolator.h => interpolator.h (92%) rename components/menu.cpp => menu.cpp (100%) rename components/menu.h => menu.h (97%) rename components/websocket.cpp => websocket.cpp (100%) rename components/websocket.h => websocket.h (100%) diff --git a/XPMP2-Sample.xcodeproj/project.pbxproj b/XPMP2-Sample.xcodeproj/project.pbxproj index ba9440a..cfa179c 100644 --- a/XPMP2-Sample.xcodeproj/project.pbxproj +++ b/XPMP2-Sample.xcodeproj/project.pbxproj @@ -3,12 +3,16 @@ archiveVersion = 1; classes = { }; - objectVersion = 70; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 123282332D55055C005956E8 /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 123282322D550559005956E8 /* util.cpp */; }; + 1232823C2D550F9B005956E8 /* aircraft.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1232823B2D550F92005956E8 /* aircraft.cpp */; }; + 123282432D5666C1005956E8 /* websocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 123282422D5666BB005956E8 /* websocket.cpp */; }; 127CF7BF2D599E9F0010501C /* appState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 127CF7BE2D599E9E0010501C /* appState.cpp */; }; + 127CF7C32D59A2E30010501C /* menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 127CF7C22D59A2DB0010501C /* menu.cpp */; }; + 127CF7C72D5A4C910010501C /* interpolator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 127CF7C52D5A4C8F0010501C /* interpolator.cpp */; }; 254A0B7C29185357004CA228 /* libfmod.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 254A0B7B29185357004CA228 /* libfmod.dylib */; }; 254A0B89291853EF004CA228 /* XPMP2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 254A0B84291853CD004CA228 /* XPMP2.framework */; }; 2572C40623D88802006A7726 /* plugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2572C40523D88802006A7726 /* plugin.cpp */; }; @@ -58,8 +62,16 @@ /* Begin PBXFileReference section */ 123282312D550523005956E8 /* util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; 123282322D550559005956E8 /* util.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = ""; }; + 1232823A2D550ED2005956E8 /* aircraft.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = aircraft.h; sourceTree = ""; }; + 1232823B2D550F92005956E8 /* aircraft.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = aircraft.cpp; sourceTree = ""; }; + 123282402D565DED005956E8 /* websocket.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = websocket.h; sourceTree = ""; }; + 123282422D5666BB005956E8 /* websocket.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = websocket.cpp; sourceTree = ""; }; 127CF7BD2D599DA30010501C /* appState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = appState.h; sourceTree = ""; }; 127CF7BE2D599E9E0010501C /* appState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = appState.cpp; sourceTree = ""; }; + 127CF7C12D59A2530010501C /* menu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu.h; sourceTree = ""; }; + 127CF7C22D59A2DB0010501C /* menu.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = menu.cpp; sourceTree = ""; }; + 127CF7C42D5A4BED0010501C /* interpolator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = interpolator.h; sourceTree = ""; }; + 127CF7C52D5A4C8F0010501C /* interpolator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = interpolator.cpp; sourceTree = ""; }; 254A0B7B29185357004CA228 /* libfmod.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libfmod.dylib; path = lib/fmod/libfmod.dylib; sourceTree = ""; }; 254A0B7D291853CD004CA228 /* XPMP2.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = XPMP2.xcodeproj; path = lib/XPMP2/XPMP2.xcodeproj; sourceTree = ""; }; 2572C40523D88802006A7726 /* plugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = plugin.cpp; sourceTree = ""; }; @@ -70,10 +82,6 @@ D6A7BDC016A1DEC000D1426A /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ -/* Begin PBXFileSystemSynchronizedRootGroup section */ - 127CF7C02D59A11A0010501C /* components */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = components; sourceTree = ""; }; -/* End PBXFileSystemSynchronizedRootGroup section */ - /* Begin PBXFrameworksBuildPhase section */ D607B19709A556E400699BC3 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; @@ -100,12 +108,19 @@ AC4E46B809C2E0B3006B7E1B /* Source */ = { isa = PBXGroup; children = ( - 127CF7C02D59A11A0010501C /* components */, 2572C40523D88802006A7726 /* plugin.cpp */, 127CF7BD2D599DA30010501C /* appState.h */, 127CF7BE2D599E9E0010501C /* appState.cpp */, 123282312D550523005956E8 /* util.h */, 123282322D550559005956E8 /* util.cpp */, + 1232823A2D550ED2005956E8 /* aircraft.h */, + 1232823B2D550F92005956E8 /* aircraft.cpp */, + 127CF7C42D5A4BED0010501C /* interpolator.h */, + 127CF7C52D5A4C8F0010501C /* interpolator.cpp */, + 127CF7C12D59A2530010501C /* menu.h */, + 127CF7C22D59A2DB0010501C /* menu.cpp */, + 123282402D565DED005956E8 /* websocket.h */, + 123282422D5666BB005956E8 /* websocket.cpp */, ); name = Source; sourceTree = ""; @@ -157,9 +172,6 @@ dependencies = ( 254A0B8D291858E9004CA228 /* PBXTargetDependency */, ); - fileSystemSynchronizedGroups = ( - 127CF7C02D59A11A0010501C /* components */, - ); name = "XPMP2-Sample"; productName = StarterPlugin; productReference = D607B19909A556E400699BC3 /* XPMP2-Sample.xpl */; @@ -212,6 +224,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 127CF7C72D5A4C910010501C /* interpolator.cpp in Sources */, + 1232823C2D550F9B005956E8 /* aircraft.cpp in Sources */, + 123282432D5666C1005956E8 /* websocket.cpp in Sources */, + 127CF7C32D59A2E30010501C /* menu.cpp in Sources */, 2572C40623D88802006A7726 /* plugin.cpp in Sources */, 123282332D55055C005956E8 /* util.cpp in Sources */, 127CF7BF2D599E9F0010501C /* appState.cpp in Sources */, diff --git a/components/aircraft.cpp b/aircraft.cpp similarity index 100% rename from components/aircraft.cpp rename to aircraft.cpp diff --git a/components/aircraft.h b/aircraft.h similarity index 100% rename from components/aircraft.h rename to aircraft.h diff --git a/appState.cpp b/appState.cpp index d5bd913..700fb7c 100644 --- a/appState.cpp +++ b/appState.cpp @@ -174,5 +174,5 @@ void AppState::OnWebSocketMessage(const std::string &msg) { remotePlanes[clientId] = new NetworkAircraft(); remotePlanes[clientId]->interpolator = new Interpolator(offset); } - remotePlanes[clientId]->interpolator->onWebSocketMessage(msg); + remotePlanes[clientId]->interpolator->OnWebSocketMessage(msg); } diff --git a/appState.h b/appState.h index a862334..3040d26 100644 --- a/appState.h +++ b/appState.h @@ -16,26 +16,26 @@ #include "XPLMProcessing.h" #include "XPLMUtilities.h" -#include "util.h" -#include "menu.h" -#include "websocket.h" #include "aircraft.h" #include "interpolator.h" +#include "menu.h" +#include "util.h" +#include "websocket.h" struct NetworkAircraft { - RemoteAircraft* remotePlane; - Interpolator* interpolator; + RemoteAircraft *remotePlane; + Interpolator *interpolator; }; class AppState final { public: static AppState *GetInstance(); - std::map remotePlanes; + std::map remotePlanes; void Initialize(); void Deinitialize(); static float PosReportLoopCallback(float inElapsedSinceLastCall, - float inElapsedTimeSinceLastFlightLoop, - int inCounter, void *inRefcon); + float inElapsedTimeSinceLastFlightLoop, + int inCounter, void *inRefcon); void OnWebSocketMessage(const std::string &msg); private: @@ -50,10 +50,8 @@ class AppState final { static XPLMDataRef planePitch; static XPLMDataRef planeHeading; static XPLMDataRef planeRoll; - + std::mutex m_mutex; std::vector remoteAircraftInfo; - - }; #endif // APP_STATE_H diff --git a/components/interpolator.cpp b/interpolator.cpp similarity index 98% rename from components/interpolator.cpp rename to interpolator.cpp index a373aef..a4ac4d3 100644 --- a/components/interpolator.cpp +++ b/interpolator.cpp @@ -12,7 +12,7 @@ Interpolator::Interpolator(int64_t offset) { this->serverTimeOffset = offset; } //------------------------------------------------------------------------------ // onWebSocketMessage //------------------------------------------------------------------------------ -void Interpolator::onWebSocketMessage(const std::string &msg) { +void Interpolator::OnWebSocketMessage(const std::string &msg) { // We lock our mutex so we can safely modify/read the buffer std::lock_guard lock(m_mutex); diff --git a/components/interpolator.h b/interpolator.h similarity index 92% rename from components/interpolator.h rename to interpolator.h index c39c724..7f58660 100644 --- a/components/interpolator.h +++ b/interpolator.h @@ -5,7 +5,8 @@ // Created by Di Zou on 2025-02-10. // -#pragma once +#ifndef INTERPOLATOR_H +#define INTERPOLATOR_H #include #include @@ -37,7 +38,7 @@ class Interpolator Interpolator& operator=(const Interpolator&) = delete; // Called whenever you receive a new WebSocket message containing an EntityState - void onWebSocketMessage(const std::string& msg); + void OnWebSocketMessage(const std::string& msg); // Get interpolated state at a given renderTime EntityState getInterpolatedState(int64_t renderTime); @@ -52,3 +53,4 @@ class Interpolator // ignoring out-of-order data if timestamp < the last stored timestamp. void addState(const EntityState& state); }; +#endif diff --git a/components/menu.cpp b/menu.cpp similarity index 100% rename from components/menu.cpp rename to menu.cpp diff --git a/components/menu.h b/menu.h similarity index 97% rename from components/menu.h rename to menu.h index 3d2605e..acdd480 100644 --- a/components/menu.h +++ b/menu.h @@ -16,7 +16,7 @@ #include "XPLMProcessing.h" #include "XPLMUtilities.h" -#include "../util.h" +#include "util.h" enum MenuItems { MENU_AI=0, ///< Menu Item "Toggle AI control" diff --git a/components/websocket.cpp b/websocket.cpp similarity index 100% rename from components/websocket.cpp rename to websocket.cpp diff --git a/components/websocket.h b/websocket.h similarity index 100% rename from components/websocket.h rename to websocket.h