| 62 | } |
| 63 | |
| 64 | std::string ShowKeyboard(const std::string &guide_text, const std::string &initial_text, const u32 max_len, const size_t out_str_len) { |
| 65 | SwkbdConfig kbd; |
| 66 | auto rc = swkbdCreate(&kbd, 0); |
| 67 | if(R_SUCCEEDED(rc)) { |
| 68 | swkbdConfigMakePresetDefault(&kbd); |
| 69 | swkbdConfigSetType(&kbd, SwkbdType_All); |
| 70 | swkbdConfigSetStringLenMax(&kbd, max_len); |
| 71 | if(!guide_text.empty()) { |
| 72 | swkbdConfigSetGuideText(&kbd, guide_text.c_str()); |
| 73 | } |
| 74 | if(!initial_text.empty()) { |
| 75 | swkbdConfigSetInitialText(&kbd, initial_text.c_str()); |
| 76 | } |
| 77 | |
| 78 | auto out_text = new char[out_str_len + 1](); |
| 79 | rc = swkbdShow(&kbd, out_text, out_str_len + 1); |
| 80 | std::string out(out_text); |
| 81 | delete[] out_text; |
| 82 | swkbdClose(&kbd); |
| 83 | |
| 84 | if(R_SUCCEEDED(rc)) { |
| 85 | return out; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | return ""; |
| 90 | } |
| 91 | |
| 92 | void HandleResult(const Result rc, const std::string &info) { |
| 93 | if(R_FAILED(rc)) { |
no outgoing calls
no test coverage detected