mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 13:35:40 +00:00
Get the current WGI controller list at startup
On Win32 this list is empty and we always get controller added events. On UWP, this list is populated and we don't get controlle added events for currently connected controllers.
This commit is contained in:
parent
12895eca1a
commit
09b7ca27d6
|
@ -532,6 +532,24 @@ WGI_JoystickInit(void)
|
||||||
if (!SUCCEEDED(hr)) {
|
if (!SUCCEEDED(hr)) {
|
||||||
SDL_SetError("add_RawGameControllerRemoved() failed: 0x%lx\n", hr);
|
SDL_SetError("add_RawGameControllerRemoved() failed: 0x%lx\n", hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__FIVectorView_1_Windows__CGaming__CInput__CRawGameController *controllers;
|
||||||
|
hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameControllerStatics_get_RawGameControllers(wgi.statics, &controllers);
|
||||||
|
if (SUCCEEDED(hr)) {
|
||||||
|
unsigned i, count = 0;
|
||||||
|
|
||||||
|
hr = __FIVectorView_1_Windows__CGaming__CInput__CRawGameController_get_Size(controllers, &count);
|
||||||
|
if (SUCCEEDED(hr)) {
|
||||||
|
for (i = 0; i < count; ++i) {
|
||||||
|
__x_ABI_CWindows_CGaming_CInput_CIRawGameController *e = NULL;
|
||||||
|
|
||||||
|
hr = __FIVectorView_1_Windows__CGaming__CInput__CRawGameController_GetAt(controllers, i, &e);
|
||||||
|
if (SUCCEEDED(hr) && e) {
|
||||||
|
IEventHandler_CRawGameControllerVtbl_InvokeAdded(&controller_added, (IInspectable *)controllers, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue