Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
zodiac1214 committed Feb 10, 2025
1 parent e88cfd4 commit 24e560e
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 25 deletions.
34 changes: 25 additions & 9 deletions XPMP2-Sample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -58,8 +62,16 @@
/* Begin PBXFileReference section */
123282312D550523005956E8 /* util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
123282322D550559005956E8 /* util.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = "<group>"; };
1232823A2D550ED2005956E8 /* aircraft.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = aircraft.h; sourceTree = "<group>"; };
1232823B2D550F92005956E8 /* aircraft.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = aircraft.cpp; sourceTree = "<group>"; };
123282402D565DED005956E8 /* websocket.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = websocket.h; sourceTree = "<group>"; };
123282422D5666BB005956E8 /* websocket.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = websocket.cpp; sourceTree = "<group>"; };
127CF7BD2D599DA30010501C /* appState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = appState.h; sourceTree = "<group>"; };
127CF7BE2D599E9E0010501C /* appState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = appState.cpp; sourceTree = "<group>"; };
127CF7C12D59A2530010501C /* menu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu.h; sourceTree = "<group>"; };
127CF7C22D59A2DB0010501C /* menu.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = menu.cpp; sourceTree = "<group>"; };
127CF7C42D5A4BED0010501C /* interpolator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = interpolator.h; sourceTree = "<group>"; };
127CF7C52D5A4C8F0010501C /* interpolator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = interpolator.cpp; sourceTree = "<group>"; };
254A0B7B29185357004CA228 /* libfmod.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libfmod.dylib; path = lib/fmod/libfmod.dylib; sourceTree = "<group>"; };
254A0B7D291853CD004CA228 /* XPMP2.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = XPMP2.xcodeproj; path = lib/XPMP2/XPMP2.xcodeproj; sourceTree = "<group>"; };
2572C40523D88802006A7726 /* plugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = plugin.cpp; sourceTree = "<group>"; };
Expand All @@ -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 = "<group>"; };
/* End PBXFileSystemSynchronizedRootGroup section */

/* Begin PBXFrameworksBuildPhase section */
D607B19709A556E400699BC3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
Expand All @@ -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 = "<group>";
Expand Down Expand Up @@ -157,9 +172,6 @@
dependencies = (
254A0B8D291858E9004CA228 /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
127CF7C02D59A11A0010501C /* components */,
);
name = "XPMP2-Sample";
productName = StarterPlugin;
productReference = D607B19909A556E400699BC3 /* XPMP2-Sample.xpl */;
Expand Down Expand Up @@ -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 */,
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion appState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
20 changes: 9 additions & 11 deletions appState.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string,NetworkAircraft*> remotePlanes;
std::map<std::string, NetworkAircraft *> 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:
Expand All @@ -50,10 +50,8 @@ class AppState final {
static XPLMDataRef planePitch;
static XPLMDataRef planeHeading;
static XPLMDataRef planeRoll;

std::mutex m_mutex;
std::vector<std::string> remoteAircraftInfo;


};
#endif // APP_STATE_H
2 changes: 1 addition & 1 deletion components/interpolator.cpp → interpolator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::mutex> lock(m_mutex);

Expand Down
6 changes: 4 additions & 2 deletions components/interpolator.h → interpolator.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
// Created by Di Zou on 2025-02-10.
//

#pragma once
#ifndef INTERPOLATOR_H
#define INTERPOLATOR_H

#include <deque>
#include <string>
Expand Down Expand Up @@ -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);
Expand All @@ -52,3 +53,4 @@ class Interpolator
// ignoring out-of-order data if timestamp < the last stored timestamp.
void addState(const EntityState& state);
};
#endif
File renamed without changes.
2 changes: 1 addition & 1 deletion components/menu.h → menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 24e560e

Please sign in to comment.