Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't even get JslConnectDevices() working. #32

Open
Kablion opened this issue May 13, 2021 · 2 comments
Open

Can't even get JslConnectDevices() working. #32

Kablion opened this issue May 13, 2021 · 2 comments

Comments

@Kablion
Copy link

Kablion commented May 13, 2021

I've not managed to really use this library because I can't even run JslConnectDevices().
I can build the .exe but running it just produces no output.
I assume the program crashes due to JslConnectDevices() because it runs fine if I remove this line.
But debugging with VSCode doesn't even run the lines before that. And no error message is produced.
I just downloaded the release 2.2.0 and put the JSL directory in my project directory.

I am using the VSCode Debugger with the folllowing builld task (created automatically except the -I,-L,-l args):

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "-LPATH\\TO\\MY\\PROJECT\\JSL\\x64",
                "-IPATH\\TO\\MY\\PROJECT\\JSL",
                "-lJoyShockLibrary",
                "-Wall",
                "-Wextra"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

My Code:

#include "JoyShockLibrary.h"
#include <iostream>

using namespace std;

int main()
{
    int i = -1;
    try
    {
        i = JslConnectDevices();
    }
    catch(const std::exception& e)
    {
        std::cerr << e.what() << '\n';
    }
    
    cout << "Test " << i << endl;

    return 1;
}

What am I doing wrong?

@Allexin
Copy link
Contributor

Allexin commented Jul 29, 2021

I have similar issue:
i have two pairs of joycons:
one from DOBE - JslConnectDevices works fine
one from aliexpress RETROPIE MK-02 - JslConnectDevices freezes my app.

@hizbi-github
Copy link

Hello!

I was having the same problem. I solved it by placing the "JoyShockLibrary.dll" in the same directory as the "main.cpp" file. The "JSL" folder was still there in the main directory of the "main.cpp" file.

Other than that, I had the same configuration as yours and was using the Visual Studio Code.

When building and running the "main.cpp" file within the VS Code, it would just crash without any errors.
Only when I ran the "main.exe" manually by double-clicking it, a Windows dialog box showed up saying that it was unable to find the "JoyShockLibrary.dll".

I have since used the library with two genuine DS4 Controllers, both wired and Bluetooth, and they worked perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants