void CChunkRenderText::StorePatternChunk(CChunk *pChunk, CFile *pFile) { CStringA str; int len = pChunk->GetLength(); // Patterns str.Format("; Bank %i\n", pChunk->GetBank()); str.AppendFormat("%s:\n", pChunk->GetLabel()); const std::vector<char> &vec = pChunk->GetStringData(0); len = vec.size(); StoreByteString(&vec.front(), vec.size(), str, DEFAULT_LINE_BREAK); /* for (int i = 0; i < len; ++i) { str.AppendFormat("$%02X", (unsigned char)vec[i]); if ((i % 20 == 19) && (i < len - 1)) str.Append("\n\t.byte "); else { if (i < len - 1) str.Append(", "); } } */ str.Append("\n"); m_songDataStrings.Add(str); }
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); } }
void CChunkRenderText::StoreSequenceChunk(CChunk *pChunk, CFile *pFile) { CStringA str; str.Format("%s:\n", pChunk->GetLabel()); StoreByteString(pChunk, str, DEFAULT_LINE_BREAK); m_sequenceStrings.Add(str); }
void CChunkRenderText::StoreSequenceChunk(CChunk *pChunk, CFile *pFile) { CString str; str.Format(_T("%s:\n"), (LPCTSTR)pChunk->GetLabel()); StoreByteString(pChunk, str); m_sequenceStrings.Add(str); }