Skip to content

Commit

Permalink
Force modules to be saved as Dn-FT modules
Browse files Browse the repository at this point in the history
This prevents modules to be saved with version 0x450 but without the
Dn-FT specific file header, causing the program to interpret it as
FT 050b modules instead.
Gumball2415 committed Dec 22, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
Gumball2415 Persune
1 parent 517b4f0 commit 254814e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Source/FamiTrackerDoc.cpp
Original file line number Diff line number Diff line change
@@ -391,8 +391,7 @@ BOOL CFamiTrackerDoc::OnSaveDocument(LPCTSTR lpszPathName)
// TODO: Dn-FamiTracker compatibility modes

// to avoid conflicts with FamiTracker beta 0.5.0 modules, set as Dn-FT module
if (m_iFileVersion >= 0x450U)
m_bFileDnModule = true;
m_bFileDnModule = true;
if (!SaveDocument(lpszPathName))
return FALSE;

@@ -816,7 +815,7 @@ bool CFamiTrackerDoc::WriteBlocks(CDocumentFile *pDocFile) const
// internal
6, // Parameters
1, // Song Info
1, // Tuning
0, // Tuning
3, // Header
6, // Instruments
6, // Sequences
@@ -827,6 +826,7 @@ bool CFamiTrackerDoc::WriteBlocks(CDocumentFile *pDocFile) const
#else
6, // Parameters
1, // Song Info
0, // Tuning
3, // Header
6, // Instruments
6, // Sequences
@@ -872,8 +872,9 @@ bool CFamiTrackerDoc::WriteBlocks(CDocumentFile *pDocFile) const
};

for (size_t i = 0; i < sizeof(FTM_WRITE_FUNC) / sizeof(*FTM_WRITE_FUNC); ++i) {
if (!CALL_MEMBER_FN(this, FTM_WRITE_FUNC[i])(pDocFile, DEFAULT_BLOCK_VERSION[i]))
return false;
if (DEFAULT_BLOCK_VERSION[i] != 0) // !! !! check if block version is nonzero
if (!CALL_MEMBER_FN(this, FTM_WRITE_FUNC[i])(pDocFile, DEFAULT_BLOCK_VERSION[i]))
return false;
}
return true;
}

0 comments on commit 254814e

Please sign in to comment.