UI: Improvements and fixes for Windows dark mode (#1728)

This commit is contained in:
Crementif 2025-11-22 23:26:27 +01:00 committed by GitHub
parent 1382ee0381
commit 934cc3eb9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 180 additions and 203 deletions

View file

@ -4,34 +4,16 @@
DirectInputControllerProvider::DirectInputControllerProvider()
{
/*m_module = LoadLibraryA("dinput8.dll");
if (!m_module)
throw std::runtime_error("can't load any xinput dll");
m_DirectInput8Create = (decltype(&DirectInput8Create))GetProcAddress(m_module, "DirectInput8Create");
m_GetdfDIJoystick = (decltype(&GetdfDIJoystick))GetProcAddress(m_module, "GetdfDIJoystick");
if (!m_DirectInput8Create)
{
FreeLibrary(m_module);
throw std::runtime_error("can't find the DirectInput8Create export");
}*/
const auto r = DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&m_dinput8, nullptr);
const auto r = DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8W, (void**)&m_dinput8, nullptr);
if (FAILED(r))
{
const auto error = GetLastError();
//FreeLibrary(m_module);
throw std::runtime_error(fmt::format("can't create direct input object (error: {:#x})", error));
}
}
DirectInputControllerProvider::~DirectInputControllerProvider()
{
/*if (m_module)
FreeLibrary(m_module);
*/
}
std::vector<std::shared_ptr<ControllerBase>> DirectInputControllerProvider::get_controllers()
@ -39,7 +21,7 @@ std::vector<std::shared_ptr<ControllerBase>> DirectInputControllerProvider::get_
std::vector<std::shared_ptr<ControllerBase>> result;
m_dinput8->EnumDevices(DI8DEVCLASS_GAMECTRL,
[](LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef) -> BOOL
[](LPCDIDEVICEINSTANCEW lpddi, LPVOID pvRef) -> BOOL
{
auto* controllers = (decltype(&result))pvRef;
@ -55,8 +37,5 @@ std::vector<std::shared_ptr<ControllerBase>> DirectInputControllerProvider::get_
LPCDIDATAFORMAT DirectInputControllerProvider::get_data_format() const
{
/*if (m_GetdfDIJoystick)
return m_GetdfDIJoystick();*/
return GetdfDIJoystick();
}