VideoInterface: Change a global into a translation-unit local variable

This commit is contained in:
Lioncash 2016-01-21 00:27:54 -05:00
parent 3a12dccac7
commit f45e1bff37
5 changed files with 13 additions and 11 deletions

View File

@ -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",

View File

@ -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;

View File

@ -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();

View File

@ -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();

View File

@ -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;