From 9749d617d054b12a3507eba88b3e466bb913c35c Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 23 Jan 2011 03:28:05 +0000 Subject: [PATCH] VBeam emulation * Fixed audio sync * Fixed frame-limiter * Fixed the cursor not showing in SMG * Reworded the option to "Accurate VBeam emulation" git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6897 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/SystemTimers.cpp | 6 ++++-- Source/Core/Core/Src/HW/VideoInterface.cpp | 21 ++++++++++++++++----- Source/Core/DolphinWX/Src/ISOProperties.cpp | 2 +- Source/Core/DolphinWX/Src/ISOProperties.h | 2 +- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp index 67564659b7..8d820cf8e4 100644 --- a/Source/Core/Core/Src/HW/SystemTimers.cpp +++ b/Source/Core/Core/Src/HW/SystemTimers.cpp @@ -161,7 +161,8 @@ void DSPCallback(u64 userdata, int cyclesLate) void AudioDMACallback(u64 userdata, int cyclesLate) { - int period = CPU_CORE_CLOCK / (AudioInterface::GetAIDSampleRate() * 4 / 32); + int fields = SConfig::GetInstance().m_LocalCoreStartupParameter.bVBeam?2:1; + int period = CPU_CORE_CLOCK / (AudioInterface::GetAIDSampleRate() * 4 / 32 * fields); DSP::UpdateAudioDMA(); // Push audio to speakers. CoreTiming::ScheduleEvent(period - cyclesLate, et_AudioDMA); } @@ -258,7 +259,8 @@ void Init() // PS: When this period is tweaked, the FreqDividerMote // in WII_IPC_HLE_Device_usb.cpp should also be tweaked accordingly // to guarantee WiiMote updates at a fixed 100Hz - IPC_HLE_PERIOD = GetTicksPerSecond() / 1500; + int fields = SConfig::GetInstance().m_LocalCoreStartupParameter.bVBeam?2:1; + IPC_HLE_PERIOD = GetTicksPerSecond() / (1500 * fields); } else { diff --git a/Source/Core/Core/Src/HW/VideoInterface.cpp b/Source/Core/Core/Src/HW/VideoInterface.cpp index d0987c9ff4..36ed817849 100644 --- a/Source/Core/Core/Src/HW/VideoInterface.cpp +++ b/Source/Core/Core/Src/HW/VideoInterface.cpp @@ -66,6 +66,7 @@ static u32 TicksPerFrame = 0; static u32 s_lineCount = 0; static u32 s_upperFieldBegin = 0; static u32 s_lowerFieldBegin = 0; +static int fields = 2; void DoState(PointerWrap &p) { @@ -155,6 +156,8 @@ void Preset(bool _bNTSC) void Init() { + fields = Core::g_CoreStartupParameter.bVBeam?1:2; + m_DTVStatus.ntsc_j = Core::g_CoreStartupParameter.bNTSCJ; for (int i = 0; i < 4; i++) @@ -712,17 +715,24 @@ void UpdateParameters() switch (m_DisplayControlRegister.FMT) { case 0: // NTSC - case 2: // PAL-M TargetRefreshRate = NTSC_FIELD_RATE; - TicksPerFrame = SystemTimers::GetTicksPerSecond() / (NTSC_FIELD_RATE / 2); + TicksPerFrame = SystemTimers::GetTicksPerSecond() / (NTSC_FIELD_RATE / fields); s_lineCount = NTSC_LINE_COUNT; s_upperFieldBegin = NTSC_UPPER_BEGIN; s_lowerFieldBegin = NTSC_LOWER_BEGIN; + break; + + case 2: // PAL-M + TargetRefreshRate = NTSC_FIELD_RATE; + TicksPerFrame = SystemTimers::GetTicksPerSecond() / (NTSC_FIELD_RATE / fields); + s_lineCount = PAL_LINE_COUNT; + s_upperFieldBegin = PAL_UPPER_BEGIN; + s_lowerFieldBegin = PAL_LOWER_BEGIN; break; case 1: // PAL TargetRefreshRate = PAL_FIELD_RATE; - TicksPerFrame = SystemTimers::GetTicksPerSecond() / (PAL_FIELD_RATE / 2); + TicksPerFrame = SystemTimers::GetTicksPerSecond() / (PAL_FIELD_RATE / fields); s_lineCount = PAL_LINE_COUNT; s_upperFieldBegin = PAL_UPPER_BEGIN; s_lowerFieldBegin = PAL_LOWER_BEGIN; @@ -746,7 +756,7 @@ int GetTicksPerLine() } else { - return TicksPerFrame / (s_lineCount * 2); + return TicksPerFrame / (s_lineCount * fields); } } @@ -823,7 +833,8 @@ void Update() else if (m_VBeamPos == s_upperFieldBegin + m_VerticalTimingRegister.ACV) { // Interlace Upper. Do not EndField (swapBuffer) at the end of the upper field. - //EndField(); + if (Core::g_CoreStartupParameter.bVBeam) + EndField(); } else if (m_VBeamPos == s_lowerFieldBegin + m_VerticalTimingRegister.ACV) { diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index 091632f966..ef1bbe3278 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -310,7 +310,7 @@ void CISOProperties::CreateGUIControls(bool IsWad) MMUBAT->SetToolTip(_("Enables Block Address Translation (BAT); a function of the Memory Management Unit. Accurate to the hardware, but slow to emulate. (ON = Compatible, OFF = Fast)")); TLBHack = new wxCheckBox(m_GameConfig, ID_TLBHACK, _("MMU Speed Hack"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); TLBHack->SetToolTip(_("Fast version of the MMU. Does not work for every game.")); - VBeam = new wxCheckBox(m_GameConfig, ID_RFI, _("Disable VBeam Speed Hack"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); + VBeam = new wxCheckBox(m_GameConfig, ID_VBEAM, _("Accurate VBeam emulation"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); VBeam->SetToolTip(_("If the FPS is erratic, this option may help. (ON = Compatible, OFF = Fast)")); FastDiscSpeed = new wxCheckBox(m_GameConfig, ID_DISCSPEED, _("Speed up Disc Transfer Rate"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); FastDiscSpeed->SetToolTip(_("Enable fast disc access. Needed for a few games. (ON = Fast, OFF = Compatible)")); diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index 547e52b739..8c57d42b15 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -167,7 +167,7 @@ class CISOProperties : public wxDialog ID_MMU, ID_MMUBAT, ID_TLBHACK, - ID_RFI, + ID_VBEAM, ID_DISCSPEED, ID_MERGEBLOCKS, ID_FORCEFILTERING,