Mercurial > hg > dmlib
diff tools/mod2wav.c @ 1199:a79edf59d5d8
Improve use of probing in dumpmod, mod2wav and ppl.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 05 Mar 2015 16:22:11 +0200 |
parents | 985225a93aeb |
children | 5b8245e5f785 |
line wrap: on
line diff
--- a/tools/mod2wav.c Thu Mar 05 16:14:40 2015 +0200 +++ b/tools/mod2wav.c Thu Mar 05 16:22:11 2015 +0200 @@ -161,26 +161,38 @@ } // Read module file - fprintf(stderr, "Reading file: %s\n", optInFilename); + dmMsg(1, "Reading file: %s\n", optInFilename); #ifdef JSS_SUP_XM - fprintf(stderr, "* Trying XM...\n"); result = jssLoadXM(inFile, &mod, TRUE); #endif #ifdef JSS_SUP_JSSMOD - if (result != 0) + dmfreset(inFile); + if (result != DMERR_OK) { - dmfseek(inFile, 0L, SEEK_SET); dmMsg(1, "* Trying JSSMOD ...\n"); result = jssLoadJSSMOD(inFile, &mod, TRUE); + dmfreset(inFile); + if (result == DMERR_OK) + result = jssLoadJSSMOD(inFile, &mod, FALSE); + } + else + { + dmMsg(2, "* Trying XM...\n"); + result = jssLoadXM(inFile, &mod, FALSE); } #endif dmf_close(inFile); + + // Check for errors, we still might have some data tho if (result != DMERR_OK) { dmErrorMsg("Error loading module file, %d: %s\n", result, dmErrorStr(result)); + } + + // Check if we have anything + if (mod == NULL) return 3; - } // Try to convert it if ((result = jssConvertModuleForPlaying(mod)) != DMERR_OK)