Add IME keyboard layout and panel metrics support#3973
Conversation
w1naenator
commented
Jan 29, 2026
- Introduced new header and implementation files for IME keyboard layout handling.
- Added structures for viewport metrics, keyboard grid layout, and drawing parameters.
- Implemented functions to compute viewport and panel metrics for the IME dialog.
- Enhanced the IME dialog UI to utilize the new keyboard layout and metrics.
- Updated input handling to support new keyboard interactions and layout adjustments.
- Added caret management and text normalization features in the IME dialog state.
- Improved window positioning logic to accommodate different screen resolutions.
- Introduced new header and implementation files for IME keyboard layout handling. - Added structures for viewport metrics, keyboard grid layout, and drawing parameters. - Implemented functions to compute viewport and panel metrics for the IME dialog. - Enhanced the IME dialog UI to utilize the new keyboard layout and metrics. - Updated input handling to support new keyboard interactions and layout adjustments. - Added caret management and text normalization features in the IME dialog state. - Improved window positioning logic to accommodate different screen resolutions.
|
which games uses ime keyboard? |
bloodborne, code vein, nier automata, dragon balls xenoverse 1/2 (was softlocked), diablo III, god eater 2 |
|
That sounds like it's executing garbage data, could you compile locally and debug the crash? |
|
The local build works normally. I tested it both by debugging in Visual Studio and by running it through the command line. The game doesn't show any improvement with this PR. So you can disregard my comment. |
|
is this still on work? |
|
This was implemented as a fix for Dragon Ball Xenoverse 1/2, where entering a character name would softlock the game. This issue is now resolved in this PR. The virtual keyboard now matches the original size, uses the correct positioning, and scales according to the output video resolution. I am not sure whether a virtual keyboard is needed on your side, so I do not know if it is worth spending additional time on it. |
|
@georgemoralis, +1 |
|
yah finish it and we gonna merge it :D |
|
ime settings needs to be converted to new settings api |
I made it look similar, but it’s still my own interpretation and code. However, there could still be patented elements, such as hotkeys and key combinations, table-style layouts, function button sequences, and many other features. |
|
My bad hadn't been on, I will test it now |
|
Tested again, and it now scrolls to the end and after a brief pause wraps while the button is being held, with no additional inputs required. There's still the issue with analogue stick navigation and L2 that I mentioned. IMO I think the only really "glaring" issue is the L2 shift/capslock, because the jumps between shift and caps lock happen quite fast and inconsistently. The analogue stick issue isn't massively inconvenient because it's behaviour is consistent (and I can just use the d pad is also there which works basically perfectly from what I can tell) |
|
Also the other issue I had mentioned before like holding triangle to enter multiple spaces. However one I forgot about is holding x on a character to input it multiple times. |
- Introduced a new mechanism for handling virtual button repeat actions, improving responsiveness for gamepad navigation. - Added support for stick navigation with adjustable repeat rates and initial delays, enhancing user experience during input. - Removed the ImeSelectorFadeState structure and related logic to streamline the IME keyboard layout drawing process. - Simplified the activation logic for menus, ensuring that menu activation is more intuitive and responsive to user input. - Adjusted the navigation threshold for stick inputs to improve sensitivity and control. - Cleaned up the code by removing unused variables and consolidating repeated logic into reusable functions.
|
@brad0demx, check now, I think everything fixed! |
|
Analogue stick feels a lot better now, I'm able to spin it in a circle and it scrolls 2x2 like on console. I notice when auto scrolling with the stick, it scrolls slower than when using the d-pad, though this a minor nitpick and doesn't really matter. Holding X and Square to repeatedly enter/delete text works, holding triangle for repeatedly entering spaces works. L2 seems to be still inconsistent, and I also notice that when holding L2 + triangle to access the punctuation variant of the keyboard, it flashes between both keyboard variants while triangle is being held. It's kind of like the logic for holding triangle to repeatedly type spaces is also being applied to this button combo shortcut. |
OK, I have a gamepad modified for shooters. It has no range for L2/R2—just 0 or full. That is why I do not have this problem. Now the issue is clear; I will fix it. |
- Removed unused includes and redundant structures. - Consolidated virtual pad snapshot handling and input state management. - Introduced new structures for OSK pad input and navigation handling. - Updated function signatures for clarity and consistency. - Enhanced keyboard parameter application for OSK shortcuts. - Improved overall readability and maintainability of the code.
|
Huge refactor and optimization made, plus L2 fixes. Something might be broken now. |
|
@brad0demx, could you please check again? |
|
L2 is now working perfectly, and the issue I mentioned with L2 + triangle is also fixed. Basically everything that I have mentioned previously (Analogue stick, L2, button combos and button hold behaviours) is working now, except one bug in this new version. When pressing triangle to enter space, it doesn't type the space on the first button press and only starts typing it after the button is held briefly. Also minor nitpick that doesn't really matter, when opening the keyboard it auto hovers over "1" at the top left when on console I believe it hovers over "G" |
Seams it is result of my optimizations, I'll fix! |
|
@brad0demx Is it working now as expected? |
|
Yes it's very close to being perfect, my only issue is currently the initial selection box is based on it's last location rather than starting on "G" when the keyboard is opened. Also when using L2 + triangle combo, it moves the selection box to the selection box of the button combo, whereas on the console the selection box stays in the same position. Explanation might not have made much sense but I got videos of the behaviour on emu and console to potentially help imeDialogue.mp4imeDialoguePS4.mp4Really appreciate you taking the feedback and working on it so fast, glad I've been able to help 🥕 |
- Added new key glyphs for Shift and Caps Lock in ime_kb_layout.h. - Improved keyboard navigation logic to skip non-action keys. - Introduced new constants for selector IDs in ime_ui.cpp for better readability. - Refactored keyboard row and column clamping logic for clarity. - Enhanced selector drawing logic with fade and pulse effects for better user feedback. - Implemented functions for cycling keyboard case states and toggling keyboard family modes. - Added functionality to focus on keyboard action keys based on their actions. - Improved edit menu handling with new templated functions for better code reuse. - Updated caret blinking logic to improve text input experience. - Expanded symbol ranges in font_stack.cpp to include keyboard symbols.
|
@brad0demx Thank you, your involvement has been very helpful. I really appreciate your time, testing, and feedback - it helped a lot with debugging and improving the OSK. |
|
@georgemoralis @StevenMiller123 @DanielSvoboda please check last update. |
|
looking good! waiting for others approval |
|
There are still a couple things missing from the PR, however, they aren't merge blocking features. First, if you use the touchpad, the button selection automatically switches to a cursor that you can then use like a mouse based on-screen keyboard on PC. You can exit that mode by pressing any of the dpad arrows or R3 (see below). The other one is gyro based input, which is entered with R3, or the button that is already present for it but isn't hooked up yet (and exited either by initiating dpad movement or touchpad movement). While in that mode, further R3 presses recenter the cursor, and its movement is most intuitively understood as having a line coming out of the Dualshock's lightbar, and its (rotational 3dof) movement changes where that line intersects the screen, and that intersection is the pointer's location, assuming that at start, this line is pointed at the center of the keyboard. |



