mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
VideoCommon: Don't round the refresh rate
We now provide a double to the FPS counter and exact values to FIFO recording and frame dumping.
This commit is contained in:
@ -60,7 +60,9 @@ static UVIBorderBlankRegister m_BorderHBlank;
|
||||
// 0xcc002076 - 0xcc00207f is full of 0x00FF: unknown
|
||||
// 0xcc002080 - 0xcc002100 even more unknown
|
||||
|
||||
static u32 s_target_refresh_rate = 0;
|
||||
static double s_target_refresh_rate = 0;
|
||||
static u32 s_target_refresh_rate_numerator = 0;
|
||||
static u32 s_target_refresh_rate_denominator = 1;
|
||||
|
||||
static constexpr std::array<u32, 2> s_clock_freqs{{
|
||||
27000000,
|
||||
@ -102,14 +104,11 @@ void DoState(PointerWrap& p)
|
||||
p.Do(m_DTVStatus);
|
||||
p.Do(m_FBWidth);
|
||||
p.Do(m_BorderHBlank);
|
||||
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);
|
||||
p.Do(s_even_field_first_hl);
|
||||
p.Do(s_odd_field_first_hl);
|
||||
p.Do(s_even_field_last_hl);
|
||||
p.Do(s_odd_field_last_hl);
|
||||
|
||||
UpdateParameters();
|
||||
}
|
||||
|
||||
// Executed after Init, before game boot
|
||||
@ -698,15 +697,27 @@ void UpdateParameters()
|
||||
s_even_field_first_hl = equ_hl + m_VBlankTimingEven.PRB + GetHalfLinesPerOddField();
|
||||
s_even_field_last_hl = s_even_field_first_hl + acv_hl - 1;
|
||||
|
||||
s_target_refresh_rate = lround(2.0 * SystemTimers::GetTicksPerSecond() /
|
||||
(GetTicksPerEvenField() + GetTicksPerOddField()));
|
||||
s_target_refresh_rate_numerator = SystemTimers::GetTicksPerSecond() * 2;
|
||||
s_target_refresh_rate_denominator = GetTicksPerEvenField() + GetTicksPerOddField();
|
||||
s_target_refresh_rate =
|
||||
static_cast<double>(s_target_refresh_rate_numerator) / s_target_refresh_rate_denominator;
|
||||
}
|
||||
|
||||
u32 GetTargetRefreshRate()
|
||||
double GetTargetRefreshRate()
|
||||
{
|
||||
return s_target_refresh_rate;
|
||||
}
|
||||
|
||||
u32 GetTargetRefreshRateNumerator()
|
||||
{
|
||||
return s_target_refresh_rate_numerator;
|
||||
}
|
||||
|
||||
u32 GetTargetRefreshRateDenominator()
|
||||
{
|
||||
return s_target_refresh_rate_denominator;
|
||||
}
|
||||
|
||||
u32 GetTicksPerSample()
|
||||
{
|
||||
return 2 * SystemTimers::GetTicksPerSecond() / s_clock_freqs[m_Clock];
|
||||
|
Reference in New Issue
Block a user