Minor filename reading cleanup

This commit is contained in:
bnnm 2018-03-25 20:01:28 +02:00
parent 69da9d5f4d
commit 382ce74821

View File

@ -14,29 +14,20 @@ VGMSTREAM * init_vgmstream_ngc_ulw(STREAMFILE *streamFile) {
/* raw data, the info is in the filename (really!) */
{
char* path;
char basename[PATH_LIMIT];
char filename[PATH_LIMIT];
char filename[PATH_LIMIT] = {0};
/* get base name */
streamFile->get_name(streamFile,filename,sizeof(filename));
path = strrchr(filename,DIR_SEPARATOR);
if (path!=NULL)
path = path+1;
else
path = filename;
strcpy(basename,path);
get_streamfile_filename(streamFile, filename,PATH_LIMIT);
/* first letter gives the channels */
if (basename[0]=='M') /* Mono */
if (filename[0]=='M') /* Mono */
channel_count = 1;
else if (basename[0]=='S' || basename[0]=='D') /* Stereo/Dolby */
else if (filename[0]=='S' || filename[0]=='D') /* Stereo/Dolby */
channel_count = 2;
else
goto fail;
/* not very robust but meh (other tracks don't loop) */
if (strcmp(basename,"MMenu.ulw")==0 || strcmp(basename,"DMenu.ulw")==0) {
if (strcmp(filename,"MMenu.ulw")==0 || strcmp(filename,"DMenu.ulw")==0) {
loop_flag = 1;
}
}