Ejemplo n.º 1
0
void ReadModPatterns(std::istream& iStrm, CPatternContainer& patc, const size_t)
//--------------------------------------------------------------------------------
{
	srlztn::SsbRead ssb(iStrm);
	ssb.BeginRead(FileIdPatterns, MptVersion::num);
	if ((ssb.m_Status & srlztn::SNT_FAILURE) != 0)
		return;
	PATTERNINDEX nPatterns = patc.Size();
	uint16 nCount = uint16_max;
	if (ssb.ReadItem(nCount, "num") != srlztn::SsbRead::EntryNotFound)
		nPatterns = nCount;
	LimitMax(nPatterns, ModSpecs::mptm.patternsMax);
	if (nPatterns > patc.Size())
		patc.ResizeArray(nPatterns);	
	for(uint16 i = 0; i < nPatterns; i++)
	{
		ssb.ReadItem(patc[i], srlztn::IdLE<uint16>(i).GetChars(), sizeof(i), &ReadModPattern);
	}
}
Ejemplo n.º 2
0
void ReadModPatterns(std::istream& iStrm, CPatternContainer& patc, const size_t)
//--------------------------------------------------------------------------------
{
    srlztn::Ssb ssb(iStrm);
    ssb.BeginRead(FileIdPatterns, MptVersion::num);
    if ((ssb.m_Status & srlztn::SNT_FAILURE) != 0)
            return;
    modplug::tracker::patternindex_t nPatterns = patc.Size();
    uint16_t nCount = UINT16_MAX;
    if (ssb.ReadItem(nCount, "num") != srlztn::Ssb::EntryNotFound)
            nPatterns = nCount;
    LimitMax(nPatterns, ModSpecs::mptm.patternsMax);
    if (nPatterns > patc.Size())
            patc.ResizeArray(nPatterns);
    for(uint16_t i = 0; i < nPatterns; i++)
    {
            ssb.ReadItem(patc[i], &i, sizeof(i), &ReadModPattern);
    }
}
Ejemplo n.º 3
0
void WriteModPatterns(std::ostream& oStrm, const CPatternContainer& patc)
//----------------------------------------------------------------------
{
	srlztn::SsbWrite ssb(oStrm);
	ssb.BeginWrite(FileIdPatterns, MptVersion::num);
	const PATTERNINDEX nPatterns = patc.Size();
	uint16 nCount = 0;
	for(uint16 i = 0; i < nPatterns; i++) if (patc[i])
	{
		ssb.WriteItem(patc[i], srlztn::IdLE<uint16>(i).GetChars(), sizeof(i), &WriteModPattern);
		nCount = i + 1;
	}
	ssb.WriteItem<uint16>(nCount, "num"); // Index of last pattern + 1.
	ssb.FinishWrite();
}
Ejemplo n.º 4
0
void WriteModPatterns(std::ostream& oStrm, const CPatternContainer& patc)
//----------------------------------------------------------------------
{
    srlztn::Ssb ssb(oStrm);
    ssb.BeginWrite(FileIdPatterns, MptVersion::num);
    const modplug::tracker::patternindex_t nPatterns = patc.Size();
    uint16_t nCount = 0;
    for(uint16_t i = 0; i < nPatterns; i++) if (patc[i])
    {
            ssb.WriteItem(patc[i], &i, sizeof(i), &WriteModPattern);
            nCount = i + 1;
    }
    ssb.WriteItem<uint16_t>(nCount, "num"); // Index of last pattern + 1.
    ssb.FinishWrite();
}