summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2013-04-07 16:27:46 +1000
committerskidau <skidau@gmail.com>2013-04-07 16:27:46 +1000
commit52053f5d958d9c9c7467858be3d2e07ef4e2bf19 (patch)
treec03919f2b3eddb4200c4be55bb82dc33d4ad840a /Source/Core
parent53368823cb26178934189956dd50c07c3a365b86 (diff)
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.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/HW/DSP.cpp1
-rw-r--r--Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.cpp23
-rw-r--r--Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.h2
-rw-r--r--Source/Core/Core/Src/HW/SystemTimers.cpp15
4 files changed, 21 insertions, 20 deletions
diff --git a/Source/Core/Core/Src/HW/DSP.cpp b/Source/Core/Core/Src/HW/DSP.cpp
index a24c8920af..a0c597326f 100644
--- a/Source/Core/Core/Src/HW/DSP.cpp
+++ b/Source/Core/Core/Src/HW/DSP.cpp
@@ -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
diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.cpp
index ba9f4ec222..9d392cd6b0 100644
--- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.cpp
+++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.cpp
@@ -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);
}
}
diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.h
index d105d3dea9..94a5bcea3f 100644
--- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.h
+++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.h
@@ -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);
diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp
index 5854f728cb..749ab584a1 100644
--- a/Source/Core/Core/Src/HW/SystemTimers.cpp
+++ b/Source/Core/Core/Src/HW/SystemTimers.cpp
@@ -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);