Skip to content

Commit

Permalink
Buzz settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Florin9doi committed Dec 27, 2020
1 parent d52d355 commit 9b1b55f
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 12 deletions.
22 changes: 11 additions & 11 deletions rpcs3/Emu/Cell/lv2/sys_usbd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down Expand Up @@ -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");
Expand All @@ -229,10 +224,15 @@ usb_handler_thread::usb_handler_thread()
usb_devices.push_back(std::make_shared<usb_device_ghltar>());
}

if (!found_buzz)
if (g_cfg.io.buzz == buzz_handler::one_controller || g_cfg.io.buzz == buzz_handler::two_controllers)
{
sys_usbd.error("Adding emulated Buzz! buzzer");
sys_usbd.warning("Adding emulated Buzz! buzzer (1-4 players)");
usb_devices.push_back(std::make_shared<usb_device_buzz>(0, 3));
}
if (g_cfg.io.buzz == buzz_handler::two_controllers)
{
// TODO: Change to 7/8 if a buzz specific configuration window is created or a tab for the 8th player is added
sys_usbd.warning("Adding emulated Buzz! buzzer (5-7 players)");
usb_devices.push_back(std::make_shared<usb_device_buzz>(4, 6));
}

Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/system_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ struct cfg_root : cfg::node
cfg::_enum<camera_handler> camera{ this, "Camera", camera_handler::null };
cfg::_enum<fake_camera_type> camera_type{ this, "Camera type", fake_camera_type::unknown };
cfg::_enum<move_handler> move{ this, "Move", move_handler::null };
cfg::_enum<buzz_handler> buzz{ this, "Buzz emulated controller", buzz_handler::null };
} io{ this };

struct node_sys : cfg::node
Expand Down
15 changes: 15 additions & 0 deletions rpcs3/Emu/system_config_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,21 @@ void fmt_class_string<move_handler>::format(std::string& out, u64 arg)
});
}

template <>
void fmt_class_string<buzz_handler>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](auto value) {
switch (value)
{
case buzz_handler::null: return "Null (use real Buzzers)";
case buzz_handler::one_controller: return "1 controller (1-4 players)";
case buzz_handler::two_controllers: return "2 controllers (5-7 players)";
}

return unknown;
});
}

template <>
void fmt_class_string<ppu_decoder_type>::format(std::string& out, u64 arg)
{
Expand Down
7 changes: 7 additions & 0 deletions rpcs3/Emu/system_config_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ enum class move_handler
mouse,
};

enum class buzz_handler
{
null,
one_controller,
two_controllers,
};

enum class microphone_handler
{
null,
Expand Down
8 changes: 8 additions & 0 deletions rpcs3/rpcs3qt/emu_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,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<buzz_handler>(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<np_internet_status>(index))
{
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/rpcs3qt/emu_settings_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ enum class emu_settings_type
Camera,
CameraType,
Move,
Buzz,

// Misc
ExitRPCS3OnFinish,
Expand Down Expand Up @@ -258,6 +259,7 @@ static const QMap<emu_settings_type, cfg_location> 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" }},
Expand Down
3 changes: 3 additions & 0 deletions rpcs3/rpcs3qt/settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> 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);

// _____ _ _______ _
// / ____| | | |__ __| | |
// | (___ _ _ ___| |_ ___ _ __ ___ | | __ _| |__
Expand Down
11 changes: 10 additions & 1 deletion rpcs3/rpcs3qt/settings_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,16 @@
</widget>
</item>
<item>
<widget class="QWidget" name="inputTabSpacerWidget" native="true"/>
<widget class="QGroupBox" name="gb_buzz_emulated">
<property name="title">
<string>Buzz! emulated controller</string>
</property>
<layout class="QVBoxLayout" name="gb_buzz_emulated_layout">
<item>
<widget class="QComboBox" name="buzzBox"/>
</item>
</layout>
</widget>
</item>
</layout>
</item>
Expand Down
1 change: 1 addition & 0 deletions rpcs3/rpcs3qt/tooltips.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class Tooltips : public QObject
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("Emulate Buzz! controllers.");

// network

Expand Down

0 comments on commit 9b1b55f

Please sign in to comment.