diff tools/ppl.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 848a88ce7a57
children e8c99da451cd
line wrap: on
line diff
--- a/tools/ppl.c	Thu Mar 05 16:14:40 2015 +0200
+++ b/tools/ppl.c	Thu Mar 05 16:22:11 2015 +0200
@@ -588,15 +588,22 @@
     // Read module file
     dmMsg(1, "Reading file: %s\n", optFilename);
 #ifdef JSS_SUP_XM
-    dmMsg(2, "* Trying XM...\n");
     result = jssLoadXM(file, &engine.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, &engine.mod, TRUE);
+        dmfreset(file);
+        if (result == DMERR_OK)
+            result = jssLoadJSSMOD(file, &engine.mod, FALSE);
+    }
+    else
+    {
+        dmMsg(2, "* Trying XM...\n");
+        result = jssLoadXM(file, &engine.mod, FALSE);
     }
 #endif
     dmf_close(file);