From fd00b1a8154b9724b89fb0121b5348c3cf62c06c Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 20 Feb 2022 22:16:43 -0500 Subject: [PATCH] allow loading 1.0 .dmw --- src/engine/engine.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 438a965cc..3069f9193 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -1632,7 +1632,15 @@ bool DivEngine::addWaveFromFile(const char* path) { reader.seek(0,SEEK_SET); int len=reader.readI(); wave->max=(unsigned char)reader.readC(); - if (reader.size()==(size_t)(len+5)) { + if (wave->max==255) { // new wavetable format + unsigned char waveVersion=reader.readC(); + logI("reading modern .dmw...\n"); + logD("wave version %d\n",waveVersion); + wave->max=reader.readC(); + for (int i=0; idata[i]=reader.readI(); + } + } else if (reader.size()==(size_t)(len+5)) { // read as .dmw logI("reading .dmw...\n"); if (len>256) len=256;