NES: fix issue for real
This commit is contained in:
parent
bf19feab89
commit
a895cb9c5e
|
@ -358,7 +358,7 @@ void DivPlatformNES::reset() {
|
||||||
dacSample=-1;
|
dacSample=-1;
|
||||||
sampleBank=0;
|
sampleBank=0;
|
||||||
|
|
||||||
apu_turn_on(nes);
|
apu_turn_on(nes,apuType);
|
||||||
nes->apu.cpu_cycles=0;
|
nes->apu.cpu_cycles=0;
|
||||||
nes->apu.cpu_opcode_cycle=0;
|
nes->apu.cpu_opcode_cycle=0;
|
||||||
|
|
||||||
|
@ -375,11 +375,13 @@ void DivPlatformNES::setPAL(bool pal) {
|
||||||
if (pal) {
|
if (pal) {
|
||||||
rate=1662607;
|
rate=1662607;
|
||||||
freqBase=FREQ_BASE_PAL;
|
freqBase=FREQ_BASE_PAL;
|
||||||
nes->apu.type=1;
|
apuType=1;
|
||||||
|
nes->apu.type=apuType;
|
||||||
} else {
|
} else {
|
||||||
rate=1789773;
|
rate=1789773;
|
||||||
freqBase=FREQ_BASE;
|
freqBase=FREQ_BASE;
|
||||||
nes->apu.type=0;
|
apuType=0;
|
||||||
|
nes->apu.type=apuType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,6 +393,7 @@ void DivPlatformNES::notifyInsDeletion(void* 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;
|
||||||
|
apuType=pal;
|
||||||
dumpWrites=false;
|
dumpWrites=false;
|
||||||
skipRegisterWrites=false;
|
skipRegisterWrites=false;
|
||||||
for (int i=0; i<5; i++) {
|
for (int i=0; i<5; i++) {
|
||||||
|
|
|
@ -38,6 +38,7 @@ class DivPlatformNES: public DivDispatch {
|
||||||
unsigned int dacPos;
|
unsigned int dacPos;
|
||||||
int dacSample;
|
int dacSample;
|
||||||
unsigned char sampleBank;
|
unsigned char sampleBank;
|
||||||
|
unsigned char apuType;
|
||||||
struct NESAPU* nes;
|
struct NESAPU* nes;
|
||||||
|
|
||||||
float freqBase;
|
float freqBase;
|
||||||
|
|
|
@ -190,7 +190,7 @@ void apu_tick(struct NESAPU* a, BYTE *hwtick) {
|
||||||
|
|
||||||
a->r4011.cycles++;
|
a->r4011.cycles++;
|
||||||
}
|
}
|
||||||
void apu_turn_on(struct NESAPU* a) {
|
void apu_turn_on(struct NESAPU* a, BYTE apu_type) {
|
||||||
memset(&a->apu, 0x00, sizeof(a->apu));
|
memset(&a->apu, 0x00, sizeof(a->apu));
|
||||||
memset(&a->r4015, 0x00, sizeof(a->r4015));
|
memset(&a->r4015, 0x00, sizeof(a->r4015));
|
||||||
memset(&a->r4017, 0x00, sizeof(a->r4017));
|
memset(&a->r4017, 0x00, sizeof(a->r4017));
|
||||||
|
@ -202,7 +202,8 @@ void apu_turn_on(struct NESAPU* a) {
|
||||||
memset(&a->DMC, 0x00, sizeof(a->DMC));
|
memset(&a->DMC, 0x00, sizeof(a->DMC));
|
||||||
/* al reset e' sempre settato a 60Hz */
|
/* al reset e' sempre settato a 60Hz */
|
||||||
a->apu.mode = APU_60HZ;
|
a->apu.mode = APU_60HZ;
|
||||||
a->apu.type = 0;
|
/* per favore non fatemi questo... e' terribile */
|
||||||
|
a->apu.type = apu_type;
|
||||||
apu_change_step(a->apu.step);
|
apu_change_step(a->apu.step);
|
||||||
/* valori iniziali dei vari canali */
|
/* valori iniziali dei vari canali */
|
||||||
a->S1.frequency = 1;
|
a->S1.frequency = 1;
|
||||||
|
|
|
@ -628,7 +628,7 @@ static const WORD dmc_rate[3][16] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
EXTERNC void apu_tick(struct NESAPU* a, BYTE *hwtick);
|
EXTERNC void apu_tick(struct NESAPU* a, BYTE *hwtick);
|
||||||
EXTERNC void apu_turn_on(struct NESAPU* a);
|
EXTERNC void apu_turn_on(struct NESAPU* a, BYTE apu_type);
|
||||||
|
|
||||||
#undef EXTERNC
|
#undef EXTERNC
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue