mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-25 14:05:12 +00:00
dev140 - YM2612: add YMF276 mode
This commit is contained in:
parent
6a01c83a9a
commit
aa5b8795ed
10 changed files with 67 additions and 22 deletions
3
extern/opn/ym3438.c
vendored
3
extern/opn/ym3438.c
vendored
|
@ -981,6 +981,9 @@ static void OPN2_ChOutput(ym3438_t *chip)
|
|||
{
|
||||
out = (Bit16s)chip->dacdata;
|
||||
out = SIGN_EXTEND(8, out);
|
||||
if (chip->chip_type & ym3438_mode_opn) {
|
||||
out <<=5;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@ these fields are 0 in format versions prior to 100 (0.6pre1).
|
|||
|
||||
the format versions are:
|
||||
|
||||
- 140: Furnace dev140
|
||||
- 139: Furnace dev139
|
||||
- 138: Furnace dev138
|
||||
- 137: Furnace dev137
|
||||
|
|
|
@ -175,7 +175,7 @@ String DivConfig::getString(String key, String fallback) const {
|
|||
return fallback;
|
||||
}
|
||||
|
||||
bool DivConfig::has(String key) {
|
||||
bool DivConfig::has(String key) const {
|
||||
try {
|
||||
String test=conf.at(key);
|
||||
} catch (std::out_of_range& e) {
|
||||
|
|
|
@ -46,7 +46,7 @@ class DivConfig {
|
|||
String getString(String key, String fallback) const;
|
||||
|
||||
// check for existence
|
||||
bool has(String key);
|
||||
bool has(String key) const;
|
||||
|
||||
// set a config value
|
||||
void set(String key, bool value);
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
|
||||
#define BUSY_END isBusy.unlock(); softLocked=false;
|
||||
|
||||
#define DIV_VERSION "dev139"
|
||||
#define DIV_ENGINE_VERSION 139
|
||||
#define DIV_VERSION "dev140"
|
||||
#define DIV_ENGINE_VERSION 140
|
||||
// for imports
|
||||
#define DIV_VERSION_MOD 0xff01
|
||||
#define DIV_VERSION_FC 0xff02
|
||||
|
|
|
@ -190,11 +190,11 @@ void DivPlatformGenesis::acquire_nuked(short** buf, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
os[0]=(os[0]<<5);
|
||||
if (chipType!=2) os[0]=(os[0]<<5);
|
||||
if (os[0]<-32768) os[0]=-32768;
|
||||
if (os[0]>32767) os[0]=32767;
|
||||
|
||||
os[1]=(os[1]<<5);
|
||||
if (chipType!=2) os[1]=(os[1]<<5);
|
||||
if (os[1]<-32768) os[1]=-32768;
|
||||
if (os[1]>32767) os[1]=32767;
|
||||
|
||||
|
@ -223,7 +223,7 @@ void DivPlatformGenesis::acquire_ymfm(short** buf, size_t len) {
|
|||
flushFirst=false;
|
||||
}
|
||||
|
||||
if (ladder) {
|
||||
if (chipType==1) {
|
||||
fm_ymfm->generate(&out_ymfm);
|
||||
} else {
|
||||
((ymfm::ym3438*)fm_ymfm)->generate(&out_ymfm);
|
||||
|
@ -1225,7 +1225,17 @@ void DivPlatformGenesis::reset() {
|
|||
fm_ymfm->reset();
|
||||
}
|
||||
OPN2_Reset(&fm);
|
||||
OPN2_SetChipType(&fm,ladder?ym3438_mode_ym2612:0);
|
||||
switch (chipType) {
|
||||
case 1: // YM2612
|
||||
OPN2_SetChipType(&fm,ym3438_mode_ym2612);
|
||||
break;
|
||||
case 2: // YMF276
|
||||
OPN2_SetChipType(&fm,ym3438_mode_opn);
|
||||
break;
|
||||
default: // YM3438
|
||||
OPN2_SetChipType(&fm,0);
|
||||
break;
|
||||
}
|
||||
if (dumpWrites) {
|
||||
addWrite(0xffffffff,0);
|
||||
}
|
||||
|
@ -1325,14 +1335,28 @@ void DivPlatformGenesis::setFlags(const DivConfig& flags) {
|
|||
chipClock=COLOR_NTSC*15.0/7.0;
|
||||
break;
|
||||
}
|
||||
ladder=flags.getBool("ladderEffect",false);
|
||||
if (flags.has("chipType")) {
|
||||
chipType=flags.getInt("chipType",0);
|
||||
} else {
|
||||
chipType=flags.getBool("ladderEffect",false)?1:0;
|
||||
}
|
||||
noExtMacros=flags.getBool("noExtMacros",false);
|
||||
fbAllOps=flags.getBool("fbAllOps",false);
|
||||
OPN2_SetChipType(&fm,ladder?ym3438_mode_ym2612:0);
|
||||
switch (chipType) {
|
||||
case 1: // YM2612
|
||||
OPN2_SetChipType(&fm,ym3438_mode_ym2612);
|
||||
break;
|
||||
case 2: // YMF276
|
||||
OPN2_SetChipType(&fm,ym3438_mode_opn);
|
||||
break;
|
||||
default: // YM3438
|
||||
OPN2_SetChipType(&fm,0);
|
||||
break;
|
||||
}
|
||||
CHECK_CUSTOM_CLOCK;
|
||||
if (useYMFM) {
|
||||
if (fm_ymfm!=NULL) delete fm_ymfm;
|
||||
if (ladder) {
|
||||
if (chipType==1) {
|
||||
fm_ymfm=new ymfm::ym2612(iface);
|
||||
} else {
|
||||
fm_ymfm=new ymfm::ym3438(iface);
|
||||
|
@ -1349,7 +1373,7 @@ void DivPlatformGenesis::setFlags(const DivConfig& flags) {
|
|||
int DivPlatformGenesis::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
|
||||
parent=p;
|
||||
dumpWrites=false;
|
||||
ladder=false;
|
||||
chipType=0;
|
||||
skipRegisterWrites=false;
|
||||
flushFirst=false;
|
||||
for (int i=0; i<10; i++) {
|
||||
|
|
|
@ -85,7 +85,7 @@ class DivPlatformGenesis: public DivPlatformOPN {
|
|||
int softPCMTimer;
|
||||
|
||||
bool extMode, softPCM, noExtMacros, useYMFM;
|
||||
bool ladder;
|
||||
unsigned char chipType;
|
||||
|
||||
unsigned char dacVolTable[128];
|
||||
|
||||
|
|
|
@ -94,7 +94,6 @@
|
|||
ImGui::TextColored(ch->extMode?colorOn:colorOff,">> ExtMode"); \
|
||||
ImGui::TextColored(ch->softPCM?colorOn:colorOff,">> SoftPCM"); \
|
||||
ImGui::TextColored(ch->useYMFM?colorOn:colorOff,">> UseYMFM"); \
|
||||
ImGui::TextColored(ch->ladder?colorOn:colorOff,">> Ladder");
|
||||
|
||||
#define OPNB_CHIP_DEBUG \
|
||||
FM_OPN_CHIP_DEBUG; \
|
||||
|
|
|
@ -2152,27 +2152,27 @@ void FurnaceGUI::initSystemPresets() {
|
|||
);
|
||||
ENTRY(
|
||||
"Yamaha YM2612 (OPN2)", {
|
||||
CH(DIV_SYSTEM_YM2612, 1.0f, 0, "ladderEffect=true")
|
||||
CH(DIV_SYSTEM_YM2612, 1.0f, 0, "chipType=1")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
"Yamaha YM2612 (extended channel 3)", {
|
||||
CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "ladderEffect=true")
|
||||
CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "chipType=1")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
"Yamaha YM2612 (OPN2) CSM", {
|
||||
CH(DIV_SYSTEM_YM2612_CSM, 1.0f, 0, "ladderEffect=true")
|
||||
CH(DIV_SYSTEM_YM2612_CSM, 1.0f, 0, "chipType=1")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
"Yamaha YM2612 (OPN2) with DualPCM", {
|
||||
CH(DIV_SYSTEM_YM2612_DUALPCM, 1.0f, 0, "ladderEffect=true")
|
||||
CH(DIV_SYSTEM_YM2612_DUALPCM, 1.0f, 0, "chipType=1")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
"Yamaha YM2612 (extended channel 3) with DualPCM", {
|
||||
CH(DIV_SYSTEM_YM2612_DUALPCM_EXT, 1.0f, 0, "ladderEffect=true")
|
||||
CH(DIV_SYSTEM_YM2612_DUALPCM_EXT, 1.0f, 0, "chipType=1")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
|
|
|
@ -34,10 +34,16 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
case DIV_SYSTEM_YM2612_DUALPCM_EXT:
|
||||
case DIV_SYSTEM_YM2612_CSM: {
|
||||
int clockSel=flags.getInt("clockSel",0);
|
||||
bool ladder=flags.getBool("ladderEffect",0);
|
||||
int chipType=0;
|
||||
if (flags.has("chipType")) {
|
||||
chipType=flags.getInt("chipType",0);
|
||||
} else {
|
||||
chipType=flags.getBool("ladderEffect",0)?1:0;
|
||||
}
|
||||
bool noExtMacros=flags.getBool("noExtMacros",false);
|
||||
bool fbAllOps=flags.getBool("fbAllOps",false);
|
||||
|
||||
ImGui::Text("Clock rate:");
|
||||
if (ImGui::RadioButton("NTSC (7.67MHz)",clockSel==0)) {
|
||||
clockSel=0;
|
||||
altered=true;
|
||||
|
@ -58,9 +64,21 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
clockSel=4;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::Checkbox("Enable DAC distortion",&ladder)) {
|
||||
|
||||
ImGui::Text("Chip type:");
|
||||
if (ImGui::RadioButton("YM3438 (9-bit DAC)",chipType==0)) {
|
||||
chipType=0;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton("YM2612 (9-bit DAC with distortion)",chipType==1)) {
|
||||
chipType=1;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton("YMF276 (external DAC)",chipType==2)) {
|
||||
chipType=2;
|
||||
altered=true;
|
||||
}
|
||||
|
||||
if (type==DIV_SYSTEM_YM2612_EXT || type==DIV_SYSTEM_YM2612_DUALPCM_EXT || type==DIV_SYSTEM_YM2612_CSM) {
|
||||
if (ImGui::Checkbox("Disable ExtCh FM macros (compatibility)",&noExtMacros)) {
|
||||
altered=true;
|
||||
|
@ -73,7 +91,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
flags.set("clockSel",clockSel);
|
||||
flags.set("ladderEffect",ladder);
|
||||
flags.set("chipType",chipType);
|
||||
flags.set("noExtMacros",noExtMacros);
|
||||
flags.set("fbAllOps",fbAllOps);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue