[AD] PATCH: fix digmid with absolute pathnames in .cfg file

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi all,

I'm working on the Linux port of Worminator3 an allegro using game and had some trouble to get midi sound to work.

Under most Linux distributions there is a softwavesynth called timidity++ which comes with a set of gus-patches, I choose to use this as patchset.

This made install_sound (from memory, more general sound-init) happy, however no midi songs could be heard, after some debugging I found out that digmid cannot handle patches.cfg files with absolute paths, the attached patch fixes this.

Regards,

Hans

p.s. I'm not on the list please CC any comments.
--- allegro-4.2.0/src/digmid.c.digmid	2004-09-03 11:30:22.000000000 +0200
+++ allegro-4.2.0/src/digmid.c	2006-02-01 16:35:03.000000000 +0100
@@ -519,7 +519,7 @@
 {
    PACKFILE *f;
    char dir[1024], file[1024], buf[1024], filename[1024];
-   char todo[256][32];
+   char todo[256][64];
    char *argv[16], *p;
    char tmp[128];
    int argc;
@@ -679,8 +679,11 @@
       /* read from regular disk files */
       for (i=0; i<256; i++) {
 	 if (ugetc(todo[i])) {
-	    ustrzcpy(filename, sizeof(filename), dir);
-	    ustrzcat(filename, sizeof(filename), todo[i]);
+	    if (is_relative_filename(todo[i])) {
+	       ustrzcpy(filename, sizeof(filename), dir);
+	       ustrzcat(filename, sizeof(filename), todo[i]);
+            } else
+	       ustrzcpy(filename, sizeof(filename), todo[i]);
 
 	    if (ugetc(get_extension(filename)) == 0)
 	       ustrzcat(filename, sizeof(filename), uconvert_ascii(".pat", tmp));


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/