Skip to content

Commit a05e19f

Browse files
Fix WIndows build
1 parent 3b341a5 commit a05e19f

5 files changed

Lines changed: 15 additions & 12 deletions

File tree

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
// Set your X-PLane install folder to deploy the plugin directly to X-Plane while debugging
3-
"xplane.folder" : "/home/andi/.steam/steam/steamapps/common/X-Plane 11"
3+
//"xplane.folder" : "/home/andi/.steam/steam/steamapps/common/X-Plane 11"
4+
"xplane.folder": "D:\\SteamLibrary\\steamapps\\common\\X-Plane 11"
45
}

src/MSP.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ bool MSP::probeNextPort()
236236
{
237237
return false;
238238
}
239-
std::string connectionString = "\\\\.\\COM" + std::to_string(portID);
239+
connectionString = "\\\\.\\COM" + std::to_string(portID);
240240
#elif LIN
241241
if (this->probeTtyUSB)
242242
{
@@ -395,7 +395,7 @@ void MSP::decode()
395395
{
396396
this->lastUpdate = Utils::GetTicks();
397397
}
398-
else if (Utils::GetTicks() > this->lastUpdate + (Utils::IsDebuggerPresent() ? MSPConstants::MSP_COMM_DEBUG_TIMEOUT_MS : MSPConstants::MSP_COMM_TIMEOUT_MS))
398+
else if (Utils::GetTicks() > this->lastUpdate + (Utils::IsDebuggerAttached() ? MSPConstants::MSP_COMM_DEBUG_TIMEOUT_MS : MSPConstants::MSP_COMM_TIMEOUT_MS))
399399
{
400400
this->state = STATE_TIMEOUT;
401401
this->disconnect();

src/Utils.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <dlfcn.h>
2020
#include <gtk/gtk.h>
2121
#include <arpa/inet.h>
22+
#include <sys/ptrace.h>
2223
#endif
2324

2425
#if APL
@@ -146,14 +147,16 @@ namespace Utils
146147
#endif
147148
}
148149

149-
#if LIN || APL
150-
151-
static bool IsDebuggerPresent()
150+
static bool IsDebuggerAttached()
152151
{
152+
#if LIN || APL
153+
return ptrace(PTRACE_TRACEME, 0, 1, 0) == -1;
154+
#elif IBM
155+
return IsDebuggerPresent();
156+
#else
153157
return false;
154-
}
155-
156158
#endif
159+
}
157160

158161
static uint32_t GetTicks()
159162
{

src/serial/Serial.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ void Serial::OpenConnection(std::string &connectionString)
5555
// Disable software flow control (XON/XOFF)
5656
dcbSerialParams.fOutX = FALSE;
5757
dcbSerialParams.fInX = FALSE;
58-
OpenConnection
5958
// Disable hardware flow control (RTS/CTS)
6059
dcbSerialParams.fRtsControl = RTS_CONTROL_DISABLE;
6160
dcbSerialParams.fDtrControl = DTR_CONTROL_DISABLE;
6261

6362
// Disable any special processing of bytes
6463
dcbSerialParams.fBinary = TRUE;
6564

66-
if (!SetCommState(hSerial, &dcbSerialParams))OpenConnection
65+
if (!SetCommState(hSerial, &dcbSerialParams))
6766
{
6867
throw std::runtime_error("Could not set Serial Port parameters");
6968
}
@@ -77,7 +76,7 @@ OpenConnection
7776
comTimeOut.WriteTotalTimeoutConstant = 300;
7877
SetCommTimeouts(hSerial, &comTimeOut);
7978

80-
this->connected = true;OpenConnection
79+
this->connected = true;
8180
}
8281
}
8382
}

src/serial/TcpSerial.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include "SerialBase.h"
66

7-
#ifndef SOCKET
7+
#if LIN
88
typedef int SOCKET;
99
#endif
1010

0 commit comments

Comments
 (0)