1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

USB: Replace if/else with switch

This commit is contained in:
Florin9doi 2024-07-14 13:43:02 +03:00 committed by Megamouse
parent 33d2b27b91
commit 7fba56f27b

View File

@ -870,7 +870,9 @@ void connect_usb_controller(u8 index, input::product_type type)
if (!already_connected)
{
if (type == input::product_type::guncon_3)
switch (type)
{
case input::product_type::guncon_3:
{
if (!g_cfg_guncon3.load())
{
@ -881,8 +883,9 @@ void connect_usb_controller(u8 index, input::product_type type)
std::shared_ptr<usb_device> dev = std::make_shared<usb_device_guncon3>(index, usbh->get_new_location());
usbh->connect_usb_device(dev, true);
usbh->pad_to_usb.emplace(index, std::pair(type, dev));
break;
}
if (type == input::product_type::top_shot_elite)
case input::product_type::top_shot_elite:
{
if (!g_cfg_topshotelite.load())
{
@ -893,8 +896,9 @@ void connect_usb_controller(u8 index, input::product_type type)
std::shared_ptr<usb_device> dev = std::make_shared<usb_device_topshotelite>(index, usbh->get_new_location());
usbh->connect_usb_device(dev, true);
usbh->pad_to_usb.emplace(index, std::pair(type, dev));
break;
}
if (type == input::product_type::top_shot_fearmaster)
case input::product_type::top_shot_fearmaster:
{
if (!g_cfg_topshotfearmaster.load())
{
@ -905,13 +909,18 @@ void connect_usb_controller(u8 index, input::product_type type)
std::shared_ptr<usb_device> dev = std::make_shared<usb_device_topshotfearmaster>(index, usbh->get_new_location());
usbh->connect_usb_device(dev, true);
usbh->pad_to_usb.emplace(index, std::pair(type, dev));
break;
}
if (type == input::product_type::udraw_gametablet)
case input::product_type::udraw_gametablet:
{
sys_usbd.success("Adding emulated uDraw GameTablet (controller %d)", index);
std::shared_ptr<usb_device> dev = std::make_shared<usb_device_gametablet>(index, usbh->get_new_location());
usbh->connect_usb_device(dev, true);
usbh->pad_to_usb.emplace(index, std::pair(type, dev));
break;
}
default:
break;
}
}
}