DescentDevelopers / Descent3

Descent 3 by Outrage Entertainment
GNU General Public License v3.0
2.74k stars 231 forks source link

[Runtime Issue]: Unable to set temporary directory to a path that contains Japanese characters #483

Open Jayman2000 opened 1 week ago

Jayman2000 commented 1 week ago

Build Version

v1.5 de75a80ae7564563961c4635ef839fce70944a4c

Operating System Environment

CPU Environment

Game Modes Affected

Game Environment

I’m using game data from the US Windows Dual-Jewel version of Descent 3 v1.4.

Description

If Descent3.exe is stored in a directory that has Japanese characters in its name, then it will immediately crash if you try launching it:

Descent 3 Error
Error: Unable to set temporary directory to: "D:\VC\Partially mine\Descent3\Encoding bug test\ディセント3\custom\cache"


Press OK to exit, CANCEL to ignore this error and continue.

If you press “Cancel”, then the game will try to continue, but it will immediately give you another similar error. That second error does not give you an option to continue.

You can workaround this problem by enabling Windows’s “Beta: Use Unicode UTF-8 for worldwide language support” setting.

Regression Status

Last commit that doesn’t have this problem: 9263055e730c381b7b2fb9fb32d7cea439daddc2 First commit that does have this problem: 82084e9176bdc36d2c88ec7caab1a0ed69769c25

Steps to Reproduce

  1. Set your system locale to a non-Unicode Japanese locale.

    1. Go to Windows Settings > Time & language > Language & region > Administrative language settings > Change system locale.

    2. Make sure that “Beta: Use Unicode UTF-8 for worldwide language support” is unchecked.

    3. In the “Current system locale” dropdown box, select “Japanese (Japan)”.

    4. Click “OK”.

    5. Reboot.

  2. Follow the README’s build instructions.

  3. Create a D3-open-source folder with the required files and folders (See the README’s usage section for details).

  4. Try running Descent3.exe. You should be able to get to the title screen without any errors.

  5. Rename the D3-open-source folder to ディセント3.

  6. Try running Descent3.exe. Before the Dolby ad starts, you’ll get an error about not being able to set the working directory to ディセント3\custom\cache.

Lgt2x commented 1 week ago

Make sure that “Beta: Use Unicode UTF-8 for worldwide language support” is unchecked.

Any reason you'd want to do that with a locale like japanese? Does checking this box fix the issue?

Jayman2000 commented 1 week ago

Any reason you'd want to do that with a locale like japanese?

I don’t really know for sure if there are any reasons why you would want to check that box or uncheck that box. I think that checking that box will break some legacy applications that require code page 932, but I haven’t tested that out on Windows. I have run Japanese applications in Wine before, and I’ve had to switch off of my default UTF-8 locale because the application wasn’t working properly. If you want, I can try some of those same applications on Windows to see if that checkbox breaks anything.

That being said, here’s what I do know for sure:


Does checking this box fix the issue?

Yes. As I wrote previously,

You can workaround this problem by enabling Windows’s “Beta: Use Unicode UTF-8 for worldwide language support” setting.

Lgt2x commented 1 week ago

Thanks for your reply. Don't hesitate to open a PR with a fix if you can while you have a setup ready for reproduction.

winterheart commented 4 days ago

Adding platform-conditional _wfopen() handling should fix this issue.