mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Thanks to Wagnard28 and other lots of people's test, now this will hopefully solve the troubling regression problems between r4616 and r4617.
Sorry about such frequent commits in a short time git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4619 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -139,6 +139,14 @@ struct AudioDMA
|
|||||||
u32 ReadAddress;
|
u32 ReadAddress;
|
||||||
UAudioDMAControl AudioDMAControl;
|
UAudioDMAControl AudioDMAControl;
|
||||||
int BlocksLeft;
|
int BlocksLeft;
|
||||||
|
|
||||||
|
AudioDMA()
|
||||||
|
{
|
||||||
|
SourceAddress = 0;
|
||||||
|
ReadAddress = 0;
|
||||||
|
AudioDMAControl.Hex = 0;
|
||||||
|
BlocksLeft = 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ARDMA
|
// ARDMA
|
||||||
@ -212,6 +220,7 @@ void Init()
|
|||||||
{
|
{
|
||||||
g_ARAM = (u8 *)AllocateMemoryPages(ARAM_SIZE);
|
g_ARAM = (u8 *)AllocateMemoryPages(ARAM_SIZE);
|
||||||
}
|
}
|
||||||
|
g_audioDMA.AudioDMAControl.Hex = 0;
|
||||||
g_dspState.DSPControl.Hex = 0;
|
g_dspState.DSPControl.Hex = 0;
|
||||||
g_dspState.DSPControl.DSPHalt = 1;
|
g_dspState.DSPControl.DSPHalt = 1;
|
||||||
et_GenerateDSPInterrupt = CoreTiming::RegisterEvent("DSPint", GenerateDSPInterrupt_Wrapper);
|
et_GenerateDSPInterrupt = CoreTiming::RegisterEvent("DSPint", GenerateDSPInterrupt_Wrapper);
|
||||||
@ -408,20 +417,12 @@ void Write16(const u16 _Value, const u32 _Address)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case AUDIO_DMA_CONTROL_LEN: // called by AIStartDMA()
|
case AUDIO_DMA_CONTROL_LEN: // called by AIStartDMA()
|
||||||
{
|
|
||||||
UAudioDMAControl old_control = g_audioDMA.AudioDMAControl;
|
|
||||||
g_audioDMA.AudioDMAControl.Hex = _Value;
|
g_audioDMA.AudioDMAControl.Hex = _Value;
|
||||||
|
g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
|
||||||
if (!old_control.Enabled && g_audioDMA.AudioDMAControl.Enabled)
|
g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
|
||||||
{
|
INFO_LOG(DSPINTERFACE, "AID DMA started - source address %08x, length %i blocks", g_audioDMA.SourceAddress, g_audioDMA.AudioDMAControl.NumBlocks);
|
||||||
// Enabled bit was flipped to true, let's latch address & length and call the interrupt.
|
|
||||||
g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
|
|
||||||
g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
|
|
||||||
GenerateDSPInterrupt(DSP::INT_AID);
|
|
||||||
INFO_LOG(DSPINTERFACE, "AID DMA started - source address %08x, length %i blocks", g_audioDMA.SourceAddress, g_audioDMA.AudioDMAControl.NumBlocks);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case AUDIO_DMA_BYTES_LEFT:
|
case AUDIO_DMA_BYTES_LEFT:
|
||||||
_dbg_assert_(DSPINTERFACE,0);
|
_dbg_assert_(DSPINTERFACE,0);
|
||||||
break;
|
break;
|
||||||
@ -446,9 +447,8 @@ void UpdateAudioDMA()
|
|||||||
g_audioDMA.ReadAddress += 32;
|
g_audioDMA.ReadAddress += 32;
|
||||||
g_audioDMA.BlocksLeft--;
|
g_audioDMA.BlocksLeft--;
|
||||||
if (!g_audioDMA.BlocksLeft) {
|
if (!g_audioDMA.BlocksLeft) {
|
||||||
// No need to turn off the DMA - we can only get here if we had
|
// Latch new parameters
|
||||||
// blocks left when we entered this function, and no longer have
|
// This is mainly used by NGC games which do auto loops
|
||||||
// any. Latch new parameters
|
|
||||||
g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
|
g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
|
||||||
g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
|
g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
|
||||||
// DEBUG_LOG(DSPLLE, "ADMA read addresses: %08x", g_audioDMA.ReadAddress);
|
// DEBUG_LOG(DSPLLE, "ADMA read addresses: %08x", g_audioDMA.ReadAddress);
|
||||||
|
@ -184,7 +184,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PB)
|
|||||||
if (!ReadOutPBWii(blockAddr, PB))
|
if (!ReadOutPBWii(blockAddr, PB))
|
||||||
break;
|
break;
|
||||||
ProcessUpdates(PB);
|
ProcessUpdates(PB);
|
||||||
MixAddVoice(PB, templbuffer, temprbuffer, _iSize, true, _CRC);
|
MixAddVoice(PB, templbuffer, temprbuffer, _iSize, true, UCODE_AXWII);
|
||||||
if (!WriteBackPBWii(blockAddr, PB))
|
if (!WriteBackPBWii(blockAddr, PB))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#ifndef _UCODE_AX_VOICE_H
|
#ifndef _UCODE_AX_VOICE_H
|
||||||
#define _UCODE_AX_VOICE_H
|
#define _UCODE_AX_VOICE_H
|
||||||
|
|
||||||
|
#include "UCodes.h"
|
||||||
#include "UCode_AX_ADPCM.h"
|
#include "UCode_AX_ADPCM.h"
|
||||||
#include "UCode_AX.h"
|
#include "UCode_AX.h"
|
||||||
#include "../main.h"
|
#include "../main.h"
|
||||||
@ -82,7 +83,7 @@ inline bool WriteBackPBWii(u32 pb_address, ParamBlockType& PB)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class ParamBlockType>
|
template<class ParamBlockType>
|
||||||
inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer, int _iSize, bool Wii, u32 CRC = 0)
|
inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer, int _iSize, bool Wii, u32 _uCode = UCODE_ROM)
|
||||||
{
|
{
|
||||||
ratioFactor = 32000.0f / (float)soundStream->GetMixer()->GetSampleRate();
|
ratioFactor = 32000.0f / (float)soundStream->GetMixer()->GetSampleRate();
|
||||||
|
|
||||||
@ -245,15 +246,14 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This accurate boundary wrapping will fix the hangup in many Wii games like:
|
if (Wii && (_uCode == UCODE_AXWII))
|
||||||
// New Super Mario Bros.Wii, Fatal Frame 4,
|
|
||||||
// Resident Evil Darkside Chronicles, Muramasa The Demon Blade, etc.
|
|
||||||
samplePos = newSamplePos - sampleEnd + loopPos;
|
|
||||||
|
|
||||||
if (Wii && (CRC == 0xfa450138))
|
|
||||||
{
|
{
|
||||||
// Some Wii games check this flag and will turn it off when necessary
|
// This accurate boundary wrapping will fix the hangup in many AXWii games like:
|
||||||
// If that is the case, DSP should not touch it
|
// New Super Mario Bros.Wii, Fatal Frame 4, Resident Evil Darkside Chronicles
|
||||||
|
samplePos = newSamplePos - sampleEnd + loopPos;
|
||||||
|
|
||||||
|
// And these AXWii games check this flag and will turn it off when necessary
|
||||||
|
// So DSP should not touch it
|
||||||
//
|
//
|
||||||
//pb.running = 0;
|
//pb.running = 0;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#define UCODE_ROM 0x0000000
|
#define UCODE_ROM 0x0000000
|
||||||
#define UCODE_INIT_AUDIO_SYSTEM 0x0000001
|
#define UCODE_INIT_AUDIO_SYSTEM 0x0000001
|
||||||
|
#define UCODE_AXWII 0x1000000
|
||||||
|
|
||||||
class CMailHandler;
|
class CMailHandler;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user