SubNESHawk: Add subframe reset
This commit is contained in:
parent
74d20ca45c
commit
ad6790cfb7
|
@ -197,6 +197,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add in the reset timing float control for subneshawk
|
||||||
|
if (using_reset_timing && (ControllerDefinition.FloatControls.Count() == 0))
|
||||||
|
{
|
||||||
|
ControllerDefinition.FloatControls.Add("Reset Cycle");
|
||||||
|
ControllerDefinition.FloatRanges.Add(new ControllerDefinition.FloatRange(0, 0, 500000));
|
||||||
|
}
|
||||||
|
|
||||||
// don't replace the magicSoundProvider on reset, as it's not needed
|
// don't replace the magicSoundProvider on reset, as it's not needed
|
||||||
// if (magicSoundProvider != null) magicSoundProvider.Dispose();
|
// if (magicSoundProvider != null) magicSoundProvider.Dispose();
|
||||||
|
|
||||||
|
@ -419,6 +426,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
public bool current_strobe;
|
public bool current_strobe;
|
||||||
public bool new_strobe;
|
public bool new_strobe;
|
||||||
public bool alt_lag;
|
public bool alt_lag;
|
||||||
|
// variable used with subneshawk to trigger reset at specific cycle after reset
|
||||||
|
public bool using_reset_timing = false;
|
||||||
// this function will run one step of the ppu
|
// this function will run one step of the ppu
|
||||||
// it will return whether the controller is read or not.
|
// it will return whether the controller is read or not.
|
||||||
public void do_single_step(IController controller, out bool cont_read, out bool frame_done)
|
public void do_single_step(IController controller, out bool cont_read, out bool frame_done)
|
||||||
|
|
|
@ -30,11 +30,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
HardReset();
|
HardReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset_frame = false;
|
||||||
if (controller.IsPressed("Reset"))
|
if (controller.IsPressed("Reset"))
|
||||||
{
|
{
|
||||||
SoftReset();
|
reset_frame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset_cycle = controller.GetFloat("Reset Cycle");
|
||||||
|
reset_cycle_int = (int)Math.Floor(reset_cycle);
|
||||||
|
|
||||||
_islag = true;
|
_islag = true;
|
||||||
subnes.alt_lag = true;
|
subnes.alt_lag = true;
|
||||||
|
|
||||||
|
@ -47,6 +51,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
if (pass_a_frame)
|
if (pass_a_frame)
|
||||||
{
|
{
|
||||||
subnes.videoProvider.FillFrameBuffer();
|
subnes.videoProvider.FillFrameBuffer();
|
||||||
|
current_cycle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_islag = subnes.alt_lag;
|
_islag = subnes.alt_lag;
|
||||||
|
@ -57,19 +62,30 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
VBL_CNT++;
|
VBL_CNT++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset_frame = false;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool stop_cur_frame;
|
public bool stop_cur_frame;
|
||||||
public bool pass_new_input;
|
public bool pass_new_input;
|
||||||
public bool pass_a_frame;
|
public bool pass_a_frame;
|
||||||
|
public bool reset_frame;
|
||||||
|
public int current_cycle;
|
||||||
|
public float reset_cycle;
|
||||||
|
public int reset_cycle_int;
|
||||||
|
|
||||||
public void do_frame(IController controller)
|
public void do_frame(IController controller)
|
||||||
{
|
{
|
||||||
stop_cur_frame = false;
|
stop_cur_frame = false;
|
||||||
while (!stop_cur_frame)
|
while (!stop_cur_frame)
|
||||||
{
|
{
|
||||||
|
if (reset_frame && (current_cycle == reset_cycle_int))
|
||||||
|
{
|
||||||
|
SoftReset();
|
||||||
|
reset_frame = false;
|
||||||
|
}
|
||||||
subnes.do_single_step(controller, out pass_new_input, out pass_a_frame);
|
subnes.do_single_step(controller, out pass_new_input, out pass_a_frame);
|
||||||
|
current_cycle++;
|
||||||
stop_cur_frame |= pass_a_frame;
|
stop_cur_frame |= pass_a_frame;
|
||||||
stop_cur_frame |= pass_new_input;
|
stop_cur_frame |= pass_new_input;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
ser.Sync("Frame", ref _frame);
|
ser.Sync("Frame", ref _frame);
|
||||||
ser.Sync("IsLag", ref _islag);
|
ser.Sync("IsLag", ref _islag);
|
||||||
ser.Sync("pass_a_frame", ref pass_a_frame);
|
ser.Sync("pass_a_frame", ref pass_a_frame);
|
||||||
|
ser.Sync("reset_frame", ref reset_frame);
|
||||||
ser.Sync("pass_new_input", ref pass_new_input);
|
ser.Sync("pass_new_input", ref pass_new_input);
|
||||||
|
ser.Sync("current_cycle", ref current_cycle);
|
||||||
|
ser.Sync("reset_cycle", ref reset_cycle);
|
||||||
|
ser.Sync("reset_cycle_int", ref reset_cycle_int);
|
||||||
ser.Sync("VBL_CNT", ref VBL_CNT);
|
ser.Sync("VBL_CNT", ref VBL_CNT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
|
|
||||||
SetupMemoryDomains();
|
SetupMemoryDomains();
|
||||||
|
|
||||||
|
subnes.using_reset_timing = true;
|
||||||
HardReset();
|
HardReset();
|
||||||
|
current_cycle = 0;
|
||||||
VBL_CNT = 0;
|
VBL_CNT = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +60,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
subnes.cpu.NESSoftReset();
|
subnes.cpu.NESSoftReset();
|
||||||
subnes.apu.NESSoftReset();
|
subnes.apu.NESSoftReset();
|
||||||
subnes.ppu.NESSoftReset();
|
subnes.ppu.NESSoftReset();
|
||||||
|
current_cycle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DisplayType Region => DisplayType.NTSC;
|
public DisplayType Region => DisplayType.NTSC;
|
||||||
|
|
Loading…
Reference in New Issue