From ef5c9ad4fb1edcaa91c61db5308dced57282e6d1 Mon Sep 17 00:00:00 2001 From: ergo720 <45463469+ergo720@users.noreply.github.com> Date: Sun, 12 Dec 2021 21:59:20 +0100 Subject: [PATCH] Simulate correctly the USB enumeration process in XGetDevices --- src/core/hle/XAPI/Xapi.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/hle/XAPI/Xapi.cpp b/src/core/hle/XAPI/Xapi.cpp index 8ebce53ee..9721537d0 100644 --- a/src/core/hle/XAPI/Xapi.cpp +++ b/src/core/hle/XAPI/Xapi.cpp @@ -551,7 +551,15 @@ xbox::dword_xt WINAPI xbox::EMUPATCH(XGetDevices) g_bXppGuard = true; - if (g_bIsDevicesInitializing || g_bIsDevicesEmulating) { + // When simulating the initialization lag of XInitDevices, always report no devices to simulate the USB enumeration process + // Test case: Star Wars Jedi Knight: Jedi Academy + if (g_bIsDevicesInitializing) { + g_bXppGuard = false; + RETURN(0); + } + + // Happens during device hotplug, report the last known connectivity status + if (g_bIsDevicesEmulating) { g_bXppGuard = false; RETURN(DeviceType->CurrentConnected); }