Skip to content

Commit

Permalink
libmodplug: import PRs 52, 53, 54 and 55 from mainstream at github:
Browse files Browse the repository at this point in the history
- Fix volume event handling for .FAR modules.
- Fix incorrect loading of Oktalyzer order list.
- Add check for CD61 magic to MOD loader.
- Fix tempo for 669 modules.
  • Loading branch information
sezero committed Jan 14, 2021
1 parent c4b74e4 commit 13d7ec1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/libmodplug/load_669.c
Expand Up @@ -69,7 +69,7 @@ BOOL CSoundFile_Read669(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
_this->m_dwSongFlags |= SONG_LINEARSLIDES;
_this->m_nMinPeriod = 28 << 2;
_this->m_nMaxPeriod = 1712 << 3;
_this->m_nDefaultTempo = 125;
_this->m_nDefaultTempo = 78;
_this->m_nDefaultSpeed = 6;
_this->m_nChannels = 8;
_this->m_nSamples = pfh->samples;
Expand Down Expand Up @@ -146,7 +146,7 @@ BOOL CSoundFile_Read669(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
case 0x02: command = CMD_TONEPORTAMENTO; break;
case 0x03: command = CMD_MODCMDEX; param |= 0x50; break;
case 0x04: command = CMD_VIBRATO; param |= 0x40; break;
case 0x05: if (param) command = CMD_SPEED; else command = 0; param += 2; break;
case 0x05: if (param) command = CMD_SPEED; else command = 0; break;
case 0x06: if (param == 0) { command = CMD_PANNINGSLIDE; param = 0xFE; }
else if (param == 1) { command = CMD_PANNINGSLIDE; param = 0xEF; }
else command = 0;
Expand All @@ -166,7 +166,7 @@ BOOL CSoundFile_Read669(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
for (UINT i=0; i<8; i++) if (!mspeed[i].command)
{
mspeed[i].command = CMD_SPEED;
mspeed[i].param = pfh->tempolist[npat] + 2;
mspeed[i].param = pfh->tempolist[npat];
break;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/libmodplug/load_far.c
Expand Up @@ -140,11 +140,10 @@ BOOL CSoundFile_ReadFAR(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
m->instr = ins + 1;
m->note = note + 36;
}
if (vol & 0x0F)
if (vol >= 0x01 && vol <= 0x10)
{
m->volcmd = VOLCMD_VOLUME;
m->vol = (vol & 0x0F) << 2;
if (m->vol <= 4) m->vol = 0;
m->vol = (vol - 1) << 2;
}
switch(eff & 0xF0)
{
Expand Down
1 change: 1 addition & 0 deletions src/libmodplug/load_mod.c
Expand Up @@ -115,6 +115,7 @@ BOOL CSoundFile_ReadMod(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
if ((IsMagic(s, "M.K.")) || (IsMagic(s, "M!K!"))
|| (IsMagic(s, "M&K!")) || (IsMagic(s, "N.T."))) _this->m_nChannels = 4; else
if ((IsMagic(s, "CD81")) || (IsMagic(s, "OKTA"))) _this->m_nChannels = 8; else
if (IsMagic(s, "CD61")) _this->m_nChannels = 6; else
if ((s[0]=='F') && (s[1]=='L') && (s[2]=='T') && (s[3]>='4') && (s[3]<='9')) _this->m_nChannels = s[3] - '0'; else
if ((s[0]>='2') && (s[0]<='9') && (s[1]=='C') && (s[2]=='H') && (s[3]=='N')) _this->m_nChannels = s[0] - '0'; else
if ((s[0]=='1') && (s[1]>='0') && (s[1]<='9') && (s[2]=='C') && (s[3]=='H')) _this->m_nChannels = s[1] - '0' + 10; else
Expand Down
2 changes: 1 addition & 1 deletion src/libmodplug/load_okt.c
Expand Up @@ -100,7 +100,7 @@ BOOL CSoundFile_ReadOKT(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
{
UINT orderlen = norders;
if (orderlen >= MAX_ORDERS) orderlen = MAX_ORDERS-1;
for (UINT i=0; i<orderlen; i++) _this->Order[i] = lpStream[dwMemPos+10+i];
for (UINT i=0; i<orderlen; i++) _this->Order[i] = lpStream[dwMemPos+8+i];
for (UINT j=orderlen; j>1; j--) { if (_this->Order[j-1]) break; _this->Order[j-1] = 0xFF; }
dwMemPos += bswapBE32(*((DWORD *)(lpStream + dwMemPos + 4))) + 8;
}
Expand Down

0 comments on commit 13d7ec1

Please sign in to comment.