Fixed [Linux 64-bit] CEZ3 is broken in multiple places

Status
Not open for further replies.
Castle Eggman Zone Act 3 is broken in multiple places on 64-bit Linux.

Problem 1: Boss cannot be attacked.
As shown in the attached screenshot, Robotnik's cage does not properly rise.

Problem 2: Crashing and/or Hanging
Very likely related to the first problem, the game will either instacrash, or hang with the music playing in the background but the screen no longer refreshing. The following is a sample of what is outputted to my terminal during one of these events.
*** Error in `./lsdlsrb2': corrupted double-linked list: 0x0000000005e05940 ***
I've had it also output that it had memory corruption once, a buffer overrun, and others, but now that I'm keeping an eye on it to report the bug, the only exact error message which I keep reliably getting is corrupted double-linked list, with a different 64-bit hex number each time.

Because this error causes a hang and not a crash, it's proven impossible for me to capture a backtrace or other debug information.

I disabled P_Boss4MoveCage by having it immediately return true, and the crash persisted. Ditto for returning false. It seems the problem is bigger than the code for moving the cage.

I created a barebones test map with the player spawn, the boss, and rings, but no cage or any linedef effects. I haven't tested it for an extended period of time, but in the short time I have tested it, no crashes. It's in the attached .zip file, map01 in the wad.
 

Attachments

  • srb20001.png
    srb20001.png
    355.4 KB · Views: 374
  • eggscaliber-testmap.wad.zip
    2.9 KB · Views: 239
Last edited by a moderator:
It does for me on WINE too, but the sound breaks horribly after so long, even with PulseAudio disabled. I'm on 1.4x WINE, however, so it's good to know newer releases of WINE cooperate better.

I don't think this is limited to the 64-bit edition either. I could only run the latest 32-bit version, (I assume it is so from Alam's trunk, since the other release was labeled as 64-bit.) and the AMD builds, oddly enough; I've never had an AMD CPU.

I'm glad you were able to extract more information from the hang than I could. I didn't know how to get more from SRB2 if it couldn't write a crash log.

EDIT : Just tested the map file myself. I gave it whole minutes, and multiple attempts to defeat him, without seeing it crash or hang.
 
Last edited:
It does for me on WINE too, but the sound breaks horribly after so long, even with PulseAudio disabled.

I know that problem from my brother's laptop; we didn't disable PulseAudio there but simply removed it using apt-get. I don't have PulseAudio installed on my desktop anyway.
http://www.hecticgeek.com/2012/01/how-to-remove-pulseaudio-use-alsa-ubuntu-linux/
^ I'm unsure, but maybe it's worth trying to actually remove it completely. It can easily be reinstalled if you decide to need PulseAudio again.

[...] and the AMD builds, oddly enough; I've never had an AMD CPU.

https://superuser.com/questions/128...-called-amd64-and-32-bits-version-called-i386
;-)
 
The sound problem is specific to SRB2, and could be the fault of WINE 1.4x. Every other application I've ran through WINE doesn't have this problem as long as PulseAudio is killed in the terminal. I would just remove it, but I'm not sure if my laptop's own speakers work without it, since I use headphones almost all the time.

ToBeFree said:
https://superuser.com/questions/1284...on-called-i386
;-)

Thanks for linking the explanation! I've been wondering that for the longest time, it finally makes sense. AMD has contributed a lot more than I realized.
 
Crash Identified

I have made a major discovery regarding the crash. The corrupted double-linked list crash does not occur when -nosound is used on the command prompt. However, the cage still fails to rise. This is still progress, and now the culprit of the crashing has been identified.

I discovered this by running valgrind, a memory error detector, with srb2. Doing so completely killed the framerate as expected, which caused the line "ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred" to be spammed with the most screwed up sound ever. With -nosound, the log produced by valgrind had no error. Sure enough I run it straight with -nosound, and I get no crash.

As it turns out, the crash occurs when sfx_litng3 plays. As such, the crash can be triggered with soundtest 41 most of the time; sometimes it works if you start the game and play it from the menu, which is related to the nature of the bug. It's a memory allocation overflow during sample rate conversion. After way too much time spent trying to understand how this could possibly exist only in 64-bit, a single increase of a fixed value by one is all it took to solve the crashing problem. Next up is getting the cage to rise and drop properly.

A pull request has been issued on Github.
 
It's a memory allocation overflow during sample rate conversion. After way too much time spent trying to understand how this could possibly exist only in 64-bit, a single increase of a fixed value by one is all it took to solve the crashing problem.

It's not specific to 64 bit. It happens in any SDL build. We knew the sdl_mixer code was extremely crashy before 2.1.0 came out, but couldn't figure out exactly why.
 
Why does playing soundtest 41 cause crashes on 64-bit Linux but not 32-bit Linux? This is likely an issue with memory allocation.

How come when I convert the sound in question to wav and export using SLADE the sample rate is 44053Hz? Shouldn't the sample rate for all sounds be converted to a multiple of 11025Hz to allow for stupidly easy sample rate conversion? That will work around the broken sample rate conversion code at least.

The only sounds which have a sample rate which is not a multiple of 11025 are:
DSAMWTR7.wav 44053
DSAMWTR8.wav 44053
DSATHUN1.wav 44053
DSATHUN2.wav 44053
DSBNCE1.wav 16000
DSBRAKRL.wav 32000
DSBRAKRX.wav 32000
DSLAVBUB.wav 16000
DSLITNG1.wav 44053
DSLITNG3.wav 44053

I've gotten to the root of the problem within the game's code: the value for newsamples is not being calculated properly. In the case of DSLITNG3.wav, samples is 186264, the proper value of newsamples is 186462.7244..., but the calculated value of newsamples is 186461, and that is with the +1 it gets. Through much experimenting and learning how the fixed point math works, I got it calculating the value pretty much perfectly. I've updated the pull request to reflect this.

---------- Post added at 02:40 PM ---------- Previous post was at 01:37 PM ----------

Fixed the cage. Put it in a new pull request as it's a separate issue than the other.
 
Changes had been merged and applied to SDL and SDL2 interface
 
So, is this fixed in the 2.1.8 release, or do I need to compile from source? The game is still crashing on both the Nights mode stage of Castle Eggman, and its boss.
 
If you're still wondering, the fixes are currently only upstream on github, so you'll have to compile from source. I imagine that 2.1.9 will include the fixes.
 
I'll probably wait for a new patch to be released, if that's going to happen anytime soon. If not, I'll cave and compile it myself. I don't like filling my system's partition with development libraries I don't use, unless I have to.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top