mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-26 22:43:01 +00:00
dev154 - NES: DPCM mode is now default
This commit is contained in:
parent
f42c689f97
commit
bd53c57658
7 changed files with 42 additions and 8 deletions
|
@ -53,8 +53,8 @@
|
|||
#define EXTERN_BUSY_BEGIN_SOFT e->softLocked=true; e->isBusy.lock();
|
||||
#define EXTERN_BUSY_END e->isBusy.unlock(); e->softLocked=false;
|
||||
|
||||
#define DIV_VERSION "dev153"
|
||||
#define DIV_ENGINE_VERSION 153
|
||||
#define DIV_VERSION "dev154"
|
||||
#define DIV_ENGINE_VERSION 154
|
||||
// for imports
|
||||
#define DIV_VERSION_MOD 0xff01
|
||||
#define DIV_VERSION_FC 0xff02
|
||||
|
|
|
@ -1040,6 +1040,11 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
|
|||
ds.systemFlags[0].set("noEasyNoise",true);
|
||||
}
|
||||
|
||||
// NES PCM
|
||||
if (ds.system[0]==DIV_SYSTEM_NES) {
|
||||
ds.systemFlags[0].set("dpcmMode",false);
|
||||
}
|
||||
|
||||
ds.systemName=getSongSystemLegacyName(ds,!getConfInt("noMultiSystem",0));
|
||||
|
||||
if (active) quitDispatch();
|
||||
|
@ -2724,6 +2729,15 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
// NES PCM compat
|
||||
if (ds.version<154) {
|
||||
for (int i=0; i<ds.systemLen; i++) {
|
||||
if (ds.system[i]==DIV_SYSTEM_NES) {
|
||||
ds.systemFlags[i].set("dpcmMode",false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (active) quitDispatch();
|
||||
BUSY_BEGIN_SOFT;
|
||||
saveLock.lock();
|
||||
|
|
|
@ -401,7 +401,7 @@ int DivPlatformNES::dispatch(DivCommand c) {
|
|||
chan[c.chan].furnaceDac=false;
|
||||
if (dpcmMode && !skipRegisterWrites) {
|
||||
unsigned int dpcmAddr=sampleOffDPCM[dacSample];
|
||||
unsigned int dpcmLen=(parent->getSample(dacSample)->lengthDPCM+15)>>4;
|
||||
unsigned int dpcmLen=parent->getSample(dacSample)->lengthDPCM>>4;
|
||||
if (dpcmLen>255) dpcmLen=255;
|
||||
goingToLoop=parent->getSample(dacSample)->isLoopable();
|
||||
// write DPCM
|
||||
|
@ -655,7 +655,7 @@ void DivPlatformNES::reset() {
|
|||
dacSample=-1;
|
||||
sampleBank=0;
|
||||
dpcmBank=0;
|
||||
dpcmMode=false;
|
||||
dpcmMode=dpcmModeDefault;
|
||||
goingToLoop=false;
|
||||
countMode=false;
|
||||
|
||||
|
@ -709,6 +709,8 @@ void DivPlatformNES::setFlags(const DivConfig& flags) {
|
|||
for (int i=0; i<5; i++) {
|
||||
oscBuf[i]->rate=rate/32;
|
||||
}
|
||||
|
||||
dpcmModeDefault=flags.getBool("dpcmMode",true);
|
||||
}
|
||||
|
||||
void DivPlatformNES::notifyInsDeletion(void* ins) {
|
||||
|
|
|
@ -53,6 +53,7 @@ class DivPlatformNES: public DivDispatch {
|
|||
unsigned char writeOscBuf;
|
||||
unsigned char apuType;
|
||||
bool dpcmMode;
|
||||
bool dpcmModeDefault;
|
||||
bool dacAntiClickOn;
|
||||
bool useNP;
|
||||
bool goingToLoop;
|
||||
|
|
|
@ -485,9 +485,9 @@ bool DivSample::initInternal(DivSampleDepth d, int count) {
|
|||
break;
|
||||
case DIV_SAMPLE_DEPTH_1BIT_DPCM: // DPCM
|
||||
if (dataDPCM!=NULL) delete[] dataDPCM;
|
||||
lengthDPCM=(count+7)/8;
|
||||
lengthDPCM=1+((((count+7)/8)+15)&(~15));
|
||||
dataDPCM=new unsigned char[lengthDPCM];
|
||||
memset(dataDPCM,0,lengthDPCM);
|
||||
memset(dataDPCM,0xaa,lengthDPCM);
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_YMZ_ADPCM: // YMZ ADPCM
|
||||
if (dataZ!=NULL) delete[] dataZ;
|
||||
|
@ -1092,12 +1092,14 @@ void DivSample::render(unsigned int formatMask) {
|
|||
if (NOT_IN_FORMAT(DIV_SAMPLE_DEPTH_1BIT_DPCM)) { // DPCM
|
||||
if (!initInternal(DIV_SAMPLE_DEPTH_1BIT_DPCM,samples)) return;
|
||||
int accum=63;
|
||||
int next=63;
|
||||
for (unsigned int i=0; i<samples; i++) {
|
||||
int next=((unsigned short)(data16[i]^0x8000))>>9;
|
||||
next=((unsigned short)(data16[i]^0x8000))>>9;
|
||||
if (next>accum) {
|
||||
dataDPCM[i>>3]|=1<<(i&7);
|
||||
accum++;
|
||||
} else {
|
||||
dataDPCM[i>>3]&=~(1<<(i&7));
|
||||
accum--;
|
||||
}
|
||||
if (accum<0) accum=0;
|
||||
|
|
|
@ -699,7 +699,7 @@ void DivEngine::registerSystems() {
|
|||
sysDefs[DIV_SYSTEM_NES]=new DivSysDef(
|
||||
"NES (Ricoh 2A03)", NULL, 0x06, 0x06, 5, false, true, 0x161, false, (1U<<DIV_SAMPLE_DEPTH_1BIT_DPCM)|(1U<<DIV_SAMPLE_DEPTH_8BIT),
|
||||
"also known as Famicom in Japan, it's the most well-known game console of the '80's.",
|
||||
{"Pulse 1", "Pulse 2", "Triangle", "Noise", "PCM"},
|
||||
{"Pulse 1", "Pulse 2", "Triangle", "Noise", "DPCM"},
|
||||
{"S1", "S2", "TR", "NO", "PCM"},
|
||||
{DIV_CH_PULSE, DIV_CH_PULSE, DIV_CH_WAVE, DIV_CH_NOISE, DIV_CH_PCM},
|
||||
{DIV_INS_NES, DIV_INS_NES, DIV_INS_NES, DIV_INS_NES, DIV_INS_AMIGA},
|
||||
|
|
|
@ -456,6 +456,9 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
case DIV_SYSTEM_FDS:
|
||||
case DIV_SYSTEM_MMC5: {
|
||||
int clockSel=flags.getInt("clockSel",0);
|
||||
bool dpcmMode=flags.getBool("dpcmMode",true);
|
||||
|
||||
ImGui::Text("Clock rate:");
|
||||
|
||||
if (ImGui::RadioButton("NTSC (1.79MHz)",clockSel==0)) {
|
||||
clockSel=0;
|
||||
|
@ -470,9 +473,21 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
altered=true;
|
||||
}
|
||||
|
||||
ImGui::Text("DPCM channel mode:");
|
||||
|
||||
if (ImGui::RadioButton("DPCM (muffled samples; low CPU usage)",dpcmMode)) {
|
||||
dpcmMode=true;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton("PCM (crisp samples; high CPU usage)",!dpcmMode)) {
|
||||
dpcmMode=false;
|
||||
altered=true;
|
||||
}
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
flags.set("clockSel",clockSel);
|
||||
flags.set("dpcmMode",dpcmMode);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue