NESHawk: scanline timing and audio fix
This commit is contained in:
parent
69d8a473a1
commit
6bd0fbccef
|
@ -43,8 +43,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
|
||||
noise = new NoiseUnit(this, pal);
|
||||
triangle = new TriangleUnit(this);
|
||||
pulse[0] = new PulseUnit(this, 0);
|
||||
pulse[1] = new PulseUnit(this, 1);
|
||||
pulse[0] = new PulseUnit(this, 1);
|
||||
pulse[1] = new PulseUnit(this, 0);
|
||||
if (old != null)
|
||||
{
|
||||
m_vol = old.m_vol;
|
||||
|
@ -156,10 +156,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
case 3:
|
||||
if (apu.len_clock_active)
|
||||
{
|
||||
if (len_cnt==0)
|
||||
if (len_cnt == 0)
|
||||
{
|
||||
len_cnt = LENGTH_TABLE[(val >> 3) & 0x1F]+1;
|
||||
}
|
||||
len_cnt = LENGTH_TABLE[(val >> 3) & 0x1F] + 1;
|
||||
}
|
||||
} else
|
||||
{
|
||||
len_cnt = LENGTH_TABLE[(val >> 3) & 0x1F];
|
||||
|
@ -167,7 +167,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
|
||||
timer_reload_value = (timer_reload_value & 0xFF) | ((val & 0x07) << 8);
|
||||
timer_raw_reload_value = timer_reload_value * 2 + 2;
|
||||
duty_step = 0;
|
||||
duty_step = 0;
|
||||
env_start_flag = 1;
|
||||
|
||||
// allow the lenctr_en to kill the len_cnt
|
||||
|
@ -202,7 +202,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
// this should be optimized to update only when `timer_reload_value` changes
|
||||
int sweep_shifter = timer_reload_value >> sweep_shiftcount;
|
||||
if (sweep_negate == 1)
|
||||
sweep_shifter = -sweep_shifter + unit;
|
||||
sweep_shifter = -sweep_shifter - unit;
|
||||
sweep_shifter += timer_reload_value;
|
||||
|
||||
// this sweep logic is always enabled:
|
||||
|
@ -234,7 +234,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
}
|
||||
}
|
||||
|
||||
// env_loopdoubles as "halt length counter"
|
||||
// env_loop doubles as "halt length counter"
|
||||
if ((env_loop == 0 || len_halt) && len_cnt > 0)
|
||||
len_cnt--;
|
||||
}
|
||||
|
|
|
@ -308,9 +308,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
if (yp >= read_value && yp < read_value + spriteHeight && spr_true_count == 0)
|
||||
{
|
||||
//a flag gets set if sprite zero is in range
|
||||
if (oam_index == reg_2003)
|
||||
sprite_zero_in_range = true;
|
||||
|
||||
if (oam_index == reg_2003) { sprite_zero_in_range = true; }
|
||||
|
||||
spr_true_count++;
|
||||
soam_m_index++;
|
||||
}
|
||||
|
@ -442,7 +441,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
//2. is the bg pixel nonzero?
|
||||
//then, it is spritehit.
|
||||
Reg2002_objhit |= (sprite_zero_go && s == 0 && pixel != 0 && rasterpos < 255 && show_bg_new && show_obj_new);
|
||||
|
||||
//priority handling, if in front of BG:
|
||||
bool drawsprite = !(((temp_attr & 0x20) != 0) && ((pixel & 3) != 0));
|
||||
if (drawsprite && nes.Settings.DispSprites)
|
||||
|
@ -466,7 +464,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
{
|
||||
ppur.increment_hsc();
|
||||
|
||||
if (ppur.status.cycle == 256)
|
||||
if ((ppur.status.cycle == 256) && ppu_was_on)
|
||||
{
|
||||
ppur.increment_vs();
|
||||
}
|
||||
|
@ -540,7 +538,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
{
|
||||
ppur.increment_hsc();
|
||||
|
||||
if (ppur.status.cycle == 256)
|
||||
if ((ppur.status.cycle == 256) && ppu_was_on)
|
||||
{
|
||||
ppur.increment_vs();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue