sysconf stub cuz crash(?) + some stderrp stuff

This commit is contained in:
lizzie 2025-12-01 09:33:59 +00:00
parent 41f91ece33
commit 9cb8f0baa8
14 changed files with 506 additions and 73 deletions

View file

@ -23,12 +23,14 @@ Joycons::Joycons(const std::string& input_engine_) : InputEngine(input_engine_)
return;
}
LOG_INFO(Input, "Joycon driver Initialization started");
const int init_res = SDL_hid_init();
if (init_res == 0) {
#if SDL_VERSION_ATLEAST(2, 26, 4)
int const res = SDL_hid_init();
if (res == 0) {
Setup();
} else {
LOG_ERROR(Input, "Hidapi could not be initialized. failed with error = {}", init_res);
LOG_ERROR(Input, "Hidapi could not be initialized. failed with error = {}", res);
}
#endif
}
Joycons::~Joycons() {
@ -55,7 +57,9 @@ void Joycons::Reset() {
}
device->Stop();
}
#if SDL_VERSION_ATLEAST(2, 26, 4)
SDL_hid_exit();
#endif
}
void Joycons::Setup() {
@ -80,9 +84,9 @@ void Joycons::Setup() {
}
void Joycons::ScanThread(std::stop_token stop_token) {
#if SDL_VERSION_ATLEAST(2, 26, 4)
constexpr u16 nintendo_vendor_id = 0x057e;
Common::SetCurrentThreadName("JoyconScanThread");
do {
SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0);
SDL_hid_device_info* cur_dev = devs;
@ -98,6 +102,7 @@ void Joycons::ScanThread(std::stop_token stop_token) {
SDL_hid_free_enumeration(devs);
} while (Common::StoppableTimedWait(stop_token, std::chrono::seconds{5}));
#endif
}
bool Joycons::IsDeviceNew(SDL_hid_device_info* device_info) const {