MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / text

Method text

switch/source/KeyboardManager.cpp:124–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124std::string KeyboardManager::text(const std::string& suggestion, const std::string& hint, size_t maxLen)
125{
126 if (!systemKeyboardAvailable || maxLen == 0) {
127 return "";
128 }
129
130 // Same PauseGuard rationale as keyboard(): the size-cache walk delays the
131 // swkbd applet launch by the walk's full remaining duration.
132 BackupSizeCache::PauseGuard pauseWalk;
133 SwkbdConfig kbd;
134 std::string out;
135 if (R_SUCCEEDED(swkbdCreate(&kbd, 0))) {
136 swkbdConfigMakePresetDefault(&kbd);
137 swkbdConfigSetGuideText(&kbd, hint.c_str());
138 swkbdConfigSetInitialText(&kbd, suggestion.c_str());
139 swkbdConfigSetStringLenMax(&kbd, maxLen);
140 std::vector<char> buf(maxLen * 4 + 1, 0); // UTF-8 worst case per char
141 Result rc = swkbdShow(&kbd, buf.data(), buf.size());
142 swkbdClose(&kbd);
143 if (R_SUCCEEDED(rc)) {
144 out = buf.data();
145 }
146 }
147 return out;
148}

Callers 1

keyboardMethod · 0.45

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected