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
This commit is contained in:
skidau 2011-01-23 03:28:05 +00:00
parent a291fcca08
commit 9749d617d0
4 changed files with 22 additions and 9 deletions

View File

@ -161,7 +161,8 @@ void DSPCallback(u64 userdata, int cyclesLate)
void AudioDMACallback(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. DSP::UpdateAudioDMA(); // Push audio to speakers.
CoreTiming::ScheduleEvent(period - cyclesLate, et_AudioDMA); CoreTiming::ScheduleEvent(period - cyclesLate, et_AudioDMA);
} }
@ -258,7 +259,8 @@ void Init()
// PS: When this period is tweaked, the FreqDividerMote // PS: When this period is tweaked, the FreqDividerMote
// in WII_IPC_HLE_Device_usb.cpp should also be tweaked accordingly // in WII_IPC_HLE_Device_usb.cpp should also be tweaked accordingly
// to guarantee WiiMote updates at a fixed 100Hz // 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 else
{ {

View File

@ -66,6 +66,7 @@ static u32 TicksPerFrame = 0;
static u32 s_lineCount = 0; static u32 s_lineCount = 0;
static u32 s_upperFieldBegin = 0; static u32 s_upperFieldBegin = 0;
static u32 s_lowerFieldBegin = 0; static u32 s_lowerFieldBegin = 0;
static int fields = 2;
void DoState(PointerWrap &p) void DoState(PointerWrap &p)
{ {
@ -155,6 +156,8 @@ void Preset(bool _bNTSC)
void Init() void Init()
{ {
fields = Core::g_CoreStartupParameter.bVBeam?1:2;
m_DTVStatus.ntsc_j = Core::g_CoreStartupParameter.bNTSCJ; m_DTVStatus.ntsc_j = Core::g_CoreStartupParameter.bNTSCJ;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -712,17 +715,24 @@ void UpdateParameters()
switch (m_DisplayControlRegister.FMT) switch (m_DisplayControlRegister.FMT)
{ {
case 0: // NTSC case 0: // NTSC
case 2: // PAL-M
TargetRefreshRate = NTSC_FIELD_RATE; TargetRefreshRate = NTSC_FIELD_RATE;
TicksPerFrame = SystemTimers::GetTicksPerSecond() / (NTSC_FIELD_RATE / 2); TicksPerFrame = SystemTimers::GetTicksPerSecond() / (NTSC_FIELD_RATE / fields);
s_lineCount = NTSC_LINE_COUNT; s_lineCount = NTSC_LINE_COUNT;
s_upperFieldBegin = NTSC_UPPER_BEGIN; s_upperFieldBegin = NTSC_UPPER_BEGIN;
s_lowerFieldBegin = NTSC_LOWER_BEGIN; s_lowerFieldBegin = NTSC_LOWER_BEGIN;
break; 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 case 1: // PAL
TargetRefreshRate = PAL_FIELD_RATE; TargetRefreshRate = PAL_FIELD_RATE;
TicksPerFrame = SystemTimers::GetTicksPerSecond() / (PAL_FIELD_RATE / 2); TicksPerFrame = SystemTimers::GetTicksPerSecond() / (PAL_FIELD_RATE / fields);
s_lineCount = PAL_LINE_COUNT; s_lineCount = PAL_LINE_COUNT;
s_upperFieldBegin = PAL_UPPER_BEGIN; s_upperFieldBegin = PAL_UPPER_BEGIN;
s_lowerFieldBegin = PAL_LOWER_BEGIN; s_lowerFieldBegin = PAL_LOWER_BEGIN;
@ -746,7 +756,7 @@ int GetTicksPerLine()
} }
else 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) else if (m_VBeamPos == s_upperFieldBegin + m_VerticalTimingRegister.ACV)
{ {
// Interlace Upper. Do not EndField (swapBuffer) at the end of the upper field. // 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) else if (m_VBeamPos == s_lowerFieldBegin + m_VerticalTimingRegister.ACV)
{ {

View File

@ -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)")); 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 = 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.")); 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)")); 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 = 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)")); FastDiscSpeed->SetToolTip(_("Enable fast disc access. Needed for a few games. (ON = Fast, OFF = Compatible)"));

View File

@ -167,7 +167,7 @@ class CISOProperties : public wxDialog
ID_MMU, ID_MMU,
ID_MMUBAT, ID_MMUBAT,
ID_TLBHACK, ID_TLBHACK,
ID_RFI, ID_VBEAM,
ID_DISCSPEED, ID_DISCSPEED,
ID_MERGEBLOCKS, ID_MERGEBLOCKS,
ID_FORCEFILTERING, ID_FORCEFILTERING,