diff --git a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp index 79dd7628bd..69ac9a26b1 100644 --- a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp @@ -145,7 +145,6 @@ usb_handler_thread::usb_handler_thread() bool found_skylander = false; bool found_ghltar = false; - bool found_buzz = false; for (ssize_t index = 0; index < ndev; index++) { @@ -199,14 +198,10 @@ usb_handler_thread::usb_handler_thread() check_device(0x044F, 0xB660, 0xB660, "Thrustmaster T500 RS Gear Shift"); // Buzz controllers - if (check_device(0x054C, 0x1000, 0x1040, "buzzer0")) - found_buzz = true; - if (check_device(0x054C, 0x0001, 0x0041, "buzzer1")) - found_buzz = true; - if (check_device(0x054C, 0x0042, 0x0042, "buzzer2")) - found_buzz = true; - if (check_device(0x046D, 0xC220, 0xC220, "buzzer9")) - found_buzz = true; + check_device(0x054C, 0x1000, 0x1040, "buzzer0"); + check_device(0x054C, 0x0001, 0x0041, "buzzer1"); + check_device(0x054C, 0x0042, 0x0042, "buzzer2"); + check_device(0x046D, 0xC220, 0xC220, "buzzer9"); // GCon3 Gun check_device(0x0B9A, 0x0800, 0x0800, "guncon3"); @@ -229,12 +224,16 @@ usb_handler_thread::usb_handler_thread() usb_devices.push_back(std::make_shared()); } - if (!found_buzz) + if (g_cfg.io.buzz == buzz_handler::one_controller || g_cfg.io.buzz == buzz_handler::two_controllers) { - sys_usbd.notice("Adding emulated Buzz! buzzer"); + sys_usbd.notice("Adding emulated Buzz! buzzer (1-4 players)"); usb_devices.push_back(std::make_shared(0, 3)); + } + if (g_cfg.io.buzz == buzz_handler::two_controllers) + { // The current buzz emulation piggybacks on the pad input. // Since there can only be 7 pads connected on a PS3 the 8th player is currently not supported + sys_usbd.notice("Adding emulated Buzz! buzzer (5-7 players)"); usb_devices.push_back(std::make_shared(4, 6)); } diff --git a/rpcs3/Emu/system_config.h b/rpcs3/Emu/system_config.h index a0153e0729..6db4f17313 100644 --- a/rpcs3/Emu/system_config.h +++ b/rpcs3/Emu/system_config.h @@ -251,6 +251,7 @@ struct cfg_root : cfg::node cfg::_enum camera{ this, "Camera", camera_handler::null }; cfg::_enum camera_type{ this, "Camera type", fake_camera_type::unknown }; cfg::_enum move{ this, "Move", move_handler::null }; + cfg::_enum buzz{ this, "Buzz emulated controller", buzz_handler::null }; } io{ this }; struct node_sys : cfg::node diff --git a/rpcs3/Emu/system_config_types.cpp b/rpcs3/Emu/system_config_types.cpp index a3fe64a51b..b3cb2c5c4a 100644 --- a/rpcs3/Emu/system_config_types.cpp +++ b/rpcs3/Emu/system_config_types.cpp @@ -355,6 +355,22 @@ void fmt_class_string::format(std::string& out, u64 arg) }); } +template <> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](auto value) + { + switch (value) + { + case buzz_handler::null: return "Null"; + case buzz_handler::one_controller: return "1 controller"; + case buzz_handler::two_controllers: return "2 controllers"; + } + + return unknown; + }); +} + template <> void fmt_class_string::format(std::string& out, u64 arg) { diff --git a/rpcs3/Emu/system_config_types.h b/rpcs3/Emu/system_config_types.h index b87e1f7f01..5f808b9105 100644 --- a/rpcs3/Emu/system_config_types.h +++ b/rpcs3/Emu/system_config_types.h @@ -95,6 +95,13 @@ enum class move_handler mouse, }; +enum class buzz_handler +{ + null, + one_controller, + two_controllers, +}; + enum class microphone_handler { null, diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index 12c9b41de1..567c116ea3 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -853,6 +853,14 @@ QString emu_settings::GetLocalizedSetting(const QString& original, emu_settings_ case move_handler::mouse: return tr("Mouse", "Move handler"); } break; + case emu_settings_type::Buzz: + switch (static_cast(index)) + { + case buzz_handler::null: return tr("Null (use real Buzzers)", "Buzz handler"); + case buzz_handler::one_controller: return tr("1 controller (1-4 players)", "Buzz handler"); + case buzz_handler::two_controllers: return tr("2 controllers (5-7 players)", "Buzz handler"); + } + break; case emu_settings_type::InternetStatus: switch (static_cast(index)) { diff --git a/rpcs3/rpcs3qt/emu_settings_type.h b/rpcs3/rpcs3qt/emu_settings_type.h index 9aaefb972a..7f5b6f47d8 100644 --- a/rpcs3/rpcs3qt/emu_settings_type.h +++ b/rpcs3/rpcs3qt/emu_settings_type.h @@ -114,6 +114,7 @@ enum class emu_settings_type Camera, CameraType, Move, + Buzz, // Misc ExitRPCS3OnFinish, @@ -258,6 +259,7 @@ static const QMap settings_location = { emu_settings_type::Camera, { "Input/Output", "Camera"}}, { emu_settings_type::CameraType, { "Input/Output", "Camera type"}}, { emu_settings_type::Move, { "Input/Output", "Move" }}, + { emu_settings_type::Buzz, { "Input/Output", "Buzz emulated controller" }}, // Misc { emu_settings_type::ExitRPCS3OnFinish, { "Miscellaneous", "Exit RPCS3 when process finishes" }}, diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 5cb5540efc..953dcc8934 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -849,6 +849,9 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std m_emu_settings->EnhanceComboBox(ui->moveBox, emu_settings_type::Move); SubscribeTooltip(ui->gb_move_handler, tooltips.settings.move); + m_emu_settings->EnhanceComboBox(ui->buzzBox, emu_settings_type::Buzz); + SubscribeTooltip(ui->gb_buzz_emulated, tooltips.settings.buzz); + // _____ _ _______ _ // / ____| | | |__ __| | | // | (___ _ _ ___| |_ ___ _ __ ___ | | __ _| |__ diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index 4fdbc604e7..b6d1a64619 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -1345,7 +1345,16 @@ - + + + Buzz! emulated controller + + + + + + + diff --git a/rpcs3/rpcs3qt/tooltips.h b/rpcs3/rpcs3qt/tooltips.h index 364858c464..c550beae6f 100644 --- a/rpcs3/rpcs3qt/tooltips.h +++ b/rpcs3/rpcs3qt/tooltips.h @@ -181,6 +181,7 @@ public: const QString camera = tr("Camera support is not implemented, leave this on null."); const QString camera_type = tr("Camera support is not implemented, leave this on unknown."); const QString move = tr("PlayStation Move support.\nFake: Experimental! This maps Move controls to DS3 controller mappings.\nMouse: Emulate PSMove with Mouse handler."); + const QString buzz = tr("Buzz! support.\nSelect 1 or 2 controllers if the game requires Buzz! controllers and you don't have real controllers.\nSelect Null if the game has support for DualShock or if you have real Buzz! controllers."); // network