From: <sag...@us...> - 2010-10-16 21:06:16
|
Revision: 743 http://modplug.svn.sourceforge.net/modplug/?rev=743&view=rev Author: saga-games Date: 2010-10-16 21:06:10 +0000 (Sat, 16 Oct 2010) Log Message: ----------- [Fix] IT Loader: IT files with no samples made OpenMPT crash since rev.730 [Mod] Edit History: Dialog also shows total edit count now. Modified Paths: -------------- trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/soundlib/Load_it.cpp Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-10-16 00:26:47 UTC (rev 742) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-10-16 21:06:10 UTC (rev 743) @@ -3139,12 +3139,17 @@ SetDlgItemText(IDC_EDIT_HISTORY, s); // Total edit time - totalTime = (uint64)((double)(totalTime) / HISTORY_TIMER_PRECISION); - s.Format(_T("Total edit time: %lluh %02llum %02llus"), totalTime / 3600, (totalTime / 60) % 60, totalTime % 60); - SetDlgItemText(IDC_TOTAL_EDIT_TIME, s); - // Window title - s.Format(_T("Edit history for %s"), m_pModDoc->GetTitle()); - SetWindowText(s); + s = ""; + if(totalTime) + { + totalTime = (uint64)((double)(totalTime) / HISTORY_TIMER_PRECISION); + + s.Format(_T("Total edit time: %lluh %02llum %02llus (%u session%s)"), totalTime / 3600, (totalTime / 60) % 60, totalTime % 60, num, (num != 1) ? _T("s") : _T("")); + SetDlgItemText(IDC_TOTAL_EDIT_TIME, s); + // Window title + s.Format(_T("Edit history for %s"), m_pModDoc->GetTitle()); + SetWindowText(s); + } // Enable or disable Clear button GetDlgItem(IDC_BTN_CLEAR)->EnableWindow((m_pModDoc->GetFileHistory()->empty()) ? FALSE : TRUE); Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-10-16 00:26:47 UTC (rev 742) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-10-16 21:06:10 UTC (rev 743) @@ -904,7 +904,11 @@ // In order to properly compute the position, in file, of eventual extended settings // such as "attack" we need to keep the "real" size of the last sample as those extra // setting will follow this sample in the file - UINT lastSampleOffset = smppos[min(0, pifh->smpnum - 1)] + sizeof(ITSAMPLESTRUCT); + UINT lastSampleOffset = 0; + if(pifh->smpnum > 0) + { + lastSampleOffset = smppos[pifh->smpnum - 1] + sizeof(ITSAMPLESTRUCT); + } // -! NEW_FEATURE#0027 // Reading Samples This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |