OSK/overlays: fix initial input interception

Don't use default interception if we already intercept with custom params.
This commit is contained in:
Megamouse 2022-04-26 00:20:07 +02:00
parent c8700dd246
commit 3183d73e4d
8 changed files with 13 additions and 7 deletions

View File

@ -533,7 +533,7 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
Emu.CallFromMainThread([=, &result, &info]()
{
osk->Create(get_localized_string(localized_string_id::CELL_OSK_DIALOG_TITLE), message, osk->osk_text, maxLength, prohibitFlgs, allowOskPanelFlg, firstViewPanel, info.base_color.load(), info.dimmer_enabled.load());
osk->Create(get_localized_string(localized_string_id::CELL_OSK_DIALOG_TITLE), message, osk->osk_text, maxLength, prohibitFlgs, allowOskPanelFlg, firstViewPanel, info.base_color.load(), info.dimmer_enabled.load(), false);
result = true;
result.notify_one();

View File

@ -261,7 +261,7 @@ public:
f32 a = 1.0f;
};
virtual void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color, bool dimmer_enabled) = 0;
virtual void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color, bool dimmer_enabled, bool intercept_input) = 0;
// Closes the dialog.
// Set status to CELL_OSKDIALOG_CLOSE_CONFIRM or CELL_OSKDIALOG_CLOSE_CANCEL for user input.

View File

@ -953,7 +953,7 @@ namespace rsx
static constexpr auto thread_name = "OSK Thread"sv;
};
void osk_dialog::Create(const std::string& /*title*/, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color, bool dimmer_enabled)
void osk_dialog::Create(const std::string& /*title*/, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color, bool dimmer_enabled, bool intercept_input)
{
state = OskDialogState::Open;
flags = prohibit_flags;
@ -963,6 +963,7 @@ namespace rsx
m_frame.back_color.b = base_color.b;
m_frame.back_color.a = base_color.a;
m_background.back_color.a = dimmer_enabled ? 0.8f : 0.0f;
m_start_pad_interception = intercept_input;
const callback_t shift_cb = [this](const std::u32string& text){ on_shift(text); };
const callback_t layer_cb = [this](const std::u32string& text){ on_layer(text); };

View File

@ -82,7 +82,7 @@ namespace rsx
osk_dialog();
~osk_dialog() override = default;
void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color, bool dimmer_enabled) override;
void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color, bool dimmer_enabled, bool intercept_input) override;
void Close(s32 status) override;
void initialize_layout(const std::u32string& title, const std::u32string& initial_text);

View File

@ -67,7 +67,11 @@ namespace rsx
m_input_timer.Start();
input::SetIntercepted(true);
// Only start intercepting input if the the overlay allows it (enabled by default)
if (m_start_pad_interception)
{
input::SetIntercepted(true);
}
const auto handle_button_press = [&](u8 button_id, bool pressed, int pad_index)
{

View File

@ -94,6 +94,7 @@ namespace rsx
};
atomic_t<bool> exit = false;
atomic_t<bool> m_interactive = false;
bool m_start_pad_interception = true;
atomic_t<bool> m_stop_pad_interception = false;
atomic_t<u64> thread_bits = 0;
bool m_keyboard_input_enabled = false; // Allow keyboard events

View File

@ -22,7 +22,7 @@ osk_dialog_frame::~osk_dialog_frame()
}
}
void osk_dialog_frame::Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 /*first_view_panel*/, color /*base_color*/, bool /*dimmer_enabled*/)
void osk_dialog_frame::Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 /*first_view_panel*/, color /*base_color*/, bool /*dimmer_enabled*/, bool /*intercept_input*/)
{
state = OskDialogState::Open;

View File

@ -16,7 +16,7 @@ class osk_dialog_frame : public QObject, public OskDialogBase
public:
osk_dialog_frame() = default;
~osk_dialog_frame();
void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color, bool dimmer_enabled) override;
void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color, bool dimmer_enabled, bool intercept_input) override;
void Close(s32 status) override;
private: