mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 06:53:01 +00:00
NES: prepare for DPCM
This commit is contained in:
parent
b92ce84b34
commit
a7b8f81da7
3 changed files with 17 additions and 3 deletions
|
@ -53,6 +53,10 @@ const char* regCheatSheetNES[]={
|
|||
NULL
|
||||
};
|
||||
|
||||
unsigned char _readDMC(void* user, unsigned short addr) {
|
||||
return ((DivPlatformNES*)user)->readDMC(addr);
|
||||
}
|
||||
|
||||
const char** DivPlatformNES::getRegisterSheet() {
|
||||
return regCheatSheetNES;
|
||||
}
|
||||
|
@ -633,6 +637,11 @@ void DivPlatformNES::setNSFPlay(bool use) {
|
|||
useNP=use;
|
||||
}
|
||||
|
||||
unsigned char DivPlatformNES::readDMC(unsigned short addr) {
|
||||
printf("read from DMC! %x\n",addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DivPlatformNES::init(DivEngine* p, int channels, int sugRate, unsigned int flags) {
|
||||
parent=p;
|
||||
apuType=flags;
|
||||
|
@ -643,12 +652,14 @@ int DivPlatformNES::init(DivEngine* p, int channels, int sugRate, unsigned int f
|
|||
nes1_NP->SetOption(xgm::NES_APU::OPT_NONLINEAR_MIXER,1);
|
||||
nes2_NP=new xgm::NES_DMC;
|
||||
nes2_NP->SetOption(xgm::NES_DMC::OPT_NONLINEAR_MIXER,1);
|
||||
nes2_NP->SetMemory([](unsigned short addr, unsigned int& data) {
|
||||
data=0;
|
||||
nes2_NP->SetMemory([this](unsigned short addr, unsigned int& data) {
|
||||
data=readDMC(addr);
|
||||
});
|
||||
nes2_NP->SetAPU(nes1_NP);
|
||||
} else {
|
||||
nes=new struct NESAPU;
|
||||
nes->readDMC=_readDMC;
|
||||
nes->readDMCUser=this;
|
||||
}
|
||||
writeOscBuf=0;
|
||||
for (int i=0; i<5; i++) {
|
||||
|
|
|
@ -93,6 +93,7 @@ class DivPlatformNES: public DivDispatch {
|
|||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
float getPostAmp();
|
||||
unsigned char readDMC(unsigned short addr);
|
||||
void setNSFPlay(bool use);
|
||||
void setFlags(unsigned int flags);
|
||||
void notifyInsDeletion(void* ins);
|
||||
|
|
|
@ -207,7 +207,7 @@ enum apu_mode { APU_60HZ, APU_48HZ };
|
|||
break;\
|
||||
}\
|
||||
{\
|
||||
a->DMC.buffer = 0;\
|
||||
a->DMC.buffer = a->readDMC(a->readDMCUser,a->DMC.address);\
|
||||
}\
|
||||
/* incremento gli hwtick da compiere */\
|
||||
if (hwtick) { hwtick[0] += tick; }\
|
||||
|
@ -525,6 +525,8 @@ EXTERNC struct NESAPU {
|
|||
_apuTriangle TR;
|
||||
_apuNoise NS;
|
||||
_apuDMC DMC;
|
||||
void* readDMCUser;
|
||||
unsigned char (*readDMC)(void*,unsigned short);
|
||||
unsigned char muted[5];
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue