diff --git a/code/audio.cpp b/code/audio.cpp index 3119e70..a6c5b7d 100644 --- a/code/audio.cpp +++ b/code/audio.cpp @@ -81,7 +81,8 @@ void loadMusic(const char *filename) Mix_FreeMusic(engine.music); #if USEPACK - unpack(filename, PAK_MOD); + if(!unpack(filename, PAK_MOD)) + return; char musicFilename[PATH_MAX]; strcpy(musicFilename, ""); diff --git a/code/unpack.cpp b/code/unpack.cpp index acc7f6c..78a54c1 100644 --- a/code/unpack.cpp +++ b/code/unpack.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Searches the pak file for the required data. When it is found, the data is read into a character buffer. */ -void unpack(const char *file, signed char fileType) +bool unpack(const char *file, signed char fileType) { unsigned char *packBuffer; char packFilename[60]; @@ -49,6 +49,10 @@ void unpack(const char *file, signed char fileType) if (!fread(packFilename, 1, 56, pak)) { fclose(pak); + + if (fileType == PAK_MOD || fileType == PAK_S3M) + return false; + if (fileType != PAK_FONT) { showErrorAndExit(0, file); @@ -97,6 +101,7 @@ void unpack(const char *file, signed char fileType) engine.sdlrw = SDL_RWFromMem(packBuffer, packFSize); fclose(pak); + return true; } /* diff --git a/code/unpack.h b/code/unpack.h index fe3ba50..ae8d01b 100644 --- a/code/unpack.h +++ b/code/unpack.h @@ -18,5 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -extern void unpack(const char *file, signed char fileType); +extern bool unpack(const char *file, signed char fileType); extern int locateDataInPak(const char *file, bool required);