citra-emu
/
citra-canary
Archived
1
0
Fork 0

frontend/applets/swkbd: use system username

This commit is contained in:
zhupengfei 2018-07-17 22:42:53 +08:00
parent dcaf4a8e83
commit b54e3b7aa9
No known key found for this signature in database
GPG Key ID: 85B82A3E62174206
3 changed files with 9 additions and 6 deletions

View File

@ -7,6 +7,6 @@
namespace Frontend {
void RegisterDefaultApplets() {
RegisterSoftwareKeyboard(std::make_shared<DefaultCitraKeyboard>());
RegisterSoftwareKeyboard(std::make_shared<DefaultKeyboard>());
}
} // namespace Frontend

View File

@ -6,8 +6,10 @@
#include <cctype>
#include "common/assert.h"
#include "common/logging/log.h"
#include "common/string_util.h"
#include "core/core.h"
#include "core/frontend/applets/swkbd.h"
#include "core/hle/service/cfg/cfg.h"
namespace Frontend {
@ -130,18 +132,19 @@ ValidationError SoftwareKeyboard::Finalize(const std::string& text, u8 button) {
data = {text, button};
}
void DefaultCitraKeyboard::Setup(const Frontend::KeyboardConfig* config) {
void DefaultKeyboard::Setup(const Frontend::KeyboardConfig* config) {
SoftwareKeyboard::Setup(config);
std::string username = Common::UTF16ToUTF8(Service::CFG::GetCurrentModule()->GetUsername());
switch (this->config.button_config) {
case ButtonConfig::None:
case ButtonConfig::Single:
Finalize("Citra", 0);
Finalize(username, 0);
break;
case ButtonConfig::Dual:
Finalize("Citra", 1);
Finalize(username, 1);
break;
case ButtonConfig::Triple:
Finalize("Citra", 2);
Finalize(username, 2);
break;
default:
UNREACHABLE();

View File

@ -119,7 +119,7 @@ protected:
KeyboardData data;
};
class DefaultCitraKeyboard final : public SoftwareKeyboard {
class DefaultKeyboard final : public SoftwareKeyboard {
public:
void Setup(const KeyboardConfig* config) override;
};