dev145 - Namco WSG: new noise strategy for C30

This commit is contained in:
tildearrow 2023-03-09 02:55:16 -05:00
parent 3cede1c2fd
commit 8c706f71a9
5 changed files with 40 additions and 5 deletions

View File

@ -47,8 +47,8 @@
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
#define BUSY_END isBusy.unlock(); softLocked=false;
#define DIV_VERSION "0.6pre4-hotfix"
#define DIV_ENGINE_VERSION 144
#define DIV_VERSION "dev145"
#define DIV_ENGINE_VERSION 145
// for imports
#define DIV_VERSION_MOD 0xff01
#define DIV_VERSION_FC 0xff02

View File

@ -2678,6 +2678,15 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
}
}
// Namco C30 noise compat
if (ds.version<145) {
for (int i=0; i<ds.systemLen; i++) {
if (ds.system[i]==DIV_SYSTEM_NAMCO_CUS30) {
ds.systemFlags[i].set("newNoise",false);
}
}
}
if (active) quitDispatch();
BUSY_BEGIN_SOFT;
saveLock.lock();

View File

@ -316,9 +316,16 @@ void DivPlatformNamcoWSG::tick(bool sysTick) {
rWrite((i<<3)+0x100,0);
rWrite((i<<3)+0x104,(chan[(i+1)&7].noise?0x80:0));
}
rWrite((i<<3)+0x103,chan[i].freq&0xff);
rWrite((i<<3)+0x102,(chan[i].freq>>8)&0xff);
rWrite((i<<3)+0x101,((chan[i].freq>>16)&15)|(i<<4));
if (chan[i].noise && newNoise) {
int noiseFreq=chan[i].freq>>9;
if (noiseFreq<0) noiseFreq=0;
if (noiseFreq>255) noiseFreq=255;
rWrite((i<<3)+0x103,noiseFreq);
} else {
rWrite((i<<3)+0x103,chan[i].freq&0xff);
rWrite((i<<3)+0x102,(chan[i].freq>>8)&0xff);
rWrite((i<<3)+0x101,((chan[i].freq>>16)&15)|(i<<4));
}
}
break;
}
@ -544,6 +551,7 @@ void DivPlatformNamcoWSG::setFlags(const DivConfig& flags) {
for (int i=0; i<chans; i++) {
oscBuf[i]->rate=rate;
}
newNoise=flags.getBool("newNoise",true);
}
void DivPlatformNamcoWSG::poke(unsigned int addr, unsigned short val) {

View File

@ -49,6 +49,7 @@ class DivPlatformNamcoWSG: public DivDispatch {
namco_audio_device* namco;
int devType, chans;
bool newNoise;
unsigned char regPool[512];
void updateWave(int ch);
friend void putDispatchChip(void*,int);

View File

@ -1704,6 +1704,20 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
}
break;
}
case DIV_SYSTEM_NAMCO_CUS30: {
bool newNoise=flags.getBool("newNoise",true);
if (InvCheckbox("Compatible noise frequencies",&newNoise)) {
altered=true;
}
if (altered) {
e->lockSave([&]() {
flags.set("newNoise",newNoise);
});
}
break;
}
case DIV_SYSTEM_SM8521:/* {
bool noAntiClick=flags.getBool("noAntiClick",false);
@ -1724,11 +1738,14 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
case DIV_SYSTEM_VBOY:
case DIV_SYSTEM_GA20:
case DIV_SYSTEM_PV1000:
case DIV_SYSTEM_NAMCO:
case DIV_SYSTEM_NAMCO_15XX:
ImGui::Text("nothing to configure");
break;
case DIV_SYSTEM_VERA:
case DIV_SYSTEM_YMU759:
supportsCustomRate=false;
ImGui::Text("nothing to configure");
break;
default: {
bool sysPal=flags.getInt("clockSel",0);