lukemcredmond / violetland

Automatically exported from code.google.com/p/violetland
0 stars 0 forks source link

Sound causes segfault #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build and install the game, if you run it, it will segfault:

Path to resources is set to:
    /home/demonslayer/var/games/violet/bin/../share/violetland/
Can't open config file.
violetland v0.2.2
SDL_Init...
SDL_GL_SetAttribute SDL_GL_DOUBLEBUFFER...
SDL_SetVideoMode 800x600 (w)...
glViewport...
SoundManager...
Mix_OpenAudio (freq 22050)...
    sound is enabled
Mix_Volume (master) 40...
MusicManager...
    found 0 tracks
Segmentation fault

2. gdb shows:

MusicManager...
    found 0 tracks

Program received signal SIGSEGV, Segmentation fault.
0x000000000042d593 in Sound::play ()

... so I comment out everything inside Sound::play() see below. Recompile,
then gdb shows:

MusicManager...
    found 0 tracks
InputHandler...
Loading weapons...
Constructing aim...

Program received signal SIGSEGV, Segmentation fault.
0x000000000042d504 in Sound::isPlaying ()

So I comment out everything in Sound::isPlaying() see below, and add return
0. Now after recompile the game works normally.

3. Problem is solved when I change Sound.cpp to:

bool Sound::isPlaying() {
    return 0;
    //return !(m_chan == -1 || Mix_Playing(m_chan) == 0) && m_enabled;
}

void Sound::play(int fade) {
    /*if (m_enabled) {
        if (isPlaying())
            stop(0);

        if (fade == 0)
            m_chan = Mix_PlayChannel(-1, m_sndRef, 0);
        else
            m_chan = Mix_FadeInChannel(-1, m_sndRef, 0, fade);
    }*/
}

What is the expected output? What do you see instead?
See above

What version of the product are you using? On what operating system?
0.2.2 on Linux x86_64

Please provide any additional information below.
version 0.2.0 works fine.

Original issue reported on code.google.com by draconis...@gmail.com on 9 Nov 2009 at 10:30

GoogleCodeExporter commented 9 years ago
It works for me (it says also that it found 3 tranks for music). There should 
be 3
tracks in violetland-v0.2.2/music, check it. If there are not, unzip the source
again (or download it again). If there are, try compiling again.

Original comment by adriyeti...@gmail.com on 9 Nov 2009 at 2:17

GoogleCodeExporter commented 9 years ago
I'm also getting                                                                

Path to resources is set to:                                                    

        /usr/bin/../share/violetland/   

So maybe it has something to do with the installation directories.

Original comment by adriyeti...@gmail.com on 9 Nov 2009 at 2:19

GoogleCodeExporter commented 9 years ago
draconishinobi, where the program resource files are placed?
Try to start game with -r <path_to_resources> key.

Anyway, I think that program should be started even if there is no music so 
user will
have an opportunity to not download music. But if path to resources is invalid 
the
game all the same won't start because it won't load pictures and so on.

Original comment by 5253...@gmail.com on 9 Nov 2009 at 4:53

GoogleCodeExporter commented 9 years ago
Ok, I'm sorry. If you see splash screen (which is appeared before MusicManager 
is
initialising) the path is set properly. You probably do not have music files 
for some
reason. I accept this issue. In other words, the game should start without 
music.

Original comment by 5253...@gmail.com on 9 Nov 2009 at 6:45

GoogleCodeExporter commented 9 years ago
I make some code changes, please, test it.

Original comment by 5253...@gmail.com on 9 Nov 2009 at 7:01

GoogleCodeExporter commented 9 years ago
Ok, the latest svn works, and sound effects work. However music does not.

Here's how I installed the game:

svn checkout http://violetland.googlecode.com/svn/trunk/ violetland-read-only
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/home/demonslayer/var/games/violet ..
make
make install

Then I run the game:
bash-3.1$ ./violetland 
Path to resources is set to:
    /home/demonslayer/var/games/violet/bin/../share/violetland/
violetland v0.2.3
SDL_Init...
SDL_GL_SetAttribute SDL_GL_DOUBLEBUFFER...
SDL_SetVideoMode 800x600 (w)...
glViewport...
SoundManager...
Mix_OpenAudio (freq 22050)...
    sound is enabled
Mix_Volume (master) 40...
MusicManager...
    found 0 tracks
InputHandler...
Loading weapons...
Constructing aim...

Still 9 tracks found. If I go to the install directory
(/home/demonslayer/var/games/violet) and run find I get:

.
./bin
./bin/violetland
./share
./share/violetland
./share/violetland/README_EN.TXT
./share/violetland/README_RU.TXT
./share/violetland/fonts
./share/violetland/fonts/harabara.ttf
./share/violetland/icon-dark.png
./share/violetland/icon-light.png
./share/violetland/images
./share/violetland/images/ak.png
./share/violetland/images/anima
./share/violetland/images/anima/bleed
./share/violetland/images/anima/bleed/bleed-0.png
./share/violetland/images/anima/bleed/bleed-1.png
./share/violetland/images/anima/bleed/bleed-10.png
./share/violetland/images/anima/bleed/bleed-11.png
./share/violetland/images/anima/bleed/bleed-12.png
./share/violetland/images/anima/bleed/bleed-2.png
./share/violetland/images/anima/bleed/bleed-3.png
./share/violetland/images/anima/bleed/bleed-4.png
./share/violetland/images/anima/bleed/bleed-5.png
./share/violetland/images/anima/bleed/bleed-6.png
./share/violetland/images/anima/bleed/bleed-7.png
./share/violetland/images/anima/bleed/bleed-8.png
./share/violetland/images/anima/bleed/bleed-9.png
./share/violetland/images/anima/monsters
./share/violetland/images/anima/monsters/0
./share/violetland/images/anima/monsters/0/move-0.png
./share/violetland/images/anima/monsters/0/move-1.png
./share/violetland/images/anima/monsters/0/move-10.png
./share/violetland/images/anima/monsters/0/move-11.png
./share/violetland/images/anima/monsters/0/move-12.png
./share/violetland/images/anima/monsters/0/move-13.png
./share/violetland/images/anima/monsters/0/move-14.png
./share/violetland/images/anima/monsters/0/move-15.png
./share/violetland/images/anima/monsters/0/move-16.png
./share/violetland/images/anima/monsters/0/move-17.png
./share/violetland/images/anima/monsters/0/move-18.png
./share/violetland/images/anima/monsters/0/move-19.png
./share/violetland/images/anima/monsters/0/move-2.png
./share/violetland/images/anima/monsters/0/move-20.png
./share/violetland/images/anima/monsters/0/move-21.png
./share/violetland/images/anima/monsters/0/move-22.png
./share/violetland/images/anima/monsters/0/move-23.png
./share/violetland/images/anima/monsters/0/move-24.png
./share/violetland/images/anima/monsters/0/move-3.png
./share/violetland/images/anima/monsters/0/move-4.png
./share/violetland/images/anima/monsters/0/move-5.png
./share/violetland/images/anima/monsters/0/move-6.png
./share/violetland/images/anima/monsters/0/move-7.png
./share/violetland/images/anima/monsters/0/move-8.png
./share/violetland/images/anima/monsters/0/move-9.png
./share/violetland/images/anima/monsters/1
./share/violetland/images/anima/monsters/1/move-0.png
./share/violetland/images/anima/monsters/1/move-1.png
./share/violetland/images/anima/monsters/1/move-10.png
./share/violetland/images/anima/monsters/1/move-11.png
./share/violetland/images/anima/monsters/1/move-12.png
./share/violetland/images/anima/monsters/1/move-13.png
./share/violetland/images/anima/monsters/1/move-14.png
./share/violetland/images/anima/monsters/1/move-15.png
./share/violetland/images/anima/monsters/1/move-16.png
./share/violetland/images/anima/monsters/1/move-17.png
./share/violetland/images/anima/monsters/1/move-18.png
./share/violetland/images/anima/monsters/1/move-19.png
./share/violetland/images/anima/monsters/1/move-2.png
./share/violetland/images/anima/monsters/1/move-20.png
./share/violetland/images/anima/monsters/1/move-21.png
./share/violetland/images/anima/monsters/1/move-22.png
./share/violetland/images/anima/monsters/1/move-23.png
./share/violetland/images/anima/monsters/1/move-24.png
./share/violetland/images/anima/monsters/1/move-3.png
./share/violetland/images/anima/monsters/1/move-4.png
./share/violetland/images/anima/monsters/1/move-5.png
./share/violetland/images/anima/monsters/1/move-6.png
./share/violetland/images/anima/monsters/1/move-7.png
./share/violetland/images/anima/monsters/1/move-8.png
./share/violetland/images/anima/monsters/1/move-9.png
./share/violetland/images/anima/player
./share/violetland/images/anima/player/legs-0.png
./share/violetland/images/anima/player/legs-1.png
./share/violetland/images/anima/player/legs-10.png
./share/violetland/images/anima/player/legs-11.png
./share/violetland/images/anima/player/legs-12.png
./share/violetland/images/anima/player/legs-13.png
./share/violetland/images/anima/player/legs-14.png
./share/violetland/images/anima/player/legs-15.png
./share/violetland/images/anima/player/legs-16.png
./share/violetland/images/anima/player/legs-17.png
./share/violetland/images/anima/player/legs-18.png
./share/violetland/images/anima/player/legs-19.png
./share/violetland/images/anima/player/legs-2.png
./share/violetland/images/anima/player/legs-20.png
./share/violetland/images/anima/player/legs-21.png
./share/violetland/images/anima/player/legs-22.png
./share/violetland/images/anima/player/legs-23.png
./share/violetland/images/anima/player/legs-24.png
./share/violetland/images/anima/player/legs-3.png
./share/violetland/images/anima/player/legs-4.png
./share/violetland/images/anima/player/legs-5.png
./share/violetland/images/anima/player/legs-6.png
./share/violetland/images/anima/player/legs-7.png
./share/violetland/images/anima/player/legs-8.png
./share/violetland/images/anima/player/legs-9.png
./share/violetland/images/blood_0.png
./share/violetland/images/blood_1.png
./share/violetland/images/blood_2.png
./share/violetland/images/laser.png
./share/violetland/images/medikit.png
./share/violetland/images/player_top.png
./share/violetland/images/pm.png
./share/violetland/images/remington.png
./share/violetland/images/splash_0.png
./share/violetland/images/splash_1.png
./share/violetland/images/terrain
./share/violetland/images/terrain/0
./share/violetland/images/terrain/0/0.png
./share/violetland/images/terrain/0/1.png
./share/violetland/images/terrain/1
./share/violetland/images/terrain/1/0.png
./share/violetland/images/terrain/1/1.png
./share/violetland/images/terrain/2
./share/violetland/images/terrain/2/0.png
./share/violetland/images/terrain/2/1.png
./share/violetland/images/terrain/2/2.png
./share/violetland/images/terrain/3
./share/violetland/images/terrain/3/0.png
./share/violetland/images/terrain/3/1.png
./share/violetland/images/terrain/base_0.png
./share/violetland/images/terrain/base_1.png
./share/violetland/images/terrain/base_2.png
./share/violetland/images/terrain/base_3.png
./share/violetland/images/uzi.png
./share/violetland/music
./share/violetland/music/dzaibatsu.ogg
./share/violetland/music/mitol-test.ogg
./share/violetland/music/morning.ogg
./share/violetland/music/space-crusader.ogg
./share/violetland/sounds
./share/violetland/sounds/ak-47_reload.ogg
./share/violetland/sounds/ak-47_shot.ogg
./share/violetland/sounds/laser_reload.ogg
./share/violetland/sounds/laser_shot.ogg
./share/violetland/sounds/player_hit_0.ogg
./share/violetland/sounds/player_hit_1.ogg
./share/violetland/sounds/player_hit_2.ogg
./share/violetland/sounds/player_killed.ogg
./share/violetland/sounds/pm_reload.ogg
./share/violetland/sounds/pm_shot.ogg
./share/violetland/sounds/remington_reload.ogg
./share/violetland/sounds/remington_shot.ogg
./share/violetland/sounds/uzi_reload.ogg
./share/violetland/sounds/uzi_shot.ogg
./share/violetland/sounds/zombie_hit_1.ogg
./share/violetland/sounds/zombie_hit_2.ogg
./share/violetland/weapons

Anyway so far the game runs fine without music even tho music seems to be there.
Thanks again for looking into the issue.

Original comment by draconis...@gmail.com on 10 Nov 2009 at 9:38

GoogleCodeExporter commented 9 years ago
oops, I mean 0 tracks found not 9.

Original comment by draconis...@gmail.com on 10 Nov 2009 at 9:39

GoogleCodeExporter commented 9 years ago
Check out new revision from svn, run it and post the output.

Original comment by 5253...@gmail.com on 10 Nov 2009 at 10:20

GoogleCodeExporter commented 9 years ago
Updated to revision 77.

But, same result, no music. Everything else works, still.

Original comment by draconis...@gmail.com on 10 Nov 2009 at 12:57

GoogleCodeExporter commented 9 years ago
Path to resources is set to:
    /home/demonslayer/var/games/violet/bin/../share/violetland/
violetland v0.2.3
Assuming LINUX environment...
SDL_Init...
SDL_GL_SetAttribute SDL_GL_DOUBLEBUFFER...
SDL_SetVideoMode 800x600 (w)...
glViewport...
SoundManager...
Mix_OpenAudio (freq 22050)...
    sound is enabled
Mix_Volume (master) 40...
MusicManager...
    loaded 0 tracks
InputHandler...
Loading weapons...
Constructing aim...

Original comment by draconis...@gmail.com on 10 Nov 2009 at 12:58

GoogleCodeExporter commented 9 years ago
Do you have any song in        
/home/demonslayer/var/games/violet/bin/../share/violetland/?

Original comment by adriyeti...@gmail.com on 10 Nov 2009 at 6:47

GoogleCodeExporter commented 9 years ago
He has songs, see comment 6. The log at comment 10 show to us that a function
getFilesFromDir() inside FileUtility.cpp can't find existing files. It's very 
strange.

Draconishinobi, post, please, the advanced files listing from music directory 
(with
permissions, owners and others).

Original comment by 5253...@gmail.com on 11 Nov 2009 at 7:00

GoogleCodeExporter commented 9 years ago
$ ls -pila (for example)

Original comment by adriyeti...@gmail.com on 11 Nov 2009 at 8:05

GoogleCodeExporter commented 9 years ago
Ok here it is:

bash-3.1$ pwd
/home/demonslayer/var/games/violet/share/violetland/music
bash-3.1$ ls -pila
total 4296
491968 drwxr-xr-x 2 demonslayer users      32 2009-11-10 14:55 ./
491551 drwxr-xr-x 6 demonslayer users      72 2009-11-10 14:55 ../
491969 -rw-r--r-- 1 demonslayer users 1286405 2009-11-10 11:31 dzaibatsu.ogg
491972 -rw-r--r-- 1 demonslayer users  358224 2009-11-10 11:31 mitol-test.ogg
491970 -rw-r--r-- 1 demonslayer users 1745968 2009-11-10 11:31 morning.ogg
491971 -rw-r--r-- 1 demonslayer users  992528 2009-11-10 11:31 
space-crusader.ogg

The music files seem to be there, and I can play them with mplayer, but it 
doesn't
look like the game finds them. Maybe the prefix option doesn't work right ?

Original comment by draconis...@gmail.com on 12 Nov 2009 at 9:49

GoogleCodeExporter commented 9 years ago
Seems that all are well. I can't reproduce the problem.
The game works so we have some half-solution.

Original comment by 5253...@gmail.com on 12 Nov 2009 at 7:16