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

Game crashing at random using dethrace-e757db4-windows-x64 #396

Closed
TwistedZeon opened this issue Jul 17, 2024 · 4 comments · Fixed by #397
Closed

Game crashing at random using dethrace-e757db4-windows-x64 #396

TwistedZeon opened this issue Jul 17, 2024 · 4 comments · Fixed by #397

Comments

@TwistedZeon
Copy link

I have the GOG version of Carmageddon setup previously with the Windows 95 Restoration Pack and now I'm using dethrace on top of that. Hopefully the patch isn't affecting it but otherwise using a non audio release of dethrace didn't crash in the same setup.

I use a .bat file to launch the game setup like such

cd /d "D:\GOG Games\Carmageddon Max Pack\CARMA"
procdump64.exe dethrace.exe -hires --full-screen

I do get audio so that's at least working but I seem to get random crashes that are unprompted.

I get a terminal readout like this upon crashing

D:\GOG Games\Carmageddon Max Pack\CARMA>procdump64.exe dethrace.exe -hires --full-screen
Dethrace version: e757db4
Game mode: Carmageddon
[WARN] S3StopMIDIOutlets stubbed
[INFO] AudioBackend_Init Playback device: 'Speakers (Realtek(R) Audio)'
[SDLPROCDUMP] EXCEPTION_DEBUG_EVENT
[SDLPROCDUMP] ExceptionCode: 0xc0000005 (EXCEPTION_ACCESS_VIOLATION)
[SDLPROCDUMP] ExceptionFlags: 0x00000000 ()
[SDLPROCDUMP] FirstChance: 1
[SDLPROCDUMP] ExceptionAddress: 0x39fcac0b
[SDLPROCDUMP] (Non-continuable exception debug event)
[SDLPROCDUMP]
[SDLPROCDUMP] Writing minidump to "minidumps/dethrace_2024-07-17_16-57-42.dmp"
[SDLPROCDUMP]

The exact dethrace version I'm using is from here https://github.com/dethrace-labs/dethrace/actions/runs/9962726905

I'm on Windows 11 so I'm using dethrace-e757db4-windows-x64.zip

I have uploaded a .dmp file as well https://drive.google.com/file/d/1EhuQ7XAeLv9Ux1AEVvKUjP9XKgWzd6sh/view?usp=sharing

@b-kurczynski
Copy link
Contributor

Hello everyone,

I have found this project yesterday and I felt in love with it immediately. Kudos to @dethrace-labs for titan's work done reverse-engineering the old, good Carma.

I think I'm facing similar issue to the one reported in this ticket, although I have used dethrace-6e6ce12-windows-x64.zip

The sympthoms
On my end the issue looks like audio being suddenly corrupted and starts to tick. peak and the game crashes eventually. I have observed this happens once one CDA ends and the game attempts to play next. It happens both in game and in main menu. The version of the game build from "main" but before merging "Original music" does not suffer this issue.

Double press of "S" key right before CDA comes to and end workarounds the issue.

Code analysis
I did some source code analysis (without actually running it) and I found one suspicious place:
https://github.com/dethrace-labs/dethrace/blob/main/src/harness/audio/miniaudio.c#L77

I have found that:

  • there is a function SoundService() which stops/starts CDA in case the previous CDA finished
  • there is a function AudioBackend_StopCDA() which stops and uninits CDA but only when it's still playing
  • this means there is no call to ma_sound_uninit() to flush the finished CDA if it already stopped - a memory leak?
  • according to spec the sound must be unitialized with ma_sound_uninit()

I have a memory dump. Please let me know if you would like it, then I will try to share it somehow.

@dethrace-labs
Copy link
Owner

Thanks very much for the analysis! That does sound suspicious and matches the behavior I saw during development where ma_sound_unint wasn’t being called at all.

I’ll take a look at the above memory dump and hopefully that might point to the same root cause. Double pressing S is a good indicator that you’ve found the cause of (at least one!) problem.

@dethrace-labs
Copy link
Owner

Looking at the minidump, the crash is coming from deep inside miniaudio when trying to play the next CD track. I'm going to go ahead and fix the missing call to ma_sound_uninit described by @b-kurczynski and expect/hope that to fix both issues

@b-kurczynski
Copy link
Contributor

Hi @dethrace-labs , I just poke a bit with my local copy and I can confirm that adding missing call to ma_sound_uninit fixed my problem.

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

Successfully merging a pull request may close this issue.

3 participants