diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-10-05 20:46:10 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-10-05 20:46:10 +0200 |
commit | e742981dee8cf4fb27da74f10f492b26aebfd12b (patch) | |
tree | 18467d3bf84b9b25f7ab8b3db467cbc93c0f2056 /plugins/adplug | |
parent | 8045bd869397a2303d4e14fef21448acc0a8f2c2 (diff) |
merger DRO support from adplug-2.2.1
Diffstat (limited to 'plugins/adplug')
-rw-r--r-- | plugins/adplug/adplug/dro.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/adplug/adplug/dro.cpp b/plugins/adplug/adplug/dro.cpp index 1d7d5f8e..fdf08e42 100644 --- a/plugins/adplug/adplug/dro.cpp +++ b/plugins/adplug/adplug/dro.cpp @@ -59,9 +59,20 @@ bool CdroPlayer::load(const char *filename, const CFileProvider &fp) // load section mstotal = f->readInt(4); // Total milliseconds in file length = f->readInt(4); // Total data bytes in file - f->ignore(4); // Type of opl data this can contain - ignored data = new unsigned char [length]; - for (i=0;i<length;i++) + + f->ignore(1); // Type of opl data this can contain - ignored + for (i=0;i<3;i++) + data[i]=f->readInt(1); + + if ((data[0] == 0) || (data[1] == 0) || (data[2] == 0)) { + // Some early .DRO files only used one byte for the hardware type, then + // later changed to four bytes with no version number change. If we're + // here then this is a later (more popular) file with the full four bytes + // for the hardware-type. + i = 0; // so ignore the three bytes we just read and start again + } + for (;i<length;i++) data[i]=f->readInt(1); fp.close(f); rewind(0); |