Skip to content

Commit

Permalink
Fix assembly period table export
Browse files Browse the repository at this point in the history
  • Loading branch information
Gumball2415 committed Feb 16, 2024
1 parent 1f9e366 commit b52993e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions Source/ChunkRenderText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ void CChunkRenderText::StoreNSFConfig(unsigned int DPCMSegment, stNSFHeader Head
WriteFileString(str, m_pFileNSFConfig);
}

void CChunkRenderText::StorePeriods(unsigned int *pNoteLUTNTSC, unsigned int* pNoteLUTPAL, unsigned int* pNoteLUTSaw, unsigned int* pNoteLUTFDS, unsigned int* pNoteLUTN163, unsigned int* pNoteLUTVRC7) const
void CChunkRenderText::StorePeriods(unsigned int *pLUTNTSC, unsigned int* pLUTPAL, unsigned int* pLUTSaw, unsigned int *pLUTVRC7, unsigned int *pLUTFDS, unsigned int *pLUTN163) const
{
CString str;

Expand All @@ -619,31 +619,31 @@ void CChunkRenderText::StorePeriods(unsigned int *pNoteLUTNTSC, unsigned int* pN
str.Append("; 2A03 NTSC\n");
str.Append(".if .defined(NTSC_PERIOD_TABLE)\n");
str.Append("ft_periods_ntsc: ;; Patched\n");
StoreWordString(pNoteLUTNTSC);
StoreWordString(pLUTNTSC);

str.Append(".endif\n\n");
str.Append("; 2A03 PAL\n");
str.Append(".if .defined(PAL_PERIOD_TABLE)\n");
str.Append("ft_periods_pal: ;; Patched\n");
StoreWordString(pNoteLUTPAL);
StoreWordString(pLUTPAL);

str.Append(".endif\n\n");
str.Append("; VRC6 Sawtooth\n");
str.Append(".if .defined(USE_VRC6)\n");
str.Append("ft_periods_sawtooth: ;; Patched\n");
StoreWordString(pNoteLUTSaw);
StoreWordString(pLUTSaw);

str.Append(".endif\n\n");
str.Append("; FDS\n");
str.Append(".if .defined(USE_FDS)\n");
str.Append("ft_periods_fds: ;; Patched\n");
StoreWordString(pNoteLUTFDS);
StoreWordString(pLUTFDS);

str.Append(".endif\n\n");
str.Append("; N163\n");
str.Append(".if .defined(USE_N163)\n");
str.Append("ft_periods_n163: ;; Patched\n");
StoreWordString(pNoteLUTN163);
StoreWordString(pLUTN163);

str.Append(".endif\n\n");
str.Append("; VRC7\n");
Expand All @@ -654,9 +654,9 @@ void CChunkRenderText::StorePeriods(unsigned int *pNoteLUTNTSC, unsigned int* pN
for (int i = 0; i <= NOTE_RANGE; ++i) { // // // include last item for linear pitch code optimization
CString str;
if (i == NOTE_RANGE)
str.AppendFormat("$%04X\n", pNoteLUTVRC7[0] << 3);
str.AppendFormat("$%04X\n", pLUTVRC7[0] << 3);
else
str.AppendFormat("$%04X, ", pNoteLUTVRC7[i] << 2);
str.AppendFormat("$%04X, ", pLUTVRC7[i] << 2);
str.Append(str);
}

Expand Down
2 changes: 1 addition & 1 deletion Source/ChunkRenderText.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CChunkRenderText
void StoreNSFStub(stNSFHeader Header, bool Bankswitched, vibrato_t VibratoStyle, bool LinearPitch, int ActualNamcoChannels, bool IsAssembly = false) const;
void StoreNSFHeader(stNSFHeader Header) const;
void StoreNSFConfig(unsigned int DPCMSegment, stNSFHeader Header, bool Bankswitched = false) const;
void StorePeriods(unsigned int *pLUTNTSC, unsigned int *pLUTPAL, unsigned int *pLUTSaw, unsigned int *pLUTFDS, unsigned int *pLUTN163, unsigned int *pLUTVRC7) const;
void StorePeriods(unsigned int *pLUTNTSC, unsigned int *pLUTPAL, unsigned int *pLUTSaw, unsigned int *pLUTVRC7, unsigned int *pLUTFDS, unsigned int *pLUTN163) const;
void StoreVibrato(unsigned int *pLUTVibrato) const;
void SetExtraDataFiles(CFile *pFileNSFStub, CFile *pFileNSFHeader, CFile *pFileNSFConfig, CFile *pFilePeriods, CFile *pFileVibrato);

Expand Down
2 changes: 1 addition & 1 deletion Source/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2797,7 +2797,7 @@ void CCompiler::WriteAssembly(CFile *pFile, bool bExtraData, stNSFHeader Header,
unsigned int LUTVRC7[NOTE_COUNT]{};

const CSoundGen *pSoundGen = theApp.GetSoundGenerator();
for (int i = 0; i < CDetuneTable::DETUNE_N163; ++i) { // // //
for (int i = 0; i <= CDetuneTable::DETUNE_N163; ++i) { // // //
switch (i) {
case CDetuneTable::DETUNE_NTSC:
for (int j = 0; j < NOTE_COUNT; ++j) LUTNTSC[j] = pSoundGen->ReadPeriodTable(j, i); break;
Expand Down

0 comments on commit b52993e

Please sign in to comment.