Merge branch 'master' into newMixer

This commit is contained in:
tildearrow 2025-10-21 18:05:00 -05:00
commit ab2f2a0a59
8 changed files with 54 additions and 18 deletions

View file

@ -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; i<tex->UpdateRect.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; i<h.y+h.h; i++) {
memcpy(&data[i_y+h.x],tex->GetPixelsAt(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; i<tex->UpdateRect.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; i<h.y+h.h; i++) {
memcpy(&data[i_y+h.x],tex->GetPixelsAt(h.x,i),h.w*sizeof(uint32_t));
i_y+=t->width;
}
}
}

View file

@ -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

View file

@ -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();

View file

@ -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; i<ds.systemLen; i++) {
if (ds.system[i]==DIV_SYSTEM_YM2151) {
// find all E5xx effects and adapt to normal range
for (int j=ch; j<ch+8; j++) {
for (size_t k=0; k<ds.subsong.size(); k++) {
for (int l=0; l<DIV_MAX_PATTERNS; l++) {
DivPattern* p=ds.subsong[k]->pat[j].data[l];
if (p==NULL) continue;
for (int m=0; m<DIV_MAX_ROWS; m++) {
for (int n=0; n<ds.subsong[k]->pat[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();

View file

@ -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));

View file

@ -1395,7 +1395,7 @@ void FurnaceGUI::doInterpolate() {
for (int k=0, k_p=curPoint.first; k<distance; k++) {
DivPattern* pat=e->curPat[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;

View file

@ -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;