Skip to content

Commit

Permalink
Merge pull request Electronicks#86 from TauAkiou/linux-build-invalid-…
Browse files Browse the repository at this point in the history
…device-fix

fix linux build (missing <cstring>) and fix invalid deviceHandles index
  • Loading branch information
Electronicks authored Jan 30, 2023
2 parents df400c5 + 2a39f78 commit daf20a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions JoyShockMapper/src/Mapping.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Mapping.h"
#include "InputHelpers.h"
#include <regex>
#include <cstring>

ostream &operator<<(ostream &out, Mapping mapping)
{
Expand Down
1 change: 1 addition & 0 deletions JoyShockMapper/src/SDL2Wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ struct SdlInstance : public JslWrapper
}
else
{
deviceHandleArray[i] = -1;
delete device;
}
}
Expand Down
4 changes: 3 additions & 1 deletion JoyShockMapper/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <memory>
#include <cfloat>
#include <cuchar>
#include <cstring>

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

if (numConnected < deviceHandles.size())
{
deviceHandles.resize(numConnected);
deviceHandles.erase(std::remove(deviceHandles.begin(), deviceHandles.end(), -1), deviceHandles.end());
//deviceHandles.resize(numConnected);
}

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

0 comments on commit daf20a3

Please sign in to comment.