mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-03 22:21:09 +00:00
add notifyInsDeletion
prevent invalid memory access when deleting instruments
This commit is contained in:
parent
0545775de6
commit
91e8ff01cf
18 changed files with 61 additions and 0 deletions
|
@ -215,3 +215,9 @@ void DivMacroInt::init(DivInstrument* which) {
|
||||||
arpMode=true;
|
arpMode=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivMacroInt::notifyInsDeletion(DivInstrument* which) {
|
||||||
|
if (ins==which) {
|
||||||
|
init(NULL);
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ class DivMacroInt {
|
||||||
bool arpMode;
|
bool arpMode;
|
||||||
void next();
|
void next();
|
||||||
void init(DivInstrument* which);
|
void init(DivInstrument* which);
|
||||||
|
void notifyInsDeletion(DivInstrument* which);
|
||||||
DivMacroInt():
|
DivMacroInt():
|
||||||
ins(NULL),
|
ins(NULL),
|
||||||
volPos(0),
|
volPos(0),
|
||||||
|
|
|
@ -331,6 +331,12 @@ bool DivPlatformAY8910::keyOffAffectsArp(int ch) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivPlatformAY8910::notifyInsDeletion(void* ins) {
|
||||||
|
for (int i=0; i<3; i++) {
|
||||||
|
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int DivPlatformAY8910::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
int DivPlatformAY8910::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
||||||
parent=p;
|
parent=p;
|
||||||
skipRegisterWrites=false;
|
skipRegisterWrites=false;
|
||||||
|
|
|
@ -59,6 +59,7 @@ class DivPlatformAY8910: 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 notifyInsDeletion(void* ins);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||||
void quit();
|
void quit();
|
||||||
};
|
};
|
||||||
|
|
|
@ -311,6 +311,12 @@ void DivPlatformC64::forceIns() {
|
||||||
updateFilter();
|
updateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivPlatformC64::notifyInsDeletion(void* ins) {
|
||||||
|
for (int i=0; i<3; i++) {
|
||||||
|
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DivPlatformC64::reset() {
|
void DivPlatformC64::reset() {
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
chan[i]=DivPlatformC64::Channel();
|
chan[i]=DivPlatformC64::Channel();
|
||||||
|
|
|
@ -61,6 +61,7 @@ class DivPlatformC64: public DivDispatch {
|
||||||
void tick();
|
void tick();
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
void setPAL(bool pal);
|
void setPAL(bool pal);
|
||||||
|
void notifyInsDeletion(void* ins);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||||
void setChipModel(bool is6581);
|
void setChipModel(bool is6581);
|
||||||
void quit();
|
void quit();
|
||||||
|
|
|
@ -317,6 +317,12 @@ bool DivPlatformGB::isStereo() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivPlatformGB::notifyInsDeletion(void* ins) {
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int DivPlatformGB::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
int DivPlatformGB::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
isMuted[i]=false;
|
isMuted[i]=false;
|
||||||
|
|
|
@ -45,6 +45,7 @@ class DivPlatformGB: public DivDispatch {
|
||||||
void tick();
|
void tick();
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
bool isStereo();
|
||||||
|
void notifyInsDeletion(void* ins);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformGB();
|
~DivPlatformGB();
|
||||||
|
|
|
@ -423,6 +423,10 @@ bool DivPlatformGenesis::keyOffAffectsPorta(int ch) {
|
||||||
return (ch>5);
|
return (ch>5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivPlatformGenesis::notifyInsDeletion(void* ins) {
|
||||||
|
psg.notifyInsDeletion(ins);
|
||||||
|
}
|
||||||
|
|
||||||
void DivPlatformGenesis::setPAL(bool pal) {
|
void DivPlatformGenesis::setPAL(bool pal) {
|
||||||
if (pal) {
|
if (pal) {
|
||||||
rate=211125;
|
rate=211125;
|
||||||
|
|
|
@ -60,6 +60,7 @@ class DivPlatformGenesis: public DivDispatch {
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
bool keyOffAffectsPorta(int ch);
|
bool keyOffAffectsPorta(int ch);
|
||||||
void setPAL(bool pal);
|
void setPAL(bool pal);
|
||||||
|
void notifyInsDeletion(void* ins);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformGenesis();
|
~DivPlatformGenesis();
|
||||||
|
|
|
@ -324,6 +324,12 @@ void DivPlatformNES::setPAL(bool pal) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivPlatformNES::notifyInsDeletion(void* ins) {
|
||||||
|
for (int i=0; i<5; i++) {
|
||||||
|
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int DivPlatformNES::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
int DivPlatformNES::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
||||||
parent=p;
|
parent=p;
|
||||||
skipRegisterWrites=false;
|
skipRegisterWrites=false;
|
||||||
|
|
|
@ -50,6 +50,7 @@ class DivPlatformNES: public DivDispatch {
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
void setPAL(bool pal);
|
void setPAL(bool pal);
|
||||||
|
void notifyInsDeletion(void* ins);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformNES();
|
~DivPlatformNES();
|
||||||
|
|
|
@ -313,6 +313,12 @@ bool DivPlatformPCE::keyOffAffectsArp(int ch) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivPlatformPCE::notifyInsDeletion(void* ins) {
|
||||||
|
for (int i=0; i<6; i++) {
|
||||||
|
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DivPlatformPCE::setPAL(bool pal) {
|
void DivPlatformPCE::setPAL(bool pal) {
|
||||||
if (pal) { // technically there is no PAL PC Engine but oh well...
|
if (pal) { // technically there is no PAL PC Engine but oh well...
|
||||||
rate=1773448/6;
|
rate=1773448/6;
|
||||||
|
|
|
@ -65,6 +65,7 @@ class DivPlatformPCE: public DivDispatch {
|
||||||
bool isStereo();
|
bool isStereo();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
void setPAL(bool pal);
|
void setPAL(bool pal);
|
||||||
|
void notifyInsDeletion(void* ins);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformPCE();
|
~DivPlatformPCE();
|
||||||
|
|
|
@ -193,6 +193,12 @@ int DivPlatformSMS::getPortaFloor(int ch) {
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivPlatformSMS::notifyInsDeletion(void* ins) {
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DivPlatformSMS::setPAL(bool pal) {
|
void DivPlatformSMS::setPAL(bool pal) {
|
||||||
if (pal) {
|
if (pal) {
|
||||||
rate=221681;
|
rate=221681;
|
||||||
|
|
|
@ -42,6 +42,7 @@ class DivPlatformSMS: public DivDispatch {
|
||||||
bool keyOffAffectsPorta(int ch);
|
bool keyOffAffectsPorta(int ch);
|
||||||
int getPortaFloor(int ch);
|
int getPortaFloor(int ch);
|
||||||
void setPAL(bool pal);
|
void setPAL(bool pal);
|
||||||
|
void notifyInsDeletion(void* ins);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformSMS();
|
~DivPlatformSMS();
|
||||||
|
|
|
@ -589,6 +589,12 @@ bool DivPlatformYM2610::keyOffAffectsArp(int ch) {
|
||||||
return (ch>3);
|
return (ch>3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivPlatformYM2610::notifyInsDeletion(void* ins) {
|
||||||
|
for (int i=4; i<7; i++) {
|
||||||
|
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int DivPlatformYM2610::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
int DivPlatformYM2610::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
||||||
parent=p;
|
parent=p;
|
||||||
skipRegisterWrites=false;
|
skipRegisterWrites=false;
|
||||||
|
|
|
@ -71,6 +71,7 @@ class DivPlatformYM2610: 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 notifyInsDeletion(void* ins);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformYM2610();
|
~DivPlatformYM2610();
|
||||||
|
|
Loading…
Reference in a new issue