OpenFodder / openfodder

Open Fodder: An open source port of Cannon Fodder
http://openfodder.com
GNU General Public License v3.0
459 stars 42 forks source link

"SDLAudioP2" received signal SIGSEGV, Segmentation fault. #47

Closed andrew-mcmahon closed 4 years ago

andrew-mcmahon commented 5 years ago

Describe the bug I appear to have triggered some sound related crashes. Plus a crash on exit.

To Reproduce I believe it's triggered by the launching of some of the bonus amiga levels - which don't appear to feature any music - then hitting ESC to go back to the main menu. Do it enough times and it sometimes bombs the game or stops the music from playing. If I click on the about screen or the cannon fodder 1/2 campaigns I don't seem to trigger it.

Expected behavior You'd expect the main menu music to reset from the beginning when closing any of the campaigns/levels but you end up with silence. After it starts doing this you still don't get any music if you launch the cannon fodder 1 or 2 campaign.

Desktop (please complete the following information):

Additional context I compiled a debug version of the game by changing the makefile: CC = clang++ $(CXXFLAGS) -c -g -O0 -Wall -std=c++14 -ferror-limit=100 $(pathInc) $(Libs)

I've attached some logs with backtraces by using gdb OpenFodder:
openfodder1.log openfodder2.log openfodder_crash_on_exit.log

Hopefully those help. OpenFodder otherwise appears to be reliable and faithful to the original games. You can even shrink or increase the window size with the plus and minus keys - found that by accident!

andrew-mcmahon commented 5 years ago

It is a rather tricky one to trigger at will.

It could equally be caused by switching to the PC Format levels (the game then uses the DOS assets) and then switching back to the main menu to use the amiga files again. The music goes silent just after the minute mark and never comes back again: https://drive.google.com/file/d/1EDI1t18FVW7UwKSWR_4mHBcpWhGxKgul/view?usp=sharing

At the start of the video you'll notice that the main menu music doesn't reset when exiting from the about screen, cannon fodder campaign screens, etc - it just carries on playing the current track.

The random map feature seems to generate nonsense (2:20) but I assume that feature isn't finished yet. lovely maps!

Otherwise it's great to be able to switch between the DOS and Amiga assets with: ./OpenFodder --amiga or ./OpenFodder --pc

You can see a few subtle differences in the graphics/gameplay between them. I even like the easter egg on the main menu with the turret!

segrax commented 5 years ago

Otherwise it's great to be able to switch between the DOS and Amiga assets with: ./OpenFodder --amiga or ./OpenFodder --pc

You can see a few subtle differences in the graphics/gameplay between them. Even like the easter egg on the main menu with the turret!

You can do that -- those are valid CLI flags :) -- You can't however use PC assets on the Amiga demos

Can also press F1/F2 in most places to switch between Amiga/PC (F1 is Amiga, F2 PC) Theres a few CLI toggles and Hotkeys (see 'Command Line Parameters' in Readme.md)

The random map feature seems to generate nonsense (2:20) but I assume that feature isn't finished yet.

Are you compiling master? We changed the random map generator since the last official release, so it requires assets which aren't included in the last data pack release Try a recursive checkout of the data repo, as it includes the new script repository (https://github.com/OpenFodder/scripts) -- all random maps are generated by script now. https://github.com/OpenFodder/data example random map: https://twitter.com/Open_Fodder/status/1116290666311503872

I'll do some digging into the sound crash later, think i have seen this error before, most probably its because the sound playback routine is running in a separate thread, i'll assume the buffer is being freed before the thread terminates.

Thanks for the detailed report!

andrew-mcmahon commented 5 years ago

To be a completionist I've copied all the game data for DOS, Amiga and CD32 plus I made sure all the files matched your md5 hashes. OpenFodder uses Amiga by default; I first played the game on an Amiga 500+; Cartoon Classics so that's fine by me.

I am compiling the latest master but I've just been using: git clone https://github.com/OpenFodder/openfodder and adding the outdated v1.6 data pack. Oops!
Discard the issue with the random generation Rob - it's my fault - very impressive that it can generate an endless wave of feasible looking maps.
I'll switch to using: git clone --recursive https://github.com/OpenFodder/openfodder

Added another sound crash log. I just played a few campaign missions for the first and second game without issue, switched to the Amiga Power maps then back to the main menu. Instant crash. openfodder.log

I don't know if you noticed the strange graphical glitch on Alessandro map - just above the bunker 2:05 in the google drive video; it's the first time I've played any of these bonus maps!

Thanks again. p.s. I see lots of classic Lucasarts games in your twitter pics - you might want give the Fatboy soundfont a go with ScummVM or any SDL-based port that uses Fluidsynth; makes em sound great. e.g. export SDL_SOUNDFONTS=/usr/share/soundfonts/fatboy_v0786.sf2 usually makes it apply to all SDL-based games. Never got a Roland Sound Canvas :'(

segrax commented 5 years ago

I am compiling the latest master but I've just been using: git clone https://github.com/OpenFodder/openfodder and adding the outdated v1.6 data pack. Oops!

Thats fair, we where supposed to do a release earlier in the year, but life got in the way :) Think we may actually need a system for downloading/updating scripts at run-time, rather than simply relying on outdated packaged assets.

I don't know if you noticed the strange graphical glitch on Alessandro map - just above the bunker 2:05 in the google drive video; it's the first time I've played any of these bonus maps!

Yeah, that map was a quick hack to test the map editor years ago, its actually been removed from the repository now (it probably should never of been added, but felt we needed something)

p.s. I see lots of classic Lucasarts games in your twitter pics - you might want give the Fatboy soundfont a go with ScummVM or any SDL-based port that uses Fluidsynth; makes em sound great. e.g. export SDL_SOUNDFONTS=/usr/share/soundfonts/fatboy_v0786.sf2 usually makes it apply to all SDL-based games. Never got a Roland Sound Canvas :'(

Interesting, thanks! I'll give it a look tonight. I am somewhat of a Lucas adventure lover.. maybe too extreme in some cases :) https://github.com/segrax/Maniac.Mansion.Disassembly

drnovice commented 5 years ago

[...]

I don't know if you noticed the strange graphical glitch on Alessandro map - just above the bunker 2:05 in the google drive video; it's the first time I've played any of these bonus maps!

[...]

LOL yup! Alessandro just wanted to try some hot & spice elements on a test map, trying even some sprites never used in the game (and now we can see why, about some of them can create graphical errors).

andrew-mcmahon commented 5 years ago

LOL yup! Alessandro just wanted to try some hot & spice elements on a test map, trying even some sprites never used in the game (and now we can see why, about some of them can create graphical errors).

My first reaction was that I had a dud data file, then I wondered if the mesa-git drivers were on the blink. Nice to know it's known about, albeit unintentional =D

Ever tried these out Rob? Can run it through ScummVM on any platform unlike the Special Edition.
I've got the files backed up on my cheapo Buffalo NAS. I think this wins the award for my favourite bit of trickery so far... or perhaps nblood or stalker or openxcom; I'm spoilt for choice :P

segrax commented 5 years ago

Ever tried these out Rob? Can run it through ScummVM on any platform unlike the Special Edition.

Yeah, That is a great piece of work for MI, its something they should of done in the official special edition release!!

I think this wins the award for my favourite bit of trickery so far... or perhaps nblood or stalker or openxcom; I'm spoilt for choice :P

Haha yeah its good these days, lots of choices :) have played Devilution and OpenXcom, although im more of a D2 fan than D1 these days.. still play on BNet from time to time D2 Ubering

Ever play OpenDune or SDLPop

andrew-mcmahon commented 5 years ago

Is that a shameless plug for both of those Rob? <3 #1 #2

Prince of Persia! I'll have to try that remake. I think I did manage to beat Jaffar without cheating.
Similar games are Another World, Flashback and maybe Heart of Darkness.

I played Dune and Dune 2 back in the day as well as Dune 2000 more recently.
They felt a bit dated compared to the later games as you couldn't queue up units. Red Alert 1 & 2 are my favourites and I'm hoping OpenRA will support everything eventually. Plus I see ScummVM now supports Westwood's Blade Runner too.

Here's a good site worth bookmarking.

Truth be told there's little I've not played; I've probably been hopelessly addicted since the ZX Spectrum - used to take half an hour to load a tape and have it crash right near the end =X I bet you remember Navy Moves, Manic Miner or Saboteur? If I hadn't played them so much I might have learnt to program them like you! =D

I'm having a play around with FS-UAE and Amiga Forever atm. The French seem to be seeding just about every Amiga game ever released in IPF format.
I would've got a few free ones using X-COPY but I never had the whole catalogue! Couldn't get Cannon Fodder 2 to unpack with the SOS unpacker but I found a way - probably a duff copy: CannonFodder2_0104.zip

segrax commented 5 years ago

Couldn't get Cannon Fodder 2 to unpack with the SOS unpacker but I found a way

Did it give an error?

I bet you remember Navy Moves, Manic Miner or Saboteur?

Actually nah, we had a C64 when I was a kid, so never had exposure to the Spectrum, while I cant speak for all of Australia, but most people I knew had C64/Amiga/PC

Red Alert 1 & 2 are my favourites and I'm hoping OpenRA will support everything eventually.

have tried OpenRA, but prefer playing those games in the original engines, seen CNCNet? they've done some good work in keeping the originals working

There is actually an official remaster in the works, Remaster

andrew-mcmahon commented 5 years ago

Spectrum was a bit crap to be honest; that's what made the Amiga so damn good - apart from the 11 disks for Monkey Island 2.

C64/Amiga/PC

I went the Spectrum Tape -> Disk / Amiga 500+ / Windows 3.1 -> Windows 10 / Debian route I doubt I'll be going back to Windows. I tried Linux in the past but there were no GPU drivers; now that mesa drivers are solid for AMD cards plus there's DXVK, D9VK, Proton, Wine, etc.
If I didn't still have an old Phenom II x4 955 I'd try virtualising Windows and passing a GPU through for one or two that don't work like Arkham Knight.

Did it give an error?

Yes it did - it implies the disk images are duds; that doesn't put much confidence in the rest of the set that the French are sending out:

Skipping Track 159 (Invalid SOS6 Marker)
Skipping Track 160 (SYNC not found)

Cannon Fodder 2 UK 0104 (attached above)

68e07be0c13366981498271c0c177c1f  CannonFodder2_Disk1of3.ipf
844976ecfbee9b39cdca70c35cf0f906  CannonFodder2_Disk2of3.ipf
a8f30ec8498e900cf042126cfa6d5dd4  CannonFodder2_Disk3of3.ipf

I ended up using the HxC Floppy Emulator software with the SPS DLL's in Wine to extract the files off the disks and used another copy to repair a few mismatched files.

The first game extracts without issue and the CD32 version pretty much uses the same files as the first with one or two differences - same repair trick there.

Out of interest no issue with compiling OpenFodder or SOS Extractor with Clang 9; it's found it's way into Debian Testing.

segrax commented 5 years ago

Yes it did - it implies the disk images are duds; that doesn't put much confidence in the rest of the set that the French are sending out:

Skipping Track 159 (Invalid SOS6 Marker)
Skipping Track 160 (SYNC not found)

Those track skips are fairly normal, as the disk rips typically have more tracks than the game actually used. But now I think of it, Cannon Fodder 2 wasn't actually protected by the SOS disk protection, those disks are regular AmigaDos, so thats why it will have failed :)

You should be able to fire up UAE and copy files off those IPFs via regular Workbench

segrax commented 5 years ago

Do it enough times and it sometimes bombs the game or stops the music from playing.

Have just pushed a fix for this, seems the bug was caused by the audio detection mechanism (it tries not to delete/create the sound object unless it needs to on a version switch, the issue being on returning to the campaign menu, the current version is set to 0, which meant it couldnt check which audio object was being used)

andrew-mcmahon commented 5 years ago

That looks to have done the trick all right. I'll definitely be giving it a good test over the weekend.