Skip to content

Commit daf20a3

Browse files
authored
Merge pull request Electronicks#86 from TauAkiou/linux-build-invalid-device-fix
fix linux build (missing <cstring>) and fix invalid deviceHandles index
2 parents df400c5 + 2a39f78 commit daf20a3

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

JoyShockMapper/src/Mapping.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "Mapping.h"
22
#include "InputHelpers.h"
33
#include <regex>
4+
#include <cstring>
45

56
ostream &operator<<(ostream &out, Mapping mapping)
67
{

JoyShockMapper/src/SDL2Wrapper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ struct SdlInstance : public JslWrapper
317317
}
318318
else
319319
{
320+
deviceHandleArray[i] = -1;
320321
delete device;
321322
}
322323
}

JoyShockMapper/src/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <memory>
1717
#include <cfloat>
1818
#include <cuchar>
19+
#include <cstring>
1920

2021
#ifdef _WIN32
2122
#include <shellapi.h>
@@ -1594,7 +1595,8 @@ void connectDevices(bool mergeJoycons = true)
15941595

15951596
if (numConnected < deviceHandles.size())
15961597
{
1597-
deviceHandles.resize(numConnected);
1598+
deviceHandles.erase(std::remove(deviceHandles.begin(), deviceHandles.end(), -1), deviceHandles.end());
1599+
//deviceHandles.resize(numConnected);
15981600
}
15991601

16001602
for (auto handle : deviceHandles) // Don't use foreach!

0 commit comments

Comments
 (0)