DSP: Add cycles parameter to all Update functions in HLE, might be useful someday :p A couple more signatures for the idle skip detector. no big functional changes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2932 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-04-08 18:36:53 +00:00
parent 541832e4f0
commit 0c4d4835ac
22 changed files with 78 additions and 63 deletions

View File

@ -39,10 +39,10 @@ CDSPHandler::~CDSPHandler()
m_pUCode = NULL;
}
void CDSPHandler::Update()
void CDSPHandler::Update(int cycles)
{
if (m_pUCode != NULL)
m_pUCode->Update();
m_pUCode->Update(cycles);
}
unsigned short CDSPHandler::WriteControlRegister(unsigned short _Value)

View File

@ -25,7 +25,7 @@
class CDSPHandler
{
public:
void Update();
void Update(int cycles);
unsigned short WriteControlRegister(unsigned short _Value);
unsigned short ReadControlRegister();
void SendMailToDSP(u32 _uMail);

View File

@ -415,7 +415,6 @@ void CUCode_AX::HandleMail(u32 _uMail)
{
DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : AXTask Mail (%08x)", _uMail);
AXTask(_uMail);
}
}
@ -423,7 +422,7 @@ void CUCode_AX::HandleMail(u32 _uMail)
// ------------------------------------------------------------------------------
// Update with DSP Interrupt
// -----------
void CUCode_AX::Update()
void CUCode_AX::Update(int cycles)
{
// check if we have to sent something
if (!m_rMailHandler.IsEmpty())

View File

@ -35,7 +35,7 @@ public:
void HandleMail(u32 _uMail);
void MixAdd(short* _pBuffer, int _iSize);
void Update();
void Update(int cycles);
// Logging
//template<class ParamBlockType>

View File

@ -225,7 +225,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
}
void CUCode_AXWii::Update()
void CUCode_AXWii::Update(int cycles)
{
// check if we have to sent something
if (!m_rMailHandler.IsEmpty())

View File

@ -33,7 +33,7 @@ public:
template<class ParamBlockType>
//void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs);
void MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs);
void Update();
void Update(int cycles);
// The logging function for the debugger
void Logging(short* _pBuffer, int _iSize, int a);

View File

@ -35,7 +35,7 @@ CUCode_CARD::~CUCode_CARD()
}
void CUCode_CARD::Update()
void CUCode_CARD::Update(int cycles)
{
// check if we have to sent something
if (!m_rMailHandler.IsEmpty())

View File

@ -38,7 +38,7 @@ public:
virtual ~CUCode_CARD();
void HandleMail(u32 _uMail);
void Update();
void Update(int cycles);
};
#endif

View File

@ -38,7 +38,7 @@ void CUCode_InitAudioSystem::Init()
{}
void CUCode_InitAudioSystem::Update()
void CUCode_InitAudioSystem::Update(int cycles)
{
if (m_rMailHandler.IsEmpty())
{

View File

@ -27,7 +27,7 @@ public:
virtual ~CUCode_InitAudioSystem();
void HandleMail(u32 _uMail);
void Update();
void Update(int cycles);
void Init();
private:

View File

@ -87,7 +87,7 @@ void CUCode_Jac::HandleMail(u32 _uMail)
}
void CUCode_Jac::Update()
void CUCode_Jac::Update(int cycles)
{
// check if we have to sent something
/* if (!g_MailHandler.empty())

View File

@ -67,7 +67,7 @@ public:
virtual ~CUCode_Jac();
void HandleMail(u32 _uMail);
void Update();
void Update(int cycles);
};
#endif

View File

@ -33,7 +33,7 @@ CUCode_Rom::CUCode_Rom(CMailHandler& _rMailHandler)
CUCode_Rom::~CUCode_Rom()
{}
void CUCode_Rom::Update()
void CUCode_Rom::Update(int cycles)
{}
void CUCode_Rom::HandleMail(u32 _uMail)

View File

@ -27,7 +27,7 @@ public:
virtual ~CUCode_Rom();
void HandleMail(u32 _uMail);
void Update();
void Update(int cycles);
private:
struct SUCode

View File

@ -47,7 +47,7 @@ CUCode_Zelda::~CUCode_Zelda()
}
void CUCode_Zelda::Update()
void CUCode_Zelda::Update(int cycles)
{
// check if we have to sent something
if (!m_rMailHandler.IsEmpty())

View File

@ -67,7 +67,7 @@ public:
virtual ~CUCode_Zelda();
void HandleMail(u32 _uMail);
void Update();
void Update(int cycles);
void MixAdd(short* buffer, int size);
};

View File

@ -36,7 +36,9 @@ public:
{}
virtual void HandleMail(u32 _uMail) = 0;
virtual void Update(void) = 0;
// Cycles are out of the 81/121mhz the DSP runs at.
virtual void Update(int cycles) = 0;
virtual void MixAdd(short* buffer, int size) {}
protected:

View File

@ -308,7 +308,8 @@ unsigned short DSP_ReadControlRegister()
void DSP_Update(int cycles)
{
CDSPHandler::GetInstance().Update();
// This is called OFTEN - better not do anything expensive!
CDSPHandler::GetInstance().Update(cycles);
}
/* Other Audio will pass through here. The kind of audio that sometimes are

View File

@ -27,20 +27,30 @@ u8 inst_flags[ISPACE];
// Good candidates for idle skipping is mail wait loops. If we're time slicing
// between the main CPU and the DSP, if the DSP runs into one of these, it might
// as well give up its time slice immediately.
// as well give up its time slice immediately, after executing once.
// Max signature length is 6. A 0 in a signature is ignored.
#define NUM_IDLE_SIGS 2
#define NUM_IDLE_SIGS 4
#define MAX_IDLE_SIG_SIZE 6
// 0xFFFF means ignore.
const u16 idle_skip_sigs[NUM_IDLE_SIGS][MAX_IDLE_SIG_SIZE + 1] =
{
{ 0x26fc, // LRS $30, @DMBH
0x02c0, 0x8000, // ANDCF $30, #0x8000
0x029d, 0xFFFF, // JLZ 0x027a
0x02df, 0 }, // RET
{ 0x27fc, // LRS $31, @DMBH
0x03c0, 0x8000, // ANDCF $31, #0x8000
0x029d, 0x027a, // JLZ 0x027a
0x029d, 0xFFFF, // JLZ 0x027a
0x02df, 0 }, // RET
{ 0x26fe, // LRS $30, @CMBH
0x02c0, 0x8000, // ANDCF $30, #0x8000
0x029c, 0xFFFF, // JLNZ 0x0280
0x02df, 0 }, // RET
{ 0x27fe, // LRS $31, @CMBH
0x03c0, 0x8000, // ANDCF $31, #0x8000
0x029c, 0x0280, // JLNZ 0x0280
0x029c, 0xFFFF, // JLNZ 0x0280
0x02df, 0 }, // RET
};
@ -80,6 +90,8 @@ void AnalyzeRange(int start_addr, int end_addr)
{
if (idle_skip_sigs[s][i] == 0)
found = true;
if (idle_skip_sigs[s][i] == 0xFFFF)
continue;
if (idle_skip_sigs[s][i] != dsp_imem_read(addr + i))
break;
}