# HG changeset patch # User Matti Hamalainen # Date 1425567618 -7200 # Node ID 0d173edbabe2a2779939e04ce67e9a1ef0c1a450 # Parent 2b48b7fe95bc017fcc44ea39e6ea2abc63ba2dbc Do the file probing stuff here as well. diff -r 2b48b7fe95bc -r 0d173edbabe2 tests/plrtest.c --- 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)