mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
overlays: ignore input if kb pad handler is active
This commit is contained in:
parent
a1abc79f28
commit
8f14f392fd
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include "Emu/Io/pad_config_types.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -250,6 +251,8 @@ struct VibrateMotor
|
||||
|
||||
struct Pad
|
||||
{
|
||||
const pad_handler m_pad_handler;
|
||||
|
||||
bool m_buffer_cleared{true};
|
||||
u32 m_port_status{0};
|
||||
u32 m_device_capability{0};
|
||||
@ -308,8 +311,9 @@ struct Pad
|
||||
bool ldd{false};
|
||||
u8 ldd_data[132] = {};
|
||||
|
||||
explicit Pad(u32 port_status, u32 device_capability, u32 device_type)
|
||||
: m_port_status(port_status)
|
||||
explicit Pad(pad_handler handler, u32 port_status, u32 device_capability, u32 device_type)
|
||||
: m_pad_handler(handler)
|
||||
, m_port_status(port_status)
|
||||
, m_device_capability(device_capability)
|
||||
, m_device_type(device_type)
|
||||
{
|
||||
|
@ -124,8 +124,9 @@ namespace rsx
|
||||
if (Emu.IsPaused())
|
||||
continue;
|
||||
|
||||
// Get keyboard input
|
||||
if (m_keyboard_input_enabled && input::g_keyboards_intercepted)
|
||||
// Get keyboard input if supported by the overlay and activated by the game.
|
||||
// Ignored if a keyboard pad handler is active in order to prevent double input.
|
||||
if (m_keyboard_input_enabled && !m_keyboard_pad_handler_active && input::g_keyboards_intercepted)
|
||||
{
|
||||
auto& handler = g_fxo->get<KeyboardHandlerBase>();
|
||||
std::lock_guard<std::mutex> lock(handler.m_mutex);
|
||||
@ -150,10 +151,9 @@ namespace rsx
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (g_cfg.io.keyboard != keyboard_handler::null)
|
||||
{
|
||||
// TODO: Init handler only if the game requests keyboard input.
|
||||
// This probably needs to happen completely seperate from cellKb.
|
||||
// Workaround if cellKb did not init the keyboard handler.
|
||||
handler.Init(1);
|
||||
}
|
||||
}
|
||||
@ -169,6 +169,8 @@ namespace rsx
|
||||
continue;
|
||||
}
|
||||
|
||||
bool keyboard_pad_handler_active = false;
|
||||
|
||||
int pad_index = -1;
|
||||
for (const auto& pad : handler->GetPads())
|
||||
{
|
||||
@ -192,6 +194,11 @@ namespace rsx
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pad->m_pad_handler == pad_handler::keyboard)
|
||||
{
|
||||
m_keyboard_pad_handler_active = true;
|
||||
}
|
||||
|
||||
for (const Button& button : pad->m_buttons)
|
||||
{
|
||||
u8 button_id = pad_button::pad_button_max_enum;
|
||||
@ -310,6 +317,8 @@ namespace rsx
|
||||
}
|
||||
}
|
||||
|
||||
m_keyboard_pad_handler_active = keyboard_pad_handler_active;
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,7 @@ namespace rsx
|
||||
atomic_t<bool> m_stop_pad_interception = false;
|
||||
atomic_t<u64> thread_bits = 0;
|
||||
bool m_keyboard_input_enabled = false; // Allow keyboard events
|
||||
bool m_keyboard_pad_handler_active = true; // Initialized as true to prevent keyboard input until proven otherwise.
|
||||
|
||||
static thread_local u64 g_thread_bit;
|
||||
|
||||
|
@ -13,6 +13,9 @@ LOG_CHANNEL(input_log, "Input");
|
||||
|
||||
void basic_keyboard_handler::Init(const u32 max_connect)
|
||||
{
|
||||
m_keyboards.clear();
|
||||
m_info = {};
|
||||
|
||||
for (u32 i = 0; i < max_connect; i++)
|
||||
{
|
||||
Keyboard kb{};
|
||||
@ -23,7 +26,7 @@ void basic_keyboard_handler::Init(const u32 max_connect)
|
||||
}
|
||||
|
||||
LoadSettings();
|
||||
memset(&m_info, 0, sizeof(KbInfo));
|
||||
|
||||
m_info.max_connect = max_connect;
|
||||
m_info.now_connect = std::min(::size32(m_keyboards), max_connect);
|
||||
m_info.info = input::g_keyboards_intercepted ? CELL_KB_INFO_INTERCEPTED : 0; // Ownership of keyboard data: 0=Application, 1=System
|
||||
|
@ -168,7 +168,7 @@ void pad_thread::Init()
|
||||
}
|
||||
cur_pad_handler->Init();
|
||||
|
||||
m_pads[i] = std::make_shared<Pad>(CELL_PAD_STATUS_DISCONNECTED, pad_settings[i].device_capability, pad_settings[i].device_type);
|
||||
m_pads[i] = std::make_shared<Pad>(handler_type, CELL_PAD_STATUS_DISCONNECTED, pad_settings[i].device_capability, pad_settings[i].device_type);
|
||||
|
||||
if (is_ldd_pad)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user