Fixed bug in NR42 write that also caused memory corruption

This commit is contained in:
Lior Halphon 2018-01-06 12:17:06 +02:00
parent a1af4c59ca
commit a20e8a8220

View File

@ -718,7 +718,10 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
} }
else if (gb->apu.is_active[GB_NOISE]){ else if (gb->apu.is_active[GB_NOISE]){
nrx2_glitch(&gb->apu.noise_channel.current_volume, value, gb->io_registers[reg]); nrx2_glitch(&gb->apu.noise_channel.current_volume, value, gb->io_registers[reg]);
update_square_sample(gb, GB_NOISE); update_sample(gb, GB_NOISE,
(gb->apu.noise_channel.lfsr & 1) ?
gb->apu.noise_channel.current_volume : 0,
0);
} }
break; break;
} }