Minor code cleanups

This commit is contained in:
Henrik Rydgård
2026-03-04 11:24:32 +01:00
parent 827430e1b1
commit fff0261be5
2 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
#include "Common/UI/Root.h"
#include "Common/Render/DrawBuffer.h"
static const bool ClickDebug = false;
static constexpr bool ClickDebug = false;
UIScreen::UIScreen() : Screen() {
lastOrientation_ = GetDeviceOrientation();
+6 -6
View File
@@ -70,11 +70,7 @@ static const HIDControllerInfo g_psInfos[] = {
// {PSSubType::DS5, DUALSENSE_EDGE_WIRELESS},
};
static const HIDControllerInfo *GetGamepadInfo(HANDLE handle) {
HIDD_ATTRIBUTES attr{sizeof(HIDD_ATTRIBUTES)};
if (!HidD_GetAttributes(handle, &attr)) {
return nullptr;
}
static const HIDControllerInfo *GetGamepadInfo(const HIDD_ATTRIBUTES &attr) {
for (const auto &info : g_psInfos) {
if (attr.VendorID == info.vendorId && attr.ProductID == info.productId) {
return &info;
@@ -106,7 +102,11 @@ static HANDLE OpenFirstHIDController(HIDControllerType *subType, int *reportSize
HANDLE handle = CreateFile(detailData->DevicePath, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (handle != INVALID_HANDLE_VALUE) {
const HIDControllerInfo *info = GetGamepadInfo(handle);
HIDD_ATTRIBUTES attr{sizeof(HIDD_ATTRIBUTES)};
if (!HidD_GetAttributes(handle, &attr)) {
return nullptr;
}
const HIDControllerInfo *info = GetGamepadInfo(attr);
*outInfo = info;
if (info) {
*subType = info->type;