diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 3eb5743d73..ee7e1141d7 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -770,7 +770,7 @@ void VideoThrottle() // depending on the emulation speed set bool ShouldSkipFrame(int skipped) { - u32 TargetFPS = VideoInterface::TargetRefreshRate; + u32 TargetFPS = VideoInterface::GetTargetRefreshRate(); if (SConfig::GetInstance().m_EmulationSpeed > 0.0f) TargetFPS = u32(TargetFPS * SConfig::GetInstance().m_EmulationSpeed); const u32 frames = s_drawn_frame.load(); @@ -801,7 +801,7 @@ void UpdateTitle() float FPS = (float)(s_drawn_frame.load() * 1000.0 / ElapseTime); float VPS = (float)(s_drawn_video.load() * 1000.0 / ElapseTime); - float Speed = (float)(s_drawn_video.load() * (100 * 1000.0) / (VideoInterface::TargetRefreshRate * ElapseTime)); + float Speed = (float)(s_drawn_video.load() * (100 * 1000.0) / (VideoInterface::GetTargetRefreshRate() * ElapseTime)); // Settings are shown the same for both extended and summary info std::string SSettings = StringFromFormat("%s %s | %s | %s", cpu_core_base->GetName(), _CoreParameter.bCPUThread ? "DC" : "SC", diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp index fef82e8c36..7e3dbd6122 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp @@ -177,7 +177,7 @@ FifoPlayer::FifoPlayer() : void FifoPlayer::WriteFrame(const FifoFrameInfo& frame, const AnalyzedFrameInfo& info) { // Core timing information - m_CyclesPerFrame = SystemTimers::GetTicksPerSecond() / VideoInterface::TargetRefreshRate; + m_CyclesPerFrame = SystemTimers::GetTicksPerSecond() / VideoInterface::GetTargetRefreshRate(); m_ElapsedCycles = 0; m_FrameFifoSize = frame.fifoDataSize; diff --git a/Source/Core/Core/HW/VideoInterface.cpp b/Source/Core/Core/HW/VideoInterface.cpp index 8b09640424..30928314fc 100644 --- a/Source/Core/Core/HW/VideoInterface.cpp +++ b/Source/Core/Core/HW/VideoInterface.cpp @@ -49,7 +49,7 @@ static UVIBorderBlankRegister m_BorderHBlank; // 0xcc002076 - 0xcc00207f is full of 0x00FF: unknown // 0xcc002080 - 0xcc002100 even more unknown -u32 TargetRefreshRate = 0; +u32 s_target_refresh_rate = 0; static u32 s_clock_freqs[2] = { @@ -94,7 +94,7 @@ void DoState(PointerWrap &p) p.Do(m_DTVStatus); p.Do(m_FBWidth); p.Do(m_BorderHBlank); - p.Do(TargetRefreshRate); + p.Do(s_target_refresh_rate); p.Do(s_ticks_last_line_start); p.Do(s_half_line_count); p.Do(s_half_line_of_next_si_poll); @@ -609,7 +609,12 @@ void UpdateParameters() s_even_field_last_hl = s_even_field_first_hl + m_VerticalTimingRegister.ACV * 2; s_odd_field_last_hl = s_odd_field_first_hl + m_VerticalTimingRegister.ACV * 2; - TargetRefreshRate = lround(2.0 * SystemTimers::GetTicksPerSecond() / (GetTicksPerEvenField() + GetTicksPerOddField())); + s_target_refresh_rate = lround(2.0 * SystemTimers::GetTicksPerSecond() / (GetTicksPerEvenField() + GetTicksPerOddField())); +} + +u32 GetTargetRefreshRate() +{ + return s_target_refresh_rate; } u32 GetTicksPerSample() @@ -622,7 +627,6 @@ u32 GetTicksPerHalfLine() return GetTicksPerSample() * m_HTiming0.HLW; } - u32 GetTicksPerField() { return GetTicksPerEvenField(); diff --git a/Source/Core/Core/HW/VideoInterface.h b/Source/Core/Core/HW/VideoInterface.h index 4253a75695..53fcc4d83d 100644 --- a/Source/Core/Core/HW/VideoInterface.h +++ b/Source/Core/Core/HW/VideoInterface.h @@ -305,9 +305,6 @@ union UVIHorizontalStepping }; }; - // urgh, ugly externs. - extern u32 TargetRefreshRate; - // For BS2 HLE void Preset(bool _bNTSC); @@ -330,6 +327,7 @@ union UVIHorizontalStepping // Change values pertaining to video mode void UpdateParameters(); + u32 GetTargetRefreshRate(); u32 GetTicksPerSample(); u32 GetTicksPerHalfLine(); u32 GetTicksPerField(); diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp index e12a21ce6a..f6f7783b16 100644 --- a/Source/Core/VideoCommon/AVIDump.cpp +++ b/Source/Core/VideoCommon/AVIDump.cpp @@ -108,7 +108,7 @@ bool AVIDump::CreateFile() s_stream->codec->width = s_width; s_stream->codec->height = s_height; s_stream->codec->time_base.num = 1; - s_stream->codec->time_base.den = VideoInterface::TargetRefreshRate; + s_stream->codec->time_base.den = VideoInterface::GetTargetRefreshRate(); s_stream->codec->gop_size = 12; s_stream->codec->pix_fmt = g_Config.bUseFFV1 ? AV_PIX_FMT_BGRA : AV_PIX_FMT_YUV420P;