Skip to content

Commit

Permalink
input/overlays: add option to lock overlay input to player one
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed Jun 26, 2023
1 parent 8e3d0af commit 237f2c1
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rpcs3/Emu/RSX/Overlays/overlays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ namespace rsx
continue;
}

if (pad_index > 0 && g_cfg.io.lock_overlay_input_to_player_one)
{
continue;
}

if (!pad)
{
rsx_log.fatal("Pad %d is nullptr", pad_index);
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 @@ -277,6 +277,7 @@ struct cfg_root : cfg::node
cfg::uint<0, 100'000> pad_sleep{this, "Pad handler sleep (microseconds)", 1'000, true};
cfg::_bool background_input_enabled{this, "Background input enabled", true, true};
cfg::_bool show_move_cursor{this, "Show move cursor", false, true};
cfg::_bool lock_overlay_input_to_player_one{this, "Lock overlay input to player one", false, true};
cfg::string midi_devices{ this, "Emulated Midi devices", "ßßß@@@ßßß@@@ßßß@@@" };
} io{ this };

Expand Down
3 changes: 3 additions & 0 deletions rpcs3/Input/pad_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ void pad_thread::operator()()

for (usz i = 0; i < m_pads.size() && !ps_button_pressed; i++)
{
if (i > 0 && g_cfg.io.lock_overlay_input_to_player_one)
break;

const auto& pad = m_pads[i];

if (!(pad->m_port_status & CELL_PAD_STATUS_CONNECTED))
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 @@ -144,6 +144,7 @@ enum class emu_settings_type
// Input / Output
BackgroundInput,
ShowMoveCursor,
LockOvlIptToP1,
PadHandlerMode,
PadConnection,
KeyboardHandler,
Expand Down Expand Up @@ -327,6 +328,7 @@ inline static const QMap<emu_settings_type, cfg_location> settings_location =
// Input / Output
{ emu_settings_type::BackgroundInput, { "Input/Output", "Background input enabled"}},
{ emu_settings_type::ShowMoveCursor, { "Input/Output", "Show move cursor"}},
{ emu_settings_type::LockOvlIptToP1, { "Input/Output", "Lock overlay input to player one"}},
{ emu_settings_type::PadHandlerMode, { "Input/Output", "Pad handler mode"}},
{ emu_settings_type::PadConnection, { "Input/Output", "Keep pads connected" }},
{ emu_settings_type::KeyboardHandler, { "Input/Output", "Keyboard"}},
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 @@ -1244,6 +1244,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
m_emu_settings->EnhanceCheckBox(ui->showMoveCursorBox, emu_settings_type::ShowMoveCursor);
SubscribeTooltip(ui->showMoveCursorBox, tooltips.settings.show_move_cursor);

m_emu_settings->EnhanceCheckBox(ui->lockOverlayInputToPlayerOne, emu_settings_type::LockOvlIptToP1);
SubscribeTooltip(ui->lockOverlayInputToPlayerOne, tooltips.settings.lock_overlay_input_to_player_one);

// Midi
const QString midi_none = m_emu_settings->m_midi_creator.get_none();
const midi_device def_midi_device{ .type = midi_device_type::keyboard, .name = midi_none.toStdString() };
Expand Down
7 changes: 7 additions & 0 deletions rpcs3/rpcs3qt/settings_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1803,6 +1803,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="lockOverlayInputToPlayerOne">
<property name="text">
<string>Lock Overlay Input To Player One</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacerIoAdditionalSettings">
<property name="orientation">
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/rpcs3qt/tooltips.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ class Tooltips : public QObject
const QString show_move_cursor = tr("Shows the raw position of the PS Move input.\nThis can be very helpful during calibration screens.");
const QString midi_devices = tr("Select up to 3 emulated midi devices and their type.");

const QString lock_overlay_input_to_player_one = tr("Locks the native overlay input to the first player.");

// network

const QString net_status = tr("If set to Connected, RPCS3 will allow programs to use your internet connection.");
Expand Down

0 comments on commit 237f2c1

Please sign in to comment.