Forced an exception check after an interrupt is generated by the DSP. Changed the timing back to 3ms/5ms periods, fixing the slowdown and garbled AX audio.

Fixed Accurate VBeam emulation when DSP HLE audio is being used.
This commit is contained in:
skidau 2013-04-07 16:27:46 +10:00
parent 53368823cb
commit 52053f5d95
4 changed files with 21 additions and 20 deletions

View File

@ -647,6 +647,7 @@ void GenerateDSPInterruptFromDSPEmu(DSPInterruptType type, bool _bSet)
{
CoreTiming::ScheduleEvent_Threadsafe(
0, et_GenerateDSPInterrupt, type | (_bSet<<16));
CoreTiming::ForceExceptionCheck(100);
}
// called whenever SystemTimers thinks the dsp deserves a few more cycles

View File

@ -112,23 +112,16 @@ u8 *CUCode_Zelda::GetARAMPointer(u32 address)
void CUCode_Zelda::Update(int cycles)
{
m_cycles += cycles;
if (m_cycles >= 243000)
if (!IsLightVersion())
{
m_cycles = 0;
if (!IsLightVersion())
{
if (m_rMailHandler.GetNextMail() == DSP_FRAME_END)
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
}
if (NeedsResumeMail())
{
m_rMailHandler.PushMail(DSP_RESUME);
if (m_rMailHandler.GetNextMail() == DSP_FRAME_END)
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
}
}
if (NeedsResumeMail())
{
m_rMailHandler.PushMail(DSP_RESUME);
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
}
}

View File

@ -275,8 +275,6 @@ private:
u32 m_PBAddress; // The main param block array
u32 m_PBAddress2; // 4 smaller param blocks
u32 m_cycles;
void ExecuteList();
u8 *GetARAMPointer(u32 address);

View File

@ -243,6 +243,8 @@ void PreInit()
void Init()
{
const int fields = SConfig::GetInstance().m_LocalCoreStartupParameter.bVBeam ? 2 : 1;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{
// AyuanX: TO BE TWEAKED
@ -251,12 +253,19 @@ void Init()
// FYI, WII_IPC_HLE_Interface::Update is also called in WII_IPCInterface::Write32
const int freq = 1500;
const int fields = SConfig::GetInstance().m_LocalCoreStartupParameter.
bVBeam ? 2 : 1;
IPC_HLE_PERIOD = GetTicksPerSecond() / (freq * fields);
}
DSP_PERIOD = 12500; // TO BE TWEAKED (> 15000 breaks Lost Kingdom II)
if (DSP::GetDSPEmulator()->IsLLE())
{
DSP_PERIOD = 12000; // TO BE TWEAKED
}
else
{
// AX HLE uses 3ms (Wii) or 5ms (GC) timing period
int ms_to_process = SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5;
DSP_PERIOD = (int)(GetTicksPerSecond() / 1000) * ms_to_process / fields;
}
// System internal sample rate is fixed at 32KHz * 4 (16bit Stereo) / 32 bytes DMA
AUDIO_DMA_PERIOD = CPU_CORE_CLOCK / (AudioInterface::GetAIDSampleRate() * 4 / 32);