Cores: All cores must update Frame counter post-emulation. NOTE: This is a sync breaking change for MGBA movies using RTC, as the time sent to the core was the pre-incremented time.
This commit is contained in:
parent
7c661b5520
commit
4165b2893d
src
BizHawk.Emulation.Common/Interfaces
BizHawk.Emulation.Cores
Computers/MSX
Consoles
Atari
Coleco
GCE/Vectrex
Intellivision
Magnavox/Odyssey2
Nintendo
GBA
GBHawk
GBHawkLink
GBHawkLink3x
GBHawkLink4x
Gameboy
NES
QuickNES
SNES
SubGBHawk
SubNESHawk
PC Engine
Sega
Sony/PSX
WonderSwan
|
@ -38,6 +38,7 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
/// <summary>
|
||||
/// Gets the current frame count
|
||||
/// Frame must be incremented after emulation in the core
|
||||
/// </summary>
|
||||
int Frame { get; }
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
|
|||
if (_controller.IsPressed("P2 B2")) ctrl2_byte -= 0x20;
|
||||
|
||||
if (current_controller == MSXControllerKB) { kb_rows_check(controller); }
|
||||
|
||||
_frame++;
|
||||
|
||||
if (Tracer.Enabled)
|
||||
{
|
||||
|
@ -45,7 +43,9 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
|
|||
LibMSX.MSX_settracecallback(MSX_Pntr, tracecb);
|
||||
|
||||
LibMSX.MSX_frame_advance(MSX_Pntr, ctrl1_byte, ctrl2_byte, kb_rows, true, true);
|
||||
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
{
|
||||
_controller = controller;
|
||||
|
||||
_frame++;
|
||||
_islag = true;
|
||||
|
||||
// Handle all the console controls here
|
||||
|
@ -76,6 +75,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
|
||||
_tia.LineCount = 0;
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,8 +68,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
|||
cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
if (controller.IsPressed("Power"))
|
||||
{
|
||||
// it seems that theMachine.Reset() doesn't clear ram, etc
|
||||
|
@ -89,6 +87,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
|||
_lagCount++;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,6 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
|||
|
||||
public bool FrameAdvance(IController controller, bool render, bool rendersound = true)
|
||||
{
|
||||
Frame++;
|
||||
if (controller.IsPressed("Power"))
|
||||
{
|
||||
LibLynx.Reset(Core);
|
||||
|
@ -135,6 +134,8 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
|||
LagCount++;
|
||||
}
|
||||
|
||||
Frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
SoftReset();
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
_isLag = true;
|
||||
if (_tracer.Enabled)
|
||||
{
|
||||
|
@ -164,6 +162,8 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
_lagCount++;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
if (controller.IsPressed("Power"))
|
||||
{
|
||||
HardReset();
|
||||
|
@ -74,6 +72,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
_lagcount++;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
_cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
_sticRow = -1;
|
||||
|
||||
// read the controller state here for now
|
||||
|
@ -125,6 +124,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
SoftReset();
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
if (controller.IsPressed("Power"))
|
||||
{
|
||||
HardReset();
|
||||
|
@ -48,6 +46,8 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
_lagcount++;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
|
||||
public bool FrameAdvance(IController controller, bool render, bool renderSound = true)
|
||||
{
|
||||
Frame++;
|
||||
if (controller.IsPressed("Power"))
|
||||
{
|
||||
LibmGBA.BizReset(Core);
|
||||
|
@ -147,6 +146,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
// this should be called in hblank on the appropriate line, but until we implement that, just do it here
|
||||
_scanlinecb?.Invoke();
|
||||
|
||||
Frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
if (controller.IsPressed("P1 Power"))
|
||||
{
|
||||
HardReset();
|
||||
|
@ -90,6 +88,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
_lagcount++;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
L.cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
if (controller.IsPressed("P1 Power"))
|
||||
{
|
||||
L.HardReset();
|
||||
|
@ -91,6 +89,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
_lagcount++;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,8 +68,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
L.cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
if (controller.IsPressed("P1 Power"))
|
||||
{
|
||||
L.HardReset();
|
||||
|
@ -130,6 +128,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
_lagcount++;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,8 +83,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
|
|||
A.cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
if (controller.IsPressed("P1 Power"))
|
||||
{
|
||||
A.HardReset();
|
||||
|
@ -166,6 +164,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
|
|||
_lagcount++;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -276,8 +276,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
internal void FrameAdvancePrep(IController controller)
|
||||
{
|
||||
Frame++;
|
||||
|
||||
// update our local copy of the controller data
|
||||
CurrentButtons = 0;
|
||||
|
||||
|
@ -327,6 +325,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
LagCount++;
|
||||
}
|
||||
|
||||
Frame++;
|
||||
|
||||
endofframecallback?.Invoke(LibGambatte.gambatte_cpuread(GambatteState, 0xff40));
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
_cablediscosignal = cablediscosignalNew;
|
||||
|
||||
Frame++;
|
||||
L.FrameAdvancePrep(LCont);
|
||||
R.FrameAdvancePrep(RCont);
|
||||
|
||||
|
@ -148,6 +147,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
LagCount++;
|
||||
}
|
||||
|
||||
Frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -304,8 +304,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
HardReset();
|
||||
}
|
||||
|
||||
Frame++;
|
||||
|
||||
//if (resetSignal)
|
||||
//Controller.UnpressButton("Reset"); TODO fix this
|
||||
resetSignal = controller.IsPressed("Reset");
|
||||
|
@ -381,6 +379,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
// any cheats still active will be re-applied by the buspoke at the start of the next frame
|
||||
num_cheats = 0;
|
||||
|
||||
Frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
//quite strange that is makes the sprite hit flag go high like this
|
||||
if (nes._isVS2c05==2)
|
||||
{
|
||||
if (nes.Frame<4)
|
||||
if (nes.Frame<3)
|
||||
{
|
||||
|
||||
return (byte)((Reg2002_vblank_active << 7) | (Reg2002_objhit << 6) | (1 << 5) | (0x1D));
|
||||
|
|
|
@ -196,7 +196,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
|
||||
QN.qn_set_tracecb(Context, Tracer.Enabled ? _traceCb : null);
|
||||
|
||||
Frame++;
|
||||
LibQuickNES.ThrowStringError(QN.qn_emulate_frame(Context, j1, j2));
|
||||
IsLagFrame = QN.qn_get_joypad_read_count(Context) == 0;
|
||||
if (IsLagFrame)
|
||||
|
@ -210,6 +209,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
_callBack1?.Invoke();
|
||||
_callBack2?.Invoke();
|
||||
|
||||
Frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,8 +70,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
RefreshMemoryCallbacks(false);
|
||||
|
||||
// apparently this is one frame?
|
||||
_timeFrameCounter++;
|
||||
Api.CMD_run();
|
||||
_timeFrameCounter++;
|
||||
|
||||
// once upon a time we forwarded messages from bsnes here, by checking for queued text messages, but I don't think it's needed any longer
|
||||
if (IsLagFrame)
|
||||
|
|
|
@ -36,8 +36,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubGBHawk
|
|||
_GBCore.cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
reset_frame = false;
|
||||
if (controller.IsPressed("P1 Power"))
|
||||
{
|
||||
|
@ -81,6 +79,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubGBHawk
|
|||
}
|
||||
|
||||
reset_frame = false;
|
||||
|
||||
_frame++;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
_nesCore.cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
if (controller.IsPressed("Power"))
|
||||
{
|
||||
HardReset();
|
||||
|
@ -62,6 +60,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
}
|
||||
|
||||
reset_frame = false;
|
||||
|
||||
_frame++;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
_controller = controller;
|
||||
_lagged = true;
|
||||
DriveLightOn = false;
|
||||
Frame++;
|
||||
CheckSpriteLimit();
|
||||
PSG.BeginFrame(Cpu.TotalExecutedCycles);
|
||||
|
||||
|
@ -40,6 +39,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
_isLag = false;
|
||||
}
|
||||
|
||||
Frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
|||
L.Cpu.TraceCallback = null;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
if (controller.IsPressed("Power"))
|
||||
{
|
||||
HardReset();
|
||||
|
@ -53,6 +51,8 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
|||
_lagCount++;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
{
|
||||
_controller = controller;
|
||||
_lagged = true;
|
||||
_frame++;
|
||||
|
||||
if (!IsGameGear)
|
||||
{
|
||||
|
@ -129,6 +128,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
_isLag = false;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -136,7 +137,6 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
public void FrameAdvancePrep()
|
||||
{
|
||||
_lagged = true;
|
||||
_frame++;
|
||||
|
||||
if (!IsGameGear && IsGameGear_C)
|
||||
{
|
||||
|
@ -156,6 +156,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
{
|
||||
_isLag = false;
|
||||
}
|
||||
|
||||
_frame++;
|
||||
}
|
||||
|
||||
public int Frame => _frame;
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
throw new Exception($"{nameof(Core.gpgx_put_control)}() failed!");
|
||||
|
||||
IsLagFrame = true;
|
||||
Frame++;
|
||||
|
||||
_driveLight = false;
|
||||
|
||||
Core.gpgx_advance();
|
||||
|
@ -68,7 +68,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
LagCount++;
|
||||
|
||||
if (_cds != null)
|
||||
DriveLightOn = _driveLight;
|
||||
DriveLightOn = _driveLight;
|
||||
|
||||
Frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -808,8 +808,6 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
//TODO - actually, make this feedback from the core. there should be a register or status which effectively corresponds to whether it's reading.
|
||||
DriveLightOn = false;
|
||||
|
||||
Frame++;
|
||||
|
||||
SetInput();
|
||||
|
||||
OctoshockDll.shock_SetLEC(psx, _SyncSettings.EnableLEC);
|
||||
|
@ -899,6 +897,8 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
OctoshockDll.shock_GetSamples(psx, samples);
|
||||
}
|
||||
|
||||
Frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
|
||||
public bool FrameAdvance(IController controller, bool render, bool rendersound = true)
|
||||
{
|
||||
Frame++;
|
||||
IsLagFrame = true;
|
||||
|
||||
if (controller.IsPressed("Power"))
|
||||
|
@ -79,6 +78,8 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
if (IsLagFrame)
|
||||
LagCount++;
|
||||
|
||||
Frame++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue