vrcx-team / VRCX

Friendship management tool for VRChat
MIT License
1.04k stars 188 forks source link

[Bug] Playerlist sorting by name is not identical to 'Sorted by Name' in VRChat itself #704

Open Wasmachineman-NL opened 11 months ago

Wasmachineman-NL commented 11 months ago

Title. VRChat's playerlist ignores special characters while VRCX doesn't, making crossreferencing the ingame playerlist significantly harder.

Natsumi-sama commented 10 months ago

This sounds like the correct alphabetical order to me, how does it differ?

Wasmachineman-NL commented 10 months ago

This sounds like the correct alphabetical order to me, how does it differ?

What I would like to see is that VRCX sorts players exactly as the game itself does, since I often crossreference the playerlist for reasons I will not go into publicly.

Natsumi-sama commented 10 months ago

But how does the game sort differently, what weird sorting are they using?

Wasmachineman-NL commented 10 months ago

Special characters are ignored by VRChat itself when sorting the playerlist ingame.

If user X is called Bart and user Y is called Вart then VRCX doesn't sort them properly when using Sort by Name in VRCX.

loukylor commented 2 months ago

So I actually did some investigation into this, and long story short it's a lot harder than it may seem. I'm just gonna gloss over the details, but because VRChat is built using Il2Cpp, the .NET backend is (a custom fork of) mono. As a result, string comparison is different than regular .NET, yielding different sorting orders when dealing with unicode characters. Therefore, to fix this issue, VRCX would have to reimplement mono's string comparison behavior.

I'm fairly certain that VRChat uses this method while sorting. However this presents many challenges:

That being said, I am 100% sure that it compares the display names of users directly and does no preprocessing (as of writing this). I'm also almost certain the only CompareOptions it passes in is IgnoreCase.

I'd also like to say that investigating this has taken about 30 hours off my life for such a simple small little fix and still no satisfying conclusion. So, to end off, I would just like to curse VRChat, Unity, Il2Cpp, and mono. Anyway, I think this should be marked with Good First Issue