GP2X .mod File Being Loaded In Windows But Not On Gp2x


motorollin

Member
Joined
Jul 31, 2007
Messages
163
My game's music (a .MOD file) plays back when I run my game in Windows but not on the GP2X. I added some code to test whether the file was being loaded:

CODE
Mix_Music *gamemusic = NULL;
gamemusic = Mix_LoadMUS( "snd/game.mod" );

if ( !gamemusic )
{
quit=true;
loop=false;
status=1000;
}


Under Windows, the game *doesn't* quit, so the file was successfully loaded. On the GP2X it *does* quit, which means it can't load the file. The file snd/game.mod does exist on the SD card. Any ideas what I need to do to get this to work?
 
Check the song's file path, even if you think you've got it right.

See if it really quits because it couldn't load the file, or because of a different reason altogether that happens a couple of lines down.

Good luck, sound on the GP2X is a bitch...
 
Alex. said:
Check the song's file path, even if you think you've got it right.

It's definitely right - just double checked. And it's in the same place relative to the executable on Windows and on the GP2X.

Alex. said:
See if it really quits because it couldn't load the file, or because of a different reason altogether that happens a couple of lines down.

Ok I commented out the test line (if(!gamemusic)...) and recompiled for the GP2X, and it didn't quit. So it's definitely the file loading which is the problem.

Alex. said:
Good luck, sound on the GP2X is a bitch...

I'm starting to realise that!
 
Last edited by a moderator:
check the music driver or print out the driver name before loading.

iirc there was issues with having the wrong driver... if you search the forums you'll find a few of those topics.
 
YakumoFuji said:
check the music driver or print out the driver name before loading.

iirc there was issues with having the wrong driver... if you search the forums you'll find a few of those topics.
exactly, the driver should be OSS AFAIK on the gp2x.
 
Last edited by a moderator:
synkro said:
YakumoFuji said:
check the music driver or print out the driver name before loading.

iirc there was issues with having the wrong driver... if you search the forums you'll find a few of those topics.
exactly, the driver should be OSS AFAIK on the gp2x.

Would I be correct in thinking that SDL_AudioDriverName() is the function I need to use to find this? I tried this:

CODE

char * drv;
SDL_AudioDriverName( drv, 1024 );



but it made the game quit under Windows (haven't tried on the GP2X yet). I was expecting it to fill drv with the driver name which I could then fprintf() to stdout.

This works:

CODE
char dn[16];
SDL_AudioDriverName( dn, 12 );
fprintf( stdout, dn );


Just about to try on the GP2X...

Where does stdout go on the GP2X? In Dev-C++ it creates a file called stdout.txt. The GP2X doesn't do this so I can't see the result of the check.
 
Last edited by a moderator:
Ok I set up SDL_ttf and got the driver name rendered to the title screen of the game. Under Windows (where it works) it uses dsound - I assume this is MS DirectSound. On the GP2X it is currently using dsp. I tried SDL_AudioInit("oss") and SDL_AudioInit("OSS") but it still doesn't work on the GP2X, so I guess that driver name is incorrect. What would be the correct name for the OSS driver on the GP2X?
 
woogal said:
It's failing on load so nothing to do with the playback driver. How are you running the executable, from the menu or from telnet?
I'm running from Gmenu2x. Also tried from the standard GP2X menu but the same thing happened.
 
Last edited by a moderator:
Are you sure the filename is the same? If your loading "game.mod" and it's called "Game.mod" on the sd card, it'll fail to load on the gp2x, but not on windows.
 
The filenames and directory names are all in lower case, and are written that way in the code. Also, OGG music plays back fine on the GP2X.
 
I'm wondering whether the Windows version of SDL_Mixer supports MOD playback whereas the GP2X version doesn't. Can anyone confirm whether the version of the GP2X SDL_Mixer library which comes with the Dev-C++ GP2X SDK definitely supports MOD playback? Alternatively is there a pre-built package with the latest versions which I can install in to Dev-C++?
 
To make this easier I've knocked together a quick and dirty mod player:

CODE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <SDL.h>
#include <SDL_mixer.h>

int main (int argc, char *argv[])
{
int done=0;

SDL_Surface *screen = NULL;
SDL_Init (SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
screen = SDL_SetVideoMode (320, 240, 16, SDL_SWSURFACE);

Mix_Music *music = NULL;
Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 512 );
music = Mix_LoadMUS( "game.mod" );
if ( !music ){done=1;}
Mix_PlayMusic( music, -1 );

while (!done)
{
//
}
chdir("/usr/gp2x");
execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
}


That's the whole code, and exactly the same thing happens: Under Windows the mod plays (and the app never quits), but on the GP2X the app just quits straight back to the menu.

Would somebody mind compiling this and testing with a mod to see what happens? Preferably somebody with Dev-C++ and a more recent build of SDL_Mixer.

Thanks as always for the help!
 
Try:
CODE
music = Mix_LoadMUS( "./game.mod" );

Shouldn't matter but worth a try.
 
@sam_fisher
Not really. It still doesn't explain why the file won't even load on the GP2X. All it proves is that the problem is not being caused by Dev-C++, but is something common to both Dev-C++ and Open2x. I'm thinking it must be something to do with the GP2X version of the SDL_Mixer libraries.

@yaustar
Just tried it and the same thing happened.


I'm still hoping somebody can point me towards an alternative GP2X build of SDL_Mixer.
 
A bit of progress. I printed Mix_GetError() to the screen just after the file load is attempted, and ran the game on the GP2X. The error returned by SDL_Mixer is "Unrecognized music format". On Windows no error is printed to the screen.
 
Well then, I guess, you got some odd mod? did you try other mod files?
I`m pretty sure mod is supported by sdl on the gp2x (Fenix does and that is based on sdl)
 
Back
Top