From acc9a741744356b14ee925a9d4dc706914dd455f Mon Sep 17 00:00:00 2001 From: booto Date: Mon, 27 Jul 2015 20:04:03 +0800 Subject: [PATCH] VI: Restore forced-progressive hack with option Bugfix: TargetRefreshRate uses rounded result NTSC's 59.94 was becoming 59 with integer division. --- Source/Core/Core/HW/VideoInterface.cpp | 23 ++++++++++++++++------- Source/Core/VideoCommon/VideoConfig.cpp | 3 +++ Source/Core/VideoCommon/VideoConfig.h | 1 + 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/HW/VideoInterface.cpp b/Source/Core/Core/HW/VideoInterface.cpp index 65784822e8..2fee313162 100644 --- a/Source/Core/Core/HW/VideoInterface.cpp +++ b/Source/Core/Core/HW/VideoInterface.cpp @@ -18,6 +18,7 @@ #include "Core/PowerPC/PowerPC.h" #include "VideoCommon/VideoBackendBase.h" +#include "VideoCommon/VideoConfig.h" namespace VideoInterface { @@ -520,7 +521,7 @@ void UpdateParameters() s_even_field_last_hl = s_odd_field_first_hl - 1; s_odd_field_last_hl = s_odd_field_first_hl + GetHalfLinesPerOddField() - 1; - TargetRefreshRate = 2 * SystemTimers::GetTicksPerSecond() / (GetTicksPerEvenField() + GetTicksPerOddField()); + TargetRefreshRate = lround(2.0 * SystemTimers::GetTicksPerSecond() / (GetTicksPerEvenField() + GetTicksPerOddField())); } u32 GetTicksPerHalfLine() @@ -564,13 +565,21 @@ static void BeginField(FieldType field) u32 xfbAddr; - if (field == FieldType::FIELD_EVEN) - { - xfbAddr = GetXFBAddressTop(); + if (g_ActiveConfig.bForceProgressive && (multiplier == 2)) { + if (m_VBlankTimingOdd.PRB < m_VBlankTimingEven.PRB) + xfbAddr = GetXFBAddressTop(); + else + xfbAddr = GetXFBAddressBottom(); } - else - { - xfbAddr = GetXFBAddressBottom(); + else { + if (field == FieldType::FIELD_EVEN) + { + xfbAddr = GetXFBAddressTop(); + } + else + { + xfbAddr = GetXFBAddressBottom(); + } } static const char* const fieldTypeNames[] = { "Odd", "Even" }; diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 92abca4819..8b79016dba 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -99,6 +99,7 @@ void VideoConfig::Load(const std::string& ini_file) IniFile::Section* hacks = iniFile.GetOrCreateSection("Hacks"); hacks->Get("EFBAccessEnable", &bEFBAccessEnable, true); hacks->Get("BBoxEnable", &bBBoxEnable, false); + hacks->Get("ForceProgressive", &bForceProgressive, true); hacks->Get("EFBToTextureEnable", &bSkipEFBCopyToRam, true); hacks->Get("EFBScaledCopy", &bCopyEFBScaled, true); hacks->Get("EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false); @@ -204,6 +205,7 @@ void VideoConfig::GameIniLoad() CHECK_SETTING("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable); CHECK_SETTING("Video_Hacks", "BBoxEnable", bBBoxEnable); + CHECK_SETTING("Video_Hacks", "ForceProgressive", bForceProgressive); CHECK_SETTING("Video_Hacks", "EFBToTextureEnable", bSkipEFBCopyToRam); CHECK_SETTING("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled); CHECK_SETTING("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges); @@ -293,6 +295,7 @@ void VideoConfig::Save(const std::string& ini_file) IniFile::Section* hacks = iniFile.GetOrCreateSection("Hacks"); hacks->Set("EFBAccessEnable", bEFBAccessEnable); hacks->Set("BBoxEnable", bBBoxEnable); + hacks->Set("ForceProgressive", bForceProgressive); hacks->Set("EFBToTextureEnable", bSkipEFBCopyToRam); hacks->Set("EFBScaledCopy", bCopyEFBScaled); hacks->Set("EFBEmulateFormatChanges", bEFBEmulateFormatChanges); diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index ad0f880c80..ea831c500c 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -112,6 +112,7 @@ struct VideoConfig final bool bEFBAccessEnable; bool bPerfQueriesEnable; bool bBBoxEnable; + bool bForceProgressive; bool bEFBEmulateFormatChanges; bool bSkipEFBCopyToRam;