mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Osk: Prevent adding highlighted char past limit.
The display would correctly show the number of characters allowed, but you could still end up going one past. This caused glitches in some games, see #9821.
This commit is contained in:
1 parent
f648a82df9
commit
bc07a0529c
1 file changed
+3
-3
@@ -658,7 +658,7 @@ std::wstring PSPOskDialog::CombinationString(bool isInput)
|
||||
string += inputChars[i];
|
||||
}
|
||||
|
||||
if (string.size() <= FieldMaxLength())
|
||||
if (string.size() < FieldMaxLength())
|
||||
{
|
||||
string += oskKeys[currentKeyboard][selectedRow][selectedCol];
|
||||
}
|
||||
@@ -870,7 +870,7 @@ int PSPOskDialog::NativeKeyboard() {
|
||||
// Only write the bytes of the output and the null terminator, don't write the rest.
|
||||
for (size_t i = 0; i < end; ++i) {
|
||||
u16 value = 0;
|
||||
if (i < FieldMaxLength())
|
||||
if (i < FieldMaxLength() && i < inputChars.size())
|
||||
value = inputChars[i];
|
||||
outText[i] = value;
|
||||
}
|
||||
@@ -1070,7 +1070,7 @@ int PSPOskDialog::Update(int animSpeed) {
|
||||
for (size_t i = 0; i < end; ++i)
|
||||
{
|
||||
u16 value = 0;
|
||||
if (i < inputChars.size())
|
||||
if (i < FieldMaxLength() && i < inputChars.size())
|
||||
value = inputChars[i];
|
||||
outText[i] = value;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user