Skip to content

Commit

Permalink
Fix loading modules which have 28 channels
Browse files Browse the repository at this point in the history
Seems there was an off-by-one error in the code for quite some time.
  • Loading branch information
CaptainSwag101 committed Jan 16, 2017
1 parent cc34d69 commit 5ad4c3c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/FamiTrackerDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ void CFamiTrackerDoc::ReadBlock_Parameters(CDocumentFile *pDocFile, const int Ve
m_iExpansionChip = pDocFile->GetBlockChar();

m_iChannelsAvailable = AssertRange(pDocFile->GetBlockInt(), 1, MAX_CHANNELS, "Channel count"); // // //
AssertRange<MODULE_ERROR_OFFICIAL>(static_cast<int>(m_iChannelsAvailable), 1, MAX_CHANNELS - 1, "Channel count");
AssertRange<MODULE_ERROR_OFFICIAL>(static_cast<int>(m_iChannelsAvailable), 1, MAX_CHANNELS, "Channel count"); // // //

m_iMachine = static_cast<machine_t>(pDocFile->GetBlockInt());
AssertFileData(m_iMachine == NTSC || m_iMachine == PAL, "Unknown machine");
Expand Down
2 changes: 1 addition & 1 deletion Source/FamiTrackerTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const int ECHO_BUFFER_LENGTH = 3;

// Number of available channels (max) TODO: should not be used anymore!
// instead, check the channelsavailable variable and allocate dynamically
const int MAX_CHANNELS = 5 + 3 + 2 + 6 + 1 + 8 + 3;
const int MAX_CHANNELS = 5 + 3 + 2 + 8 + 1 + 6 + 3; // // //

const int CHANNELS_DEFAULT = 5;
const int CHANNELS_VRC6 = 3;
Expand Down

1 comment on commit 5ad4c3c

@langel
Copy link

@langel langel commented on 5ad4c3c Jan 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just set MAX_CHANNELS to 666 and be done with it ;)

Please sign in to comment.