Mercurial > hg > dmlib
comparison jloadxm.c @ 98:82b825bb08b0
Fix XM loading. Oops.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Oct 2012 20:25:04 +0300 |
parents | aa9fbdbcea70 |
children | a65f0c3deaa7 |
comparison
equal
deleted
inserted
replaced
97:2884a611042b | 98:82b825bb08b0 |
---|---|
353 | 353 |
354 // Skip the extra data after header #2 | 354 // Skip the extra data after header #2 |
355 remainder = xmI1.headSize - (dmftell(inFile) - pos); | 355 remainder = xmI1.headSize - (dmftell(inFile) - pos); |
356 if (remainder > 0) | 356 if (remainder > 0) |
357 { | 357 { |
358 JSSDEBUG("Skipping: %li\n", remainder); | 358 JSSDEBUG("xmI1#1 Skipping: %li\n", remainder); |
359 dmfseek(inFile, remainder, SEEK_CUR); | 359 dmfseek(inFile, remainder, SEEK_CUR); |
360 } | 360 } |
361 | 361 |
362 // Check and convert all ext instrument information | 362 // Check and convert all ext instrument information |
363 #ifndef JSS_LIGHT | 363 #ifndef JSS_LIGHT |
579 { | 579 { |
580 // We may STILL need to skip extra data after 1st instr. header | 580 // We may STILL need to skip extra data after 1st instr. header |
581 remainder = xmI1.headSize - (dmftell(inFile) - pos); | 581 remainder = xmI1.headSize - (dmftell(inFile) - pos); |
582 if (remainder > 0) | 582 if (remainder > 0) |
583 { | 583 { |
584 JSSDEBUG("Skipping: %li\n", remainder); | 584 JSSDEBUG("xmI1#2 Skipping: %li\n", remainder); |
585 dmfseek(inFile, remainder, SEEK_CUR); | 585 dmfseek(inFile, remainder, SEEK_CUR); |
586 } | 586 } |
587 } | 587 } |
588 | 588 |
589 return 0; | 589 return 0; |
724 { | 724 { |
725 off_t pos, remainder; | 725 off_t pos, remainder; |
726 XMPattern xmP; | 726 XMPattern xmP; |
727 | 727 |
728 // Get the pattern header | 728 // Get the pattern header |
729 pos = dmftell(inFile); | |
729 dmf_read_le32(inFile, &xmP.headSize); | 730 dmf_read_le32(inFile, &xmP.headSize); |
730 xmP.packing = dmfgetc(inFile); | 731 xmP.packing = dmfgetc(inFile); |
731 dmf_read_le16(inFile, &xmP.nrows); | 732 dmf_read_le16(inFile, &xmP.nrows); |
732 dmf_read_le16(inFile, &xmP.size); | 733 dmf_read_le16(inFile, &xmP.size); |
733 pos = dmftell(inFile); | |
734 | 734 |
735 // Check the header | 735 // Check the header |
736 if (xmP.packing != 0) | 736 if (xmP.packing != 0) |
737 JSSERROR(DMERR_INVALID_DATA, DMERR_INVALID_DATA, | 737 JSSERROR(DMERR_INVALID_DATA, DMERR_INVALID_DATA, |
738 "Pattern #%i packing type unsupported (%i)\n", | 738 "Pattern #%i packing type unsupported (%i)\n", |
758 | 758 |
759 // Skip extra data (if the file is damaged) | 759 // Skip extra data (if the file is damaged) |
760 remainder = xmP.headSize - (dmftell(inFile) - pos); | 760 remainder = xmP.headSize - (dmftell(inFile) - pos); |
761 if (remainder > 0) | 761 if (remainder > 0) |
762 { | 762 { |
763 JSSDEBUG("Skipping: %li\n", remainder); | 763 JSSDEBUG("xmP Skipping: %li\n", remainder); |
764 dmfseek(inFile, remainder, SEEK_CUR); | 764 dmfseek(inFile, remainder, SEEK_CUR); |
765 } | 765 } |
766 } | 766 } |
767 | 767 |
768 // Allocate the empty pattern | 768 // Allocate the empty pattern |