exch-bms2 / beatoraja

Cross-platform rhythm game based on Java and libGDX.
GNU General Public License v3.0
627 stars 146 forks source link

Game is unable to launch due to unicode letters in libgdx filepath #609

Open DolphinDTM opened 3 years ago

DolphinDTM commented 3 years ago

When I try to launch beatoraja, the game tries to find a folder inside .../AppData/Local/Temp/ called libgdx[name] The game creates this folder upon being launched, however, it seems that libgdx or beatoraja is using my real full name, which contains the character Ø.

To clarify: it is able to CREATE the folder correctly, but is not able to READ from it or locate it. beatoraja command line

libgdx folder

I censored the name to protect my own privacy, but I hope you still understand what is going on here.

I tried simply renaming the folder to "libgdxDolphin" but it did not work. It will just create a new folder with my full name again. There are similar problems related to unexpected characters in filepaths, but the other ones seem fixable. For this one, I genuinely do not know how to solve it.

wcko87 commented 3 years ago

have you tried applying the UTF-8 fix? using japanese locale only fixes issues of this sort if the issues stem from japanese characters - for all other characters, the UTF-8 fix should cover that.

DolphinDTM commented 3 years ago

I tried applying it but nothing changed. Same error seemingly.

wcko87 commented 3 years ago

try adding this line to your bat file:

set USERNAME=dolphin

So it looks like this:

REM *** Set system-wide "_JAVA_OPTIONS" environment variable to use OpenGL pipeline (improved performance of > 30% potentially. Also use anti-aliasing for non-LR2 fonts, and finally allow Swing framework to utilize AA and GTKLookAndFeel for config window. ***
set USERNAME=dolphin
set _JAVA_OPTIONS='-Dsun.java2d.opengl=true -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel' -Dfile.encoding="UTF-8"
pushd %~dp0
java -Xms1g -Xmx4g -cp beatoraja.jar;ir/* bms.player.beatoraja.MainLoader
popd

This makes libgdx create the libgdx appdata directory with the username dolphin instead. source: https://steamcommunity.com/app/646570/discussions/1/2561864094351818098/

(also tested it myself. If I do set USERNAME=qqøqq, it reproduces the error you got)

DolphinDTM commented 3 years ago

Oh that's super useful. I'll try it out in a few moments! in other news, I found out where on earth libgdx is pulling my real name from!

Windows User Profiles

For some context: I ran into a similar issue where another software was not able to load its own installation files because they were in my documents folder (not by my own choice). When I initially got my current computer, I made the mistake of creating a user with my own real name, because I thought it only affected it login screen, and not the actual name of the user folder. After going through some hoops with registry edits, I was able to forcibly rename both my display name and the Windows local user name (and its associated folder) to "Dolphin", but it seems my real name still stuck around in this one place. If you know where to find it in the registry edit then I can go in and fix that too, since I'm honestly expecting it to cause issues in the future for other software as well.

DolphinDTM commented 3 years ago

adding that line fixed the game immediately!!!! i can finally play the game now!

wcko87 commented 3 years ago

Just documented the fix in my guide discussions page. https://github.com/wcko87/beatoraja-english-guide/discussions/32

potchy commented 3 years ago

There's an open issue in libgdx's repo for this exact problem: https://github.com/libgdx/libgdx/issues/5524 Then one in OpenJDK's issue tracker: https://bugs.openjdk.java.net/browse/JDK-8195129

It seems it's going to be incredibly difficult to get this fixed

wcko87 commented 3 years ago

yes, but it is also easily fixed on our end so I think it is okay to close this issue