# HG changeset patch # User Matti Hamalainen # Date 1425544168 -7200 # Node ID 08c93ebb85b9d03245fddb6c80bbb37ca44b98f7 # Parent e7a95193737456e669d81d7395437b4ae07081f7 Some preliminary code for 0x0102 format pattern support. diff -r e7a951937374 -r 08c93ebb85b9 minijss/jloadxm.c --- a/minijss/jloadxm.c Thu Mar 05 10:28:48 2015 +0200 +++ b/minijss/jloadxm.c Thu Mar 05 10:29:28 2015 +0200 @@ -130,7 +130,7 @@ /* Unpack a XM pattern structure from resource to given JSS pattern */ -static int jssXMUnpackPattern(DMResource *inFile, int size, JSSPattern *pattern) +static int jssXMUnpackPattern104(DMResource *inFile, int size, JSSPattern *pattern) { JSSNote *pnote; int row, channel; @@ -218,6 +218,23 @@ } +static int jssXMUnpackPattern102(DMResource *inFile, int size, JSSPattern *pattern) +{ + } + + // Check the state + if (size > 0) + { + // Some data left unparsed + JSSWARNING(DMERR_EXTRA_DATA, DMERR_EXTRA_DATA, + "Unparsed data after pattern (%d bytes), possibly broken file.\n", + size); + } + + return DMERR_OK; +} + + /* Convert XM envelope structure to JSS envelope structure */ static int jssXMConvertEnvelope( @@ -695,7 +712,16 @@ JSSERROR(DMERR_MALLOC, DMERR_MALLOC, "Could not allocate memory for pattern #%d\n", index); - result = jssXMUnpackPattern(inFile, xmP.size, module->patterns[index]); + switch (module->intVersion) + { + case 0x0104: + result = jssXMUnpackPattern104(inFile, xmP.size, module->patterns[index]); + break; + case 0x0102: + result = jssXMUnpackPattern102(inFile, xmP.size, module->patterns[index]); + break; + } + if (result != 0) JSSERROR(result, result, "Error in unpacking pattern #%d data\n", index); }