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

Overlays: Fix wrapped text in native UI #12345

Merged
merged 3 commits into from
Jul 14, 2022
Merged

Overlays: Fix wrapped text in native UI #12345

merged 3 commits into from
Jul 14, 2022

Conversation

Megamouse
Copy link
Contributor

  • The first commit aligns wrapped lines properly instead of only aligning the whole wrapped block as seen in master.
  • The second commit fixes the missing characters that sometimes occur at the beginning of the wrapped lines.
    I had to rewrite render_text_ex because I did not really understand the existing code.
    It feels like I simplified the function in the process.

Old:
Notice the missing [ of "[Cross-Controller]" at the beginning of the third line.

image

New:

image

@Darkhost1999
Copy link
Contributor

Darkhost1999 commented Jul 14, 2022

I'm able to write my own messages using Bethesda games. Looks good to me even with multiple spaces before a word. I hadn't tested earlier so IDK if it was broke before

Test Results

PR
image
Master
image

@kd-11
Copy link
Contributor

kd-11 commented Jul 14, 2022

I'm able to write my own messages using Bethesda games. Looks good to me even with multiple spaces before a word. I hadn't tested earlier so IDK if it was broke before
Test Results

That's not what I was talking about. You need multiple spaces at the end of a wrapped line to see the difference.

@Megamouse
Copy link
Contributor Author

Megamouse commented Jul 14, 2022

Btw, the original bug is really ugly. You access characters of the original text array with indices that don't match because of newlines etc. So I think my approach is much less convoluted and tracking the indices is even less performant imo.

I don't quite understand what you mean with the whitespace stuff.

Used string:

"           Start [%0] on the PS Vita system.             \nIf you have not installed [%0], go to [Remote Play] on the            PS            Vita            system            and            start            [Cross-Controller] from the LiveArea™ screen.                        "

This is your patched code ( '[' now isn't truncated in the original dialog ):
image

Mine:
image

It looks pretty much identical if you ask me.
The only thing both algorithms don't do is truncate the end of the lines.

@Megamouse
Copy link
Contributor Author

Fixed the alignment with leading and trailing whitespace
image

@kd-11
Copy link
Contributor

kd-11 commented Jul 14, 2022

I don't quite understand what you mean with the whitespace stuff.

I meant leading multiple whitespace. You needed to keep ignoring whitespace after a word break until a non-whitespace character was encountered. Seems fine now.

@Megamouse Megamouse merged commit 105781f into RPCS3:master Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants