diff --git a/demos/misc/hittingtherevlimiter_RF5C68.fur b/demos/misc/hittingtherevlimiter_RF5C68.fur index 87bcb7929..ff43170d3 100644 Binary files a/demos/misc/hittingtherevlimiter_RF5C68.fur and b/demos/misc/hittingtherevlimiter_RF5C68.fur differ diff --git a/extern/imgui_software_renderer/imgui_sw.cpp b/extern/imgui_software_renderer/imgui_sw.cpp index 040580503..2f702bbae 100644 --- a/extern/imgui_software_renderer/imgui_sw.cpp +++ b/extern/imgui_software_renderer/imgui_sw.cpp @@ -765,17 +765,21 @@ void ImGui_ImplSW_UpdateTexture(ImTextureData* tex) { // update region if (t->isAlpha) { unsigned char* data=(unsigned char*)t->pixels; - int i_y=t->width*tex->UpdateRect.y; - for (int i=tex->UpdateRect.y; iUpdateRect.y+tex->UpdateRect.w; i++) { - memcpy(&data[i_y],tex->GetPixelsAt(tex->UpdateRect.x,i),tex->UpdateRect.w); - i_y+=t->width; + for (ImTextureRect& h: tex->Updates) { + int i_y=t->width*h.y; + for (int i=h.y; iGetPixelsAt(h.x,i),h.w); + i_y+=t->width; + } } } else { uint32_t* data=t->pixels; - int i_y=t->width*tex->UpdateRect.y; - for (int i=tex->UpdateRect.y; iUpdateRect.y+tex->UpdateRect.w; i++) { - memcpy(&data[i_y],tex->GetPixelsAt(tex->UpdateRect.x,i),tex->UpdateRect.w*sizeof(uint32_t)); - i_y+=t->width; + for (ImTextureRect& h: tex->Updates) { + int i_y=t->width*h.y; + for (int i=h.y; iGetPixelsAt(h.x,i),h.w*sizeof(uint32_t)); + i_y+=t->width; + } } } diff --git a/src/engine/engine.h b/src/engine/engine.h index 86993b69b..cf36e976d 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -54,8 +54,8 @@ class DivWorkPool; #define DIV_UNSTABLE -#define DIV_VERSION "dev235" -#define DIV_ENGINE_VERSION 235 +#define DIV_VERSION "dev236" +#define DIV_ENGINE_VERSION 236 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 diff --git a/src/engine/fileOps/dmf.cpp b/src/engine/fileOps/dmf.cpp index 2b43ce275..8593993ef 100644 --- a/src/engine/fileOps/dmf.cpp +++ b/src/engine/fileOps/dmf.cpp @@ -840,6 +840,13 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) { pat->newData[k][DIV_PAT_FXVAL(l)]=128+((pat->newData[k][DIV_PAT_FXVAL(l)]-128)/4); } } + // YM2151: pitch effect range is different + if (ds.system[0]==DIV_SYSTEM_ARCADE && pat->newData[k][DIV_PAT_FX(l)]==0xe5 && pat->newData[k][DIV_PAT_FXVAL(l)]!=-1) { + int newVal=(2*((pat->newData[k][DIV_PAT_FXVAL(l)]&0xff)-0x80))+0x80; + if (newVal<0) newVal=0; + if (newVal>0xff) newVal=0xff; + pat->newData[k][DIV_PAT_FXVAL(l)]=newVal; + } } // instrument pat->newData[k][DIV_PAT_INS]=reader.readS(); diff --git a/src/engine/fileOps/fur.cpp b/src/engine/fileOps/fur.cpp index e4b8c70d2..efb1d2632 100644 --- a/src/engine/fileOps/fur.cpp +++ b/src/engine/fileOps/fur.cpp @@ -2143,6 +2143,37 @@ bool DivEngine::loadFur(unsigned char* file, size_t len, int variantID) { } } + // YM2151 E5xx range was different + if (ds.version<236) { + int ch=0; + // so much nesting + for (int i=0; ipat[j].data[l]; + if (p==NULL) continue; + + for (int m=0; mpat[j].effectCols; n++) { + if (p->newData[m][DIV_PAT_FX(n)]==0xe5 && p->newData[m][DIV_PAT_FXVAL(n)]!=-1) { + int newVal=(2*((p->newData[m][DIV_PAT_FXVAL(n)]&0xff)-0x80))+0x80; + if (newVal<0) newVal=0; + if (newVal>0xff) newVal=0xff; + p->newData[m][DIV_PAT_FXVAL(n)]=newVal; + } + } + } + } + } + } + } + ch+=getChannelCount(ds.system[i]); + } + } + if (active) quitDispatch(); BUSY_BEGIN_SOFT; saveLock.lock(); diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index a60bf2226..f61376900 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -1380,12 +1380,6 @@ void DivEngine::processRow(int i, bool afterDelay) { break; case 0xe5: // pitch chan[i].pitch=effectVal-0x80; - // why isn't this removed yet? we shpuldn't give this chip special treatment! - if (sysOfChan[i]==DIV_SYSTEM_YM2151) { // YM2151 pitch oddity - chan[i].pitch*=2; - if (chan[i].pitch<-128) chan[i].pitch=-128; - if (chan[i].pitch>127) chan[i].pitch=127; - } // send pitch now dispatchCmd(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15))); dispatchCmd(DivCommand(DIV_CMD_HINT_PITCH,i,chan[i].pitch)); diff --git a/src/gui/editing.cpp b/src/gui/editing.cpp index 505dd36fb..cf39622da 100644 --- a/src/gui/editing.cpp +++ b/src/gui/editing.cpp @@ -1395,7 +1395,7 @@ void FurnaceGUI::doInterpolate() { for (int k=0, k_p=curPoint.first; kcurPat[iCoarse].getPattern(e->curOrders->ord[iCoarse][(k_p>>8)&0xff],true); int val=curPoint.second+((nextPoint.second-curPoint.second)*(double)k/(double)distance); - pat->newData[k_p&0xff][DIV_PAT_NOTE]=val%12; + pat->newData[k_p&0xff][DIV_PAT_NOTE]=val; k_p++; if ((k_p&0xff)>=e->curSubSong->patLen) { k_p&=~0xff; diff --git a/src/gui/sampleEdit.cpp b/src/gui/sampleEdit.cpp index 4415130d9..441c0294a 100644 --- a/src/gui/sampleEdit.cpp +++ b/src/gui/sampleEdit.cpp @@ -1144,7 +1144,7 @@ void FurnaceGUI::drawSampleEdit() { if (resampleTarget>384000) resampleTarget=384000; } double factor=resampleTarget/(double)targetRate; - unsigned int targetLength=sample->samples*factor; + unsigned int targetLength=round(sample->samples*factor); if (ImGui::InputScalar("Length##SRLen",ImGuiDataType_U32,&targetLength, &_ONE, &_SIXTEEN)) { if (targetLength<1) targetLength=1; resampleTarget=targetRate*targetLength/(double)sample->samples;