Пример #1
0
void CChunkRenderText::StoreSamples(const std::vector<const CDSample*> &Samples)
{
	// Store DPCM samples in file, assembly format
	CStringA str;
	str.Format("\n; DPCM samples (located at DPCM segment)\n");
	WriteFileString(str, m_pFile);

	if (Samples.size() > 0) {
		str.Format("\n\t.segment \"DPCM\"\n");
		WriteFileString(str, m_pFile);
	}

	unsigned int Address = CCompiler::PAGE_SAMPLES;
	for (size_t i = 0; i < Samples.size(); ++i) {
		const CDSample *pDSample = Samples[i];
		const unsigned int SampleSize = pDSample->GetSize();
		const char *pData = pDSample->GetData();
		
		CStringA label;
		label.Format(CCompiler::LABEL_SAMPLE, i);
		str.Format("%s: ; %s\n", LPCSTR(label), pDSample->GetName());
		StoreByteString(pData, SampleSize, str, DEFAULT_LINE_BREAK);
		Address += SampleSize;

		// Adjust if necessary
		if ((Address & 0x3F) > 0) {
			int PadSize = 0x40 - (Address & 0x3F);
			Address	+= PadSize;
			str.Append("\n\t.align 64\n");
		}

		str.Append("\n");
		WriteFileString(str, m_pFile);
	}
}
Пример #2
0
void CChunkRenderText::DumpStrings(const CStringA &preStr, const CStringA &postStr, CStringArray &stringArray, CFile *pFile) const
{
	WriteFileString(preStr, pFile);

	for (int i = 0; i < stringArray.GetCount(); ++i) {
		WriteFileString(stringArray[i], pFile);
	}

	WriteFileString(postStr, pFile);
}
Пример #3
0
void CChunkRenderText::DumpStrings(CString preStr, CString postStr, CStringArray stringArray, CFile *pFile)
{
	WriteFileString(pFile, preStr);

	for (int i = 0; i < stringArray.GetCount(); ++i) {
		WriteFileString(pFile, stringArray[i]);
	}

	WriteFileString(pFile, postStr);
}
Пример #4
0
void CIniFile::SetString(CString Section, CString Item, CString Value)
{
	//保存到FileContainer
	WriteFileString(Section, Item, Value);
	//保存到ini文件
	WriteIniFile();
}
Пример #5
0
void CChunkRenderText::StoreChunks(const std::vector<CChunk*> &Chunks)
{
	// Generate strings
	for (std::vector<CChunk*>::const_iterator it = Chunks.begin(); it != Chunks.end(); ++it) {
		for (int j = 0; j < sizeof(RENDER_FUNCTIONS) / sizeof(stChunkRenderFunc); ++j) {
			if ((*it)->GetType() == RENDER_FUNCTIONS[j].type)
				(this->*RENDER_FUNCTIONS[j].function)(*it, m_pFile);
		}
	}

	// Write strings to file
	WriteFileString(CStringA("; FamiTracker exported music data: "), m_pFile);
	WriteFileString(CFamiTrackerDoc::GetDoc()->GetTitle(), m_pFile);
	WriteFileString(CStringA("\n;\n\n"), m_pFile);

	// Module header
	DumpStrings(CStringA("; Module header\n"), CStringA("\n"), m_headerStrings, m_pFile);

	// Instrument list
	DumpStrings(CStringA("; Instrument pointer list\n"), CStringA("\n"), m_instrumentListStrings, m_pFile);
	DumpStrings(CStringA("; Instruments\n"), CStringA(""), m_instrumentStrings, m_pFile);

	// Sequences
	DumpStrings(CStringA("; Sequences\n"), CStringA("\n"), m_sequenceStrings, m_pFile);

	// Waves (FDS & N163)
	if (m_wavetableStrings.IsEmpty() == FALSE) {
		DumpStrings(CStringA("; FDS waves\n"), CStringA("\n"), m_wavetableStrings, m_pFile);
	}

	if (m_wavesStrings.IsEmpty() == FALSE) {
		DumpStrings(CStringA("; N163 waves\n"), CStringA("\n"), m_wavesStrings, m_pFile);
	}

	// Samples
	DumpStrings(CStringA("; DPCM instrument list (pitch, sample index)\n"), CStringA("\n"), m_sampleListStrings, m_pFile);
	DumpStrings(CStringA("; DPCM samples list (location, size, bank)\n"), CStringA("\n"), m_samplePointersStrings, m_pFile);

	// Songs
	DumpStrings(CStringA("; Song pointer list\n"), CStringA("\n"), m_songListStrings, m_pFile);
	DumpStrings(CStringA("; Song info\n"), CStringA("\n"), m_songStrings, m_pFile);

	// Song data
	DumpStrings(CStringA(";\n; Pattern and frame data for all songs below\n;\n\n"), CStringA(""), m_songDataStrings, m_pFile);

	// Actual DPCM samples are stored later
}
Пример #6
0
void CIniFile::SetFloat(CString Section, CString Item, float Value)
{
	CString strtemp;
	strtemp.Format(_T("%e"),Value);
	//保存到FileContainer
	WriteFileString(Section, Item, strtemp);
	//保存到ini文件
	WriteIniFile();
}
Пример #7
0
void CChunkRenderText::StoreChunks(std::vector<CChunk*> &m_vChunks, CFile *pFile)
{
	// Generate strings
	for (unsigned int i = 0; i < m_vChunks.size(); ++i) {
		for (int j = 0; j < sizeof(RENDER_FUNCTIONS) / sizeof(stChunkRenderFunc); ++j) {
			if (m_vChunks[i]->GetType() == RENDER_FUNCTIONS[j].type)
				(this->*RENDER_FUNCTIONS[j].function)(m_vChunks[i], pFile);
		}
	}
	
	// Write strings to file
	WriteFileString(pFile, CString("; FamiTracker exported music data\n;\n\n"));

	// Module header
	DumpStrings(CString("; Module header\n"), CString("\n"), m_headerStrings, pFile);

	// Instrument list
	DumpStrings(CString("; Instrument pointer list\n"), CString("\n"), m_instrumentListStrings, pFile);
	DumpStrings(CString("; Instruments\n"), CString(""), m_instrumentStrings, pFile);

	// Sequences
	DumpStrings(CString("; Sequences\n"), CString("\n"), m_sequenceStrings, pFile);

	// Waves (FDS & N163)
	if (m_wavetableStrings.IsEmpty() == FALSE) {
		DumpStrings(CString("; FDS waves\n"), CString("\n"), m_wavetableStrings, pFile);
	}

	if (m_wavesStrings.IsEmpty() == FALSE) {
		DumpStrings(CString("; N163 waves\n"), CString("\n"), m_wavesStrings, pFile);
	}

	// Samples
	DumpStrings(CString("; DPCM instrument list (pitch, sample index)\n"), CString("\n"), m_sampleListStrings, pFile);
	DumpStrings(CString("; DPCM samples list (location, size, bank)\n"), CString("\n"), m_samplePointersStrings, pFile);

	// Songs
	DumpStrings(CString("; Song pointer list\n"), CString("\n"), m_songListStrings, pFile);
	DumpStrings(CString("; Song info\n"), CString("\n"), m_songStrings, pFile);

	// Song data
	DumpStrings(CString(";\n; Pattern and frame data for all songs below\n;\n\n"), CString(""), m_songDataStrings, pFile);

	// Actual DPCM samples are stored later
}