From 1255d94baabe34d6d0a33fba979926f481e94a9c Mon Sep 17 00:00:00 2001 From: SutandoTsukai181 <52977072+SutandoTsukai181@users.noreply.github.com> Date: Sun, 24 May 2020 19:50:08 +0300 Subject: [PATCH 1/2] Remove empty strings from button_text before adding buttons --- src/core/hle/applets/swkbd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp index 7481a168c..ec3f63339 100644 --- a/src/core/hle/applets/swkbd.cpp +++ b/src/core/hle/applets/swkbd.cpp @@ -201,7 +201,8 @@ Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig( }); if (frontend_config.has_custom_button_text) { for (const auto& text : config.button_text) { - frontend_config.button_text.push_back(Common::UTF16BufferToUTF8(text)); + if (text.front() != 0) + frontend_config.button_text.push_back(Common::UTF16BufferToUTF8(text)); } } frontend_config.filters.prevent_digit = From 9ed6762c59778a6988c7d211c592e54ac146b076 Mon Sep 17 00:00:00 2001 From: SutandoTsukai181 <52977072+SutandoTsukai181@users.noreply.github.com> Date: Sun, 24 May 2020 21:45:23 +0300 Subject: [PATCH 2/2] Use fixed indices for button order Apps always return 3 strings, even if there is no custom text, so the index should be constant for each button. --- src/citra_qt/applets/swkbd.cpp | 4 ++-- src/core/hle/applets/swkbd.cpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/citra_qt/applets/swkbd.cpp b/src/citra_qt/applets/swkbd.cpp index 95d4fd4fa..8dd022e2e 100644 --- a/src/citra_qt/applets/swkbd.cpp +++ b/src/citra_qt/applets/swkbd.cpp @@ -49,7 +49,7 @@ QtKeyboardDialog::QtKeyboardDialog(QWidget* parent, QtKeyboard* keyboard_) break; case ButtonConfig::Dual: buttons->addButton(config.has_custom_button_text - ? QString::fromStdString(config.button_text[1]) + ? QString::fromStdString(config.button_text[2]) : tr(SWKBD_BUTTON_OKAY), QDialogButtonBox::ButtonRole::AcceptRole); buttons->addButton(config.has_custom_button_text @@ -59,7 +59,7 @@ QtKeyboardDialog::QtKeyboardDialog(QWidget* parent, QtKeyboard* keyboard_) break; case ButtonConfig::Single: buttons->addButton(config.has_custom_button_text - ? QString::fromStdString(config.button_text[0]) + ? QString::fromStdString(config.button_text[2]) : tr(SWKBD_BUTTON_OKAY), QDialogButtonBox::ButtonRole::AcceptRole); break; diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp index ec3f63339..7481a168c 100644 --- a/src/core/hle/applets/swkbd.cpp +++ b/src/core/hle/applets/swkbd.cpp @@ -201,8 +201,7 @@ Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig( }); if (frontend_config.has_custom_button_text) { for (const auto& text : config.button_text) { - if (text.front() != 0) - frontend_config.button_text.push_back(Common::UTF16BufferToUTF8(text)); + frontend_config.button_text.push_back(Common::UTF16BufferToUTF8(text)); } } frontend_config.filters.prevent_digit =