From eb84ffe29d54364779d950c0d90d2ec14c1f4e1b Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 6 Jan 2018 20:32:02 -0600 Subject: [PATCH] Fix SMX_GetConfig not returning a result. This caused SMXConfig to think it was setting both controller configurations even when only one was connected, which made the UI not refresh correctly if only P2 was connected. --- sdk/SMX.h | 5 ++++- sdk/Windows/SMX.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sdk/SMX.h b/sdk/SMX.h index 7ca2efd..cbff240 100644 --- a/sdk/SMX.h +++ b/sdk/SMX.h @@ -79,7 +79,10 @@ extern "C" SMX_API void SMX_SetLights(const char lightsData[864]); extern "C" SMX_API void SMX_ReenableAutoLights(); // Get the current controller's configuration. -extern "C" SMX_API void SMX_GetConfig(int pad, SMXConfig *config); +// +// Return true if a configuration is available. If false is returned, no panel is connected +// and no data will be set. +extern "C" SMX_API bool SMX_GetConfig(int pad, SMXConfig *config); // Update the current controller's configuration. This doesn't block, and the new configuration will // be sent in the background. SMX_GetConfig will return the new configuration as soon as this call diff --git a/sdk/Windows/SMX.cpp b/sdk/Windows/SMX.cpp index dd35a6f..0fd7e43 100644 --- a/sdk/Windows/SMX.cpp +++ b/sdk/Windows/SMX.cpp @@ -53,7 +53,7 @@ SMX_API void SMX_SetLogCallback(SMXLogCallback callback) }); } -SMX_API void SMX_GetConfig(int pad, SMXConfig *config) { g_pSMX->GetDevice(pad)->GetConfig(*config); } +SMX_API bool SMX_GetConfig(int pad, SMXConfig *config) { return g_pSMX->GetDevice(pad)->GetConfig(*config); } SMX_API void SMX_SetConfig(int pad, const SMXConfig *config) { g_pSMX->GetDevice(pad)->SetConfig(*config); } SMX_API void SMX_GetInfo(int pad, SMXInfo *info) { g_pSMX->GetDevice(pad)->GetInfo(*info); } SMX_API uint16_t SMX_GetInputState(int pad) { return g_pSMX->GetDevice(pad)->GetInputState(); }