You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(10) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(2) |
May
(10) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(4) |
| 2009 |
Jan
(9) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(6) |
Jun
(18) |
Jul
(33) |
Aug
(39) |
Sep
(33) |
Oct
(24) |
Nov
(23) |
Dec
(22) |
| 2010 |
Jan
(29) |
Feb
(32) |
Mar
(51) |
Apr
(17) |
May
(31) |
Jun
(21) |
Jul
(32) |
Aug
(28) |
Sep
(35) |
Oct
(27) |
Nov
(11) |
Dec
(13) |
| 2011 |
Jan
(14) |
Feb
(13) |
Mar
(27) |
Apr
(27) |
May
(28) |
Jun
(20) |
Jul
(43) |
Aug
(52) |
Sep
(66) |
Oct
(61) |
Nov
(11) |
Dec
(8) |
| 2012 |
Jan
(20) |
Feb
(30) |
Mar
(38) |
Apr
(21) |
May
(33) |
Jun
(21) |
Jul
(25) |
Aug
(9) |
Sep
(24) |
Oct
(42) |
Nov
(27) |
Dec
(41) |
| 2013 |
Jan
(20) |
Feb
(35) |
Mar
(156) |
Apr
(298) |
May
(258) |
Jun
(201) |
Jul
(105) |
Aug
(60) |
Sep
(193) |
Oct
(245) |
Nov
(280) |
Dec
(194) |
| 2014 |
Jan
(63) |
Feb
(202) |
Mar
(200) |
Apr
(23) |
May
(53) |
Jun
(105) |
Jul
(18) |
Aug
(26) |
Sep
(110) |
Oct
(187) |
Nov
(97) |
Dec
(74) |
| 2015 |
Jan
(45) |
Feb
(55) |
Mar
(116) |
Apr
(116) |
May
(193) |
Jun
(164) |
Jul
(50) |
Aug
(111) |
Sep
(98) |
Oct
(71) |
Nov
(103) |
Dec
(63) |
| 2016 |
Jan
(33) |
Feb
(101) |
Mar
(182) |
Apr
(139) |
May
(140) |
Jun
(103) |
Jul
(165) |
Aug
(286) |
Sep
(208) |
Oct
(127) |
Nov
(97) |
Dec
(54) |
| 2017 |
Jan
(64) |
Feb
(335) |
Mar
(202) |
Apr
(212) |
May
(139) |
Jun
(127) |
Jul
(294) |
Aug
(154) |
Sep
(170) |
Oct
(152) |
Nov
(156) |
Dec
(62) |
| 2018 |
Jan
(168) |
Feb
(237) |
Mar
(196) |
Apr
(174) |
May
(174) |
Jun
(161) |
Jul
(127) |
Aug
(88) |
Sep
(149) |
Oct
(66) |
Nov
(52) |
Dec
(135) |
| 2019 |
Jan
(146) |
Feb
(126) |
Mar
(104) |
Apr
(58) |
May
(60) |
Jun
(28) |
Jul
(197) |
Aug
(129) |
Sep
(141) |
Oct
(148) |
Nov
(63) |
Dec
(100) |
| 2020 |
Jan
(74) |
Feb
(37) |
Mar
(59) |
Apr
(154) |
May
(194) |
Jun
(133) |
Jul
(313) |
Aug
(197) |
Sep
(49) |
Oct
(162) |
Nov
(143) |
Dec
(57) |
| 2021 |
Jan
(120) |
Feb
(107) |
Mar
(314) |
Apr
(157) |
May
(524) |
Jun
(169) |
Jul
(72) |
Aug
(133) |
Sep
(135) |
Oct
(146) |
Nov
(198) |
Dec
(325) |
| 2022 |
Jan
(409) |
Feb
(249) |
Mar
(138) |
Apr
(95) |
May
(102) |
Jun
(221) |
Jul
(66) |
Aug
(120) |
Sep
(192) |
Oct
(131) |
Nov
(53) |
Dec
(171) |
| 2023 |
Jan
(357) |
Feb
(82) |
Mar
(168) |
Apr
(218) |
May
(196) |
Jun
(86) |
Jul
(115) |
Aug
(49) |
Sep
(190) |
Oct
(102) |
Nov
(45) |
Dec
(76) |
| 2024 |
Jan
(86) |
Feb
(50) |
Mar
(324) |
Apr
(209) |
May
(197) |
Jun
(232) |
Jul
(194) |
Aug
(247) |
Sep
(219) |
Oct
(266) |
Nov
(328) |
Dec
(304) |
| 2025 |
Jan
(191) |
Feb
(115) |
Mar
(137) |
Apr
(32) |
May
(126) |
Jun
(403) |
Jul
(213) |
Aug
(203) |
Sep
(148) |
Oct
(109) |
Nov
(191) |
Dec
(209) |
| 2026 |
Jan
(127) |
Feb
(123) |
Mar
(160) |
Apr
(141) |
May
(45) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <sag...@us...> - 2010-03-26 13:23:10
|
Revision: 551
http://modplug.svn.sourceforge.net/modplug/?rev=551&view=rev
Author: saga-games
Date: 2010-03-26 13:23:03 +0000 (Fri, 26 Mar 2010)
Log Message:
-----------
[New] Treeview: Sequences can now be copied to other modules by simply dragging the sequence header into the the other module's sequence header. Does only work between two different modules, not within the same module.
[Ref] Minor refacotring; AddSequence() now returns the new sequence index for ease of use.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/Mptrack.h
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/View_tre.h
trunk/OpenMPT/soundlib/ModSequence.cpp
trunk/OpenMPT/soundlib/ModSequence.h
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-25 22:36:06 UTC (rev 550)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-26 13:23:03 UTC (rev 551)
@@ -1770,8 +1770,7 @@
ORDERINDEX startOrd = nOrd;
modified = true;
- m_SndFile.Order.AddSequence(false);
- SEQUENCEINDEX newSeq = m_SndFile.Order.GetNumSequences() - 1;
+ SEQUENCEINDEX newSeq = m_SndFile.Order.AddSequence(false);
m_SndFile.Order.SetSequence(newSeq);
// resize new seqeuence if necessary
Modified: trunk/OpenMPT/mptrack/Mptrack.h
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.h 2010-03-25 22:36:06 UTC (rev 550)
+++ trunk/OpenMPT/mptrack/Mptrack.h 2010-03-26 13:23:03 UTC (rev 551)
@@ -96,6 +96,7 @@
DRAGONDROP_PATTERN, // | Pattern from a song | Pattern # | NULL |
DRAGONDROP_ORDER, // | Pattern index in a song | Order # | NULL |
DRAGONDROP_SONG, // | Song file (mod/s3m/xm/it) | 0 | pszFileName |
+ DRAGONDROP_SEQUENCE // | Sequence (a set of orders) | Sequence # | NULL |
};
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-25 22:36:06 UTC (rev 550)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-26 13:23:03 UTC (rev 551)
@@ -1940,6 +1940,11 @@
pdropinfo->dwDropType = DRAGONDROP_INSTRUMENT;
break;
+ case MODITEM_SEQUENCE:
+ case MODITEM_HDR_ORDERS:
+ pdropinfo->dwDropType = DRAGONDROP_SEQUENCE;
+ break;
+
case MODITEM_INSLIB_SAMPLE:
case MODITEM_INSLIB_INSTRUMENT:
if (m_szSongName[0])
@@ -2000,7 +2005,7 @@
}
-BOOL CModTree::CanDrop(HTREEITEM hItem, BOOL bDoDrop)
+bool CModTree::CanDrop(HTREEITEM hItem, bool bDoDrop)
//---------------------------------------------------
{
const uint64 modItemDrop = GetModItem(hItem);
@@ -2010,14 +2015,18 @@
const uint32 modItemDragType = GetModItemType(m_qwItemDrag);
const uint32 modItemDragID = GetModItemID(m_qwItemDrag);
- PMODTREEDOCINFO pInfo = DocInfo[m_nDocNdx];
- CModDoc *pModDoc = (pInfo) ? pInfo->pModDoc : NULL;
+ const PMODTREEDOCINFO pInfoDrag = DocInfo[m_nDragDocNdx];
+ const PMODTREEDOCINFO pInfoDrop = DocInfo[m_nDocNdx];
+ CModDoc *pModDoc = (pInfoDrop) ? pInfoDrop->pModDoc : nullptr;
+ CSoundFile *pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : nullptr;
+
switch(modItemDropType)
{
case MODITEM_ORDER:
case MODITEM_SEQUENCE:
- if ((modItemDragType == MODITEM_ORDER) && (pModDoc) && (m_nDocNdx == m_nDragDocNdx))
+ if ((modItemDragType == MODITEM_ORDER) && (pModDoc) && (pSndFile) && (m_nDocNdx == m_nDragDocNdx))
{
+ // drop an order somewhere
if (bDoDrop)
{
SEQUENCEINDEX nSeqFrom = (SEQUENCEINDEX)(modItemDragID >> 16), nSeqTo = (SEQUENCEINDEX)(modItemDropID >> 16);
@@ -2026,7 +2035,7 @@
{
// drop on sequence -> attach
nSeqTo = (SEQUENCEINDEX)(modItemDropID & 0xFFFF);
- nOrdTo = pModDoc->GetSoundFile()->Order.GetSequence(nSeqTo).GetLengthTailTrimmed();
+ nOrdTo = pSndFile->Order.GetSequence(nSeqTo).GetLengthTailTrimmed();
}
if (nSeqFrom != nSeqTo || nOrdFrom != nOrdTo)
@@ -2037,9 +2046,36 @@
}
}
}
- return TRUE;
+ return true;
}
break;
+ case MODITEM_HDR_ORDERS:
+ // Drop your sequences here.
+ // At the moment, only dropping sequences into another module is possible.
+ if((modItemDragType == MODITEM_SEQUENCE || modItemDragType == MODITEM_HDR_ORDERS) && pSndFile && pSndFile->GetType() == MOD_TYPE_MPT && pInfoDrag && pModDoc != pInfoDrag->pModDoc)
+ {
+ if(bDoDrop)
+ {
+ // copy mod sequence over.
+ CModDoc *pDragDoc = pInfoDrag->pModDoc;
+ if(pDragDoc == nullptr) return false;
+ CSoundFile *pDragSndFile = pDragDoc->GetSoundFile();
+ if(pDragSndFile == nullptr) return false;
+ const SEQUENCEINDEX nOrigSeq = (SEQUENCEINDEX)modItemDragID;
+ const ModSequence *pOrigSeq = &(pDragSndFile->Order.GetSequence(nOrigSeq));
+ if(pOrigSeq == nullptr) return false;
+
+ pSndFile->Order.AddSequence(false);
+ pSndFile->Order.resize(pOrigSeq->GetLength(), pSndFile->Order.GetInvalidPatIndex());
+ for(ORDERINDEX nOrd = 0; nOrd < pOrigSeq->GetLengthTailTrimmed(); nOrd++)
+ {
+ pSndFile->Order[nOrd] = pDragSndFile->Order.GetSequence(nOrigSeq)[nOrd];
+ }
+ pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, NULL);
+ pModDoc->SetModified();
+ }
+ return true;
+ }
case MODITEM_SAMPLE:
break;
case MODITEM_INSTRUMENT:
@@ -2058,11 +2094,11 @@
else
SetMidiPercussion((DWORD)modItemDropID, szFullPath);
}
- return TRUE;
+ return true;
}
break;
}
- return FALSE;
+ return false;
}
@@ -2170,12 +2206,12 @@
}
-void CModTree::OnBeginDrag(HTREEITEM hItem, BOOL bLeft, LRESULT *pResult)
+void CModTree::OnBeginDrag(HTREEITEM hItem, bool bLeft, LRESULT *pResult)
//-----------------------------------------------------------------------
{
if (!(m_dwStatus & TREESTATUS_DRAGGING))
{
- BOOL bDrag = FALSE;
+ bool bDrag = false;
m_hDropWnd = NULL;
m_hItemDrag = hItem;
@@ -2191,15 +2227,25 @@
case MODITEM_PATTERN:
case MODITEM_SAMPLE:
case MODITEM_INSTRUMENT:
+ case MODITEM_SEQUENCE:
case MODITEM_MIDIINSTRUMENT:
case MODITEM_MIDIPERCUSSION:
case MODITEM_INSLIB_SAMPLE:
case MODITEM_INSLIB_INSTRUMENT:
case MODITEM_INSLIB_SONG:
- bDrag = TRUE;
+ bDrag = true;
break;
+ case MODITEM_HDR_ORDERS:
+ // can we drag an order header? (only in MPTM format and if there's only one sequence)
+ {
+ CModDoc *pModDoc = DocInfo[m_nDragDocNdx]->pModDoc;
+ CSoundFile *pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : nullptr;
+ if(pSndFile && pSndFile->GetType() == MOD_TYPE_MPT && pSndFile->Order.GetNumSequences() == 1)
+ bDrag = true;
+ }
+ break;
default:
- if (m_qwItemDrag & 0x8000) bDrag = TRUE;
+ if (m_qwItemDrag & 0x8000) bDrag = true;
}
if (bDrag)
{
@@ -2218,7 +2264,7 @@
if (pnmhdr)
{
LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)pnmhdr;
- OnBeginDrag(pnmtv->itemNew.hItem, FALSE, pResult);
+ OnBeginDrag(pnmtv->itemNew.hItem, false, pResult);
}
}
@@ -2229,7 +2275,7 @@
if (pnmhdr)
{
LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)pnmhdr;
- OnBeginDrag(pnmtv->itemNew.hItem, TRUE, pResult);
+ OnBeginDrag(pnmtv->itemNew.hItem, true, pResult);
}
}
@@ -2616,7 +2662,7 @@
if (rect.PtInRect(point))
{
m_hDropWnd = m_hWnd;
- BOOL bCanDrop = CanDrop( HitTest(point, &flags), FALSE);
+ bool bCanDrop = CanDrop( HitTest(point, &flags), false);
SetCursor((bCanDrop) ? CMainFrame::curDragging : CMainFrame::curNoDrop2);
} else
{
Modified: trunk/OpenMPT/mptrack/View_tre.h
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.h 2010-03-25 22:36:06 UTC (rev 550)
+++ trunk/OpenMPT/mptrack/View_tre.h 2010-03-26 13:23:03 UTC (rev 551)
@@ -158,7 +158,7 @@
VOID RemoveDocument(CModDoc *pModDoc);
VOID UpdateView(UINT nDocNdx, DWORD dwHint);
VOID OnUpdate(CModDoc *pModDoc, DWORD dwHint, CObject *pHint);
- BOOL CanDrop(HTREEITEM hItem, BOOL bDoDrop);
+ bool CanDrop(HTREEITEM hItem, bool bDoDrop);
VOID UpdatePlayPos(CModDoc *pModDoc, PMPTNOTIFICATION pNotify);
bool IsItemExpanded(HTREEITEM hItem);
@@ -188,7 +188,7 @@
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
- afx_msg void OnBeginDrag(HTREEITEM, BOOL bLeft, LRESULT *pResult);
+ afx_msg void OnBeginDrag(HTREEITEM, bool bLeft, LRESULT *pResult);
afx_msg void OnBeginLDrag(LPNMHDR, LRESULT *pResult);
afx_msg void OnBeginRDrag(LPNMHDR, LRESULT *pResult);
afx_msg void OnEndDrag(DWORD dwMask);
Modified: trunk/OpenMPT/soundlib/ModSequence.cpp
===================================================================
--- trunk/OpenMPT/soundlib/ModSequence.cpp 2010-03-25 22:36:06 UTC (rev 550)
+++ trunk/OpenMPT/soundlib/ModSequence.cpp 2010-03-26 13:23:03 UTC (rev 551)
@@ -291,9 +291,11 @@
}
-void ModSequenceSet::AddSequence(bool bDuplicate)
-//-----------------------------------------------
+SEQUENCEINDEX ModSequenceSet::AddSequence(bool bDuplicate)
+//--------------------------------------------------------
{
+ if(GetNumSequences() == MAX_SEQUENCES)
+ return SEQUENCEINDEX_INVALID;
m_Sequences.push_back(ModSequence(*m_pSndFile, s_nCacheSize));
if (bDuplicate)
{
@@ -301,6 +303,7 @@
m_Sequences.back().m_sName = ""; // Don't copy sequence name.
}
SetSequence(GetNumSequences() - 1);
+ return GetNumSequences() - 1;
}
Modified: trunk/OpenMPT/soundlib/ModSequence.h
===================================================================
--- trunk/OpenMPT/soundlib/ModSequence.h 2010-03-25 22:36:06 UTC (rev 550)
+++ trunk/OpenMPT/soundlib/ModSequence.h 2010-03-26 13:23:03 UTC (rev 551)
@@ -133,7 +133,7 @@
const ModSequence& GetSequence(SEQUENCEINDEX nSeq);
SEQUENCEINDEX GetNumSequences() const {return static_cast<SEQUENCEINDEX>(m_Sequences.size());}
void SetSequence(SEQUENCEINDEX); // Sets working sequence.
- void AddSequence(bool bDuplicate = true); // Adds new sequence. If bDuplicate is true, new sequence is a duplicate of the old one.
+ SEQUENCEINDEX AddSequence(bool bDuplicate = true); // Adds new sequence. If bDuplicate is true, new sequence is a duplicate of the old one. Returns the ID of the new sequence.
void RemoveSequence() {RemoveSequence(GetCurrentSequenceIndex());}
void RemoveSequence(SEQUENCEINDEX); // Removes given sequence
SEQUENCEINDEX GetCurrentSequenceIndex() const {return m_nCurrentSeq;}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-25 22:36:13
|
Revision: 550
http://modplug.svn.sourceforge.net/modplug/?rev=550&view=rev
Author: saga-games
Date: 2010-03-25 22:36:06 +0000 (Thu, 25 Mar 2010)
Log Message:
-----------
[Fix] Module Conversion: When removing instruments from the treeview and converting the module to a different format which also supports instruments, OpenMPT crashed due to a null pointer exception.
[Fix] Treeview: Soundfont samples were not playing correctly anymore. Note that soundfont samples in the MIDI library still don't work.
[Fix] Length Calculation: If the first pattern was empty, OpenMPT was caught in an infinite loop.
[Ref] Minor refactoring.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_ins.h
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/soundlib/Sampleio.cpp
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj
Removed Paths:
-------------
trunk/OpenMPT/zlib/gzio.c
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.h 2010-03-24 19:25:32 UTC (rev 549)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2010-03-25 22:36:06 UTC (rev 550)
@@ -23,7 +23,7 @@
void MapTranspose(int nAmount);
public:
- CNoteMapWnd() { m_nPlayingNote=-1; m_nNote = 5*12; m_pModDoc = NULL; m_nInstrument = 0; m_bIns = FALSE; m_cxFont = m_cyFont = 0; m_hFont = NULL; m_nOldNote = m_nOldIns = 0; m_pParent = NULL; }
+ CNoteMapWnd() { m_nPlayingNote=-1; m_nNote = NOTE_MIDDLEC - 1; m_pModDoc = NULL; m_nInstrument = 0; m_bIns = FALSE; m_cxFont = m_cyFont = 0; m_hFont = NULL; m_nOldNote = m_nOldIns = 0; m_pParent = NULL; }
BOOL SetCurrentInstrument(CModDoc *pModDoc, UINT nIns);
BOOL SetCurrentNote(UINT nNote);
VOID Init(CCtrlInstruments *pParent) { m_pParent = pParent; }
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-03-24 19:25:32 UTC (rev 549)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-03-25 22:36:06 UTC (rev 550)
@@ -1060,7 +1060,7 @@
if ((m_pSndFile) && (m_pModDoc) && (!IsLocked()))
{
CHAR s[256], sold[128] = "";
- UINT nPat = SendViewMessage(VIEWMSG_GETCURRENTPATTERN);
+ PATTERNINDEX nPat = (PATTERNINDEX)SendViewMessage(VIEWMSG_GETCURRENTPATTERN);
m_EditPatName.GetWindowText(s, MAX_PATTERNNAME);
s[MAX_PATTERNNAME-1] = 0;
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-24 19:25:32 UTC (rev 549)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-25 22:36:06 UTC (rev 550)
@@ -1983,7 +1983,7 @@
if (CTrackApp::gpDLSBanks[nDLSBank]->ExtractInstrument(&m_WaveFile, 1, nIns, nRgn))
{
PlaySoundFile(&m_WaveFile);
- m_WaveFile.SetRepeatCount(0);
+ m_WaveFile.SetRepeatCount(-1);
}
EndWaitCursor();
return TRUE;
@@ -1994,7 +1994,7 @@
//-------------------------------------------------------------
{
CMappedFile f;
- BOOL bOk = FALSE;
+ bool bOk = false;
if (lpszFileName)
{
@@ -2029,7 +2029,7 @@
m_WaveFile.Patterns.Insert(1,64);
if (m_WaveFile.Patterns[0])
{
- if (!nNote) nNote = 5*12+1;
+ if (!nNote) nNote = NOTE_MIDDLEC;
MODCOMMAND *m = m_WaveFile.Patterns[0];
m[0].note = (BYTE)nNote;
m[0].instr = 1;
@@ -2052,10 +2052,10 @@
if ((m_WaveFile.m_nSamples > 1) || (m_WaveFile.Samples[1].uFlags & CHN_LOOP))
{
MODCOMMAND *m = m_WaveFile.Patterns[0];
- m[32*4].note = 0xFF;
- m[32*4+1].note = 0xFF;
- m[63*4].note = 0xFE;
- m[63*4+1].note = 0xFE;
+ m[32*4].note = NOTE_KEYOFF;
+ m[32*4+1].note = NOTE_KEYOFF;
+ m[63*4].note = NOTE_NOTECUT;
+ m[63*4+1].note = NOTE_NOTECUT;
} else
{
MODCOMMAND *m = m_WaveFile.Patterns[1];
@@ -2065,7 +2065,7 @@
m[63*4].param = 1;
}
}
- bOk = PlaySoundFile(&m_WaveFile);
+ bOk = PlaySoundFile(&m_WaveFile) ? true : false;
}
}
f.Close();
@@ -2975,7 +2975,7 @@
//end rewbs.fix3116
void CMainFrame::OnShowWindow(BOOL bShow, UINT /*nStatus*/)
-//-----------------------------------------------------
+//---------------------------------------------------------
{
static bool firstShow = true;
if (bShow && !IsWindowVisible() && firstShow) {
@@ -3008,7 +3008,7 @@
/////////////////////////////////////////////
void AddPluginNamesToCombobox(CComboBox& CBox, SNDMIXPLUGIN* plugarray, const bool librarynames)
-//---------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------
{
#ifndef NO_VST
for (UINT iPlug=0; iPlug<MAX_MIXPLUGINS; iPlug++)
@@ -3027,7 +3027,7 @@
}
void AddPluginParameternamesToCombobox(CComboBox& CBox, SNDMIXPLUGIN& plug)
-//----------------------------------------------------------------------------
+//-------------------------------------------------------------------------
{
if(plug.pMixPlugin)
AddPluginParameternamesToCombobox(CBox, *(CVstPlugin *)plug.pMixPlugin);
@@ -3051,7 +3051,7 @@
// TODO: Let some magic happen to convert between absolute and relative paths. m_csExecutableDirectoryPath might be helpful
void CMainFrame::SetDirectory(const LPCTSTR szFilenameFrom, Directory dir, TCHAR (&directories)[NUM_DIRS][_MAX_PATH], bool bStripFilename)
-//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------------------------
{
TCHAR szPath[_MAX_PATH], szDir[_MAX_DIR];
@@ -3079,28 +3079,28 @@
}
void CMainFrame::SetDefaultDirectory(const LPCTSTR szFilenameFrom, Directory dir, bool bStripFilename)
-//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------
{
SetDirectory(szFilenameFrom, dir, m_szDefaultDirectory, bStripFilename);
}
void CMainFrame::SetWorkingDirectory(const LPCTSTR szFilenameFrom, Directory dir, bool bStripFilename)
-//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------
{
SetDirectory(szFilenameFrom, dir, m_szWorkingDirectory, bStripFilename);
}
LPCTSTR CMainFrame::GetDefaultDirectory(Directory dir)
-//----------------------------------------------------------------------------
+//----------------------------------------------------
{
return m_szDefaultDirectory[dir];
}
LPCTSTR CMainFrame::GetWorkingDirectory(Directory dir)
-//----------------------------------------------------------------------------
+//----------------------------------------------------
{
return m_szWorkingDirectory[dir];
}
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-24 19:25:32 UTC (rev 549)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-25 22:36:06 UTC (rev 550)
@@ -416,11 +416,11 @@
m_SndFile.m_nDefaultSpeed = CLAMP(m_SndFile.m_nDefaultSpeed, specs.speedMin, specs.speedMax);
bool bTrimmedEnvelopes = false;
- for(INSTRUMENTINDEX i = 1; i <= m_SndFile.m_nInstruments; i++)
+ for(INSTRUMENTINDEX i = 1; i <= m_SndFile.m_nInstruments; i++) if(m_SndFile.Instruments[i] != nullptr)
{
- bTrimmedEnvelopes |= UpdateEnvelopes(&m_SndFile.Instruments[i]->VolEnv);
- bTrimmedEnvelopes |= UpdateEnvelopes(&m_SndFile.Instruments[i]->PanEnv);
- bTrimmedEnvelopes |= UpdateEnvelopes(&m_SndFile.Instruments[i]->PitchEnv);
+ bTrimmedEnvelopes |= UpdateEnvelopes(&(m_SndFile.Instruments[i]->VolEnv));
+ bTrimmedEnvelopes |= UpdateEnvelopes(&(m_SndFile.Instruments[i]->PanEnv));
+ bTrimmedEnvelopes |= UpdateEnvelopes(&(m_SndFile.Instruments[i]->PitchEnv));
}
if(bTrimmedEnvelopes == true)
AddToLog("WARNING: Instrument envelopes have been shortened.\n");
@@ -708,7 +708,7 @@
for (UINT j=0; j<m_SndFile.Order.size(); j++)
{
if (m_SndFile.Order[j] == i) break;
- if (m_SndFile.Order[j] == m_SndFile.Order.GetInvalidPatIndex())
+ if (m_SndFile.Order[j] == m_SndFile.Order.GetInvalidPatIndex() && nOrd == ORDERINDEX_INVALID)
{
m_SndFile.Order[j] = i;
break;
Modified: trunk/OpenMPT/soundlib/Sampleio.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sampleio.cpp 2010-03-24 19:25:32 UTC (rev 549)
+++ trunk/OpenMPT/soundlib/Sampleio.cpp 2010-03-25 22:36:06 UTC (rev 550)
@@ -47,14 +47,14 @@
bool CSoundFile::ReadSampleAsInstrument(INSTRUMENTINDEX nInstr, LPBYTE lpMemFile, DWORD dwFileLength)
//---------------------------------------------------------------------------------------------------
{
- LPDWORD psig = (LPDWORD)lpMemFile;
+ uint32 *psig = (uint32 *)lpMemFile;
if ((!lpMemFile) || (dwFileLength < 128)) return false;
- if (((psig[0] == 0x46464952) && (psig[2] == 0x45564157)) // RIFF....WAVE signature
- || ((psig[0] == 0x5453494C) && (psig[2] == 0x65766177)) // LIST....wave
- || (psig[76/4] == 0x53524353) // S3I signature
- || ((psig[0] == 0x4D524F46) && (psig[2] == 0x46464941)) // AIFF signature
- || ((psig[0] == 0x4D524F46) && (psig[2] == 0x58565338)) // 8SVX signature
- || (psig[0] == 0x53504D49) // ITS signature
+ if (((psig[0] == LittleEndian(0x46464952)) && (psig[2] == LittleEndian(0x45564157))) // RIFF....WAVE signature
+ || ((psig[0] == LittleEndian(0x5453494C)) && (psig[2] == LittleEndian(0x65766177))) // LIST....wave
+ || (psig[76/4] == LittleEndian(0x53524353)) // S3I signature
+ || ((psig[0] == LittleEndian(0x4D524F46)) && (psig[2] == LittleEndian(0x46464941))) // AIFF signature
+ || ((psig[0] == LittleEndian(0x4D524F46)) && (psig[2] == LittleEndian(0x58565338))) // 8SVX signature
+ || (psig[0] == LittleEndian(0x53504D49)) // ITS signature
)
{
// Loading Instrument
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-24 19:25:32 UTC (rev 549)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-25 22:36:06 UTC (rev 550)
@@ -140,7 +140,10 @@
// End of song ?
if ((nPattern == Order.GetInvalidPatIndex()) || (nCurrentPattern >= Order.size()))
{
- nCurrentPattern = m_nRestartPos;
+ if(nCurrentPattern == m_nRestartPos)
+ break;
+ else
+ nCurrentPattern = m_nRestartPos;
} else
{
nCurrentPattern++;
@@ -151,6 +154,9 @@
// Skip non-existing patterns
if ((nPattern >= Patterns.Size()) || (!Patterns[nPattern]))
{
+ // If there isn't even a tune, we should probably stop here.
+ if(nCurrentPattern == m_nRestartPos)
+ break;
nNextPattern = nCurrentPattern + 1;
continue;
}
Modified: trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj
===================================================================
--- trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj 2010-03-24 19:25:32 UTC (rev 549)
+++ trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj 2010-03-25 22:36:06 UTC (rev 550)
@@ -26,7 +26,7 @@
OutputDirectory="x86\ZlibStat$(ConfigurationName)"
IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
+ InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
@@ -99,7 +99,7 @@
OutputDirectory="x86\ZlibStat$(ConfigurationName)"
IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
+ InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
@@ -173,7 +173,7 @@
OutputDirectory="x86\ZlibStat$(ConfigurationName)"
IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
+ InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
@@ -762,10 +762,6 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\gzio.c"
- >
- </File>
- <File
RelativePath="..\..\..\infback.c"
>
</File>
Deleted: trunk/OpenMPT/zlib/gzio.c
===================================================================
--- trunk/OpenMPT/zlib/gzio.c 2010-03-24 19:25:32 UTC (rev 549)
+++ trunk/OpenMPT/zlib/gzio.c 2010-03-25 22:36:06 UTC (rev 550)
@@ -1,1026 +0,0 @@
-/* gzio.c -- IO on .gz files
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- *
- * Compile this file with -DNO_GZCOMPRESS to avoid the compression code.
- */
-
-/* @(#) $Id$ */
-
-#include <stdio.h>
-
-#include "zutil.h"
-
-#ifdef NO_DEFLATE /* for compatibility with old definition */
-# define NO_GZCOMPRESS
-#endif
-
-#ifndef NO_DUMMY_DECL
-struct internal_state {int dummy;}; /* for buggy compilers */
-#endif
-
-#ifndef Z_BUFSIZE
-# ifdef MAXSEG_64K
-# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
-# else
-# define Z_BUFSIZE 16384
-# endif
-#endif
-#ifndef Z_PRINTF_BUFSIZE
-# define Z_PRINTF_BUFSIZE 4096
-#endif
-
-#ifdef __MVS__
-# pragma map (fdopen , "\174\174FDOPEN")
- FILE *fdopen(int, const char *);
-#endif
-
-#ifndef STDC
-extern voidp malloc OF((uInt size));
-extern void free OF((voidpf ptr));
-#endif
-
-#define ALLOC(size) malloc(size)
-#define TRYFREE(p) {if (p) free(p);}
-
-static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
-
-/* gzip flag byte */
-#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
-#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */
-#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
-#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
-#define COMMENT 0x10 /* bit 4 set: file comment present */
-#define RESERVED 0xE0 /* bits 5..7: reserved */
-
-typedef struct gz_stream {
- z_stream stream;
- int z_err; /* error code for last stream operation */
- int z_eof; /* set if end of input file */
- FILE *file; /* .gz file */
- Byte *inbuf; /* input buffer */
- Byte *outbuf; /* output buffer */
- uLong crc; /* crc32 of uncompressed data */
- char *msg; /* error message */
- char *path; /* path name for debugging only */
- int transparent; /* 1 if input file is not a .gz file */
- char mode; /* 'w' or 'r' */
- z_off_t start; /* start of compressed data in file (header skipped) */
- z_off_t in; /* bytes into deflate or inflate */
- z_off_t out; /* bytes out of deflate or inflate */
- int back; /* one character push-back */
- int last; /* true if push-back is last character */
-} gz_stream;
-
-
-local gzFile gz_open OF((const char *path, const char *mode, int fd));
-local int do_flush OF((gzFile file, int flush));
-local int get_byte OF((gz_stream *s));
-local void check_header OF((gz_stream *s));
-local int destroy OF((gz_stream *s));
-local void putLong OF((FILE *file, uLong x));
-local uLong getLong OF((gz_stream *s));
-
-/* ===========================================================================
- Opens a gzip (.gz) file for reading or writing. The mode parameter
- is as in fopen ("rb" or "wb"). The file is given either by file descriptor
- or path name (if fd == -1).
- gz_open returns NULL if the file could not be opened or if there was
- insufficient memory to allocate the (de)compression state; errno
- can be checked to distinguish the two cases (if errno is zero, the
- zlib error is Z_MEM_ERROR).
-*/
-local gzFile gz_open (path, mode, fd)
- const char *path;
- const char *mode;
- int fd;
-{
- int err;
- int level = Z_DEFAULT_COMPRESSION; /* compression level */
- int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
- char *p = (char*)mode;
- gz_stream *s;
- char fmode[80]; /* copy of mode, without the compression level */
- char *m = fmode;
-
- if (!path || !mode) return Z_NULL;
-
- s = (gz_stream *)ALLOC(sizeof(gz_stream));
- if (!s) return Z_NULL;
-
- s->stream.zalloc = (alloc_func)0;
- s->stream.zfree = (free_func)0;
- s->stream.opaque = (voidpf)0;
- s->stream.next_in = s->inbuf = Z_NULL;
- s->stream.next_out = s->outbuf = Z_NULL;
- s->stream.avail_in = s->stream.avail_out = 0;
- s->file = NULL;
- s->z_err = Z_OK;
- s->z_eof = 0;
- s->in = 0;
- s->out = 0;
- s->back = EOF;
- s->crc = crc32(0L, Z_NULL, 0);
- s->msg = NULL;
- s->transparent = 0;
-
- s->path = (char*)ALLOC(strlen(path)+1);
- if (s->path == NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- strcpy(s->path, path); /* do this early for debugging */
-
- s->mode = '\0';
- do {
- if (*p == 'r') s->mode = 'r';
- if (*p == 'w' || *p == 'a') s->mode = 'w';
- if (*p >= '0' && *p <= '9') {
- level = *p - '0';
- } else if (*p == 'f') {
- strategy = Z_FILTERED;
- } else if (*p == 'h') {
- strategy = Z_HUFFMAN_ONLY;
- } else if (*p == 'R') {
- strategy = Z_RLE;
- } else {
- *m++ = *p; /* copy the mode */
- }
- } while (*p++ && m != fmode + sizeof(fmode));
- if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
-
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- err = Z_STREAM_ERROR;
-#else
- err = deflateInit2(&(s->stream), level,
- Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy);
- /* windowBits is passed < 0 to suppress zlib header */
-
- s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
-#endif
- if (err != Z_OK || s->outbuf == Z_NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- } else {
- s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
-
- err = inflateInit2(&(s->stream), -MAX_WBITS);
- /* windowBits is passed < 0 to tell that there is no zlib header.
- * Note that in this case inflate *requires* an extra "dummy" byte
- * after the compressed stream in order to complete decompression and
- * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
- * present after the compressed stream.
- */
- if (err != Z_OK || s->inbuf == Z_NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- }
- s->stream.avail_out = Z_BUFSIZE;
-
- errno = 0;
- s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
-
- if (s->file == NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- if (s->mode == 'w') {
- /* Write a very simple .gz header:
- */
- fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
- Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
- s->start = 10L;
- /* We use 10L instead of ftell(s->file) to because ftell causes an
- * fflush on some systems. This version of the library doesn't use
- * start anyway in write mode, so this initialization is not
- * necessary.
- */
- } else {
- check_header(s); /* skip the .gz header */
- s->start = ftell(s->file) - s->stream.avail_in;
- }
-
- return (gzFile)s;
-}
-
-/* ===========================================================================
- Opens a gzip (.gz) file for reading or writing.
-*/
-gzFile ZEXPORT gzopen (path, mode)
- const char *path;
- const char *mode;
-{
- return gz_open (path, mode, -1);
-}
-
-/* ===========================================================================
- Associate a gzFile with the file descriptor fd. fd is not dup'ed here
- to mimic the behavio(u)r of fdopen.
-*/
-gzFile ZEXPORT gzdopen (fd, mode)
- int fd;
- const char *mode;
-{
- char name[46]; /* allow for up to 128-bit integers */
-
- if (fd < 0) return (gzFile)Z_NULL;
- sprintf(name, "<fd:%d>", fd); /* for debugging */
-
- return gz_open (name, mode, fd);
-}
-
-/* ===========================================================================
- * Update the compression level and strategy
- */
-int ZEXPORT gzsetparams (file, level, strategy)
- gzFile file;
- int level;
- int strategy;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
-
- /* Make room to allow flushing */
- if (s->stream.avail_out == 0) {
-
- s->stream.next_out = s->outbuf;
- if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
- s->z_err = Z_ERRNO;
- }
- s->stream.avail_out = Z_BUFSIZE;
- }
-
- return deflateParams (&(s->stream), level, strategy);
-}
-
-/* ===========================================================================
- Read a byte from a gz_stream; update next_in and avail_in. Return EOF
- for end of file.
- IN assertion: the stream s has been sucessfully opened for reading.
-*/
-local int get_byte(s)
- gz_stream *s;
-{
- if (s->z_eof) return EOF;
- if (s->stream.avail_in == 0) {
- errno = 0;
- s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
- if (s->stream.avail_in == 0) {
- s->z_eof = 1;
- if (ferror(s->file)) s->z_err = Z_ERRNO;
- return EOF;
- }
- s->stream.next_in = s->inbuf;
- }
- s->stream.avail_in--;
- return *(s->stream.next_in)++;
-}
-
-/* ===========================================================================
- Check the gzip header of a gz_stream opened for reading. Set the stream
- mode to transparent if the gzip magic header is not present; set s->err
- to Z_DATA_ERROR if the magic header is present but the rest of the header
- is incorrect.
- IN assertion: the stream s has already been created sucessfully;
- s->stream.avail_in is zero for the first time, but may be non-zero
- for concatenated .gz files.
-*/
-local void check_header(s)
- gz_stream *s;
-{
- int method; /* method byte */
- int flags; /* flags byte */
- uInt len;
- int c;
-
- /* Assure two bytes in the buffer so we can peek ahead -- handle case
- where first byte of header is at the end of the buffer after the last
- gzip segment */
- len = s->stream.avail_in;
- if (len < 2) {
- if (len) s->inbuf[0] = s->stream.next_in[0];
- errno = 0;
- len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file);
- if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO;
- s->stream.avail_in += len;
- s->stream.next_in = s->inbuf;
- if (s->stream.avail_in < 2) {
- s->transparent = s->stream.avail_in;
- return;
- }
- }
-
- /* Peek ahead to check the gzip magic header */
- if (s->stream.next_in[0] != gz_magic[0] ||
- s->stream.next_in[1] != gz_magic[1]) {
- s->transparent = 1;
- return;
- }
- s->stream.avail_in -= 2;
- s->stream.next_in += 2;
-
- /* Check the rest of the gzip header */
- method = get_byte(s);
- flags = get_byte(s);
- if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
- s->z_err = Z_DATA_ERROR;
- return;
- }
-
- /* Discard time, xflags and OS code: */
- for (len = 0; len < 6; len++) (void)get_byte(s);
-
- if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
- len = (uInt)get_byte(s);
- len += ((uInt)get_byte(s))<<8;
- /* len is garbage if EOF but the loop below will quit anyway */
- while (len-- != 0 && get_byte(s) != EOF) ;
- }
- if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
- while ((c = get_byte(s)) != 0 && c != EOF) ;
- }
- if ((flags & COMMENT) != 0) { /* skip the .gz file comment */
- while ((c = get_byte(s)) != 0 && c != EOF) ;
- }
- if ((flags & HEAD_CRC) != 0) { /* skip the header crc */
- for (len = 0; len < 2; len++) (void)get_byte(s);
- }
- s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
-}
-
- /* ===========================================================================
- * Cleanup then free the given gz_stream. Return a zlib error code.
- Try freeing in the reverse order of allocations.
- */
-local int destroy (s)
- gz_stream *s;
-{
- int err = Z_OK;
-
- if (!s) return Z_STREAM_ERROR;
-
- TRYFREE(s->msg);
-
- if (s->stream.state != NULL) {
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- err = Z_STREAM_ERROR;
-#else
- err = deflateEnd(&(s->stream));
-#endif
- } else if (s->mode == 'r') {
- err = inflateEnd(&(s->stream));
- }
- }
- if (s->file != NULL && fclose(s->file)) {
-#ifdef ESPIPE
- if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */
-#endif
- err = Z_ERRNO;
- }
- if (s->z_err < 0) err = s->z_err;
-
- TRYFREE(s->inbuf);
- TRYFREE(s->outbuf);
- TRYFREE(s->path);
- TRYFREE(s);
- return err;
-}
-
-/* ===========================================================================
- Reads the given number of uncompressed bytes from the compressed file.
- gzread returns the number of bytes actually read (0 for end of file).
-*/
-int ZEXPORT gzread (file, buf, len)
- gzFile file;
- voidp buf;
- unsigned len;
-{
- gz_stream *s = (gz_stream*)file;
- Bytef *start = (Bytef*)buf; /* starting point for crc computation */
- Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */
-
- if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
-
- if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
- if (s->z_err == Z_STREAM_END) return 0; /* EOF */
-
- next_out = (Byte*)buf;
- s->stream.next_out = (Bytef*)buf;
- s->stream.avail_out = len;
-
- if (s->stream.avail_out && s->back != EOF) {
- *next_out++ = s->back;
- s->stream.next_out++;
- s->stream.avail_out--;
- s->back = EOF;
- s->out++;
- start++;
- if (s->last) {
- s->z_err = Z_STREAM_END;
- return 1;
- }
- }
-
- while (s->stream.avail_out != 0) {
-
- if (s->transparent) {
- /* Copy first the lookahead bytes: */
- uInt n = s->stream.avail_in;
- if (n > s->stream.avail_out) n = s->stream.avail_out;
- if (n > 0) {
- zmemcpy(s->stream.next_out, s->stream.next_in, n);
- next_out += n;
- s->stream.next_out = next_out;
- s->stream.next_in += n;
- s->stream.avail_out -= n;
- s->stream.avail_in -= n;
- }
- if (s->stream.avail_out > 0) {
- s->stream.avail_out -=
- (uInt)fread(next_out, 1, s->stream.avail_out, s->file);
- }
- len -= s->stream.avail_out;
- s->in += len;
- s->out += len;
- if (len == 0) s->z_eof = 1;
- return (int)len;
- }
- if (s->stream.avail_in == 0 && !s->z_eof) {
-
- errno = 0;
- s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
- if (s->stream.avail_in == 0) {
- s->z_eof = 1;
- if (ferror(s->file)) {
- s->z_err = Z_ERRNO;
- break;
- }
- }
- s->stream.next_in = s->inbuf;
- }
- s->in += s->stream.avail_in;
- s->out += s->stream.avail_out;
- s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
- s->in -= s->stream.avail_in;
- s->out -= s->stream.avail_out;
-
- if (s->z_err == Z_STREAM_END) {
- /* Check CRC and original size */
- s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
- start = s->stream.next_out;
-
- if (getLong(s) != s->crc) {
- s->z_err = Z_DATA_ERROR;
- } else {
- (void)getLong(s);
- /* The uncompressed length returned by above getlong() may be
- * different from s->out in case of concatenated .gz files.
- * Check for such files:
- */
- check_header(s);
- if (s->z_err == Z_OK) {
- inflateReset(&(s->stream));
- s->crc = crc32(0L, Z_NULL, 0);
- }
- }
- }
- if (s->z_err != Z_OK || s->z_eof) break;
- }
- s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
-
- if (len == s->stream.avail_out &&
- (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO))
- return -1;
- return (int)(len - s->stream.avail_out);
-}
-
-
-/* ===========================================================================
- Reads one byte from the compressed file. gzgetc returns this byte
- or -1 in case of end of file or error.
-*/
-int ZEXPORT gzgetc(file)
- gzFile file;
-{
- unsigned char c;
-
- return gzread(file, &c, 1) == 1 ? c : -1;
-}
-
-
-/* ===========================================================================
- Push one byte back onto the stream.
-*/
-int ZEXPORT gzungetc(c, file)
- int c;
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF;
- s->back = c;
- s->out--;
- s->last = (s->z_err == Z_STREAM_END);
- if (s->last) s->z_err = Z_OK;
- s->z_eof = 0;
- return c;
-}
-
-
-/* ===========================================================================
- Reads bytes from the compressed file until len-1 characters are
- read, or a newline character is read and transferred to buf, or an
- end-of-file condition is encountered. The string is then terminated
- with a null character.
- gzgets returns buf, or Z_NULL in case of error.
-
- The current implementation is not optimized at all.
-*/
-char * ZEXPORT gzgets(file, buf, len)
- gzFile file;
- char *buf;
- int len;
-{
- char *b = buf;
- if (buf == Z_NULL || len <= 0) return Z_NULL;
-
- while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
- *buf = '\0';
- return b == buf && len > 0 ? Z_NULL : b;
-}
-
-
-#ifndef NO_GZCOMPRESS
-/* ===========================================================================
- Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of bytes actually written (0 in case of error).
-*/
-int ZEXPORT gzwrite (file, buf, len)
- gzFile file;
- voidpc buf;
- unsigned len;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
-
- s->stream.next_in = (Bytef*)buf;
- s->stream.avail_in = len;
-
- while (s->stream.avail_in != 0) {
-
- if (s->stream.avail_out == 0) {
-
- s->stream.next_out = s->outbuf;
- if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
- s->z_err = Z_ERRNO;
- break;
- }
- s->stream.avail_out = Z_BUFSIZE;
- }
- s->in += s->stream.avail_in;
- s->out += s->stream.avail_out;
- s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
- s->in -= s->stream.avail_in;
- s->out -= s->stream.avail_out;
- if (s->z_err != Z_OK) break;
- }
- s->crc = crc32(s->crc, (const Bytef *)buf, len);
-
- return (int)(len - s->stream.avail_in);
-}
-
-
-/* ===========================================================================
- Converts, formats, and writes the args to the compressed file under
- control of the format string, as in fprintf. gzprintf returns the number of
- uncompressed bytes actually written (0 in case of error).
-*/
-#ifdef STDC
-#include <stdarg.h>
-
-int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
-{
- char buf[Z_PRINTF_BUFSIZE];
- va_list va;
- int len;
-
- buf[sizeof(buf) - 1] = 0;
- va_start(va, format);
-#ifdef NO_vsnprintf
-# ifdef HAS_vsprintf_void
- (void)vsprintf(buf, format, va);
- va_end(va);
- for (len = 0; len < sizeof(buf); len++)
- if (buf[len] == 0) break;
-# else
- len = vsprintf(buf, format, va);
- va_end(va);
-# endif
-#else
-# ifdef HAS_vsnprintf_void
- (void)vsnprintf(buf, sizeof(buf), format, va);
- va_end(va);
- len = strlen(buf);
-# else
- len = vsnprintf(buf, sizeof(buf), format, va);
- va_end(va);
-# endif
-#endif
- if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0)
- return 0;
- return gzwrite(file, buf, (unsigned)len);
-}
-#else /* not ANSI C */
-
-int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
- gzFile file;
- const char *format;
- int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
-{
- char buf[Z_PRINTF_BUFSIZE];
- int len;
-
- buf[sizeof(buf) - 1] = 0;
-#ifdef NO_snprintf
-# ifdef HAS_sprintf_void
- sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- for (len = 0; len < sizeof(buf); len++)
- if (buf[len] == 0) break;
-# else
- len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
-# endif
-#else
-# ifdef HAS_snprintf_void
- snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- len = strlen(buf);
-# else
- len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
-# endif
-#endif
- if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0)
- return 0;
- return gzwrite(file, buf, len);
-}
-#endif
-
-/* ===========================================================================
- Writes c, converted to an unsigned char, into the compressed file.
- gzputc returns the value that was written, or -1 in case of error.
-*/
-int ZEXPORT gzputc(file, c)
- gzFile file;
- int c;
-{
- unsigned char cc = (unsigned char) c; /* required for big endian systems */
-
- return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1;
-}
-
-
-/* ===========================================================================
- Writes the given null-terminated string to the compressed file, excluding
- the terminating null character.
- gzputs returns the number of characters written, or -1 in case of error.
-*/
-int ZEXPORT gzputs(file, s)
- gzFile file;
- const char *s;
-{
- return gzwrite(file, (char*)s, (unsigned)strlen(s));
-}
-
-
-/* ===========================================================================
- Flushes all pending output into the compressed file. The parameter
- flush is as in the deflate() function.
-*/
-local int do_flush (file, flush)
- gzFile file;
- int flush;
-{
- uInt len;
- int done = 0;
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
-
- s->stream.avail_in = 0; /* should be zero already anyway */
-
- for (;;) {
- len = Z_BUFSIZE - s->stream.avail_out;
-
- if (len != 0) {
- if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
- s->z_err = Z_ERRNO;
- return Z_ERRNO;
- }
- s->stream.next_out = s->outbuf;
- s->stream.avail_out = Z_BUFSIZE;
- }
- if (done) break;
- s->out += s->stream.avail_out;
- s->z_err = deflate(&(s->stream), flush);
- s->out -= s->stream.avail_out;
-
- /* Ignore the second of two consecutive flushes: */
- if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
-
- /* deflate has finished flushing only when it hasn't used up
- * all the available space in the output buffer:
- */
- done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
-
- if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
- }
- return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
-}
-
-int ZEXPORT gzflush (file, flush)
- gzFile file;
- int flush;
-{
- gz_stream *s = (gz_stream*)file;
- int err = do_flush (file, flush);
-
- if (err) return err;
- fflush(s->file);
- return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
-}
-#endif /* NO_GZCOMPRESS */
-
-/* ===========================================================================
- Sets the starting position for the next gzread or gzwrite on the given
- compressed file. The offset represents a number of bytes in the
- gzseek returns the resulting offset location as measured in bytes from
- the beginning of the uncompressed stream, or -1 in case of error.
- SEEK_END is not implemented, returns error.
- In this version of the library, gzseek can be extremely slow.
-*/
-z_off_t ZEXPORT gzseek (file, offset, whence)
- gzFile file;
- z_off_t offset;
- int whence;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || whence == SEEK_END ||
- s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
- return -1L;
- }
-
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- return -1L;
-#else
- if (whence == SEEK_SET) {
- offset -= s->in;
- }
- if (offset < 0) return -1L;
-
- /* At this point, offset is the number of zero bytes to write. */
- if (s->inbuf == Z_NULL) {
- s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */
- if (s->inbuf == Z_NULL) return -1L;
- zmemzero(s->inbuf, Z_BUFSIZE);
- }
- while (offset > 0) {
- uInt size = Z_BUFSIZE;
- if (offset < Z_BUFSIZE) size = (uInt)offset;
-
- size = gzwrite(file, s->inbuf, size);
- if (size == 0) return -1L;
-
- offset -= size;
- }
- return s->in;
-#endif
- }
- /* Rest of function is for reading only */
-
- /* compute absolute position */
- if (whence == SEEK_CUR) {
- offset += s->out;
- }
- if (offset < 0) return -1L;
-
- if (s->transparent) {
- /* map to fseek */
- s->back = EOF;
- s->stream.avail_in = 0;
- s->stream.next_in = s->inbuf;
- if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
-
- s->in = s->out = offset;
- return offset;
- }
-
- /* For a negative seek, rewind and use positive seek */
- if (offset >= s->out) {
- offset -= s->out;
- } else if (gzrewind(file) < 0) {
- return -1L;
- }
- /* offset is now the number of bytes to skip. */
-
- if (offset != 0 && s->outbuf == Z_NULL) {
- s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
- if (s->outbuf == Z_NULL) return -1L;
- }
- if (offset && s->back != EOF) {
- s->back = EOF;
- s->out++;
- offset--;
- if (s->last) s->z_err = Z_STREAM_END;
- }
- while (offset > 0) {
- int size = Z_BUFSIZE;
- if (offset < Z_BUFSIZE) size = (int)offset;
-
- size = gzread(file, s->outbuf, (uInt)size);
- if (size <= 0) return -1L;
- offset -= size;
- }
- return s->out;
-}
-
-/* ===========================================================================
- Rewinds input file.
-*/
-int ZEXPORT gzrewind (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'r') return -1;
-
- s->z_err = Z_OK;
- s->z_eof = 0;
- s->back = EOF;
- s->stream.avail_in = 0;
- s->stream.next_in = s->inbuf;
- s->crc = crc32(0L, Z_NULL, 0);
- if (!s->transparent) (void)inflateReset(&s->stream);
- s->in = 0;
- s->out = 0;
- return fseek(s->file, s->start, SEEK_SET);
-}
-
-/* ===========================================================================
- Returns the starting position for the next gzread or gzwrite on the
- given compressed file. This position represents a number of bytes in the
- uncompressed data stream.
-*/
-z_off_t ZEXPORT gztell (file)
- gzFile file;
-{
- return gzseek(file, 0L, SEEK_CUR);
-}
-
-/* ===========================================================================
- Returns 1 when EOF has previously been detected reading the given
- input stream, otherwise zero.
-*/
-int ZEXPORT gzeof (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- /* With concatenated compressed files that can have embedded
- * crc trailers, z_eof is no longer the only/best indicator of EOF
- * on a gz_stream. Handle end-of-stream error explicitly here.
- */
- if (s == NULL || s->mode != 'r') return 0;
- if (s->z_eof) return 1;
- return s->z_err == Z_STREAM_END;
-}
-
-/* ===========================================================================
- Returns 1 if reading and doing so transparently, otherwise zero.
-*/
-int ZEXPORT gzdirect (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'r') return 0;
- return s->transparent;
-}
-
-/* ===========================================================================
- Outputs a long in LSB order to the given file
-*/
-local void putLong (file, x)
- FILE *file;
- uLong x;
-{
- int n;
- for (n = 0; n < 4; n++) {
- fputc((int)(x & 0xff), file);
- x >>= 8;
- }
-}
-
-/* ===========================================================================
- Reads a long in LSB order from the given gz_stream. Sets z_err in case
- of error.
-*/
-local uLong getLong (s)
- gz_stream *s;
-{
- uLong x = (uLong)get_byte(s);
- int c;
-
- x += ((uLong)get_byte(s))<<8;
- x += ((uLong)get_byte(s))<<16;
- c = get_byte(s);
- if (c == EOF) s->z_err = Z_DATA_ERROR;
- x += ((uLong)c)<<24;
- return x;
-}
-
-/* ===========================================================================
- Flushes all pending output if necessary, closes the compressed file
- and deallocates all the (de)compression state.
-*/
-int ZEXPORT gzclose (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL) return Z_STREAM_ERROR;
-
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- return Z_STREAM_ERROR;
-#else
- if (do_flush (file, Z_FINISH) != Z_OK)
- return destroy((gz_stream*)file);
-
- putLong (s->file, s->crc);
- putLong (s->file, (uLong)(s->in & 0xffffffff));
-#endif
- }
- return destroy((gz_stream*)file);
-}
-
-#ifdef STDC
-# define zstrerror(errnum) strerror(errnum)
-#else
-# define zstrerror(errnum) ""
-#endif
-
-/* ===========================================================================
- Returns the error message for the last error which occurred on the
- given compressed file. errnum is set to zlib error number. If an
- error occurred in the file system and not in the compression library,
- errnum is set to Z_ERRNO and the application may consult errno
- to get the exact error code.
-*/
-const char * ZEXPORT gzerror (file, errnum)
- gzFile file;
- int *errnum;
-{
- char *m;
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL) {
- *errnum = Z_STREAM_ERROR;
- return (const char*)ERR_MSG(Z_STREAM_ERROR);
- }
- *errnum = s->z_err;
- if (*errnum == Z_OK) return (const char*)"";
-
- m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
-
- if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
-
- TRYFREE(s->msg);
- s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
- if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR);
- strcpy(s->msg, s->path);
- strcat(s->msg, ": ");
- strcat(s->msg, m);
- return (const char*)s->msg;
-}
-
-/* ===========================================================================
- Clear the error and end-of-file flags, and do the same for the real file.
-*/
-void ZEXPORT gzclearerr (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL) return;
- if (s->z_err != Z_STREAM_END) s->z_err = Z_OK;
- s->z_eof = 0;
- clearerr(s->file);
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-24 19:25:39
|
Revision: 549
http://modplug.svn.sourceforge.net/modplug/?rev=549&view=rev
Author: saga-games
Date: 2010-03-24 19:25:32 +0000 (Wed, 24 Mar 2010)
Log Message:
-----------
[Fix] MPTM Saving: A missing null pointer check crashed OpenMPT when trying to access a deleted instrument slot.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Load_it.cpp
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2010-03-24 14:27:14 UTC (rev 548)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-03-24 19:25:32 UTC (rev 549)
@@ -35,7 +35,7 @@
const INSTRUMENTINDEX iCount = sf.GetNumInstruments();
for(INSTRUMENTINDEX i = 1; i <= iCount; i++)
{
- if(sf.Instruments[i]->pTuning != 0)
+ if(sf.Instruments[i] != nullptr && sf.Instruments[i]->pTuning != 0)
return true;
}
return false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-24 14:27:24
|
Revision: 548
http://modplug.svn.sourceforge.net/modplug/?rev=548&view=rev
Author: saga-games
Date: 2010-03-24 14:27:14 +0000 (Wed, 24 Mar 2010)
Log Message:
-----------
[Imp] Installer: Copy config files from app's directory to appdata if necessary and possible.
[Fix] Installer: When autodetecting which keyboard config fits best, don't overwrite an already existing config anymore.
Modified Paths:
--------------
trunk/OpenMPT/installer/install.iss
Modified: trunk/OpenMPT/installer/install.iss
===================================================================
--- trunk/OpenMPT/installer/install.iss 2010-03-24 12:22:00 UTC (rev 547)
+++ trunk/OpenMPT/installer/install.iss 2010-03-24 14:27:14 UTC (rev 548)
@@ -99,6 +99,41 @@
[Code]
+// Copy old config files to the AppData directory, if there are any (and if the files don't exist already)
+procedure CopyConfigsToAppDataDir();
+var
+ adjustIniPath: Boolean;
+ keyFile: String;
+
+begin
+
+ // Not needed if portable mode is enabled.
+ if(IsTaskSelected('portable')) then
+ begin
+ Exit;
+ end;
+
+ // If there was an INI file with portable mode flag set, we have to reset it (or else, the mptrack.ini in %appdata% will never be used!)
+ if(IniKeyExists('Paths', 'UseAppDataDirectory', ExpandConstant('{app}\mptrack.ini'))) then
+ begin
+ DeleteIniEntry('Paths', 'UseAppDataDirectory', ExpandConstant('{app}\mptrack.ini'));
+ end;
+
+ FileCopy(ExpandConstant('{app}\mptrack.ini'), ExpandConstant('{userappdata}\OpenMPT\mptrack.ini'), true);
+ FileCopy(ExpandConstant('{app}\plugin.cache'), ExpandConstant('{userappdata}\OpenMPT\plugin.cache'), true);
+ FileCopy(ExpandConstant('{app}\mpt_intl.ini'), ExpandConstant('{userappdata}\OpenMPT\mpt_intl.ini'), true);
+ adjustIniPath := FileCopy(ExpandConstant('{app}\Keybindings.mkb'), ExpandConstant('{userappdata}\OpenMPT\Keybindings.mkb'), true);
+ adjustIniPath := adjustIniPath or FileCopy(ExpandConstant('{app}\default.mkb'), ExpandConstant('{userappdata}\OpenMPT\Keybindings.mkb'), true);
+
+ // If the keymappings moved, we might have to update the path in the INI file.
+ keyFile := GetIniString('Paths', 'Key_Config_File', '', ExpandConstant('{userappdata}\OpenMPT\mptrack.ini'));
+ if(((keyFile = ExpandConstant('{app}\Keybindings.mkb')) or (keyFile = ExpandConstant('{app}\default.mkb'))) and (adjustIniPath)) then
+ begin
+ SetIniString('Paths', 'Key_Config_File', ExpandConstant('{userappdata}\OpenMPT\Keybindings.mkb'), ExpandConstant('{userappdata}\OpenMPT\mptrack.ini'));
+ end;
+
+end;
+
procedure CurStepChanged(CurStep: TSetupStep);
var
INIFile: String;
@@ -118,6 +153,9 @@
case CurStep of
ssPostInstall:
begin
+ // Copy old config files from app's directory, if possible and necessary.
+ CopyConfigsToAppDataDir();
+
// Find a suitable keyboard layout (might not be very precise sometimes, as it's based on the UI language)
// Check http://msdn.microsoft.com/en-us/library/ms776294%28VS.85%29.aspx for the correct language codes.
keyboardFilepath := '';
@@ -138,7 +176,7 @@
end;
// Found an alternative keybinding.
- if(keyboardFilepath <> '') then
+ if((keyboardFilepath <> '') and (not IniKeyExists('Paths', 'Key_Config_File', INIFile))) then
begin
keyboardFilepath := ExpandConstant('{app}\extraKeymaps\' + keyboardFilepath + '.mkb');
SetIniString('Paths', 'Key_Config_File', keyboardFilepath, INIFile);
@@ -196,6 +234,3 @@
end;
end;
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-24 12:22:10
|
Revision: 547
http://modplug.svn.sourceforge.net/modplug/?rev=547&view=rev
Author: saga-games
Date: 2010-03-24 12:22:00 +0000 (Wed, 24 Mar 2010)
Log Message:
-----------
[Mod] Updated zlib to version 1.2.4; added VC10 project that comes with the zlib package (not tested if the project it works or anything, since I don't have VC10 yet)
Modified Paths:
--------------
trunk/OpenMPT/zlib/ChangeLog
trunk/OpenMPT/zlib/FAQ
trunk/OpenMPT/zlib/INDEX
trunk/OpenMPT/zlib/Makefile
trunk/OpenMPT/zlib/Makefile.in
trunk/OpenMPT/zlib/README
trunk/OpenMPT/zlib/adler32.c
trunk/OpenMPT/zlib/compress.c
trunk/OpenMPT/zlib/configure
trunk/OpenMPT/zlib/contrib/masmx64/gvmat64.asm
trunk/OpenMPT/zlib/contrib/masmx64/inffas8664.c
trunk/OpenMPT/zlib/contrib/masmx64/inffasx64.asm
trunk/OpenMPT/zlib/contrib/masmx64/readme.txt
trunk/OpenMPT/zlib/contrib/masmx86/bld_ml32.bat
trunk/OpenMPT/zlib/contrib/masmx86/inffas32.asm
trunk/OpenMPT/zlib/contrib/masmx86/readme.txt
trunk/OpenMPT/zlib/contrib/minizip/crypt.h
trunk/OpenMPT/zlib/contrib/minizip/ioapi.c
trunk/OpenMPT/zlib/contrib/minizip/ioapi.h
trunk/OpenMPT/zlib/contrib/minizip/iowin32.c
trunk/OpenMPT/zlib/contrib/minizip/iowin32.h
trunk/OpenMPT/zlib/contrib/minizip/miniunz.c
trunk/OpenMPT/zlib/contrib/minizip/minizip.c
trunk/OpenMPT/zlib/contrib/minizip/mztools.c
trunk/OpenMPT/zlib/contrib/minizip/mztools.h
trunk/OpenMPT/zlib/contrib/minizip/unzip.c
trunk/OpenMPT/zlib/contrib/minizip/unzip.h
trunk/OpenMPT/zlib/contrib/minizip/zip.c
trunk/OpenMPT/zlib/contrib/minizip/zip.h
trunk/OpenMPT/zlib/crc32.c
trunk/OpenMPT/zlib/deflate.c
trunk/OpenMPT/zlib/deflate.h
trunk/OpenMPT/zlib/example.c
trunk/OpenMPT/zlib/infback.c
trunk/OpenMPT/zlib/inffast.c
trunk/OpenMPT/zlib/inflate.c
trunk/OpenMPT/zlib/inflate.h
trunk/OpenMPT/zlib/inftrees.c
trunk/OpenMPT/zlib/inftrees.h
trunk/OpenMPT/zlib/minigzip.c
trunk/OpenMPT/zlib/trees.c
trunk/OpenMPT/zlib/uncompr.c
trunk/OpenMPT/zlib/zconf.h
trunk/OpenMPT/zlib/zlib.h
trunk/OpenMPT/zlib/zutil.c
trunk/OpenMPT/zlib/zutil.h
Added Paths:
-----------
trunk/OpenMPT/zlib/contrib/vstudio/vc10/
trunk/OpenMPT/zlib/contrib/vstudio/vc10/miniunz.vcxproj
trunk/OpenMPT/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters
trunk/OpenMPT/zlib/contrib/vstudio/vc10/miniunz.vcxproj.user
trunk/OpenMPT/zlib/contrib/vstudio/vc10/minizip.vcxproj
trunk/OpenMPT/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters
trunk/OpenMPT/zlib/contrib/vstudio/vc10/minizip.vcxproj.user
trunk/OpenMPT/zlib/contrib/vstudio/vc10/testzlib.vcxproj
trunk/OpenMPT/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters
trunk/OpenMPT/zlib/contrib/vstudio/vc10/testzlib.vcxproj.user
trunk/OpenMPT/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj
trunk/OpenMPT/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters
trunk/OpenMPT/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.user
trunk/OpenMPT/zlib/contrib/vstudio/vc10/zlib.rc
trunk/OpenMPT/zlib/contrib/vstudio/vc10/zlibstat.vcxproj
trunk/OpenMPT/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters
trunk/OpenMPT/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.user
trunk/OpenMPT/zlib/contrib/vstudio/vc10/zlibvc.def
trunk/OpenMPT/zlib/contrib/vstudio/vc10/zlibvc.sln
trunk/OpenMPT/zlib/contrib/vstudio/vc10/zlibvc.vcxproj
trunk/OpenMPT/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters
trunk/OpenMPT/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.user
Modified: trunk/OpenMPT/zlib/ChangeLog
===================================================================
--- trunk/OpenMPT/zlib/ChangeLog 2010-03-23 17:44:41 UTC (rev 546)
+++ trunk/OpenMPT/zlib/ChangeLog 2010-03-24 12:22:00 UTC (rev 547)
@@ -1,6 +1,281 @@
ChangeLog file for zlib
+Changes in 1.2.4 (14 Mar 2010)
+- Fix VER3 extraction in configure for no fourth subversion
+- Update zlib.3, add docs to Makefile.in to make .pdf out of it
+- Add zlib.3.pdf to distribution
+- Don't set error code in gzerror() if passed pointer is NULL
+- Apply destination directory fixes to CMakeLists.txt [Lowman]
+- Move #cmakedefine's to a new zconf.in.cmakein
+- Restore zconf.h for builds that don't use configure or cmake
+- Add distclean to dummy Makefile for convenience
+- Update and improve INDEX, README, and FAQ
+- Update CMakeLists.txt for the return of zconf.h [Lowman]
+- Update contrib/vstudio/vc9 and vc10 [Vollant]
+- Change libz.dll.a back to libzdll.a in win32/Makefile.gcc
+- Apply license and readme changes to contrib/asm686 [Raiter]
+- Check file name lengths and add -c option in minigzip.c [Li]
+- Update contrib/amd64 and contrib/masmx86/ [Vollant]
+- Avoid use of "eof" parameter in trees.c to not shadow library variable
+- Update make_vms.com for removal of zlibdefs.h [Zinser]
+- Update assembler code and vstudio projects in contrib [Vollant]
+- Remove outdated assembler code contrib/masm686 and contrib/asm586
+- Remove old vc7 and vc8 from contrib/vstudio
+- Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe]
+- Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open()
+- Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant]
+- Remove *64 functions from win32/zlib.def (they're not 64-bit yet)
+- Fix bug in void-returning vsprintf() case in gzwrite.c
+- Fix name change from inflate.h in contrib/inflate86/inffas86.c
+- Check if temporary file exists before removing in make_vms.com [Zinser]
+- Fix make install and uninstall for --static option
+- Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta]
+- Update readme.txt in contrib/masmx64 and masmx86 to assemble
+
+Changes in 1.2.3.9 (21 Feb 2010)
+- Expunge gzio.c
+- Move as400 build information to old
+- Fix updates in contrib/minizip and contrib/vstudio
+- Add const to vsnprintf test in configure to avoid warnings [Weigelt]
+- Delete zconf.h (made by configure) [Weigelt]
+- Change zconf.in.h to zconf.h.in per convention [Weigelt]
+- Check for NULL buf in gzgets()
+- Return empty string for gzgets() with len == 1 (like fgets())
+- Fix description of gzgets() in zlib.h for end-of-file, NULL return
+- Update minizip to 1.1 [Vollant]
+- Avoid MSVC loss of data warnings in gzread.c, gzwrite.c
+- Note in zlib.h that gzerror() should be used to distinguish from EOF
+- Remove use of snprintf() from gzlib.c
+- Fix bug in gzseek()
+- Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant]
+- Fix zconf.h generation in CMakeLists.txt [Lowman]
+- Improve comments in zconf.h where modified by configure
+
+Changes in 1.2.3.8 (13 Feb 2010)
+- Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer]
+- Use z_off64_t in gz_zero() and gz_skip() to match state->skip
+- Avoid comparison problem when sizeof(int) == sizeof(z_off64_t)
+- Revert to Makefile.in from 1.2.3.6 (live with the clutter)
+- Fix missing error return in gzflush(), add zlib.h note
+- Add *64 functions to zlib.map [Levin]
+- Fix signed/unsigned comparison in gz_comp()
+- Use SFLAGS when testing shared linking in configure
+- Add --64 option to ./configure to use -m64 with gcc
+- Fix ./configure --help to correctly name options
+- Have make fail if a test fails [Levin]
+- Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson]
+- Remove assembler object files from contrib
+
+Changes in 1.2.3.7 (24 Jan 2010)
+- Always gzopen() with O_LARGEFILE if available
+- Fix gzdirect() to work immediately after gzopen() or gzdopen()
+- Make gzdirect() more precise when the state changes while reading
+- Improve zlib.h documentation in many places
+- Catch memory allocation failure in gz_open()
+- Complete close operation if seek forward in gzclose_w() fails
+- Return Z_ERRNO from gzclose_r() if close() fails
+- Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL
+- Return zero for gzwrite() errors to match zlib.h description
+- Return -1 on gzputs() error to match zlib.h description
+- Add zconf.in.h to allow recovery from configure modification [Weigelt]
+- Fix static library permissions in Makefile.in [Weigelt]
+- Avoid warnings in configure tests that hide functionality [Weigelt]
+- Add *BSD and DragonFly to Linux case in configure [gentoo 123571]
+- Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212]
+- Avoid access of uninitialized data for first inflateReset2 call [Gomes]
+- Keep object files in subdirectories to reduce the clutter somewhat
+- Remove default Makefile and zlibdefs.h, add dummy Makefile
+- Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_
+- Remove zlibdefs.h completely -- modify zconf.h instead
+
+Changes in 1.2.3.6 (17 Jan 2010)
+- Avoid void * arithmetic in gzread.c and gzwrite.c
+- Make compilers happier with const char * for gz_error message
+- Avoid unused parameter warning in inflate.c
+- Avoid signed-unsigned comparison warning in inflate.c
+- Indent #pragma's for traditional C
+- Fix usage of strwinerror() in glib.c, change to gz_strwinerror()
+- Correct email address in configure for system options
+- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser]
+- Update zlib.map [Brown]
+- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [T\x9Ar\x9Ak]
+- Apply various fixes to CMakeLists.txt [Lowman]
+- Add checks on len in gzread() and gzwrite()
+- Add error message for no more room for gzungetc()
+- Remove zlib version check in gzwrite()
+- Defer compression of gzprintf() result until need to
+- Use snprintf() in gzdopen() if available
+- Remove USE_MMAP configuration determination (only used by minigzip)
+- Remove examples/pigz.c (available separately)
+- Update examples/gun.c to 1.6
+
+Changes in 1.2.3.5 (8 Jan 2010)
+- Add space after #if in zutil.h for some compilers
+- Fix relatively harmless bug in deflate_fast() [Exarevsky]
+- Fix same problem in deflate_slow()
+- Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown]
+- Add deflate_rle() for faster Z_RLE strategy run-length encoding
+- Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding
+- Change name of "write" variable in inffast.c to avoid library collisions
+- Fix premature EOF from gzread() in gzio.c [Brown]
+- Use zlib header window size if windowBits is 0 in inflateInit2()
+- Remove compressBound() call in deflate.c to avoid linking compress.o
+- Replace use of errno in gz* with functions, support WinCE [Alves]
+- Provide alternative to perror() in minigzip.c for WinCE [Alves]
+- Don't use _vsnprintf on later versions of MSVC [Lowman]
+- Add CMake build script and input file [Lowman]
+- Update contrib/minizip to 1.1 [Svensson, Vollant]
+- Moved nintendods directory from contrib to .
+- Replace gzio.c with a new set of routines with the same functionality
+- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above
+- Update contrib/minizip to 1.1b
+- Change gzeof() to return 0 on error instead of -1 to agree with zlib.h
+
+Changes in 1.2.3.4 (21 Dec 2009)
+- Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility
+- Update comments in configure and Makefile.in for default --shared
+- Fix test -z's in configure [Marquess]
+- Build examplesh and minigzipsh when not testing
+- Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h
+- Import LDFLAGS from the environment in configure
+- Fix configure to populate SFLAGS with discovered CFLAGS options
+- Adapt make_vms.com to the new Makefile.in [Zinser]
+- Add zlib2ansi script for C++ compilation [Marquess]
+- Add _FILE_OFFSET_BITS=64 test to make test (when applicable)
+- Add AMD64 assembler code for longest match to contrib [Teterin]
+- Include options from $SFLAGS when doing $LDSHARED
+- Simplify 64-bit file support by introducing z_off64_t type
+- Make shared object files in objs directory to work around old Sun cc
+- Use only three-part version number for Darwin shared compiles
+- Add rc option to ar in Makefile.in for when ./configure not run
+- Add -WI,-rpath,. to LDFLAGS for OSF 1 V4*
+- Set LD_LIBRARYN32_PATH for SGI IRIX shared compile
+- Protect against _FILE_OFFSET_BITS being defined when compiling zlib
+- Rename Makefile.in targets allstatic to static and allshared to shared
+- Fix static and shared Makefile.in targets to be independent
+- Correct error return bug in gz_open() by setting state [Brown]
+- Put spaces before ;;'s in configure for better sh compatibility
+- Add pigz.c (parallel implementation of gzip) to examples/
+- Correct constant in crc32.c to UL [Leventhal]
+- Reject negative lengths in crc32_combine()
+- Add inflateReset2() function to work like inflateEnd()/inflateInit2()
+- Include sys/types.h for _LARGEFILE64_SOURCE [Brown]
+- Correct typo in doc/algorithm.txt [Janik]
+- Fix bug in adler32_combine() [Zhu]
+- Catch missing-end-of-block-code error in all inflates and in puff
+ Assures that random input to inflate eventually results in an error
+- Added enough.c (calculation of ENOUGH for inftrees.h) to examples/
+- Update ENOUGH and its usage to reflect discovered bounds
+- Fix gzerror() error report on empty input file [Brown]
+- Add ush casts in trees.c to avoid pedantic runtime errors
+- Fix typo in zlib.h uncompress() description [Reiss]
+- Correct inflate() comments with regard to automatic header detection
+- Remove deprecation comment on Z_PARTIAL_FLUSH (it stays)
+- Put new version of gzlog (2.0) in examples with interruption recovery
+- Add puff compile option to permit invalid distance-too-far streams
+- Add puff TEST command options, ability to read piped input
+- Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but
+ _LARGEFILE64_SOURCE not defined
+- Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart
+- Fix deflateSetDictionary() to use all 32K for output consistency
+- Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h)
+- Clear bytes after deflate lookahead to avoid use of uninitialized data
+- Change a limit in inftrees.c to be more transparent to Coverity Prevent
+- Update win32/zlib.def with exported symbols from zlib.h
+- Correct spelling error in zlib.h [Willem]
+- Allow Z_BLOCK for deflate() to force a new block
+- Allow negative bits in inflatePrime() to delete existing bit buffer
+- Add Z_TREES flush option to inflate() to return at end of trees
+- Add inflateMark() to return current state information for random access
+- Add Makefile for NintendoDS to contrib [Costa]
+- Add -w in configure compile tests to avoid spurious warnings [Beucler]
+- Fix typos in zlib.h comments for deflateSetDictionary()
+- Fix EOF detection in transparent gzread() [Maier]
+
+Changes in 1.2.3.3 (2 October 2006)
+- Make --shared the default for configure, add a --static option
+- Add compile option to permit invalid distance-too-far streams
+- Add inflateUndermine() function which is required to enable above
+- Remove use of "this" variable name for C++ compatibility [Marquess]
+- Add testing of shared library in make test, if shared library built
+- Use ftello() and fseeko() if available instead of ftell() and fseek()
+- Provide two versions of all functions that use the z_off_t type for
+ binary compatibility -- a normal version and a 64-bit offset version,
+ per the Large File Support Extension when _LARGEFILE64_SOURCE is
+ defined; use the 64-bit versions by default when _FILE_OFFSET_BITS
+ is defined to be 64
+- Add a --uname= option to configure to perhaps help with cross-compiling
+
+Changes in 1.2.3.2 (3 September 2006)
+- Turn off silly Borland warnings [Hay]
+- Use off64_t and define _LARGEFILE64_SOURCE when present
+- Fix missing dependency on inffixed.h in Makefile.in
+- Rig configure --shared to build both shared and static [Teredesai, Truta]
+- Remove zconf.in.h and instead create a new zlibdefs.h file
+- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant]
+- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt]
+
+Changes in 1.2.3.1 (16 August 2006)
+- Add watcom directory with OpenWatcom make files [Daniel]
+- Remove #undef of FAR in zconf.in.h for MVS [Fedtke]
+- Update make_vms.com [Zinser]
+- Use -fPIC for shared build in configure [Teredesai, Nicholson]
+- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen]
+- Use fdopen() (not _fdopen()) for Interix in zutil.h [B\x8Ack]
+- Add some FAQ entries about the contrib directory
+- Update the MVS question in the FAQ
+- Avoid extraneous reads after EOF in gzio.c [Brown]
+- Correct spelling of "successfully" in gzio.c [Randers-Pehrson]
+- Add comments to zlib.h about gzerror() usage [Brown]
+- Set extra flags in gzip header in gzopen() like deflate() does
+- Make configure options more compatible with double-dash conventions
+ [Weigelt]
+- Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen]
+- Fix uninstall target in Makefile.in [Truta]
+- Add pkgconfig support [Weigelt]
+- Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt]
+- Replace set_data_type() with a more accurate detect_data_type() in
+ trees.c, according to the txtvsbin.txt document [Truta]
+- Swap the order of #include <stdio.h> and #include "zlib.h" in
+ gzio.c, example.c and minigzip.c [Truta]
+- Shut up annoying VS2005 warnings about standard C deprecation [Rowe,
+ Truta] (where?)
+- Fix target "clean" from win32/Makefile.bor [Truta]
+- Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe]
+- Update zlib www home address in win32/DLL_FAQ.txt [Truta]
+- Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove]
+- Enable browse info in the "Debug" and "ASM Debug" configurations in
+ the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta]
+- Add pkgconfig support [Weigelt]
+- Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h,
+ for use in win32/zlib1.rc [Polushin, Rowe, Truta]
+- Add a document that explains the new text detection scheme to
+ doc/txtvsbin.txt [Truta]
+- Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta]
+- Move algorithm.txt into doc/ [Truta]
+- Synchronize FAQ with website
+- Fix compressBound(), was low for some pathological cases [Fearnley]
+- Take into account wrapper variations in deflateBound()
+- Set examples/zpipe.c input and output to binary mode for Windows
+- Update examples/zlib_how.html with new zpipe.c (also web site)
+- Fix some warnings in examples/gzlog.c and examples/zran.c (it seems
+ that gcc became pickier in 4.0)
+- Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain
+ un-versioned, the patch adds versioning only for symbols introduced in
+ zlib-1.2.0 or later. It also declares as local those symbols which are
+ not designed to be exported." [Levin]
+- Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure
+- Do not initialize global static by default in trees.c, add a response
+ NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess]
+- Don't use strerror() in gzio.c under WinCE [Yakimov]
+- Don't use errno.h in zutil.h under WinCE [Yakimov]
+- Move arguments for AR to its usage to allow replacing ar [Marot]
+- Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson]
+- Improve inflateInit() and inflateInit2() documentation
+- Fix structure size comment in inflate.h
+- Change configure help option from --h* to --help [Santos]
+
Changes in 1.2.3 (18 July 2005)
- Apply security vulnerability fixes to contrib/infback9 as well
- Clean up some text files (carriage returns, trailing space)
@@ -13,7 +288,7 @@
compile
- Fix some spelling errors in comments [Betts]
- Correct inflateInit2() error return documentation in zlib.h
-- Added zran.c example of compressed data random access to examples
+- Add zran.c example of compressed data random access to examples
directory, shows use of inflatePrime()
- Fix cast for assignments to strm->state in inflate.c and infback.c
- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
Modified: trunk/OpenMPT/zlib/FAQ
===================================================================
--- trunk/OpenMPT/zlib/FAQ 2010-03-23 17:44:41 UTC (rev 546)
+++ trunk/OpenMPT/zlib/FAQ 2010-03-24 12:22:00 UTC (rev 547)
@@ -3,8 +3,8 @@
If your question is not there, please check the zlib home page
-http://www.zlib.org which may have more recent information.
-The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
+http://zlib.net/ which may have more recent information.
+The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
1. Is zlib Y2K-compliant?
@@ -13,54 +13,51 @@
2. Where can I get a Windows DLL version?
- The zlib sources can be compiled without change to produce a DLL.
- See the file win32/DLL_FAQ.txt in the zlib distribution.
- Pointers to the precompiled DLL are found in the zlib web site at
- http://www.zlib.org.
+ The zlib sources can be compiled without change to produce a DLL. See the
+ file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the
+ precompiled DLL are found in the zlib web site at http://zlib.net/ .
3. Where can I get a Visual Basic interface to zlib?
See
- * http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm
- * contrib/visual-basic.txt in the zlib distribution
+ * http://marknelson.us/1997/01/01/zlib-engine/
* win32/DLL_FAQ.txt in the zlib distribution
4. compress() returns Z_BUF_ERROR.
- Make sure that before the call of compress, the length of the compressed
- buffer is equal to the total size of the compressed buffer and not
- zero. For Visual Basic, check that this parameter is passed by reference
+ Make sure that before the call of compress(), the length of the compressed
+ buffer is equal to the available size of the compressed buffer and not
+ zero. For Visual Basic, check that this parameter is passed by reference
("as any"), not by value ("as long").
5. deflate() or inflate() returns Z_BUF_ERROR.
- Before making the call, make sure that avail_in and avail_out are not
- zero. When setting the parameter flush equal to Z_FINISH, also make sure
- that avail_out is big enough to allow processing all pending input.
- Note that a Z_BUF_ERROR is not fatal--another call to deflate() or
- inflate() can be made with more input or output space. A Z_BUF_ERROR
- may in fact be unavoidable depending on how the functions are used, since
- it is not possible to tell whether or not there is more output pending
- when strm.avail_out returns with zero.
+ Before making the call, make sure that avail_in and avail_out are not zero.
+ When setting the parameter flush equal to Z_FINISH, also make sure that
+ avail_out is big enough to allow processing all pending input. Note that a
+ Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be
+ made with more input or output space. A Z_BUF_ERROR may in fact be
+ unavoidable depending on how the functions are used, since it is not
+ possible to tell whether or not there is more output pending when
+ strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a
+ heavily annotated example.
6. Where's the zlib documentation (man pages, etc.)?
- It's in zlib.h for the moment, and Francis S. Lin has converted it to a
- web page zlib.html. Volunteers to transform this to Unix-style man pages,
- please contact us (zl...@gz...). Examples of zlib usage are in the files
- example.c and minigzip.c.
+ It's in zlib.h . Examples of zlib usage are in the files example.c and
+ minigzip.c, with more in examples/ .
7. Why don't you use GNU autoconf or libtool or ...?
- Because we would like to keep zlib as a very small and simple
- package. zlib is rather portable and doesn't need much configuration.
+ Because we would like to keep zlib as a very small and simple package.
+ zlib is rather portable and doesn't need much configuration.
8. I found a bug in zlib.
- Most of the time, such problems are due to an incorrect usage of
- zlib. Please try to reproduce the problem with a small program and send
- the corresponding source to us at zl...@gz... . Do not send
- multi-megabyte data files without prior agreement.
+ Most of the time, such problems are due to an incorrect usage of zlib.
+ Please try to reproduce the problem with a small program and send the
+ corresponding source to us at zl...@gz... . Do not send multi-megabyte
+ data files without prior agreement.
9. Why do I get "undefined reference to gzputc"?
@@ -82,7 +79,7 @@
12. Can zlib handle .Z files?
- No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt
+ No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt
the code of uncompress on your own.
13. How can I make a Unix shared library?
@@ -99,8 +96,10 @@
However, many flavors of Unix come with a shared zlib already installed.
Before going to the trouble of compiling a shared version of zlib and
- trying to install it, you may want to check if it's already there! If you
- can #include <zlib.h>, it's there. The -lz option will probably link to it.
+ trying to install it, you may want to check if it's already there! If you
+ can #include <zlib.h>, it's there. The -lz option will probably link to
+ it. You can check the version at the top of zlib.h or with the
+ ZLIB_VERSION symbol defined in zlib.h .
15. I have a question about OttoPDF.
@@ -109,8 +108,8 @@
16. Can zlib decode Flate data in an Adobe PDF file?
- Yes. See http://www.fastio.com/ (ClibPDF), or http://www.pdflib.com/ .
- To modify PDF forms, see http://sourceforge.net/projects/acroformtool/ .
+ Yes. See http://www.pdflib.com/ . To modify PDF forms, see
+ http://sourceforge.net/projects/acroformtool/ .
17. Why am I getting this "register_frame_info not found" error on Solaris?
@@ -121,67 +120,67 @@
symbol __register_frame_info: referenced symbol not found
The symbol __register_frame_info is not part of zlib, it is generated by
- the C compiler (cc or gcc). You must recompile applications using zlib
- which have this problem. This problem is specific to Solaris. See
+ the C compiler (cc or gcc). You must recompile applications using zlib
+ which have this problem. This problem is specific to Solaris. See
http://www.sunfreeware.com for Solaris versions of zlib and applications
using zlib.
18. Why does gzip give an error on a file I make with compress/deflate?
The compress and deflate functions produce data in the zlib format, which
- is different and incompatible with the gzip format. The gz* functions in
- zlib on the other hand use the gzip format. Both the zlib and gzip
- formats use the same compressed data format internally, but have different
- headers and trailers around the compressed data.
+ is different and incompatible with the gzip format. The gz* functions in
+ zlib on the other hand use the gzip format. Both the zlib and gzip formats
+ use the same compressed data format internally, but have different headers
+ and trailers around the compressed data.
19. Ok, so why are there two different formats?
- The gzip format was designed to retain the directory information about
- a single file, such as the name and last modification date. The zlib
- format on the other hand was designed for in-memory and communication
- channel applications, and has a much more compact header and trailer and
- uses a faster integrity check than gzip.
+ The gzip format was designed to retain the directory information about a
+ single file, such as the name and last modification date. The zlib format
+ on the other hand was designed for in-memory and communication channel
+ applications, and has a much more compact header and trailer and uses a
+ faster integrity check than gzip.
20. Well that's nice, but how do I make a gzip file in memory?
You can request that deflate write the gzip format instead of the zlib
- format using deflateInit2(). You can also request that inflate decode
- the gzip format using inflateInit2(). Read zlib.h for more details.
+ format using deflateInit2(). You can also request that inflate decode the
+ gzip format using inflateInit2(). Read zlib.h for more details.
21. Is zlib thread-safe?
- Yes. However any library routines that zlib uses and any application-
- provided memory allocation routines must also be thread-safe. zlib's gz*
+ Yes. However any library routines that zlib uses and any application-
+ provided memory allocation routines must also be thread-safe. zlib's gz*
functions use stdio library routines, and most of zlib's functions use the
- library memory allocation routines by default. zlib's Init functions allow
- for the application to provide custom memory allocation routines.
+ library memory allocation routines by default. zlib's *Init* functions
+ allow for the application to provide custom memory allocation routines.
Of course, you should only operate on any given zlib or gzip stream from a
single thread at a time.
22. Can I use zlib in my commercial application?
- Yes. Please read the license in zlib.h.
+ Yes. Please read the license in zlib.h.
23. Is zlib under the GNU license?
- No. Please read the license in zlib.h.
+ No. Please read the license in zlib.h.
24. The license says that altered source versions must be "plainly marked". So
what exactly do I need to do to meet that requirement?
- You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
+ You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
particular, the final version number needs to be changed to "f", and an
- identification string should be appended to ZLIB_VERSION. Version numbers
+ identification string should be appended to ZLIB_VERSION. Version numbers
x.x.x.f are reserved for modifications to zlib by others than the zlib
- maintainers. For example, if the version of the base zlib you are altering
+ maintainers. For example, if the version of the base zlib you are altering
is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
- ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
+ ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
update the version strings in deflate.c and inftrees.c.
For altered source distributions, you should also note the origin and
nature of the changes in zlib.h, as well as in ChangeLog and README, along
- with the dates of the alterations. The origin should include at least your
+ with the dates of the alterations. The origin should include at least your
name (or your company's name), and an email address to contact for help or
issues with the library.
@@ -197,105 +196,112 @@
26. Will zlib work on a 64-bit machine?
- It should. It has been tested on 64-bit machines, and has no dependence
- on any data types being limited to 32-bits in length. If you have any
+ Yes. It has been tested on 64-bit machines, and has no dependence on any
+ data types being limited to 32-bits in length. If you have any
difficulties, please provide a complete problem report to zl...@gz...
27. Will zlib decompress data from the PKWare Data Compression Library?
- No. The PKWare DCL uses a completely different compressed data format
- than does PKZIP and zlib. However, you can look in zlib's contrib/blast
+ No. The PKWare DCL uses a completely different compressed data format than
+ does PKZIP and zlib. However, you can look in zlib's contrib/blast
directory for a possible solution to your problem.
28. Can I access data randomly in a compressed stream?
- No, not without some preparation. If when compressing you periodically
- use Z_FULL_FLUSH, carefully write all the pending data at those points,
- and keep an index of those locations, then you can start decompression
- at those points. You have to be careful to not use Z_FULL_FLUSH too
- often, since it can significantly degrade compression.
+ No, not without some preparation. If when compressing you periodically use
+ Z_FULL_FLUSH, carefully write all the pending data at those points, and
+ keep an index of those locations, then you can start decompression at those
+ points. You have to be careful to not use Z_FULL_FLUSH too often, since it
+ can significantly degrade compression. Alternatively, you can scan a
+ deflate stream once to generate an index, and then use that index for
+ random access. See examples/zran.c .
29. Does zlib work on MVS, OS/390, CICS, etc.?
- We don't know for sure. We have heard occasional reports of success on
- these systems. If you do use it on one of these, please provide us with
- a report, instructions, and patches that we can reference when we get
- these questions. Thanks.
+ It has in the past, but we have not heard of any recent evidence. There
+ were working ports of zlib 1.1.4 to MVS, but those links no longer work.
+ If you know of recent, successful applications of zlib on these operating
+ systems, please let us know. Thanks.
-30. Is there some simpler, easier to read version of inflate I can look at
- to understand the deflate format?
+30. Is there some simpler, easier to read version of inflate I can look at to
+ understand the deflate format?
- First off, you should read RFC 1951. Second, yes. Look in zlib's
+ First off, you should read RFC 1951. Second, yes. Look in zlib's
contrib/puff directory.
31. Does zlib infringe on any patents?
- As far as we know, no. In fact, that was originally the whole point behind
- zlib. Look here for some more information:
+ As far as we know, no. In fact, that was originally the whole point behind
+ zlib. Look here for some more information:
http://www.gzip.org/#faq11
32. Can zlib work with greater than 4 GB of data?
- Yes. inflate() and deflate() will process any amount of data correctly.
+ Yes. inflate() and deflate() will process any amount of data correctly.
Each call of inflate() or deflate() is limited to input and output chunks
of the maximum value that can be stored in the compiler's "unsigned int"
- type, but there is no limit to the number of chunks. Note however that the
- strm.total_in and strm_total_out counters may be limited to 4 GB. These
+ type, but there is no limit to the number of chunks. Note however that the
+ strm.total_in and strm_total_out counters may be limited to 4 GB. These
counters are provided as a convenience and are not used internally by
- inflate() or deflate(). The application can easily set up its own counters
+ inflate() or deflate(). The application can easily set up its own counters
updated after each call of inflate() or deflate() to count beyond 4 GB.
compress() and uncompress() may be limited to 4 GB, since they operate in a
- single call. gzseek() and gztell() may be limited to 4 GB depending on how
- zlib is compiled. See the zlibCompileFlags() function in zlib.h.
+ single call. gzseek() and gztell() may be limited to 4 GB depending on how
+ zlib is compiled. See the zlibCompileFlags() function in zlib.h.
- The word "may" appears several times above since there is a 4 GB limit
- only if the compiler's "long" type is 32 bits. If the compiler's "long"
- type is 64 bits, then the limit is 16 exabytes.
+ The word "may" appears several times above since there is a 4 GB limit only
+ if the compiler's "long" type is 32 bits. If the compiler's "long" type is
+ 64 bits, then the limit is 16 exabytes.
33. Does zlib have any security vulnerabilities?
- The only one that we are aware of is potentially in gzprintf(). If zlib
- is compiled to use sprintf() or vsprintf(), then there is no protection
- against a buffer overflow of a 4K string space, other than the caller of
- gzprintf() assuring that the output will not exceed 4K. On the other
- hand, if zlib is compiled to use snprintf() or vsnprintf(), which should
- normally be the case, then there is no vulnerability. The ./configure
- script will display warnings if an insecure variation of sprintf() will
- be used by gzprintf(). Also the zlibCompileFlags() function will return
- information on what variant of sprintf() is used by gzprintf().
+ The only one that we are aware of is potentially in gzprintf(). If zlib is
+ compiled to use sprintf() or vsprintf(), then there is no protection
+ against a buffer overflow of an 8K string space (or other value as set by
+ gzbuffer()), other than the caller of gzprintf() assuring that the output
+ will not exceed 8K. On the other hand, if zlib is compiled to use
+ snprintf() or vsnprintf(), which should normally be the case, then there is
+ no vulnerability. The ./configure script will display warnings if an
+ insecure variation of sprintf() will be used by gzprintf(). Also the
+ zlibCompileFlags() function will return information on what variant of
+ sprintf() is used by gzprintf().
If you don't have snprintf() or vsnprintf() and would like one, you can
find a portable implementation here:
http://www.ijs.si/software/snprintf/
- Note that you should be using the most recent version of zlib. Versions
- 1.1.3 and before were subject to a double-free vulnerability.
+ Note that you should be using the most recent version of zlib. Versions
+ 1.1.3 and before were subject to a double-free vulnerability, and versions
+ 1.2.1 and 1.2.2 were subject to an access exception when decompressing
+ invalid compressed data.
34. Is there a Java version of zlib?
Probably what you want is to use zlib in Java. zlib is already included
as part of the Java SDK in the java.util.zip package. If you really want
a version of zlib written in the Java language, look on the zlib home
- page for links: http://www.zlib.org/
+ page for links: http://zlib.net/ .
35. I get this or that compiler or source-code scanner warning when I crank it
up to maximally-pedantic. Can't you guys write proper code?
Many years ago, we gave up attempting to avoid warnings on every compiler
- in the universe. It just got to be a waste of time, and some compilers
- were downright silly. So now, we simply make sure that the code always
- works.
+ in the universe. It just got to be a waste of time, and some compilers
+ were downright silly as well as contradicted each other. So now, we simply
+ make sure that the code always works.
36. Valgrind (or some similar memory access checker) says that deflate is
performing a conditional jump that depends on an uninitialized value.
Isn't that a bug?
- No. That is intentional for performance reasons, and the output of
- deflate is not affected. This only started showing up recently since
- zlib 1.2.x uses malloc() by default for allocations, whereas earlier
- versions used calloc(), which zeros out the allocated memory.
+ No. That is intentional for performance reasons, and the output of deflate
+ is not affected. This only started showing up recently since zlib 1.2.x
+ uses malloc() by default for allocations, whereas earlier versions used
+ calloc(), which zeros out the allocated memory. Even though the code was
+ correct, versions 1.2.4 and later was changed to not stimulate these
+ checkers.
37. Will zlib read the (insert any ancient or arcane format here) compressed
data format?
@@ -305,20 +311,21 @@
38. How can I encrypt/decrypt zip files with zlib?
- zlib doesn't support encryption. The original PKZIP encryption is very weak
- and can be broken with freely available programs. To get strong encryption,
- use GnuPG, http://www.gnupg.org/ , which already includes zlib compression.
- For PKZIP compatible "encryption", look at http://www.info-zip.org/
+ zlib doesn't support encryption. The original PKZIP encryption is very
+ weak and can be broken with freely available programs. To get strong
+ encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib
+ compression. For PKZIP compatible "encryption", look at
+ http://www.info-zip.org/
39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
- "gzip" is the gzip format, and "deflate" is the zlib format. They should
- probably have called the second one "zlib" instead to avoid confusion
- with the raw deflate compressed data format. While the HTTP 1.1 RFC 2616
+ "gzip" is the gzip format, and "deflate" is the zlib format. They should
+ probably have called the second one "zlib" instead to avoid confusion with
+ the raw deflate compressed data format. While the HTTP 1.1 RFC 2616
correctly points to the zlib specification in RFC 1950 for the "deflate"
transfer encoding, there have been reports of servers and browsers that
incorrectly produce or expect raw deflate data per the deflate
- specficiation in RFC 1951, most notably Microsoft. So even though the
+ specficiation in RFC 1951, most notably Microsoft. So even though the
"deflate" transfer encoding using the zlib format would be the more
efficient approach (and in fact exactly what the zlib format was designed
for), using the "gzip" transfer encoding is probably more reliable due to
@@ -328,12 +335,32 @@
40. Does zlib support the new "Deflate64" format introduced by PKWare?
- No. PKWare has apparently decided to keep that format proprietary, since
- they have not documented it as they have previous compression formats.
- In any case, the compression improvements are so modest compared to other
- more modern approaches, that it's not worth the effort to implement.
+ No. PKWare has apparently decided to keep that format proprietary, since
+ they have not documented it as they have previous compression formats. In
+ any case, the compression improvements are so modest compared to other more
+ modern approaches, that it's not worth the effort to implement.
-41. Can you please sign these lengthy legal documents and fax them back to us
+41. I'm having a problem with the zip functions in zlib, can you help?
+
+ There are no zip functions in zlib. You are probably using minizip by
+ Giles Vollant, which is found in the contrib directory of zlib. It is not
+ part of zlib. In fact none of the stuff in contrib is part of zlib. The
+ files in there are not supported by the zlib authors. You need to contact
+ the authors of the respective contribution for help.
+
+42. The match.asm code in contrib is under the GNU General Public License.
+ Since it's part of zlib, doesn't that mean that all of zlib falls under the
+ GNU GPL?
+
+ No. The files in contrib are not part of zlib. They were contributed by
+ other authors and are provided as a convenience to the user within the zlib
+ distribution. Each item in contrib has its own license.
+
+43. Is zlib subject to export controls? What is its ECCN?
+
+ zlib is not subject to export controls, and so is classified as EAR99.
+
+44. Can you please sign these lengthy legal documents and fax them back to us
so that we can use your software in our product?
No. Go away. Shoo.
Modified: trunk/OpenMPT/zlib/INDEX
===================================================================
--- trunk/OpenMPT/zlib/INDEX 2010-03-23 17:44:41 UTC (rev 546)
+++ trunk/OpenMPT/zlib/INDEX 2010-03-24 12:22:00 UTC (rev 547)
@@ -1,23 +1,33 @@
+CMakeLists.txt cmake build file
ChangeLog history of changes
FAQ Frequently Asked Questions about zlib
INDEX this file
-Makefile makefile for Unix (generated by configure)
-Makefile.in makefile for Unix (template for configure)
+Makefile dummy Makefile that tells you to ./configure
+Makefile.in template for Unix Makefile
README guess what
-algorithm.txt description of the (de)compression algorithm
configure configure script for Unix
-zconf.in.h template for zconf.h (used by configure)
+make_vms.com makefile for VMS
+treebuild.xml XML description of source file dependencies
+zconf.h.cmakein zconf.h template for cmake
+zconf.h.in zconf.h template for configure
+zlib.3 Man page for zlib
+zlib.3.pdf Man page in PDF format
+zlib.map Linux symbol information
+zlib.pc.in Template for pkg-config descriptor
+zlib2ansi perl script to convert source files for C++ compilation
amiga/ makefiles for Amiga SAS C
-as400/ makefiles for IBM AS/400
+doc/ documentation for formats and algorithms
msdos/ makefiles for MSDOS
+nintendods/ makefile for Nintendo DS
old/ makefiles for various architectures and zlib documentation
files that have not yet been updated for zlib 1.2.x
projects/ projects for various Integrated Development Environments
qnx/ makefiles for QNX
+watcom/ makefiles for OpenWatcom
win32/ makefiles for Windows
- zlib public header files (must be kept):
+ zlib public header files (required for library use):
zconf.h
zlib.h
@@ -28,7 +38,11 @@
crc32.h
deflate.c
deflate.h
-gzio.c
+gzclose.c
+gzguts.h
+gzlib.c
+gzread.c
+gzwrite.c
infback.c
inffast.c
inffast.h
@@ -46,6 +60,7 @@
source files for sample programs:
example.c
minigzip.c
+See examples/README.examples for more
unsupported contribution by third parties
See contrib/README.contrib
Modified: trunk/OpenMPT/zlib/Makefile
===================================================================
--- trunk/OpenMPT/zlib/Makefile 2010-03-23 17:44:41 UTC (rev 546)
+++ trunk/OpenMPT/zlib/Makefile 2010-03-24 12:22:00 UTC (rev 547)
@@ -1,154 +1,5 @@
-# Makefile for zlib
-# Copyright (C) 1995-2005 Jean-loup Gailly.
-# For conditions of distribution and use, see copyright notice in zlib.h
+all:
+ -@echo "Please use ./configure first. Thank you."
-# To compile and test, type:
-# ./configure; make test
-# The call of configure is optional if you don't have special requirements
-# If you wish to build zlib as a shared library, use: ./configure -s
-
-# To use the asm code, type:
-# cp contrib/asm?86/match.S ./match.S
-# make LOC=-DASMV OBJA=match.o
-
-# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
-# make install
-# To install in $HOME instead of /usr/local, use:
-# make install prefix=$HOME
-
-CC=cc
-
-CFLAGS=-O
-#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
-#CFLAGS=-g -DDEBUG
-#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
-# -Wstrict-prototypes -Wmissing-prototypes
-
-LDFLAGS=libz.a
-LDSHARED=$(CC)
-CPP=$(CC) -E
-
-LIBS=libz.a
-SHAREDLIB=libz.so
-SHAREDLIBV=libz.so.1.2.3
-SHAREDLIBM=libz.so.1
-
-AR=ar rc
-RANLIB=ranlib
-TAR=tar
-SHELL=/bin/sh
-EXE=
-
-prefix = /usr/local
-exec_prefix = ${prefix}
-libdir = ${exec_prefix}/lib
-includedir = ${prefix}/include
-mandir = ${prefix}/share/man
-man3dir = ${mandir}/man3
-
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
- zutil.o inflate.o infback.o inftrees.o inffast.o
-
-OBJA =
-# to use the asm code: make OBJA=match.o
-
-TEST_OBJS = example.o minigzip.o
-
-all: example$(EXE) minigzip$(EXE)
-
-check: test
-test: all
- @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
- echo hello world | ./minigzip | ./minigzip -d || \
- echo ' *** minigzip test FAILED ***' ; \
- if ./example; then \
- echo ' *** zlib test OK ***'; \
- else \
- echo ' *** zlib test FAILED ***'; \
- fi
-
-libz.a: $(OBJS) $(OBJA)
- $(AR) $@ $(OBJS) $(OBJA)
- -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
-
-match.o: match.S
- $(CPP) match.S > _match.s
- $(CC) -c _match.s
- mv _match.o match.o
- rm -f _match.s
-
-$(SHAREDLIBV): $(OBJS)
- $(LDSHARED) -o $@ $(OBJS)
- rm -f $(SHAREDLIB) $(SHAREDLIBM)
- ln -s $@ $(SHAREDLIB)
- ln -s $@ $(SHAREDLIBM)
-
-example$(EXE): example.o $(LIBS)
- $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
-
-minigzip$(EXE): minigzip.o $(LIBS)
- $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
-
-install: $(LIBS)
- -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
- -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
- -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
- -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
- cp zlib.h zconf.h $(includedir)
- chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
- cp $(LIBS) $(libdir)
- cd $(libdir); chmod 755 $(LIBS)
- -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
- cd $(libdir); if test -f $(SHAREDLIBV); then \
- rm -f $(SHAREDLIB) $(SHAREDLIBM); \
- ln -s $(SHAREDLIBV) $(SHAREDLIB); \
- ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
- (ldconfig || true) >/dev/null 2>&1; \
- fi
- cp zlib.3 $(man3dir)
- chmod 644 $(man3dir)/zlib.3
-# The ranlib in install is needed on NeXTSTEP which checks file times
-# ldconfig is for Linux
-
-uninstall:
- cd $(includedir); \
- cd $(libdir); rm -f libz.a; \
- if test -f $(SHAREDLIBV); then \
- rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
- fi
- cd $(man3dir); rm -f zlib.3
-
-mostlyclean: clean
-clean:
- rm -f *.o *~ example$(EXE) minigzip$(EXE) \
- libz.* foo.gz so_locations \
- _match.s maketree contrib/infback9/*.o
-
-maintainer-clean: distclean
-distclean: clean
- cp -p Makefile.in Makefile
- cp -p zconf.in.h zconf.h
- rm -f .DS_Store
-
-tags:
- etags *.[ch]
-
-depend:
- makedepend -- $(CFLAGS) -- *.[ch]
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-adler32.o: zlib.h zconf.h
-compress.o: zlib.h zconf.h
-crc32.o: crc32.h zlib.h zconf.h
-deflate.o: deflate.h zutil.h zlib.h zconf.h
-example.o: zlib.h zconf.h
-gzio.o: zutil.h zlib.h zconf.h
-inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inftrees.o: zutil.h zlib.h zconf.h inftrees.h
-minigzip.o: zlib.h zconf.h
-trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
-uncompr.o: zlib.h zconf.h
-zutil.o: zutil.h zlib.h zconf.h
+distclean:
+ make -f Makefile.in distclean
Modified: trunk/OpenMPT/zlib/Makefile.in
===================================================================
--- trunk/OpenMPT/zlib/Makefile.in 2010-03-23 17:44:41 UTC (rev 546)
+++ trunk/OpenMPT/zlib/Makefile.in 2010-03-24 12:22:00 UTC (rev 547)
@@ -1,11 +1,11 @@
# Makefile for zlib
-# Copyright (C) 1995-2005 Jean-loup Gailly.
+# Copyright (C) 1995-2010 Jean-loup Gailly.
# For conditions of distribution and use, see copyright notice in zlib.h
# To compile and test, type:
# ./configure; make test
-# The call of configure is optional if you don't have special requirements
-# If you wish to build zlib as a shared library, use: ./configure -s
+# Normally configure builds both a static and a shared library.
+# If you want to build just a static library, use: ./configure --static
# To use the asm code, type:
# cp contrib/asm?86/match.S ./match.S
@@ -24,14 +24,17 @@
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
# -Wstrict-prototypes -Wmissing-prototypes
-LDFLAGS=libz.a
+SFLAGS=-O
+
+LDFLAGS=-L. libz.a
LDSHARED=$(CC)
CPP=$(CC) -E
-LIBS=libz.a
+STATICLIB=libz.a
SHAREDLIB=libz.so
-SHAREDLIBV=libz.so.1.2.3
+SHAREDLIBV=libz.so.1.2.4
SHAREDLIBM=libz.so.1
+LIBS=$(STATICLIB) $(SHAREDLIB) $(SHAREDLIBV)
AR=ar rc
RANLIB=ranlib
@@ -45,30 +48,64 @@
includedir = ${prefix}/include
mandir = ${prefix}/share/man
man3dir = ${mandir}/man3
+pkgconfigdir = ${libdir}/pkgconfig
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
- zutil.o inflate.o infback.o inftrees.o inffast.o
+OBJC = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
+ gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
+PIC_OBJC = adler32.lo compress.lo crc32.lo deflate.lo gzclose.lo gzlib.lo gzread.lo \
+ gzwrite.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo
+
+# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
OBJA =
-# to use the asm code: make OBJA=match.o
+PIC_OBJA =
-TEST_OBJS = example.o minigzip.o
+OBJS = $(OBJC) $(OBJA)
-all: example$(EXE) minigzip$(EXE)
+PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
+all: static shared
+
+static: example$(EXE) minigzip$(EXE)
+
+shared: examplesh$(EXE) minigzipsh$(EXE)
+
+all64: example64$(EXE) minigzip64$(EXE)
+
check: test
-test: all
- @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
- echo hello world | ./minigzip | ./minigzip -d || \
- echo ' *** minigzip test FAILED ***' ; \
- if ./example; then \
+
+test: all teststatic testshared
+
+teststatic: static
+ @if echo hello world | ./minigzip | ./minigzip -d && ./example; then \
echo ' *** zlib test OK ***'; \
else \
- echo ' *** zlib test FAILED ***'; \
+ echo ' *** zlib test FAILED ***'; false; \
fi
+ -@rm -f foo.gz
-libz.a: $(OBJS) $(OBJA)
- $(AR) $@ $(OBJS) $(OBJA)
+testshared: shared
+ @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
+ LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
+ DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
+ SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
+ if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh; then \
+ echo ' *** zlib shared test OK ***'; \
+ else \
+ echo ' *** zlib shared test FAILED ***'; false; \
+ fi
+ -@rm -f foo.gz
+
+test64: all64
+ @if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64; then \
+ echo ' *** zlib 64-bit test OK ***'; \
+ else \
+ echo ' *** zlib 64-bit test FAILED ***'; false; \
+ fi
+ -@rm -f foo.gz
+
+libz.a: $(OBJS)
+ $(AR) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
match.o: match.S
@@ -77,58 +114,114 @@
mv _match.o match.o
rm -f _match.s
-$(SHAREDLIBV): $(OBJS)
- $(LDSHARED) -o $@ $(OBJS)
+match.lo: match.S
+ $(CPP) match.S > _match.s
+ $(CC) -c -fPIC _match.s
+ mv _match.o match.lo
+ rm -f _match.s
+
+example64.o: example.c zlib.h zconf.h
+ $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ example.c
+
+minigzip64.o: minigzip.c zlib.h zconf.h
+ $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ minigzip.c
+
+.SUFFIXES: .lo
+
+.c.lo:
+ -@if [ ! -d objs ]; then mkdir objs; fi
+ $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
+ -@mv objs/$*.o $@
+
+$(SHAREDLIBV): $(PIC_OBJS)
+ $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) -lc
rm -f $(SHAREDLIB) $(SHAREDLIBM)
ln -s $@ $(SHAREDLIB)
ln -s $@ $(SHAREDLIBM)
+ -@rmdir objs
-example$(EXE): example.o $(LIBS)
+example$(EXE): example.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
-minigzip$(EXE): minigzip.o $(LIBS)
+minigzip$(EXE): minigzip.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
-install: $(LIBS)
- -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
- -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
- -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
- -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
- cp zlib.h zconf.h $(includedir)
- chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
- cp $(LIBS) $(libdir)
- cd $(libdir); chmod 755 $(LIBS)
- -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
- cd $(libdir); if test -f $(SHAREDLIBV); then \
+examplesh$(EXE): example.o $(SHAREDLIBV)
+ $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
+
+minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
+ $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
+
+example64$(EXE): example64.o $(STATICLIB)
+ $(CC) $(CFLAGS) -o $@ example64.o $(LDFLAGS)
+
+minigzip64$(EXE): minigzip64.o $(STATICLIB)
+ $(CC) $(CFLAGS) -o $@ minigzip64.o $(LDFLAGS)
+
+install-libs: $(LIBS)
+ -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
+ -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
+ -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
+ -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
+ cp $(LIBS) $(DESTDIR)$(libdir)
+ cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB)
+ -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
+ -@cd $(DESTDIR)$(libdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
+ chmod 755 $(SHAREDLIBV); \
rm -f $(SHAREDLIB) $(SHAREDLIBM); \
ln -s $(SHAREDLIBV) $(SHAREDLIB); \
ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
(ldconfig || true) >/dev/null 2>&1; \
fi
- cp zlib.3 $(man3dir)
- chmod 644 $(man3dir)/zlib.3
+ cp zlib.3 $(DESTDIR)$(man3dir)
+ chmod 644 $(DESTDIR)$(man3dir)/zlib.3
+ cp zlib.pc $(DESTDIR)$(pkgconfigdir)
+ chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
# The ranlib in install is needed on NeXTSTEP which checks file times
# ldconfig is for Linux
+install: install-libs
+ -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
+ cp zlib.h zconf.h $(DESTDIR)$(includedir)
+ chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
+
uninstall:
- cd $(includedir); \
- cd $(libdir); rm -f libz.a; \
- if test -f $(SHAREDLIBV); then \
+ cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h
+ cd $(DESTDIR)$(libdir); rm -f libz.a; \
+ if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
fi
- cd $(man3dir); rm -f zlib.3
+ cd $(DESTDIR)$(man3dir); rm -f zlib.3
+ cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc
+docs: zlib.3.pdf
+
+zlib.3.pdf: zlib.3
+ groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf
+
+zconf.h.in: zconf.h.cmakein
+ sed "/^#cmakedefine/D" < zconf.h.cmakein > zconf.h.in
+ touch -r zconf.h.cmakein zconf.h.in
+
+zconf: zconf.h.in
+ cp -p zconf.h.in zconf.h
+
mostlyclean: clean
clean:
- rm -f *.o *~ example$(EXE) minigzip$(EXE) \
+ rm -f *.o *.lo *~ \
+ example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
+ example64$(EXE) minigzip64$(EXE) \
libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o
+ rm -rf objs
maintainer-clean: distclean
-distclean: clean
- cp -p Makefile.in Makefile
- cp -p zconf.in.h zconf.h
- rm -f .DS_Store
+distclean: clean zconf docs
+ rm -f Makefile zlib.pc
+ -@rm -f .DS_Store
+ -@printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile
+ -@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile
+ -@touch -r Makefile.in Makefile
tags:
etags *.[ch]
@@ -138,17 +231,22 @@
# DO NOT DELETE THIS LINE -- make depend depends on it.
-adler32.o: zlib.h zconf.h
-compress.o: zlib.h zconf.h
-crc32.o: crc32.h zlib.h zconf.h
+adler32.o zutil.o: zutil.h zlib.h zconf.h
+gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h
+compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h
+crc32.o: zutil.h zlib.h zconf.h crc32.h
deflate.o: deflate.h zutil.h zlib.h zconf.h
-example.o: zlib.h zconf.h
-gzio.o: zutil.h zlib.h zconf.h
+infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
-minigzip.o: zlib.h zconf.h
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
-uncompr.o: zlib.h zconf.h
-zutil.o: zutil.h zlib.h zconf.h
+
+adler32.lo zutil.lo: zutil.h zlib.h zconf.h
+gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h
+compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h
+crc32.lo: zutil.h zlib.h zconf.h crc32.h
+deflate.lo: deflate.h zutil.h zlib.h zconf.h
+infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
+inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
+inftrees.lo: zutil.h zlib.h zconf.h inftrees.h
+trees.lo: deflate.h zutil.h zlib.h zconf.h trees.h
Modified: trunk/OpenMPT/zlib/README
=================================================================...
[truncated message content] |
|
From: <sag...@us...> - 2010-03-23 17:44:51
|
Revision: 546
http://modplug.svn.sourceforge.net/modplug/?rev=546&view=rev
Author: saga-games
Date: 2010-03-23 17:44:41 +0000 (Tue, 23 Mar 2010)
Log Message:
-----------
[Fix] Loaders: Some mod formats were erroneously converted to IT instead of XM since revision 532.
[Fix] Multi window edit: When (un)muting a channel from the general tab in window 1, it was instantly shown in the pattern editor of window 2, but not vice versa.
[Fix] XM Compatibility: Improved handling of the situation when a 3xx effect was used, but previously no note was playing.
[Fix] Channel Manager: When removing channels using the channel manager, their names were not cleared properly.
[Imp] S3M Loader: Display a message if an S3M file contains Adlib instruments (rare).
[Imp] Effect vis: Make use of song's own row highlighting variables instead of fixed global ones.
[Ref] Some more small internal changes.
Revision Links:
--------------
http://modplug.svn.sourceforge.net/modplug/?rev=532&view=rev
Modified Paths:
--------------
trunk/OpenMPT/mptrack/EffectVis.cpp
trunk/OpenMPT/mptrack/InputHandler.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/soundlib/Load_s3m.cpp
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
Modified: trunk/OpenMPT/mptrack/EffectVis.cpp
===================================================================
--- trunk/OpenMPT/mptrack/EffectVis.cpp 2010-03-22 21:03:07 UTC (rev 545)
+++ trunk/OpenMPT/mptrack/EffectVis.cpp 2010-03-23 17:44:41 UTC (rev 546)
@@ -268,9 +268,9 @@
// Draw vertical grid lines
for (UINT row=m_startRow; row<=m_endRow; row++)
{
- if (row % CMainFrame::m_nRowSpacing == 0)
+ if (row % m_pSndFile->m_nRowsPerMeasure == 0)
CMainFrame::penScratch = CMainFrame::penGrayff;
- else if (row % CMainFrame::m_nRowSpacing2 == 0)
+ else if (row % m_pSndFile->m_nRowsPerBeat == 0)
CMainFrame::penScratch = CMainFrame::penGray99;
else
CMainFrame::penScratch = CMainFrame::penGray55;
Modified: trunk/OpenMPT/mptrack/InputHandler.cpp
===================================================================
--- trunk/OpenMPT/mptrack/InputHandler.cpp 2010-03-22 21:03:07 UTC (rev 545)
+++ trunk/OpenMPT/mptrack/InputHandler.cpp 2010-03-23 17:44:41 UTC (rev 546)
@@ -189,10 +189,10 @@
void CInputHandler::SetupSpecialKeyInterception()
{
m_bInterceptWindowsKeys = m_bInterceptNumLock = m_bInterceptCapsLock = m_bInterceptScrollLock = false;
- for( int context=0; context<sizeof(keyMap)/sizeof(keyMap[0]); context++ )
- for( int mod=0; mod<sizeof(keyMap[0])/sizeof(keyMap[0][0]); mod++ )
- for( int key=0; key<sizeof(keyMap[0][0])/sizeof(keyMap[0][0][0]); key++ )
- for( int kevent=0; kevent<sizeof(keyMap[0][0][0])/sizeof(keyMap[0][0][0][0]); kevent++ ) {
+ for( int context=0; context < ARRAYELEMCOUNT(keyMap); context++ )
+ for( int mod=0; mod < ARRAYELEMCOUNT(keyMap[0]); mod++ )
+ for( int key=0; key < ARRAYELEMCOUNT(keyMap[0][0]); key++ )
+ for( int kevent=0; kevent < ARRAYELEMCOUNT(keyMap[0][0][0]); kevent++ ) {
if( keyMap[context][mod][key][kevent] == kcNull ) continue;
if( mod == HOTKEYF_EXT ) m_bInterceptWindowsKeys = true;
if( key == VK_NUMLOCK ) m_bInterceptNumLock = true;
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-22 21:03:07 UTC (rev 545)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-23 17:44:41 UTC (rev 546)
@@ -337,17 +337,18 @@
case MOD_TYPE_MED:
case MOD_TYPE_OKT:
case MOD_TYPE_AMS:
- case MOD_TYPE_MT2:
- m_SndFile.ChangeModTypeTo(MOD_TYPE_IT);
- /*m_SndFile.ChangeModTypeTo(MOD_TYPE_XM);
+ m_SndFile.ChangeModTypeTo(MOD_TYPE_XM);
if ((m_SndFile.m_nDefaultTempo == 125) && (m_SndFile.m_nDefaultSpeed == 6) && (!m_SndFile.m_nInstruments))
{
m_SndFile.m_nType = MOD_TYPE_MOD;
for (UINT i=0; i<m_SndFile.Patterns.Size(); i++)
if ((m_SndFile.Patterns[i]) && (m_SndFile.PatternSize[i] != 64))
m_SndFile.m_nType = MOD_TYPE_XM;
- }*/
+ }
break;
+ case MOD_TYPE_MT2:
+ m_SndFile.ChangeModTypeTo(MOD_TYPE_IT);
+ break;
case MOD_TYPE_FAR:
case MOD_TYPE_PTM:
case MOD_TYPE_STM:
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-22 21:03:07 UTC (rev 545)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-03-23 17:44:41 UTC (rev 546)
@@ -592,8 +592,8 @@
tmpchn++;
if (i >= nRemainingChannels)
{
+ m_SndFile.InitChannel(i);
m_SndFile.Chn[i].dwFlags |= CHN_MUTE;
- m_SndFile.InitChannel(i);
}
}
}
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-22 21:03:07 UTC (rev 545)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-23 17:44:41 UTC (rev 546)
@@ -13,8 +13,9 @@
#include "OpenGLEditor.h" //rewbs.fxvis
#include "PatternGotoDialog.h"
#include "PatternRandomizer.h"
-#include ".\arrayutils.h"
-#include ".\view_pat.h"
+#include "arrayutils.h"
+#include "view_pat.h"
+#include "View_gen.h"
#include "misc_util.h"
#include "midi.h"
#include <cmath>
@@ -1106,8 +1107,10 @@
InvalidateChannelsHeaders();
}
}
- else if (!(nFlags&MK_CONTROL)) {
- pModDoc->MuteChannel(nItemNo, (pSndFile->ChnSettings[nItemNo].dwFlags & CHN_MUTE) ? FALSE : TRUE);
+ else if (!(nFlags&MK_CONTROL))
+ {
+ pModDoc->MuteChannel(nItemNo, (pSndFile->ChnSettings[nItemNo].dwFlags & CHN_MUTE) ? false : true);
+ pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | ((nItemNo / CHANNELS_IN_TAB) << HINT_SHIFT_CHNTAB));
}
break;
case DRAGITEM_PATTERNHEADER:
@@ -2482,7 +2485,7 @@
// If a note or an instr is present on the row, do the change, if required.
// Do not set instr if note and instr are both blank.
// Do set instr if note is a PC note and instr is blank.
- if ( ((p->note > 0 && p->note < NOTE_MIN_SPECIAL) || MODCOMMAND::IsPcNote(p->note) || p->instr) && (p->instr!=nIns) ) {
+ if ( ((p->note > 0 && p->note < NOTE_MIN_SPECIAL) || p->IsPcNote() || p->instr) && (p->instr!=nIns) ) {
p->instr = nIns;
bModified = TRUE;
}
Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_s3m.cpp 2010-03-22 21:03:07 UTC (rev 545)
+++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2010-03-23 17:44:41 UTC (rev 546)
@@ -68,6 +68,12 @@
BYTE channels[32];
} S3MFILEHEADER;
+enum
+{
+ S3I_TYPE_NONE = 0,
+ S3I_TYPE_PCM = 1,
+ S3I_TYPE_ADMEL = 2,
+};
void CSoundFile::S3MConvert(MODCOMMAND *m, BOOL bIT) const
//--------------------------------------------------------
@@ -227,7 +233,7 @@
DWORD dwMemPos;
BYTE insflags[128], inspack[128];
S3MFILEHEADER psfh = *(S3MFILEHEADER *)lpStream;
- bool bKeepMidiMacros = false;
+ bool bKeepMidiMacros = false, bHasAdlibPatches = false;
psfh.reserved1 = LittleEndianW(psfh.reserved1);
psfh.ordnum = LittleEndianW(psfh.ordnum);
@@ -355,7 +361,7 @@
lstrcpy(m_szNames[iSmp], (LPCSTR)&s[0x30]);
SpaceToNullStringFixed(m_szNames[iSmp], 28);
- if ((s[0]==1) && (s[0x4E]=='R') && (s[0x4F]=='S'))
+ if ((s[0] == S3I_TYPE_PCM) && (s[0x4E] == 'R') && (s[0x4F] == 'S'))
{
Samples[iSmp].nLength = CLAMP(LittleEndian(*((LPDWORD)(s + 0x10))), 4, MAX_SAMPLE_LENGTH);
Samples[iSmp].nLoopStart = CLAMP(LittleEndian(*((LPDWORD)(s + 0x14))), 0, Samples[iSmp].nLength - 1);
@@ -381,6 +387,9 @@
Samples[iSmp].nLoopStart = Samples[iSmp].nLoopEnd = 0;
Samples[iSmp].nPan = 0x80;
//ASSERT(iLooplength == 0 || iLooplength > 4);
+ } else if(s[0] == S3I_TYPE_ADMEL)
+ {
+ bHasAdlibPatches = true;
}
}
@@ -489,7 +498,7 @@
}
// Reading samples
- for (UINT iRaw=1; iRaw<=insnum; iRaw++) if ((Samples[iRaw].nLength) && (insfile[iRaw]))
+ for (UINT iRaw = 1; iRaw <= insnum; iRaw++) if ((Samples[iRaw].nLength) && (insfile[iRaw]))
{
UINT flags = (psfh.version == 1) ? RS_PCM8S : RS_PCM8U;
if (insflags[iRaw-1] & 4) flags += 5;
@@ -502,6 +511,13 @@
m_nMaxPeriod = 32767;
if (psfh.flags & 0x10) m_dwSongFlags |= SONG_AMIGALIMITS;
+#ifdef MODPLUG_TRACKER
+ if(bHasAdlibPatches)
+ {
+ ::MessageBox(0, "This track uses Adlib instruments, which are not supported by OpenMPT.", "OpenMPT S3M Import", MB_OK|MB_ICONEXCLAMATION);
+ }
+#endif
+
return true;
}
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-22 21:03:07 UTC (rev 545)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-23 17:44:41 UTC (rev 546)
@@ -693,8 +693,10 @@
}
}
- if ((!bPorta) && (m_nType & (MOD_TYPE_XM|MOD_TYPE_MED|MOD_TYPE_MT2))) {
- if (pSmp) {
+ if ((!bPorta) && (m_nType & (MOD_TYPE_XM|MOD_TYPE_MED|MOD_TYPE_MT2)))
+ {
+ if (pSmp)
+ {
pChn->nTranspose = pSmp->RelativeTone;
pChn->nFineTune = pSmp->nFineTune;
}
@@ -702,9 +704,12 @@
// IT Compatibility: Update multisample instruments frequency even if instrument is not specified
if(!bPorta && pSmp && IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nC5Speed = pSmp->nC5Speed;
- // XM Compatibility: Ignore notes with portamento if there was no note
- if(bPorta && (pChn->nPeriod == 0) && IsCompatibleMode(TRK_FASTTRACKER2))
+ // XM Compatibility: Ignore notes with portamento if there was no note playing.
+ if(bPorta && (pChn->pCurrentSample == nullptr) && IsCompatibleMode(TRK_FASTTRACKER2))
+ {
+ pChn->nPeriod = 0;
return;
+ }
if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MED)) note += pChn->nTranspose;
note = CLAMP(note, 1, 132);
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-22 21:03:07 UTC (rev 545)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-23 17:44:41 UTC (rev 546)
@@ -1494,7 +1494,7 @@
}
void CSoundFile::ResetChannelState(CHANNELINDEX i, BYTE resetMask)
-//-------------------------------------------------------
+//----------------------------------------------------------------
{
if(i >= MAX_CHANNELS) return;
@@ -1571,7 +1571,7 @@
CHANNELINDEX CSoundFile::ReArrangeChannels(const vector<CHANNELINDEX>& newOrder)
-//-------------------------------------------------------------------
+//------------------------------------------------------------------------------
{
//newOrder[i] tells which current channel should be placed to i:th position in
//the new order, or if i is not an index of current channels, then new channel is
@@ -1639,14 +1639,14 @@
{
if(newOrder[nChn] < m_nChannels)
{
- ChnSettings[nChn] = settings[newOrder[nChn]];
- Chn[nChn] = chns[newOrder[nChn]];
- if(m_pModDoc)
- {
- if(recordStates[newOrder[nChn]] == 1) m_pModDoc->Record1Channel(nChn, true);
- if(recordStates[newOrder[nChn]] == 2) m_pModDoc->Record2Channel(nChn, true);
- }
- m_bChannelMuteTogglePending[nChn] = chnMutePendings[newOrder[nChn]];
+ ChnSettings[nChn] = settings[newOrder[nChn]];
+ Chn[nChn] = chns[newOrder[nChn]];
+ if(m_pModDoc)
+ {
+ if(recordStates[newOrder[nChn]] == 1) m_pModDoc->Record1Channel(nChn, true);
+ if(recordStates[newOrder[nChn]] == 2) m_pModDoc->Record2Channel(nChn, true);
+ }
+ m_bChannelMuteTogglePending[nChn] = chnMutePendings[newOrder[nChn]];
}
else
{
@@ -1657,6 +1657,14 @@
SetupMODPanning();
m_nChannels = nRemainingChannels;
+
+ // Reset removed channels. Most notably, clear the channel name.
+ for(CHANNELINDEX nChn = m_nChannels; nChn < MAX_BASECHANNELS; nChn++)
+ {
+ InitChannel(nChn);
+ Chn[nChn].dwFlags |= CHN_MUTE;
+ }
+
END_CRITICAL();
return static_cast<CHANNELINDEX>(m_nChannels);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2010-03-22 21:03:15
|
Revision: 545
http://modplug.svn.sourceforge.net/modplug/?rev=545&view=rev
Author: rewbs
Date: 2010-03-22 21:03:07 +0000 (Mon, 22 Mar 2010)
Log Message:
-----------
[fix] Prevent effect visualizer from writing PC notes if module type isn't MPTM.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/EffectVis.cpp
Modified: trunk/OpenMPT/mptrack/EffectVis.cpp
===================================================================
--- trunk/OpenMPT/mptrack/EffectVis.cpp 2010-03-22 20:17:53 UTC (rev 544)
+++ trunk/OpenMPT/mptrack/EffectVis.cpp 2010-03-22 21:03:07 UTC (rev 545)
@@ -767,7 +767,7 @@
//--------------------------------
{
CModControlDlg::OnInitDialog();
- if (IsPcNote(m_startRow))
+ if (m_pModDoc->GetModType() == MOD_TYPE_MPT && IsPcNote(m_startRow))
{
// If first selected row is a PC Note, default to PC note overwrite mode
// and use it as a template for new PC notes that will be created via the visualiser.
@@ -808,8 +808,11 @@
m_cmbActionList.ResetContent();
m_cmbActionList.SetItemData(m_cmbActionList.AddString("Overwrite with effect:"), kAction_OverwriteFX);
m_cmbActionList.SetItemData(m_cmbActionList.AddString("Fill blanks with effect:"), kAction_FillFX);
- m_cmbActionList.SetItemData(m_cmbActionList.AddString("Overwrite with PC note"), kAction_OverwritePC);
- m_cmbActionList.SetItemData(m_cmbActionList.AddString("Fill blanks with PC note"), kAction_FillPC);
+ if (m_pModDoc->GetModType() == MOD_TYPE_MPT)
+ {
+ m_cmbActionList.SetItemData(m_cmbActionList.AddString("Overwrite with PC note"), kAction_OverwritePC);
+ m_cmbActionList.SetItemData(m_cmbActionList.AddString("Fill blanks with PC note"), kAction_FillPC);
+ }
m_cmbActionList.SetItemData(m_cmbActionList.AddString("Never change effect type"), kAction_Preserve);
m_cmbActionList.SetCurSel(m_nAction);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2010-03-22 20:18:00
|
Revision: 544
http://modplug.svn.sourceforge.net/modplug/?rev=544&view=rev
Author: rewbs
Date: 2010-03-22 20:17:53 +0000 (Mon, 22 Mar 2010)
Log Message:
-----------
[Fix] Effect visualizer is now aware of PC notes (bug 3836).
[Fix] Context menu command "Change Plugin" for PC notes now works when the PC note has a blank plugin (instrument) field.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/EffectVis.cpp
trunk/OpenMPT/mptrack/EffectVis.h
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/mptrack_08.vcproj
trunk/OpenMPT/mptrack/resource.h
trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb
Added Paths:
-----------
trunk/OpenMPT/mptrack/res/vispcnode.bmp
Modified: trunk/OpenMPT/mptrack/EffectVis.cpp
===================================================================
--- trunk/OpenMPT/mptrack/EffectVis.cpp 2010-03-21 22:07:22 UTC (rev 543)
+++ trunk/OpenMPT/mptrack/EffectVis.cpp 2010-03-22 20:17:53 UTC (rev 544)
@@ -25,20 +25,22 @@
IMPLEMENT_DYNAMIC(CEffectVis, CDialog)
CEffectVis::CEffectVis(CViewPattern *pViewPattern, UINT startRow, UINT endRow, UINT nchn, CModDoc* pModDoc, UINT pat)
- //: CDialog(CEffectVis::IDD, pParent)
{
m_pViewPattern = pViewPattern;
m_dwStatus = 0x00;
m_nDragItem = -1;
m_brushBlack.CreateSolidBrush(RGB(0, 0, 0));
m_boolForceRedraw = TRUE;
+ m_pModDoc = pModDoc;
m_nRowToErase = -1;
m_nParamToErase = -1;
m_nLastDrawnRow = -1;
+ m_nLastDrawnY = -1;
m_nOldPlayPos = -1;
- m_nFillEffect=0;
- m_nAction=kAction_Overwrite; //Overwrite
+ m_nFillEffect = m_pModDoc->GetIndexFromEffect(CMD_SMOOTHMIDI, 0);
+ m_nAction=kAction_OverwriteFX;
+ m_templatePCNote.Set(NOTE_PCS, 1, 0, 0);
UpdateSelection(startRow, endRow, nchn, pModDoc, pat);
}
@@ -51,16 +53,9 @@
ON_WM_MOUSEMOVE()
ON_WM_RBUTTONDOWN()
ON_WM_RBUTTONUP()
-// ON_WM_CHAR()
-// ON_WM_KEYDOWN()
-// ON_WM_KEYUP()
-// ON_WM_MBUTTONDOWN()
//{{AFX_MSG_MAP(CEffectVis)
ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
//}}AFX_MSG_MAP
-//ON_STN_CLICKED(IDC_VISSTATUS, OnStnClickedVisstatus)
-//ON_EN_CHANGE(IDC_VISSTATUS, OnEnChangeVisstatus)
- ON_COMMAND(IDC_VISFILLBLANKS, OnFillBlanksCheck)
ON_CBN_SELCHANGE(IDC_VISACTION, OnActionChanged)
ON_CBN_SELCHANGE(IDC_VISEFFECTLIST, OnEffectChanged)
END_MESSAGE_MAP()
@@ -71,19 +66,14 @@
DDX_Control(pDX, IDC_VISSTATUS, m_edVisStatus);
DDX_Control(pDX, IDC_VISEFFECTLIST, m_cmbEffectList);
DDX_Control(pDX, IDC_VISACTION, m_cmbActionList);
- DDX_Control(pDX, IDC_VISFILLBLANKS, m_btnFillCheck);
}
-void CEffectVis::OnFillBlanksCheck()
-{
- m_bFillCheck = IsDlgButtonChecked(IDC_VISFILLBLANKS);
-}
-
-
void CEffectVis::OnActionChanged()
{
m_nAction = m_cmbActionList.GetItemData(m_cmbActionList.GetCurSel());
- if (m_nAction == (UINT)kAction_Preserve)
+ if (m_nAction == (UINT)kAction_FillPC
+ || m_nAction == (UINT)kAction_OverwritePC
+ || m_nAction == (UINT)kAction_Preserve)
m_cmbEffectList.EnableWindow(FALSE);
else
m_cmbEffectList.EnableWindow(TRUE);
@@ -106,21 +96,54 @@
}
-BYTE CEffectVis::GetParam(UINT row)
-{ MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern];
+uint16 CEffectVis::GetParam(UINT row)
+{
+ MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern];
+ uint16 paramValue = 0;
+
if (pcmd)
- return pcmd[row*m_pSndFile->m_nChannels + m_nChan].param;
- else
- return 0;
+ {
+ MODCOMMAND cmd = pcmd[row*m_pSndFile->m_nChannels + m_nChan];
+ if (cmd.IsPcNote())
+ {
+ paramValue = cmd.GetValueEffectCol();
+ }
+ else
+ {
+ paramValue = cmd.param;
+ }
+ }
+
+ return paramValue;
}
-void CEffectVis::SetParam(UINT row, BYTE param)
+// Sets a row's param value based on the vertical cursor position.
+// Sets either plain pattern effect parameter or PC note parameter
+// as appropriate, depending on contents of row.
+void CEffectVis::SetParamFromY(UINT row, long y)
{
MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern];
- BEGIN_CRITICAL();
- if (pcmd)
- pcmd[row*m_pSndFile->m_nChannels + m_nChan].param = param;
- END_CRITICAL();
+ if (!pcmd) {
+ return;
+ }
+
+ int offset = row*m_pSndFile->m_nChannels + m_nChan;
+ if (IsPcNote(row))
+ {
+ uint16 param = ScreenYToPCParam(y);
+ BEGIN_CRITICAL();
+ pcmd[offset].SetValueEffectCol(param);
+ END_CRITICAL();
+ }
+ else
+ {
+ int param = ScreenYToFXParam(y);
+ // Cap the parameter value as appropriate, based on effect type (e.g. Zxx gets capped to [0x00,0x7F])
+ m_pModDoc->GetEffectFromIndex(m_pModDoc->GetIndexFromEffect(pcmd[offset].command, param), param);
+ BEGIN_CRITICAL();
+ pcmd[offset].param = static_cast<BYTE>(param);
+ END_CRITICAL();
+ }
}
@@ -133,12 +156,21 @@
return 0;
}
-void CEffectVis::SetCommand(UINT row, BYTE cmd)
+void CEffectVis::SetCommand(UINT row, BYTE command)
{
MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern];
BEGIN_CRITICAL();
- if (pcmd)
- pcmd[row*m_pSndFile->m_nChannels + m_nChan].command = cmd;
+ if (pcmd) {
+ int offset = row*m_pSndFile->m_nChannels + m_nChan;
+ if (pcmd[offset].IsPcNote()) {
+ // Clear PC note
+ pcmd[offset].note = 0;
+ pcmd[offset].instr = 0;
+ pcmd[offset].volcmd = 0;
+ pcmd[offset].vol = 0;
+ }
+ pcmd[offset].command = command;
+ }
END_CRITICAL();
}
@@ -149,24 +181,66 @@
return -1;
}
-int CEffectVis::ParamToScreenY(BYTE param)
+
+int CEffectVis::RowToScreenY(UINT row)
{
+ MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern];
+ int screenY = -1;
+
+ if (pcmd)
+ {
+ MODCOMMAND cmd = pcmd[row*m_pSndFile->m_nChannels + m_nChan];
+ if (cmd.IsPcNote())
+ {
+ uint16 paramValue = cmd.GetValueEffectCol();
+ screenY = PCParamToScreenY(paramValue);
+ }
+ else
+ {
+ uint16 paramValue = cmd.param;
+ screenY = FXParamToScreenY(paramValue);
+ }
+ }
+
+ return screenY;
+}
+
+int CEffectVis::FXParamToScreenY(uint16 param)
+{
if ((param >= 0x00) || (param <= 0xFF))
- return (int) (m_rcDraw.bottom - param*m_pixelsPerParam + 0.5);
+ return (int) (m_rcDraw.bottom - param*m_pixelsPerFXParam + 0.5);
return -1;
}
-BYTE CEffectVis::ScreenYToParam(int y)
+int CEffectVis::PCParamToScreenY(uint16 param)
{
- if (y<=ParamToScreenY(0xFF))
+ if ((param >= 0x00) || (param <= MODCOMMAND::maxColumnValue))
+ return (int) (m_rcDraw.bottom - param*m_pixelsPerPCParam + 0.5);
+ return -1;
+}
+
+BYTE CEffectVis::ScreenYToFXParam(int y)
+{
+ if (y<=FXParamToScreenY(0xFF))
return 0xFF;
- if (y>=ParamToScreenY(0x00))
+ if (y>=FXParamToScreenY(0x00))
return 0x00;
- return (BYTE)((m_rcDraw.bottom-y)/m_pixelsPerParam+0.5);
+ return (BYTE)((m_rcDraw.bottom-y)/m_pixelsPerFXParam+0.5);
}
+uint16 CEffectVis::ScreenYToPCParam(int y)
+{
+ if (y<=PCParamToScreenY(MODCOMMAND::maxColumnValue))
+ return MODCOMMAND::maxColumnValue;
+
+ if (y>=PCParamToScreenY(0x00))
+ return 0x00;
+
+ return (uint16)((m_rcDraw.bottom-y)/m_pixelsPerPCParam+0.5);
+}
+
UINT CEffectVis::ScreenXToRow(int x)
{
if (x<=RowToScreenX(m_startRow))
@@ -184,14 +258,14 @@
if (m_pViewPattern)
{
m_pViewPattern->m_pEffectVis = NULL;
- //m_pViewPattern = NULL;
}
}
void CEffectVis::DrawGrid()
{
- //Lots of space for opti here.
+ // Lots of room for optimisation here.
+ // Draw vertical grid lines
for (UINT row=m_startRow; row<=m_endRow; row++)
{
if (row % CMainFrame::m_nRowSpacing == 0)
@@ -204,35 +278,31 @@
int x1 = RowToScreenX(row);
m_dcGrid.MoveTo(x1, m_rcDraw.top);
m_dcGrid.LineTo(x1, m_rcDraw.bottom);
- //::DeletePen(CMainFrame::penScratch);
}
-
- for (UINT i=0; i<256; i+=64)
+ // Draw horizontal grid lines
+ const UINT numHorizontalLines = 4;
+ for (UINT i=0; i<numHorizontalLines; i++)
{
- switch (i)
+ switch (i%4)
{
case 0: CMainFrame::penScratch = CMainFrame::penGray00; break;
- case 64: CMainFrame::penScratch = CMainFrame::penGray40; break;
- case 128: CMainFrame::penScratch = CMainFrame::penGray80; break;
- case 192: CMainFrame::penScratch = CMainFrame::penGraycc; break;
+ case 1: CMainFrame::penScratch = CMainFrame::penGray40; break;
+ case 2: CMainFrame::penScratch = CMainFrame::penGray80; break;
+ case 3: CMainFrame::penScratch = CMainFrame::penGraycc; break;
}
m_dcGrid.SelectObject(CMainFrame::penScratch);
- int y1 = ParamToScreenY((BYTE)i);
+ int y1 = m_rcDraw.bottom/numHorizontalLines * i;
m_dcGrid.MoveTo(m_rcDraw.left+INNERLEFTBORDER, y1);
m_dcGrid.LineTo(m_rcDraw.right-INNERRIGHTBORDER, y1);
- //::DeletePen(CMainFrame::penScratch);
}
}
void CEffectVis::SetPlayCursor(UINT nPat, UINT nRow)
{
- //TEMP:
-// ::FillRect(m_dcPlayPos.m_hDC, &m_rcDraw, m_brushBlack);
-
int x1;
//erase current playpos:
if (m_nOldPlayPos>=m_startRow && m_nOldPlayPos<=m_endRow)
@@ -362,12 +432,13 @@
//---------------------------------------
{
//erase
- if (m_nRowToErase<m_startRow || m_nParamToErase<0)
+ if (m_nRowToErase<m_startRow || m_nParamToErase < 0)
+ {
::FillRect(m_dcNodes.m_hDC, &m_rcDraw, m_brushBlack);
+ }
else
{
int x = RowToScreenX(m_nRowToErase);
- //int y = ParamToScreenY(m_nParamToErase);
CRect r( x-NODEHALF-1, m_rcDraw.top, x-NODEHALF+NODESIZE+1, m_rcDraw.bottom);
::FillRect(m_dcNodes.m_hDC, r, m_brushBlack);
}
@@ -376,8 +447,8 @@
for (UINT row=m_startRow; row<=m_endRow; row++)
{
int x = RowToScreenX(row);
- int y = ParamToScreenY(GetParam(row));
- DibBlt(m_dcNodes.m_hDC, x-NODEHALF, y-NODEHALF, NODESIZE, NODESIZE, 0, 0, CMainFrame::bmpVisNode);
+ int y = RowToScreenY(row);
+ DibBlt(m_dcNodes.m_hDC, x-NODEHALF, y-NODEHALF, NODESIZE, NODESIZE, 0, 0, IsPcNote(row)? CMainFrame::bmpVisPcNode : CMainFrame::bmpVisNode);
}
}
@@ -433,7 +504,6 @@
VOID CEffectVis::DoClose()
//------------------------
{
- // delete fastDC;
m_dcGrid.SelectObject(m_pbOldGrid);
m_dcGrid.DeleteDC();
m_dcNodes.SelectObject(m_pbOldNodes);
@@ -453,7 +523,6 @@
}
m_hWnd = NULL;
delete this;
-// _CrtDumpMemoryLeaks();
}
@@ -463,21 +532,16 @@
void CEffectVis::OnSize(UINT nType, int cx, int cy)
{
- //CDialog::OnSize(nType, cx, cy);
- // TODO: Add your message handler code here
GetClientRect(&m_rcFullWin);
m_rcDraw.SetRect( m_rcFullWin.left + LEFTBORDER, m_rcFullWin.top + TOPBORDER,
m_rcFullWin.right - RIGHTBORDER, m_rcFullWin.bottom - BOTTOMBORDER);
#define INFOWIDTH 200
-#define CHECKBOXWIDTH 100
#define ACTIONLISTWIDTH 150
#define COMMANDLISTWIDTH 130
if (IsWindow(m_edVisStatus.m_hWnd))
- m_edVisStatus.SetWindowPos(this, m_rcFullWin.left, m_rcDraw.bottom, INFOWIDTH, m_rcFullWin.bottom-m_rcDraw.bottom, SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_SHOWWINDOW|SWP_NOZORDER);
-// if (IsWindow(m_btnFillCheck))
-// m_btnFillCheck.SetWindowPos(this, m_rcFullWin.right-COMMANDLISTWIDTH-CHECKBOXWIDTH, m_rcDraw.bottom, CHECKBOXWIDTH, m_rcFullWin.bottom-m_rcDraw.bottom, SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_SHOWWINDOW|SWP_NOZORDER);
+ m_edVisStatus.SetWindowPos(this, m_rcFullWin.left, m_rcDraw.bottom, m_rcFullWin.right-COMMANDLISTWIDTH-ACTIONLISTWIDTH, m_rcFullWin.bottom-m_rcDraw.bottom, SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_SHOWWINDOW|SWP_NOZORDER);
if (IsWindow(m_cmbActionList))
m_cmbActionList.SetWindowPos(this, m_rcFullWin.right-COMMANDLISTWIDTH-ACTIONLISTWIDTH, m_rcDraw.bottom, ACTIONLISTWIDTH, m_rcFullWin.bottom-m_rcDraw.bottom, SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_SHOWWINDOW|SWP_NOZORDER);
if (IsWindow(m_cmbEffectList))
@@ -485,7 +549,8 @@
m_pixelsPerRow = (float)(m_rcDraw.Width()-INNERLEFTBORDER-INNERRIGHTBORDER)/(float)m_nRows;
- m_pixelsPerParam = (float)(m_rcDraw.Height())/(float)0xFF;
+ m_pixelsPerFXParam = (float)(m_rcDraw.Height())/(float)0xFF;
+ m_pixelsPerPCParam = (float)(m_rcDraw.Height())/(float)MODCOMMAND::maxColumnValue;
m_boolForceRedraw = TRUE;
InvalidateRect(NULL, FALSE); //redraw everything
}
@@ -553,7 +618,7 @@
}
m_pixelsPerRow = (float)(m_rcDraw.right - m_rcDraw.left)/(float)m_nRows;
- m_pixelsPerParam = (float)(m_rcDraw.bottom - m_rcDraw.top)/(float)0xFF;
+ m_pixelsPerFXParam = (float)(m_rcDraw.bottom - m_rcDraw.top)/(float)0xFF;
m_boolForceRedraw = TRUE;
Update();
@@ -562,7 +627,6 @@
void CEffectVis::OnRButtonDown(UINT nFlags, CPoint point)
{
- // TODO: Add your message handler code here and/or call default
if (!(m_dwStatus & FXVSTATUS_LDRAGGING))
{
SetFocus();
@@ -574,7 +638,7 @@
for (UINT row=m_startRow; row<=m_endRow; row++)
{
int x = RowToScreenX(row);
- int y = ParamToScreenY(GetParam(row));
+ int y = RowToScreenY(row);
rect.SetRect(x-NODEHALF, y-NODEHALF, x+NODEHALF+1, y+NODEHALF+1);
if (rect.PtInRect(point))
{
@@ -590,80 +654,87 @@
void CEffectVis::OnRButtonUp(UINT nFlags, CPoint point)
{
- // TODO: Add your message handler code here and/or call default
ReleaseCapture();
m_dwStatus = 0x00;
m_nDragItem = -1;
- CDialog::OnLButtonUp(nFlags, point);
-
+ CDialog::OnRButtonUp(nFlags, point);
}
void CEffectVis::OnMouseMove(UINT nFlags, CPoint point)
{
- // TODO: Add your message handler code here and/or call default
CDialog::OnMouseMove(nFlags, point);
m_pModDoc = m_pViewPattern->GetDocument();
if (!m_pModDoc)
return;
- UINT row= ScreenXToRow(point.x);
- BYTE paramValue=ScreenYToParam(point.y);
+ UINT row = ScreenXToRow(point.x);
if ((m_dwStatus & FXVSTATUS_RDRAGGING) && (m_nDragItem>=0) )
{
m_nRowToErase = m_nDragItem;
m_nParamToErase = GetParam(m_nDragItem);
- MakeChange(m_nDragItem, paramValue);
- m_pModDoc->SetModified();
- m_pModDoc->UpdateAllViews(NULL, HINT_PATTERNDATA | (m_nPattern << HINT_SHIFT_PAT), NULL);
+ MakeChange(m_nDragItem, point.y);
}
else if ((m_dwStatus & FXVSTATUS_LDRAGGING))
{
- //Interpolate if there's a gap, but with no release of left mouse button.
- if ((m_nLastDrawnRow>(int)m_startRow) && (row != m_nLastDrawnRow) && (row != m_nLastDrawnRow+1) && (row != m_nLastDrawnRow-1))
+ // Interpolate if we detect that rows have been skipped but the left mouse button was not released.
+ // This ensures we produce a smooth curve even when we are not notified of mouse movements at a high frequency (e.g. if CPU usage is high)
+ if ((m_nLastDrawnRow>(int)m_startRow) && (row != m_nLastDrawnRow) && (row != m_nLastDrawnRow+1) && (row != m_nLastDrawnRow-1))
{
- int diff = abs((long)row-(long)m_nLastDrawnRow);
- ASSERT(diff!=0);
- int sign = ((int)(row-m_nLastDrawnRow) > 0) ? 1 : -1;
- float factor = (float)(paramValue-GetParam(m_nLastDrawnRow))/(float)diff + 0.5f;
+ int steps = abs((long)row-(long)m_nLastDrawnRow);
+ ASSERT(steps!=0);
+ int direction = ((int)(row-m_nLastDrawnRow) > 0) ? 1 : -1;
+ float factor = (float)(point.y - m_nLastDrawnY)/(float)steps + 0.5f;
int currentRow;
-
- for (int i=1; i<=diff; i++)
+ for (int i=1; i<=steps; i++)
{
- currentRow = m_nLastDrawnRow+(sign*i);
- int newParam = GetParam(m_nLastDrawnRow)+((float)i*factor+0.5f);
- if (newParam>0xFF) newParam = 0xFF; if (newParam<0x00) newParam = 0x00;
- MakeChange(currentRow, newParam);
+ currentRow = m_nLastDrawnRow+(direction*i);
+ int interpolatedY = m_nLastDrawnY+((float)i*factor+0.5f);
+ MakeChange(currentRow, interpolatedY);
}
-
- m_nRowToErase = -1; //Don't use single value update
+
+ //Don't use single value update
+ m_nRowToErase = -1;
m_nParamToErase = -1;
}
else
{
- //m_nLastDrawnRow = row;
m_nRowToErase = -1;
- m_nParamToErase = -1; //GetParam(row);
- MakeChange(row, paramValue);
+ m_nParamToErase = -1;
+ MakeChange(row, point.y);
}
+ // Remember last modified point in case we need to interpolate
m_nLastDrawnRow = row;
- m_pModDoc->SetModified();
- m_pModDoc->UpdateAllViews(NULL, HINT_PATTERNDATA | (m_nPattern << HINT_SHIFT_PAT), NULL);
+ m_nLastDrawnY = point.y;
+ }
+ //update status bar
+ CHAR status[256];
+ CHAR effectName[128];
+ uint16 paramValue;
+
+ if (IsPcNote(row))
+ {
+ paramValue = ScreenYToPCParam(point.y);
+ wsprintf(effectName, "%s", "Param Control"); //TODO - show smooth & plug+param
}
- //update status bar
- CHAR s[256];
- wsprintf(s, "Pat: %d\tChn: %d\tRow: %d\tVal: %02X", m_nPattern, m_nChan+1, row, paramValue);
- m_edVisStatus.SetWindowText(s);
+ else
+ {
+ paramValue = ScreenYToFXParam(point.y);
+ m_pModDoc->GetEffectInfo(m_pModDoc->GetIndexFromEffect(GetCommand(row), GetParam(row)), effectName, true);
+ }
+
+ wsprintf(status, "Pat: %d\tChn: %d\tRow: %d\tVal: %02X (%03d) [%s]",
+ m_nPattern, m_nChan+1, row, paramValue, paramValue, effectName);
+ m_edVisStatus.SetWindowText(status);
}
void CEffectVis::OnLButtonDown(UINT nFlags, CPoint point)
{
- // TODO: Add your message handler code here and/or call default
if (!(m_dwStatus & FXVSTATUS_RDRAGGING))
{
SetFocus();
@@ -678,74 +749,47 @@
void CEffectVis::OnLButtonUp(UINT nFlags, CPoint point)
{
- // TODO: Add your message handler code here and/or call default
ReleaseCapture();
m_dwStatus = 0x00;
CModControlDlg::OnLButtonUp(nFlags, point);
m_nLastDrawnRow = -1;
}
-//void CEffectVis::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
-//{
-// // TODO: Add your message handler code here and/or call default
-// CModControlDlg::OnChar(nChar, nRepCnt, nFlags);
-// m_pViewPattern->OnChar(nChar, nRepCnt, nFlags);
-//}
-//void CEffectVis::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
-//{
-// // TODO: Add your message handler code here and/or call default
-//
-// CModControlDlg::OnKeyDown(nChar, nRepCnt, nFlags);
-// m_pViewPattern->OnKeyDown(nChar, nRepCnt, nFlags);
-//}
-
-//void CEffectVis::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
-//{
-// // TODO: Add your message handler code here and/or call default
-//
-// CModControlDlg::OnKeyUp(nChar, nRepCnt, nFlags);
-// m_pViewPattern->OnKeyUp(nChar, nRepCnt, nFlags);
-//}
-
-//void CEffectVis::OnMButtonDown(UINT nFlags, CPoint point)
-//{
-// // TODO: Add your message handler code here and/or call default
-//
-// CModControlDlg::OnMButtonDown(nFlags, point);
-//}
-
void CEffectVis::OnEditUndo()
{
CHAR s[64];
wsprintf(s, "Undo Through!");
::MessageBox(NULL, s, NULL, MB_OK|MB_ICONEXCLAMATION);
}
-//void CEffectVis::OnStnClickedVisstatus()
-//{
-// // TODO: Add your control notification handler code here
-//}
-//void CEffectVis::OnEnChangeVisstatus()
-//{
-// // TODO: If this is a RICHEDIT control, the control will not
-// // send this notification unless you override the CModControlDlg::OnInitDialog()
-// // function and call CRichEditCtrl().SetEventMask()
-// // with the ENM_CHANGE flag ORed into the mask.
-//
-// // TODO: Add your control notification handler code here
-//}
-
BOOL CEffectVis::OnInitDialog()
//--------------------------------
{
CModControlDlg::OnInitDialog();
- m_bFillCheck=true;
- m_btnFillCheck.SetCheck(m_bFillCheck);
- m_nFillEffect=m_pModDoc->GetIndexFromEffect(GetCommand(m_startRow), GetParam(m_startRow));
- if (m_nFillEffect<0)
- m_nFillEffect=28;
+ if (IsPcNote(m_startRow))
+ {
+ // If first selected row is a PC Note, default to PC note overwrite mode
+ // and use it as a template for new PC notes that will be created via the visualiser.
+ m_nAction = kAction_OverwritePC;
+ MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern];
+ if (pcmd) {
+ int offset = m_startRow*m_pSndFile->m_nChannels + m_nChan;
+ m_templatePCNote.Set(pcmd[offset].note, pcmd[offset].instr, pcmd[offset].GetValueVolCol(), 0);
+ }
+ m_cmbEffectList.EnableWindow(FALSE);
+ }
+ else
+ {
+ // Otherwise, default to FX overwrite and
+ // use effect of first selected row as default effect type
+ m_nAction = kAction_OverwriteFX;
+ m_nFillEffect = m_pModDoc->GetIndexFromEffect(GetCommand(m_startRow), GetParam(m_startRow));
+ if (m_nFillEffect<0 || m_nFillEffect>=MAX_EFFECTS)
+ m_nFillEffect = m_pModDoc->GetIndexFromEffect(CMD_SMOOTHMIDI, 0);
+ }
+
CHAR s[128];
UINT numfx = m_pModDoc->GetNumEffects();
m_cmbEffectList.ResetContent();
@@ -762,44 +806,91 @@
}
m_cmbActionList.ResetContent();
- m_cmbActionList.SetItemData(m_cmbActionList.AddString("Overwrite FX type with:"), kAction_Overwrite);
- m_cmbActionList.SetItemData(m_cmbActionList.AddString("Fill blanks with:"),kAction_Fill);
- m_cmbActionList.SetItemData(m_cmbActionList.AddString("Keep FX type."),kAction_Preserve);
+ m_cmbActionList.SetItemData(m_cmbActionList.AddString("Overwrite with effect:"), kAction_OverwriteFX);
+ m_cmbActionList.SetItemData(m_cmbActionList.AddString("Fill blanks with effect:"), kAction_FillFX);
+ m_cmbActionList.SetItemData(m_cmbActionList.AddString("Overwrite with PC note"), kAction_OverwritePC);
+ m_cmbActionList.SetItemData(m_cmbActionList.AddString("Fill blanks with PC note"), kAction_FillPC);
+ m_cmbActionList.SetItemData(m_cmbActionList.AddString("Never change effect type"), kAction_Preserve);
+
m_cmbActionList.SetCurSel(m_nAction);
return true;
}
-void CEffectVis::MakeChange(int currentRow, int newParam)
+void CEffectVis::MakeChange(int row, long y)
{
- int currentCommand=GetCommand(currentRow);
+ MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern];
+ if (!pcmd) {
+ return;
+ }
+ int offset = row*m_pSndFile->m_nChannels + m_nChan;
+
switch (m_nAction)
{
- case kAction_Preserve:
- if (currentCommand) { //Only set param if we have an effect type here
- m_pModDoc->GetEffectFromIndex(m_pModDoc->GetIndexFromEffect(currentCommand, m_nParamToErase), newParam);
- SetParam(currentRow, newParam);
+ case kAction_FillFX:
+ // Only set command if there isn't a command already at this row and it's not a PC note
+ if (!GetCommand(row) && !IsPcNote(row))
+ {
+ SetCommand(row, m_pModDoc->GetEffectFromIndex(m_nFillEffect));
}
+ // Always set param
+ SetParamFromY(row, y);
break;
+
+ case kAction_OverwriteFX:
+ // Always set command and param. Blows away any PC notes.
+ SetCommand(row, m_pModDoc->GetEffectFromIndex(m_nFillEffect));
+ SetParamFromY(row, y);
+ break;
- case kAction_Fill:
- if (currentCommand) { //If we have an effect type here, just set param
- m_pModDoc->GetEffectFromIndex(m_pModDoc->GetIndexFromEffect(currentCommand, m_nParamToErase), newParam);
- SetParam(currentRow, newParam);
- }
- else //Else set command and param
+ case kAction_FillPC:
+ // Fill only empty slots with PC notes - leave other slots alone.
+ if (pcmd[offset].IsEmpty())
{
- SetCommand(currentRow, m_pModDoc->GetEffectFromIndex(m_nFillEffect, newParam));
- SetParam(currentRow, newParam);
+ SetPcNote(row);
}
+ // Always set param
+ SetParamFromY(row, y);
break;
- case kAction_Overwrite:
- //Always set command and param
- SetCommand(currentRow, m_pModDoc->GetEffectFromIndex(m_nFillEffect, newParam));
- SetParam(currentRow, newParam);
+ case kAction_OverwritePC:
+ // Always convert to PC Note and set param value
+ SetPcNote(row);
+ SetParamFromY(row, y);
+ break;
+
+ case kAction_Preserve:
+ if (GetCommand(row) || IsPcNote(row)) {
+ // Only set param if we have an effect type or if this is a PC note.
+ // Never change the effect type.
+ SetParamFromY(row, y);
+ }
+ break;
+
}
- return;
+ m_pModDoc->SetModified();
+ m_pModDoc->UpdateAllViews(NULL, HINT_PATTERNDATA | (m_nPattern << HINT_SHIFT_PAT), NULL);
}
+void CEffectVis::SetPcNote(int row)
+{
+ MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern];
+ if (!pcmd) {
+ return;
+ }
+
+ int offset = row*m_pSndFile->m_nChannels + m_nChan;
+ BEGIN_CRITICAL();
+ pcmd[offset].Set(m_templatePCNote.note, m_templatePCNote.instr, m_templatePCNote.GetValueVolCol(), 0);
+ END_CRITICAL();
+}
+
+bool CEffectVis::IsPcNote(int row)
+{
+ MODCOMMAND *pcmd = m_pSndFile->Patterns[m_nPattern];
+ if (pcmd)
+ return pcmd[row*m_pSndFile->m_nChannels + m_nChan].IsPcNote();
+ else
+ return false;
+}
\ No newline at end of file
Modified: trunk/OpenMPT/mptrack/EffectVis.h
===================================================================
--- trunk/OpenMPT/mptrack/EffectVis.h 2010-03-21 22:07:22 UTC (rev 543)
+++ trunk/OpenMPT/mptrack/EffectVis.h 2010-03-22 20:17:53 UTC (rev 544)
@@ -8,19 +8,21 @@
//#define FXVSTATUS_NCLBTNDOWN 0x02
//#define INSSTATUS_SPLITCURSOR 0x04
-enum
-{
- kAction_Overwrite=0,
- kAction_Fill,
- kAction_Preserve
-};
-
// EffectVis dialog
class CEffectVis : public CModControlDlg
{
DECLARE_DYNAMIC(CEffectVis)
public:
+ enum
+ {
+ kAction_OverwriteFX=0,
+ kAction_FillFX,
+ kAction_OverwritePC,
+ kAction_FillPC,
+ kAction_Preserve
+ };
+
CEffectVis(CViewPattern *pViewPattern, UINT startRow, UINT endRow, UINT nchn, CModDoc* pModDoc, UINT pat);
virtual ~CEffectVis();
//{{AFX_VIRTUAL(CEffectVis)
@@ -47,15 +49,13 @@
RECT invalidated;
int m_nLastDrawnRow; // for interpolation
+ long m_nLastDrawnY; // for interpolation
int m_nRowToErase;
int m_nParamToErase;
UINT m_nOldPlayPos;
+ MODCOMMAND m_templatePCNote;
-
-// int m_nRectWidth, m_nRectHeight;
-// CRect m_rectDraw;
-// CRect m_rectOwner;
CBrush m_brushBlack;
public:
@@ -71,18 +71,23 @@
DWORD m_dwStatus;
void InvalidateRow(int row);
- float m_pixelsPerRow, m_pixelsPerParam;
+ float m_pixelsPerRow, m_pixelsPerFXParam, m_pixelsPerPCParam;
void UpdateSelection(UINT startRow, UINT endRow, UINT nchn, CModDoc* m_pModDoc, UINT pats);
void Update();
int RowToScreenX(UINT row);
- int ParamToScreenY(BYTE param);
- BYTE GetParam(UINT row);
+ int RowToScreenY(UINT row);
+ int PCParamToScreenY(uint16 param);
+ int FXParamToScreenY(uint16 param);
+ uint16 GetParam(UINT row);
BYTE GetCommand(UINT row);
- void SetParam(UINT row, BYTE param);
+ void SetParamFromY(UINT row, long y);
void SetCommand(UINT row, BYTE cmd);
- BYTE ScreenYToParam(int y);
+ BYTE ScreenYToFXParam(int y);
+ uint16 ScreenYToPCParam(int y);
UINT ScreenXToRow(int x);
void SetPlayCursor(UINT nPat, UINT nRow);
+ bool IsPcNote(int row);
+ void SetPcNote(int row);
CSoundFile* m_pSndFile;
CModDoc* m_pModDoc;
@@ -90,8 +95,6 @@
CRect m_rcFullWin;
CComboBox m_cmbEffectList, m_cmbActionList;
- CButton m_btnFillCheck;
- bool m_bFillCheck;
CEdit m_edVisStatus;
virtual VOID OnOK();
@@ -116,18 +119,13 @@
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
- afx_msg void OnFillBlanksCheck();
afx_msg void OnEffectChanged();
afx_msg void OnActionChanged();
-// afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
-// afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
-// afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
-// afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
//{{AFX_MSG(CEffectVis)
afx_msg void OnEditUndo();
//}}AFX_MSG
private:
- void MakeChange(int currentRow, int newParam);
+ void MakeChange(int currentRow, long newY);
};
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-21 22:07:22 UTC (rev 543)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-22 20:17:53 UTC (rev 544)
@@ -246,7 +246,8 @@
LPMODPLUGDIB CMainFrame::bmpPatterns = NULL;
LPMODPLUGDIB CMainFrame::bmpNotes = NULL;
LPMODPLUGDIB CMainFrame::bmpVUMeters = NULL;
-LPMODPLUGDIB CMainFrame::bmpVisNode = NULL; //rewbs.fxVis
+LPMODPLUGDIB CMainFrame::bmpVisNode = NULL;
+LPMODPLUGDIB CMainFrame::bmpVisPcNode = NULL;
HPEN CMainFrame::gpenVuMeter[NUM_VUMETER_PENS*2];
COLORREF CMainFrame::rgbCustomColors[MAX_MODCOLORS] =
{
@@ -772,7 +773,8 @@
bmpPatterns = LoadDib(MAKEINTRESOURCE(IDB_PATTERNS));
bmpNotes = LoadDib(MAKEINTRESOURCE(IDB_PATTERNVIEW));
bmpVUMeters = LoadDib(MAKEINTRESOURCE(IDB_VUMETERS));
- bmpVisNode = LoadDib(MAKEINTRESOURCE(IDB_VISNODE)); //rewbs.fxVis
+ bmpVisNode = LoadDib(MAKEINTRESOURCE(IDB_VISNODE));
+ bmpVisPcNode = LoadDib(MAKEINTRESOURCE(IDB_VISPCNODE));
UpdateColors();
// Toolbars
EnableDocking(CBRS_ALIGN_ANY);
@@ -849,6 +851,11 @@
delete bmpVisNode;
bmpVisNode = NULL;
}
+ if (bmpVisPcNode)
+ {
+ delete bmpVisPcNode;
+ bmpVisPcNode = NULL;
+ }
// Kill GDI Objects
DeleteGDIObject(brushGray);
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2010-03-21 22:07:22 UTC (rev 543)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-03-22 20:17:53 UTC (rev 544)
@@ -442,7 +442,7 @@
static HPEN penBlack, penDarkGray, penLightGray, penWhite, penHalfDarkGray, penSample, penEnvelope, penEnvelopeHighlight, penSeparator, penScratch, penGray00, penGray33, penGray40, penGray55, penGray80, penGray99, penGraycc, penGrayff;
static HCURSOR curDragging, curNoDrop, curArrow, curNoDrop2, curVSplit;
static COLORREF rgbCustomColors[MAX_MODCOLORS];
- static LPMODPLUGDIB bmpPatterns, bmpNotes, bmpVUMeters, bmpVisNode;
+ static LPMODPLUGDIB bmpPatterns, bmpNotes, bmpVUMeters, bmpVisNode, bmpVisPcNode;
static HPEN gpenVuMeter[NUM_VUMETER_PENS*2];
// key config
static TCHAR m_szKbdFile[_MAX_PATH];
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-21 22:07:22 UTC (rev 543)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-22 20:17:53 UTC (rev 544)
@@ -2224,6 +2224,17 @@
return gFXInfo[ndx].dwEffect;
}
+
+UINT CModDoc::GetEffectFromIndex(UINT ndx)
+//----------------------------------------
+{
+ if (ndx >= MAX_FXINFO) {
+ return 0;
+ }
+
+ return gFXInfo[ndx].dwEffect;
+}
+
UINT CModDoc::GetEffectMaskFromIndex(UINT ndx)
//-------------------------------------------------------
{
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2010-03-21 22:07:22 UTC (rev 543)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2010-03-22 20:17:53 UTC (rev 544)
@@ -193,6 +193,7 @@
bool GetEffectInfo(UINT ndx, LPSTR s, bool bXX = false, DWORD *prangeMin=NULL, DWORD *prangeMax=NULL);
LONG GetIndexFromEffect(UINT command, UINT param);
UINT GetEffectFromIndex(UINT ndx, int &refParam);
+ UINT GetEffectFromIndex(UINT ndx);
UINT GetEffectMaskFromIndex(UINT ndx);
bool GetEffectNameEx(LPSTR pszName, UINT ndx, UINT param);
BOOL IsExtendedEffect(UINT ndx) const;
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-21 22:07:22 UTC (rev 543)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-22 20:17:53 UTC (rev 544)
@@ -2481,7 +2481,8 @@
p = pSndFile->Patterns[m_nPattern] + r * pSndFile->m_nChannels + c;
// If a note or an instr is present on the row, do the change, if required.
// Do not set instr if note and instr are both blank.
- if ( ((p->note > 0 && p->note < NOTE_MIN_SPECIAL) ||p->instr) && (p->instr!=nIns) ) {
+ // Do set instr if note is a PC note and instr is blank.
+ if ( ((p->note > 0 && p->note < NOTE_MIN_SPECIAL) || MODCOMMAND::IsPcNote(p->note) || p->instr) && (p->instr!=nIns) ) {
p->instr = nIns;
bModified = TRUE;
}
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2010-03-21 22:07:22 UTC (rev 543)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2010-03-22 20:17:53 UTC (rev 544)
@@ -13,7 +13,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Deutsch (Deutschland) resources
+// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
@@ -207,12 +207,12 @@
END
#endif // APSTUDIO_INVOKED
-#endif // Deutsch (Deutschland) resources
+#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// Englisch (USA) resources
+// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
@@ -1302,17 +1302,16 @@
PUSHBUTTON "Save",IDC_BUTTON2,193,39,36,14
END
-IDD_EFFECTVISUALIZER DIALOGEX 0, 0, 385, 108
-STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+IDD_EFFECTVISUALIZER DIALOGEX 0, 0, 422, 109
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
CAPTION "Param Editor"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- EDITTEXT IDC_VISSTATUS,4,91,162,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_STATICEDGE
- CONTROL "Fill blanks with:",IDC_VISFILLBLANKS,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,188,92,63,10
+ EDITTEXT IDC_VISSTATUS,4,92,162,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_STATICEDGE
COMBOBOX IDC_VISEFFECTLIST,299,89,76,158,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_VISACTION,221,90,76,158,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "",IDC_RENDERZONE,4,3,377,84,NOT WS_VISIBLE
+ LTEXT "",IDC_RENDERZONE,4,3,414,84,NOT WS_VISIBLE
END
IDD_SOUNDBANK_INFO1 DIALOGEX 0, 0, 271, 167
@@ -1722,9 +1721,9 @@
IDD_EFFECTVISUALIZER, DIALOG
BEGIN
LEFTMARGIN, 4
- RIGHTMARGIN, 381
+ RIGHTMARGIN, 418
TOPMARGIN, 3
- BOTTOMMARGIN, 103
+ BOTTOMMARGIN, 104
END
IDD_SOUNDBANK_INFO1, DIALOG
@@ -1851,6 +1850,7 @@
IDB_ENVTOOLBAR BITMAP "res\\envbar.bmp"
IDB_SMPTOOLBAR BITMAP "res\\smptoolb.bmp"
IDB_VISNODE BITMAP "res\\bitmap1.bmp"
+IDB_VISPCNODE BITMAP "res\\vispcnode.bmp"
/////////////////////////////////////////////////////////////////////////////
//
@@ -2378,12 +2378,12 @@
IDS_SOUNDTOUCH_LOADFAILURE "Unable to load OpenMPT_soundtouch_i16.dll."
END
-#endif // Englisch (USA) resources
+#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// Englisch (GB) resources
+// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
@@ -2752,7 +2752,7 @@
//
IDR_BUILTIN_TUNINGS TUNING "res\\built-inTunings.tc"
-#endif // Englisch (GB) resources
+#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj
===================================================================
--- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2010-03-21 22:07:22 UTC (rev 543)
+++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2010-03-22 20:17:53 UTC (rev 544)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="mptrack"
ProjectGUID="{21D95071-FB97-4E69-B3B1-050D0D4A5021}"
RootNamespace="mptrack"
@@ -49,7 +49,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/EHsc"
Optimization="0"
- AdditionalIncludeDirectories="..\unlha,..\unzip,..\unrar,..\soundlib,..\include,..\xsoundlib,..\"
+ AdditionalIncludeDirectories="..\unlha;..\unzip;..\unrar;..\soundlib;..\include;..\xsoundlib;..\"
PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,ENABLE_EQ,MODPLUG_TRACKER,NO_PACKING,HAVE_DOT_NET,ENABLE_AMD,ENABLE_SSE,ENABLE_AMDNOW,ENABLE_MMX"
StringPooling="true"
BasicRuntimeChecks="3"
@@ -922,6 +922,14 @@
>
</File>
<File
+ RelativePath=".\res\visnode1.bmp"
+ >
+ </File>
+ <File
+ RelativePath=".\res\vispcnode.bmp"
+ >
+ </File>
+ <File
RelativePath=".\res\vumeters.bmp"
>
</File>
Added: trunk/OpenMPT/mptrack/res/vispcnode.bmp
===================================================================
(Binary files differ)
Property changes on: trunk/OpenMPT/mptrack/res/vispcnode.bmp
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2010-03-21 22:07:22 UTC (rev 543)
+++ trunk/OpenMPT/mptrack/resource.h 2010-03-22 20:17:53 UTC (rev 544)
@@ -103,6 +103,8 @@
#define IDB_SPLASHTEST 432
#define IDB_SPLASHNOFOLDFIN 435
#define IDR_VSTMENU 436
+#define IDB_VISNODE1 436
+#define IDB_VISPCNODE 436
#define IDD_DEFAULTPLUGINEDITOR 438
#define IDD_CHANNELMANAGER 440
#define IDD_SOUNDBANK_INFO1 441
Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb
===================================================================
--- trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb 2010-03-21 22:07:22 UTC (rev 543)
+++ trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb 2010-03-22 20:17:53 UTC (rev 544)
@@ -119,9 +119,9 @@
3:1070:0:71:1 //Base octave F#: G (KeyDown)
3:1071:0:66:1 //Base octave G: B (KeyDown)
3:1072:0:72:1 //Base octave G#: H (KeyDown)
-3:1073:0:78:1 //Base octave +1 A: N (KeyDown)
-3:1074:0:74:1 //Base octave +1 A#: J (KeyDown)
-3:1075:0:77:1 //Base octave +1 B: M (KeyDown)
+3:1073:0:78:1 //Base octave A: N (KeyDown)
+3:1074:0:74:1 //Base octave A#: J (KeyDown)
+3:1075:0:77:1 //Base octave B: M (KeyDown)
3:1076:0:81:1 //Base octave +1 C: Q (KeyDown)
3:1077:0:50:1 //Base octave +1 C#: 2 (KeyDown)
3:1078:0:87:1 //Base octave +1 D: W (KeyDown)
@@ -131,9 +131,9 @@
3:1082:0:53:1 //Base octave +1 F#: 5 (KeyDown)
3:1083:0:84:1 //Base octave +1 G: T (KeyDown)
3:1084:0:54:1 //Base octave +1 G#: 6 (KeyDown)
-3:1085:0:89:1 //Base octave +2 A: Y (KeyDown)
-3:1086:0:55:1 //Base octave +2 A#: 7 (KeyDown)
-3:1087:0:85:1 //Base octave +2 B: U (KeyDown)
+3:1085:0:89:1 //Base octave +1 A: Y (KeyDown)
+3:1086:0:55:1 //Base octave +1 A#: 7 (KeyDown)
+3:1087:0:85:1 //Base octave +1 B: U (KeyDown)
3:1088:0:73:1 //Base octave +2 C: I (KeyDown)
3:1089:0:57:1 //Base octave +2 C#: 9 (KeyDown)
3:1090:0:79:1 //Base octave +2 D: O (KeyDown)
@@ -151,11 +151,13 @@
3:1220:0:104:1 //Set octave 8: NUM 8 (KeyDown)
3:1221:0:105:1 //Set octave 9: NUM 9 (KeyDown)
3:1316:1:16:1 //Chord Modifier: Shift (KeyDown)
-3:1200:0:49:1 //Note cut: 1 (KeyDown)
-3:1201:0:223:1 //Note off: ` (KeyDown)
-3:1201:0:187:1 //Note off: = (KeyDown)
-3:1667:1:49:1 //Note cut (don't remember instrument): Shift+1 (KeyDown)
-3:1668:1:223:1 //Note off (don't remember instrument): Shift+` (KeyDown)
+3:1200:0:49:1 //Note Cut: 1 (KeyDown)
+3:1201:0:223:1 //Note Off: ` (KeyDown)
+3:1201:0:187:1 //Note Off: = (KeyDown)
+3:1667:1:49:1 //Note Cut (don't remember instrument): Shift+1 (KeyDown)
+3:1668:1:223:1 //Note Off (don't remember instrument): Shift+` (KeyDown)
+3:1788:1:222:1 //Parameter control(MPTm only): Shift+# (KeyDown)
+3:1789:0:222:1 //Parameter control(smooth)(MPTm only): # (KeyDown)
//----( Pattern Context [bottom] - Ins Col (4) )------------
4:1202:0:96:1 //Set instrument digit 0: NUM 0 (KeyDown)
@@ -314,6 +316,6 @@
19:1816:0:57:5 //Pattern index digit 9: 9 (KeyDown|KeyHold)
19:1816:0:105:5 //Pattern index digit 9: NUM 9 (KeyDown|KeyHold)
19:1817:0:107:5 //Increase pattern index : NUM PLUS (KeyDown|KeyHold)
-19:1817:0:187:5 //Increase pattern index : + (KeyDown|KeyHold)
+19:1817:0:187:5 //Increase pattern index : = (KeyDown|KeyHold)
19:1818:0:109:1 //Decrease pattern index: NUM SUB (KeyDown)
19:1818:0:189:1 //Decrease pattern index: - (KeyDown)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-21 22:07:32
|
Revision: 543
http://modplug.svn.sourceforge.net/modplug/?rev=543&view=rev
Author: saga-games
Date: 2010-03-21 22:07:22 +0000 (Sun, 21 Mar 2010)
Log Message:
-----------
[Imp] ULT Loader: Experimental fixing of the 3xx and F00 effects.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Load_ult.cpp
Modified: trunk/OpenMPT/soundlib/Load_ult.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_ult.cpp 2010-03-21 21:29:43 UTC (rev 542)
+++ trunk/OpenMPT/soundlib/Load_ult.cpp 2010-03-21 22:07:22 UTC (rev 543)
@@ -42,11 +42,7 @@
9xx - set sample offset to xx * 1024
with 9yy: set sample offset to xxyy * 4
E0x - set vibrato strength (2 is normal)
-F00 - reset speed/tempo to 6/125
-Apparently 3xx will CONTINUE to slide until it reaches its destination, or
-until a 300 effect is encountered. I'm not attempting to handle this (yet).
-
The logarithmic volume scale used in older format versions here, or pretty
much anywhere for that matter. I don't even think Ultra Tracker tries to
convert them. */
@@ -85,11 +81,6 @@
if (!p)
*pe = CMD_NONE;
break;
- case 0x03:
- // 300 apparently stops sliding, which is totally weird
- if (!p)
- p = 1; // close enough?
- break;
case 0x05:
// play backwards
if((p & 0x0F) == 0x02)
@@ -242,6 +233,76 @@
return repeat;
}
+// Functor for postfixing ULT patterns (this is easier than just remembering everything WHILE we're reading the pattern events)
+struct PostFixUltCommands
+//=======================
+{
+ PostFixUltCommands(CHANNELINDEX numChannels)
+ {
+ this->numChannels = numChannels;
+ curChannel = 0;
+ writeT125 = false;
+ isPortaActive.resize(numChannels, false);
+ }
+
+ void operator()(MODCOMMAND& m)
+ {
+ // Attempt to fix portamentos.
+ // UltraTracker will slide until the destination note is reached or 300 is encountered.
+
+ // Stop porta?
+ if(m.command == CMD_TONEPORTAMENTO && m.param == 0)
+ {
+ isPortaActive[curChannel] = false;
+ m.command = CMD_NONE;
+ }
+ if(m.volcmd == VOLCMD_TONEPORTAMENTO && m.vol == 0)
+ {
+ isPortaActive[curChannel] = false;
+ m.volcmd = VOLCMD_NONE;
+ }
+
+ // Apply porta?
+ if(m.note == NOTE_NONE && isPortaActive[curChannel])
+ {
+ if(m.command == CMD_NONE && m.vol != VOLCMD_TONEPORTAMENTO)
+ {
+ m.command = CMD_TONEPORTAMENTO;
+ m.param = 0;
+ } else if(m.volcmd == VOLCMD_NONE && m.command != CMD_TONEPORTAMENTO)
+ {
+ m.volcmd = VOLCMD_TONEPORTAMENTO;
+ m.vol = 0;
+ }
+ } else // new note -> stop porta (or initialize again)
+ {
+ isPortaActive[curChannel] = (m.command == CMD_TONEPORTAMENTO || m.volcmd == VOLCMD_TONEPORTAMENTO);
+ }
+
+ // attempt to fix F00 (reset to tempo 125, speed 6)
+ if(writeT125 && m.command == CMD_NONE)
+ {
+ m.command = CMD_TEMPO;
+ m.param = 125;
+ }
+ if(m.command == CMD_SPEED && m.param == 0)
+ {
+ m.param = 6;
+ writeT125 = true;
+ }
+ if(m.command == CMD_TEMPO) // don't try to fix this anymore if the tempo has already changed.
+ {
+ writeT125 = false;
+ }
+ curChannel = (curChannel + 1) % numChannels;
+ }
+
+ vector<bool> isPortaActive;
+ bool writeT125;
+ CHANNELINDEX numChannels, curChannel;
+};
+
+
bool CSoundFile::ReadUlt(const BYTE *lpStream, DWORD dwMemLength)
//---------------------------------------------------------------
{
@@ -409,6 +470,9 @@
}
}
+ // Post-fix some effects.
+ Patterns.ForEachModCommand(PostFixUltCommands(m_nChannels));
+
for(SAMPLEINDEX nSmp = 0; nSmp < m_nSamples; nSmp++)
{
dwMemPos += ReadSample(&Samples[nSmp + 1], (Samples[nSmp + 1].uFlags & CHN_16BIT) ? RS_PCM16S : RS_PCM8S, (LPCSTR)(lpStream + dwMemPos), dwMemLength - dwMemPos);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rel...@us...> - 2010-03-21 21:29:51
|
Revision: 542
http://modplug.svn.sourceforge.net/modplug/?rev=542&view=rev
Author: relabsoluness
Date: 2010-03-21 21:29:43 +0000 (Sun, 21 Mar 2010)
Log Message:
-----------
[Fix] VST: Some VSTs that previously wouldn't load might now load fine.
[Fix] Instrument tuning: Minor fixes to ratio window, made tuning collection loading more reliable, minor other changes.
[Fix] Serialization code: Fixed a memory leak in write functions, added alternative way to read entries and minor other changes.
[Mod] Mod specs: Reduced xmEx sample count to 4000.
[Ref] Added CountOf-macro (a better alternative to ARRAYELEMCOUNT-macro).
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/serialization_utils.cpp
trunk/OpenMPT/mptrack/serialization_utils.h
trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp
trunk/OpenMPT/mptrack/typedefs.h
trunk/OpenMPT/soundlib/mod_specifications.h
trunk/OpenMPT/soundlib/tuning.cpp
trunk/OpenMPT/soundlib/tuningCollection.cpp
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-03-21 17:25:13 UTC (rev 541)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-03-21 21:29:43 UTC (rev 542)
@@ -708,7 +708,8 @@
// Returns the unique id of a plug that's currently loading
// (not sure what this is actually for - we return *effect's UID, cos Herman Seib does something similar :)
// Let's see what happens...)
- case audioMasterCurrentId: return effect->uniqueID;
+ case audioMasterCurrentId:
+ return (effect != nullptr) ? effect->uniqueID : 0;
// Call application idle routine (this will call effEditIdle for all open editors too)
case audioMasterIdle:
OnIdle();
Modified: trunk/OpenMPT/mptrack/serialization_utils.cpp
===================================================================
--- trunk/OpenMPT/mptrack/serialization_utils.cpp 2010-03-21 17:25:13 UTC (rev 541)
+++ trunk/OpenMPT/mptrack/serialization_utils.cpp 2010-03-21 21:29:43 UTC (rev 542)
@@ -863,8 +863,11 @@
if (m_fpLogFunc)
m_fpLogFunc(tstrWritingMap, uint32(m_posMapStart - m_posStart));
- if(GetFlag(RwfRwHasMap)) //Write map
+ if (GetFlag(RwfRwHasMap)) //Write map
+ {
oStrm.write(m_MapStream.str(), m_MapStream.pcount());
+ m_MapStream.freeze(false);
+ }
const Postype posMapEnd = oStrm.tellp();
Modified: trunk/OpenMPT/mptrack/serialization_utils.h
===================================================================
--- trunk/OpenMPT/mptrack/serialization_utils.h 2010-03-21 17:25:13 UTC (rev 541)
+++ trunk/OpenMPT/mptrack/serialization_utils.h 2010-03-21 21:29:43 UTC (rev 542)
@@ -127,6 +127,11 @@
EntryRead,
EntryNotFound
};
+ enum IdMatchStatus
+ {
+ IdMatch, IdMismatch
+ };
+ typedef std::vector<ReadEntry>::const_iterator ReadIterator;
Ssb(InStream* pIstrm, OutStream* pOstrm);
Ssb(IoStream& ioStrm);
@@ -142,7 +147,7 @@
void BeginWrite(const void* pId, const size_t nIdSize, const uint64& nVersion);
void BeginWrite(const LPCSTR pszId, const uint64& nVersion) {BeginWrite(pszId, strlen(pszId), nVersion);}
- // Read header.
+ // Call this to begin reading: must be called before other read functions.
void BeginRead(const void* pId, const size_t nLength, const uint64& nVersion);
void BeginRead(const LPCSTR pszId, const uint64& nVersion) {return BeginRead(pszId, strlen(pszId), nVersion);}
@@ -170,6 +175,18 @@
// After calling BeginRead(), this returns number of entries in the file.
NumType GetNumEntries() const {return m_nReadEntrycount;}
+ // Returns read iterator to the beginning of entries.
+ // The behaviour of read iterators is undefined if map doesn't
+ // contain entry ids or data begin positions.
+ ReadIterator GetReadBegin();
+
+ // Returns read iterator to the end(one past last) of entries.
+ ReadIterator GetReadEnd();
+
+ // Compares given id with read entry id
+ IdMatchStatus CompareId(const ReadIterator& iter, LPCSTR pszId) {return CompareId(iter, pszId, strlen(pszId));}
+ IdMatchStatus CompareId(const ReadIterator& iter, const void* pId, const size_t nIdSize);
+
// When writing, returns the number of entries written.
// When reading, returns the number of entries read not including unrecognized entries.
NumType GetCounter() const {return m_nCounter;}
@@ -187,6 +204,12 @@
template <class T, class FuncObj>
ReadRv ReadItem(T& obj, const void* pId, const size_t nIdSize, FuncObj);
+ // Read item using read iterator.
+ template <class T>
+ ReadRv ReadItem(const ReadIterator& iter, T& obj) {return ReadItem(iter, obj, srlztn::ReadItem<T>);}
+ template <class T, class FuncObj>
+ ReadRv ReadItem(const ReadIterator& iter, T& obj, FuncObj func);
+
// Write item using default write implementation.
template <class T>
void WriteItem(const T& obj, const LPCSTR pszId) {WriteItem(obj, pszId, strlen(pszId), &srlztn::WriteItem<T>);}
@@ -204,6 +227,9 @@
void SetFlag(Rwf flag, bool val) {m_Flags.set(flag, val);}
bool GetFlag(Rwf flag) const {return m_Flags[flag];}
+ // Write given string to log if log func is defined.
+ void Log(LPCTSTR psz) {if (m_fpLogFunc) m_fpLogFunc(psz);}
+
SsbStatus m_Status;
uint32 m_nFixedEntrySize; // Read/write: If > 0, data entries have given fixed size.
fpLogFunc_t m_fpLogFunc; // Pointer to log function.
@@ -319,6 +345,48 @@
}
+template <class T, class FuncObj>
+Ssb::ReadRv Ssb::ReadItem(const ReadIterator& iter, T& obj, FuncObj func)
+//-----------------------------------------------------------------------
+{
+ m_pIstrm->clear();
+ if (iter->rposStart != 0)
+ m_pIstrm->seekg(m_posStart + Postype(iter->rposStart));
+ const Postype pos = m_pIstrm->tellg();
+ func(*m_pIstrm, obj, iter->nSize);
+ return OnReadEntry(&(*iter), &m_Idarray[iter->nIdpos], iter->nIdLength, pos);
+}
+
+
+inline Ssb::IdMatchStatus Ssb::CompareId(const ReadIterator& iter, const void* pId, const size_t nIdSize)
+//-------------------------------------------------------------------------------------------------------
+{
+ if (nIdSize == iter->nIdLength && memcmp(&m_Idarray[iter->nIdpos], pId, iter->nIdLength) == 0)
+ return IdMatch;
+ else
+ return IdMismatch;
+}
+
+
+inline Ssb::ReadIterator Ssb::GetReadBegin()
+//------------------------------------------
+{
+ ASSERT(GetFlag(RwfRMapHasId) && (GetFlag(RwfRMapHasStartpos) || GetFlag(RwfRMapHasSize) || m_nFixedEntrySize > 0));
+ if (GetFlag(RwfRMapCached) == false)
+ CacheMap();
+ return mapData.begin();
+}
+
+
+inline Ssb::ReadIterator Ssb::GetReadEnd()
+//----------------------------------------
+{
+ if (GetFlag(RwfRMapCached) == false)
+ CacheMap();
+ return mapData.end();
+}
+
+
template<class T>
inline void Binarywrite(OutStream& oStrm, const T& data)
//------------------------------------------------------
@@ -364,19 +432,25 @@
inline void Binaryread(InStream& iStrm, T& data, const Offtype bytecount)
//-----------------------------------------------------------------------
{
+ #if _HAS_TR1
+ static_assert(std::tr1::has_trivial_assign<T>::value == true, "");
+ #endif
memset(&data, 0, sizeof(data));
- iStrm.read(reinterpret_cast<char*>(&data), min(bytecount, sizeof(data)));
+ iStrm.read(reinterpret_cast<char*>(&data), (std::min)((size_t)bytecount, sizeof(data)));
}
template <class T>
-inline void ReadItem(InStream& iStrm, T& data, const DataSize /*nSize*/)
-//----------------------------------------------------------------------
+inline void ReadItem(InStream& iStrm, T& data, const DataSize nSize)
+//------------------------------------------------------------------
{
#if _HAS_TR1
- STATIC_ASSERT(std::tr1::has_trivial_assign<T>::value == true);
+ static_assert(std::tr1::has_trivial_assign<T>::value == true, "");
#endif
- Binaryread(iStrm, data);
+ if (nSize == sizeof(T) || nSize == invalidDatasize)
+ Binaryread(iStrm, data);
+ else
+ Binaryread(iStrm, data, nSize);
}
// Read specialization for float. If data size is 8, read double and assign it to given float.
Modified: trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp
===================================================================
--- trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp 2010-03-21 17:25:13 UTC (rev 541)
+++ trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp 2010-03-21 21:29:43 UTC (rev 542)
@@ -49,8 +49,8 @@
const size_t sizeofS = sizeof(s) / sizeof(s[0]);
CRect rect;
- NOTEINDEXTYPE nNotes = (rcClient.bottom + m_cyFont - 1) / m_cyFont;
- if(!m_nNote) m_nNote = m_nNoteCentre;
+ NOTEINDEXTYPE nNotes = static_cast<NOTEINDEXTYPE>((rcClient.bottom + m_cyFont - 1) / m_cyFont);
+ //if(!m_nNote) m_nNote = m_nNoteCentre;
NOTEINDEXTYPE nPos = m_nNote - (nNotes/2);
int ypaint = 0;
@@ -132,11 +132,11 @@
CRect rcClient;
GetClientRect(&rcClient);
int nNotes = (rcClient.bottom + m_cyFont - 1) / m_cyFont;
- const UINT n = (pt.y / m_cyFont) + m_nNote - (nNotes/2);
- const NOTEINDEXTYPE note = n - m_nNoteCentre;
+ const int n = (pt.y / m_cyFont) + m_nNote - (nNotes/2);
+ const NOTEINDEXTYPE note = static_cast<NOTEINDEXTYPE>(n - m_nNoteCentre);
if(m_pTuning->IsValidNote(note))
{
- m_nNote = n;
+ m_nNote = static_cast<NOTEINDEXTYPE>(n);
InvalidateRect(NULL, FALSE);
if(m_pParent)
m_pParent->UpdateRatioMapEdits(GetShownCentre());
Modified: trunk/OpenMPT/mptrack/typedefs.h
===================================================================
--- trunk/OpenMPT/mptrack/typedefs.h 2010-03-21 17:25:13 UTC (rev 541)
+++ trunk/OpenMPT/mptrack/typedefs.h 2010-03-21 21:29:43 UTC (rev 542)
@@ -2,8 +2,16 @@
#define TYPEDEFS_H
#define nullptr 0
-#define ARRAYELEMCOUNT(x) (sizeof(x)/sizeof(x[0]))
+// CountOf macro computes the number of elements in a statically-allocated array.
+#if _MSC_VER >= 1400
+ #define CountOf(x) _countof(x)
+#else
+ #define CountOf(x) (sizeof(x)/sizeof(x[0]))
+#endif
+
+#define ARRAYELEMCOUNT(x) CountOf(x)
+
//Compile time assert.
#define STATIC_ASSERT(expr) C_ASSERT(expr)
#define static_assert(expr, msg) C_ASSERT(expr)
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2010-03-21 17:25:13 UTC (rev 541)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2010-03-21 21:29:43 UTC (rev 542)
@@ -233,7 +233,7 @@
0, //Max sample filename length
22, //Max instrument name length
0, //Max instrument filename length
- 256 * 16, //SamplesMax (actually 16 per instrument)
+ 4000, //SamplesMax (actually 16 per instrument(256*16=4096), but limited to MAX_SAMPLES=4000)
256, //instrumentMax
mixLevels_117RC3, //defaultMixLevels
200, //Max MIDI mapping directives
Modified: trunk/OpenMPT/soundlib/tuning.cpp
===================================================================
--- trunk/OpenMPT/soundlib/tuning.cpp 2010-03-21 17:25:13 UTC (rev 541)
+++ trunk/OpenMPT/soundlib/tuning.cpp 2010-03-21 21:29:43 UTC (rev 542)
@@ -381,7 +381,8 @@
ssb.ReadItem(pTuning->m_GroupRatio, "RTI3");
ssb.ReadItem(pTuning->m_SerHelperRatiotableSize, "RTI4");
- if ((ssb.m_Status & srlztn::SNT_FAILURE) == 0)
+ // If reader status is ok and m_StepMin is somewhat reasonable, process data.
+ if ((ssb.m_Status & srlztn::SNT_FAILURE) == 0 && pTuning->m_StepMin >= -300 && pTuning->m_StepMin <= 300)
{
EDITMASK temp = pTuning->GetEditMask();
pTuning->m_EditMask = EM_ALLOWALL; //Allowing all while processing data.
@@ -500,6 +501,11 @@
//m_StepMin
inStrm.read(reinterpret_cast<char*>(&pT->m_StepMin), sizeof(pT->m_StepMin));
+ if (pT->m_StepMin < -200 || pT->m_StepMin > 200)
+ {
+ delete pT;
+ return nullptr;
+ }
//m_GroupSize
inStrm.read(reinterpret_cast<char*>(&pT->m_GroupSize), sizeof(pT->m_GroupSize));
Modified: trunk/OpenMPT/soundlib/tuningCollection.cpp
===================================================================
--- trunk/OpenMPT/soundlib/tuningCollection.cpp 2010-03-21 17:25:13 UTC (rev 541)
+++ trunk/OpenMPT/soundlib/tuningCollection.cpp 2010-03-21 21:29:43 UTC (rev 542)
@@ -153,10 +153,19 @@
iStrm.seekg(startpos);
srlztn::Ssb ssb(iStrm);
ssb.BeginRead("TC", s_SerializationVersion);
- ssb.ReadItem(m_Name, "0", 1, &ReadStr);
- ssb.ReadItem(m_EditMask, "1");
- for(size_t i = 2; i < ssb.GetNumEntries(); i++)
- ssb.ReadItem(*this, "2", 1, &ReadTuning);
+
+ srlztn::Ssb::ReadIterator iter = ssb.GetReadBegin();
+ const srlztn::Ssb::ReadIterator iterEnd = ssb.GetReadEnd();
+ for(iter; iter != iterEnd; iter++)
+ {
+ if (ssb.CompareId(iter, "0") == srlztn::Ssb::IdMatch)
+ ssb.ReadItem(iter, m_Name, &ReadStr);
+ else if (ssb.CompareId(iter, "1") == srlztn::Ssb::IdMatch)
+ ssb.ReadItem(iter, m_EditMask);
+ else if (ssb.CompareId(iter, "2") == srlztn::Ssb::IdMatch)
+ ssb.ReadItem(iter, *this, &ReadTuning);
+ }
+
if(ssb.m_Status & srlztn::SNT_FAILURE)
return true;
else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-21 17:25:20
|
Revision: 541
http://modplug.svn.sourceforge.net/modplug/?rev=541&view=rev
Author: saga-games
Date: 2010-03-21 17:25:13 +0000 (Sun, 21 Mar 2010)
Log Message:
-----------
[Fix] Threw out the old ULT loader in favor of Storlek's loader from SchismTracker (used with permission from the author himself). This is a lot more accurate than MPT's old loader.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Load_ult.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/soundlib/Load_ult.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_ult.cpp 2010-03-21 14:45:39 UTC (rev 540)
+++ trunk/OpenMPT/soundlib/Load_ult.cpp 2010-03-21 17:25:13 UTC (rev 541)
@@ -1,227 +1,419 @@
/*
- * This source code is public domain.
+ * Purpose: Load ULT (UltraTracker) modules
+ * Authors: Storlek (Original author - http://schismtracker.org/)
+ * Johannes Schultz (OpenMPT Port, tweaks)
*
- * Copied to OpenMPT from libmodplug.
- *
- * Authors: Olivier Lapicque <oli...@jp...>
- *
-*/
+ * Thanks to Storlek for allowing me to use this code!
+ */
#include "stdafx.h"
#include "sndfile.h"
-#pragma warning(disable:4244) //"conversion from 'type1' to 'type2', possible loss of data"
+enum
+{
+ ULT_16BIT = 4,
+ ULT_LOOP = 8,
+ ULT_PINGPONGLOOP = 16,
+};
-#define ULT_16BIT 0x04
-#define ULT_LOOP 0x08
-#define ULT_BIDI 0x10
-
#pragma pack(1)
+struct ULT_SAMPLE
+{
+ char name[32];
+ char filename[12];
+ uint32 loop_start;
+ uint32 loop_end;
+ uint32 size_start;
+ uint32 size_end;
+ uint8 volume; // 0-255, apparently prior to 1.4 this was logarithmic?
+ uint8 flags; // above
+ uint16 speed; // only exists for 1.4+
+ int16 finetune;
+};
+STATIC_ASSERT(sizeof(ULT_SAMPLE) >= 64);
+#pragma pack()
-// Raw ULT header struct:
-typedef struct tagULTHEADER
+#define ASSERT_CAN_READ(x) \
+ if( dwMemPos > dwMemLength || x > dwMemLength - dwMemPos ) return false;
+
+/* Unhandled effects:
+5x1 - do not loop sample (x is unused)
+5xC - end loop and finish sample
+9xx - set sample offset to xx * 1024
+ with 9yy: set sample offset to xxyy * 4
+E0x - set vibrato strength (2 is normal)
+F00 - reset speed/tempo to 6/125
+
+Apparently 3xx will CONTINUE to slide until it reaches its destination, or
+until a 300 effect is encountered. I'm not attempting to handle this (yet).
+
+The logarithmic volume scale used in older format versions here, or pretty
+much anywhere for that matter. I don't even think Ultra Tracker tries to
+convert them. */
+
+static const uint8 ult_efftrans[] =
{
- char id[15];
- char songtitle[32];
- BYTE reserved;
-} ULTHEADER;
+ CMD_ARPEGGIO,
+ CMD_PORTAMENTOUP,
+ CMD_PORTAMENTODOWN,
+ CMD_TONEPORTAMENTO,
+ CMD_VIBRATO,
+ CMD_NONE,
+ CMD_NONE,
+ CMD_TREMOLO,
+ CMD_NONE,
+ CMD_OFFSET,
+ CMD_VOLUMESLIDE,
+ CMD_PANNING8,
+ CMD_VOLUME,
+ CMD_PATTERNBREAK,
+ CMD_NONE, // extended effects, processed separately
+ CMD_SPEED,
+};
+static void TranslateULTCommands(uint8 *pe, uint8 *pp)
+//----------------------------------------------------
+{
+ uint8 e = *pe & 0x0F;
+ uint8 p = *pp;
-// Raw ULT sampleinfo struct:
-typedef struct tagULTSAMPLE
+ *pe = ult_efftrans[e];
+
+ switch (e)
+ {
+ case 0x00:
+ if (!p)
+ *pe = CMD_NONE;
+ break;
+ case 0x03:
+ // 300 apparently stops sliding, which is totally weird
+ if (!p)
+ p = 1; // close enough?
+ break;
+ case 0x05:
+ // play backwards
+ if((p & 0x0F) == 0x02)
+ {
+ *pe = CMD_S3MCMDEX;
+ p = 0x9F;
+ }
+ break;
+ case 0x0A:
+ // blah, this sucks
+ if (p & 0xF0)
+ p &= 0xF0;
+ break;
+ case 0x0B:
+ // mikmod does this wrong, resulting in values 0-225 instead of 0-255
+ p = (p & 0x0F) * 0x11;
+ break;
+ case 0x0C: // volume
+ p >>= 2;
+ break;
+ case 0x0D: // pattern break
+ p = 10 * (p >> 4) + (p & 0x0F);
+ case 0x0E: // special
+ switch (p >> 4)
+ {
+ case 0x01:
+ *pe = CMD_PORTAMENTOUP;
+ p = 0xF0 | (p & 0x0F);
+ break;
+ case 0x02:
+ *pe = CMD_PORTAMENTODOWN;
+ p = 0xF0 | (p & 0x0F);
+ break;
+ case 0x08:
+ *pe = CMD_S3MCMDEX;
+ p = 0x60 | (p & 0x0F);
+ break;
+ case 0x09:
+ *pe = CMD_RETRIG;
+ p &= 0x0F;
+ break;
+ case 0x0A:
+ *pe = CMD_VOLUMESLIDE;
+ p = ((p & 0x0F) << 4) | 0x0F;
+ break;
+ case 0x0B:
+ *pe = CMD_VOLUMESLIDE;
+ p = 0xF0 | (p & 0x0F);
+ break;
+ case 0x0C: case 0x0D:
+ *pe = CMD_S3MCMDEX;
+ break;
+ }
+ break;
+ case 0x0F:
+ if (p > 0x2F)
+ *pe = CMD_TEMPO;
+ break;
+ }
+
+ *pp = p;
+}
+
+static int ReadULTEvent(MODCOMMAND *note, const BYTE *lpStream, DWORD *dwMP, const DWORD dwMemLength)
+//---------------------------------------------------------------------------------------------------
{
- CHAR samplename[32];
- CHAR dosname[12];
- LONG loopstart;
- LONG loopend;
- LONG sizestart;
- LONG sizeend;
- BYTE volume;
- BYTE flags;
- WORD finetune;
-} ULTSAMPLE;
+ DWORD dwMemPos = *dwMP;
+ uint8 b, repeat = 1;
+ uint8 cmd1, cmd2; // 1 = vol col, 2 = fx col in the original schismtracker code
+ uint8 param1, param2;
-#pragma pack()
+ ASSERT_CAN_READ(1)
+ b = lpStream[dwMemPos++];
+ if (b == 0xFC) // repeat event
+ {
+ ASSERT_CAN_READ(2);
+ repeat = lpStream[dwMemPos++];
+ b = lpStream[dwMemPos++];
+ }
+ ASSERT_CAN_READ(4)
+ note->note = (b > 0 && b < 61) ? b + 36 : NOTE_NONE;
+ note->instr = lpStream[dwMemPos++];
+ b = lpStream[dwMemPos++];
+ cmd1 = b & 0x0F;
+ cmd2 = b >> 4;
+ param1 = lpStream[dwMemPos++];
+ param2 = lpStream[dwMemPos++];
+ TranslateULTCommands(&cmd1, ¶m1);
+ TranslateULTCommands(&cmd2, ¶m2);
+ // sample offset -- this is even more special than digitrakker's
+ if(cmd1 == CMD_OFFSET && cmd2 == CMD_OFFSET)
+ {
+ uint32 off = ((param1 << 8) | param2) >> 6;
+ cmd1 = CMD_NONE;
+ param1 = (uint8)min(off, 0xFF);
+ } else if(cmd1 == CMD_OFFSET)
+ {
+ uint32 off = param1 * 4;
+ param1 = (uint8)min(off, 0xFF);
+ } else if(cmd2 == CMD_OFFSET)
+ {
+ uint32 off = param2 * 4;
+ param2 = (uint8)min(off, 0xFF);
+ } else if(cmd1 == cmd2)
+ {
+ // don't try to figure out how ultratracker does this, it's quite random
+ cmd2 = CMD_NONE;
+ }
+ if (cmd2 == CMD_VOLUME || (cmd2 == CMD_NONE && cmd1 != CMD_VOLUME))
+ {
+ // swap commands
+ std::swap(cmd1, cmd2);
+ std::swap(param1, param2);
+ }
+ // Do that dance.
+ // Maybe I should quit rewriting this everywhere and make a generic version :P
+ int n;
+ for (n = 0; n < 4; n++)
+ {
+ if(CSoundFile::ConvertVolEffect(&cmd1, ¶m1, (n >> 1) ? true : false))
+ {
+ n = 5;
+ break;
+ }
+ std::swap(cmd1, cmd2);
+ std::swap(param1, param2);
+ }
+ if (n < 5)
+ {
+ if (CSoundFile::GetEffectWeight((MODCOMMAND::COMMAND)cmd1) > CSoundFile::GetEffectWeight((MODCOMMAND::COMMAND)cmd2))
+ {
+ std::swap(cmd1, cmd2);
+ std::swap(param1, param2);
+ }
+ cmd1 = CMD_NONE;
+ }
+ if (!cmd1)
+ param1 = 0;
+ if (!cmd2)
+ param2 = 0;
+
+ note->volcmd = cmd1;
+ note->vol = param1;
+ note->command = cmd2;
+ note->param = param2;
+
+ *dwMP = dwMemPos;
+ return repeat;
+}
+
bool CSoundFile::ReadUlt(const BYTE *lpStream, DWORD dwMemLength)
//---------------------------------------------------------------
{
- ULTHEADER *pmh = (ULTHEADER *)lpStream;
- ULTSAMPLE *pus;
- UINT nos, nop;
DWORD dwMemPos = 0;
+ uint8 ult_version;
- // try to read module header
- if ((!lpStream) || (dwMemLength < 0x100)) return false;
- if (strncmp(pmh->id,"MAS_UTrack_V00",14)) return false;
- // Warning! Not supported ULT format, trying anyway
- // if ((pmh->id[14] < '1') || (pmh->id[14] > '4')) return false;
+ // Tracker ID
+ ASSERT_CAN_READ(15);
+ if (memcmp(lpStream, "MAS_UTrack_V00", 14) != 0)
+ return false;
+ dwMemPos += 14;
+ ult_version = lpStream[dwMemPos++];
+ if (ult_version < '1' || ult_version > '4')
+ return false;
+ ult_version -= '0';
+
+ ASSERT_CAN_READ(32);
+ memcpy(m_szNames[0], lpStream + dwMemPos, 32);
+ SetNullTerminator(m_szNames[0]);
+ dwMemPos += 32;
+
m_nType = MOD_TYPE_ULT;
- m_nDefaultSpeed = 6;
- m_nDefaultTempo = 125;
- memcpy(m_szNames[0], pmh->songtitle, 31);
- SpaceToNullStringFixed(m_szNames[0], 31);
- // read songtext
- dwMemPos = sizeof(ULTHEADER);
- if ((pmh->reserved) && (dwMemPos + pmh->reserved * 32 < dwMemLength))
+ m_dwSongFlags = SONG_ITCOMPATMODE | SONG_ITOLDEFFECTS; // this will be converted to IT format by MPT.
+ SetModFlag(MSF_COMPATIBLE_PLAY, true);
+
+ ASSERT_CAN_READ(1);
+ uint8 nNumLines = (uint8)lpStream[dwMemPos++];
+ ASSERT_CAN_READ((DWORD)(nNumLines * 32));
+ // read "nNumLines" lines, each containing 32 characters.
+ if(m_lpszSongComments != nullptr)
+ delete(m_lpszSongComments);
+ m_lpszSongComments = new char[(nNumLines * 33) + 1];
+ if(m_lpszSongComments)
{
- UINT len = pmh->reserved * 32;
- m_lpszSongComments = new char[len + 1 + pmh->reserved];
- if (m_lpszSongComments)
+ for(size_t nLine = 0; nLine < nNumLines; nLine++)
{
- for (UINT l=0; l<pmh->reserved; l++)
- {
- memcpy(m_lpszSongComments+l*33, lpStream+dwMemPos+l*32, 32);
- m_lpszSongComments[l*33+32] = 0x0D;
- }
- m_lpszSongComments[len] = 0;
+ memcpy(m_lpszSongComments + nLine * 33, lpStream + dwMemPos + nLine * 32, 32);
+ m_lpszSongComments[nLine * 33 + 32] = 0x0D;
}
- dwMemPos += len;
+ m_lpszSongComments[nNumLines * 33] = 0;
}
- if (dwMemPos >= dwMemLength) return true;
- nos = lpStream[dwMemPos++];
- m_nSamples = nos;
- if (m_nSamples >= MAX_SAMPLES) m_nSamples = MAX_SAMPLES-1;
- UINT smpsize = 64;
- if (pmh->id[14] >= '4') smpsize += 2;
- if (dwMemPos + nos*smpsize + 256 + 2 > dwMemLength) return true;
- for (UINT ins=1; ins<=nos; ins++, dwMemPos+=smpsize) if (ins<=m_nSamples)
+ dwMemPos += nNumLines * 32;
+
+ ASSERT_CAN_READ(1);
+ m_nSamples = (SAMPLEINDEX)lpStream[dwMemPos++];
+ if(m_nSamples >= MAX_SAMPLES)
+ return false;
+
+ for(SAMPLEINDEX nSmp = 0; nSmp < m_nSamples; nSmp++)
{
- pus = (ULTSAMPLE *)(lpStream+dwMemPos);
- MODSAMPLE *pSmp = &Samples[ins];
- memcpy(m_szNames[ins], pus->samplename, 31);
- memcpy(pSmp->filename, pus->dosname, 12);
- SpaceToNullStringFixed(m_szNames[ins], 31);
+ ULT_SAMPLE ultSmp;
+ MODSAMPLE *pSmp = &(Samples[nSmp + 1]);
+ // annoying: v4 added a field before the end of the struct
+ if(ult_version >= 4)
+ {
+ ASSERT_CAN_READ(sizeof(ULT_SAMPLE));
+ memcpy(&ultSmp, lpStream + dwMemPos, sizeof(ULT_SAMPLE));
+ dwMemPos += sizeof(ULT_SAMPLE);
+
+ ultSmp.speed = LittleEndianW(ultSmp.speed);
+ } else
+ {
+ ASSERT_CAN_READ(sizeof(64));
+ memcpy(&ultSmp, lpStream + dwMemPos, 64);
+ dwMemPos += 64;
+
+ ultSmp.finetune = ultSmp.speed;
+ ultSmp.speed = 8363;
+ }
+ ultSmp.finetune = LittleEndianW(ultSmp.finetune);
+ ultSmp.loop_start = LittleEndian(ultSmp.loop_start);
+ ultSmp.loop_end = LittleEndian(ultSmp.loop_end);
+ ultSmp.size_start = LittleEndian(ultSmp.size_start);
+ ultSmp.size_end = LittleEndian(ultSmp.size_end);
+
+ memcpy(m_szNames[nSmp + 1], ultSmp.name, 32);
+ SetNullTerminator(m_szNames[nSmp + 1]);
+ memcpy(pSmp->filename, ultSmp.filename, 12);
SpaceToNullStringFixed(pSmp->filename, 12);
- pSmp->nLoopStart = pus->loopstart;
- pSmp->nLoopEnd = pus->loopend;
- pSmp->nLength = pus->sizeend - pus->sizestart;
- pSmp->nVolume = pus->volume;
+
+ if(ultSmp.size_end <= ultSmp.size_start)
+ continue;
+ pSmp->nLength = ultSmp.size_end - ultSmp.size_start;
+ pSmp->nLoopStart = ultSmp.loop_start;
+ pSmp->nLoopEnd = min(ultSmp.loop_end, pSmp->nLength);
+ pSmp->nVolume = ultSmp.volume;
pSmp->nGlobalVol = 64;
- pSmp->nC5Speed = 8363;
- if (pmh->id[14] >= '4')
+
+ /* mikmod does some weird integer math here, but it didn't really work for me */
+ pSmp->nC5Speed = ultSmp.speed;
+ if(ultSmp.finetune)
{
- pSmp->nC5Speed = pus->finetune;
+ pSmp->nC5Speed = (UINT)(((double)pSmp->nC5Speed) * pow(2, (((double)ultSmp.finetune) / (12.0 * 32768))));
}
- if (pus->flags & ULT_LOOP) pSmp->uFlags |= CHN_LOOP;
- if (pus->flags & ULT_BIDI) pSmp->uFlags |= CHN_PINGPONGLOOP;
- if (pus->flags & ULT_16BIT)
+
+ if(ultSmp.flags & ULT_LOOP)
+ pSmp->uFlags |= CHN_LOOP;
+ if(ultSmp.flags & ULT_PINGPONGLOOP)
+ pSmp->uFlags |= CHN_PINGPONGLOOP;
+ if(ultSmp.flags & ULT_16BIT)
{
pSmp->uFlags |= CHN_16BIT;
pSmp->nLoopStart >>= 1;
pSmp->nLoopEnd >>= 1;
}
}
- Order.ReadAsByte(lpStream+dwMemPos, 256, dwMemLength-dwMemPos);
+
+ // ult just so happens to use 255 for its end mark, so there's no need to fiddle with this
+ Order.ReadAsByte(lpStream + dwMemPos, 256, dwMemLength - dwMemPos);
dwMemPos += 256;
- m_nChannels = lpStream[dwMemPos] + 1;
- nop = lpStream[dwMemPos+1] + 1;
- dwMemPos += 2;
- if (m_nChannels > 32) m_nChannels = 32;
- // Default channel settings
- for (UINT nSet=0; nSet<m_nChannels; nSet++)
+
+ ASSERT_CAN_READ(2);
+ m_nChannels = lpStream[dwMemPos++] + 1;
+ PATTERNINDEX nNumPats = lpStream[dwMemPos++] + 1;
+
+ if(m_nChannels > MAX_BASECHANNELS || nNumPats > MAX_PATTERNS)
+ return false;
+
+ if(ult_version >= 3)
{
- ChnSettings[nSet].nVolume = 64;
- ChnSettings[nSet].nPan = (nSet & 1) ? 0x40 : 0xC0;
- }
- // read pan position table for v1.5 and higher
- if(pmh->id[14]>='3')
- {
- if (dwMemPos + m_nChannels > dwMemLength) return true;
- for(UINT t=0; t<m_nChannels; t++)
+ ASSERT_CAN_READ(m_nChannels);
+ for(CHANNELINDEX nChn = 0; nChn < m_nChannels; nChn++)
{
- ChnSettings[t].nPan = (lpStream[dwMemPos++] << 4) + 8;
- if (ChnSettings[t].nPan > 256) ChnSettings[t].nPan = 256;
+ ChnSettings[nChn].nPan = ((lpStream[dwMemPos + nChn] & 0x0F) << 4) + 8;
}
- }
- // Allocating Patterns
- for (UINT nAllocPat=0; nAllocPat<nop; nAllocPat++)
+ dwMemPos += m_nChannels;
+ } else
{
- if (nAllocPat < MAX_PATTERNS)
+ for(CHANNELINDEX nChn = 0; nChn < m_nChannels; nChn++)
{
- Patterns.Insert(nAllocPat, 64);
+ ChnSettings[nChn].nPan = (nChn & 1) ? 192 : 64;
}
}
- // Reading Patterns
- for (UINT nChn=0; nChn<m_nChannels; nChn++)
+
+ for(PATTERNINDEX nPat = 0; nPat < nNumPats; nPat++)
{
- for (UINT nPat=0; nPat<nop; nPat++)
+ if(Patterns.Insert(nPat, 64))
+ return false;
+ }
+
+ for(CHANNELINDEX nChn = 0; nChn < m_nChannels; nChn++)
+ {
+ MODCOMMAND evnote;
+ MODCOMMAND *note;
+ int repeat;
+ evnote.Clear();
+
+ for(PATTERNINDEX nPat = 0; nPat < nNumPats; nPat++)
{
- MODCOMMAND *pat = NULL;
-
- if (nPat < MAX_PATTERNS)
+ note = Patterns[nPat] + nChn;
+ ROWINDEX nRow = 0;
+ while(nRow < 64)
{
- pat = Patterns[nPat];
- if (pat) pat += nChn;
- }
- UINT row = 0;
- while (row < 64)
- {
- if (dwMemPos + 6 > dwMemLength) return true;
- UINT rep = 1;
- UINT note = lpStream[dwMemPos++];
- if (note == 0xFC)
+ repeat = ReadULTEvent(&evnote, lpStream, &dwMemPos, dwMemLength);
+ if(repeat + nRow > 64)
+ repeat = 64 - nRow;
+ if(repeat == 0) break;
+ while (repeat--)
{
- rep = lpStream[dwMemPos];
- note = lpStream[dwMemPos+1];
- dwMemPos += 2;
+ *note = evnote;
+ note += m_nChannels;
+ nRow++;
}
- UINT instr = lpStream[dwMemPos++];
- UINT eff = lpStream[dwMemPos++];
- UINT dat1 = lpStream[dwMemPos++];
- UINT dat2 = lpStream[dwMemPos++];
- UINT cmd1 = eff & 0x0F;
- UINT cmd2 = eff >> 4;
- if (cmd1 == 0x0C) dat1 >>= 2; else
- if (cmd1 == 0x0B) { cmd1 = dat1 = 0; }
- if (cmd2 == 0x0C) dat2 >>= 2; else
- if (cmd2 == 0x0B) { cmd2 = dat2 = 0; }
- while ((rep != 0) && (row < 64))
- {
- if (pat)
- {
- pat->instr = instr;
- if (note) pat->note = note + 36;
- if (cmd1 | dat1)
- {
- if (cmd1 == 0x0C)
- {
- pat->volcmd = VOLCMD_VOLUME;
- pat->vol = dat1;
- } else
- {
- pat->command = cmd1;
- pat->param = dat1;
- ConvertModCommand(pat);
- }
- }
- if (cmd2 == 0x0C)
- {
- pat->volcmd = VOLCMD_VOLUME;
- pat->vol = dat2;
- } else
- if ((cmd2 | dat2) && (!pat->command))
- {
- pat->command = cmd2;
- pat->param = dat2;
- ConvertModCommand(pat);
- }
- pat += m_nChannels;
- }
- row++;
- rep--;
- }
}
}
}
- // Reading Instruments
- for (UINT smp=1; smp<=m_nSamples; smp++) if (Samples[smp].nLength)
+
+ for(SAMPLEINDEX nSmp = 0; nSmp < m_nSamples; nSmp++)
{
- if (dwMemPos >= dwMemLength) return true;
- UINT flags = (Samples[smp].uFlags & CHN_16BIT) ? RS_PCM16S : RS_PCM8S;
- dwMemPos += ReadSample(&Samples[smp], flags, (LPSTR)(lpStream+dwMemPos), dwMemLength - dwMemPos);
+ dwMemPos += ReadSample(&Samples[nSmp + 1], (Samples[nSmp + 1].uFlags & CHN_16BIT) ? RS_PCM16S : RS_PCM8S, (LPCSTR)(lpStream + dwMemPos), dwMemLength - dwMemPos);
}
return true;
}
+#undef ASSERT_CAN_READ
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-21 14:45:39 UTC (rev 540)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-21 17:25:13 UTC (rev 541)
@@ -65,6 +65,7 @@
extern void ITUnpack8Bit(LPSTR pSample, DWORD dwLen, LPBYTE lpMemFile, DWORD dwMemLength, BOOL b215);
extern void ITUnpack16Bit(LPSTR pSample, DWORD dwLen, LPBYTE lpMemFile, DWORD dwMemLength, BOOL b215);
+extern BYTE ImpulseTrackerPortaVolCmd[16];
#define MAX_PACK_TABLES 3
@@ -3825,4 +3826,138 @@
case CMD_NONE:
default: return 0;
}
-}
\ No newline at end of file
+}
+
+// Try to convert a fx column command (*e) into a volume column command.
+// Returns true if successful.
+// Some commands can only be converted by losing some precision.
+// If moving the command into the volume column is more important than accuracy, use bForce = true.
+// (Code translated from SchismTracker and mainly supposed to be used with loaders ported from this tracker)
+bool CSoundFile::ConvertVolEffect(uint8 *e, uint8 *p, bool bForce)
+//----------------------------------------------------------------
+{
+ switch (*e)
+ {
+ case CMD_NONE:
+ return true;
+ case CMD_VOLUME:
+ *e = VOLCMD_VOLUME;
+ *p = min(*p, 64);
+ break;
+ case CMD_PORTAMENTOUP:
+ if (bForce)
+ *p = min(*p, 9);
+ else if (*p > 9)
+ return false;
+ *e = VOLCMD_PORTAUP;
+ break;
+ case CMD_PORTAMENTODOWN:
+ if (bForce)
+ *p = min(*p, 9);
+ else if (*p > 9)
+ return false;
+ *e = VOLCMD_PORTADOWN;
+ break;
+ case CMD_TONEPORTAMENTO:
+ if (*p >= 0xF0)
+ {
+ // hack for people who can't type F twice :)
+ *e = VOLCMD_TONEPORTAMENTO;
+ *p = 0xFF;
+ return true;
+ }
+ for (uint8 n = 0; n < 10; n++)
+ {
+ if (bForce
+ ? (*p <= ImpulseTrackerPortaVolCmd[n])
+ : (*p == ImpulseTrackerPortaVolCmd[n]))
+ {
+ *e = VOLCMD_TONEPORTAMENTO;
+ *p = n;
+ return true;
+ }
+ }
+ return false;
+ case CMD_VIBRATO:
+ if (bForce)
+ *p = min(*p, 9);
+ else if (*p > 9)
+ return false;
+ *e = VOLCMD_VIBRATODEPTH;
+ break;
+ case CMD_FINEVIBRATO:
+ if (bForce)
+ *p = 0;
+ else if (*p)
+ return false;
+ *e = VOLCMD_VIBRATODEPTH;
+ break;
+ case CMD_PANNING8:
+ *p = min(64, *p * 64 / 255);
+ *e = VOLCMD_PANNING;
+ break;
+ case CMD_VOLUMESLIDE:
+ if (*p == 0)
+ return false;
+ if ((*p & 0xF) == 0) // Dx0 / Cx
+ {
+ if (bForce)
+ *p = min(*p >> 4, 9);
+ else if ((*p >> 4) > 9)
+ return false;
+ else
+ *p >>= 4;
+ *e = VOLCMD_VOLSLIDEUP;
+ } else if ((*p & 0xF0) == 0) // D0x / Dx
+ {
+ if (bForce)
+ *p = min(*p, 9);
+ else if (*p > 9)
+ return false;
+ *e = VOLCMD_VOLSLIDEDOWN;
+ } else if ((*p & 0xF) == 0xF) // DxF / Ax
+ {
+ if (bForce)
+ *p = min(*p >> 4, 9);
+ else if ((*p >> 4) > 9)
+ return false;
+ else
+ *p >>= 4;
+ *e = VOLCMD_FINEVOLUP;
+ } else if ((*p & 0xf0) == 0xf0) // DFx / Bx
+ {
+ if (bForce)
+ *p = min(*p, 9);
+ else if ((*p & 0xF) > 9)
+ return false;
+ else
+ *p &= 0xF;
+ *e = VOLCMD_FINEVOLDOWN;
+ } else // ???
+ {
+ return false;
+ }
+ break;
+ case CMD_S3MCMDEX:
+ switch (*p >> 4)
+ {
+ case 8:
+ *e = VOLCMD_PANNING;
+ *p = ((*p & 0xf) << 2) + 2;
+ return true;
+ case 0: case 1: case 2: case 0xF:
+ if (bForce)
+ {
+ *e = *p = 0;
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+ default:
+ return false;
+ }
+ return true;
+}
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2010-03-21 14:45:39 UTC (rev 540)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2010-03-21 17:25:13 UTC (rev 541)
@@ -981,6 +981,8 @@
// "importance" of every FX command. Table is used for importing from formats with multiple effect colums
// and is approximately the same as in SchismTracker.
static uint16 CSoundFile::GetEffectWeight(MODCOMMAND::COMMAND cmd);
+ // try to convert a an effect into a volume column effect.
+ static bool ConvertVolEffect(uint8 *e, uint8 *p, bool bForce);
};
#pragma warning(default : 4324) //structure was padded due to __declspec(align())
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-21 14:45:54
|
Revision: 540
http://modplug.svn.sourceforge.net/modplug/?rev=540&view=rev
Author: saga-games
Date: 2010-03-21 14:45:39 +0000 (Sun, 21 Mar 2010)
Log Message:
-----------
[New] Installer: Try to find out what keymap file suits the user best.
Modified Paths:
--------------
trunk/OpenMPT/installer/install.iss
trunk/OpenMPT/installer/vst_scan.iss
Modified: trunk/OpenMPT/installer/install.iss
===================================================================
--- trunk/OpenMPT/installer/install.iss 2010-03-20 22:00:26 UTC (rev 539)
+++ trunk/OpenMPT/installer/install.iss 2010-03-21 14:45:39 UTC (rev 540)
@@ -95,9 +95,65 @@
; portable installation
Type: dirifempty; Name: "{app}\tunings"; Tasks: portable;
-; crappy workaround for uninstall stuff
+#include "vst_scan.iss"
+
[Code]
+procedure CurStepChanged(CurStep: TSetupStep);
+var
+ INIFile: String;
+ keyboardFilepath: String;
+ baseLanguage: Integer;
+
+begin
+ // Get the right INI path.
+ if(IsTaskSelected('portable')) then
+ begin
+ INIFile := ExpandConstant('{app}\mptrack.ini');
+ end else
+ begin
+ INIFile := ExpandConstant('{userappdata}\OpenMPT\mptrack.ini');
+ end;
+
+ case CurStep of
+ ssPostInstall:
+ begin
+ // Find a suitable keyboard layout (might not be very precise sometimes, as it's based on the UI language)
+ // Check http://msdn.microsoft.com/en-us/library/ms776294%28VS.85%29.aspx for the correct language codes.
+ keyboardFilepath := '';
+ baseLanguage := (GetUILanguage and $3FF);
+ case baseLanguage of
+ $07: // German
+ begin
+ keyboardFilepath := 'DE_jojo';
+ end;
+ $0c: // French
+ begin
+ keyboardFilepath := 'FR_mpt_classic_(vanisherIII)';
+ end;
+ $14: // Norwegian
+ begin
+ keyboardFilepath := 'NO_mpt_classic_(rakib)';
+ end;
+ end;
+
+ // Found an alternative keybinding.
+ if(keyboardFilepath <> '') then
+ begin
+ keyboardFilepath := ExpandConstant('{app}\extraKeymaps\' + keyboardFilepath + '.mkb');
+ SetIniString('Paths', 'Key_Config_File', keyboardFilepath, INIFile);
+ end;
+
+ // Scan for pre-installed VST plugins
+ if(IsTaskSelected('vst_scan')) then
+ begin
+ OnVSTScan(INIFile);
+ end;
+ end;
+ end;
+end;
+
+// Crappy workaround for uninstall stuff
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
filepath: String;
@@ -140,6 +196,6 @@
end;
end;
-#include "vst_scan.iss"
+
Modified: trunk/OpenMPT/installer/vst_scan.iss
===================================================================
--- trunk/OpenMPT/installer/vst_scan.iss 2010-03-20 22:00:26 UTC (rev 539)
+++ trunk/OpenMPT/installer/vst_scan.iss 2010-03-21 14:45:39 UTC (rev 540)
@@ -11,11 +11,10 @@
ProgressValue: Integer;
ArrayLen: LongInt;
bExitSetup: Boolean;
- INIFile: String;
VSTPluginNumber: Integer;
OldVSTPluginNumber: Integer;
-procedure ProcessDirectory (RootDir: String; Progress: Boolean);
+procedure ProcessDirectory (RootDir: String; Progress: Boolean; INIFile: String);
var
NewRoot: String;
FilePath: String;
@@ -32,7 +31,7 @@
begin
FilePath := NewRoot + FindRec.Name;
if FindRec.Attributes AND FILE_ATTRIBUTE_DIRECTORY > 0 then
- ProcessDirectory (FilePath, Progress)
+ ProcessDirectory (FilePath, Progress, INIFile)
else
begin
// Start action -->
@@ -69,48 +68,38 @@
end;
end;
-procedure CurStepChanged (CurStep: TSetupStep);
+procedure OnVSTScan(INIFile: String);
var
Dir: String;
begin
- if ((CurStep = ssInstall) And (IsTaskSelected('vst_scan'))) then
- begin
+ VSTPluginNumber := GetIniInt('VST Plugins', 'NumPlugins', 0, 0, 0, INIFile);
+ OldVSTPluginNumber := VSTPluginNumber;
- // Get the right INI path.
- if(IsTaskSelected('portable')) then
- begin
- INIFile := ExpandConstant('{app}\mptrack.ini');
- end else
- begin
- INIFile := ExpandConstant('{userappdata}\OpenMPT\mptrack.ini');
- end;
- VSTPluginNumber := GetIniInt('VST Plugins', 'NumPlugins', 0, 0, 0, INIFile);
- OldVSTPluginNumber := VSTPluginNumber;
-
- // The folder to scan.
- Dir := ExpandConstant('{pf}\Steinberg\VstPlugins');
- RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\VST', 'VSTPluginsPath', Dir); // won't touch Dir if registry path does not exist
- // The progress page.
- ProgressPage := CreateOutputProgressPage (CustomMessage ('ProgressTitle'),
- CustomMessage ('ProgressCaption'));
- ProgressPage.SetText (CustomMessage ('ProgressText'), Dir);
- ProgressPage.SetProgress(0, 0);
- ProgressPage.Show;
- // Make the Cancel button visible during the operation.
- ;WizardForm.CancelButton.Visible := TRUE;
- // Scan the folder.
- ProcessDirectory (Dir, TRUE);
- // Hide the progress page.
- try
- finally
- ProgressPage.Hide;
- end;
-
- // Update INI key
-
- if(VSTPluginNumber <> OldVSTPluginNumber) then
- begin
- SetIniInt('VST Plugins', 'NumPlugins', VSTPluginNumber, INIFile);
- end;
+ // The folder to scan.
+ Dir := ExpandConstant('{pf}\Steinberg\VstPlugins');
+ RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\VST', 'VSTPluginsPath', Dir); // won't touch Dir if registry path does not exist
+ // The progress page.
+ ProgressPage := CreateOutputProgressPage (CustomMessage ('ProgressTitle'),
+ CustomMessage ('ProgressCaption'));
+ ProgressPage.SetText (CustomMessage ('ProgressText'), Dir);
+ ProgressPage.SetProgress(0, 0);
+ ProgressPage.Show;
+ // Make the Cancel button visible during the operation.
+ ;WizardForm.CancelButton.Visible := TRUE;
+ // Scan the folder.
+ ProcessDirectory (Dir, TRUE, INIFile);
+ // Hide the progress page.
+ try
+ finally
+ ProgressPage.Hide;
end;
+
+ // Update INI key
+
+ if(VSTPluginNumber <> OldVSTPluginNumber) then
+ begin
+ SetIniInt('VST Plugins', 'NumPlugins', VSTPluginNumber, INIFile);
+ end;
end;
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-20 22:00:36
|
Revision: 539
http://modplug.svn.sourceforge.net/modplug/?rev=539&view=rev
Author: saga-games
Date: 2010-03-20 22:00:26 +0000 (Sat, 20 Mar 2010)
Log Message:
-----------
[Fix] XM compatibility: New instrument + tone portamento = ignore new instrument (fixes partytime.xm by cancer)
[Ref] Minor code cleanup.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-20 17:26:29 UTC (rev 538)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-20 22:00:26 UTC (rev 539)
@@ -400,7 +400,8 @@
}
}
nSpeedCount += nMusicSpeed;
- switch(m_nTempoMode) {
+ switch(m_nTempoMode)
+ {
case tempo_mode_alternative:
dElapsedTime += 60000.0 / (1.65625 * (double)(nMusicSpeed * nMusicTempo)); break;
case tempo_mode_modern:
@@ -435,10 +436,10 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
// Effects
-void CSoundFile::InstrumentChange(MODCHANNEL *pChn, UINT instr, BOOL bPorta, BOOL bUpdVol, BOOL bResetEnv)
+void CSoundFile::InstrumentChange(MODCHANNEL *pChn, UINT instr, bool bPorta, bool bUpdVol, bool bResetEnv)
//--------------------------------------------------------------------------------------------------------
{
- BOOL bInstrumentChanged = FALSE;
+ bool bInstrumentChanged = false;
if (instr >= MAX_INSTRUMENTS) return;
MODINSTRUMENT *pIns = Instruments[instr];
@@ -469,8 +470,8 @@
// bInstrumentChanged is used for IT carry-on env option
if (pIns != pChn->pModInstrument)
{
- bInstrumentChanged = TRUE;
- pChn->pModInstrument = pIns;
+ bInstrumentChanged = true;
+ // we will set the new instrument later.
}
else
{
@@ -483,6 +484,15 @@
returnAfterVolumeAdjust = true;
}
}
+
+ // XM compatibility: new instrument + portamento = forget it!
+ if(bInstrumentChanged && bPorta && IsCompatibleMode(TRK_FASTTRACKER2))
+ {
+ return;
+ } else
+ {
+ pChn->pModInstrument = pIns;
+ }
// Update Volume
if (bUpdVol)
@@ -1152,7 +1162,7 @@
UINT vol = pChn->nRowVolume;
UINT cmd = pChn->nRowCommand;
UINT param = pChn->nRowParam;
- bool bPorta = ((cmd != CMD_TONEPORTAMENTO) && (cmd != CMD_TONEPORTAVOL) && (volcmd != VOLCMD_TONEPORTAMENTO)) ? FALSE : TRUE;
+ bool bPorta = ((cmd != CMD_TONEPORTAMENTO) && (cmd != CMD_TONEPORTAVOL) && (volcmd != VOLCMD_TONEPORTAMENTO)) ? false : true;
UINT nStartTick = 0;
@@ -1380,13 +1390,13 @@
if (instr)
{
MODSAMPLE *psmp = pChn->pModSample;
- InstrumentChange(pChn, instr, bPorta, TRUE);
+ InstrumentChange(pChn, instr, bPorta, true);
pChn->nNewIns = 0;
// Special IT case: portamento+note causes sample change -> ignore portamento
if ((m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT))
&& (psmp != pChn->pModSample) && (note) && (note < 0x80))
{
- bPorta = FALSE;
+ bPorta = false;
}
}
// New Note ?
@@ -1394,7 +1404,7 @@
{
if ((!instr) && (pChn->nNewIns) && (note < 0x80))
{
- InstrumentChange(pChn, pChn->nNewIns, bPorta, FALSE, (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) ? FALSE : TRUE);
+ InstrumentChange(pChn, pChn->nNewIns, bPorta, false, (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) ? false : true);
pChn->nNewIns = 0;
}
NoteChange(nChn, note, bPorta, (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) ? false : true);
@@ -3330,7 +3340,7 @@
{
int vol = pChn->nVolume;
- // FT2 compatibility: Retrig + volume will not change volume of retrigged notes
+ // XM compatibility: Retrig + volume will not change volume of retrigged notes
if(!IsCompatibleMode(TRK_FASTTRACKER2) || !(pChn->nRowVolCmd == VOLCMD_VOLUME))
{
if (retrigTable1[dv])
@@ -3352,7 +3362,7 @@
{
if ((pChn->nRowInstr) && (param < 0x100))
{
- InstrumentChange(pChn, pChn->nRowInstr, FALSE, FALSE);
+ InstrumentChange(pChn, pChn->nRowInstr, false, false);
bResetEnv = true;
}
if (param < 0x100) bResetEnv = true;
@@ -3872,7 +3882,8 @@
UINT CSoundFile::GetBestPlugin(UINT nChn, UINT priority, bool respectMutes)
//-------------------------------------------------------------------------
{
- if (nChn > MAX_CHANNELS) { //Check valid channel number
+ if (nChn > MAX_CHANNELS) //Check valid channel number
+ {
return 0;
}
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2010-03-20 17:26:29 UTC (rev 538)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2010-03-20 22:00:26 UTC (rev 539)
@@ -821,7 +821,7 @@
UINT GetNNAChannel(UINT nChn) const;
void CheckNNA(UINT nChn, UINT instr, int note, BOOL bForceCut);
void NoteChange(UINT nChn, int note, bool bPorta = false, bool bResetEnv = true, bool bManual = false);
- void InstrumentChange(MODCHANNEL *pChn, UINT instr, BOOL bPorta=FALSE,BOOL bUpdVol=TRUE,BOOL bResetEnv=TRUE);
+ void InstrumentChange(MODCHANNEL *pChn, UINT instr, bool bPorta = false, bool bUpdVol = true, bool bResetEnv = true);
// Channel Effects
void KeyOff(UINT nChn);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-20 17:26:39
|
Revision: 538
http://modplug.svn.sourceforge.net/modplug/?rev=538&view=rev
Author: saga-games
Date: 2010-03-20 17:26:29 +0000 (Sat, 20 Mar 2010)
Log Message:
-----------
[Ref] Moved the "visited rows" code a bit so that it can be used for other purposes later. It's also using bool vectors now, as those are apparently specialized to really only take up a bit per vector item.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-20 12:32:15 UTC (rev 537)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-20 17:26:29 UTC (rev 538)
@@ -77,7 +77,9 @@
//-------------------------------------------
{
bool dummy = false;
- return GetLength(dummy, bAdjust, bTotal);
+ double result = GetLength(dummy, bAdjust, bTotal);
+ InitializeVisitedRows(true); // forget that we went over the whole module.
+ return result;
}
double CSoundFile::GetLength(bool& targetReached, BOOL bAdjust, BOOL bTotal, ORDERINDEX endOrder, ROWINDEX endRow)
@@ -117,31 +119,7 @@
nPattern = Order[0];
nRow = nNextRow = 0;
- /* Now, some fun code begins: This will determine if a specific row in a pattern (orderlist item)
- has been visited before. This way, we can tell when the module starts to loop, i.e. when we have determined
- the song length (or found out that a given point of the module cannot be reached).
- The concept is actually very simple: Store a boolean value for every row for every possible orderlist item.
- To save some memory, I have decided to actually store 8 row flags in one uint8 item, to save some
- space. Hence, there's some funky bit-shifting here and there.
- As the modplug engine already deals with pattern loops sufficiently, there's no problem with (infinite) pattern loops
- in this code. However, if you're going to use this idea somewhere else, bare in mind that rows inside pattern loops
- should only be evaluated once, or else the algorithm will cancel too early!
- */
- vector<vector<uint8> > visited_rows;
- visited_rows.resize(Order.GetLengthTailTrimmed());
- for(ORDERINDEX nOrd = 0; nOrd < Order.GetLengthTailTrimmed(); nOrd++)
- {
- PATTERNINDEX nPat = Order[nOrd];
- ROWINDEX nSize = 0;
- if(Patterns.IsValidPat(nPat))
- nSize = Patterns[nPat].GetNumRows();
- // as we need one vector unit per 8 rows, we will probably have to add some non-existing rows
- // (f.e. if a pattern has 7 rows, we actually need another row so it's 8 rows = 1 byte - got it? ;)
- if(nSize & 7)
- nSize += 8;
- nSize >>= 3; // 2^3 elements per vector unit!
- visited_rows[nOrd].resize(nSize, 0);
- }
+ InitializeVisitedRows(true);
for (;;)
{
@@ -187,16 +165,8 @@
break;
}
- // Detect backward loop (or more general: if this row has been visited before)
- size_t row_slot = nRow >> 3;
- uint8 row_mask = 1 << (nRow & 7);
- // This should always be true - but who knows what different parts of the program could modify the patterns and orders while this test is running?
- if(nCurrentPattern < visited_rows.size() && row_slot < visited_rows[nCurrentPattern].size())
- {
- if((visited_rows[nCurrentPattern][row_slot] & row_mask) != 0)
- break; // we visited this row already - this module must be looping.
- visited_rows[nCurrentPattern][row_slot] |= row_mask;
- }
+ if(IsRowVisited(nCurrentPattern, nRow, true))
+ break;
// Update next position
nNextRow = nRow + 1;
@@ -3594,7 +3564,7 @@
m_nMusicTempo = param;
}
// Tempo Slide
- else if (param < 0x20 && m_nTickCount) //rewbs.tempoSlideFix: only slide if (T0x or T1x) and tick is not 0
+ else if (param < 0x20 && !(m_dwSongFlags & SONG_FIRSTTICK)) //rewbs.tempoSlideFix: only slide if (T0x or T1x) and tick is not 0
{
if ((param & 0xF0) == 0x10)
m_nMusicTempo += (param & 0x0F); //rewbs.tempoSlideFix: no *2
@@ -3625,7 +3595,7 @@
{
//IT compatibility 10. Pattern loops (+ same fix for XM and MOD files)
if(IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2 | TRK_PROTRACKER))
- pChn->nPatternLoop = m_nRow+1;
+ pChn->nPatternLoop = m_nRow + 1;
return -1;
}
@@ -4042,4 +4012,97 @@
pChn->nOldFinePortaUpDown = abs(tickParam);
pChn->m_CalculateFreq = true;
+}
+
+
+/* Now, some fun code begins: This will determine if a specific row in a pattern (orderlist item)
+ has been visited before. This way, we can tell when the module starts to loop, i.e. when we have determined
+ the song length (or found out that a given point of the module cannot be reached).
+ The concept is actually very simple: Store a boolean value for every row for every possible orderlist item.
+
+ Specific implementations:
+
+ Length detection code:
+ As the modplug engine already deals with pattern loops sufficiently, there's no problem with (infinite) pattern loops
+ in this code.
+
+ Normal player code:
+ Bare in mind that rows inside pattern loops should only be evaluated once, or else the algorithm will cancel too early!
+ So in that case, the pattern loop rows have to be reset when looping back.
+*/
+
+
+void CSoundFile::InitializeVisitedRows(const bool bReset)
+//-------------------------------------------------------
+{
+ m_bVisitedRows.resize(Order.GetLengthTailTrimmed());
+
+ for(ORDERINDEX nOrd = 0; nOrd < Order.GetLengthTailTrimmed(); nOrd++)
+ {
+ // If we want to reset the vectors completely, we overwrite exisiting items with 0.
+ if(bReset)
+ {
+ for(size_t i = 0; i < m_bVisitedRows[nOrd].size(); i++)
+ {
+ m_bVisitedRows[nOrd][i] = false;
+ }
+ }
+ m_bVisitedRows[nOrd].resize(GetVisitedRowsVectorSize(Order[nOrd]), false);
+ }
+}
+
+
+// (Un)sets a given row as visited.
+void CSoundFile::SetRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bVisited)
+//---------------------------------------------------------------------------------------------
+{
+ const ORDERINDEX nMaxOrd = Order.GetLengthTailTrimmed();
+ if(nOrd >= nMaxOrd)
+ return;
+
+ // The module might have been edited in the meantime - so we have to extend this a bit.
+ if(nOrd >= m_bVisitedRows.size() || nRow >= m_bVisitedRows[nOrd].size())
+ InitializeVisitedRows(false);
+
+ m_bVisitedRows[nOrd][nRow] = bVisited;
+}
+
+
+// Returns if a given row has been visited yet.
+// If bAutoSet is true, the queried row will automatically be marked as visited.
+// Use this parameter instead of consecutive IsRowVisited/SetRowVisited calls, as it's faster.
+bool CSoundFile::IsRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bAutoSet)
+//--------------------------------------------------------------------------------------------
+{
+ const ORDERINDEX nMaxOrd = Order.GetLengthTailTrimmed();
+ if(nOrd >= nMaxOrd)
+ return false;
+
+ // The row slot for this row has not been assigned yet - Just return false, as this means that the program has not played the row yet.
+ if(nOrd >= m_bVisitedRows.size() || nRow >= m_bVisitedRows[nOrd].size())
+ {
+ if(bAutoSet)
+ SetRowVisited(nOrd, nRow, true);
+ else
+ return false;
+ }
+
+ if(m_bVisitedRows[nOrd][nRow])
+ return true; // we visited this row already - this module must be looping.
+
+ if(bAutoSet)
+ m_bVisitedRows[nOrd][nRow] = true;
+
+ return false;
+}
+
+
+// Get the needed vector size for pattern nPat.
+size_t CSoundFile::GetVisitedRowsVectorSize(const PATTERNINDEX nPat)
+//------------------------------------------------------------------
+{
+ if(Patterns.IsValidPat(nPat))
+ return (size_t)(Patterns[nPat].GetNumRows());
+ else
+ return 0;
}
\ No newline at end of file
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2010-03-20 12:32:15 UTC (rev 537)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2010-03-20 17:26:29 UTC (rev 538)
@@ -532,8 +532,11 @@
uint16 m_ModFlags;
const CModSpecifications* m_pModSpecs;
+ // For handling backwards jumps and stuff to prevent infinite loops when counting the mod length or rendering to wav.
+ vector<vector<bool> > m_bVisitedRows;
+
public: // Static Members
static UINT m_nXBassDepth, m_nXBassRange;
static float m_nMaxSample;
@@ -578,7 +581,8 @@
m_nGlobalVolumeDestination, m_nSamplePreAmp, m_nVSTiVolume;
long m_lHighResRampingGlobalVolume;
UINT m_nFreqFactor, m_nTempoFactor, m_nOldGlbVolSlide;
- LONG m_nMinPeriod, m_nMaxPeriod, m_nRepeatCount;
+ LONG m_nMinPeriod, m_nMaxPeriod;
+ LONG m_nRepeatCount; // -1 means repeat infinitely.
DWORD m_nGlobalFadeSamples, m_nGlobalFadeMaxSamples;
UINT m_nMaxOrderPosition, m_nPatternNames;
LPSTR m_lpszSongComments, m_lpszPatternNames;
@@ -965,7 +969,15 @@
void BuildDefaultInstrument();
long GetSampleOffset();
+// A couple of functions for handling backwards jumps and stuff to prevent infinite loops when counting the mod length or rendering to wav.
public:
+ void InitializeVisitedRows(const bool bReset = true);
+private:
+ void SetRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bVisited = true);
+ bool IsRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bAutoSet = true);
+ size_t GetVisitedRowsVectorSize(const PATTERNINDEX nPat);
+
+public:
// "importance" of every FX command. Table is used for importing from formats with multiple effect colums
// and is approximately the same as in SchismTracker.
static uint16 CSoundFile::GetEffectWeight(MODCOMMAND::COMMAND cmd);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-20 12:32:24
|
Revision: 537
http://modplug.svn.sourceforge.net/modplug/?rev=537&view=rev
Author: saga-games
Date: 2010-03-20 12:32:15 +0000 (Sat, 20 Mar 2010)
Log Message:
-----------
[Fix] S3M/IT compatibility: Note Cut really cuts notes and does not just mute them (so that following volume commands could restore the sample)
[Imp] Cleanup Dialog: Made it look a bit nicer.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/soundlib/Snd_fx.cpp
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2010-03-19 19:38:33 UTC (rev 536)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2010-03-20 12:32:15 UTC (rev 537)
@@ -36,38 +36,44 @@
LTEXT "The following problems have been encountered when loading this module:",IDC_STATIC,6,6,237,8
END
-IDD_CLEANUP_SONG DIALOGEX 0, 0, 370, 281
+IDD_CLEANUP_SONG DIALOGEX 0, 0, 394, 154
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cleanup"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "OK",IDOK,306,6,60,14
- PUSHBUTTON "Cancel",IDCANCEL,306,24,60,14
- CONTROL "Remove unused",IDC_CHK_CLEANUP_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,18,90,10
- CONTROL "Remove all",IDC_CHK_REMOVE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,18,90,10
- CONTROL "Rearrange",IDC_CHK_REARRANGE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,18,90,10
- CONTROL "Merge sequences",IDC_CHK_MERGE_SEQUENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,54,90,10
- CONTROL "Remove all orders",IDC_CHK_REMOVE_ORDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,54,90,10
- CONTROL "Remove unused",IDC_CHK_CLEANUP_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,90,90,10
- CONTROL "Remove all",IDC_CHK_REMOVE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,90,90,10
- CONTROL "Rearrange",IDC_CHK_REARRANGE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,90,90,10
+ DEFPUSHBUTTON "OK",IDOK,330,6,60,14
+ PUSHBUTTON "Cancel",IDCANCEL,330,24,60,14
+ CONTROL "Remove unused",IDC_CHK_CLEANUP_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,6,90,10
+ CONTROL "Remove all",IDC_CHK_REMOVE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,6,90,10
+ CONTROL "Rearrange",IDC_CHK_REARRANGE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,18,90,10
+ CONTROL "Merge sequences",IDC_CHK_MERGE_SEQUENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,36,90,10
+ CONTROL "Remove all orders",IDC_CHK_REMOVE_ORDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,36,90,10
+ CONTROL "Remove unused",IDC_CHK_CLEANUP_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,54,90,10
+ CONTROL "Remove all",IDC_CHK_REMOVE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,54,90,10
+ CONTROL "Rearrange",IDC_CHK_REARRANGE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,66,90,10
CONTROL "Remove data after loop end",IDC_CHK_OPTIMIZE_SAMPLES,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,102,108,10
- CONTROL "Remove unused",IDC_CHK_CLEANUP_INSTRUMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,138,90,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,66,108,10
+ CONTROL "Remove unused",IDC_CHK_CLEANUP_INSTRUMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,84,90,10
CONTROL "Remove all (convert to samples)",IDC_CHK_REMOVE_INSTRUMENTS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,138,120,10
- CONTROL "Remove unused",IDC_CHK_CLEANUP_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,174,90,10
- CONTROL "Remove all",IDC_CHK_REMOVE_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,174,90,10
- CONTROL "Reset all variables",IDC_CHK_RESET_VARIABLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,90,10
- PUSHBUTTON "Remove all unused stuff",IDC_BTN_CLEANUP_SONG,18,246,90,18
- PUSHBUTTON "Compo cleanup",IDC_BTN_COMPO_CLEANUP,120,246,90,18
- GROUPBOX "Patterns",IDC_STATIC,6,6,294,30
- GROUPBOX "Orders / Sequences",IDC_STATIC,6,42,294,30
- GROUPBOX "Samples",IDC_STATIC,6,78,294,42
- GROUPBOX "Instruments",IDC_STATIC,6,126,294,30
- GROUPBOX "Plugins",IDC_STATIC,6,162,294,30
- GROUPBOX "Miscellaneous",IDC_STATIC,6,198,294,30
- GROUPBOX "Presets",IDC_STATIC,6,234,294,36
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,84,120,10
+ CONTROL "Remove unused",IDC_CHK_CLEANUP_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,102,90,10
+ CONTROL "Remove all",IDC_CHK_REMOVE_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,102,90,10
+ CONTROL "Reset all variables",IDC_CHK_RESET_VARIABLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,120,90,10
+ PUSHBUTTON "Remove all unused stuff",IDC_BTN_CLEANUP_SONG,108,138,90,12
+ PUSHBUTTON "Create samplepack",IDC_BTN_COMPO_CLEANUP,204,138,90,12
+ LTEXT "Patterns:",IDC_STATIC,6,6,84,12
+ LTEXT "Orders / Sequences:",IDC_STATIC,6,36,84,12
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,30,312,1
+ LTEXT "Samples:",IDC_STATIC,6,53,84,12
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,48,312,1
+ LTEXT "Instruments:",IDC_STATIC,6,82,84,12
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,78,312,1
+ LTEXT "Plugins:",IDC_STATIC,6,101,84,12
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,96,312,1
+ LTEXT "Miscellaneous:",IDC_STATIC,6,119,84,12
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,114,312,1
+ LTEXT "Presets:",IDC_STATIC,6,137,84,12
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,132,312,1
END
IDD_CHANNEL_NAME DIALOGEX 0, 0, 154, 58
@@ -162,9 +168,9 @@
IDD_CLEANUP_SONG, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 363
+ RIGHTMARGIN, 387
TOPMARGIN, 7
- BOTTOMMARGIN, 274
+ BOTTOMMARGIN, 147
END
IDD_CHANNEL_NAME, DIALOG
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-19 19:38:33 UTC (rev 536)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-20 12:32:15 UTC (rev 537)
@@ -353,7 +353,7 @@
break;
// Global Volume
case CMD_GLOBALVOLUME:
- if (!(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))) param <<= 1;
+ if (!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) param <<= 1;
if(IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2))
{
//IT compatibility 16. Both FT2 and IT ignore out-of-range values
@@ -381,13 +381,13 @@
if (((param & 0x0F) == 0x0F) && (param & 0xF0))
{
param >>= 4;
- if (!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1;
+ if (!(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1;
nGlbVol += param << 1;
} else
if (((param & 0xF0) == 0xF0) && (param & 0x0F))
{
param = (param & 0x0F) << 1;
- if (!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1;
+ if (!(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1;
nGlbVol -= param;
} else
if (param & 0xF0)
@@ -3466,7 +3466,7 @@
if(IsCompatibleMode(TRK_IMPULSETRACKER))
nTick = 1;
// ST3 doesn't cut notes with SC0
- else if(m_nType == MOD_TYPE_S3M)
+ else if(GetType() == MOD_TYPE_S3M)
return;
}
@@ -3475,14 +3475,23 @@
MODCHANNEL *pChn = &Chn[nChn];
// if (m_nInstruments) KeyOff(pChn); ?
pChn->nVolume = 0;
+ // S3M/IT compatibility: Note Cut really cuts notes and does not just mute them (so that following volume commands could restore the sample)
+ if(IsCompatibleMode(TRK_IMPULSETRACKER|TRK_SCREAMTRACKER))
+ {
+ pChn->nPeriod = 0;
+ }
pChn->dwFlags |= CHN_FASTVOLRAMP;
MODINSTRUMENT *pHeader = pChn->pModInstrument;
- if (pHeader && pHeader->nMidiChannel>0 && pHeader->nMidiChannel<17) { // instro sends to a midi chan
+ // instro sends to a midi chan
+ if (pHeader && pHeader->nMidiChannel>0 && pHeader->nMidiChannel<17)
+ {
UINT nPlug = pHeader->nMixPlug;
- if ((nPlug) && (nPlug <= MAX_MIXPLUGINS)) {
+ if ((nPlug) && (nPlug <= MAX_MIXPLUGINS))
+ {
IMixPlugin *pPlug = (IMixPlugin*)m_MixPlugins[nPlug-1].pMixPlugin;
- if (pPlug) {
+ if (pPlug)
+ {
pPlug->MidiCommand(pHeader->nMidiChannel, pHeader->nMidiProgram, pHeader->wMidiBank, /*pChn->nNote+*/NOTE_KEYOFF, 0, nChn);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-19 19:38:41
|
Revision: 536
http://modplug.svn.sourceforge.net/modplug/?rev=536&view=rev
Author: saga-games
Date: 2010-03-19 19:38:33 +0000 (Fri, 19 Mar 2010)
Log Message:
-----------
[Fix] Pattern Editor: Changing a channel plugin in MOD/S3M files doesn't mark them as modified anymore.
[Fix] General Tab: Moving a plugin in MOD/S3M files doesn't mark them as modified anymore. The channel fx dropdown lists are now also disabled for those module types.
[Fix] Plugin Editor: Changing a plugin parameter in MOD/S3M files doesn't mark them as modified anymore.
[Ref] Added "supportsPlugins" to MOD specifications.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/View_gen.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/soundlib/mod_specifications.h
Modified: trunk/OpenMPT/mptrack/View_gen.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_gen.cpp 2010-03-19 18:43:47 UTC (rev 535)
+++ trunk/OpenMPT/mptrack/View_gen.cpp 2010-03-19 19:38:33 UTC (rev 536)
@@ -403,10 +403,10 @@
::EnableWindow(m_sbPan[ichn].m_hWnd, bEnable && !(pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_MOD)));
::EnableWindow(m_spinPan[ichn], bEnable && !(pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_MOD)));
- ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT1+ichn*2), bIT);
- ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT2+ichn*2), bEnable && !(pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_MOD)));
- ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT9+ichn), ((bEnable) && (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT))));
- m_CbnEffects[ichn].EnableWindow(bEnable);
+ ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT1 + ichn*2), bIT); // channel vol
+ ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT2 + ichn*2), bEnable && !(pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_MOD))); // channel pan
+ ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT9 + ichn), ((bEnable) && (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)))); // channel name
+ m_CbnEffects[ichn].EnableWindow(bEnable & (pSndFile->GetModSpecifications().supportsPlugins ? TRUE : FALSE));
}
UnlockControls();
}
@@ -707,7 +707,8 @@
wsprintf(s, "(%d%% wet, %d%% dry)", 100-n, n);
SetDlgItemText(IDC_STATIC8, s);
pPlugin->fDryRatio = static_cast<float>(n)/100.0f;
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
}
}
@@ -738,7 +739,8 @@
{
pVstPlugin->SetParameter(m_nCurrentParam, fValue);
OnParamChanged();
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
}
}
@@ -765,7 +767,8 @@
pSndFile = pModDoc->GetSoundFile();
pPlugin = &pSndFile->m_MixPlugins[m_nCurrentPlugin];
- if(pPlugin->pMixPlugin){
+ if(pPlugin->pMixPlugin)
+ {
DWORD gain = nPos;
if(gain == 0) gain = 1;
@@ -776,7 +779,8 @@
sprintf(s,"Gain: x %1.1f",fValue);
SetDlgItemText(IDC_STATIC2, s);
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
}
// -! BEHAVIOUR_CHANGE#0028
@@ -828,7 +832,8 @@
&& (pSndFile->ChnSettings[nChn].nMixPlugin != (UINT)nfx))
{
pSndFile->ChnSettings[nChn].nMixPlugin = (PLUGINDEX)nfx;
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB));
}
}
@@ -856,7 +861,8 @@
if (strcmp(s, pSndFile->m_MixPlugins[m_nCurrentPlugin].Info.szName))
{
memcpy(pSndFile->m_MixPlugins[m_nCurrentPlugin].Info.szName, s, 32);
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB));
}
}
@@ -930,10 +936,8 @@
CSelectPluginDlg dlg(pModDoc, m_nCurrentPlugin, this);
if (dlg.DoModal() == IDOK)
{
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT))
- {
+ if(pSndFile->GetModSpecifications().supportsPlugins)
pModDoc->SetModified();
- }
}
OnPluginChanged();
OnParamChanged();
@@ -1004,7 +1008,8 @@
if (m_nCurrentPreset > 0 && m_nCurrentPreset <= nParams){
pVstPlugin->SetCurrentProgram(m_nCurrentPreset-1);
}
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
}
@@ -1025,10 +1030,13 @@
if(files.abort) return;
//TODO: exception handling
- if (!(pVstPlugin->LoadProgram(files.first_file.c_str()))) {
+ if (!(pVstPlugin->LoadProgram(files.first_file.c_str())))
+ {
::AfxMessageBox("Error loading preset.Are you sure it is for this plugin?");
- } else {
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ } else
+ {
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
//end rewbs.fxpPresets
@@ -1080,7 +1088,8 @@
FLOAT fValue = (FLOAT)atof(s);
pVstPlugin->SetParameter(m_nCurrentParam, fValue);
OnParamChanged();
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
}
}
@@ -1102,7 +1111,8 @@
//CVstPlugin *pVstPlugin = (CVstPlugin *)pPlugin->pMixPlugin;
UINT value = GetDlgItemIntEx(IDC_EDIT15);
pPlugin->fDryRatio = (float)value / 100.0f;
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
//OnWetDryChanged();
}
}
@@ -1153,7 +1163,8 @@
pPlugin->Info.dwInputRouting &= ~MIXPLUG_INPUTF_MASTEREFFECT;
}
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
@@ -1175,7 +1186,8 @@
pPlugin->Info.dwInputRouting &= ~MIXPLUG_INPUTF_BYPASS;
}
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
@@ -1199,7 +1211,8 @@
pPlugin->Info.dwInputRouting &= ~MIXPLUG_INPUTF_MIXEXPAND;
}
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
VOID CViewGlobals::OnSpecialMixProcessingChanged()
@@ -1211,7 +1224,8 @@
if(!pPlugin) return;
pPlugin->Info.dwInputRouting = (pPlugin->Info.dwInputRouting & 0xffff00ff) | (m_CbnSpecialMixProcessing.GetCurSel()<<8); // update#02 (fix)
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
// -! BEHAVIOUR_CHANGE#0028
@@ -1234,7 +1248,8 @@
pPlugin->Info.dwInputRouting &= ~MIXPLUG_INPUTF_WETMIX;
}
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
@@ -1263,7 +1278,8 @@
{
CVstPlugin *pVstPlugin = (CVstPlugin *)pPlugin->pMixPlugin;
pVstPlugin->ExecuteCommand(nIndex);
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
}
@@ -1281,7 +1297,8 @@
pPlugin = &pSndFile->m_MixPlugins[m_nCurrentPlugin];
nroute = m_CbnOutput.GetItemData(m_CbnOutput.GetCurSel());
pPlugin->Info.dwOutputRouting = nroute;
- if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
@@ -1396,7 +1413,8 @@
END_CRITICAL();
- pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
EndWaitCursor();
@@ -1453,7 +1471,8 @@
m_CbnPlugin.SetCurSel(m_nCurrentPlugin);
OnPluginChanged();
- pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
}
}
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-19 18:43:47 UTC (rev 535)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-19 19:38:33 UTC (rev 536)
@@ -4365,7 +4365,7 @@
}
void CViewPattern::TempEnterChord(int note)
-//---------------------------------------------
+//-----------------------------------------
{
CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
CModDoc *pModDoc = GetDocument();
@@ -4650,7 +4650,8 @@
if (newPlug <= MAX_MIXPLUGINS && newPlug != pSndFile->ChnSettings[m_nMenuOnChan-1].nMixPlugin)
{
pSndFile->ChnSettings[m_nMenuOnChan-1].nMixPlugin = newPlug;
- pModDoc->SetModified();
+ if(pSndFile->GetModSpecifications().supportsPlugins)
+ pModDoc->SetModified();
InvalidateChannelsHeaders();
}
}
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-03-19 18:43:47 UTC (rev 535)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-03-19 19:38:33 UTC (rev 536)
@@ -664,8 +664,10 @@
CModDoc* pModDoc = pVstPlugin->GetModDoc();
if (pModDoc) {
CAbstractVstEditor *pVstEditor = pVstPlugin->GetEditor();
- if (pVstEditor && pVstEditor->m_hWnd) { //Check GUI is open
- CMainFrame::GetMainFrame()->ThreadSafeSetModified(pModDoc);
+ if (pVstEditor && pVstEditor->m_hWnd) // Check GUI is open
+ {
+ if(pModDoc->GetSoundFile() && pModDoc->GetSoundFile()->GetModSpecifications().supportsPlugins)
+ CMainFrame::GetMainFrame()->ThreadSafeSetModified(pModDoc);
}
//Could be used to update general tab in real time, but causes flickers in treeview
//pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, NULL);
@@ -980,11 +982,11 @@
//---from here VST 2.1 extension opcodes------------------------------------------------------
// begin of automation session (when mouse down), parameter index in <index>
case audioMasterBeginEdit:
- Log("VST plugin to host: Get Directory\n");
+ Log("VST plugin to host: Begin Edit\n");
break;
// end of automation session (when mouse up), parameter index in <index>
case audioMasterEndEdit:
- Log("VST plugin to host: Get Directory\n");
+ Log("VST plugin to host: End Edit\n");
break;
// open a fileselector window with VstFileSelect* in <ptr>
case audioMasterOpenFileSelector:
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2010-03-19 18:43:47 UTC (rev 535)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2010-03-19 19:38:33 UTC (rev 536)
@@ -47,6 +47,7 @@
char volcommands[MAX_VOLCMDS + 1]; // dito, but for volume column
bool hasIgnoreIndex; // Does "+++" pattern exist?
bool hasRestartPos;
+ bool supportsPlugins;
};
@@ -91,6 +92,7 @@
" vpcdabuhlrgfe:o", // Supported Volume Column commands
true, // Has "+++" pattern
true, // Has restart position (order)
+ true, // Supports plugins
};
@@ -130,6 +132,7 @@
" ???????????????", // Supported Volume Column commands
false, // Doesn't have "+++" pattern
true, // Has restart position (order)
+ false, // Doesn't support plugins
};
// MOD with MPT extensions.
@@ -167,6 +170,7 @@
" ???????????????", // Supported Volume Column commands
true, // Has "+++" pattern
true, // Has restart position (order)
+ false, // Doesn't support plugins
};
const CModSpecifications xm =
@@ -203,6 +207,7 @@
" vpcdabuhlrg????", // Supported Volume Column commands
false, // Doesn't have "+++" pattern
true, // Has restart position (order)
+ false, // Doesn't support plugins
};
// XM with MPT extensions
@@ -240,6 +245,7 @@
" vpcdabuhlrgfe:o", // Supported Volume Column commands
true, // Has "+++" pattern
true, // Has restart position (order)
+ true, // Supports plugins
};
const CModSpecifications s3m =
@@ -276,6 +282,7 @@
" vp?????????????", // Supported Volume Column commands
true, // Has "+++" pattern
false, // Doesn't have restart position (order)
+ false, // Doesn't support plugins
};
// S3M with MPT extensions
@@ -313,6 +320,7 @@
" vp?????????????", // Supported Volume Column commands
true, // Has "+++" pattern
false, // Doesn't have restart position (order)
+ false, // Doesn't support plugins
};
const CModSpecifications it =
@@ -349,6 +357,7 @@
" vpcdab?h??gfe??", // Supported Volume Column commands
true, // Has "+++" pattern
false, // Doesn't have restart position (order)
+ false, // Doesn't support plugins
};
const CModSpecifications itEx =
@@ -385,6 +394,7 @@
" vpcdab?h??gfe:o", // Supported Volume Column commands
true, // Has "+++" pattern
true, // Has restart position (order)
+ true, // Supports plugins
};
} //namespace ModSpecs
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-19 18:43:56
|
Revision: 535
http://modplug.svn.sourceforge.net/modplug/?rev=535&view=rev
Author: saga-games
Date: 2010-03-19 18:43:47 +0000 (Fri, 19 Mar 2010)
Log Message:
-----------
[Fix] Pattern Editor: Display "fine" / "extra fine" portamento effects properly (S3M/IT/MPTM), display SFx macro properly, display MOD effects with no memory properly.
[Ref] Fixed a path in mptrack.h (which apparently doesn't work in VC6, in which OpenMPT doesn't compile properly anyway)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Mptrack.h
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-17 23:18:14 UTC (rev 534)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-19 18:43:47 UTC (rev 535)
@@ -2327,7 +2327,7 @@
case CMD_GLOBALVOLSLIDE:
case CMD_CHANNELVOLSLIDE:
case CMD_PANNINGSLIDE:
- if (m_SndFile.m_nType & MOD_TYPE_S3MITMPT)
+ if (m_SndFile.GetType() & MOD_TYPE_S3MITMPT)
{
if (!param) pos = 29; else
if (((param & 0x0F) == 0x0F) && (param & 0xF0))
@@ -2345,7 +2345,7 @@
}
break;
case CMD_PANNING8:
- if(m_SndFile.m_nType & MOD_TYPE_S3M)
+ if(m_SndFile.GetType() == MOD_TYPE_S3M)
{
pos = CLAMP(param, 0, 0x80);
if(param == 0xA4)
@@ -2373,7 +2373,7 @@
case CMD_GLOBALVOLSLIDE:
case CMD_CHANNELVOLSLIDE:
case CMD_PANNINGSLIDE:
- if (m_SndFile.m_nType & MOD_TYPE_S3MITMPT)
+ if (m_SndFile.GetType() & MOD_TYPE_S3MITMPT)
{
if (pos < 15) param = 15-pos; else
if (pos < 29) param = (29-pos) | 0xF0; else
@@ -2387,7 +2387,7 @@
}
break;
case CMD_PANNING8:
- if(m_SndFile.m_nType & MOD_TYPE_S3M)
+ if(m_SndFile.GetType() == MOD_TYPE_S3M)
param = (pos <= 0x80) ? pos : 0xA4;
break;
}
@@ -2398,42 +2398,58 @@
bool CModDoc::GetEffectNameEx(LPSTR pszName, UINT ndx, UINT param)
//----------------------------------------------------------------
{
- CHAR s[64];
+ char s[64];
+ char szContinueOrIgnore[16];
+
if (pszName) pszName[0] = 0;
if ((!pszName) || (ndx >= MAX_FXINFO) || (!gFXInfo[ndx].pszName)) return false;
wsprintf(pszName, "%s: ", gFXInfo[ndx].pszName);
s[0] = 0;
+ // for effects that don't have effect memory in MOD format.
+ if(m_SndFile.GetType() == MOD_TYPE_MOD)
+ strcpy(szContinueOrIgnore, "ignore");
+ else
+ strcpy(szContinueOrIgnore, "continue");
+
std::string sPlusChar = "+", sMinusChar = "-";
switch(gFXInfo[ndx].dwEffect)
{
case CMD_ARPEGGIO:
+ if(m_SndFile.GetType() == MOD_TYPE_XM) // XM also ignores this!
+ strcpy(szContinueOrIgnore, "ignore");
+
if (param)
wsprintf(s, "note+%d note+%d", param >> 4, param & 0x0F);
else
- strcpy(s, "continue");
+ strcpy(s, szContinueOrIgnore);
break;
case CMD_PORTAMENTOUP:
- if (param)
- wsprintf(s, "+%d", param);
- else
- strcpy(s, "continue");
- break;
-
case CMD_PORTAMENTODOWN:
- if (param)
- wsprintf(s, "-%d", param);
+ if(param)
+ {
+ char sign[2];
+ strcpy(sign, (gFXInfo[ndx].dwEffect == CMD_PORTAMENTOUP) ? "+" : "-");
+ if((m_SndFile.GetType() & MOD_TYPE_S3MITMPT) && ((param & 0xF0) == 0xF0))
+ wsprintf(s, "fine %s%d", sign, (param & 0x0F));
+ else if((m_SndFile.GetType() & MOD_TYPE_S3MITMPT) && ((param & 0xF0) == 0xE0))
+ wsprintf(s, "extra fine %s%d", sign, (param & 0x0F));
+ else
+ wsprintf(s, "%s%d", sign, param);
+ }
else
- strcpy(s, "continue");
+ {
+ strcpy(s, szContinueOrIgnore);
+ }
break;
case CMD_TONEPORTAMENTO:
if (param)
wsprintf(s, "speed %d", param);
else
- strcpy(s, "continue");
+ strcpy(s, szContinueOrIgnore);
break;
case CMD_VIBRATO:
@@ -2443,7 +2459,7 @@
if (param)
wsprintf(s, "speed=%d depth=%d", param >> 4, param & 0x0F);
else
- strcpy(s, "continue");
+ strcpy(s, szContinueOrIgnore);
break;
case CMD_SPEED:
@@ -2500,7 +2516,7 @@
case CMD_PANNINGSLIDE:
if(gFXInfo[ndx].dwEffect == CMD_PANNINGSLIDE)
{
- if(m_SndFile.m_nType & MOD_TYPE_XM)
+ if(m_SndFile.GetType() == MOD_TYPE_XM)
{
sPlusChar = "-> ";
sMinusChar = "<- ";
@@ -2516,11 +2532,11 @@
{
wsprintf(s, "continue");
} else
- if ((m_SndFile.m_nType & MOD_TYPE_S3MITMPT) && ((param & 0x0F) == 0x0F) && (param & 0xF0))
+ if ((m_SndFile.GetType() & MOD_TYPE_S3MITMPT) && ((param & 0x0F) == 0x0F) && (param & 0xF0))
{
wsprintf(s, "fine %s%d", sPlusChar.c_str(), param >> 4);
} else
- if ((m_SndFile.m_nType & MOD_TYPE_S3MITMPT) && ((param & 0xF0) == 0xF0) && (param & 0x0F))
+ if ((m_SndFile.GetType() & MOD_TYPE_S3MITMPT) && ((param & 0xF0) == 0xF0) && (param & 0x0F))
{
wsprintf(s, "fine %s%d", sMinusChar.c_str(), param & 0x0F);
} else
@@ -2706,8 +2722,9 @@
strcat(s, " rows");
break;
case 0xF0: // macro
- if(m_SndFile.m_nType & MOD_TYPE_MOD)
- wsprintf(s, "SF%X", param & 0x0F); break;
+ if(m_SndFile.GetType() != MOD_TYPE_MOD)
+ wsprintf(s, "SF%X", param & 0x0F);
+ break;
default:
break;
}
@@ -2754,7 +2771,7 @@
strcat(s, " rows");
break;
case 0xF0:
- if(m_SndFile.m_nType & MOD_TYPE_MOD) // invert loop
+ if(m_SndFile.GetType() == MOD_TYPE_MOD) // invert loop
{
if((param & 0x0F) == 0)
strcpy(s, "Stop");
@@ -3514,4 +3531,4 @@
displayName.Format(TEXT("%s (%s)"), (LPCTSTR)instrumentName, (LPCTSTR)pluginName);
}
return displayName;
-}
+}
\ No newline at end of file
Modified: trunk/OpenMPT/mptrack/Mptrack.h
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.h 2010-03-17 23:18:14 UTC (rev 534)
+++ trunk/OpenMPT/mptrack/Mptrack.h 2010-03-19 18:43:47 UTC (rev 535)
@@ -13,7 +13,7 @@
#endif
#include "resource.h" // main symbols
-#include "sndfile.h"
+#include "../soundlib/Sndfile.h"
#include <windows.h>
#ifdef UPDATECHECKENABLED
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-17 23:18:23
|
Revision: 534
http://modplug.svn.sourceforge.net/modplug/?rev=534&view=rev
Author: saga-games
Date: 2010-03-17 23:18:14 +0000 (Wed, 17 Mar 2010)
Log Message:
-----------
[Fix] Pattern Editor: In the note properties, the Gxx effect for XM files was not limited properly.
[Imp] Pattern Editor: Instead of simply ignoring note off/cut/fade when working with .MOD files, it is converted to C00.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-15 20:27:57 UTC (rev 533)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-17 23:18:14 UTC (rev 534)
@@ -2288,7 +2288,7 @@
else nmax = 0xFF;
break;
case CMD_GLOBALVOLUME:
- nmax = (nType & MOD_TYPE_IT | MOD_TYPE_MPT) ? 128 : 64;
+ nmax = (nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? 128 : 64;
break;
case CMD_MODCMDEX:
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-15 20:27:57 UTC (rev 533)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-17 23:18:14 UTC (rev 534)
@@ -4157,6 +4157,14 @@
else if( note < pSndFile->GetModSpecifications().noteMin)
note = pSndFile->GetModSpecifications().noteMin;
+ // Special case: Convert note off commands to C00 for MOD files
+ if((pSndFile->GetType() == MOD_TYPE_MOD) && (note == NOTE_NOTECUT || note == NOTE_FADE || note == NOTE_KEYOFF))
+ {
+ TempEnterFX(CMD_VOLUME);
+ TempEnterFXparam(0);
+ return;
+ }
+
// Check whether the module format supports the note.
if( pSndFile->GetModSpecifications().HasNote(note) == false )
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-15 20:28:07
|
Revision: 533
http://modplug.svn.sourceforge.net/modplug/?rev=533&view=rev
Author: saga-games
Date: 2010-03-15 20:27:57 +0000 (Mon, 15 Mar 2010)
Log Message:
-----------
[Imp] MT2 Loader: Make use of the "lines per beat" header field.
[Imp] VST Editor: Added shortcuts for "toggle bypass", "pass keys to plug" and "record params to pattern"
[Mod] Keymaps: Updated DE_jojo.mkb with the new VST Editor shortcuts.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/AbstractVstEditor.cpp
trunk/OpenMPT/mptrack/CommandSet.cpp
trunk/OpenMPT/mptrack/CommandSet.h
trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb
trunk/OpenMPT/soundlib/Load_mt2.cpp
Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp
===================================================================
--- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2010-03-14 18:43:27 UTC (rev 532)
+++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2010-03-15 20:27:57 UTC (rev 533)
@@ -311,13 +311,14 @@
switch(wParam)
{
- case kcVSTGUIPrevPreset: OnSetPreviousVSTPreset(); return wParam;
- case kcVSTGUIPrevPresetJump:OnVSTPresetBackwardJump(); return wParam;
- case kcVSTGUINextPreset: OnSetNextVSTPreset(); return wParam;
- case kcVSTGUINextPresetJump:OnVSTPresetForwardJump(); return wParam;
- case kcVSTGUIRandParams: OnRandomizePreset() ; return wParam;
-
-
+ case kcVSTGUIPrevPreset: OnSetPreviousVSTPreset(); return wParam;
+ case kcVSTGUIPrevPresetJump: OnVSTPresetBackwardJump(); return wParam;
+ case kcVSTGUINextPreset: OnSetNextVSTPreset(); return wParam;
+ case kcVSTGUINextPresetJump: OnVSTPresetForwardJump(); return wParam;
+ case kcVSTGUIRandParams: OnRandomizePreset() ; return wParam;
+ case kcVSTGUIToggleRecordParams: OnRecordAutomation(); return wParam;
+ case kcVSTGUIToggleSendKeysToPlug: OnPassKeypressesToPlug(); return wParam;
+ case kcVSTGUIBypassPlug: OnBypassPlug(); return wParam;
}
if (wParam>=kcVSTGUIStartNotes && wParam<=kcVSTGUIEndNotes)
{
@@ -590,21 +591,22 @@
void CAbstractVstEditor::UpdateOptionsMenu() {
//--------------------------------------------
- if (m_pOptionsMenu->m_hMenu) {
+ if (m_pOptionsMenu->m_hMenu)
m_pOptionsMenu->DestroyMenu();
- }
+ CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler();
+
m_pOptionsMenu->CreatePopupMenu();
//Bypass
m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->IsBypassed()?MF_CHECKED:0,
- ID_PLUG_BYPASS, "&Bypass");
+ ID_PLUG_BYPASS, "&Bypass\t" + ih->GetKeyTextFromCommand(kcVSTGUIBypassPlug));
//Record Params
m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->m_bRecordAutomation?MF_CHECKED:0,
- ID_PLUG_RECORDAUTOMATION, "Record &Params");
+ ID_PLUG_RECORDAUTOMATION, "Record &Params\t" + ih->GetKeyTextFromCommand(kcVSTGUIToggleRecordParams));
//Pass on keypresses
m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->m_bPassKeypressesToPlug?MF_CHECKED:0,
- ID_PLUG_PASSKEYS, "Pass &Keys to Plug");
+ ID_PLUG_PASSKEYS, "Pass &Keys to Plug\t" + ih->GetKeyTextFromCommand(kcVSTGUIToggleSendKeysToPlug));
m_pMenu->DeleteMenu(3, MF_BYPOSITION);
Modified: trunk/OpenMPT/mptrack/CommandSet.cpp
===================================================================
--- trunk/OpenMPT/mptrack/CommandSet.cpp 2010-03-14 18:43:27 UTC (rev 532)
+++ trunk/OpenMPT/mptrack/CommandSet.cpp 2010-03-15 20:27:57 UTC (rev 533)
@@ -2575,6 +2575,21 @@
commands[kcInstrumentEnvelopeZoomOut].isDummy = false;
commands[kcInstrumentEnvelopeZoomOut].Message = "Zoom Out";
+ commands[kcVSTGUIToggleRecordParams].UID = 1839;
+ commands[kcVSTGUIToggleRecordParams].isHidden = false;
+ commands[kcVSTGUIToggleRecordParams].isDummy = false;
+ commands[kcVSTGUIToggleRecordParams].Message = "Toggle parameter recording";
+
+ commands[kcVSTGUIToggleSendKeysToPlug].UID = 1840;
+ commands[kcVSTGUIToggleSendKeysToPlug].isHidden = false;
+ commands[kcVSTGUIToggleSendKeysToPlug].isDummy = false;
+ commands[kcVSTGUIToggleSendKeysToPlug].Message = "Pass key presses to plugin";
+
+ commands[kcVSTGUIBypassPlug].UID = 1841;
+ commands[kcVSTGUIBypassPlug].isHidden = false;
+ commands[kcVSTGUIBypassPlug].isDummy = false;
+ commands[kcVSTGUIBypassPlug].Message = "Bypass plugin";
+
#ifdef _DEBUG
for (int i=0; i<kcNumCommands; i++) {
if (commands[i].UID != 0) { // ignore unset UIDs
Modified: trunk/OpenMPT/mptrack/CommandSet.h
===================================================================
--- trunk/OpenMPT/mptrack/CommandSet.h 2010-03-14 18:43:27 UTC (rev 532)
+++ trunk/OpenMPT/mptrack/CommandSet.h 2010-03-15 20:27:57 UTC (rev 533)
@@ -983,7 +983,10 @@
kcVSTGUIPrevPresetJump,
kcVSTGUINextPresetJump,
kcVSTGUIRandParams,
- kcEndVSTGUICommands=kcVSTGUIRandParams,
+ kcVSTGUIToggleRecordParams,
+ kcVSTGUIToggleSendKeysToPlug,
+ kcVSTGUIBypassPlug,
+ kcEndVSTGUICommands=kcVSTGUIBypassPlug,
kcStartOrderlistCommands,
// Orderlist edit
Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb
===================================================================
--- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2010-03-14 18:43:27 UTC (rev 532)
+++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2010-03-15 20:27:57 UTC (rev 533)
@@ -306,7 +306,10 @@
13:1764:0:39:1 //Next plugin preset: NACH-RECHTS (KeyDown)
13:1782:0:38:1 //Plugin preset backward jump: NACH-OBEN (KeyDown)
13:1783:0:40:1 //Plugin preset forward jump: NACH-UNTEN (KeyDown)
-13:1765:2:82:1 //Randomize plugin parameters: Ctrl+R (KeyDown)
+13:1765:2:80:1 //Randomize plugin parameters: Ctrl+P (KeyDown)
+13:1839:2:82:1 //Toggle parameter recording: Ctrl+R (KeyDown)
+13:1840:2:75:1 //Pass key presses to plugin: Ctrl+K (KeyDown)
+13:1841:2:66:1 //Bypass plugin: Ctrl+B (KeyDown)
//----( General Context [top] (14) )------------
Modified: trunk/OpenMPT/soundlib/Load_mt2.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mt2.cpp 2010-03-14 18:43:27 UTC (rev 532)
+++ trunk/OpenMPT/soundlib/Load_mt2.cpp 2010-03-15 20:27:57 UTC (rev 533)
@@ -202,6 +202,8 @@
m_nDefaultSpeed = pfh->bTicksPerLine;
m_nDefaultTempo = 125;
m_dwSongFlags = SONG_ITCOMPATMODE;
+ m_nRowsPerBeat = pfh->bLinesPerBeat;
+ m_nRowsPerMeasure = m_nRowsPerBeat * 4;
if ((pfh->wSamplesPerTick > 100) && (pfh->wSamplesPerTick < 5000))
{
m_nDefaultTempo = 110250 / pfh->wSamplesPerTick;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-14 18:43:37
|
Revision: 532
http://modplug.svn.sourceforge.net/modplug/?rev=532&view=rev
Author: saga-games
Date: 2010-03-14 18:43:27 +0000 (Sun, 14 Mar 2010)
Log Message:
-----------
[Fix] Comments tab: Correct C-5 frequency is now also shown if the module is an XM file.
[Fix] Slightly better MT2 (MadTracker) handling: Release node is not set anymore for each and every instrument envelope. MT2 files are now loaded as IT files by default (instead of XM) because of their extended instrument properties (NNAs, filters, etc) - I wonder what this breaks, but I don't bother because MT2 support was already 100% broken before this. :) Some MT example tunes sound a bit better now at least.
[Imp] Pattern Editor: Since the behaviour of sliding commands with both nibbles set varies from tracker to tracker, "undefined" is always shown in the note properties in such cases.
[Imp] Module creation: When creating a new .MOD, it has 31 samples by default.
[Ref] IsPortable is now static.
[Ref] Some minor refactoring.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/Mptrack.h
trunk/OpenMPT/mptrack/View_ins.cpp
trunk/OpenMPT/mptrack/view_com.cpp
trunk/OpenMPT/soundlib/Load_mt2.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-14 14:26:37 UTC (rev 531)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-14 18:43:27 UTC (rev 532)
@@ -338,14 +338,15 @@
case MOD_TYPE_OKT:
case MOD_TYPE_AMS:
case MOD_TYPE_MT2:
- m_SndFile.ChangeModTypeTo(MOD_TYPE_XM);
+ m_SndFile.ChangeModTypeTo(MOD_TYPE_IT);
+ /*m_SndFile.ChangeModTypeTo(MOD_TYPE_XM);
if ((m_SndFile.m_nDefaultTempo == 125) && (m_SndFile.m_nDefaultSpeed == 6) && (!m_SndFile.m_nInstruments))
{
m_SndFile.m_nType = MOD_TYPE_MOD;
for (UINT i=0; i<m_SndFile.Patterns.Size(); i++)
if ((m_SndFile.Patterns[i]) && (m_SndFile.PatternSize[i] != 64))
m_SndFile.m_nType = MOD_TYPE_XM;
- }
+ }*/
break;
case MOD_TYPE_FAR:
case MOD_TYPE_PTM:
@@ -654,7 +655,7 @@
m_SndFile.m_nSamplePreAmp = m_SndFile.m_nVSTiVolume = 128;
}
- for (CHANNELINDEX nChn=0; nChn < MAX_BASECHANNELS; nChn++)
+ for (CHANNELINDEX nChn = 0; nChn < MAX_BASECHANNELS; nChn++)
{
m_SndFile.ChnSettings[nChn].dwFlags = 0;
m_SndFile.ChnSettings[nChn].nVolume = 64;
@@ -667,7 +668,7 @@
if (!m_SndFile.m_nSamples)
{
strcpy(m_SndFile.m_szNames[1], "untitled");
- m_SndFile.m_nSamples = 1;
+ m_SndFile.m_nSamples = (GetModType() == MOD_TYPE_MOD) ? 31 : 1;
ctrlSmp::ResetSamples(m_SndFile, ctrlSmp::SmpResetInit);
@@ -2523,6 +2524,10 @@
{
wsprintf(s, "fine %s%d", sMinusChar.c_str(), param & 0x0F);
} else
+ if ((param & 0x0F) != param && (param & 0xF0) != param) // both nibbles are set.
+ {
+ strcpy(s, "undefined");
+ } else
if (param & 0x0F)
{
wsprintf(s, "%s%d", sMinusChar.c_str(), param & 0x0F);
@@ -2946,6 +2951,7 @@
}
int CModDoc::GetMacroType(CString value)
+//--------------------------------------
{
if (value.Compare("")==0) return sfx_unused;
if (value.Compare("F0F000z")==0) return sfx_cutoff;
@@ -2960,6 +2966,7 @@
}
int CModDoc::MacroToPlugParam(CString macro)
+//------------------------------------------
{
int code=0;
char* param = (char *) (LPCTSTR) macro;
@@ -2975,7 +2982,9 @@
return (code+128);
}
}
-int CModDoc::MacroToMidiCC(CString macro) {
+int CModDoc::MacroToMidiCC(CString macro)
+//---------------------------------------
+{
int code=0;
char* param = (char *) (LPCTSTR) macro;
param +=2;
@@ -2987,8 +2996,9 @@
return code;
}
-int CModDoc::FindMacroForParam(long param) {
-//------------------------------------------
+int CModDoc::FindMacroForParam(long param)
+//----------------------------------------
+{
for (int macro=0; macro<16; macro++) { //what's the named_const for num macros?? :D
CString macroString = &(GetSoundFile()->m_MidiCfg.szMidiSFXExt[macro*32]);
if (GetMacroType(macroString) == sfx_plug && MacroToPlugParam(macroString) == param) {
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-14 14:26:37 UTC (rev 531)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-14 18:43:27 UTC (rev 532)
@@ -253,6 +253,7 @@
TCHAR CTrackApp::m_szExePath[_MAX_PATH] = TEXT("");
+bool CTrackApp::m_bPortableMode = false;
/////////////////////////////////////////////////////////////////////////////
// MPTRACK Command Line options
Modified: trunk/OpenMPT/mptrack/Mptrack.h
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.h 2010-03-14 14:26:37 UTC (rev 531)
+++ trunk/OpenMPT/mptrack/Mptrack.h 2010-03-14 18:43:27 UTC (rev 532)
@@ -158,7 +158,7 @@
TCHAR m_szConfigFileName[_MAX_PATH];
TCHAR m_szPluginCacheFileName[_MAX_PATH];
TCHAR m_szStringsFileName[_MAX_PATH];
- bool m_bPortableMode;
+ static bool m_bPortableMode;
#ifdef UPDATECHECKENABLED
// Internet request context
@@ -202,7 +202,7 @@
BOOL IsWaveExEnabled() const { return m_bExWaveSupport; }
BOOL IsDebug() const { return m_bDebugMode; }
LPCSTR GetConfigFileName() const { return m_szConfigFileName; }
- bool IsPortableMode() const { return m_bPortableMode; }
+ static bool IsPortableMode() { return m_bPortableMode; }
LPCSTR GetPluginCacheFileName() const { return m_szPluginCacheFileName; }
LPCSTR GetConfigPath() const { return m_szConfigDirectory; }
void SetupPaths();
Modified: trunk/OpenMPT/mptrack/View_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_ins.cpp 2010-03-14 14:26:37 UTC (rev 531)
+++ trunk/OpenMPT/mptrack/View_ins.cpp 2010-03-14 18:43:27 UTC (rev 532)
@@ -223,28 +223,12 @@
UINT CViewInstrument::EnvGetTick(int nPoint) const
//------------------------------------------------
{
- CModDoc *pModDoc = GetDocument();
- if (pModDoc)
- {
- CSoundFile *pSndFile = pModDoc->GetSoundFile();
- MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument];
- if ((pIns) && (nPoint >= 0))
- {
- switch(m_nEnv)
- {
- case ENV_VOLUME:
- if (nPoint < (int)pIns->VolEnv.nNodes) return pIns->VolEnv.Ticks[nPoint];
- break;
- case ENV_PANNING:
- if (nPoint < (int)pIns->PanEnv.nNodes) return pIns->PanEnv.Ticks[nPoint];
- break;
- case ENV_PITCH:
- if (nPoint < (int)pIns->PitchEnv.nNodes) return pIns->PitchEnv.Ticks[nPoint];
- break;
- }
- }
- }
- return 0;
+ INSTRUMENTENVELOPE *envelope = GetEnvelopePtr();
+ if(envelope == nullptr) return 0;
+ if((nPoint >= 0) && (nPoint < (int)envelope->nNodes))
+ return envelope->Ticks[nPoint];
+ else
+ return 0;
}
@@ -253,8 +237,10 @@
{
INSTRUMENTENVELOPE *envelope = GetEnvelopePtr();
if(envelope == nullptr) return 0;
- if(nPoint >= 0 && nPoint < (int)envelope->nNodes) return envelope->Values[nPoint];
- return 0;
+ if(nPoint >= 0 && nPoint < (int)envelope->nNodes)
+ return envelope->Values[nPoint];
+ else
+ return 0;
}
Modified: trunk/OpenMPT/mptrack/view_com.cpp
===================================================================
--- trunk/OpenMPT/mptrack/view_com.cpp 2010-03-14 14:26:37 UTC (rev 531)
+++ trunk/OpenMPT/mptrack/view_com.cpp 2010-03-14 18:43:27 UTC (rev 532)
@@ -298,7 +298,7 @@
{
wsprintf(s, "%d Hz",
pSndFile->GetFreqFromPeriod(
- pSndFile->GetPeriodFromNote(NOTE_MIDDLEC, pSmp->nFineTune, pSmp->nC5Speed),
+ pSndFile->GetPeriodFromNote(NOTE_MIDDLEC + pSmp->RelativeTone, pSmp->nFineTune, pSmp->nC5Speed),
pSmp->nC5Speed));
}
break;
Modified: trunk/OpenMPT/soundlib/Load_mt2.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mt2.cpp 2010-03-14 14:26:37 UTC (rev 531)
+++ trunk/OpenMPT/soundlib/Load_mt2.cpp 2010-03-14 18:43:27 UTC (rev 532)
@@ -124,7 +124,7 @@
#pragma pack()
-static VOID ConvertMT2Command(CSoundFile *that, MODCOMMAND *m, MT2COMMAND *p)
+static void ConvertMT2Command(CSoundFile *that, MODCOMMAND *m, MT2COMMAND *p)
//---------------------------------------------------------------------------
{
// Note
@@ -172,6 +172,7 @@
m->command = p->fxparam2;
m->param = p->fxparam1;
that->ConvertModCommand(m);
+ that->MODExx2S3MSxx(m);
} else
{
// TODO: MT2 Effects
@@ -200,6 +201,7 @@
m_nRestartPos = pfh->wRestart;
m_nDefaultSpeed = pfh->bTicksPerLine;
m_nDefaultTempo = 125;
+ m_dwSongFlags = SONG_ITCOMPATMODE;
if ((pfh->wSamplesPerTick > 100) && (pfh->wSamplesPerTick < 5000))
{
m_nDefaultTempo = 110250 / pfh->wSamplesPerTick;
@@ -406,9 +408,9 @@
Instruments[iIns] = pIns;
if (pIns)
{
- memset(pIns, 0, sizeof(MODINSTRUMENT));
+ memcpy(Instruments[iIns], &m_defaultInstrument, sizeof(MODINSTRUMENT));
memcpy(pIns->name, pmi->szName, 32);
- SpaceToNullStringFixed(pIns->name, 32);
+ SpaceToNullStringFixed(pIns->name, 31);
pIns->nGlobalVol = 64;
pIns->nPan = 128;
for (BYTE i = 0; i < NOTE_MAX; i++)
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-14 14:26:37 UTC (rev 531)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-14 18:43:27 UTC (rev 532)
@@ -1414,7 +1414,7 @@
return MOD_TYPE_MOD;
if (m_nType & (MOD_TYPE_S3M|MOD_TYPE_STM|MOD_TYPE_ULT|MOD_TYPE_FAR|MOD_TYPE_PTM))
return MOD_TYPE_S3M;
- if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MED|MOD_TYPE_MTM|MOD_TYPE_MT2))
+ if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MED|MOD_TYPE_MTM/*|MOD_TYPE_MT2*/))
return MOD_TYPE_XM;
if(m_nType & MOD_TYPE_MPT)
return MOD_TYPE_MPT;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-14 14:26:47
|
Revision: 531
http://modplug.svn.sourceforge.net/modplug/?rev=531&view=rev
Author: saga-games
Date: 2010-03-14 14:26:37 +0000 (Sun, 14 Mar 2010)
Log Message:
-----------
[Fix] Pattern Editor: Entered (volume) effects are now properly checked (makes a difference f.e. in MOD format where it was previously possible to enter effects like Hxx)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/View_pat.cpp
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-13 22:34:51 UTC (rev 530)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-03-14 14:26:37 UTC (rev 531)
@@ -3724,7 +3724,6 @@
{
CSoundFile *pSndFile = pModDoc->GetSoundFile();
- if(pSndFile->m_nType & MOD_TYPE_MOD) return; // no volume column
PrepareUndo(m_dwBeginSel, m_dwEndSel);
@@ -3772,8 +3771,11 @@
}
if (vol > max) vol %= 10;
- p->volcmd = volcmd;
- p->vol = vol;
+ if(pSndFile->GetModSpecifications().HasVolCommand(volcmd))
+ {
+ p->volcmd = volcmd;
+ p->vol = vol;
+ }
}
if (IsEditingEnabled_bmsg())
@@ -3808,7 +3810,7 @@
void CViewPattern::TempEnterFX(int c)
-//---------------------------------------------------------
+//-----------------------------------
{
CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
CModDoc *pModDoc = GetDocument();
@@ -3828,7 +3830,7 @@
{
ENTER_PCNOTE_VALUE(c, ValueEffectCol);
}
- else
+ else if(pSndFile->GetModSpecifications().HasCommand(c))
{
//LPCSTR lpcmd = (pSndFile->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) ? gszModCommands : gszS3mCommands;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-13 22:34:58
|
Revision: 530
http://modplug.svn.sourceforge.net/modplug/?rev=530&view=rev
Author: saga-games
Date: 2010-03-13 22:34:51 +0000 (Sat, 13 Mar 2010)
Log Message:
-----------
[Fix] IT compatibility: ignore slide commands with both nibbles set (f.e. D55, PA1, ...)
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Snd_fx.cpp
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-13 16:02:46 UTC (rev 529)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-03-13 22:34:51 UTC (rev 530)
@@ -2408,7 +2408,10 @@
void CSoundFile::VolumeSlide(MODCHANNEL *pChn, UINT param)
//--------------------------------------------------------
{
- if (param) pChn->nOldVolumeSlide = param; else param = pChn->nOldVolumeSlide;
+ if (param)
+ pChn->nOldVolumeSlide = param;
+ else
+ param = pChn->nOldVolumeSlide;
LONG newvolume = pChn->nVolume;
if (m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT|MOD_TYPE_STM|MOD_TYPE_AMF))
{
@@ -2443,9 +2446,18 @@
}
if ((!(m_dwSongFlags & SONG_FIRSTTICK)) || (m_dwSongFlags & SONG_FASTVOLSLIDES))
{
- if (param & 0x0F) newvolume -= (int)((param & 0x0F) * 4);
- else newvolume += (int)((param & 0xF0) >> 2);
- if (m_nType & MOD_TYPE_MOD) pChn->dwFlags |= CHN_FASTVOLRAMP;
+ // IT compatibility: Ignore slide commands with both nibbles set.
+ if (param & 0x0F)
+ {
+ if(!IsCompatibleMode(TRK_IMPULSETRACKER) || (param & 0xF0) == 0)
+ newvolume -= (int)((param & 0x0F) * 4);
+ }
+ else
+ {
+ if(!IsCompatibleMode(TRK_IMPULSETRACKER) || (param & 0x0F) == 0)
+ newvolume += (int)((param & 0xF0) >> 2);
+ }
+ if (m_nType == MOD_TYPE_MOD) pChn->dwFlags |= CHN_FASTVOLRAMP;
}
newvolume = CLAMP(newvolume, 0, 256);
@@ -2457,7 +2469,10 @@
//---------------------------------------------------------
{
LONG nPanSlide = 0;
- if (param) pChn->nOldPanSlide = param; else param = pChn->nOldPanSlide;
+ if (param)
+ pChn->nOldPanSlide = param;
+ else
+ param = pChn->nOldPanSlide;
if (m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT|MOD_TYPE_STM))
{
if (((param & 0x0F) == 0x0F) && (param & 0xF0))
@@ -2486,8 +2501,17 @@
{
if (!(m_dwSongFlags & SONG_FIRSTTICK))
{
- if (param & 0x0F) nPanSlide = -(int)((param & 0x0F) << 2);
- else nPanSlide = (int)((param & 0xF0) >> 2);
+ // IT compatibility: Ignore slide commands with both nibbles set.
+ if (param & 0x0F)
+ {
+ if(!IsCompatibleMode(TRK_IMPULSETRACKER) || (param & 0xF0) == 0)
+ nPanSlide = -(int)((param & 0x0F) << 2);
+ }
+ else
+ {
+ if(!IsCompatibleMode(TRK_IMPULSETRACKER) || (param & 0x0F) == 0)
+ nPanSlide = (int)((param & 0xF0) >> 2);
+ }
// XM compatibility: FT2's panning slide is not as deep
if(IsCompatibleMode(TRK_FASTTRACKER2))
nPanSlide >>= 2;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-13 16:02:53
|
Revision: 529
http://modplug.svn.sourceforge.net/modplug/?rev=529&view=rev
Author: saga-games
Date: 2010-03-13 16:02:46 +0000 (Sat, 13 Mar 2010)
Log Message:
-----------
[Ref] Removed unnecessary ancient code change comments, fixed some compiler warnings in sample editor
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_smp.cpp
trunk/OpenMPT/mptrack/Ctrl_smp.h
trunk/OpenMPT/mptrack/View_smp.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-03-13 14:17:33 UTC (rev 528)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-03-13 16:02:46 UTC (rev 529)
@@ -53,8 +53,6 @@
#define BASENOTE_MIN (1*12) // C-1
#define BASENOTE_MAX (9*12) // C-9
-#pragma warning(disable:4244)
-
BEGIN_MESSAGE_MAP(CCtrlSamples, CModControlDlg)
//{{AFX_MSG_MAP(CCtrlSamples)
ON_WM_VSCROLL()
@@ -321,12 +319,12 @@
}
-BOOL CCtrlSamples::SetCurrentSample(UINT nSmp, LONG lZoom, BOOL bUpdNum)
-//----------------------------------------------------------------------
+bool CCtrlSamples::SetCurrentSample(SAMPLEINDEX nSmp, LONG lZoom, bool bUpdNum)
+//-----------------------------------------------------------------------------
{
CModDoc *pModDoc = GetDocument();
CSoundFile *pSndFile;
- if (!pModDoc) return FALSE;
+ if (!pModDoc) return false;
pSndFile = pModDoc->GetSoundFile();
if (pSndFile->m_nSamples < 1) pSndFile->m_nSamples = 1;
if ((nSmp < 1) || (nSmp > pSndFile->m_nSamples)) return FALSE;
@@ -335,7 +333,6 @@
if (m_nSample != nSmp)
{
m_nSample = nSmp;
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
UpdateView((m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO, NULL);
}
if (bUpdNum)
@@ -349,7 +346,7 @@
m_ComboZoom.SetCurSel(lZoom);
PostViewMessage(VIEWMSG_SETCURRENTSAMPLE, (lZoom << 16) | m_nSample);
UnlockControls();
- return TRUE;
+ return true;
}
@@ -392,12 +389,11 @@
}
}
}
- SetCurrentSample((lParam > 0) ? lParam : m_nSample);
+ SetCurrentSample((lParam > 0) ? ((SAMPLEINDEX)lParam) : m_nSample);
- m_nFinetuneStep = CMainFrame::GetPrivateProfileLong("Sample Editor", "FinetuneStep", 25, theApp.GetConfigFileName());
+ m_nFinetuneStep = (uint16)GetPrivateProfileInt("Sample Editor", "FinetuneStep", 25, theApp.GetConfigFileName());
// Initial Update
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
if (!m_bInitialized) UpdateView((m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_MODTYPE, NULL);
CChildFrame *pFrame = (CChildFrame *)GetParentFrame();
if ((pFrame) && (m_hWndView)) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)pFrame->GetSampleViewState());
@@ -428,7 +424,7 @@
break;
case CTRLMSG_SMP_OPENFILE:
- if (lParam) return OpenSample((LPCSTR)lParam);
+ if (lParam) return OpenSample((LPCSTR)lParam) ? TRUE : FALSE;
break;
case CTRLMSG_SMP_SONGDROP:
@@ -437,7 +433,7 @@
LPDRAGONDROP pDropInfo = (LPDRAGONDROP)lParam;
CSoundFile *pSndFile = (CSoundFile *)(pDropInfo->lDropParam);
if (pDropInfo->pModDoc) pSndFile = pDropInfo->pModDoc->GetSoundFile();
- if (pSndFile) return OpenSample(pSndFile, pDropInfo->dwDropItem);
+ if (pSndFile) return OpenSample(pSndFile, (SAMPLEINDEX)pDropInfo->dwDropItem) ? TRUE : FALSE;
}
break;
@@ -446,7 +442,7 @@
break;
case CTRLMSG_SETCURRENTINSTRUMENT:
- SetCurrentSample(lParam, -1, TRUE);
+ SetCurrentSample((SAMPLEINDEX)lParam, -1, TRUE);
break;
//rewbs.customKeys
@@ -535,8 +531,6 @@
m_ToolBar2.UpdateStyle();
}
if (!(dwHintMask & (HINT_SAMPLEINFO|HINT_MODTYPE))) return;
- // 05/01/05 : ericus replaced ">> 24" by ">> 20" : 4000 samples -> 12bits [see Moddoc.h]
- //if (((dwHintMask >> 20) != (m_nSample&0x0fff)) && (!(dwHintMask & HINT_MODTYPE))) return;
if (((dwHintMask >> HINT_SHIFT_SMP) != m_nSample) && (!(dwHintMask & HINT_MODTYPE))) return;
LockControls();
if (!m_bInitialized) dwHintMask |= HINT_MODTYPE;
@@ -691,35 +685,32 @@
}
-BOOL CCtrlSamples::OpenSample(LPCSTR lpszFileName)
+bool CCtrlSamples::OpenSample(LPCSTR lpszFileName)
//------------------------------------------------
{
CMappedFile f;
CHAR szName[_MAX_FNAME], szExt[_MAX_EXT];
LPBYTE lpFile;
DWORD len;
- BOOL bOk;
+ bool bOk = false;
BeginWaitCursor();
if ((!lpszFileName) || (!f.Open(lpszFileName)))
{
EndWaitCursor();
- return FALSE;
+ return false;
}
len = f.GetLength();
if (len > CTrackApp::gMemStatus.dwTotalPhys) len = CTrackApp::gMemStatus.dwTotalPhys;
- bOk = FALSE;
lpFile = f.Lock(len);
if (!lpFile) goto OpenError;
BEGIN_CRITICAL();
m_pModDoc->GetSampleUndo()->PrepareUndo(m_nSample, sundo_replace);
+ bOk = m_pSndFile->ReadSampleFromFile(m_nSample, lpFile, len);
- if (m_pSndFile->ReadSampleFromFile(m_nSample, lpFile, len))
- {
- bOk = TRUE;
- }
END_CRITICAL();
+
if (!bOk)
{
CRawSampleDlg dlg(this);
@@ -772,7 +763,7 @@
}
if (m_pSndFile->ReadSample(pSmp, flags, p16, l16))
{
- bOk = TRUE;
+ bOk = true;
}
END_CRITICAL();
} else
@@ -816,18 +807,17 @@
pSmp->nPan = 128;
pSmp->uFlags |= CHN_PANNING;
}
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, NULL);
m_pModDoc->SetModified();
}
- return TRUE;
+ return true;
}
-BOOL CCtrlSamples::OpenSample(CSoundFile *pSndFile, UINT nSample)
-//---------------------------------------------------------------
+bool CCtrlSamples::OpenSample(CSoundFile *pSndFile, SAMPLEINDEX nSample)
+//----------------------------------------------------------------------
{
- if ((!pSndFile) || (!nSample) || (nSample > pSndFile->m_nSamples)) return FALSE;
+ if ((!pSndFile) || (!nSample) || (nSample > pSndFile->m_nSamples)) return false;
BeginWaitCursor();
BEGIN_CRITICAL();
@@ -841,11 +831,10 @@
pSmp->uFlags |= CHN_PANNING;
}
END_CRITICAL();
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, NULL);
m_pModDoc->SetModified();
EndWaitCursor();
- return TRUE;
+ return true;
}
@@ -857,7 +846,7 @@
{
if ((!IsLocked()) && (m_pSndFile))
{
- UINT n = GetDlgItemInt(IDC_EDIT_SAMPLE);
+ SAMPLEINDEX n = (SAMPLEINDEX)GetDlgItemInt(IDC_EDIT_SAMPLE);
if ((n > 0) && (n <= m_pSndFile->m_nSamples) && (n != m_nSample))
{
SetCurrentSample(n, -1, FALSE);
@@ -913,7 +902,6 @@
}
}
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (smp << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES);
if ((pSndFile->m_nInstruments) && (!m_pModDoc->FindSampleParent(smp)))
{
@@ -1102,7 +1090,7 @@
return;
//Default case: Normalize current sample
- UINT iMinSample = m_nSample, iMaxSample = m_nSample;
+ SAMPLEINDEX iMinSample = m_nSample, iMaxSample = m_nSample;
//If only one sample is selected, parts of it may be amplified
UINT iStart = 0, iEnd = 0;
@@ -1124,20 +1112,22 @@
BeginWaitCursor();
- BOOL bModified = FALSE;
+ bool bModified = false;
- for(UINT iSmp = iMinSample; iSmp <= iMaxSample; iSmp++)
+ for(SAMPLEINDEX iSmp = iMinSample; iSmp <= iMaxSample; iSmp++)
{
if (m_pSndFile->Samples[iSmp].pSample)
{
- BOOL bOk = FALSE;
+ bool bOk = false;
MODSAMPLE *pSmp = &m_pSndFile->Samples[iSmp];
- if(iMinSample != iMaxSample) {
+ if(iMinSample != iMaxSample)
+ {
//if more than one sample is selected, always amplify the whole sample.
iStart = 0;
iEnd = pSmp->nLength;
- } else {
+ } else
+ {
//one sample: correct the boundaries, if needed
if (iEnd > pSmp->nLength) iEnd = pSmp->nLength;
if (iStart > iEnd) iStart = iEnd;
@@ -1153,7 +1143,7 @@
if (pSmp->uFlags & CHN_16BIT)
{
- signed short *p = (signed short *)pSmp->pSample;
+ int16 *p = (int16 *)pSmp->pSample;
int max = 1;
for (UINT i = iStart; i < iEnd; i++)
{
@@ -1165,14 +1155,14 @@
max++;
for (UINT j = iStart; j < iEnd; j++)
{
- int l = p[j];
- p[j] = (l << 15) / max;
+ int l = (((int)p[j]) << 15) / max;
+ p[j] = (int16)l;
}
- bModified = bOk = TRUE;
+ bModified = bOk = true;
}
} else
{
- signed char *p = (signed char *)pSmp->pSample;
+ int8 *p = (int8 *)pSmp->pSample;
int max = 1;
for (UINT i = iStart; i < iEnd; i++)
{
@@ -1184,10 +1174,10 @@
max++;
for (UINT j = iStart; j < iEnd; j++)
{
- int l = p[j];
- p[j] = (l << 7) / max;
+ int l = (((int)p[j]) << 7) / max;
+ p[j] = (int8)l;
}
- bModified = bOk = TRUE;
+ bModified = bOk = true;
}
}
@@ -1253,7 +1243,6 @@
}
}
m_pModDoc->AdjustEndOfSample(m_nSample);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL);
m_pModDoc->SetModified();
EndWaitCursor();
@@ -1267,7 +1256,7 @@
if(!m_pModDoc || !m_pSndFile)
return;
- UINT iMinSample = m_nSample, iMaxSample = m_nSample;
+ SAMPLEINDEX iMinSample = m_nSample, iMaxSample = m_nSample;
//Shift -> Process all samples
if(CMainFrame::GetInputHandler()->ShiftPressed())
@@ -1284,11 +1273,11 @@
UINT iModified = 0;
float fReportOffset = 0;
- for(UINT iSmp = iMinSample; iSmp <= iMaxSample; iSmp++)
+ for(SAMPLEINDEX iSmp = iMinSample; iSmp <= iMaxSample; iSmp++)
{
UINT iStart, iEnd;
- if( m_pSndFile->Samples[iSmp].pSample == nullptr )
+ if(m_pSndFile->Samples[iSmp].pSample == nullptr)
continue;
if (iMinSample != iMaxSample)
@@ -1508,7 +1497,6 @@
viewstate.dwEndSel = dwEnd + (dwEnd-dwStart);
SendViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&viewstate);
}
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL);
m_pModDoc->SetModified();
}
@@ -1643,7 +1631,6 @@
viewstate.dwEndSel = dwStart + dwRemove;
SendViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&viewstate);
}
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL);
m_pModDoc->SetModified();
}
@@ -1712,9 +1699,9 @@
//Calculate/verify samplerate at C5.
long lSampleRate = pSmp->nC5Speed;
if(m_pSndFile->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM))
- lSampleRate = (double)CSoundFile::TransposeToFrequency(pSmp->RelativeTone, pSmp->nFineTune);
+ lSampleRate = CSoundFile::TransposeToFrequency(pSmp->RelativeTone, pSmp->nFineTune);
if(lSampleRate <= 0)
- lSampleRate = 8363.0;
+ lSampleRate = 8363;
//Open dialog
CPSRatioCalc dlg(pSmp->nLength, lSampleRate,
@@ -1742,15 +1729,15 @@
// Time stretching
if(IsDlgButtonChecked(IDC_CHECK3)){
UpdateData(TRUE); //Ensure m_dTimeStretchRatio is up-to-date with textbox content
- errorcode = TimeStretch(m_dTimeStretchRatio/100.0);
+ errorcode = TimeStretch((float)(m_dTimeStretchRatio / 100.0));
//Update loop points only if no error occured.
if(errorcode == 0)
{
- pSmp->nLoopStart = min(pSmp->nLoopStart * (m_dTimeStretchRatio / 100.0), pSmp->nLength);
- pSmp->nLoopEnd = min(pSmp->nLoopEnd * (m_dTimeStretchRatio/100.0), pSmp->nLength);
- pSmp->nSustainStart = min(pSmp->nSustainStart * (m_dTimeStretchRatio/100.0), pSmp->nLength);
- pSmp->nSustainEnd = min(pSmp->nSustainEnd * (m_dTimeStretchRatio/100.0), pSmp->nLength);
+ pSmp->nLoopStart = (UINT)min(pSmp->nLoopStart * (m_dTimeStretchRatio / 100.0), pSmp->nLength);
+ pSmp->nLoopEnd = (UINT)min(pSmp->nLoopEnd * (m_dTimeStretchRatio/100.0), pSmp->nLength);
+ pSmp->nSustainStart = (UINT)min(pSmp->nSustainStart * (m_dTimeStretchRatio/100.0), pSmp->nLength);
+ pSmp->nSustainEnd = (UINT)min(pSmp->nSustainEnd * (m_dTimeStretchRatio/100.0), pSmp->nLength);
}
}
@@ -1758,8 +1745,8 @@
else{
// Get selected pitch modifier [-12,+12]
CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO4);
- short pm = combo->GetCurSel() - 12;
- if(pm == 0) goto error;
+ float pm = float(combo->GetCurSel()) - 12.0f;
+ if(pm == 0.0f) goto error;
// Compute pitch ratio in range [0.5f ; 2.0f] (1.0f means output == input)
// * pitch up -> 1.0f + n / 12.0f -> (12.0f + n) / 12.0f , considering n : pitch modifier > 0
@@ -1799,8 +1786,8 @@
}
-int CCtrlSamples::TimeStretch(double ratio)
-//-----------------------------------------
+int CCtrlSamples::TimeStretch(float ratio)
+//----------------------------------------
{
static HANDLE handleSt = NULL; // Handle to SoundTouch object.
if((!m_pSndFile) || (!m_pSndFile->Samples[m_nSample].pSample)) return -1;
@@ -1819,7 +1806,7 @@
if(ratio <= 0.0 || ratio == 1.0) return -1;
// Convert to pitch factor
- float pitch = Round((float)ratio, 4);
+ float pitch = Round(ratio, 4);
if(pitch < 0.5f) return 2 + (1<<8);
if(pitch > 2.0f) return 2 + (2<<8);
@@ -2013,7 +2000,7 @@
// Get selected oversampling - quality - (also refered as FFT overlapping) factor
CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO5);
- short ovs = combo->GetCurSel() + 4;
+ long ovs = combo->GetCurSel() + 4;
// Get selected FFT size (power of 2 ; should not exceed MAX_BUFFER_LENGTH - see smbPitchShift.h)
combo = (CComboBox *)GetDlgItem(IDC_COMBO6);
@@ -2054,7 +2041,7 @@
long lSampleRate = pSmp->GetSampleRate(m_pSndFile->GetType());
// Deduce max sample value (float conversion step)
- float maxSampleValue = ( 1 << (smpsize * 8 - 1) ) - 1;
+ float maxSampleValue = float(( 1 << (smpsize * 8 - 1) ) - 1);
// Allocate working buffers
float * buffer = new float[MAX_BUFFER_LENGTH + fft];
@@ -2287,7 +2274,6 @@
}
}
m_pModDoc->AdjustEndOfSample(m_nSample);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL);
m_pModDoc->SetModified();
}
@@ -2336,7 +2322,6 @@
if (strncmp(s, m_pSndFile->m_szNames[m_nSample], 32))
{
memcpy(m_pSndFile->m_szNames[m_nSample], s, 32);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | (HINT_SMPNAMES|HINT_SAMPLEINFO), this);
m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
m_pModDoc->SetModified();
@@ -2357,7 +2342,6 @@
if (strncmp(s, m_pSndFile->Samples[m_nSample].filename, 22))
{
memcpy(m_pSndFile->Samples[m_nSample].filename, s, 22);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO, this);
if (m_pSndFile->m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) m_pModDoc->SetModified();
}
@@ -2374,7 +2358,7 @@
nVol <<= 2;
if (nVol != m_pSndFile->Samples[m_nSample].nVolume)
{
- m_pSndFile->Samples[m_nSample].nVolume = nVol;
+ m_pSndFile->Samples[m_nSample].nVolume = (WORD)nVol;
m_pModDoc->SetModified();
}
}
@@ -2389,7 +2373,7 @@
if (nVol > 64) nVol = 64;
if (nVol != m_pSndFile->Samples[m_nSample].nGlobalVol)
{
- m_pSndFile->Samples[m_nSample].nGlobalVol = nVol;
+ m_pSndFile->Samples[m_nSample].nGlobalVol = (WORD)nVol;
m_pModDoc->SetModified();
}
}
@@ -2438,7 +2422,7 @@
//end rewbs.fix36944
if (nPan != m_pSndFile->Samples[m_nSample].nPan)
{
- m_pSndFile->Samples[m_nSample].nPan = nPan;
+ m_pSndFile->Samples[m_nSample].nPan = (WORD)nPan;
if (m_pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) m_pModDoc->SetModified();
}
}
@@ -2451,7 +2435,7 @@
int n = GetDlgItemInt(IDC_EDIT5);
if (m_pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_S3M|MOD_TYPE_MPT))
{
- if ((n > 0) && (n <= (m_pSndFile->m_nType & MOD_TYPE_S3M) ? 65535 : 9999999) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed))
+ if ((n > 0) && (n <= (m_pSndFile->GetType() == MOD_TYPE_S3M ? 65535 : 9999999)) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed))
{
m_pSndFile->Samples[m_nSample].nC5Speed = n;
int transp = CSoundFile::FrequencyToTranspose(n) >> 7;
@@ -2469,8 +2453,9 @@
}
} else
{
- if ((n >= -128) && (n <= 127)) {
- m_pSndFile->Samples[m_nSample].nFineTune = n;
+ if ((n >= -128) && (n <= 127))
+ {
+ m_pSndFile->Samples[m_nSample].nFineTune = (signed char)n;
m_pModDoc->SetModified();
}
@@ -2482,12 +2467,12 @@
//-------------------------------------
{
if (IsLocked()) return;
- int n = 60 - (m_CbnBaseNote.GetCurSel() + BASENOTE_MIN);
+ int n = (NOTE_MIDDLEC - 1) - (m_CbnBaseNote.GetCurSel() + BASENOTE_MIN);
if (m_pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_S3M|MOD_TYPE_MPT))
{
LONG ft = CSoundFile::FrequencyToTranspose(m_pSndFile->Samples[m_nSample].nC5Speed) & 0x7f;
n = CSoundFile::TransposeToFrequency(n, ft);
- if ((n > 0) && (n <= (m_pSndFile->m_nType & MOD_TYPE_S3M) ? 65535 : 9999999) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed))
+ if ((n > 0) && (n <= (m_pSndFile->GetType() == MOD_TYPE_S3M ? 65535 : 9999999)) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed))
{
CHAR s[32];
m_pSndFile->Samples[m_nSample].nC5Speed = n;
@@ -2499,8 +2484,9 @@
}
} else
{
- if ((n >= -128) && (n < 128)) {
- m_pSndFile->Samples[m_nSample].RelativeTone = n;
+ if ((n >= -128) && (n < 128))
+ {
+ m_pSndFile->Samples[m_nSample].RelativeTone = (signed char)n;
m_pModDoc->SetModified();
}
}
@@ -2525,7 +2511,7 @@
m_SpinVibDepth.GetRange(lmin, lmax);
int n = GetDlgItemInt(IDC_EDIT15);
if ((n >= lmin) && (n <= lmax)) {
- m_pSndFile->Samples[m_nSample].nVibDepth = n;
+ m_pSndFile->Samples[m_nSample].nVibDepth = (BYTE)n;
m_pModDoc->SetModified();
}
}
@@ -2539,7 +2525,7 @@
m_SpinVibSweep.GetRange(lmin, lmax);
int n = GetDlgItemInt(IDC_EDIT14);
if ((n >= lmin) && (n <= lmax)) {
- m_pSndFile->Samples[m_nSample].nVibSweep = n;
+ m_pSndFile->Samples[m_nSample].nVibSweep = (BYTE)n;
m_pModDoc->SetModified();
}
}
@@ -2553,7 +2539,7 @@
m_SpinVibRate.GetRange(lmin, lmax);
int n = GetDlgItemInt(IDC_EDIT16);
if ((n >= lmin) && (n <= lmax)) {
- m_pSndFile->Samples[m_nSample].nVibRate = n;
+ m_pSndFile->Samples[m_nSample].nVibRate = (BYTE)n;
m_pModDoc->SetModified();
}
}
@@ -2605,7 +2591,6 @@
(resets sound without any reason otherwise) - bug report 1874 */
m_pModDoc->AdjustEndOfSample(m_nSample);
}
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this);
m_pModDoc->SetModified();
}
@@ -2627,7 +2612,6 @@
(resets sound without any reason otherwise) - bug report 1874 */
m_pModDoc->AdjustEndOfSample(m_nSample);
}
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this);
m_pModDoc->SetModified();
}
@@ -2674,7 +2658,6 @@
&& ((n < (LONG)pSmp->nSustainEnd) || (!(pSmp->uFlags & CHN_SUSTAINLOOP))))
{
pSmp->nSustainStart = n;
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this);
m_pModDoc->SetModified();
}
@@ -2691,7 +2674,6 @@
&& ((n > (LONG)pSmp->nSustainStart) || (!(pSmp->uFlags & CHN_SUSTAINLOOP))))
{
pSmp->nSustainEnd = n;
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this);
m_pModDoc->SetModified();
}
@@ -2702,42 +2684,45 @@
#define BIDILOOP_ACCURACY 2 // 5%
-BOOL MPT_LoopCheck(int sstart0, int sstart1, int send0, int send1)
+bool MPT_LoopCheck(int sstart0, int sstart1, int send0, int send1)
+//----------------------------------------------------------------
{
int dse0 = send0 - sstart0;
- if ((dse0 < -SMPLOOP_ACCURACY) || (dse0 > SMPLOOP_ACCURACY)) return FALSE;
+ if ((dse0 < -SMPLOOP_ACCURACY) || (dse0 > SMPLOOP_ACCURACY)) return false;
int dse1 = send1 - sstart1;
- if ((dse1 < -SMPLOOP_ACCURACY) || (dse1 > SMPLOOP_ACCURACY)) return FALSE;
+ if ((dse1 < -SMPLOOP_ACCURACY) || (dse1 > SMPLOOP_ACCURACY)) return false;
int dstart = sstart1 - sstart0;
int dend = send1 - send0;
if (!dstart) dstart = dend >> 7;
if (!dend) dend = dstart >> 7;
- if ((dstart ^ dend) < 0) return FALSE;
+ if ((dstart ^ dend) < 0) return false;
int delta = dend - dstart;
- return ((delta > -SMPLOOP_ACCURACY) && (delta < SMPLOOP_ACCURACY)) ? TRUE : FALSE;
+ return ((delta > -SMPLOOP_ACCURACY) && (delta < SMPLOOP_ACCURACY)) ? true : false;
}
-BOOL MPT_BidiEndCheck(int spos0, int spos1, int spos2)
+bool MPT_BidiEndCheck(int spos0, int spos1, int spos2)
+//----------------------------------------------------
{
int delta0 = spos1 - spos0;
int delta1 = spos2 - spos1;
int delta2 = spos2 - spos0;
if (!delta0) delta0 = delta1 >> 7;
if (!delta1) delta1 = delta0 >> 7;
- if ((delta1 ^ delta0) < 0) return FALSE;
+ if ((delta1 ^ delta0) < 0) return false;
return ((delta0 >= -1) && (delta0 <= 0) && (delta1 >= -1) && (delta1 <= 0) && (delta2 >= -1) && (delta2 <= 0));
}
-BOOL MPT_BidiStartCheck(int spos0, int spos1, int spos2)
+bool MPT_BidiStartCheck(int spos0, int spos1, int spos2)
+//------------------------------------------------------
{
int delta1 = spos1 - spos0;
int delta0 = spos2 - spos1;
int delta2 = spos2 - spos0;
if (!delta0) delta0 = delta1 >> 7;
if (!delta1) delta1 = delta0 >> 7;
- if ((delta1 ^ delta0) < 0) return FALSE;
+ if ((delta1 ^ delta0) < 0) return false;
return ((delta0 >= -1) && (delta0 <= 0) && (delta1 > -1) && (delta1 <= 0) && (delta2 >= -1) && (delta2 <= 0));
}
@@ -2752,7 +2737,7 @@
MODSAMPLE *pSmp = &m_pSndFile->Samples[nsample];
LPSTR pSample = pSmp->pSample;
short int pos;
- BOOL bRedraw = FALSE;
+ bool bRedraw = false;
LockControls();
if ((!pSmp->nLength) || (!pSample)) goto NoSample;
@@ -2765,7 +2750,7 @@
// Loop Start
if ((pos = (short int)m_SpinLoopStart.GetPos()) != 0)
{
- BOOL bOk = FALSE;
+ bool bOk = false;
LPSTR p = pSample+pSmp->nLoopStart*pinc;
int find0 = (int)pSample[pSmp->nLoopEnd*pinc-pinc];
int find1 = (int)pSample[pSmp->nLoopEnd*pinc];
@@ -2802,7 +2787,7 @@
wsprintf(s, "%u", pSmp->nLoopStart);
m_EditLoopStart.SetWindowText(s);
m_pModDoc->AdjustEndOfSample(m_nSample);
- bRedraw = TRUE;
+ bRedraw = true;
}
m_SpinLoopStart.SetPos(0);
}
@@ -2810,7 +2795,7 @@
pos = (short int)m_SpinLoopEnd.GetPos();
if ((pos) && (pSmp->nLoopEnd))
{
- BOOL bOk = FALSE;
+ bool bOk = false;
LPSTR p = pSample+pSmp->nLoopEnd*pinc;
int find0 = (int)pSample[pSmp->nLoopStart*pinc];
int find1 = (int)pSample[pSmp->nLoopStart*pinc+pinc];
@@ -2846,7 +2831,7 @@
wsprintf(s, "%u", pSmp->nLoopEnd);
m_EditLoopEnd.SetWindowText(s);
m_pModDoc->AdjustEndOfSample(m_nSample);
- bRedraw = TRUE;
+ bRedraw = true;
}
m_SpinLoopEnd.SetPos(0);
}
@@ -2854,7 +2839,7 @@
pos = (short int)m_SpinSustainStart.GetPos();
if ((pos) && (pSmp->nSustainEnd))
{
- BOOL bOk = FALSE;
+ bool bOk = false;
LPSTR p = pSample+pSmp->nSustainStart*pinc;
int find0 = (int)pSample[pSmp->nSustainEnd*pinc-pinc];
int find1 = (int)pSample[pSmp->nSustainEnd*pinc];
@@ -2890,7 +2875,7 @@
{
wsprintf(s, "%u", pSmp->nSustainStart);
m_EditSustainStart.SetWindowText(s);
- bRedraw = TRUE;
+ bRedraw = true;
}
m_SpinSustainStart.SetPos(0);
}
@@ -2898,7 +2883,7 @@
pos = (short int)m_SpinSustainEnd.GetPos();
if (pos)
{
- BOOL bOk = FALSE;
+ bool bOk = false;
LPSTR p = pSample+pSmp->nSustainEnd*pinc;
int find0 = (int)pSample[pSmp->nSustainStart*pinc];
int find1 = (int)pSample[pSmp->nSustainStart*pinc+pinc];
@@ -2933,7 +2918,7 @@
{
wsprintf(s, "%u", pSmp->nSustainEnd);
m_EditSustainEnd.SetWindowText(s);
- bRedraw = TRUE;
+ bRedraw = true;
}
m_SpinSustainEnd.SetPos(0);
}
@@ -2958,18 +2943,16 @@
m_EditFineTune.SetWindowText(s);
} else
{
- LONG d = pSmp->nFineTune + pos;
- if (d < -128) d = -128;
- if (d > 127) d = 127;
- pSmp->nFineTune = d;
+ LONG d = CLAMP(pSmp->nFineTune + pos, -128, 127);
+ pSmp->nFineTune = (signed char)d;
wsprintf(s, "%d", d);
m_EditFineTune.SetWindowText(s);
}
m_SpinFineTune.SetPos(0);
}
if ((nCode == SB_ENDSCROLL) || (nCode == SB_THUMBPOSITION)) SwitchToView();
- if (bRedraw) {
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
+ if (bRedraw)
+ {
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this);
m_pModDoc->SetModified();
}
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.h 2010-03-13 14:17:33 UTC (rev 528)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2010-03-13 16:02:46 UTC (rev 529)
@@ -37,7 +37,7 @@
CComboBox m_ComboPitch, m_ComboQuality, m_ComboFFT;
int PitchShift(float pitch);
- int TimeStretch(double ratio);
+ int TimeStretch(float ratio);
void UpdateTimeStretchParameterString();
void ReadTimeStretchParameters();
@@ -50,9 +50,9 @@
CCtrlSamples();
~CCtrlSamples();
- BOOL SetCurrentSample(UINT n, LONG lZoom=-1, BOOL bUpdNum=TRUE);
- BOOL OpenSample(LPCSTR lpszFileName);
- BOOL OpenSample(CSoundFile *pSndFile, UINT nSample);
+ bool SetCurrentSample(SAMPLEINDEX nSmp, LONG lZoom = -1, bool bUpdNum = true);
+ bool OpenSample(LPCSTR lpszFileName);
+ bool OpenSample(CSoundFile *pSndFile, SAMPLEINDEX nSample);
LONG* GetSplitPosRef() {return &CMainFrame::glSampleWindowHeight;} //rewbs.varWindowSize
public:
Modified: trunk/OpenMPT/mptrack/View_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_smp.cpp 2010-03-13 14:17:33 UTC (rev 528)
+++ trunk/OpenMPT/mptrack/View_smp.cpp 2010-03-13 16:02:46 UTC (rev 529)
@@ -397,11 +397,8 @@
void CViewSample::UpdateView(DWORD dwHintMask, CObject *)
//-------------------------------------------------------
{
- // 05/01/05 : ericus replaced ">> 24" by ">> 20" : 4000 samples -> 12bits [see Moddoc.h]
- //rewbs: replaced 0xff by 0x0fff for 4000 samples.
if ((dwHintMask & (HINT_MPTOPTIONS|HINT_MODTYPE))
|| ((dwHintMask & HINT_SAMPLEDATA) && (m_nSample == (dwHintMask >> HINT_SHIFT_SMP))) )
- //|| ((dwHintMask & HINT_SAMPLEDATA) && ((m_nSample&0x0fff) == (dwHintMask >> 20))) )
{
UpdateScrollSize();
UpdateNcButtonState();
@@ -1613,7 +1610,6 @@
pSmp->uFlags |= CHN_LOOP;
pModDoc->SetModified();
pModDoc->AdjustEndOfSample(m_nSample);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL);
}
}
@@ -1638,7 +1634,6 @@
pSmp->uFlags |= CHN_SUSTAINLOOP;
pModDoc->SetModified();
pModDoc->AdjustEndOfSample(m_nSample);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL);
}
}
@@ -1745,7 +1740,6 @@
SetCurSel(0, 0);
pModDoc->AdjustEndOfSample(m_nSample);
pModDoc->SetModified();
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | dwUpdateFlags, NULL);
}
@@ -1914,7 +1908,6 @@
SetCurSel(0, 0);
pModDoc->AdjustEndOfSample(m_nSample);
pModDoc->SetModified();
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL);
}
CloseClipboard();
@@ -1961,7 +1954,6 @@
END_CRITICAL();
pModDoc->SetModified();
pModDoc->AdjustEndOfSample(m_nSample);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL);
}
}
@@ -2005,7 +1997,7 @@
END_CRITICAL();
pModDoc->SetModified();
pModDoc->AdjustEndOfSample(m_nSample);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
+
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL);
}
}
@@ -2070,7 +2062,6 @@
pModDoc->SetModified();
pModDoc->AdjustEndOfSample(m_nSample);
SetCurSel(0, 0);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL);
}
EndWaitCursor();
@@ -2274,7 +2265,6 @@
if (bUpdate)
{
pModDoc->AdjustEndOfSample(m_nSample);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, NULL);
pModDoc->SetModified();
}
@@ -2340,7 +2330,6 @@
(resets sound without any reason otherwise) - bug report 1874 */
pModDoc->AdjustEndOfSample(m_nSample);
}
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL);
}
}
@@ -2366,7 +2355,6 @@
(resets sound without any reason otherwise) - bug report 1874 */
pModDoc->AdjustEndOfSample(m_nSample);
}
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL);
}
}
@@ -2387,7 +2375,6 @@
pSmp->nSustainStart = m_dwMenuParam;
pModDoc->SetModified();
pModDoc->AdjustEndOfSample(m_nSample);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL);
}
}
@@ -2408,7 +2395,6 @@
pSmp->nSustainEnd = m_dwMenuParam;
pModDoc->SetModified();
pModDoc->AdjustEndOfSample(m_nSample);
- // 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL);
}
}
@@ -2496,7 +2482,7 @@
}
LRESULT CViewSample::OnMidiMsg(WPARAM dwMidiDataParam, LPARAM)
-//-------------------------------------------------------
+//------------------------------------------------------------
{
const DWORD dwMidiData = dwMidiDataParam;
static BYTE midivolume = 127;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-13 14:17:41
|
Revision: 528
http://modplug.svn.sourceforge.net/modplug/?rev=528&view=rev
Author: saga-games
Date: 2010-03-13 14:17:33 +0000 (Sat, 13 Mar 2010)
Log Message:
-----------
[Imp] Sample Editor: Remember previous settings in RAW import dialog
[New] Sample Editor: Option to not ask for RAW import settings again (settings are remembered independently for all modules)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_smp.cpp
trunk/OpenMPT/mptrack/Ctrl_smp.h
trunk/OpenMPT/mptrack/Mpdlgs.cpp
trunk/OpenMPT/mptrack/Mpdlgs.h
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-03-13 00:22:53 UTC (rev 527)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-03-13 14:17:33 UTC (rev 528)
@@ -159,6 +159,7 @@
{
m_nSample = 1;
m_nLockCount = 1;
+ m_nPreviousRawFormat = 0;
}
@@ -722,9 +723,17 @@
if (!bOk)
{
CRawSampleDlg dlg(this);
+ if(m_nPreviousRawFormat != 0)
+ {
+ dlg.m_nFormat = m_nPreviousRawFormat;
+ dlg.m_bRememberFormat = true;
+ }
EndWaitCursor();
- if (dlg.DoModal() == IDOK)
+ if ((m_nPreviousRawFormat != 0) || (dlg.DoModal() == IDOK))
{
+
+ m_nPreviousRawFormat = ((dlg.m_bRememberFormat)) ? dlg.m_nFormat : 0;
+
BeginWaitCursor();
UINT flags = 0;
MODSAMPLE *pSmp = &m_pSndFile->Samples[m_nSample];
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.h 2010-03-13 00:22:53 UTC (rev 527)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2010-03-13 14:17:33 UTC (rev 528)
@@ -32,6 +32,7 @@
uint32 m_nOverlapMs;
uint16 m_nFinetuneStep; // Increment finetune by x when using spin control. Default = 25
enum {nDefaultStretchChunkSize = 8192};
+ UINT m_nPreviousRawFormat;
CComboBox m_ComboPitch, m_ComboQuality, m_ComboFFT;
Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2010-03-13 00:22:53 UTC (rev 527)
+++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2010-03-13 14:17:33 UTC (rev 528)
@@ -1066,6 +1066,9 @@
// CRawSampleDlg
+UINT CRawSampleDlg::m_nFormat = 0;
+
+
BOOL CRawSampleDlg::OnInitDialog()
//--------------------------------
{
@@ -1082,6 +1085,7 @@
if (IsDlgButtonChecked(IDC_RADIO2)) m_nFormat |= 1;
if (IsDlgButtonChecked(IDC_RADIO4)) m_nFormat |= 2;
if (IsDlgButtonChecked(IDC_RADIO6)) m_nFormat |= 4;
+ m_bRememberFormat = IsDlgButtonChecked(IDC_CHK_REMEMBERSETTINGS) ? true : false;
CDialog::OnOK();
}
@@ -1092,6 +1096,7 @@
CheckRadioButton(IDC_RADIO1, IDC_RADIO2, (m_nFormat & 1) ? IDC_RADIO2 : IDC_RADIO1);
CheckRadioButton(IDC_RADIO3, IDC_RADIO4, (m_nFormat & 2) ? IDC_RADIO4 : IDC_RADIO3);
CheckRadioButton(IDC_RADIO5, IDC_RADIO6, (m_nFormat & 4) ? IDC_RADIO6 : IDC_RADIO5);
+ CheckDlgButton(IDC_CHK_REMEMBERSETTINGS, (m_bRememberFormat) ? MF_CHECKED : MF_UNCHECKED);
}
Modified: trunk/OpenMPT/mptrack/Mpdlgs.h
===================================================================
--- trunk/OpenMPT/mptrack/Mpdlgs.h 2010-03-13 00:22:53 UTC (rev 527)
+++ trunk/OpenMPT/mptrack/Mpdlgs.h 2010-03-13 14:17:33 UTC (rev 528)
@@ -134,10 +134,15 @@
//=================================
{
public:
- UINT m_nFormat;
+ static UINT m_nFormat;
+ bool m_bRememberFormat;
public:
- CRawSampleDlg(CWnd *parent=NULL):CDialog(IDD_LOADRAWSAMPLE, parent) { m_nFormat = 0; }
+ CRawSampleDlg(CWnd *parent = NULL):CDialog(IDD_LOADRAWSAMPLE, parent)
+ {
+ //m_nFormat = 0;
+ m_bRememberFormat = false;
+ }
protected:
virtual BOOL OnInitDialog();
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2010-03-13 00:22:53 UTC (rev 527)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2010-03-13 14:17:33 UTC (rev 528)
@@ -424,23 +424,25 @@
CONTROL "Spin1",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,196,232,11,14
END
-IDD_LOADRAWSAMPLE DIALOGEX 0, 0, 178, 89
-STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+IDD_LOADRAWSAMPLE DIALOGEX 0, 0, 178, 95
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Unknown file type"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- DEFPUSHBUTTON "OK",IDOK,66,66,50,14
- PUSHBUTTON "Cancel",IDCANCEL,120,66,50,14
- GROUPBOX "",IDC_STATIC,6,24,48,34,WS_GROUP
+ DEFPUSHBUTTON "OK",IDOK,66,72,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,120,72,50,14
+ GROUPBOX "",IDC_STATIC,6,18,48,34,WS_GROUP
LTEXT "Load it as a raw sample of the following format:",IDC_STATIC,6,6,156,12
- CONTROL "8-bit",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,12,32,29,10
- CONTROL "16-bit",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,12,44,33,10
- GROUPBOX "",IDC_STATIC,60,24,54,34,WS_GROUP
- CONTROL "Unsigned",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,64,32,46,10
- CONTROL "Signed",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,64,44,38,10
- GROUPBOX "",IDC_STATIC,120,24,51,34,WS_GROUP
- CONTROL "Mono",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,126,32,34,10
- CONTROL "Stereo",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,126,44,37,10
+ CONTROL "8-bit",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,12,26,29,10
+ CONTROL "16-bit",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,12,38,33,10
+ GROUPBOX "",IDC_STATIC,60,18,54,34,WS_GROUP
+ CONTROL "Unsigned",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,64,26,46,10
+ CONTROL "Signed",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,64,38,38,10
+ GROUPBOX "",IDC_STATIC,120,18,51,34,WS_GROUP
+ CONTROL "Mono",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,126,26,34,10
+ CONTROL "Stereo",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,126,38,37,10
+ CONTROL "Remember these settings",IDC_CHK_REMEMBERSETTINGS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,54,168,12
END
IDD_CONTROL_GLOBALS DIALOGEX 0, 0, 561, 94
@@ -1550,7 +1552,7 @@
IDD_LOADRAWSAMPLE, DIALOG
BEGIN
RIGHTMARGIN, 156
- BOTTOMMARGIN, 88
+ BOTTOMMARGIN, 94
END
IDD_CONTROL_COMMENTS, DIALOG
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2010-03-13 00:22:53 UTC (rev 527)
+++ trunk/OpenMPT/mptrack/resource.h 2010-03-13 14:17:33 UTC (rev 528)
@@ -948,6 +948,7 @@
#define IDC_EDIT_PRESET_EXPR 2424
#define IDC_LIST_SAMPLEGEN_PRESETS 2425
#define IDC_CHECK_UNDO 2426
+#define IDC_CHK_REMEMBERSETTINGS 2427
#define ID_FILE_NEWMOD 32771
#define ID_FILE_NEWXM 32772
#define ID_FILE_NEWS3M 32773
@@ -1200,11 +1201,11 @@
#define ID_SAMPLE_GENERATOR_MENU 60244
#define ID_SAMPLE_GENERATOR_PRESET_MENU 60344
#define ID_SAMPLE_GENERATE 60445
-#define ID_NOTEMAP_TRANS_UP 60446
-#define ID_NOTEMAP_TRANS_DOWN 60447
-#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 60448
-#define ID_ENVELOPE_ZOOM_IN 60449
-#define ID_ENVELOPE_ZOOM_OUT 60450
+#define ID_NOTEMAP_TRANS_UP 60446
+#define ID_NOTEMAP_TRANS_DOWN 60447
+#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 60448
+#define ID_ENVELOPE_ZOOM_IN 60449
+#define ID_ENVELOPE_ZOOM_OUT 60450
// Next default values for new objects
//
@@ -1213,7 +1214,7 @@
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 526
#define _APS_NEXT_COMMAND_VALUE 60451
-#define _APS_NEXT_CONTROL_VALUE 2427
+#define _APS_NEXT_CONTROL_VALUE 2428
#define _APS_NEXT_SYMED_VALUE 901
#endif
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-03-13 00:23:33
|
Revision: 527
http://modplug.svn.sourceforge.net/modplug/?rev=527&view=rev
Author: saga-games
Date: 2010-03-13 00:22:53 +0000 (Sat, 13 Mar 2010)
Log Message:
-----------
[Imp] Installer: Use DDE commands to open files.
Modified Paths:
--------------
trunk/OpenMPT/installer/filetypes.iss
Modified: trunk/OpenMPT/installer/filetypes.iss
===================================================================
--- trunk/OpenMPT/installer/filetypes.iss 2010-03-12 23:35:13 UTC (rev 526)
+++ trunk/OpenMPT/installer/filetypes.iss 2010-03-13 00:22:53 UTC (rev 527)
@@ -84,13 +84,10 @@
; important (setup)
Root: HKCR; Subkey: "OpenMPTFile"; ValueType: string; ValueName: ""; ValueData: "OpenMPT Module"; Flags: uninsdeletekey; Tasks: associate_common or associate_exotic
Root: HKCR; Subkey: "OpenMPTFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\mpt.ico,0"; Tasks: associate_common or associate_exotic
-Root: HKCR; Subkey: "OpenMPTFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\mptrack.exe"" ""%1"""; Tasks: associate_common or associate_exotic
+Root: HKCR; Subkey: "OpenMPTFile\shell\Open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\mptrack.exe"" ""%1"""; Tasks: associate_common or associate_exotic
+Root: HKCR; Subkey: "OpenMPTFile\shell\Open\ddeexec"; ValueType: string; ValueName: ""; ValueData: "[Edit(""%1"")]"; Tasks: associate_common or associate_exotic
[Files]
; icon file (should be moved into EXE)
Source: "mpt.ico"; DestDir: "{app}"; Flags: ignoreversion
-
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|