chip flags rewrite, part 4 - DO NOT USE

the next part is to drop systemFlagsOld completely
and then to fix the GUI
This commit is contained in:
tildearrow 2022-09-29 20:13:40 -05:00
parent ee6e0aa0e0
commit 48db9a1d0c
109 changed files with 532 additions and 377 deletions

View file

@ -76,6 +76,8 @@ additional guidelines:
- I will run a test suite to make sure this is the case. - I will run a test suite to make sure this is the case.
- if something breaks, you might want to add a compatibility flag (this requires changing the format though). - if something breaks, you might want to add a compatibility flag (this requires changing the format though).
- do not use `#pragma once`. - do not use `#pragma once`.
- on a switch block, **always** put `default` last and not in any other position.
- I have fear of some C/C++ compilers ignoring the rest of cases upon hitting default.
## Demo Songs ## Demo Songs

View file

@ -48,6 +48,41 @@ String DivConfig::toString() {
return ret; return ret;
} }
const char* base64Table="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
String DivConfig::toBase64() {
String data=toString();
String ret;
ret.reserve((2+data.size()*4)/3);
unsigned int groupOfThree=0;
unsigned char pos=0;
for (char& i: data) {
groupOfThree|=((unsigned char)i)<<((2-pos)<<3);
if (++pos>=3) {
pos=0;
ret+=base64Table[(groupOfThree>>18)&63];
ret+=base64Table[(groupOfThree>>12)&63];
ret+=base64Table[(groupOfThree>>6)&63];
ret+=base64Table[groupOfThree&63];
groupOfThree=0;
}
}
if (pos==2) {
ret+=base64Table[(groupOfThree>>18)&63];
ret+=base64Table[(groupOfThree>>12)&63];
ret+=base64Table[(groupOfThree>>6)&63];
ret+='=';
} else if (pos==1) {
ret+=base64Table[(groupOfThree>>18)&63];
ret+=base64Table[(groupOfThree>>12)&63];
ret+="==";
}
return ret;
}
void DivConfig::parseLine(const char* line) { void DivConfig::parseLine(const char* line) {
String key=""; String key="";
String value=""; String value="";
@ -105,7 +140,41 @@ bool DivConfig::loadFromMemory(const char* buf) {
return true; return true;
} }
bool DivConfig::getBool(String key, bool fallback) { bool DivConfig::loadFromBase64(const char* buf) {
String data;
unsigned int groupOfThree=0;
signed char pos=18;
for (const char* i=buf; *i; i++) {
unsigned char nextVal=0;
if ((*i)=='/') {
nextVal=63;
} else if ((*i)=='+') {
nextVal=62;
} else if ((*i)>='0' && (*i)<='9') {
nextVal=52+((*i)-'0');
} else if ((*i)>='a' && (*i)<='z') {
nextVal=26+((*i)-'a');
} else if ((*i)>='A' && (*i)<='Z') {
nextVal=((*i)-'A');
} else {
nextVal=0;
}
groupOfThree|=nextVal<<pos;
pos-=6;
if (pos<0) {
pos=18;
if ((groupOfThree>>16)&0xff) data+=(groupOfThree>>16)&0xff;
if ((groupOfThree>>8)&0xff) data+=(groupOfThree>>8)&0xff;
if (groupOfThree&0xff) data+=groupOfThree&0xff;
groupOfThree=0;
}
}
return loadFromMemory(data.c_str());
}
bool DivConfig::getBool(String key, bool fallback) const {
try { try {
String val=conf.at(key); String val=conf.at(key);
if (val=="true") { if (val=="true") {
@ -118,7 +187,7 @@ bool DivConfig::getBool(String key, bool fallback) {
return fallback; return fallback;
} }
int DivConfig::getInt(String key, int fallback) { int DivConfig::getInt(String key, int fallback) const {
try { try {
String val=conf.at(key); String val=conf.at(key);
int ret=std::stoi(val); int ret=std::stoi(val);
@ -129,7 +198,7 @@ int DivConfig::getInt(String key, int fallback) {
return fallback; return fallback;
} }
float DivConfig::getFloat(String key, float fallback) { float DivConfig::getFloat(String key, float fallback) const {
try { try {
String val=conf.at(key); String val=conf.at(key);
float ret=std::stof(val); float ret=std::stof(val);
@ -140,7 +209,7 @@ float DivConfig::getFloat(String key, float fallback) {
return fallback; return fallback;
} }
double DivConfig::getDouble(String key, double fallback) { double DivConfig::getDouble(String key, double fallback) const {
try { try {
String val=conf.at(key); String val=conf.at(key);
double ret=std::stod(val); double ret=std::stod(val);
@ -151,7 +220,7 @@ double DivConfig::getDouble(String key, double fallback) {
return fallback; return fallback;
} }
String DivConfig::getString(String key, String fallback) { String DivConfig::getString(String key, String fallback) const {
try { try {
String val=conf.at(key); String val=conf.at(key);
return val; return val;

View file

@ -29,16 +29,18 @@ class DivConfig {
public: public:
// config loading/saving // config loading/saving
bool loadFromMemory(const char* buf); bool loadFromMemory(const char* buf);
bool loadFromBase64(const char* buf);
bool loadFromFile(const char* path, bool createOnFail=true); bool loadFromFile(const char* path, bool createOnFail=true);
String toString(); String toString();
String toBase64();
bool save(const char* path); bool save(const char* path);
// get a config value // get a config value
bool getBool(String key, bool fallback); bool getBool(String key, bool fallback) const;
int getInt(String key, int fallback); int getInt(String key, int fallback) const;
float getFloat(String key, float fallback); float getFloat(String key, float fallback) const;
double getDouble(String key, double fallback); double getDouble(String key, double fallback) const;
String getString(String key, String fallback); String getString(String key, String fallback) const;
// set a config value // set a config value
void set(String key, bool value); void set(String key, bool value);

View file

@ -23,6 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <vector> #include <vector>
#include "config.h"
#define ONE_SEMITONE 2200 #define ONE_SEMITONE 2200
@ -434,9 +435,9 @@ class DivDispatch {
/** /**
* set the chip flags. * set the chip flags.
* @param flags the flags. see song.h for possible values. * @param flags a DivConfig containing chip flags.
*/ */
virtual void setFlags(unsigned int flags); virtual void setFlags(const DivConfig& flags);
/** /**
* set skip reg writes. * set skip reg writes.
@ -522,10 +523,10 @@ class DivDispatch {
* @param parent the parent DivEngine. * @param parent the parent DivEngine.
* @param channels the number of channels to acquire. * @param channels the number of channels to acquire.
* @param sugRate the suggested rate. this may change, so don't rely on it. * @param sugRate the suggested rate. this may change, so don't rely on it.
* @param flags the chip flags. see song.h for possible values. * @param flags a DivConfig containing chip flags.
* @return the number of channels allocated. * @return the number of channels allocated.
*/ */
virtual int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
/** /**
* quit the DivDispatch. * quit the DivDispatch.

View file

@ -157,7 +157,7 @@ void DivDispatchContainer::clear() {
prevSample[1]=temp[1];*/ prevSample[1]=temp[1];*/
} }
void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, double gotRate, unsigned int flags) { void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, double gotRate, const DivConfig& flags) {
if (dispatch!=NULL) return; if (dispatch!=NULL) return;
bb[0]=blip_new(32768); bb[0]=blip_new(32768);

View file

@ -3467,12 +3467,77 @@ void DivEngine::setOrder(unsigned char order) {
BUSY_END; BUSY_END;
} }
void DivEngine::setSysFlags(int system, unsigned int flags, bool restart) { void DivEngine::setSysFlags(int system, String key, bool value, bool restart) {
BUSY_BEGIN_SOFT; BUSY_BEGIN_SOFT;
saveLock.lock(); saveLock.lock();
song.systemFlagsOld[system]=flags; song.systemFlags[system].set(key,value);
saveLock.unlock(); saveLock.unlock();
disCont[system].dispatch->setFlags(song.systemFlagsOld[system]); disCont[system].dispatch->setFlags(song.systemFlags[system]);
disCont[system].setRates(got.rate);
if (restart && isPlaying()) {
playSub(false);
}
BUSY_END;
}
void DivEngine::setSysFlags(int system, String key, int value, bool restart) {
BUSY_BEGIN_SOFT;
saveLock.lock();
song.systemFlags[system].set(key,value);
saveLock.unlock();
disCont[system].dispatch->setFlags(song.systemFlags[system]);
disCont[system].setRates(got.rate);
if (restart && isPlaying()) {
playSub(false);
}
BUSY_END;
}
void DivEngine::setSysFlags(int system, String key, float value, bool restart) {
BUSY_BEGIN_SOFT;
saveLock.lock();
song.systemFlags[system].set(key,value);
saveLock.unlock();
disCont[system].dispatch->setFlags(song.systemFlags[system]);
disCont[system].setRates(got.rate);
if (restart && isPlaying()) {
playSub(false);
}
BUSY_END;
}
void DivEngine::setSysFlags(int system, String key, double value, bool restart) {
BUSY_BEGIN_SOFT;
saveLock.lock();
song.systemFlags[system].set(key,value);
saveLock.unlock();
disCont[system].dispatch->setFlags(song.systemFlags[system]);
disCont[system].setRates(got.rate);
if (restart && isPlaying()) {
playSub(false);
}
BUSY_END;
}
void DivEngine::setSysFlags(int system, String key, const char* value, bool restart) {
BUSY_BEGIN_SOFT;
saveLock.lock();
song.systemFlags[system].set(key,value);
saveLock.unlock();
disCont[system].dispatch->setFlags(song.systemFlags[system]);
disCont[system].setRates(got.rate);
if (restart && isPlaying()) {
playSub(false);
}
BUSY_END;
}
void DivEngine::setSysFlags(int system, String key, String value, bool restart) {
BUSY_BEGIN_SOFT;
saveLock.lock();
song.systemFlags[system].set(key,value);
saveLock.unlock();
disCont[system].dispatch->setFlags(song.systemFlags[system]);
disCont[system].setRates(got.rate); disCont[system].setRates(got.rate);
if (restart && isPlaying()) { if (restart && isPlaying()) {
playSub(false); playSub(false);
@ -3630,7 +3695,7 @@ void DivEngine::rescanAudioDevices() {
void DivEngine::initDispatch() { void DivEngine::initDispatch() {
BUSY_BEGIN; BUSY_BEGIN;
for (int i=0; i<song.systemLen; i++) { for (int i=0; i<song.systemLen; i++) {
disCont[i].init(song.system[i],this,getChannelCount(song.system[i]),got.rate,song.systemFlagsOld[i]); disCont[i].init(song.system[i],this,getChannelCount(song.system[i]),got.rate,song.systemFlags[i]);
disCont[i].setRates(got.rate); disCont[i].setRates(got.rate);
disCont[i].setQuality(lowQuality); disCont[i].setQuality(lowQuality);
} }

View file

@ -183,7 +183,7 @@ struct DivDispatchContainer {
void flush(size_t count); void flush(size_t count);
void fillBuf(size_t runtotal, size_t offset, size_t size); void fillBuf(size_t runtotal, size_t offset, size_t size);
void clear(); void clear();
void init(DivSystem sys, DivEngine* eng, int chanCount, double gotRate, unsigned int flags); void init(DivSystem sys, DivEngine* eng, int chanCount, double gotRate, const DivConfig& flags);
void quit(); void quit();
DivDispatchContainer(): DivDispatchContainer():
dispatch(NULL), dispatch(NULL),
@ -821,7 +821,12 @@ class DivEngine {
void setOrder(unsigned char order); void setOrder(unsigned char order);
// set system flags // set system flags
void setSysFlags(int system, unsigned int flags, bool restart); void setSysFlags(int system, String key, bool value, bool restart);
void setSysFlags(int system, String key, int value, bool restart);
void setSysFlags(int system, String key, float value, bool restart);
void setSysFlags(int system, String key, double value, bool restart);
void setSysFlags(int system, String key, const char* value, bool restart);
void setSysFlags(int system, String key, String value, bool restart);
// set Hz // set Hz
void setSongRate(float hz, bool pal); void setSongRate(float hz, bool pal);

View file

@ -1538,6 +1538,7 @@ void DivEngine::convertOldFlags(unsigned int oldFlags, DivConfig& newFlags, DivS
newFlags.set("echoVol",(int)((oldFlags>>24)&255)); newFlags.set("echoVol",(int)((oldFlags>>24)&255));
break; break;
case DIV_SYSTEM_PCM_DAC: case DIV_SYSTEM_PCM_DAC:
if (!oldFlags) oldFlags=0x1f0000|44099;
newFlags.set("rate",(int)((oldFlags&0xffff)+1)); newFlags.set("rate",(int)((oldFlags&0xffff)+1));
newFlags.set("outDepth",(int)((oldFlags>>16)&15)); newFlags.set("outDepth",(int)((oldFlags>>16)&15));
if (oldFlags&0x100000) newFlags.set("stereo",true); if (oldFlags&0x100000) newFlags.set("stereo",true);
@ -2982,7 +2983,10 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
ds.systemLen=(chCount+3)/4; ds.systemLen=(chCount+3)/4;
for(int i=0; i<ds.systemLen; i++) { for(int i=0; i<ds.systemLen; i++) {
ds.system[i]=DIV_SYSTEM_AMIGA; ds.system[i]=DIV_SYSTEM_AMIGA;
ds.systemFlagsOld[i]=1|(80<<8)|(bypassLimits?4:0)|((ds.systemLen>1 || bypassLimits)?2:0); // PAL ds.systemFlags[i].set("clockSel",1); // PAL
ds.systemFlags[i].set("stereoSep",80);
ds.systemFlags[i].set("bypassLimits",bypassLimits);
ds.systemFlags[i].set("chipType",(bool)(ds.systemLen>1 || bypassLimits));
} }
for(int i=0; i<chCount; i++) { for(int i=0; i<chCount; i++) {
ds.subsong[0]->chanShow[i]=true; ds.subsong[0]->chanShow[i]=true;
@ -3188,7 +3192,8 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) {
ds.system[0]=DIV_SYSTEM_AMIGA; ds.system[0]=DIV_SYSTEM_AMIGA;
ds.systemVol[0]=64; ds.systemVol[0]=64;
ds.systemPan[0]=0; ds.systemPan[0]=0;
ds.systemFlagsOld[0]=1|(80<<8); // PAL ds.systemFlags[0].set("clockSel",1); // PAL
ds.systemFlags[0].set("stereoSep",80);
ds.systemName="Amiga"; ds.systemName="Amiga";
seqLen=reader.readI_BE(); seqLen=reader.readI_BE();
@ -3828,11 +3833,11 @@ bool DivEngine::loadFTM(unsigned char* file, size_t len) {
} }
if (expansions&16) { if (expansions&16) {
ds.system[systemID]=DIV_SYSTEM_N163; ds.system[systemID]=DIV_SYSTEM_N163;
ds.systemFlagsOld[systemID++]=n163Chans; ds.systemFlags[systemID++].set("channels",(int)n163Chans);
} }
if (expansions&32) { if (expansions&32) {
ds.system[systemID]=DIV_SYSTEM_AY8910; ds.system[systemID]=DIV_SYSTEM_AY8910;
ds.systemFlagsOld[systemID++]=38; // Sunsoft 5B ds.systemFlags[systemID++].set("chipType",2); // Sunsoft 5B
} }
ds.systemLen=systemID; ds.systemLen=systemID;

View file

@ -94,7 +94,7 @@ bool DivDispatch::getWantPreNote() {
return false; return false;
} }
void DivDispatch::setFlags(unsigned int flags) { void DivDispatch::setFlags(const DivConfig& flags) {
} }
void DivDispatch::setSkipRegisterWrites(bool value) { void DivDispatch::setSkipRegisterWrites(bool value) {
@ -157,7 +157,7 @@ void DivDispatch::renderSamples() {
} }
int DivDispatch::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivDispatch::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
return 0; return 0;
} }

View file

@ -427,8 +427,8 @@ void DivPlatformAmiga::notifyInsDeletion(void* ins) {
} }
} }
void DivPlatformAmiga::setFlags(unsigned int flags) { void DivPlatformAmiga::setFlags(const DivConfig& flags) {
if (flags&1) { if (flags.getInt("clockSel",0)) {
chipClock=COLOR_PAL*4.0/5.0; chipClock=COLOR_PAL*4.0/5.0;
} else { } else {
chipClock=COLOR_NTSC; chipClock=COLOR_NTSC;
@ -437,10 +437,11 @@ void DivPlatformAmiga::setFlags(unsigned int flags) {
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;
} }
sep1=((flags>>8)&127)+127; int sep=flags.getInt("stereoSep",0)&127;
sep2=127-((flags>>8)&127); sep1=sep+127;
amigaModel=flags&2; sep2=127-sep;
bypassLimits=flags&4; amigaModel=flags.getInt("chipType",0);
bypassLimits=flags.getBool("bypassLimits",false);
if (amigaModel) { if (amigaModel) {
filtConstOff=4000; filtConstOff=4000;
filtConstOn=sin(M_PI*8000.0/(double)rate)*4096.0; filtConstOn=sin(M_PI*8000.0/(double)rate)*4096.0;
@ -450,7 +451,7 @@ void DivPlatformAmiga::setFlags(unsigned int flags) {
} }
} }
int DivPlatformAmiga::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformAmiga::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -101,12 +101,12 @@ class DivPlatformAmiga: public DivDispatch {
bool isStereo(); bool isStereo();
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
DivMacroInt* getChanMacroInt(int ch); DivMacroInt* getChanMacroInt(int ch);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsChange(int ins); void notifyInsChange(int ins);
void notifyWaveChange(int wave); void notifyWaveChange(int wave);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
}; };

View file

@ -849,13 +849,8 @@ void DivPlatformArcade::reset() {
//rWrite(0x1b,0x00); //rWrite(0x1b,0x00);
} }
void DivPlatformArcade::setFlags(unsigned int flags) { void DivPlatformArcade::setFlags(const DivConfig& flags) {
switch (flags&0xff) { switch (flags.getInt("clockSel",0)) {
default:
case 0:
chipClock=COLOR_NTSC;
baseFreqOff=0;
break;
case 1: case 1:
chipClock=COLOR_PAL*4.0/5.0; chipClock=COLOR_PAL*4.0/5.0;
baseFreqOff=12; baseFreqOff=12;
@ -864,6 +859,10 @@ void DivPlatformArcade::setFlags(unsigned int flags) {
chipClock=4000000.0; chipClock=4000000.0;
baseFreqOff=-122; baseFreqOff=-122;
break; break;
default:
chipClock=COLOR_NTSC;
baseFreqOff=0;
break;
} }
rate=chipClock/64; rate=chipClock/64;
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
@ -879,7 +878,7 @@ void DivPlatformArcade::setYMFM(bool use) {
useYMFM=use; useYMFM=use;
} }
int DivPlatformArcade::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformArcade::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -111,13 +111,13 @@ class DivPlatformArcade: public DivPlatformOPM {
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
DivMacroInt* getChanMacroInt(int ch); DivMacroInt* getChanMacroInt(int ch);
void notifyInsChange(int ins); void notifyInsChange(int ins);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
bool isStereo(); bool isStereo();
void setYMFM(bool use); void setYMFM(bool use);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformArcade(); ~DivPlatformArcade();
}; };

View file

@ -772,17 +772,13 @@ void DivPlatformAY8910::setExtClockDiv(unsigned int eclk, unsigned char ediv) {
} }
} }
void DivPlatformAY8910::setFlags(unsigned int flags) { void DivPlatformAY8910::setFlags(const DivConfig& flags) {
if (extMode) { if (extMode) {
chipClock=extClock; chipClock=extClock;
rate=chipClock/extDiv; rate=chipClock/extDiv;
} else { } else {
clockSel=(flags>>7)&1; clockSel=flags.getBool("halfClock",false);
switch (flags&15) { switch (flags.getInt("clockSel",0)) {
default:
case 0:
chipClock=COLOR_NTSC/2.0;
break;
case 1: case 1:
chipClock=COLOR_PAL*2.0/5.0; chipClock=COLOR_PAL*2.0/5.0;
break; break;
@ -825,6 +821,9 @@ void DivPlatformAY8910::setFlags(unsigned int flags) {
case 14: case 14:
chipClock=1536000; chipClock=1536000;
break; break;
default:
chipClock=COLOR_NTSC/2.0;
break;
} }
rate=chipClock/8; rate=chipClock/8;
} }
@ -833,7 +832,7 @@ void DivPlatformAY8910::setFlags(unsigned int flags) {
} }
if (ay!=NULL) delete ay; if (ay!=NULL) delete ay;
switch ((flags>>4)&3) { switch (flags.getInt("chipType",0)) {
case 1: case 1:
ay=new ym2149_device(rate,clockSel); ay=new ym2149_device(rate,clockSel);
sunsoft=false; sunsoft=false;
@ -858,11 +857,11 @@ void DivPlatformAY8910::setFlags(unsigned int flags) {
ay->device_start(); ay->device_start();
ay->device_reset(); ay->device_reset();
stereo=(flags>>6)&1; stereo=flags.getBool("stereo",false);
stereoSep=(flags>>8)&255; stereoSep=flags.getInt("stereoSep",0)&255;
} }
int DivPlatformAY8910::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformAY8910::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -162,7 +162,7 @@ class DivPlatformAY8910: public DivDispatch {
void forceIns(); void forceIns();
void tick(bool sysTick=true); void tick(bool sysTick=true);
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
bool isStereo(); bool isStereo();
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
DivMacroInt* getChanMacroInt(int ch); DivMacroInt* getChanMacroInt(int ch);
@ -171,7 +171,7 @@ class DivPlatformAY8910: public DivDispatch {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
DivPlatformAY8910(bool useExtMode=false, unsigned int eclk=COLOR_NTSC, unsigned char ediv=8): DivPlatformAY8910(bool useExtMode=false, unsigned int eclk=COLOR_NTSC, unsigned char ediv=8):
DivDispatch(), DivDispatch(),

View file

@ -761,9 +761,9 @@ void DivPlatformAY8930::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) immWrite(i.addr,i.val); for (DivRegWrite& i: wlist) immWrite(i.addr,i.val);
} }
void DivPlatformAY8930::setFlags(unsigned int flags) { void DivPlatformAY8930::setFlags(const DivConfig& flags) {
clockSel=(flags>>7)&1; clockSel=flags.getBool("halfClock",false);
switch (flags&15) { switch (flags.getInt("clockSel",0)) {
case 1: case 1:
chipClock=COLOR_PAL*2.0/5.0; chipClock=COLOR_PAL*2.0/5.0;
break; break;
@ -809,11 +809,11 @@ void DivPlatformAY8930::setFlags(unsigned int flags) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;
} }
stereo=(flags>>6)&1; stereo=flags.getBool("stereo",false);
stereoSep=(flags>>8)&255; stereoSep=flags.getInt("stereoSep",0)&255;
} }
int DivPlatformAY8930::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformAY8930::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -164,7 +164,7 @@ class DivPlatformAY8930: public DivDispatch {
void forceIns(); void forceIns();
void tick(bool sysTick=true); void tick(bool sysTick=true);
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
bool isStereo(); bool isStereo();
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
DivMacroInt* getChanMacroInt(int ch); DivMacroInt* getChanMacroInt(int ch);
@ -172,7 +172,7 @@ class DivPlatformAY8930: public DivDispatch {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
}; };
#endif #endif

View file

@ -321,7 +321,7 @@ void DivPlatformBubSysWSG::notifyInsDeletion(void* ins) {
} }
} }
void DivPlatformBubSysWSG::setFlags(unsigned int flags) { void DivPlatformBubSysWSG::setFlags(const DivConfig& flags) {
chipClock=COLOR_NTSC; chipClock=COLOR_NTSC;
rate=chipClock; rate=chipClock;
for (int i=0; i<2; i++) { for (int i=0; i<2; i++) {
@ -337,7 +337,7 @@ void DivPlatformBubSysWSG::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
int DivPlatformBubSysWSG::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformBubSysWSG::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -80,13 +80,13 @@ class DivPlatformBubSysWSG: public DivDispatch {
bool isStereo(); bool isStereo();
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
DivMacroInt* getChanMacroInt(int ch); DivMacroInt* getChanMacroInt(int ch);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyWaveChange(int wave); void notifyWaveChange(int wave);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformBubSysWSG(); ~DivPlatformBubSysWSG();
}; };

View file

@ -531,8 +531,8 @@ void DivPlatformC64::setFP(bool fp) {
isFP=fp; isFP=fp;
} }
void DivPlatformC64::setFlags(unsigned int flags) { void DivPlatformC64::setFlags(const DivConfig& flags) {
switch (flags&0xf) { switch (flags.getInt("clockSel",0)) {
case 0x0: // NTSC C64 case 0x0: // NTSC C64
rate=COLOR_NTSC*2.0/7.0; rate=COLOR_NTSC*2.0/7.0;
break; break;
@ -554,7 +554,7 @@ void DivPlatformC64::setFlags(unsigned int flags) {
} }
} }
int DivPlatformC64::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformC64::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -101,7 +101,7 @@ class DivPlatformC64: public DivDispatch {
void forceIns(); void forceIns();
void tick(bool sysTick=true); void tick(bool sysTick=true);
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsChange(int ins); void notifyInsChange(int ins);
bool getDCOffRequired(); bool getDCOffRequired();
bool getWantPreNote(); bool getWantPreNote();
@ -111,7 +111,7 @@ class DivPlatformC64: public DivDispatch {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void setChipModel(bool is6581); void setChipModel(bool is6581);
void setFP(bool fp); void setFP(bool fp);
void quit(); void quit();

View file

@ -138,7 +138,7 @@ void DivPlatformDummy::reset() {
} }
} }
int DivPlatformDummy::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformDummy::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -44,7 +44,7 @@ class DivPlatformDummy: public DivDispatch {
DivDispatchOscBuffer* getOscBuffer(int chan); DivDispatchOscBuffer* getOscBuffer(int chan);
void reset(); void reset();
void tick(bool sysTick=true); void tick(bool sysTick=true);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformDummy(); ~DivPlatformDummy();
}; };

View file

@ -451,10 +451,11 @@ void DivPlatformFDS::setNSFPlay(bool use) {
useNP=use; useNP=use;
} }
void DivPlatformFDS::setFlags(unsigned int flags) { void DivPlatformFDS::setFlags(const DivConfig& flags) {
if (flags==2) { // Dendy int clockSel=flags.getInt("clockSel",0);
if (clockSel==2) { // Dendy
rate=COLOR_PAL*2.0/5.0; rate=COLOR_PAL*2.0/5.0;
} else if (flags==1) { // PAL } else if (clockSel==1) { // PAL
rate=COLOR_PAL*3.0/8.0; rate=COLOR_PAL*3.0/8.0;
} else { // NTSC } else { // NTSC
rate=COLOR_NTSC/2.0; rate=COLOR_NTSC/2.0;
@ -485,9 +486,8 @@ void DivPlatformFDS::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
int DivPlatformFDS::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformFDS::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
apuType=flags;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;
writeOscBuf=0; writeOscBuf=0;

View file

@ -69,7 +69,6 @@ class DivPlatformFDS: public DivDispatch {
DivDispatchOscBuffer* oscBuf; DivDispatchOscBuffer* oscBuf;
bool isMuted[1]; bool isMuted[1];
DivWaveSynth ws; DivWaveSynth ws;
unsigned char apuType;
unsigned char writeOscBuf; unsigned char writeOscBuf;
bool useNP; bool useNP;
struct _fds* fds; struct _fds* fds;
@ -99,13 +98,13 @@ class DivPlatformFDS: public DivDispatch {
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
void setNSFPlay(bool use); void setNSFPlay(bool use);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
float getPostAmp(); float getPostAmp();
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformFDS(); ~DivPlatformFDS();
}; };

View file

@ -106,6 +106,8 @@ class DivPlatformOPN: public DivPlatformFMBase {
unsigned int ayDiv; unsigned int ayDiv;
bool extSys; bool extSys;
DivConfig ayFlags;
DivPlatformOPN(double f=9440540.0, unsigned int d=72, unsigned int a=32, bool isExtSys=false): DivPlatformOPN(double f=9440540.0, unsigned int d=72, unsigned int a=32, bool isExtSys=false):
DivPlatformFMBase(), DivPlatformFMBase(),
fmFreqBase(f), fmFreqBase(f),

View file

@ -629,9 +629,9 @@ void DivPlatformGB::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) immWrite(i.addr,i.val); for (DivRegWrite& i: wlist) immWrite(i.addr,i.val);
} }
void DivPlatformGB::setFlags(unsigned int flags) { void DivPlatformGB::setFlags(const DivConfig& flags) {
antiClickEnabled=!(flags&8); antiClickEnabled=!flags.getBool("noAntiClick",false);
switch (flags&3) { switch (flags.getInt("chipType",0)) {
case 0: case 0:
model=GB_MODEL_DMG_B; model=GB_MODEL_DMG_B;
break; break;
@ -647,7 +647,7 @@ void DivPlatformGB::setFlags(unsigned int flags) {
} }
} }
int DivPlatformGB::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformGB::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
chipClock=4194304; chipClock=4194304;
rate=chipClock/16; rate=chipClock/16;
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {

View file

@ -116,8 +116,8 @@ class DivPlatformGB: public DivDispatch {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformGB(); ~DivPlatformGB();
}; };

View file

@ -1186,16 +1186,25 @@ void DivPlatformGenesis::setSoftPCM(bool value) {
softPCM=value; softPCM=value;
} }
void DivPlatformGenesis::setFlags(unsigned int flags) { void DivPlatformGenesis::setFlags(const DivConfig& flags) {
switch (flags&(~0x80000000)) { switch (flags.getInt("clockSel",0)) {
case 1:
chipClock=COLOR_PAL*12.0/7.0;
break;
case 2:
chipClock=8000000.0;
break;
case 3:
chipClock=COLOR_NTSC*12.0/7.0;
break;
case 4:
chipClock=COLOR_NTSC*9.0/4.0;
break;
default: default:
case 0: chipClock=COLOR_NTSC*15.0/7.0; break; chipClock=COLOR_NTSC*15.0/7.0;
case 1: chipClock=COLOR_PAL*12.0/7.0; break; break;
case 2: chipClock=8000000.0; break;
case 3: chipClock=COLOR_NTSC*12.0/7.0; break;
case 4: chipClock=COLOR_NTSC*9.0/4.0; break;
} }
ladder=flags&0x80000000; ladder=flags.getBool("ladderEffect",false);
OPN2_SetChipType(ladder?ym3438_mode_ym2612:0); OPN2_SetChipType(ladder?ym3438_mode_ym2612:0);
if (useYMFM) { if (useYMFM) {
if (fm_ymfm!=NULL) delete fm_ymfm; if (fm_ymfm!=NULL) delete fm_ymfm;
@ -1213,7 +1222,7 @@ void DivPlatformGenesis::setFlags(unsigned int flags) {
} }
} }
int DivPlatformGenesis::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformGenesis::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
ladder=false; ladder=false;

View file

@ -140,14 +140,14 @@ class DivPlatformGenesis: public DivPlatformOPN {
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
bool keyOffAffectsPorta(int ch); bool keyOffAffectsPorta(int ch);
void toggleRegisterDump(bool enable); void toggleRegisterDump(bool enable);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsChange(int ins); void notifyInsChange(int ins);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void setSoftPCM(bool value); void setSoftPCM(bool value);
int getPortaFloor(int ch); int getPortaFloor(int ch);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
DivPlatformGenesis(): DivPlatformGenesis():
DivPlatformOPN(9440540.0, 72, 32) {} DivPlatformOPN(9440540.0, 72, 32) {}

View file

@ -630,7 +630,7 @@ int DivPlatformGenesisExt::getPortaFloor(int ch) {
return (ch>8)?12:0; return (ch>8)?12:0;
} }
int DivPlatformGenesisExt::init(DivEngine* parent, int channels, int sugRate, unsigned int flags) { int DivPlatformGenesisExt::init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) {
DivPlatformGenesis::init(parent,channels,sugRate,flags); DivPlatformGenesis::init(parent,channels,sugRate,flags);
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
isOpMuted[i]=false; isOpMuted[i]=false;

View file

@ -67,7 +67,7 @@ class DivPlatformGenesisExt: public DivPlatformGenesis {
bool keyOffAffectsPorta(int ch); bool keyOffAffectsPorta(int ch);
void notifyInsChange(int ins); void notifyInsChange(int ins);
int getPortaFloor(int ch); int getPortaFloor(int ch);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformGenesisExt(); ~DivPlatformGenesisExt();
}; };

View file

@ -460,7 +460,7 @@ void DivPlatformLynx::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr, i.val); for (DivRegWrite& i: wlist) rWrite(i.addr, i.val);
} }
int DivPlatformLynx::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformLynx::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -107,7 +107,7 @@ class DivPlatformLynx: public DivDispatch {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformLynx(); ~DivPlatformLynx();
}; };

View file

@ -386,10 +386,11 @@ bool DivPlatformMMC5::keyOffAffectsArp(int ch) {
return true; return true;
} }
void DivPlatformMMC5::setFlags(unsigned int flags) { void DivPlatformMMC5::setFlags(const DivConfig& flags) {
if (flags==2) { // Dendy int clockSel=flags.getInt("clockSel",0);
if (clockSel==2) { // Dendy
rate=COLOR_PAL*2.0/5.0; rate=COLOR_PAL*2.0/5.0;
} else if (flags==1) { // PAL } else if (clockSel==1) { // PAL
rate=COLOR_PAL*3.0/8.0; rate=COLOR_PAL*3.0/8.0;
} else { // NTSC } else { // NTSC
rate=COLOR_NTSC/2.0; rate=COLOR_NTSC/2.0;
@ -414,9 +415,8 @@ void DivPlatformMMC5::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
int DivPlatformMMC5::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformMMC5::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
apuType=flags;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;
writeOscBuf=0; writeOscBuf=0;

View file

@ -63,7 +63,6 @@ class DivPlatformMMC5: public DivDispatch {
unsigned int dacPos; unsigned int dacPos;
int dacSample; int dacSample;
unsigned char sampleBank; unsigned char sampleBank;
unsigned char apuType;
unsigned char writeOscBuf; unsigned char writeOscBuf;
struct _mmc5* mmc5; struct _mmc5* mmc5;
unsigned char regPool[128]; unsigned char regPool[128];
@ -85,12 +84,12 @@ class DivPlatformMMC5: public DivDispatch {
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
float getPostAmp(); float getPostAmp();
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformMMC5(); ~DivPlatformMMC5();
}; };

View file

@ -387,8 +387,8 @@ void DivPlatformMSM6258::renderSamples() {
adpcmMemLen=memPos+256; adpcmMemLen=memPos+256;
} }
void DivPlatformMSM6258::setFlags(unsigned int flags) { void DivPlatformMSM6258::setFlags(const DivConfig& flags) {
switch (flags) { switch (flags.getInt("clockSel",0)) {
case 3: case 3:
chipClock=8192000; chipClock=8192000;
break; break;
@ -408,7 +408,7 @@ void DivPlatformMSM6258::setFlags(unsigned int flags) {
} }
} }
int DivPlatformMSM6258::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformMSM6258::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
adpcmMem=new unsigned char[getSampleMemCapacity(0)]; adpcmMem=new unsigned char[getSampleMemCapacity(0)];
adpcmMemLen=0; adpcmMemLen=0;

View file

@ -108,14 +108,14 @@ class DivPlatformMSM6258: public DivDispatch {
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
const char** getRegisterSheet(); const char** getRegisterSheet();
const void* getSampleMem(int index); const void* getSampleMem(int index);
size_t getSampleMemCapacity(int index); size_t getSampleMemCapacity(int index);
size_t getSampleMemUsage(int index); size_t getSampleMemUsage(int index);
void renderSamples(); void renderSamples();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformMSM6258(); ~DivPlatformMSM6258();
}; };

View file

@ -376,13 +376,9 @@ void DivPlatformMSM6295::renderSamples() {
} }
} }
void DivPlatformMSM6295::setFlags(unsigned int flags) { void DivPlatformMSM6295::setFlags(const DivConfig& flags) {
rateSelInit=(flags>>7)&1; rateSelInit=flags.getBool("rateSel",false);
switch (flags&0x7f) { switch (flags.getInt("clockSel",0)) {
default:
case 0:
chipClock=4000000/4;
break;
case 1: case 1:
chipClock=4224000/4; chipClock=4224000/4;
break; break;
@ -425,6 +421,9 @@ void DivPlatformMSM6295::setFlags(unsigned int flags) {
case 14: case 14:
chipClock=COLOR_NTSC/3.0; chipClock=COLOR_NTSC/3.0;
break; break;
default:
chipClock=4000000/4;
break;
} }
rate=chipClock/3; rate=chipClock/3;
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
@ -436,7 +435,7 @@ void DivPlatformMSM6295::setFlags(unsigned int flags) {
} }
} }
int DivPlatformMSM6295::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformMSM6295::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
adpcmMem=new unsigned char[getSampleMemCapacity(0)]; adpcmMem=new unsigned char[getSampleMemCapacity(0)];
adpcmMemLen=0; adpcmMemLen=0;

View file

@ -96,14 +96,14 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf {
virtual void notifyInsDeletion(void* ins) override; virtual void notifyInsDeletion(void* ins) override;
virtual void poke(unsigned int addr, unsigned short val) override; virtual void poke(unsigned int addr, unsigned short val) override;
virtual void poke(std::vector<DivRegWrite>& wlist) override; virtual void poke(std::vector<DivRegWrite>& wlist) override;
virtual void setFlags(unsigned int flags) override; virtual void setFlags(const DivConfig& flags) override;
virtual const char** getRegisterSheet() override; virtual const char** getRegisterSheet() override;
virtual const void* getSampleMem(int index) override; virtual const void* getSampleMem(int index) override;
virtual size_t getSampleMemCapacity(int index) override; virtual size_t getSampleMemCapacity(int index) override;
virtual size_t getSampleMemUsage(int index) override; virtual size_t getSampleMemUsage(int index) override;
virtual void renderSamples() override; virtual void renderSamples() override;
virtual int init(DivEngine* parent, int channels, int sugRate, unsigned int flags) override; virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;
virtual void quit() override; virtual void quit() override;
DivPlatformMSM6295(): DivPlatformMSM6295():
DivDispatch(), DivDispatch(),

View file

@ -621,20 +621,20 @@ void DivPlatformN163::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
void DivPlatformN163::setFlags(unsigned int flags) { void DivPlatformN163::setFlags(const DivConfig& flags) {
switch (flags&0xf) { switch (flags.getInt("clockSel",0)) {
case 0x0: // NTSC case 1: // PAL
rate=COLOR_NTSC/2.0;
break;
case 0x1: // PAL
rate=COLOR_PAL*3.0/8.0; rate=COLOR_PAL*3.0/8.0;
break; break;
case 0x2: // Dendy case 2: // Dendy
rate=COLOR_PAL*2.0/5.0; rate=COLOR_PAL*2.0/5.0;
break; break;
default: // NTSC
rate=COLOR_NTSC/2.0;
break;
} }
initChanMax=chanMax=(flags>>4)&7; initChanMax=chanMax=flags.getInt("channels",0)&7;
multiplex=((flags>>7)&1)?false:true; // not accurate in real hardware multiplex=!flags.getBool("multiplex",false); // not accurate in real hardware
chipClock=rate; chipClock=rate;
rate/=15; rate/=15;
n163.set_multiplex(multiplex); n163.set_multiplex(multiplex);
@ -647,7 +647,7 @@ void DivPlatformN163::setFlags(unsigned int flags) {
reset(); reset();
} }
int DivPlatformN163::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformN163::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -104,14 +104,14 @@ class DivPlatformN163: public DivDispatch {
void forceIns(); void forceIns();
void tick(bool sysTick=true); void tick(bool sysTick=true);
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyWaveChange(int wave); void notifyWaveChange(int wave);
void notifyInsChange(int ins); void notifyInsChange(int ins);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformN163(); ~DivPlatformN163();
}; };

View file

@ -530,7 +530,7 @@ void DivPlatformNamcoWSG::setDeviceType(int type) {
} }
} }
void DivPlatformNamcoWSG::setFlags(unsigned int flags) { void DivPlatformNamcoWSG::setFlags(const DivConfig& flags) {
chipClock=3072000; chipClock=3072000;
rate=chipClock/32; rate=chipClock/32;
namco->device_clock_changed(rate); namco->device_clock_changed(rate);
@ -547,7 +547,7 @@ void DivPlatformNamcoWSG::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
int DivPlatformNamcoWSG::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformNamcoWSG::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -91,13 +91,13 @@ class DivPlatformNamcoWSG: public DivDispatch {
bool isStereo(); bool isStereo();
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
void setDeviceType(int type); void setDeviceType(int type);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyWaveChange(int wave); void notifyWaveChange(int wave);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformNamcoWSG(); ~DivPlatformNamcoWSG();
}; };

View file

@ -640,11 +640,12 @@ bool DivPlatformNES::keyOffAffectsArp(int ch) {
return true; return true;
} }
void DivPlatformNES::setFlags(unsigned int flags) { void DivPlatformNES::setFlags(const DivConfig& flags) {
if (flags==2) { // Dendy int clockSel=flags.getInt("clockSel",0);
if (clockSel==2) { // Dendy
rate=COLOR_PAL*2.0/5.0; rate=COLOR_PAL*2.0/5.0;
apuType=2; apuType=2;
} else if (flags==1) { // PAL } else if (clockSel==1) { // PAL
rate=COLOR_PAL*3.0/8.0; rate=COLOR_PAL*3.0/8.0;
apuType=1; apuType=1;
} else { // NTSC } else { // NTSC
@ -730,9 +731,8 @@ void DivPlatformNES::renderSamples() {
dpcmMemLen=memPos; dpcmMemLen=memPos;
} }
int DivPlatformNES::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformNES::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
apuType=flags;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;
if (useNP) { if (useNP) {

View file

@ -104,7 +104,7 @@ class DivPlatformNES: public DivDispatch {
float getPostAmp(); float getPostAmp();
unsigned char readDMC(unsigned short addr); unsigned char readDMC(unsigned short addr);
void setNSFPlay(bool use); void setNSFPlay(bool use);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
@ -113,7 +113,7 @@ class DivPlatformNES: public DivDispatch {
size_t getSampleMemCapacity(int index); size_t getSampleMemCapacity(int index);
size_t getSampleMemUsage(int index); size_t getSampleMemUsage(int index);
void renderSamples(); void renderSamples();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformNES(); ~DivPlatformNES();
}; };

View file

@ -1646,7 +1646,7 @@ void DivPlatformOPL::setOPLType(int type, bool drums) {
properDrumsSys=drums; properDrumsSys=drums;
} }
void DivPlatformOPL::setFlags(unsigned int flags) { void DivPlatformOPL::setFlags(const DivConfig& flags) {
/* /*
if (flags==3) { if (flags==3) {
chipClock=COLOR_NTSC*12.0/7.0; chipClock=COLOR_NTSC*12.0/7.0;
@ -1674,7 +1674,7 @@ void DivPlatformOPL::setFlags(unsigned int flags) {
switch (chipType) { switch (chipType) {
default: default:
case 1: case 2: case 8950: case 1: case 2: case 8950:
switch (flags&0xff) { switch (flags.getInt("clockSel",0)) {
case 0x01: case 0x01:
chipClock=COLOR_PAL*4.0/5.0; chipClock=COLOR_PAL*4.0/5.0;
break; break;
@ -1698,7 +1698,7 @@ void DivPlatformOPL::setFlags(unsigned int flags) {
chipRateBase=rate; chipRateBase=rate;
break; break;
case 3: case 3:
switch (flags&0xff) { switch (flags.getInt("clockSel",0)) {
case 0x01: case 0x01:
chipClock=COLOR_PAL*16.0/5.0; chipClock=COLOR_PAL*16.0/5.0;
break; break;
@ -1719,7 +1719,7 @@ void DivPlatformOPL::setFlags(unsigned int flags) {
chipRateBase=rate; chipRateBase=rate;
break; break;
case 4: case 4:
switch (flags&0xff) { switch (flags.getInt("clockSel",0)) {
case 0x01: case 0x01:
chipClock=COLOR_PAL*32.0/5.0; chipClock=COLOR_PAL*32.0/5.0;
break; break;
@ -1785,7 +1785,7 @@ void DivPlatformOPL::renderSamples() {
adpcmBMemLen=memPos+256; adpcmBMemLen=memPos+256;
} }
int DivPlatformOPL::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformOPL::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -143,7 +143,7 @@ class DivPlatformOPL: public DivDispatch {
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
bool keyOffAffectsPorta(int ch); bool keyOffAffectsPorta(int ch);
void toggleRegisterDump(bool enable); void toggleRegisterDump(bool enable);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsChange(int ins); void notifyInsChange(int ins);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
int getPortaFloor(int ch); int getPortaFloor(int ch);
@ -153,7 +153,7 @@ class DivPlatformOPL: public DivDispatch {
size_t getSampleMemCapacity(int index); size_t getSampleMemCapacity(int index);
size_t getSampleMemUsage(int index); size_t getSampleMemUsage(int index);
void renderSamples(); void renderSamples();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformOPL(); ~DivPlatformOPL();
}; };

View file

@ -947,24 +947,25 @@ void DivPlatformOPLL::setYMFM(bool use) {
useYMFM=use; useYMFM=use;
} }
void DivPlatformOPLL::setFlags(unsigned int flags) { void DivPlatformOPLL::setFlags(const DivConfig& flags) {
if ((flags&15)==3) { int clockSel=flags.getInt("clockSel",0);
if (clockSel==3) {
chipClock=COLOR_NTSC/2.0; chipClock=COLOR_NTSC/2.0;
} else if ((flags&15)==2) { } else if (clockSel==2) {
chipClock=4000000.0; chipClock=4000000.0;
} else if ((flags&15)==1) { } else if (clockSel==1) {
chipClock=COLOR_PAL*4.0/5.0; chipClock=COLOR_PAL*4.0/5.0;
} else { } else {
chipClock=COLOR_NTSC; chipClock=COLOR_NTSC;
} }
rate=chipClock/36; rate=chipClock/36;
patchSet=flags>>4; patchSet=flags.getInt("patchSet",0);
for (int i=0; i<11; i++) { for (int i=0; i<11; i++) {
oscBuf[i]->rate=rate/2; oscBuf[i]->rate=rate/2;
} }
} }
int DivPlatformOPLL::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformOPLL::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -117,13 +117,13 @@ class DivPlatformOPLL: public DivDispatch {
void toggleRegisterDump(bool enable); void toggleRegisterDump(bool enable);
void setVRC7(bool vrc); void setVRC7(bool vrc);
void setProperDrums(bool pd); void setProperDrums(bool pd);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsChange(int ins); void notifyInsChange(int ins);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
int getPortaFloor(int ch); int getPortaFloor(int ch);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformOPLL(); ~DivPlatformOPLL();
}; };

View file

@ -557,14 +557,13 @@ void DivPlatformPCE::notifyInsDeletion(void* ins) {
} }
} }
void DivPlatformPCE::setFlags(unsigned int flags) { void DivPlatformPCE::setFlags(const DivConfig& flags) {
if (flags&1) { // technically there is no PAL PC Engine but oh well... if (flags.getInt("clockSel",0)) { // technically there is no PAL PC Engine but oh well...
chipClock=COLOR_PAL*4.0/5.0; chipClock=COLOR_PAL*4.0/5.0;
} else { } else {
chipClock=COLOR_NTSC; chipClock=COLOR_NTSC;
} }
// flags&4 will be chip revision antiClickEnabled=!flags.getBool("noAntiClick",false);
antiClickEnabled=!(flags&8);
rate=chipClock/12; rate=chipClock/12;
for (int i=0; i<6; i++) { for (int i=0; i<6; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;
@ -574,7 +573,7 @@ void DivPlatformPCE::setFlags(unsigned int flags) {
delete pce; delete pce;
pce=NULL; pce=NULL;
} }
pce=new PCE_PSG(tempL,tempR,(flags&4)?PCE_PSG::REVISION_HUC6280A:PCE_PSG::REVISION_HUC6280); pce=new PCE_PSG(tempL,tempR,flags.getInt("chipType",0)?PCE_PSG::REVISION_HUC6280A:PCE_PSG::REVISION_HUC6280);
} }
void DivPlatformPCE::poke(unsigned int addr, unsigned short val) { void DivPlatformPCE::poke(unsigned int addr, unsigned short val) {
@ -585,7 +584,7 @@ void DivPlatformPCE::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
int DivPlatformPCE::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformPCE::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -107,13 +107,13 @@ class DivPlatformPCE: public DivDispatch {
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool isStereo(); bool isStereo();
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyWaveChange(int wave); void notifyWaveChange(int wave);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformPCE(); ~DivPlatformPCE();
}; };

View file

@ -382,18 +382,17 @@ void DivPlatformPCMDAC::notifyInsDeletion(void* ins) {
chan.std.notifyInsDeletion((DivInstrument*)ins); chan.std.notifyInsDeletion((DivInstrument*)ins);
} }
void DivPlatformPCMDAC::setFlags(unsigned int flags) { void DivPlatformPCMDAC::setFlags(const DivConfig& flags) {
// default to 44100Hz 16-bit stereo // default to 44100Hz 16-bit stereo
if (!flags) flags=0x1f0000|44099; rate=flags.getInt("rate",44100);
rate=(flags&0xffff)+1;
// rate can't be too low or the resampler will break // rate can't be too low or the resampler will break
if (rate<1000) rate=1000; if (rate<1000) rate=1000;
chipClock=rate; chipClock=rate;
outDepth=(flags>>16)&0xf; outDepth=(flags.getInt("outDepth",15))&15;
outStereo=(flags>>20)&1; outStereo=flags.getBool("stereo",true);
} }
int DivPlatformPCMDAC::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformPCMDAC::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -91,11 +91,11 @@ class DivPlatformPCMDAC: public DivDispatch {
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool isStereo(); bool isStereo();
DivMacroInt* getChanMacroInt(int ch); DivMacroInt* getChanMacroInt(int ch);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsChange(int ins); void notifyInsChange(int ins);
void notifyWaveChange(int wave); void notifyWaveChange(int wave);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
}; };

View file

@ -586,10 +586,10 @@ bool DivPlatformPCSpeaker::keyOffAffectsArp(int ch) {
return true; return true;
} }
void DivPlatformPCSpeaker::setFlags(unsigned int flags) { void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) {
chipClock=COLOR_NTSC/3.0; chipClock=COLOR_NTSC/3.0;
rate=chipClock/PCSPKR_DIVIDER; rate=chipClock/PCSPKR_DIVIDER;
speakerType=flags&3; speakerType=flags.getInt("speakerType",0)&3;
oscBuf->rate=rate; oscBuf->rate=rate;
} }
@ -611,7 +611,7 @@ void DivPlatformPCSpeaker::poke(std::vector<DivRegWrite>& wlist) {
// ??? // ???
} }
int DivPlatformPCSpeaker::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformPCSpeaker::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -108,13 +108,13 @@ class DivPlatformPCSpeaker: public DivDispatch {
void tick(bool sysTick=true); void tick(bool sysTick=true);
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void notifyPlaybackStop(); void notifyPlaybackStop();
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformPCSpeaker(); ~DivPlatformPCSpeaker();
}; };

View file

@ -295,7 +295,7 @@ void DivPlatformPET::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
int DivPlatformPET::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformPET::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -81,7 +81,7 @@ class DivPlatformPET: public DivDispatch {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformPET(); ~DivPlatformPET();
private: private:

View file

@ -592,14 +592,14 @@ void DivPlatformQSound::notifyInsDeletion(void* ins) {
} }
} }
void DivPlatformQSound::setFlags(unsigned int flags) { void DivPlatformQSound::setFlags(const DivConfig& flags) {
echoDelay = 2725 - (flags & 0xfff); echoDelay = 2725 - flags.getInt("echoDelay",0);
echoFeedback = (flags >> 12) & 255; echoFeedback = flags.getInt("echoFeedback",0) & 255;
if(echoDelay < 0) { if (echoDelay < 0) {
echoDelay = 0; echoDelay = 0;
} }
if(echoDelay > 2725) { if (echoDelay > 2725) {
echoDelay = 2725; echoDelay = 2725;
} }
//rate=chipClock/CHIP_DIVIDER; //rate=chipClock/CHIP_DIVIDER;
@ -678,7 +678,7 @@ void DivPlatformQSound::renderSamples() {
sampleMemLen=memPos+256; sampleMemLen=memPos+256;
} }
int DivPlatformQSound::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformQSound::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -93,7 +93,7 @@ class DivPlatformQSound: public DivDispatch {
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool isStereo(); bool isStereo();
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsChange(int ins); void notifyInsChange(int ins);
void notifyWaveChange(int wave); void notifyWaveChange(int wave);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
@ -104,7 +104,7 @@ class DivPlatformQSound: public DivDispatch {
size_t getSampleMemCapacity(int index = 0); size_t getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0); size_t getSampleMemUsage(int index = 0);
void renderSamples(); void renderSamples();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
}; };

View file

@ -342,13 +342,13 @@ void DivPlatformRF5C68::notifyInsDeletion(void* ins) {
} }
} }
void DivPlatformRF5C68::setFlags(unsigned int flags) { void DivPlatformRF5C68::setFlags(const DivConfig& flags) {
switch (flags&0x0f) { switch (flags.getInt("clockSel",0)) {
case 1: chipClock=10000000; break; case 1: chipClock=10000000; break;
case 2: chipClock=12500000; break; case 2: chipClock=12500000; break;
default: chipClock=8000000; break; default: chipClock=8000000; break;
} }
chipType=flags>>4; chipType=flags.getInt("chipType",0);
rate=chipClock/384; rate=chipClock/384;
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;
@ -416,7 +416,7 @@ void DivPlatformRF5C68::renderSamples() {
sampleMemLen=memPos; sampleMemLen=memPos;
} }
int DivPlatformRF5C68::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformRF5C68::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -92,7 +92,7 @@ class DivPlatformRF5C68: public DivDispatch {
void notifyInsChange(int ins); void notifyInsChange(int ins);
void notifyWaveChange(int wave); void notifyWaveChange(int wave);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
@ -100,7 +100,7 @@ class DivPlatformRF5C68: public DivDispatch {
size_t getSampleMemCapacity(int index = 0); size_t getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0); size_t getSampleMemUsage(int index = 0);
void renderSamples(); void renderSamples();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
private: private:
void chWrite(unsigned char ch, unsigned int addr, unsigned char val); void chWrite(unsigned char ch, unsigned int addr, unsigned char val);

View file

@ -422,10 +422,11 @@ void DivPlatformSAA1099::notifyInsDeletion(void* ins) {
} }
} }
void DivPlatformSAA1099::setFlags(unsigned int flags) { void DivPlatformSAA1099::setFlags(const DivConfig& flags) {
if (flags==2) { int clockSel=flags.getInt("clockSel",0);
if (clockSel==2) {
chipClock=COLOR_PAL*8.0/5.0; chipClock=COLOR_PAL*8.0/5.0;
} else if (flags==1) { } else if (clockSel==1) {
chipClock=COLOR_NTSC*2.0; chipClock=COLOR_NTSC*2.0;
} else { } else {
chipClock=8000000; chipClock=8000000;
@ -448,7 +449,7 @@ void DivPlatformSAA1099::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
int DivPlatformSAA1099::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformSAA1099::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -89,7 +89,7 @@ class DivPlatformSAA1099: public DivDispatch {
void forceIns(); void forceIns();
void tick(bool sysTick=true); void tick(bool sysTick=true);
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
bool isStereo(); bool isStereo();
int getPortaFloor(int ch); int getPortaFloor(int ch);
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
@ -97,7 +97,7 @@ class DivPlatformSAA1099: public DivDispatch {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
}; };
#endif #endif

View file

@ -360,11 +360,8 @@ void DivPlatformSCC::setChipModel(bool isplus) {
isPlus=isplus; isPlus=isplus;
} }
void DivPlatformSCC::setFlags(unsigned int flags) { void DivPlatformSCC::setFlags(const DivConfig& flags) {
switch (flags&0x7f) { switch (flags.getInt("clockSel",0)) {
case 0x00:
chipClock=COLOR_NTSC/2.0;
break;
case 0x01: case 0x01:
chipClock=COLOR_PAL*2.0/5.0; chipClock=COLOR_PAL*2.0/5.0;
break; break;
@ -374,6 +371,9 @@ void DivPlatformSCC::setFlags(unsigned int flags) {
case 0x03: case 0x03:
chipClock=4000000.0/2.0; chipClock=4000000.0/2.0;
break; break;
default:
chipClock=COLOR_NTSC/2.0;
break;
} }
rate=chipClock/8; rate=chipClock/8;
for (int i=0; i<5; i++) { for (int i=0; i<5; i++) {
@ -381,7 +381,7 @@ void DivPlatformSCC::setFlags(unsigned int flags) {
} }
} }
int DivPlatformSCC::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformSCC::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -85,8 +85,8 @@ class DivPlatformSCC: public DivDispatch {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void setChipModel(bool isPlus); void setChipModel(bool isPlus);
void quit(); void quit();
~DivPlatformSCC(); ~DivPlatformSCC();

View file

@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
// TODO: new macro formula
#include "segapcm.h" #include "segapcm.h"
#include "../engine.h" #include "../engine.h"
#include "../../ta-log.h" #include "../../ta-log.h"
@ -485,7 +484,7 @@ void DivPlatformSegaPCM::reset() {
} }
} }
void DivPlatformSegaPCM::setFlags(unsigned int flags) { void DivPlatformSegaPCM::setFlags(const DivConfig& flags) {
chipClock=8000000.0; chipClock=8000000.0;
rate=31250; rate=31250;
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
@ -497,7 +496,7 @@ bool DivPlatformSegaPCM::isStereo() {
return true; return true;
} }
int DivPlatformSegaPCM::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformSegaPCM::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -111,11 +111,11 @@ class DivPlatformSegaPCM: public DivDispatch {
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
void notifyInsChange(int ins); void notifyInsChange(int ins);
void renderSamples(); void renderSamples();
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
bool isStereo(); bool isStereo();
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformSegaPCM(); ~DivPlatformSegaPCM();
}; };

View file

@ -429,85 +429,78 @@ void DivPlatformSMS::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
void DivPlatformSMS::setFlags(unsigned int flags) { void DivPlatformSMS::setFlags(const DivConfig& flags) {
switch (flags&0xff03) { switch (flags.getInt("clockSel",0)) {
default: case 1:
case 0x0000:
chipClock=COLOR_NTSC;
break;
case 0x0001:
chipClock=COLOR_PAL*4.0/5.0; chipClock=COLOR_PAL*4.0/5.0;
break; break;
case 0x0002: case 2:
chipClock=4000000; chipClock=4000000;
break; break;
case 0x0003: case 3:
chipClock=COLOR_NTSC/2.0; chipClock=COLOR_NTSC/2.0;
break; break;
case 0x0100: case 4:
chipClock=3000000; chipClock=3000000;
break; break;
case 0x0101: case 5:
chipClock=2000000; chipClock=2000000;
break; break;
case 0x0102: case 6:
chipClock=COLOR_NTSC/8.0; chipClock=COLOR_NTSC/8.0;
break; break;
default:
chipClock=COLOR_NTSC;
break;
} }
resetPhase=!(flags&16); resetPhase=!flags.getBool("noPhaseReset",false);
divider=16; divider=16;
toneDivider=64.0; toneDivider=64.0;
noiseDivider=64.0; noiseDivider=64.0;
if (sn!=NULL) delete sn; if (sn!=NULL) delete sn;
switch (flags&0xcc) { switch (flags.getInt("chipType",0)) {
default: // Sega case 1: // TI SN76489
case 0x00:
sn=new segapsg_device();
isRealSN=false;
stereo=false;
break;
case 0x04: // TI SN76489
sn=new sn76489_device(); sn=new sn76489_device();
isRealSN=true; isRealSN=true;
stereo=false; stereo=false;
noiseDivider=60.0; // 64 for match to tone frequency on non-Sega PSG but compatibility noiseDivider=60.0; // 64 for match to tone frequency on non-Sega PSG but compatibility
break; break;
case 0x08: // TI+Atari case 2: // TI+Atari
sn=new sn76496_base_device(0x4000, 0x0f35, 0x01, 0x02, true, false, 1/*8*/, false, true); sn=new sn76496_base_device(0x4000, 0x0f35, 0x01, 0x02, true, false, 1/*8*/, false, true);
isRealSN=true; isRealSN=true;
stereo=false; stereo=false;
noiseDivider=60.0; noiseDivider=60.0;
break; break;
case 0x0c: // Game Gear (not fully emulated yet!) case 3: // Game Gear (not fully emulated yet!)
sn=new gamegear_device(); sn=new gamegear_device();
isRealSN=false; isRealSN=false;
stereo=true; stereo=true;
break; break;
case 0x40: // TI SN76489A case 4: // TI SN76489A
sn=new sn76489a_device(); sn=new sn76489a_device();
isRealSN=false; // TODO isRealSN=false; // TODO
stereo=false; stereo=false;
noiseDivider=60.0; noiseDivider=60.0;
break; break;
case 0x44: // TI SN76496 case 5: // TI SN76496
sn=new sn76496_device(); sn=new sn76496_device();
isRealSN=false; // TODO isRealSN=false; // TODO
stereo=false; stereo=false;
noiseDivider=60.0; noiseDivider=60.0;
break; break;
case 0x48: // NCR 8496 case 6: // NCR 8496
sn=new ncr8496_device(); sn=new ncr8496_device();
isRealSN=false; isRealSN=false;
stereo=false; stereo=false;
noiseDivider=60.0; noiseDivider=60.0;
break; break;
case 0x4c: // Tandy PSSJ 3-voice sound case 7: // Tandy PSSJ 3-voice sound
sn=new pssj3_device(); sn=new pssj3_device();
isRealSN=false; isRealSN=false;
stereo=false; stereo=false;
noiseDivider=60.0; noiseDivider=60.0;
break; break;
case 0x80: // TI SN94624 case 8: // TI SN94624
sn=new sn94624_device(); sn=new sn94624_device();
isRealSN=true; isRealSN=true;
stereo=false; stereo=false;
@ -515,7 +508,7 @@ void DivPlatformSMS::setFlags(unsigned int flags) {
toneDivider=8.0; toneDivider=8.0;
noiseDivider=7.5; noiseDivider=7.5;
break; break;
case 0x84: // TI SN76494 case 9: // TI SN76494
sn=new sn76494_device(); sn=new sn76494_device();
isRealSN=false; // TODO isRealSN=false; // TODO
stereo=false; stereo=false;
@ -523,6 +516,11 @@ void DivPlatformSMS::setFlags(unsigned int flags) {
toneDivider=8.0; toneDivider=8.0;
noiseDivider=7.5; noiseDivider=7.5;
break; break;
default: // Sega
sn=new segapsg_device();
isRealSN=false;
stereo=false;
break;
} }
rate=chipClock/divider; rate=chipClock/divider;
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
@ -534,7 +532,7 @@ void DivPlatformSMS::setNuked(bool value) {
nuked=value; nuked=value;
} }
int DivPlatformSMS::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformSMS::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -97,13 +97,13 @@ class DivPlatformSMS: public DivDispatch {
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
bool keyOffAffectsPorta(int ch); bool keyOffAffectsPorta(int ch);
int getPortaFloor(int ch); int getPortaFloor(int ch);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
void setNuked(bool value); void setNuked(bool value);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformSMS(); ~DivPlatformSMS();
}; };

View file

@ -767,12 +767,12 @@ void DivPlatformSNES::renderSamples() {
memcpy(sampleMem,copyOfSampleMem,65536); memcpy(sampleMem,copyOfSampleMem,65536);
} }
void DivPlatformSNES::setFlags(unsigned int flags) { void DivPlatformSNES::setFlags(const DivConfig& flags) {
globalVolL=127-(flags&127); globalVolL=127-flags.getInt("volScaleL",0);
globalVolR=127-((flags>>8)&127); globalVolR=127-flags.getInt("volScaleR",0);
} }
int DivPlatformSNES::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformSNES::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -117,7 +117,7 @@ class DivPlatformSNES: public DivDispatch {
bool isStereo(); bool isStereo();
void notifyInsChange(int ins); void notifyInsChange(int ins);
void notifyWaveChange(int wave); void notifyWaveChange(int wave);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
@ -126,7 +126,7 @@ class DivPlatformSNES: public DivDispatch {
size_t getSampleMemCapacity(int index = 0); size_t getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0); size_t getSampleMemUsage(int index = 0);
void renderSamples(); void renderSamples();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
private: private:
void updateWave(int ch); void updateWave(int ch);

View file

@ -505,8 +505,8 @@ void DivPlatformSoundUnit::notifyInsDeletion(void* ins) {
} }
} }
void DivPlatformSoundUnit::setFlags(unsigned int flags) { void DivPlatformSoundUnit::setFlags(const DivConfig& flags) {
if (flags&1) { if (flags.getInt("clockSel",0)) {
chipClock=1190000; chipClock=1190000;
} else { } else {
chipClock=1236000; chipClock=1236000;
@ -515,14 +515,15 @@ void DivPlatformSoundUnit::setFlags(unsigned int flags) {
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;
} }
initIlCtrl=3|(flags&4); bool echoOn=flags.getBool("echo",false);
initIlSize=((flags>>8)&63)|((flags&4)?0x40:0)|((flags&8)?0x80:0); initIlCtrl=3|(echoOn?4:0);
initFil1=flags>>16; initIlSize=((flags.getInt("echoDelay",0))&63)|(echoOn?0x40:0)|(flags.getBool("swapEcho",false)?0x80:0);
initEchoVol=flags>>24; initFil1=flags.getInt("echoFeedback",0);
initEchoVol=flags.getInt("echoVol",0);
sampleMemSize=flags&16; sampleMemSize=flags.getInt("sampleMemSize",0);
su->Init(sampleMemSize?65536:8192,flags&32); su->Init(sampleMemSize?65536:8192,flags.getBool("pdm",false));
renderSamples(); renderSamples();
} }
@ -572,7 +573,7 @@ void DivPlatformSoundUnit::renderSamples() {
} }
int DivPlatformSoundUnit::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformSoundUnit::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -130,7 +130,7 @@ class DivPlatformSoundUnit: public DivDispatch {
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool isStereo(); bool isStereo();
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
@ -139,7 +139,7 @@ class DivPlatformSoundUnit: public DivDispatch {
size_t getSampleMemCapacity(int index); size_t getSampleMemCapacity(int index);
size_t getSampleMemUsage(int index); size_t getSampleMemUsage(int index);
void renderSamples(); void renderSamples();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformSoundUnit(); ~DivPlatformSoundUnit();
}; };

View file

@ -509,7 +509,7 @@ void DivPlatformSwan::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
int DivPlatformSwan::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformSwan::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -94,7 +94,7 @@ class DivPlatformSwan: public DivDispatch {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformSwan(); ~DivPlatformSwan();
private: private:

View file

@ -350,21 +350,21 @@ void DivPlatformTIA::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
void DivPlatformTIA::setFlags(unsigned int flags) { void DivPlatformTIA::setFlags(const DivConfig& flags) {
if (flags&1) { if (flags.getInt("clockSel",0)) {
rate=COLOR_PAL*4.0/5.0; rate=COLOR_PAL*4.0/5.0;
} else { } else {
rate=COLOR_NTSC; rate=COLOR_NTSC;
} }
chipClock=rate; chipClock=rate;
mixingType=(flags>>1)&3; mixingType=flags.getInt("mixingType",0)&3;
for (int i=0; i<2; i++) { for (int i=0; i<2; i++) {
oscBuf[i]->rate=rate/114; oscBuf[i]->rate=rate/114;
} }
tia.reset(mixingType); tia.reset(mixingType);
} }
int DivPlatformTIA::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformTIA::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -63,7 +63,7 @@ class DivPlatformTIA: public DivDispatch {
void forceIns(); void forceIns();
void tick(bool sysTick=true); void tick(bool sysTick=true);
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
float getPostAmp(); float getPostAmp();
bool isStereo(); bool isStereo();
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
@ -71,7 +71,7 @@ class DivPlatformTIA: public DivDispatch {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
}; };
#endif #endif

View file

@ -914,11 +914,12 @@ void DivPlatformTX81Z::reset() {
extMode=false; extMode=false;
} }
void DivPlatformTX81Z::setFlags(unsigned int flags) { void DivPlatformTX81Z::setFlags(const DivConfig& flags) {
if (flags==2) { int clockSel=flags.getInt("clockSel",0);
if (clockSel==2) {
chipClock=4000000.0; chipClock=4000000.0;
baseFreqOff=-122; baseFreqOff=-122;
} else if (flags==1) { } else if (clockSel==1) {
chipClock=COLOR_PAL*4.0/5.0; chipClock=COLOR_PAL*4.0/5.0;
baseFreqOff=12; baseFreqOff=12;
} else { } else {
@ -935,7 +936,7 @@ bool DivPlatformTX81Z::isStereo() {
return true; return true;
} }
int DivPlatformTX81Z::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformTX81Z::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -104,12 +104,12 @@ class DivPlatformTX81Z: public DivPlatformOPM {
void tick(bool sysTick=true); void tick(bool sysTick=true);
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
void notifyInsChange(int ins); void notifyInsChange(int ins);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
bool isStereo(); bool isStereo();
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformTX81Z(); ~DivPlatformTX81Z();
}; };

View file

@ -426,7 +426,7 @@ void DivPlatformVERA::poke(std::vector<DivRegWrite>& wlist) {
for (auto &i: wlist) poke(i.addr,i.val); for (auto &i: wlist) poke(i.addr,i.val);
} }
int DivPlatformVERA::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformVERA::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
for (int i=0; i<17; i++) { for (int i=0; i<17; i++) {
isMuted[i]=false; isMuted[i]=false;
oscBuf[i]=new DivDispatchOscBuffer; oscBuf[i]=new DivDispatchOscBuffer;

View file

@ -80,7 +80,7 @@ class DivPlatformVERA: public DivDispatch {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformVERA(); ~DivPlatformVERA();
}; };

View file

@ -301,8 +301,8 @@ void DivPlatformVIC20::notifyInsDeletion(void* ins) {
} }
} }
void DivPlatformVIC20::setFlags(unsigned int flags) { void DivPlatformVIC20::setFlags(const DivConfig& flags) {
if (flags&1) { if (flags.getInt("clockSel",0)) {
chipClock=COLOR_PAL/4.0; chipClock=COLOR_PAL/4.0;
} else { } else {
chipClock=COLOR_NTSC*2.0/7.0; chipClock=COLOR_NTSC*2.0/7.0;
@ -321,7 +321,7 @@ void DivPlatformVIC20::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
int DivPlatformVIC20::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformVIC20::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -77,13 +77,13 @@ class DivPlatformVIC20: public DivDispatch {
void forceIns(); void forceIns();
void tick(bool sysTick=true); void tick(bool sysTick=true);
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
bool isStereo(); bool isStereo();
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformVIC20(); ~DivPlatformVIC20();
private: private:

View file

@ -479,10 +479,11 @@ bool DivPlatformVRC6::keyOffAffectsArp(int ch) {
return true; return true;
} }
void DivPlatformVRC6::setFlags(unsigned int flags) { void DivPlatformVRC6::setFlags(const DivConfig& flags) {
if (flags==2) { // Dendy int clockSel=flags.getInt("clockSel",0);
if (clockSel==2) { // Dendy
rate=COLOR_PAL*2.0/5.0; rate=COLOR_PAL*2.0/5.0;
} else if (flags==1) { // PAL } else if (clockSel==1) { // PAL
rate=COLOR_PAL*3.0/8.0; rate=COLOR_PAL*3.0/8.0;
} else { // NTSC } else { // NTSC
rate=COLOR_NTSC/2.0; rate=COLOR_NTSC/2.0;
@ -507,7 +508,7 @@ void DivPlatformVRC6::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
} }
int DivPlatformVRC6::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformVRC6::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -94,12 +94,12 @@ class DivPlatformVRC6: public DivDispatch, public vrcvi_intf {
void tick(bool sysTick=true); void tick(bool sysTick=true);
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
DivPlatformVRC6() : vrc6(*this) {}; DivPlatformVRC6() : vrc6(*this) {};
~DivPlatformVRC6(); ~DivPlatformVRC6();

View file

@ -903,8 +903,8 @@ void DivPlatformX1_010::notifyInsDeletion(void* ins) {
} }
} }
void DivPlatformX1_010::setFlags(unsigned int flags) { void DivPlatformX1_010::setFlags(const DivConfig& flags) {
switch (flags&15) { switch (flags.getInt("clockSel",0)) {
case 0: // 16MHz (earlier hardwares) case 0: // 16MHz (earlier hardwares)
chipClock=16000000; chipClock=16000000;
break; break;
@ -917,7 +917,7 @@ void DivPlatformX1_010::setFlags(unsigned int flags) {
break; break;
} }
rate=chipClock/512; rate=chipClock/512;
stereo=flags&16; stereo=flags.getBool("stereo",false);
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;
} }
@ -980,7 +980,7 @@ void DivPlatformX1_010::setBanked(bool banked) {
isBanked=banked; isBanked=banked;
} }
int DivPlatformX1_010::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformX1_010::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;

View file

@ -138,7 +138,7 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf {
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool isStereo(); bool isStereo();
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
void notifyWaveChange(int wave); void notifyWaveChange(int wave);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
@ -149,7 +149,7 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf {
void renderSamples(); void renderSamples();
const char** getRegisterSheet(); const char** getRegisterSheet();
void setBanked(bool banked); void setBanked(bool banked);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
DivPlatformX1_010(): DivPlatformX1_010():
DivDispatch(), DivDispatch(),

View file

@ -909,13 +909,9 @@ void DivPlatformYM2203::setSkipRegisterWrites(bool value) {
ay->setSkipRegisterWrites(value); ay->setSkipRegisterWrites(value);
} }
void DivPlatformYM2203::setFlags(unsigned int flags) { void DivPlatformYM2203::setFlags(const DivConfig& flags) {
// Clock flags // Clock flags
switch (flags&0x1f) { switch (flags.getInt("clockSel",0)) {
default:
case 0x00:
chipClock=COLOR_NTSC;
break;
case 0x01: case 0x01:
chipClock=COLOR_PAL*4.0/5.0; chipClock=COLOR_PAL*4.0/5.0;
break; break;
@ -931,16 +927,12 @@ void DivPlatformYM2203::setFlags(unsigned int flags) {
case 0x05: case 0x05:
chipClock=3000000.0/2.0; chipClock=3000000.0/2.0;
break; break;
default:
chipClock=COLOR_NTSC;
break;
} }
// Prescaler flags // Prescaler flags
switch ((flags>>5)&0x3) { switch (flags.getInt("prescale",0)) {
default:
case 0x00: // /6
prescale=0x2d;
fmFreqBase=4720270.0,
fmDivBase=36,
ayDiv=16;
break;
case 0x01: // /3 case 0x01: // /3
prescale=0x2e; prescale=0x2e;
fmFreqBase=4720270.0/2.0, fmFreqBase=4720270.0/2.0,
@ -953,6 +945,12 @@ void DivPlatformYM2203::setFlags(unsigned int flags) {
fmDivBase=12, fmDivBase=12,
ayDiv=4; ayDiv=4;
break; break;
default: // /6
prescale=0x2d;
fmFreqBase=4720270.0,
fmDivBase=36,
ayDiv=16;
break;
} }
rate=fm->sample_rate(chipClock); rate=fm->sample_rate(chipClock);
for (int i=0; i<6; i++) { for (int i=0; i<6; i++) {
@ -961,10 +959,11 @@ void DivPlatformYM2203::setFlags(unsigned int flags) {
immWrite(0x2d,0xff); immWrite(0x2d,0xff);
immWrite(prescale,0xff); immWrite(prescale,0xff);
ay->setExtClockDiv(chipClock,ayDiv); ay->setExtClockDiv(chipClock,ayDiv);
ay->setFlags(16); ay->setFlags(ayFlags);
} }
int DivPlatformYM2203::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformYM2203::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
ayFlags.set("chipType",1);
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
skipRegisterWrites=false; skipRegisterWrites=false;
@ -976,7 +975,7 @@ int DivPlatformYM2203::init(DivEngine* p, int channels, int sugRate, unsigned in
fm->set_fidelity(ymfm::OPN_FIDELITY_MIN); fm->set_fidelity(ymfm::OPN_FIDELITY_MIN);
// YM2149, 2MHz // YM2149, 2MHz
ay=new DivPlatformAY8910(true,chipClock,ayDiv); ay=new DivPlatformAY8910(true,chipClock,ayDiv);
ay->init(p,3,sugRate,16); ay->init(p,3,sugRate,ayFlags);
ay->toggleRegisterDump(true); ay->toggleRegisterDump(true);
setFlags(flags); setFlags(flags);

View file

@ -117,8 +117,8 @@ class DivPlatformYM2203: public DivPlatformOPN {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
DivPlatformYM2203(): DivPlatformYM2203():
DivPlatformOPN(4720270.0, 36, 16), DivPlatformOPN(4720270.0, 36, 16),

View file

@ -505,7 +505,7 @@ void DivPlatformYM2203Ext::notifyInsChange(int ins) {
} }
} }
int DivPlatformYM2203Ext::init(DivEngine* parent, int channels, int sugRate, unsigned int flags) { int DivPlatformYM2203Ext::init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) {
DivPlatformYM2203::init(parent,channels,sugRate,flags); DivPlatformYM2203::init(parent,channels,sugRate,flags);
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
isOpMuted[i]=false; isOpMuted[i]=false;

View file

@ -64,7 +64,7 @@ class DivPlatformYM2203Ext: public DivPlatformYM2203 {
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
void notifyInsChange(int ins); void notifyInsChange(int ins);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformYM2203Ext(); ~DivPlatformYM2203Ext();
}; };

View file

@ -1361,26 +1361,18 @@ void DivPlatformYM2608::renderSamples() {
adpcmBMemLen=memPos+256; adpcmBMemLen=memPos+256;
} }
void DivPlatformYM2608::setFlags(unsigned int flags) { void DivPlatformYM2608::setFlags(const DivConfig& flags) {
// Clock flags // Clock flags
switch (flags&0x1f) { switch (flags.getInt("clockSel",0)) {
default:
case 0x00:
chipClock=8000000.0;
break;
case 0x01: case 0x01:
chipClock=38400*13*16; // 31948800/4 chipClock=38400*13*16; // 31948800/4
break; break;
default:
chipClock=8000000.0;
break;
} }
// Prescaler flags // Prescaler flags
switch ((flags>>5)&0x3) { switch (flags.getInt("prescale",0)) {
default:
case 0x00: // /6
prescale=0x2d;
fmFreqBase=9440540.0,
fmDivBase=72,
ayDiv=32;
break;
case 0x01: // /3 case 0x01: // /3
prescale=0x2e; prescale=0x2e;
fmFreqBase=9440540.0/2.0, fmFreqBase=9440540.0/2.0,
@ -1393,6 +1385,12 @@ void DivPlatformYM2608::setFlags(unsigned int flags) {
fmDivBase=24, fmDivBase=24,
ayDiv=8; ayDiv=8;
break; break;
default: // /6
prescale=0x2d;
fmFreqBase=9440540.0,
fmDivBase=72,
ayDiv=32;
break;
} }
rate=fm->sample_rate(chipClock); rate=fm->sample_rate(chipClock);
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
@ -1401,11 +1399,12 @@ void DivPlatformYM2608::setFlags(unsigned int flags) {
immWrite(0x2d,0xff); immWrite(0x2d,0xff);
immWrite(prescale,0xff); immWrite(prescale,0xff);
ay->setExtClockDiv(chipClock,ayDiv); ay->setExtClockDiv(chipClock,ayDiv);
ay->setFlags(16); ay->setFlags(ayFlags);
} }
int DivPlatformYM2608::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformYM2608::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
ayFlags.set("chipType",1);
adpcmBMem=new unsigned char[getSampleMemCapacity(0)]; adpcmBMem=new unsigned char[getSampleMemCapacity(0)];
adpcmBMemLen=0; adpcmBMemLen=0;
iface.adpcmBMem=adpcmBMem; iface.adpcmBMem=adpcmBMem;
@ -1420,7 +1419,7 @@ int DivPlatformYM2608::init(DivEngine* p, int channels, int sugRate, unsigned in
fm->set_fidelity(ymfm::OPN_FIDELITY_MIN); fm->set_fidelity(ymfm::OPN_FIDELITY_MIN);
// YM2149, 2MHz // YM2149, 2MHz
ay=new DivPlatformAY8910(true,chipClock,ayDiv); ay=new DivPlatformAY8910(true,chipClock,ayDiv);
ay->init(p,3,sugRate,16); ay->init(p,3,sugRate,ayFlags);
ay->toggleRegisterDump(true); ay->toggleRegisterDump(true);
setFlags(flags); setFlags(flags);
reset(); reset();

View file

@ -138,8 +138,8 @@ class DivPlatformYM2608: public DivPlatformOPN {
size_t getSampleMemCapacity(int index); size_t getSampleMemCapacity(int index);
size_t getSampleMemUsage(int index); size_t getSampleMemUsage(int index);
void renderSamples(); void renderSamples();
void setFlags(unsigned int flags); void setFlags(const DivConfig& flags);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
DivPlatformYM2608(): DivPlatformYM2608():
DivPlatformOPN(9440540.0, 72, 32), DivPlatformOPN(9440540.0, 72, 32),

View file

@ -541,7 +541,7 @@ void DivPlatformYM2608Ext::notifyInsChange(int ins) {
} }
} }
int DivPlatformYM2608Ext::init(DivEngine* parent, int channels, int sugRate, unsigned int flags) { int DivPlatformYM2608Ext::init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) {
DivPlatformYM2608::init(parent,channels,sugRate,flags); DivPlatformYM2608::init(parent,channels,sugRate,flags);
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
isOpMuted[i]=false; isOpMuted[i]=false;

View file

@ -66,7 +66,7 @@ class DivPlatformYM2608Ext: public DivPlatformYM2608 {
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
void notifyInsChange(int ins); void notifyInsChange(int ins);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformYM2608Ext(); ~DivPlatformYM2608Ext();
}; };

View file

@ -1278,7 +1278,7 @@ void DivPlatformYM2610::setSkipRegisterWrites(bool value) {
ay->setSkipRegisterWrites(value); ay->setSkipRegisterWrites(value);
} }
int DivPlatformYM2610::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformYM2610::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
DivPlatformYM2610Base::init(p, channels, sugRate, flags); DivPlatformYM2610Base::init(p, channels, sugRate, flags);
reset(); reset();
return 14; return 14;

View file

@ -58,7 +58,7 @@ class DivPlatformYM2610: public DivPlatformYM2610Base<14> {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
DivPlatformYM2610(): DivPlatformYM2610():
DivPlatformYM2610Base<14>(1,4,7,13) {} DivPlatformYM2610Base<14>(1,4,7,13) {}

View file

@ -1345,7 +1345,7 @@ void DivPlatformYM2610B::setSkipRegisterWrites(bool value) {
ay->setSkipRegisterWrites(value); ay->setSkipRegisterWrites(value);
} }
int DivPlatformYM2610B::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { int DivPlatformYM2610B::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
DivPlatformYM2610Base::init(p, channels, sugRate, flags); DivPlatformYM2610Base::init(p, channels, sugRate, flags);
reset(); reset();
return 16; return 16;

View file

@ -54,7 +54,7 @@ class DivPlatformYM2610B: public DivPlatformYM2610Base<16> {
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
DivPlatformYM2610B(): DivPlatformYM2610B():
DivPlatformYM2610Base<16>(2,6,9,15) {} DivPlatformYM2610Base<16>(2,6,9,15) {}

Some files were not shown because too many files have changed in this diff Show more