I will preface this by saying I am VERY out of my depth here. My aim was to make a simple program that reads data from the controller and outputs it into a text file. I am using visual studio 2022, in a C++ console application project. I know steam uses SDL for their controller support and it picks up my controller fine. I assume its some kind of permission issue because I tried the example code of joystick polling and that didn’t work either, so I assume my code isn’t the problem, but here it is anyways:
#include <SDL3/SDL.h>
#include <iostream>
int main(int argc, char* argv[]) {
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
if (!SDL_Init(SDL_INIT_JOYSTICK)) {
printf("SDL could not initialize! SDL_Error: |%s|\n", SDL_GetError());
return 1;
}
int joystickCount = 69;
SDL_JoystickID* joysticks = SDL_GetJoysticks(&joystickCount);
if (joysticks == NULL) {
printf("SDL_GetJoysticks failed: %s\n", SDL_GetError());
}
else {
printf("Number of joysticks detected: %d\n", joystickCount);
SDL_free(joysticks);
}
SDL_Quit();
return 0;
}