Skip to content

Commit e6196ec

Browse files
committed
OSD: Add Accessories type indicator to USB Input OSD
1 parent 2cdc65c commit e6196ec

40 files changed

+1350
-43
lines changed

3rdparty/include/IconsPromptFont.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,24 @@
185185
#define ICON_PF_KEYBOARD "\xE2\x90\xBD"
186186
#define ICON_PF_MOUSE "\xE2\x90\xBE"
187187
#define ICON_PF_MOUSE_AND_KEYBOARD "\xE2\x90\xBF"
188+
#define ICON_PF_DUALSHOCK2 "\xE2\x91\x81"
189+
#define ICON_PF_DUALSHOCK2_SLASH "\xE2\x91\x82"
188190
#define ICON_PF_GUITAR "\xE2\x91\x83"
191+
#define ICON_PF_STEERING_WHEEL_ALT "\xE2\x91\x84"
192+
#define ICON_PF_SEGA_SEAMIC "\xE2\x91\x85"
193+
#define ICON_PF_JOGCON "\xE2\x91\x86"
194+
#define ICON_PF_BUZZ_CONTROLLER "\xE2\x91\x87"
195+
#define ICON_PF_GAMETRAK_DEVICE "\xE2\x91\x88"
196+
#define ICON_PF_DJ_HERO_TURNTABLE "\xE2\x91\x89"
197+
#define ICON_PF_REALPLAY_BOWLING "\xE2\x91\x8A"
198+
#define ICON_PF_NEGCON "\xE2\x91\x8B"
199+
#define ICON_PF_REZ_VIBRATOR "\xE2\x91\x8C"
200+
#define ICON_PF_EYETOY_WEBCAM "\xE2\x91\x8D"
201+
#define ICON_PF_SINGSTAR_MIC "\xE2\x91\x8E"
202+
#define ICON_PF_GUNCON2 "\xE2\x91\x8F"
203+
#define ICON_PF_HEADSET "\xE2\x91\x90"
204+
#define ICON_PF_KEYBOARDMANIA "\xE2\x91\x91"
205+
#define ICON_PF_PRINTER "\xE2\x91\x92"
189206
#define ICON_PF_F1 "\xE2\x91\xA0"
190207
#define ICON_PF_F2 "\xE2\x91\xA1"
191208
#define ICON_PF_F3 "\xE2\x91\xA2"
@@ -362,6 +379,7 @@
362379
#define ICON_PF_HEARTBEAT_MAG "\xE2\x8D\xBE"
363380
#define ICON_PF_MONITOR_CODE "\xE2\x8D\xBF"
364381
#define ICON_PF_SIXTY_CIRCLE "\xE2\x8E\x80"
382+
#define ICON_PF_VIDEO_CAMERA "\xE2\x8E\x81"
365383
#define ICON_PF_SPEAKER_ALT "\xE2\x8D\xA7"
366384
#define ICON_PF_THUNDERBOLT "\xE2\x8D\x9C"
367385
#define ICON_PF_BACKWARD "\xE2\x8F\x8C"

3rdparty/promptfont/promptfont.sfd

Lines changed: 1189 additions & 31 deletions
Large diffs are not rendered by default.

bin/resources/fonts/promptfont.otf

13.3 KB
Binary file not shown.

pcsx2/ImGui/ImGuiManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ ImFont* ImGuiManager::AddTextFont()
467467
{
468468
// Exclude FA and PF ranges
469469
// clang-format off
470-
static constexpr ImWchar range_exclude_icons[] = { 0x2198,0x2199,0x219e,0x21a7,0x21b0,0x21b3,0x21ba,0x21c3,0x21ce,0x21d4,0x21dc,0x21dd,0x21e0,0x21e3,0x21e6,0x21e8,0x21f3,0x21f3,0x21f7,0x21fb,0x2206,0x2208,0x221a,0x221a,0x227a,0x227d,0x22bf,0x22c8,0x2349,0x2349,0x235a,0x2361,0x2364,0x2367,0x237a,0x237f,0x23b2,0x23b5,0x23cc,0x23cc,0x23f4,0x23f7,0x2427,0x243a,0x243d,0x243d,0x2443,0x2443,0x2460,0x246b,0x248f,0x248f,0x24f5,0x24ff,0x2605,0x2605,0x2699,0x2699,0x278a,0x278e,0xff21,0xff3a,0x0,0x0 };
470+
static constexpr ImWchar range_exclude_icons[] = { 0x2198,0x2199,0x219e,0x21a7,0x21b0,0x21b3,0x21ba,0x21c3,0x21ce,0x21d4,0x21dc,0x21dd,0x21e0,0x21e3,0x21e6,0x21e8,0x21f3,0x21f3,0x21f7,0x21fb,0x2206,0x2208,0x221a,0x221a,0x227a,0x227d,0x22bf,0x22c8,0x2349,0x2349,0x235a,0x2361,0x2364,0x2367,0x237a,0x237f,0x23b2,0x23b5,0x23cc,0x23cc,0x23f4,0x23f7,0x2427,0x243a,0x243d,0x243e,0x2443,0x2452,0x2460,0x246b,0x248f,0x248f,0x24f5,0x24ff,0x2605,0x2605,0x2699,0x2699,0x278a,0x278e,0xff21,0xff3a,0x0,0x0 };
471471
// clang-format on
472472

473473
ImFontConfig cfg;

pcsx2/ImGui/ImGuiOverlays.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ __ri void ImGuiManager::DrawInputsOverlay(float scale, float margin, float spaci
670670

671671
for (u32 port = 0; port < USB::NUM_PORTS; port++)
672672
{
673-
if (EmuConfig.USB.Ports[port].DeviceType >= 0 && !USB::GetDeviceBindings(port).empty())
673+
if (EmuConfig.USB.Ports[port].DeviceType >= 0)
674674
num_ports++;
675675
}
676676

@@ -688,10 +688,7 @@ __ri void ImGuiManager::DrawInputsOverlay(float scale, float margin, float spaci
688688
continue;
689689

690690
const Pad::ControllerInfo& cinfo = pad->GetInfo();
691-
if (cinfo.icon_name)
692-
text.format("{} {}", cinfo.icon_name, slot + 1u);
693-
else
694-
text.format("{} |", slot + 1u);
691+
text.format("{} {} • {} |", ICON_FA_GAMEPAD, slot + 1u, cinfo.icon_name ? cinfo.icon_name : ICON_FA_TRIANGLE_EXCLAMATION);
695692

696693
for (u32 bind = 0; bind < static_cast<u32>(cinfo.bindings.size()); bind++)
697694
{
@@ -744,10 +741,9 @@ __ri void ImGuiManager::DrawInputsOverlay(float scale, float margin, float spaci
744741
continue;
745742

746743
const std::span<const InputBindingInfo> bindings(USB::GetDeviceBindings(port));
747-
if (bindings.empty())
748-
continue;
749744

750-
text.format("{} {} ", ICON_PF_USB, port + 1u);
745+
const char* icon = USB::GetDeviceIconName(port);
746+
text.format("{} {} • {} | ", ICON_PF_USB, port + 1u, icon ? icon : ICON_FA_TRIANGLE_EXCLAMATION);
751747

752748
for (const InputBindingInfo& bi : bindings)
753749
{

pcsx2/SIO/Pad/PadDualshock2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static const SettingInfo s_settings[] = {
8181
};
8282

8383
const Pad::ControllerInfo PadDualshock2::ControllerInfo = {Pad::ControllerType::DualShock2, "DualShock2",
84-
TRANSLATE_NOOP("Pad", "DualShock 2"), ICON_PF_GAMEPAD_ALT, s_bindings, s_settings, Pad::VibrationCapabilities::LargeSmallMotors};
84+
TRANSLATE_NOOP("Pad", "DualShock 2"), ICON_PF_DUALSHOCK2, s_bindings, s_settings, Pad::VibrationCapabilities::LargeSmallMotors};
8585

8686
void PadDualshock2::ConfigLog()
8787
{

pcsx2/SIO/Pad/PadJogcon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static const SettingInfo s_settings[] = {
4545
};
4646

4747
const Pad::ControllerInfo PadJogcon::ControllerInfo = {Pad::ControllerType::Jogcon, "Jogcon",
48-
TRANSLATE_NOOP("Pad", "Jogcon"), ICON_PF_GAMEPAD_ALT, s_bindings, s_settings, Pad::VibrationCapabilities::LargeSmallMotors};
48+
TRANSLATE_NOOP("Pad", "Jogcon"), ICON_PF_JOGCON, s_bindings, s_settings, Pad::VibrationCapabilities::LargeSmallMotors};
4949

5050
void PadJogcon::ConfigLog()
5151
{

pcsx2/SIO/Pad/PadNegcon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static const SettingInfo s_settings[] = {
4242
};
4343

4444
const Pad::ControllerInfo PadNegcon::ControllerInfo = {Pad::ControllerType::Negcon, "NeGcon",
45-
TRANSLATE_NOOP("Pad", "NeGcon"), ICON_PF_GAMEPAD_ALT, s_bindings, s_settings, Pad::VibrationCapabilities::LargeSmallMotors};
45+
TRANSLATE_NOOP("Pad", "NeGcon"), ICON_PF_NEGCON, s_bindings, s_settings, Pad::VibrationCapabilities::LargeSmallMotors};
4646

4747
void PadNegcon::ConfigLog()
4848
{

pcsx2/USB/USB.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,15 @@ const char* USB::GetDeviceName(const std::string_view device)
561561
return dev ? dev->Name() : TRANSLATE_NOOP("USB", "Not Connected");
562562
}
563563

564+
const char* USB::GetDeviceIconName(u32 port)
565+
{
566+
pxAssert(port < NUM_PORTS);
567+
if (s_usb_device_proxy[port])
568+
return s_usb_device_proxy[port]->IconName();
569+
else
570+
return nullptr;
571+
}
572+
564573
const char* USB::GetDeviceSubtypeName(const std::string_view device, u32 subtype)
565574
{
566575
const DeviceProxy* dev = RegisterDevice::instance().Device(device);

pcsx2/USB/USB.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace USB
2727

2828
std::vector<std::pair<const char*, const char*>> GetDeviceTypes();
2929
const char* GetDeviceName(const std::string_view device);
30+
const char* GetDeviceIconName(u32 port);
3031
const char* GetDeviceSubtypeName(const std::string_view device, u32 subtype);
3132
std::span<const char*> GetDeviceSubtypes(const std::string_view device);
3233
std::span<const InputBindingInfo> GetDeviceBindings(const std::string_view device, u32 subtype);

0 commit comments

Comments
 (0)