Index: apps/plugins/midi/synth.c =================================================================== --- apps/plugins/midi/synth.c (revision 20001) +++ apps/plugins/midi/synth.c (working copy) @@ -22,25 +22,34 @@ #include "guspat.h" #include "midiutil.h" #include "synth.h" - + void readTextBlock(int file, char * buf) { char c = 0; do { c = readChar(file); - } while(c == '\n' || c == ' ' || c=='\t'); - - rb->lseek(file, -1, SEEK_CUR); + if (c == '#') + { + do + { + c = readChar(file); + } while(c != '\n'); + } + } while(c == '\n' || c == '\r' || c == ' ' || c == '\t'); + + if (c != '\n') + rb->lseek(file, -1, SEEK_CUR); int cp = 0; do { c = readChar(file); buf[cp] = c; cp++; - } while (c != '\n' && c != ' ' && c != '\t' && !eof(file)); + } while (c != '\n' && c != '\r' && c != ' ' && c != '\t' && !eof(file) && c != '#'); buf[cp-1]=0; - rb->lseek(file, -1, SEEK_CUR); + if (c != '\n') + rb->lseek(file, -1, SEEK_CUR); } void resetControllers() @@ -138,8 +147,8 @@ return -1; } - char name[40]; - char fn[40]; + char name[MAX_PATH]; + char fn[MAX_PATH]; /* Scan our config file and load the right patches as needed */ int c = 0; @@ -150,7 +159,7 @@ while(readChar(file)!=' ' && !eof(file)); readTextBlock(file, name); - rb->snprintf(fn, 40, ROCKBOX_DIR "/patchset/%s.pat", name); + rb->snprintf(fn, MAX_PATH, ROCKBOX_DIR "/patchset/%s.pat", name); /* printf("\nLOADING: <%s> ", fn); */ if(patchUsed[a]==1) @@ -181,7 +190,8 @@ { readTextBlock(file, number); readTextBlock(file, name); - rb->snprintf(fn, 40, ROCKBOX_DIR "/patchset/%s.pat", name); + rb->snprintf(fn, MAX_PATH, ROCKBOX_DIR "/patchset/%s.pat", name); +/* printf("\nLOADING: <%s> ", name); */ idx = rb->atoi(number); if(idx == 0)