input: add option to keep pads connected

This commit is contained in:
Megamouse 2023-05-18 17:17:30 +02:00
parent 08c1a14b13
commit 2ef120fdcd
7 changed files with 29 additions and 0 deletions

View file

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "PadHandler.h"
#include "Emu/system_utils.hpp"
#include "Emu/system_config.h"
#include "Input/pad_thread.h"
#include "Input/product_info.h"
@ -766,6 +767,19 @@ void PadHandlerBase::process()
}
case connection::disconnected:
{
if (g_cfg.io.keep_pads_connected)
{
if (!last_connection_status[i])
{
input_log.success("%s device %d connected by force", m_type, i);
pad->m_port_status |= CELL_PAD_STATUS_CONNECTED;
pad->m_port_status |= CELL_PAD_STATUS_ASSIGN_CHANGES;
last_connection_status[i] = true;
connected_devices++;
}
continue;
}
if (last_connection_status[i])
{
input_log.error("%s device %d disconnected", m_type, i);

View file

@ -75,6 +75,7 @@ namespace rsx
: home_menu_settings_page(x, y, width, height, use_separators, parent, get_localized_string(localized_string_id::HOME_MENU_SETTINGS_INPUT))
{
add_checkbox(&g_cfg.io.background_input_enabled, "Background Input Enabled");
add_checkbox(&g_cfg.io.keep_pads_connected, "Keep Pads Connected");
add_checkbox(&g_cfg.io.show_move_cursor, "Show PS Move Cursor");
if (g_cfg.io.camera == camera_handler::qt)

View file

@ -273,6 +273,7 @@ struct cfg_root : cfg::node
cfg::_enum<turntable_handler> turntable{this, "Turntable emulated controller", turntable_handler::null};
cfg::_enum<ghltar_handler> ghltar{this, "GHLtar emulated controller", ghltar_handler::null};
cfg::_enum<pad_handler_mode> pad_mode{this, "Pad handler mode", pad_handler_mode::single_threaded, true};
cfg::_bool keep_pads_connected{this, "Keep pads connected", false, true};
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};

View file

@ -145,6 +145,7 @@ enum class emu_settings_type
BackgroundInput,
ShowMoveCursor,
PadHandlerMode,
PadConnection,
KeyboardHandler,
MouseHandler,
Camera,
@ -326,6 +327,7 @@ inline static const QMap<emu_settings_type, cfg_location> settings_location =
{ emu_settings_type::BackgroundInput, { "Input/Output", "Background input enabled"}},
{ emu_settings_type::ShowMoveCursor, { "Input/Output", "Show move cursor"}},
{ 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"}},
{ emu_settings_type::MouseHandler, { "Input/Output", "Mouse"}},
{ emu_settings_type::Camera, { "Input/Output", "Camera"}},

View file

@ -1254,6 +1254,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
m_emu_settings->EnhanceCheckBox(ui->backgroundInputBox, emu_settings_type::BackgroundInput);
SubscribeTooltip(ui->backgroundInputBox, tooltips.settings.background_input);
m_emu_settings->EnhanceCheckBox(ui->padConnectionBox, emu_settings_type::PadConnection);
SubscribeTooltip(ui->padConnectionBox, tooltips.settings.pad_connection);
m_emu_settings->EnhanceCheckBox(ui->showMoveCursorBox, emu_settings_type::ShowMoveCursor);
SubscribeTooltip(ui->showMoveCursorBox, tooltips.settings.show_move_cursor);

View file

@ -1810,6 +1810,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="padConnectionBox">
<property name="text">
<string>Keep Pads Connected</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showMoveCursorBox">
<property name="text">

View file

@ -210,6 +210,7 @@ public:
// input
const QString pad_mode = tr("Single-threaded: All pad handlers run on the same thread sequentially.\nMulti-threaded: Each pad handler has its own thread.\nOnly use multi-threaded if you can spare the extra threads.");
const QString pad_connection = tr("Shows all configured pads as always connected ingame even if they are physically disconnected.");
const QString keyboard_handler = tr("Some games support native keyboard input.\nBasic will work in these cases.");
const QString mouse_handler = tr("Some games support native mouse input.\nBasic will work in these cases.");
const QString music_handler = tr("Currently only used for cellMusic emulation.\nSelect Qt to use the default output device of your operating system.\nThis may not be able to play all audio formats.");