mirror of https://github.com/PCSX2/pcsx2.git
Core: Improve determinism on reset + default fast boot interlaced
This commit is contained in:
parent
05ed785af1
commit
33a61558e1
|
@ -162,6 +162,24 @@ static __fi void cpuRcntSet()
|
|||
cpuSetNextEvent(nextsCounter, nextCounter); // Need to update on counter resets/target changes
|
||||
}
|
||||
|
||||
|
||||
struct vSyncTimingInfo
|
||||
{
|
||||
double Framerate; // frames per second (8 bit fixed)
|
||||
GS_VideoMode VideoMode; // used to detect change (interlaced/progressive)
|
||||
u32 Render; // time from vblank end to vblank start (cycles)
|
||||
u32 Blank; // time from vblank start to vblank end (cycles)
|
||||
|
||||
u32 GSBlank; // GS CSR is swapped roughly 3.5 hblank's after vblank start
|
||||
|
||||
u32 hSyncError; // rounding error after the duration of a rendered frame (cycles)
|
||||
u32 hRender; // time from hblank end to hblank start (cycles)
|
||||
u32 hBlank; // time from hblank start to hblank end (cycles)
|
||||
u32 hScanlinesPerFrame; // number of scanlines per frame (525/625 for NTSC/PAL)
|
||||
};
|
||||
|
||||
static vSyncTimingInfo vSyncInfo;
|
||||
|
||||
void rcntInit()
|
||||
{
|
||||
int i;
|
||||
|
@ -180,9 +198,16 @@ void rcntInit()
|
|||
counters[2].interrupt = 11;
|
||||
counters[3].interrupt = 12;
|
||||
|
||||
std::memset(&vSyncInfo, 0, sizeof(vSyncInfo));
|
||||
|
||||
gsVideoMode = GS_VideoMode::Uninitialized;
|
||||
gsIsInterlaced = VMManager::Internal::IsFastBootInProgress();
|
||||
|
||||
hsyncCounter.Mode = MODE_HRENDER;
|
||||
hsyncCounter.sCycle = cpuRegs.cycle;
|
||||
vsyncCounter.CycleT = vSyncInfo.hRender;
|
||||
vsyncCounter.Mode = MODE_VRENDER;
|
||||
vsyncCounter.CycleT = vSyncInfo.Render;
|
||||
vsyncCounter.sCycle = cpuRegs.cycle;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
|
@ -190,23 +215,6 @@ void rcntInit()
|
|||
cpuRcntSet();
|
||||
}
|
||||
|
||||
struct vSyncTimingInfo
|
||||
{
|
||||
double Framerate; // frames per second (8 bit fixed)
|
||||
GS_VideoMode VideoMode; // used to detect change (interlaced/progressive)
|
||||
u32 Render; // time from vblank end to vblank start (cycles)
|
||||
u32 Blank; // time from vblank start to vblank end (cycles)
|
||||
|
||||
u32 GSBlank; // GS CSR is swapped roughly 3.5 hblank's after vblank start
|
||||
|
||||
u32 hSyncError; // rounding error after the duration of a rendered frame (cycles)
|
||||
u32 hRender; // time from hblank end to hblank start (cycles)
|
||||
u32 hBlank; // time from hblank start to hblank end (cycles)
|
||||
u32 hScanlinesPerFrame; // number of scanlines per frame (525/625 for NTSC/PAL)
|
||||
};
|
||||
|
||||
static vSyncTimingInfo vSyncInfo;
|
||||
|
||||
static void vSyncInfoCalc(vSyncTimingInfo* info, double framesPerSecond, u32 scansPerFrame)
|
||||
{
|
||||
constexpr double clock = static_cast<double>(PS2CLK);
|
||||
|
|
|
@ -40,19 +40,19 @@ void hwReset()
|
|||
psHu32(DMAC_ENABLEW) = 0x1201;
|
||||
psHu32(DMAC_ENABLER) = 0x1201;
|
||||
|
||||
rcntInit();
|
||||
|
||||
// Sets SPU2 sample rate to PS2 standard (48KHz) whenever emulator is reset.
|
||||
// For PSX mode sample rate setting, see HwWrite.cpp
|
||||
SPU2::Reset(false);
|
||||
|
||||
sifReset();
|
||||
|
||||
gsReset();
|
||||
gifUnit.Reset();
|
||||
ipuReset();
|
||||
vif0Reset();
|
||||
vif1Reset();
|
||||
gif_fifo.init();
|
||||
rcntInit();
|
||||
USBreset();
|
||||
}
|
||||
|
||||
|
|
|
@ -1240,6 +1240,14 @@ bool VMManager::Initialize(VMBootParameters boot_params)
|
|||
s_target_speed = GetTargetSpeedForLimiterMode(s_limiter_mode);
|
||||
s_use_vsync_for_timing = false;
|
||||
|
||||
s_cpu_implementation_changed = false;
|
||||
s_cpu_provider_pack->ApplyConfig();
|
||||
SetCPUState(EmuConfig.Cpu.sseMXCSR, EmuConfig.Cpu.sseVU0MXCSR, EmuConfig.Cpu.sseVU1MXCSR);
|
||||
SysClearExecutionCache();
|
||||
memBindConditionalHandlers();
|
||||
SysMemory::Reset();
|
||||
cpuReset();
|
||||
|
||||
Console.WriteLn("Opening GS...");
|
||||
s_gs_open_on_initialize = MTGS::IsOpen();
|
||||
if (!s_gs_open_on_initialize && !MTGS::WaitForOpen())
|
||||
|
@ -1338,13 +1346,6 @@ bool VMManager::Initialize(VMBootParameters boot_params)
|
|||
s_mxcsr_saved = static_cast<u32>(a64_getfpcr());
|
||||
#endif
|
||||
|
||||
s_cpu_implementation_changed = false;
|
||||
s_cpu_provider_pack->ApplyConfig();
|
||||
SetCPUState(EmuConfig.Cpu.sseMXCSR, EmuConfig.Cpu.sseVU0MXCSR, EmuConfig.Cpu.sseVU1MXCSR);
|
||||
SysClearExecutionCache();
|
||||
memBindConditionalHandlers();
|
||||
SysMemory::Reset();
|
||||
cpuReset();
|
||||
hwReset();
|
||||
|
||||
Console.WriteLn("VM subsystems initialized in %.2f ms", init_timer.GetTimeMilliseconds());
|
||||
|
|
Loading…
Reference in New Issue