Created
August 4, 2020 22:24
-
-
Save Kovak/99df656f64de7e50326755ff2b9ba22c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void FNpadController::ShowConnectionUI(bool bRunInAThread) | |
{ | |
#if !PLATFORM_WINDOWS | |
// only allow one at a time | |
if (FPlatformAtomics::InterlockedCompareExchange(&bIsShowingConnectUI, 1, 0) == 0) | |
{ | |
bIsShowingConnectUI = true; | |
TFunction<void()> Task = [this]() | |
{ | |
nn::hid::ControllerSupportArg Arg; | |
Arg.SetDefault(); | |
Arg.playerCountMax = CVarNpadMaxControllers.GetValueOnAnyThread(); | |
Arg.playerCountMin = CVarNpadMinControllers.GetValueOnAnyThread(); | |
//Arg.enableSingleMode = Arg.playerCountMax == 1; | |
nn::hid::ControllerSupportResultInfo Info; | |
nn::Result Result = nn::hid::ShowControllerSupport(&Info, Arg); | |
UE_LOG(LogSwitch, Display, TEXT("Showed connect ui. Result = %d.%d:%d-- %d, %d"), Result.GetModule(), Result.GetDescription(), Result.GetInnerValueForDebug(), Info.playerCount, Info.selectedId); | |
FPlatformAtomics::InterlockedDecrement(&bIsShowingConnectUI); | |
}; | |
if (bRunInAThread) | |
{ | |
Async(EAsyncExecution::ThreadPool, Task); | |
} | |
else | |
{ | |
Task(); | |
} | |
//Task(); | |
} | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment