From: <sag...@us...> - 2009-08-24 11:44:05
|
Revision: 340 http://modplug.svn.sourceforge.net/modplug/?rev=340&view=rev Author: saga-games Date: 2009-08-24 11:43:54 +0000 (Mon, 24 Aug 2009) Log Message: ----------- [Fix] IT Loader: Unset release env nodes for IT files made with IT 1.x, fix fadeout values [Imp] PSM Loader: Several fixes for "new new" PSM format, channel panning, etc. [Imp] S3M Loader: Don't write unnecessary invalid order items in the order table [Imp] LHA Decoder: Several fixes (patch by kode54) Modified Paths: -------------- trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_psm.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/unlha/EXTRACT.CPP trunk/OpenMPT/unlha/HUF.CPP trunk/OpenMPT/unlha/LHEXT.CPP trunk/OpenMPT/unlha/SLIDE.CPP trunk/OpenMPT/unlha/SLIDEHUF.H trunk/OpenMPT/unlha/UNLHA32.H trunk/OpenMPT/unlha/Unlha.cpp Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2009-08-23 21:07:17 UTC (rev 339) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2009-08-24 11:43:54 UTC (rev 340) @@ -230,7 +230,7 @@ const ITOLDINSTRUMENT *pis = (const ITOLDINSTRUMENT *)p; memcpy(pIns->name, pis->name, 26); memcpy(pIns->filename, pis->filename, 12); - pIns->nFadeOut = pis->fadeout << 6; + pIns->nFadeOut = pis->fadeout << 7; pIns->nGlobalVol = 64; for (UINT j=0; j<NOTE_MAX; j++) { @@ -260,6 +260,10 @@ pIns->nNNA = pis->nna; pIns->nDCT = pis->dnc; pIns->nPan = 0x80; + + pIns->VolEnv.nReleaseNode = ENV_RELEASE_NODE_UNSET; + pIns->PanEnv.nReleaseNode = ENV_RELEASE_NODE_UNSET; + pIns->PitchEnv.nReleaseNode = ENV_RELEASE_NODE_UNSET; } else { const ITINSTRUMENT *pis = (const ITINSTRUMENT *)p; @@ -276,7 +280,7 @@ } if (pis->mbank<=128) pIns->wMidiBank = pis->mbank; - pIns->nFadeOut = pis->fadeout << 5; + pIns->nFadeOut = pis->fadeout << 5; // should be 6? pIns->nGlobalVol = pis->gbv >> 1; if (pIns->nGlobalVol > 64) pIns->nGlobalVol = 64; for (UINT j=0; j<NOTE_MAX; j++) @@ -1281,7 +1285,7 @@ } // Load instrument and song extensions. - if(mptStartPos >= dwMemPos) + if(mptStartPos >= dwMemPos && mptStartPos < dwMemLength) { LPCBYTE ptr = LoadExtendedInstrumentProperties(lpStream + dwMemPos, lpStream + mptStartPos, &interpretModplugmade); LoadExtendedSongProperties(GetType(), ptr, lpStream, mptStartPos, &interpretModplugmade); @@ -2001,7 +2005,7 @@ //if (pIns->nDCT<DCT_PLUGIN) iti.dct = pIns->nDCT; else iti.dct =0; iti.dct = pIns->nDCT; //rewbs.instroVSTi: will other apps barf if they get an unknown DCT? iti.dca = pIns->nDNA; - iti.fadeout = pIns->nFadeOut >> 5; + iti.fadeout = pIns->nFadeOut >> 5; // should be 6? iti.pps = pIns->nPPS; iti.ppc = pIns->nPPC; iti.gbv = (BYTE)(pIns->nGlobalVol << 1); Modified: trunk/OpenMPT/soundlib/Load_psm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_psm.cpp 2009-08-23 21:07:17 UTC (rev 339) +++ trunk/OpenMPT/soundlib/Load_psm.cpp 2009-08-24 11:43:54 UTC (rev 340) @@ -38,7 +38,7 @@ }; -struct PSMSAMPLEHEADER // Regular sample header +struct PSMOLDSAMPLEHEADER // Regular sample header { BYTE flags; CHAR fileName[8]; // Filename of the original module (without extension) @@ -49,14 +49,15 @@ DWORD sampleLength; DWORD loopStart; DWORD loopEnd; // FF FF FF FF = end of sample - WORD unknown3; + BYTE unknown3; + BYTE defaulPan; // unused? BYTE defaultVolume; DWORD unknown4; WORD C5Freq; CHAR unknown5[21]; // 00 ... 00 }; -struct PSMSAMPLEHEADERSINARIA // Sinaria sample header +struct PSMNEWSAMPLEHEADER // Sinaria sample header (and possibly other games) { BYTE flags; CHAR fileName[8]; // Filename of the original module (without extension) @@ -68,20 +69,25 @@ DWORD loopStart; DWORD loopEnd; WORD unknown3; - BYTE unknown4; + BYTE defaultPan; // unused? BYTE defaultVolume; - DWORD unknown5; + DWORD unknown4; WORD C5Freq; - CHAR unknown6[16]; // 00 ... 00 + CHAR unknown5[16]; // 00 ... 00 }; #pragma pack() -BYTE convert_psm_effect(BYTE param, bool bIsSinaria) +BYTE convert_psm_porta(BYTE param, bool bNewFormat) { - if(bIsSinaria) + if(bNewFormat) + { return param; + } else - return (param >> 2); + { + if(param < 4) return param | 0xF0; + else return (param >> 2); + } } bool CSoundFile::ReadPSM(const LPCBYTE lpStream, const DWORD dwMemLength) @@ -91,7 +97,7 @@ if( dwMemPos > dwMemLength || x > dwMemLength - dwMemPos ) return false; DWORD dwMemPos = 0; - bool bIsSinaria = false; // The game "Sinaria" uses a slightly modified PSM structure + bool bNewFormat = false; // The game "Sinaria" uses a slightly modified PSM structure ASSERT_CAN_READ(12); PSMHEADER shdr; @@ -148,11 +154,11 @@ // Pattern ID (something like "P0 " or "P13 ") follows if(memcmp(lpStream + dwMemPos + 4, "P", 1)) return false; - if(!memcmp(lpStream + dwMemPos + 4, "PATT", 4)) bIsSinaria = true; + if(!memcmp(lpStream + dwMemPos + 4, "PATT", 4)) bNewFormat = true; char patternID[4]; - memcpy(patternID, lpStream + dwMemPos + 5 + (bIsSinaria ? 3 : 0), 3); + memcpy(patternID, lpStream + dwMemPos + 5 + (bNewFormat ? 3 : 0), 3); patternID[3] = 0; - patternOffsets.push_back(dwMemPos + 8 + (bIsSinaria ? 4 : 0)); + patternOffsets.push_back(dwMemPos + 8 + (bNewFormat ? 4 : 0)); patternIDs.push_back(atoi(patternID)); numPatterns++; @@ -185,23 +191,46 @@ switch(subChunkID) { - case 0x45544144: // "DATE" - Song date (YYMMDD) - if(subChunkSize < 6) break; + case 0x45544144: // "DATE" - Conversion date (YYMMDD) + if(subChunkSize != 6) break; + { + int version; + for(DWORD i = 0; i < subChunkSize; i++) + { + if(lpStream[dwChunkPos + i] >= '0' && lpStream[dwChunkPos + i] <= '9') + { + version = (version * 10) + (lpStream[dwChunkPos + i] - '0'); + } else + { + version = 0; + break; + } + } + if(version == 800211 || version == 940902 || version == 940903 || + version == 940906 || version == 940914 || version == 941213) + bNewFormat = true; + } + #ifdef DEBUG CHAR cDate[7]; memcpy(cDate, lpStream + dwChunkPos, 6); cDate[6] = 0; - sComment += " - Date: "; + sComment += " - Build Date: "; sComment += cDate; + if(bNewFormat) sComment += " (New Format)"; + else sComment += " (Old Format)"; + #endif break; case 0x484C504F: // "OPLH" - Order list, channel + module settings { if(subChunkSize < 9) return false; - // First two bytes = "Memory alloc, roughly ordlen + 10, if too small, song freezes" + // First two bytes = Number of chunks that follow + //WORD nTotalChunks = LittleEndian(*(WORD *)(lpStream + dwChunkPos)); // Now, the interesting part begins! DWORD dwSettingsOffset = dwChunkPos + 2; + WORD nChunkCount = 0, nFirstOrderChunk = (WORD)-1; while(dwSettingsOffset - dwChunkPos + 1 < subChunkSize) { switch(lpStream[dwSettingsOffset]) @@ -216,7 +245,7 @@ for(PATTERNINDEX i = 0; i < patternIDs.size(); i++) { char patternID[4]; - memcpy(patternID, lpStream + dwSettingsOffset + 2 + (bIsSinaria ? 3 : 0), 3); + memcpy(patternID, lpStream + dwSettingsOffset + 2 + (bNewFormat ? 3 : 0), 3); patternID[3] = 0; DWORD nPattern = atoi(patternID); if(patternIDs[i] == nPattern) @@ -225,23 +254,25 @@ break; } } - dwSettingsOffset += 5 + (bIsSinaria ? 4 : 0); + if(nFirstOrderChunk == (WORD)-1) nFirstOrderChunk = nChunkCount; + dwSettingsOffset += 5 + (bNewFormat ? 4 : 0); break; - case 0x04: - /* It looks like the 2nd number of this chunk could be the restart position, - where position = ((number < 15) ? 0 : (number - 15)) */ - - //uint32 pos = lpStream[dwSettingsOffset + 1] | (lpStream[dwSettingsOffset + 2] << 8); - - // NOTE: This should not be global! (Extreme Pinball!!!) - #ifdef DEBUG + case 0x04: // Restart position { - char s[32]; - wsprintf(s, " - restart %d", (lpStream[dwSettingsOffset + 1] < 15) ? 0 : lpStream[dwSettingsOffset + 1] - 15); - sComment += s; + // NOTE: This should not be global! (Extreme Pinball!!!) + WORD nRestartChunk = LittleEndian(*(WORD *)(lpStream + dwSettingsOffset + 1)); + ORDERINDEX nRestartPosition = 0; + if(nRestartChunk == 0) nRestartPosition = 0; + else if(nRestartChunk >= nFirstOrderChunk) nRestartPosition = (ORDERINDEX)(nRestartChunk - nFirstOrderChunk); + #ifdef DEBUG + { + char s[32]; + wsprintf(s, " - restart pos %d", nRestartPosition); + sComment += s; + } + #endif } - #endif dwSettingsOffset += 3; break; @@ -277,7 +308,7 @@ switch(lpStream[dwSettingsOffset + 3]) { case 0: - ChnSettings[nChn].nPan = lpStream[dwSettingsOffset + 2]; + ChnSettings[nChn].nPan = lpStream[dwSettingsOffset + 2] ^ 128; break; case 2: @@ -309,6 +340,7 @@ break; } + nChunkCount++; } Order.push_back(Order.GetInvalidPatIndex()); } @@ -322,7 +354,7 @@ switch(lpStream[dwChunkPos + i]) { case 0: - ChnSettings[i >> 1].nPan = lpStream[dwChunkPos + i + 1] - 128; + ChnSettings[i >> 1].nPan = lpStream[dwChunkPos + i + 1] ^ 128; break; case 2: @@ -357,10 +389,10 @@ break; case 0x504D5344: // DSMP - Samples - if(!bIsSinaria) + if(!bNewFormat) { - if(chunkSize < sizeof(PSMSAMPLEHEADER)) return false; - PSMSAMPLEHEADER *pSample = (PSMSAMPLEHEADER *)(lpStream + dwMemPos); + if(chunkSize < sizeof(PSMOLDSAMPLEHEADER)) return false; + PSMOLDSAMPLEHEADER *pSample = (PSMOLDSAMPLEHEADER *)(lpStream + dwMemPos); SAMPLEINDEX smp = (SAMPLEINDEX)(LittleEndianW(pSample->sampleNumber) + 1); m_nSamples = max(m_nSamples, smp); memcpy(m_szNames[smp], pSample->sampleName, 31); @@ -379,12 +411,12 @@ if(Samples[smp].nLoopEnd == 0xFFFFFF) Samples[smp].nLoopEnd = Samples[smp].nLength; // Delta-encoded samples - ReadSample(&Samples[smp], RS_PCM8D, (LPCSTR)(lpStream + dwMemPos + sizeof(PSMSAMPLEHEADER)), Samples[smp].nLength); + ReadSample(&Samples[smp], RS_PCM8D, (LPCSTR)(lpStream + dwMemPos + sizeof(PSMOLDSAMPLEHEADER)), Samples[smp].nLength); } else { // Sinaria uses a slightly different sample header - if(chunkSize < sizeof(PSMSAMPLEHEADERSINARIA)) return false; - PSMSAMPLEHEADERSINARIA *pSample = (PSMSAMPLEHEADERSINARIA *)(lpStream + dwMemPos); + if(chunkSize < sizeof(PSMNEWSAMPLEHEADER)) return false; + PSMNEWSAMPLEHEADER *pSample = (PSMNEWSAMPLEHEADER *)(lpStream + dwMemPos); SAMPLEINDEX smp = (SAMPLEINDEX)(LittleEndianW(pSample->sampleNumber) + 1); m_nSamples = max(m_nSamples, smp); memcpy(m_szNames[smp], pSample->sampleName, 31); @@ -403,7 +435,7 @@ if(Samples[smp].nLoopEnd == 0xFFFFFF) Samples[smp].nLoopEnd = Samples[smp].nLength; // Delta-encoded samples - ReadSample(&Samples[smp], RS_PCM8D, (LPCSTR)(lpStream + dwMemPos + sizeof(PSMSAMPLEHEADERSINARIA)), Samples[smp].nLength); + ReadSample(&Samples[smp], RS_PCM8D, (LPCSTR)(lpStream + dwMemPos + sizeof(PSMNEWSAMPLEHEADER)), Samples[smp].nLength); } break; @@ -419,24 +451,24 @@ if(m_nChannels == 0) return false; // Now that we know the number of channels, we can go through all the patterns. - for(PATTERNINDEX i = 0; i < numPatterns; i++) + for(PATTERNINDEX nPat = 0; nPat < numPatterns; nPat++) { - DWORD dwPatternOffset = patternOffsets[i]; + DWORD dwPatternOffset = patternOffsets[nPat]; if(dwPatternOffset + 2 > dwMemLength) return false; WORD patternSize = LittleEndianW(*(WORD *)(lpStream + dwPatternOffset)); dwPatternOffset += 2; - if(Patterns.Insert(i, patternSize)) + if(Patterns.Insert(nPat, patternSize)) { CString s; - s.Format(TEXT("Allocating patterns failed starting from pattern %u"), i); + s.Format(TEXT("Allocating patterns failed starting from pattern %u"), nPat); MessageBox(NULL, s, TEXT("OpenMPT PSM import"), MB_ICONERROR); break; } // Read pattern. MODCOMMAND *row_data; - row_data = Patterns[i]; + row_data = Patterns[nPat]; for(int nRow = 0; nRow < patternSize; nRow++) { @@ -458,15 +490,15 @@ if(dwRowOffset + 1 > dwMemLength) return false; // Note present BYTE bNote = lpStream[dwRowOffset]; - if(!bIsSinaria) + if(!bNewFormat) { if(bNote == 0xFF) bNote = NOTE_NOTECUT; else - bNote = (bNote & 0x0F) + 12 * (bNote >> 4) + 13; + if(bNote < 129) bNote = (bNote & 0x0F) + 12 * (bNote >> 4) + 13; } else { - bNote += 36; + if(bNote < 85) bNote += 36; } m->note = bNote; dwRowOffset++; @@ -500,41 +532,45 @@ // Volslides case 0x01: // fine volslide up command = CMD_VOLUMESLIDE; - param = (param << 3) | 0x0F; + if (bNewFormat) param = (param << 4) | 0x0F; + else param = ((param & 0x1E) << 3) | 0x0F; break; case 0x02: // volslide up command = CMD_VOLUMESLIDE; - param = (param << 3); + if (bNewFormat) param = 0xF0 & (param << 4); + else param = 0xF0 & (param << 3); break; case 0x03: // fine volslide down command = CMD_VOLUMESLIDE; - param = 0xF0 | (param >> 1); + if (bNewFormat) param |= 0xF0; + else param = 0xF0 | (param >> 1); break; case 0x04: // volslide down command = CMD_VOLUMESLIDE; - param >>= 1; + if (bNewFormat) param &= 0x0F; + else param = (param >> 1) & 0x0F; break; // Portamento case 0x0B: // fine portamento up command = CMD_PORTAMENTOUP; - param = 0xF0 | convert_psm_effect(param, bIsSinaria); + param = 0xF0 | convert_psm_porta(param, bNewFormat); break; case 0x0C: // portamento up command = CMD_PORTAMENTOUP; - param = convert_psm_effect(param, bIsSinaria); + param = convert_psm_porta(param, bNewFormat); break; case 0x0D: // fine portamento down command = CMD_PORTAMENTODOWN; - param = 0xF0 | convert_psm_effect(param, bIsSinaria); + param = 0xF0 | convert_psm_porta(param, bNewFormat); break; case 0x0E: // portamento down command = CMD_PORTAMENTODOWN; - param = convert_psm_effect(param, bIsSinaria); + param = convert_psm_porta(param, bNewFormat); break; case 0x0F: // tone portamento command = CMD_TONEPORTAMENTO; - param = convert_psm_effect(param, bIsSinaria); + if(!bNewFormat) param >>= 2; break; case 0x11: // glissando control command = CMD_S3MCMDEX; Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-08-23 21:07:17 UTC (rev 339) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-08-24 11:43:54 UTC (rev 340) @@ -513,10 +513,9 @@ //TODO: Check whether the 0xF0 mask is correct. // (there are two bytes reserved from the header, so why 0xF0 mask?). //nbo = (GetNumPatterns() + 15) & 0xF0; - nbo = Order.GetLengthTailTrimmed() + 15; + nbo = Order.GetLengthTailTrimmed(); if(nbo > 0xF0) nbo = 0xF0; - nbo = nbo & 0xF0; - if (!nbo) nbo = 16; + if (!nbo) nbo = 1; header[0x20] = nbo & 0xFF; header[0x21] = nbo >> 8; nbi = m_nInstruments; Modified: trunk/OpenMPT/unlha/EXTRACT.CPP =================================================================== --- trunk/OpenMPT/unlha/EXTRACT.CPP 2009-08-23 21:07:17 UTC (rev 339) +++ trunk/OpenMPT/unlha/EXTRACT.CPP 2009-08-24 11:43:54 UTC (rev 340) @@ -16,7 +16,7 @@ switch (method) { case 0: - case 8: + case 10: { int len1 = m_dwOutputLen - (int)(outfp - m_lpOutputFile); int len2 = m_dwStreamLen - infp; @@ -30,14 +30,22 @@ crc = 0; } break; - case 6: // -lzs- + case 8: // -lzs- LzInterface.dicbit = 11; decode(&LzInterface); break; case 1: // -lh1- case 4: // -lh4- - case 7: // -lz5- + case 9: // -lz5- LzInterface.dicbit = 12; + decode(&LzInterface); + break; + case 6: // -lh6- + LzInterface.dicbit = 15; + decode(&LzInterface); + break; + case 7: // -lh7- + LzInterface.dicbit = 16; default: decode(&LzInterface); } Modified: trunk/OpenMPT/unlha/HUF.CPP =================================================================== --- trunk/OpenMPT/unlha/HUF.CPP 2009-08-23 21:07:17 UTC (rev 339) +++ trunk/OpenMPT/unlha/HUF.CPP 2009-08-24 11:43:54 UTC (rev 340) @@ -4,7 +4,7 @@ #define NP (MAX_DICBIT + 1) #define NT (USHRT_BIT + 3) -#define PBIT 4 /* smallest integer such that (1 << PBIT) > NP */ +//#define PBIT 4 /* smallest integer such that (1 << PBIT) > NP */ #define TBIT 5 /* smallest integer such that (1 << TBIT) > NT */ #define NPT 0x80 @@ -16,8 +16,10 @@ t_freq[2 * NT - 1]; } HUFDATA; -HUFDATA *gpHufData = NULL; +//HUFDATA *gpHufData = NULL; +#define gpHufData (*((HUFDATA **)&m_pHufData)) + VOID CLhaArchive::InitHufTables() { gpHufData = (HUFDATA *)(m_pDecoderData + 4096); @@ -104,7 +106,7 @@ blocksize = getbits(16); read_pt_len(NT, TBIT, 3); read_c_len(); - read_pt_len(NP, PBIT, -1); + read_pt_len(np, pbit, -1); } blocksize--; j = gpHufData->c_table[bitbuf >> 4]; @@ -125,21 +127,28 @@ unsigned short j, mask; j = gpHufData->pt_table[bitbuf >> (16 - 8)]; - if (j < NP) fillbuf(gpHufData->pt_len[j]); + if (j < np) fillbuf(gpHufData->pt_len[j]); else { fillbuf(8); mask = 1 << (16 - 1); do { j = (bitbuf & mask) ? right[j] : left[j]; mask >>= 1; - } while (j >= NP); + } while (j >= np); fillbuf(gpHufData->pt_len[j] - 8); } if (j != 0) j = (1 << (j - 1)) + getbits(j - 1); return j; } -void CLhaArchive::decode_start_st1() +void CLhaArchive::decode_start_st1(int dicbit) { + switch (dicbit) + { + case 12: + case 13: pbit = 4; np = 14; break; + case 15: pbit = 5; np = 16; break; + case 16: pbit = 5; np = 17; break; + } init_getbits(); blocksize = 0; } Modified: trunk/OpenMPT/unlha/LHEXT.CPP =================================================================== --- trunk/OpenMPT/unlha/LHEXT.CPP 2009-08-23 21:07:17 UTC (rev 339) +++ trunk/OpenMPT/unlha/LHEXT.CPP 2009-08-24 11:43:54 UTC (rev 340) @@ -26,10 +26,10 @@ } -const char *methods[10] = +const char *methods[12] = { - "-lh0-", "-lh1-", "-lh2-", "-lh3-", "-lh4-", - "-lh5-", "-lzs-", "-lz5-", "-lz4-", NULL + "-lh0-", "-lh1-", "-lh2-", "-lh3-", "-lh4-", "-lh5-", + "-lh6-", "-lh7-", "-lzs-", "-lz5-", "-lz4-", NULL }; Modified: trunk/OpenMPT/unlha/SLIDE.CPP =================================================================== --- trunk/OpenMPT/unlha/SLIDE.CPP 2009-08-23 21:07:17 UTC (rev 339) +++ trunk/OpenMPT/unlha/SLIDE.CPP 2009-08-24 11:43:54 UTC (rev 340) @@ -43,17 +43,19 @@ { case 1: decode_start_dyn(); break; case 2: decode_start_st0(); break; - case 3: decode_start_st1(); break; - case 4: decode_start_st1(); break; - case 5: decode_start_lzs(); break; - case 6: decode_start_lz5(text); break; + case 3: decode_start_st1(12); break; + case 4: decode_start_st1(13); break; + case 5: decode_start_st1(15); break; + case 6: decode_start_st1(16); break; + case 7: decode_start_lzs(); break; + case 8: decode_start_lz5(text); break; default: decode_start_fix(); break; } #ifdef LHADEBUG Log("Starting Decode (original size=%d)...\n", pinterface->original); #endif dicsiz1 = dicsiz - 1; - offset = (pinterface->method == 6) ? 0x100 - 2 : 0x100 - 3; + offset = (pinterface->method == 8) ? 0x100 - 2 : 0x100 - 3; count = 0; loc = 0; while (count < pinterface->original) @@ -64,8 +66,10 @@ case 2: c = decode_c_st0(); break; case 3: c = decode_c_st1(); break; case 4: c = decode_c_st1(); break; - case 5: c = decode_c_lzs(); break; - case 6: c = decode_c_lz5(); break; + case 5: c = decode_c_st1(); break; + case 6: c = decode_c_st1(); break; + case 7: c = decode_c_lzs(); break; + case 8: c = decode_c_lz5(); break; default: c = decode_c_dyn(); break; } if (c <= 255) @@ -86,8 +90,10 @@ case 2: d = decode_p_st0(); break; case 3: d = decode_p_st1(); break; case 4: d = decode_p_st1(); break; - case 5: d = decode_p_lzs(); break; - case 6: d = decode_p_lz5(); break; + case 5: d = decode_p_st1(); break; + case 6: d = decode_p_st1(); break; + case 7: d = decode_p_lzs(); break; + case 8: d = decode_p_lz5(); break; default: d = decode_p_st0(); break; } int j = c - offset; Modified: trunk/OpenMPT/unlha/SLIDEHUF.H =================================================================== --- trunk/OpenMPT/unlha/SLIDEHUF.H 2009-08-23 21:07:17 UTC (rev 339) +++ trunk/OpenMPT/unlha/SLIDEHUF.H 2009-08-24 11:43:54 UTC (rev 340) @@ -11,7 +11,7 @@ /* from slide.c */ -#define MAX_DICBIT 13 +#define MAX_DICBIT 16 // 13 #define MAX_DICSIZ (1 << MAX_DICBIT) #define MATCHBIT 8 /* bits for MAXMATCH - THRESHOLD */ Modified: trunk/OpenMPT/unlha/UNLHA32.H =================================================================== --- trunk/OpenMPT/unlha/UNLHA32.H 2009-08-23 21:07:17 UTC (rev 339) +++ trunk/OpenMPT/unlha/UNLHA32.H 2009-08-24 11:43:54 UTC (rev 340) @@ -72,9 +72,10 @@ unsigned short *freq; unsigned char *buf; unsigned short bufsiz, blocksize; - unsigned int np; + unsigned int np, pbit; + void * m_pHufData; int flag, flagcnt, matchpos, prev_char; - unsigned short dicsiz, dicbit, maxmatch, loc; + unsigned int dicsiz, dicbit, maxmatch, loc; unsigned short left[2 * NC - 1], right[2 * NC - 1]; protected: @@ -113,7 +114,7 @@ protected: // huf.cpp VOID InitHufTables(); - void decode_start_st1(); + void decode_start_st1(int dicbit); void read_pt_len(short nn, short nbit, short i_special); void read_c_len(); unsigned short decode_c_st1(); Modified: trunk/OpenMPT/unlha/Unlha.cpp =================================================================== --- trunk/OpenMPT/unlha/Unlha.cpp 2009-08-23 21:07:17 UTC (rev 339) +++ trunk/OpenMPT/unlha/Unlha.cpp 2009-08-24 11:43:54 UTC (rev 340) @@ -69,6 +69,8 @@ m_lpOutputFile = 0; m_dwOutputLen = 0; m_pDecoderData = NULL; + + gpHufData = NULL; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |