diff --git a/src/engine/defines.h b/src/engine/defines.h index 172190c9..13583712 100644 --- a/src/engine/defines.h +++ b/src/engine/defines.h @@ -20,11 +20,19 @@ #ifndef _DEFINES_H #define _DEFINES_H +// global #define DIV_MAX_CHIPS 32 #define DIV_MAX_CHANS 128 #define DIV_MAX_PATTERNS 256 + +// in-pattern #define DIV_MAX_ROWS 256 #define DIV_MAX_COLS 32 +#define DIV_MAX_EFFECTS 8 + +// sample related #define DIV_MAX_SAMPLE_TYPE 4 +typedef unsigned char ORDERTYPE; + #endif diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index d27db9ea..f0061dba 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -2000,7 +2000,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { for (int i=0; ipat[i].effectCols=reader.readC(); - if (subSong->pat[i].effectCols<1 || subSong->pat[i].effectCols>8) { + if (subSong->pat[i].effectCols<1 || subSong->pat[i].effectCols>DIV_MAX_EFFECTS) { logE("channel %d has zero or too many effect columns! (%d)",i,subSong->pat[i].effectCols); lastError=fmt::sprintf("channel %d has too many effect columns! (%d)",i,subSong->pat[i].effectCols); delete[] file; diff --git a/src/engine/orders.h b/src/engine/orders.h index 78a05f0c..baf20101 100644 --- a/src/engine/orders.h +++ b/src/engine/orders.h @@ -21,7 +21,7 @@ #define _ORDERS_H struct DivOrders { - unsigned char ord[DIV_MAX_CHANS][DIV_MAX_PATTERNS]; + ORDERTYPE ord[DIV_MAX_CHANS][DIV_MAX_PATTERNS]; DivOrders() { memset(ord,0,DIV_MAX_CHANS*DIV_MAX_PATTERNS); diff --git a/src/gui/doAction.cpp b/src/gui/doAction.cpp index 14fb4466..a12366ac 100644 --- a/src/gui/doAction.cpp +++ b/src/gui/doAction.cpp @@ -522,7 +522,7 @@ void FurnaceGUI::doAction(int what) { case GUI_ACTION_PAT_INCREASE_COLUMNS: if (cursor.xCoarse<0 || cursor.xCoarse>=e->getTotalChannelCount()) break; e->curPat[cursor.xCoarse].effectCols++; - if (e->curPat[cursor.xCoarse].effectCols>8) e->curPat[cursor.xCoarse].effectCols=8; + if (e->curPat[cursor.xCoarse].effectCols>DIV_MAX_EFFECTS) e->curPat[cursor.xCoarse].effectCols=DIV_MAX_EFFECTS; break; case GUI_ACTION_PAT_DECREASE_COLUMNS: if (cursor.xCoarse<0 || cursor.xCoarse>=e->getTotalChannelCount()) break; diff --git a/src/gui/orders.cpp b/src/gui/orders.cpp index 32a4733d..0b6b6de8 100644 --- a/src/gui/orders.cpp +++ b/src/gui/orders.cpp @@ -177,10 +177,10 @@ void FurnaceGUI::drawOrders() { e->lockSave([this,i,j]() { if (changeAllOrders) { for (int k=0; kgetTotalChannelCount(); k++) { - if (e->curOrders->ord[k][i]<0xff) e->curOrders->ord[k][i]++; + if (e->curOrders->ord[k][i]<(ORDERTYPE)(DIV_MAX_PATTERNS-1)) e->curOrders->ord[k][i]++; } } else { - if (e->curOrders->ord[j][i]<0xff) e->curOrders->ord[j][i]++; + if (e->curOrders->ord[j][i]<(ORDERTYPE)(DIV_MAX_PATTERNS-1)) e->curOrders->ord[j][i]++; } }); e->walkSong(loopOrder,loopRow,loopEnd); diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index 79854802..2c611d46 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -875,11 +875,11 @@ void FurnaceGUI::drawPattern() { } ImGui::EndDisabled(); ImGui::SameLine(); - ImGui::BeginDisabled(e->curPat[i].effectCols>=8); + ImGui::BeginDisabled(e->curPat[i].effectCols>=DIV_MAX_EFFECTS); snprintf(chanID,2048,">##_RCH%d",i); if (ImGui::SmallButton(chanID)) { e->curPat[i].effectCols++; - if (e->curPat[i].effectCols>8) e->curPat[i].effectCols=8; + if (e->curPat[i].effectCols>DIV_MAX_EFFECTS) e->curPat[i].effectCols=DIV_MAX_EFFECTS; } ImGui::EndDisabled(); }