From c0ed56cba06b74345ddc82fb24926668f98553f9 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 25 May 2024 23:19:08 +0200 Subject: [PATCH] cellKbCnvRawCode: don't use caps lock as shift lock unless we are using the qwertz or azerty layout --- rpcs3/Emu/Cell/Modules/cellKb.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellKb.cpp b/rpcs3/Emu/Cell/Modules/cellKb.cpp index 9e60f43a57..9bf9af5db3 100644 --- a/rpcs3/Emu/Cell/Modules/cellKb.cpp +++ b/rpcs3/Emu/Cell/Modules/cellKb.cpp @@ -177,6 +177,7 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode) const bool is_shift = mkey & (CELL_KB_MKEY_L_SHIFT | CELL_KB_MKEY_R_SHIFT); const bool is_caps_lock = led & (CELL_KB_LED_CAPS_LOCK); const bool is_num_lock = led & (CELL_KB_LED_NUM_LOCK); + const bool is_shift_lock = is_caps_lock && (arrange == CELL_KB_MAPPING_GERMAN_GERMANY || arrange == CELL_KB_MAPPING_FRENCH_FRANCE); // CELL_KB_NUMPAD @@ -194,13 +195,14 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode) // ASCII - const auto get_ascii = [is_alt, is_shift, is_caps_lock](u16 raw, u16 shifted = 0, u16 altered = 0) + const auto get_ascii = [&](u16 raw, u16 shifted = 0, u16 altered = 0) { - if ((is_shift || is_caps_lock) && shifted) + // Usually caps lock only applies uppercase to letters, but some layouts treat it as shift lock for all keys. + if ((is_shift || (is_caps_lock && (is_shift_lock || std::isalpha(raw)))) && shifted) { return shifted; } - else if (is_alt && altered) + if (is_alt && altered) { return altered; }