mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 00:59:44 -06:00
Merge pull request #664 from booto/dtk-surgery
DTK: Adjustments attempting to increase accuracy
This commit is contained in:
@ -58,7 +58,6 @@ This file mainly deals with the [Drive I/F], however [AIDFR] controls
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HW/AudioInterface.h"
|
||||
#include "Core/HW/CPU.h"
|
||||
#include "Core/HW/DVDInterface.h"
|
||||
#include "Core/HW/MMIO.h"
|
||||
#include "Core/HW/ProcessorInterface.h"
|
||||
#include "Core/HW/SystemTimers.h"
|
||||
@ -177,8 +176,18 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
MMIO::ComplexWrite<u32>([](u32, u32 val) {
|
||||
AICR tmpAICtrl(val);
|
||||
|
||||
m_Control.AIINTMSK = tmpAICtrl.AIINTMSK;
|
||||
m_Control.AIINTVLD = tmpAICtrl.AIINTVLD;
|
||||
|
||||
if (m_Control.AIINTMSK != tmpAICtrl.AIINTMSK)
|
||||
{
|
||||
DEBUG_LOG(AUDIO_INTERFACE, "Change AIINTMSK to %d", tmpAICtrl.AIINTMSK);
|
||||
m_Control.AIINTMSK = tmpAICtrl.AIINTMSK;
|
||||
}
|
||||
|
||||
if (m_Control.AIINTVLD != tmpAICtrl.AIINTVLD)
|
||||
{
|
||||
DEBUG_LOG(AUDIO_INTERFACE, "Change AIINTVLD to %d", tmpAICtrl.AIINTVLD);
|
||||
m_Control.AIINTVLD = tmpAICtrl.AIINTVLD;
|
||||
}
|
||||
|
||||
// Set frequency of streaming audio
|
||||
if (tmpAICtrl.AISFR != m_Control.AISFR)
|
||||
@ -207,9 +216,6 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
m_Control.PSTAT = tmpAICtrl.PSTAT;
|
||||
g_LastCPUTime = CoreTiming::GetTicks();
|
||||
|
||||
// Tell Drive Interface to start/stop streaming
|
||||
DVDInterface::g_bStream = tmpAICtrl.PSTAT;
|
||||
|
||||
CoreTiming::RemoveEvent(et_AI);
|
||||
CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI);
|
||||
}
|
||||
@ -253,6 +259,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
mmio->Register(base | AI_INTERRUPT_TIMING,
|
||||
MMIO::DirectRead<u32>(&m_InterruptTiming),
|
||||
MMIO::ComplexWrite<u32>([](u32, u32 val) {
|
||||
DEBUG_LOG(AUDIO_INTERFACE, "AI_INTERRUPT_TIMING=%08x@%08x", val, PowerPC::ppcState.pc);
|
||||
m_InterruptTiming = val;
|
||||
CoreTiming::RemoveEvent(et_AI);
|
||||
CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI);
|
||||
@ -281,14 +288,22 @@ static void IncreaseSampleCount(const u32 _iAmount)
|
||||
{
|
||||
if (m_Control.PSTAT)
|
||||
{
|
||||
u32 old_SampleCounter = m_SampleCounter + 1;
|
||||
m_SampleCounter += _iAmount;
|
||||
if (m_Control.AIINTVLD && (m_SampleCounter >= m_InterruptTiming))
|
||||
|
||||
if ((m_InterruptTiming - old_SampleCounter) <= (m_SampleCounter - old_SampleCounter))
|
||||
{
|
||||
DEBUG_LOG(AUDIO_INTERFACE, "GenerateAudioInterrupt %08x:%08x @ %08x m_Control.AIINTVLD=%d", m_SampleCounter, m_InterruptTiming, PowerPC::ppcState.pc, m_Control.AIINTVLD);
|
||||
GenerateAudioInterrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool IsPlaying()
|
||||
{
|
||||
return (m_Control.PSTAT == 1);
|
||||
}
|
||||
|
||||
unsigned int GetAIDSampleRate()
|
||||
{
|
||||
return g_AIDSampleRate;
|
||||
|
Reference in New Issue
Block a user