Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native OSK #5611

Merged
merged 11 commits into from
Feb 2, 2019
Merged

Native OSK #5611

merged 11 commits into from
Feb 2, 2019

Conversation

kd-11
Copy link
Contributor

@kd-11 kd-11 commented Jan 29, 2019

  • Implements a native osk input interface for use with a controller. Only ascii input in supported at the moment.
  • Fixes a few bugs with the backend rendering of some native elements
  • Improves font and text rendering system to support more glyphs and support more languages

@Megamouse
Copy link
Contributor

Megamouse commented Jan 29, 2019

I'll check my personal tests here:
(I'll test for cancel, max length, empty string, accept with original text)

Games:

  • Diablo 3 Doesn't handle wrong return values well (should show an ingame dialog but reopens the osk immediately instead) This was caused by pressing X on the Enter button (which shouldn't be an issue once multiline is done)
  • Nascar '15 Crashes randomly on_osk_close. This game is special since it uses the osk_confirm_callback (see review below)
  • Class of Heros 2G
  • Nier
  • Minecraft
  • Skate 3

Flags:

  • No Space Needs visual clues but fine by me
  • Multiline Hacked the code and tested with Nier and it behaves just like with Qt. Of course the visuals for multiline textfields aren't implemented yet

TODO: (maybe at a later time)

  • So Far the only other trouble I have is that Input will be used by the game directly afterwards which is troublesome.
  • Add some kind of cursor and navigation for the input field

@MSuih
Copy link
Member

MSuih commented Jan 30, 2019

Would it be possible to have backspace bound to some button? It's cubersome to move the cursor to that button every time one wants to erase something. Space as a button woudn't be too bad of an idea either. In addition I think the PS3 OSK also allows you to move the caret around, you could consider implementing that with shoulder buttons as well.

Also I don't like having shift and accept/cancel as face buttons. A more natural spot for shift would be a shoulder button imo and start would be more fitting as an accept button. I'm not sure what to do with cancel though, maybe it could be placed on the keyboard with no button assigned to it.

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 30, 2019

I don't have access to all buttons in native dialog right now without restructuring how pad input works. Caret itself doesn't exist yet as well and many other features. Right now its more important to just check that games do not crash.

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 30, 2019

Added more buttons and remapped them to more closely match ps3. I think only the edit_text control remains, which will be important to support multiline and caret positioning.

@MarioSonic2987
Copy link
Contributor

MarioSonic2987 commented Jan 30, 2019

If you wait enough time (like ~5 seconds), Worms Ultimate Mayhem crashes after pressing Cancel or Accept. In master and this PR without enabling native user interface, works fine.

Master:
image
This PR:
image
Log WUM Master
Log WUM OSK

Native OSK in Minecraft works fine, without FPS goes up beyond 60 FPS.
image

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 30, 2019

Added a proper edit control with support for multiline text if requested by the application. No scrolling available so you're limited to 3 lines max which should be good enough. Also adds a caret for visual feedback when space is pressed for example.
Also added support for disabled keys e.g disabled enter key when multiline is disabled or spacebar when input with no spaces is requested.
If all goes well, I'll go ahead with the config option tomorrow.

@mavethee
Copy link

Crash while renaming world in Minecraft...
image

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 31, 2019

How to cause the crash? I cannot get it to crash (tested with DeS)

@MSuih
Copy link
Member

MSuih commented Jan 31, 2019

If the game sets a default text to OSK input, the caret stll starts at position 0. So if you'd want to replace it with your own text, you first have to keep tapping R1 untill you're at the other end before you can use backspace to erase it.

Edit: Also, if there are multiple text boxes in row with default text then the carat spawns in the position it was when last text box was closed. Meaning that if you entered a 3-letter word in first one then caret will start at 3rd letter in next text dialog.

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 31, 2019

@MSuih Fixed now. The crashes are possibly because the osk dialog never truly closes, just resets the interface. I must have failed to reset some variable.

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 31, 2019

Identified a bug in the overlay renderer where resizing the window from 1280x720 breaks clip regions. This must have silently affected save dialog as well (I suspect some entries were cut off but it was not reported). Will push a fix asap.

@mavethee
Copy link

@kd-11 When I wanna erase space in default name of world, game crashes...

@mavethee
Copy link

And there is an isssue with special letters, but probably game crash is not caused by that.

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 31, 2019

@mavethee What is the default world name?
As for special characters, I did mention only ascii input is supported. Same as all native dialog elements. Needs a lot of font work before non-standard text is supported.

@MSuih
Copy link
Member

MSuih commented Jan 31, 2019

I think the issue he's having is that the default text contains non-ascii characters and your implementation assumes that only ascii characters have been entered. Maybe the backspace function uses a fixed chararter size or something? If you need a bandaid solution then wiping all non-ascii characters from default text could work.

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 31, 2019

Backspace just does text.substr(), not sure how that would cause the crashing, but the out of range definately hints at something of the sort where the special character is larger than ascii limit of 128. I'll run some tests with some non-ascii characters and see if I can reproduce.

@mavethee
Copy link

image
"Nowy Świat" (in polish "New World").
I can't erase the space between "Nowy" and "Świat", because of this error.

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 31, 2019

Makes sense, we're unable to decode some of the characters. Will push a fix asap.

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 31, 2019

Had to just strip all extended codes and replace with the character '#'. Fixes crashing on polish characters. If the '#' replacement is too jarring, I'm open to alternative placeholder characters. Note that the replaced character is 'real' in that it exists in the string if you choose to confirm it. Its not just a visual effect/trick.

@mavethee
Copy link

mavethee commented Jan 31, 2019

@kd-11 Works well, but can you replace '#' with normal letters?
I mean, ś to s, ó - o, ź - z, ż - z, ć - c, ą - a, ę - e.
It's just a visual suggestion.
Of course, if you want to and if it's possible.
My programming skills are still bacics of basics :)

@MSuih
Copy link
Member

MSuih commented Jan 31, 2019

There are too many different variations for that to be feasible. For example there's over 30 different variations of letter A alone.

@mavethee
Copy link

Ouch. So only replacement with "#" left. But thanks for fixing that error with erasing space between words :)

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 31, 2019

Too many variations unfortunately. Its really easy to write a replacement table manually but thats a tedious task given how many variations there are. I plan to eventually replace all text in the native UI with proper unicode support which will remove this limitation (all text variables encoded in utf-32). This is not going to happen any time soon though.

@mavethee
Copy link

@kd-11 Nice. I will be waiting and learn some more stuff, because I wanna help you guys. Going to IT school in Sempteber, but learning on my own it's probably better :P

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 31, 2019

I'll hackishly map downward the characters instead of truly converting utf-16 to utf-8. Should help preserve characters in the high ascii range.

@kd-11
Copy link
Contributor Author

kd-11 commented Jan 31, 2019

Upgraded the text rendering system to use extended ascii with all text converted to this representation. This allows a lot more glyphs to render correctly, and (e.g) makes french text readable. Not all characters can be represented yet, but its at least a step to support more languages.

@MarioSonic2987
Copy link
Contributor

MarioSonic2987 commented Jan 31, 2019

Spanish texts are now readable (now renders glyphs like áéíóúñü¿¡):
image
image
image
WUM crash is still there.

@kd-11 kd-11 changed the title [WIP][Testers Needed] Native OSK [Testers Needed] Native OSK Jan 31, 2019
@mavethee
Copy link

image
Almoust nice! RPCS3 will be better than PS3 someday :)

@leskal
Copy link

leskal commented Jan 31, 2019

A progress for greek letters in Sly Cooper Thieves in Time
Master:
master
PR:
pr

- Allows for more complex interface design
- Adds all the major buttons to native dialog input options
- Adds more button options for the native osk
- Brighten osk cell backgrounds a bit to improve visibility
- Allows to disable cells from being selectable.
- Edit text control adds proper support for multiline and a functioning caret
- Use custom string conversion to ensure overlay deals with extended ascii whenever possible
- Improves language compatibility greatly and avoids empty spaces for unknown glyphs
@kd-11 kd-11 changed the title [Testers Needed] Native OSK Native OSK Feb 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants