Merge pull request #3540 from lioncash/vi

VideoInterface: Change a global into a translation-unit local variable
This commit is contained in:
Pierre Bourdon 2016-01-21 13:32:35 +01:00
commit fa785d70b1
5 changed files with 35 additions and 32 deletions

View File

@ -770,7 +770,7 @@ void VideoThrottle()
// depending on the emulation speed set // depending on the emulation speed set
bool ShouldSkipFrame(int skipped) bool ShouldSkipFrame(int skipped)
{ {
u32 TargetFPS = VideoInterface::TargetRefreshRate; u32 TargetFPS = VideoInterface::GetTargetRefreshRate();
if (SConfig::GetInstance().m_EmulationSpeed > 0.0f) if (SConfig::GetInstance().m_EmulationSpeed > 0.0f)
TargetFPS = u32(TargetFPS * SConfig::GetInstance().m_EmulationSpeed); TargetFPS = u32(TargetFPS * SConfig::GetInstance().m_EmulationSpeed);
const u32 frames = s_drawn_frame.load(); const u32 frames = s_drawn_frame.load();
@ -801,7 +801,7 @@ void UpdateTitle()
float FPS = (float)(s_drawn_frame.load() * 1000.0 / ElapseTime); float FPS = (float)(s_drawn_frame.load() * 1000.0 / ElapseTime);
float VPS = (float)(s_drawn_video.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 // 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", 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) void FifoPlayer::WriteFrame(const FifoFrameInfo& frame, const AnalyzedFrameInfo& info)
{ {
// Core timing information // Core timing information
m_CyclesPerFrame = SystemTimers::GetTicksPerSecond() / VideoInterface::TargetRefreshRate; m_CyclesPerFrame = SystemTimers::GetTicksPerSecond() / VideoInterface::GetTargetRefreshRate();
m_ElapsedCycles = 0; m_ElapsedCycles = 0;
m_FrameFifoSize = frame.fifoDataSize; m_FrameFifoSize = frame.fifoDataSize;

View File

@ -49,7 +49,7 @@ static UVIBorderBlankRegister m_BorderHBlank;
// 0xcc002076 - 0xcc00207f is full of 0x00FF: unknown // 0xcc002076 - 0xcc00207f is full of 0x00FF: unknown
// 0xcc002080 - 0xcc002100 even more unknown // 0xcc002080 - 0xcc002100 even more unknown
u32 TargetRefreshRate = 0; u32 s_target_refresh_rate = 0;
static u32 s_clock_freqs[2] = static u32 s_clock_freqs[2] =
{ {
@ -94,7 +94,7 @@ void DoState(PointerWrap &p)
p.Do(m_DTVStatus); p.Do(m_DTVStatus);
p.Do(m_FBWidth); p.Do(m_FBWidth);
p.Do(m_BorderHBlank); p.Do(m_BorderHBlank);
p.Do(TargetRefreshRate); p.Do(s_target_refresh_rate);
p.Do(s_ticks_last_line_start); p.Do(s_ticks_last_line_start);
p.Do(s_half_line_count); p.Do(s_half_line_count);
p.Do(s_half_line_of_next_si_poll); 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_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; 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() u32 GetTicksPerSample()
@ -622,7 +627,6 @@ u32 GetTicksPerHalfLine()
return GetTicksPerSample() * m_HTiming0.HLW; return GetTicksPerSample() * m_HTiming0.HLW;
} }
u32 GetTicksPerField() u32 GetTicksPerField()
{ {
return GetTicksPerEvenField(); return GetTicksPerEvenField();

View File

@ -305,36 +305,35 @@ union UVIHorizontalStepping
}; };
}; };
// urgh, ugly externs. // For BS2 HLE
extern u32 TargetRefreshRate; void Preset(bool _bNTSC);
// For BS2 HLE void Init();
void Preset(bool _bNTSC); void SetRegionReg(char region);
void DoState(PointerWrap &p);
void Init(); void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
void SetRegionReg(char region);
void DoState(PointerWrap &p);
void RegisterMMIO(MMIO::Mapping* mmio, u32 base); // returns a pointer to the current visible xfb
u32 GetXFBAddressTop();
u32 GetXFBAddressBottom();
// returns a pointer to the current visible xfb // Update and draw framebuffer
u32 GetXFBAddressTop(); void Update();
u32 GetXFBAddressBottom();
// Update and draw framebuffer // UpdateInterrupts: check if we have to generate a new VI Interrupt
void Update(); void UpdateInterrupts();
// UpdateInterrupts: check if we have to generate a new VI Interrupt // Change values pertaining to video mode
void UpdateInterrupts(); void UpdateParameters();
// Change values pertaining to video mode u32 GetTargetRefreshRate();
void UpdateParameters(); u32 GetTicksPerSample();
u32 GetTicksPerHalfLine();
u32 GetTicksPerField();
u32 GetTicksPerSample(); // Get the aspect ratio of VI's active area.
u32 GetTicksPerHalfLine(); // This function only deals with standard aspect ratios. For widescreen aspect ratios, multiply the result by 1.33333..
u32 GetTicksPerField(); float GetAspectRatio();
// Get the aspect ratio of VI's active area. } // namespace VideoInterface
// This function only deals with standard aspect ratios. For widescreen aspect ratios, multiply the result by 1.33333..
float GetAspectRatio();
}

View File

@ -108,7 +108,7 @@ bool AVIDump::CreateFile()
s_stream->codec->width = s_width; s_stream->codec->width = s_width;
s_stream->codec->height = s_height; s_stream->codec->height = s_height;
s_stream->codec->time_base.num = 1; 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->gop_size = 12;
s_stream->codec->pix_fmt = g_Config.bUseFFV1 ? AV_PIX_FMT_BGRA : AV_PIX_FMT_YUV420P; s_stream->codec->pix_fmt = g_Config.bUseFFV1 ? AV_PIX_FMT_BGRA : AV_PIX_FMT_YUV420P;