mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 13:05:11 +00:00
Virtual Boy: add static wave storage mode
This commit is contained in:
parent
cf84be0b71
commit
c59e2e6e87
3 changed files with 61 additions and 2 deletions
|
@ -123,6 +123,7 @@ void DivPlatformVB::acquire(short** buf, size_t len) {
|
|||
}
|
||||
|
||||
void DivPlatformVB::updateWave(int ch) {
|
||||
if (romMode) return;
|
||||
if (ch>=5) return;
|
||||
|
||||
for (int i=0; i<32; i++) {
|
||||
|
@ -162,6 +163,9 @@ void DivPlatformVB::tick(bool sysTick) {
|
|||
if (chan[i].std.wave.had) {
|
||||
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
||||
chan[i].wave=chan[i].std.wave.val;
|
||||
if (romMode) {
|
||||
chWrite(i,0x06,chan[i].wave);
|
||||
}
|
||||
chan[i].ws.changeWave1(chan[i].wave);
|
||||
if (!chan[i].keyOff) chan[i].keyOn=true;
|
||||
}
|
||||
|
@ -282,6 +286,9 @@ int DivPlatformVB::dispatch(DivCommand c) {
|
|||
case DIV_CMD_WAVE:
|
||||
chan[c.chan].wave=c.value;
|
||||
chan[c.chan].ws.changeWave1(chan[c.chan].wave);
|
||||
if (romMode) {
|
||||
chWrite(c.chan,0x06,chan[c.chan].wave);
|
||||
}
|
||||
chan[c.chan].keyOn=true;
|
||||
break;
|
||||
case DIV_CMD_NOTE_PORTA: {
|
||||
|
@ -464,8 +471,13 @@ void DivPlatformVB::reset() {
|
|||
chWrite(i,0x01,isMuted[i]?0:chan[i].pan);
|
||||
chWrite(i,0x05,0x00);
|
||||
chWrite(i,0x00,0x80);
|
||||
chWrite(i,0x06,i);
|
||||
if (romMode) {
|
||||
chWrite(i,0x06,0);
|
||||
} else {
|
||||
chWrite(i,0x06,i);
|
||||
}
|
||||
}
|
||||
updateROMWaves();
|
||||
delay=500;
|
||||
}
|
||||
|
||||
|
@ -481,6 +493,27 @@ float DivPlatformVB::getPostAmp() {
|
|||
return 6.0f;
|
||||
}
|
||||
|
||||
void DivPlatformVB::updateROMWaves() {
|
||||
if (romMode) {
|
||||
// copy wavetables
|
||||
for (int i=0; i<5; i++) {
|
||||
int data=0;
|
||||
DivWavetable* w=parent->getWave(i);
|
||||
|
||||
for (int j=0; j<32; j++) {
|
||||
if (w->max<1 || w->len<1) {
|
||||
data=0;
|
||||
} else {
|
||||
data=w->data[j*w->len/32]*63/w->max;
|
||||
if (data<0) data=0;
|
||||
if (data>63) data=63;
|
||||
}
|
||||
rWrite((i<<7)+(j<<2),data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformVB::notifyWaveChange(int wave) {
|
||||
for (int i=0; i<6; i++) {
|
||||
if (chan[i].wave==wave) {
|
||||
|
@ -488,6 +521,7 @@ void DivPlatformVB::notifyWaveChange(int wave) {
|
|||
updateWave(i);
|
||||
}
|
||||
}
|
||||
updateROMWaves();
|
||||
}
|
||||
|
||||
void DivPlatformVB::notifyInsDeletion(void* ins) {
|
||||
|
@ -504,6 +538,8 @@ void DivPlatformVB::setFlags(const DivConfig& flags) {
|
|||
oscBuf[i]->rate=rate;
|
||||
}
|
||||
|
||||
romMode=flags.getBool("romMode",false);
|
||||
|
||||
if (vb!=NULL) {
|
||||
delete vb;
|
||||
vb=NULL;
|
||||
|
|
|
@ -57,10 +57,12 @@ class DivPlatformVB: public DivDispatch {
|
|||
int tempR;
|
||||
unsigned char modulation;
|
||||
bool modType;
|
||||
bool romMode;
|
||||
signed char modTable[32];
|
||||
VSU* vb;
|
||||
unsigned char regPool[0x600];
|
||||
void updateWave(int ch);
|
||||
void updateROMWaves();
|
||||
void writeEnv(int ch, bool upperByteToo=false);
|
||||
friend void putDispatchChip(void*,int);
|
||||
friend void putDispatchChan(void*,int,int);
|
||||
|
|
|
@ -2242,10 +2242,31 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
|
|||
}
|
||||
break;
|
||||
}
|
||||
case DIV_SYSTEM_VBOY: {
|
||||
bool romMode=flags.getBool("romMode",false);
|
||||
|
||||
ImGui::Text("Waveform storage mode:");
|
||||
ImGui::Indent();
|
||||
if (ImGui::RadioButton("Dynamic (unconfirmed)",!romMode)) {
|
||||
romMode=false;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton("Static (up to 5 waves)",romMode)) {
|
||||
romMode=true;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
flags.set("romMode",romMode);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DIV_SYSTEM_SWAN:
|
||||
case DIV_SYSTEM_BUBSYS_WSG:
|
||||
case DIV_SYSTEM_PET:
|
||||
case DIV_SYSTEM_VBOY:
|
||||
case DIV_SYSTEM_GA20:
|
||||
case DIV_SYSTEM_PV1000:
|
||||
case DIV_SYSTEM_VERA:
|
||||
|
|
Loading…
Reference in a new issue