Mercurial > hg > dmlib
changeset 1204:0d173edbabe2
Do the file probing stuff here as well.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 05 Mar 2015 17:00:18 +0200 |
parents | 2b48b7fe95bc |
children | 76c5bde4b943 |
files | tests/plrtest.c |
diffstat | 1 files changed, 19 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/plrtest.c Thu Mar 05 16:57:27 2015 +0200 +++ b/tests/plrtest.c Thu Mar 05 17:00:18 2015 +0200 @@ -138,32 +138,39 @@ // Read module file - fprintf(stderr, "Reading file: %s\n", inFilename); + dmMsg(1, "Reading file: %s\n", inFilename); #ifdef JSS_SUP_XM - fprintf(stderr, "* Trying XM...\n"); result = jssLoadXM(file, &mod, TRUE); +#endif #ifdef JSS_SUP_JSSMOD - if (result != 0) + dmfreset(file); + if (result != DMERR_OK) { - dmfseek(file, 0L, SEEK_SET); dmMsg(1, "* Trying JSSMOD ...\n"); result = jssLoadJSSMOD(file, &mod, TRUE); + dmfreset(file); + if (result == DMERR_OK) + result = jssLoadJSSMOD(file, &mod, FALSE); } -#endif -#else -#ifdef JSS_SUP_JSSMOD - dmMsg(1, "* Trying JSSMOD ...\n"); - result = jssLoadJSSMOD(file, &mod, TRUE); -#endif + else + { + dmMsg(2, "* Trying XM...\n"); + result = jssLoadXM(file, &mod, FALSE); + } #endif dmf_close(file); + // Check for errors, we still might have some data tho if (result != DMERR_OK) { - fprintf(stderr, "Error loading module file, %d: %s\n", + 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)