mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-05 13:20:11 +00:00
Merge pull request #10968 from MarcZX10/marc/fix-ime-keyboard-type-overflow
fix(libSceConvertKeycode): look up keyboard types without signed overflow
This commit is contained in:
2 files changed
+4
-1
No files matched your search
@@ -35,7 +35,7 @@ constexpr std::uint32_t LookUp(std::int32_t keyboardType, std::int32_t japaneseV
|
||||
constexpr std::uint32_t traditionalChinese[] = {26, 27, 28, 29, 39};
|
||||
return traditionalChineseVariant >= 0 && traditionalChineseVariant < 5 ? traditionalChinese[traditionalChineseVariant] : 0;
|
||||
}
|
||||
const std::int32_t index = keyboardType - kFirstMappedType;
|
||||
const std::int64_t index = std::int64_t{keyboardType} - kFirstMappedType;
|
||||
return index >= 0 && index < kMappedTypeCount ? kImeTypeByKeyboardType[index] : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
|
||||
static void Require(bool value) { if (!value) std::abort(); }
|
||||
|
||||
static_assert(ImeKeyboardType::LookUp(INT32_MIN, 0, 0) == 0);
|
||||
static_assert(ImeKeyboardType::LookUp(INT32_MAX, 0, 0) == 0);
|
||||
|
||||
static void SetLanguage(const char* value) {
|
||||
#ifdef _WIN32
|
||||
Require(_putenv_s("ANYPS5_LANGUAGE", value != nullptr ? value : "") == 0);
|
||||
|
||||
Reference in new issue
Block a user