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

[Issue Report]: Game crashes on switching audio output device when Windows language is set to Russian #7507

Open
Venyam-N opened this issue Nov 3, 2024 · 10 comments

Comments

@Venyam-N
Copy link

Venyam-N commented Nov 3, 2024

Operating System

Windows x64

DevilutionX version

1.5.3

Describe

This is a part 2 of an old issue #7452 that strikes back -- now after updating SDL to 2.30.9

I have a HP ProBook 445 G7 laptop with AMD Zen Audio Processor / HD Audio Controller ( Realtek High Definition Audio driver v. 6.0.9703.1) running Windows 10 22H2 19045.5011. When Windows language is set to Russian, the game crashes while changing audio output devices from built-in speakers to aux headphones. When Windows language is set to English, everything works properly.

To Reproduce

  1. Start the game sounding from speakers with unplugged headphones
  2. Plug your headphones in
  3. Game crashes. Or else, sound starts to glitch, and when you unplug the headhones and the game crashes anyway.

Expected Behavior

Sound output device should change to headphones with no crashes

Additional context

When the headphones are plugged before I run the game, unplugging them don't crash the game -- output switches to speakers with no glitches (that appeared on previous SDL version), but plugging them back still crashes the game.

Previous investigation by @StephenCWills: libsdl-org/SDL#11122
Also, the game's behavior with system language set to RU end to EN differed on previous SDL version too.

@Venyam-N
Copy link
Author

Venyam-N commented Nov 3, 2024

I've recorded a couple of videos to show how it works:

  1. Windows language is set to RU, the headphones are plugged before running the game:
    https://disk.yandex.ru/i/nwKoDTKK6pdINQ

  2. Windows language is set to RU, the headphones are un-plugged before running the game:
    https://disk.yandex.ru/i/Wz7DgIcKWGwjUg

  3. Windows language is set to EN, the headphones are plugged before running the game:
    https://disk.yandex.ru/i/gQ98jPuHnRhgaQ

  4. Windows language is set to EN, the headphones are un-plugged before running the game:
    https://disk.yandex.ru/i/IsIJCit4KqTJIQ

Maybe this system language thing is somehow connected with my audio devices' names -- for some reason, system recorded both of them in Russian! Even if I switch system language, names stay in Russian -- you can see it comparing two screenshots:
-- RU: https://disk.yandex.ru/i/7Twjdke8UTe2zA
-- EN: https://disk.yandex.ru/i/Vu1EBd60lkaADw
Maybe, when the game addresses my sound devices, Cyrillic symbols get into into some function's parameters and cause all this mess?

@StephenCWills
Copy link
Member

I'm not finding anything useful from a code review. Can you check the Windows Event Viewer for new logs under the Windows Logs > Application category after a crash occurs? Maybe something useful will pop up there.

@Venyam-N
Copy link
Author

Venyam-N commented Nov 16, 2024

Done. Started the game from command line with "--verbose" key and checked event viewer afterwards:
VERBOSE LOGS: https://disk.yandex.ru/i/SbeboSEVNSfsmQ
EVENT VIEWER LOGS: https://disk.yandex.ru/i/b2jIRmHaIu7EhA

@StephenCWills
Copy link
Member

Okay, so exception code 0xc0000374 appears to indicate STATUS_HEAP_CORRUPTION. Sadly, this is still too generic, with a fairly sizable list of possible causes.

https://stackoverflow.com/a/1504307

Conventional wisdom seems to suggest reproducing the issue in a debugger. However, that would basically require me to set up a VM with the Russian language packs installed, get dev tools installed, and try to mock your audio setup. It's a lot of effort, and I'm not even sure if that last part is possible. I'm pretty much out of ideas on how to approach the issue for a solution, unless maybe we can enlist a developer who actually does speak Russian and is able to reproduce the issue on their developer system.

@glebm
Copy link
Collaborator

glebm commented Nov 16, 2024

We're going to need output from a debug build of DevilutionX to diagnose this further.

@Venyam-N, can you please install Visual Studio from https://visualstudio.microsoft.com/vs/community/? There is no need for you to compile anything, it simply has to be installed for the debug build to be able to run at all.

Once you have it installed, we can send you a debug build.

@Venyam-N
Copy link
Author

@glebm Done. What's next?

@glebm
Copy link
Collaborator

glebm commented Nov 17, 2024

@Venyam-N Nice 👍
@StephenCWills will upload a debug build that you can run from the command line and hopefully get a much more detailed error message

@StephenCWills
Copy link
Member

StephenCWills commented Nov 17, 2024

  1. Unzip this to a directory on your computer: devilutionX-1.5-Debug.zip
  2. Open command prompt and cd into that directory
  3. Run devilutionx.exe --verbose 2> stderr.log
  4. Use your headphones to crash the game
  5. Provide the output of stderr.log back to us

Please follow these steps as closely as you can. In particular, if you don't provide the 2> stderr.log arguments, you won't get any logs on the command prompt at all.

EDIT: If you encounter an issue where the game doesn't launch on step 3, try double-clicking the exe and see if you get an error popup.

@Venyam-N
Copy link
Author

Venyam-N commented Nov 17, 2024

For some reason, debug version doesn’t crash and works just fine, while generic 1.5.3 still crashes. Anyway, here are the logs: https://disk.yandex.ru/i/_sP3EACkBls8JQ

@StephenCWills
Copy link
Member

StephenCWills commented Nov 17, 2024

For some reason, debug version doesn’t crash and works just fine...

Seems that's okay. I think we still got what we needed from the logs.

==1848==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x130a21cd2768 at pc 0x7ff800fe6774 bp 0x00fa411ff1b0 sp 0x00fa411fe940

WRITE of size 1888 at 0x130a21cd2768 thread T11

#0 0x7ff800fe6773 in memcpy D:\a\_work\1\s\src\vctools\asan\llvm\compiler-rt\lib\sanitizer_common\sanitizer_common_interceptors_memintrinsics.inc:121

#1 0x7ff611feb9e3 in Aulib::floatToFloatLSB T:\...\devilutionX-1.5\build\x64-Debug\_deps\sdl_audiolib-src\src\sampleconv.cpp:127

#2 0x7ff611ff058d in Aulib::Stream_priv::fSdlCallbackImpl T:\...\devilutionX-1.5\build\x64-Debug\_deps\sdl_audiolib-src\src\stream_p.cpp:224

#3 0x7ff611fd45a3 in sdlCallback T:\...\devilutionX-1.5\build\x64-Debug\_deps\sdl_audiolib-src\src\aulib.cpp:25

#4 0x7ff823a7f4bc in SDL_SetWindowGammaRamp+0xb398 (c:\DEVX\SDL2d.dll+0x18000f4bc)

...

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

No branches or pull requests

3 participants