dsphle cleanup: Get rid of now-useless "DSPHandler" layer
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6948 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
419d6a244b
commit
d61a79266a
|
@ -722,14 +722,6 @@
|
|||
<Filter
|
||||
Name="HLE"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\HW\DSPHLE\DSPHandler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\HW\DSPHLE\DSPHandler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\HW\DSPHLE\DSPHLE.cpp"
|
||||
>
|
||||
|
|
|
@ -22,17 +22,17 @@
|
|||
#include "ChunkFile.h"
|
||||
#include "IniFile.h"
|
||||
#include "HLEMixer.h"
|
||||
#include "DSPHandler.h"
|
||||
#include "Config.h"
|
||||
#include "Setup.h"
|
||||
#include "StringUtil.h"
|
||||
#include "LogManager.h"
|
||||
#include "IniFile.h"
|
||||
#include "DSPHLE.h"
|
||||
#include "UCodes/UCodes.h"
|
||||
#include "../AudioInterface.h"
|
||||
|
||||
DSPHLE::DSPHLE() {
|
||||
g_InitMixer = false;
|
||||
m_InitMixer = false;
|
||||
soundStream = NULL;
|
||||
}
|
||||
|
||||
|
@ -52,17 +52,23 @@ struct DSPState
|
|||
Reset();
|
||||
}
|
||||
};
|
||||
DSPState g_dspState;
|
||||
DSPState m_dspState;
|
||||
|
||||
void DSPHLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
|
||||
{
|
||||
this->hWnd = hWnd;
|
||||
this->bWii = bWii;
|
||||
m_hWnd = hWnd;
|
||||
m_bWii = bWii;
|
||||
m_pUCode = NULL;
|
||||
m_lastUCode = NULL;
|
||||
m_bHalt = false;
|
||||
m_bAssertInt = false;
|
||||
|
||||
g_InitMixer = false;
|
||||
g_dspState.Reset();
|
||||
SetUCode(UCODE_ROM);
|
||||
m_DSPControl.DSPHalt = 1;
|
||||
m_DSPControl.DSPInit = 1;
|
||||
|
||||
CDSPHandler::CreateInstance(bWii);
|
||||
m_InitMixer = false;
|
||||
m_dspState.Reset();
|
||||
}
|
||||
|
||||
void DSPHLE::DSP_StopSoundStream()
|
||||
|
@ -72,15 +78,60 @@ void DSPHLE::DSP_StopSoundStream()
|
|||
void DSPHLE::Shutdown()
|
||||
{
|
||||
AudioCommon::ShutdownSoundStream();
|
||||
}
|
||||
|
||||
// Delete the UCodes
|
||||
CDSPHandler::Destroy();
|
||||
void DSPHLE::Update(int cycles)
|
||||
{
|
||||
if (m_pUCode != NULL)
|
||||
m_pUCode->Update(cycles);
|
||||
}
|
||||
|
||||
void DSPHLE::SendMailToDSP(u32 _uMail)
|
||||
{
|
||||
if (m_pUCode != NULL) {
|
||||
DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", _uMail);
|
||||
m_pUCode->HandleMail(_uMail);
|
||||
}
|
||||
}
|
||||
|
||||
IUCode* DSPHLE::GetUCode()
|
||||
{
|
||||
return m_pUCode;
|
||||
}
|
||||
|
||||
void DSPHLE::SetUCode(u32 _crc)
|
||||
{
|
||||
delete m_pUCode;
|
||||
|
||||
m_pUCode = NULL;
|
||||
m_MailHandler.Clear();
|
||||
m_pUCode = UCodeFactory(_crc, this, m_bWii);
|
||||
}
|
||||
|
||||
// TODO do it better?
|
||||
// Assumes that every odd call to this func is by the persistent ucode.
|
||||
// Even callers are deleted.
|
||||
void DSPHLE::SwapUCode(u32 _crc)
|
||||
{
|
||||
m_MailHandler.Clear();
|
||||
|
||||
if (m_lastUCode == NULL)
|
||||
{
|
||||
m_lastUCode = m_pUCode;
|
||||
m_pUCode = UCodeFactory(_crc, this, m_bWii);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_pUCode;
|
||||
m_pUCode = m_lastUCode;
|
||||
m_lastUCode = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void DSPHLE::DoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(g_InitMixer);
|
||||
CDSPHandler::GetInstance().GetUCode()->DoState(p);
|
||||
p.Do(m_InitMixer);
|
||||
GetUCode()->DoState(p);
|
||||
}
|
||||
|
||||
void DSPHLE::EmuStateChange(PLUGIN_EMUSTATE newState)
|
||||
|
@ -93,11 +144,11 @@ unsigned short DSPHLE::DSP_ReadMailBoxHigh(bool _CPUMailbox)
|
|||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
return (g_dspState.CPUMailbox >> 16) & 0xFFFF;
|
||||
return (m_dspState.CPUMailbox >> 16) & 0xFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxHigh();
|
||||
return AccessMailHandler().ReadDSPMailboxHigh();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,11 +156,11 @@ unsigned short DSPHLE::DSP_ReadMailBoxLow(bool _CPUMailbox)
|
|||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
return g_dspState.CPUMailbox & 0xFFFF;
|
||||
return m_dspState.CPUMailbox & 0xFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxLow();
|
||||
return AccessMailHandler().ReadDSPMailboxLow();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +168,7 @@ void DSPHLE::DSP_WriteMailBoxHigh(bool _CPUMailbox, unsigned short _Value)
|
|||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF) | (_Value << 16);
|
||||
m_dspState.CPUMailbox = (m_dspState.CPUMailbox & 0xFFFF) | (_Value << 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -129,10 +180,10 @@ void DSPHLE::DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short _Value)
|
|||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF0000) | _Value;
|
||||
CDSPHandler::GetInstance().SendMailToDSP(g_dspState.CPUMailbox);
|
||||
m_dspState.CPUMailbox = (m_dspState.CPUMailbox & 0xFFFF0000) | _Value;
|
||||
SendMailToDSP(m_dspState.CPUMailbox);
|
||||
// Mail sent so clear MSB to show that it is progressed
|
||||
g_dspState.CPUMailbox &= 0x7FFFFFFF;
|
||||
m_dspState.CPUMailbox &= 0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -140,12 +191,35 @@ void DSPHLE::DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short _Value)
|
|||
}
|
||||
}
|
||||
|
||||
u16 DSPHLE::WriteControlRegister(u16 _Value)
|
||||
{
|
||||
UDSPControl Temp(_Value);
|
||||
if (Temp.DSPReset)
|
||||
{
|
||||
SetUCode(UCODE_ROM);
|
||||
Temp.DSPReset = 0;
|
||||
}
|
||||
if (Temp.DSPInit == 0)
|
||||
{
|
||||
// copy 128 byte from ARAM 0x000000 to IMEM
|
||||
SetUCode(UCODE_INIT_AUDIO_SYSTEM);
|
||||
Temp.DSPInitCode = 0;
|
||||
}
|
||||
|
||||
m_DSPControl.Hex = Temp.Hex;
|
||||
return m_DSPControl.Hex;
|
||||
}
|
||||
|
||||
u16 DSPHLE::ReadControlRegister()
|
||||
{
|
||||
return m_DSPControl.Hex;
|
||||
}
|
||||
|
||||
// Other DSP fuctions
|
||||
unsigned short DSPHLE::DSP_WriteControlRegister(unsigned short _Value)
|
||||
{
|
||||
UDSPControl Temp(_Value);
|
||||
if (!g_InitMixer)
|
||||
if (!m_InitMixer)
|
||||
{
|
||||
if (!Temp.DSPHalt && Temp.DSPInit)
|
||||
{
|
||||
|
@ -158,25 +232,25 @@ unsigned short DSPHLE::DSP_WriteControlRegister(unsigned short _Value)
|
|||
BackendSampleRate = 32000;
|
||||
|
||||
soundStream = AudioCommon::InitSoundStream(
|
||||
new HLEMixer(AISampleRate, DACSampleRate, BackendSampleRate), hWnd);
|
||||
new HLEMixer(this, AISampleRate, DACSampleRate, BackendSampleRate), m_hWnd);
|
||||
if(!soundStream) PanicAlert("Error starting up sound stream");
|
||||
// Mixer is initialized
|
||||
g_InitMixer = true;
|
||||
m_InitMixer = true;
|
||||
}
|
||||
}
|
||||
return CDSPHandler::GetInstance().WriteControlRegister(_Value);
|
||||
return WriteControlRegister(_Value);
|
||||
}
|
||||
|
||||
unsigned short DSPHLE::DSP_ReadControlRegister()
|
||||
u16 DSPHLE::DSP_ReadControlRegister()
|
||||
{
|
||||
return CDSPHandler::GetInstance().ReadControlRegister();
|
||||
return ReadControlRegister();
|
||||
}
|
||||
|
||||
void DSPHLE::DSP_Update(int cycles)
|
||||
{
|
||||
// This is called OFTEN - better not do anything expensive!
|
||||
// ~1/6th as many cycles as the period PPC-side.
|
||||
CDSPHandler::GetInstance().Update(cycles / 6);
|
||||
Update(cycles / 6);
|
||||
}
|
||||
|
||||
// The reason that we don't disable this entire
|
||||
|
|
|
@ -18,10 +18,14 @@
|
|||
#ifndef _DSPHLE_H
|
||||
#define _DSPHLE_H
|
||||
|
||||
#include "AudioCommon.h"
|
||||
#include "SoundStream.h"
|
||||
#include "DSPHLEGlobals.h" // Local
|
||||
#include "MailHandler.h"
|
||||
#include "../../PluginDSP.h"
|
||||
|
||||
class IUCode;
|
||||
|
||||
class DSPHLE : public PluginDSP {
|
||||
public:
|
||||
DSPHLE();
|
||||
|
@ -52,15 +56,26 @@ public:
|
|||
virtual void DSP_StopSoundStream();
|
||||
virtual void DSP_ClearAudioBuffer(bool mute);
|
||||
|
||||
// Formerly DSPHandler
|
||||
void Update(int cycles);
|
||||
u16 WriteControlRegister(u16 _Value);
|
||||
u16 ReadControlRegister();
|
||||
void SendMailToDSP(u32 _uMail);
|
||||
IUCode *GetUCode();
|
||||
void SetUCode(u32 _crc);
|
||||
void SwapUCode(u32 _crc);
|
||||
|
||||
CMailHandler& AccessMailHandler() { return m_MailHandler; }
|
||||
|
||||
private:
|
||||
// Declarations and definitions
|
||||
void *hWnd;
|
||||
bool bWii;
|
||||
void *m_hWnd;
|
||||
bool m_bWii;
|
||||
|
||||
bool g_InitMixer;
|
||||
bool m_InitMixer;
|
||||
SoundStream *soundStream;
|
||||
|
||||
// Mailbox utility
|
||||
// Fake mailbox utility
|
||||
struct DSPState
|
||||
{
|
||||
u32 CPUMailbox;
|
||||
|
@ -76,7 +91,16 @@ private:
|
|||
Reset();
|
||||
}
|
||||
};
|
||||
DSPState g_dspState;
|
||||
DSPState m_dspState;
|
||||
|
||||
IUCode* m_pUCode;
|
||||
IUCode* m_lastUCode;
|
||||
|
||||
UDSPControl m_DSPControl;
|
||||
CMailHandler m_MailHandler;
|
||||
|
||||
bool m_bHalt;
|
||||
bool m_bAssertInt;
|
||||
};
|
||||
|
||||
// Hack to be deleted.
|
||||
|
|
|
@ -1,110 +0,0 @@
|
|||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "DSPHandler.h"
|
||||
|
||||
CDSPHandler* CDSPHandler::m_pInstance = NULL;
|
||||
|
||||
CDSPHandler::CDSPHandler(bool bWii)
|
||||
: m_pUCode(NULL),
|
||||
m_lastUCode(NULL),
|
||||
m_bHalt(false),
|
||||
m_bAssertInt(false),
|
||||
m_bWii(bWii)
|
||||
{
|
||||
SetUCode(UCODE_ROM);
|
||||
m_DSPControl.DSPHalt = 1;
|
||||
m_DSPControl.DSPInit = 1;
|
||||
}
|
||||
|
||||
CDSPHandler::~CDSPHandler()
|
||||
{
|
||||
delete m_pUCode;
|
||||
m_pUCode = NULL;
|
||||
}
|
||||
|
||||
void CDSPHandler::Update(int cycles)
|
||||
{
|
||||
if (m_pUCode != NULL)
|
||||
m_pUCode->Update(cycles);
|
||||
}
|
||||
|
||||
unsigned short CDSPHandler::WriteControlRegister(unsigned short _Value)
|
||||
{
|
||||
UDSPControl Temp(_Value);
|
||||
if (Temp.DSPReset)
|
||||
{
|
||||
SetUCode(UCODE_ROM);
|
||||
Temp.DSPReset = 0;
|
||||
}
|
||||
if (Temp.DSPInit == 0)
|
||||
{
|
||||
// copy 128 byte from ARAM 0x000000 to IMEM
|
||||
SetUCode(UCODE_INIT_AUDIO_SYSTEM);
|
||||
Temp.DSPInitCode = 0;
|
||||
}
|
||||
|
||||
m_DSPControl.Hex = Temp.Hex;
|
||||
return m_DSPControl.Hex;
|
||||
}
|
||||
|
||||
unsigned short CDSPHandler::ReadControlRegister()
|
||||
{
|
||||
return m_DSPControl.Hex;
|
||||
}
|
||||
|
||||
void CDSPHandler::SendMailToDSP(u32 _uMail)
|
||||
{
|
||||
if (m_pUCode != NULL) {
|
||||
DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", _uMail);
|
||||
m_pUCode->HandleMail(_uMail);
|
||||
}
|
||||
}
|
||||
|
||||
IUCode* CDSPHandler::GetUCode()
|
||||
{
|
||||
return m_pUCode;
|
||||
}
|
||||
|
||||
void CDSPHandler::SetUCode(u32 _crc)
|
||||
{
|
||||
delete m_pUCode;
|
||||
|
||||
m_pUCode = NULL;
|
||||
m_MailHandler.Clear();
|
||||
m_pUCode = UCodeFactory(_crc, m_MailHandler, m_bWii);
|
||||
}
|
||||
|
||||
// TODO do it better?
|
||||
// Assumes that every odd call to this func is by the persistent ucode.
|
||||
// Even callers are deleted.
|
||||
void CDSPHandler::SwapUCode(u32 _crc)
|
||||
{
|
||||
m_MailHandler.Clear();
|
||||
|
||||
if (m_lastUCode == NULL)
|
||||
{
|
||||
m_lastUCode = m_pUCode;
|
||||
m_pUCode = UCodeFactory(_crc, m_MailHandler, m_bWii);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_pUCode;
|
||||
m_pUCode = m_lastUCode;
|
||||
m_lastUCode = NULL;
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _DSPHANDLER_H
|
||||
#define _DSPHANDLER_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "AudioCommon.h"
|
||||
#include "MailHandler.h"
|
||||
#include "UCodes/UCodes.h"
|
||||
|
||||
class CDSPHandler : NonCopyable
|
||||
{
|
||||
public:
|
||||
void Update(int cycles);
|
||||
unsigned short WriteControlRegister(unsigned short _Value);
|
||||
unsigned short ReadControlRegister();
|
||||
void SendMailToDSP(u32 _uMail);
|
||||
IUCode* GetUCode();
|
||||
void SetUCode(u32 _crc);
|
||||
void SwapUCode(u32 _crc);
|
||||
|
||||
CMailHandler& AccessMailHandler() { return m_MailHandler; }
|
||||
|
||||
static CDSPHandler& GetInstance()
|
||||
{
|
||||
return *m_pInstance;
|
||||
}
|
||||
|
||||
static void Destroy()
|
||||
{
|
||||
delete m_pInstance;
|
||||
m_pInstance = NULL;
|
||||
}
|
||||
|
||||
static CDSPHandler& CreateInstance(bool bWii)
|
||||
{
|
||||
if (!m_pInstance)
|
||||
m_pInstance = new CDSPHandler(bWii);
|
||||
|
||||
return *m_pInstance;
|
||||
}
|
||||
|
||||
private:
|
||||
CDSPHandler(bool bWii);
|
||||
~CDSPHandler();
|
||||
|
||||
// singleton instance
|
||||
static CDSPHandler* m_pInstance;
|
||||
|
||||
IUCode* m_pUCode;
|
||||
IUCode* m_lastUCode;
|
||||
|
||||
UDSPControl m_DSPControl;
|
||||
CMailHandler m_MailHandler;
|
||||
|
||||
bool m_bHalt;
|
||||
bool m_bAssertInt;
|
||||
bool m_bWii;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -17,15 +17,16 @@
|
|||
|
||||
#include "Config.h" // Local
|
||||
#include "DSPHLEGlobals.h"
|
||||
#include "DSPHandler.h"
|
||||
#include "DSPHLE.h"
|
||||
#include "HLEMixer.h"
|
||||
#include "UCodes/UCodes.h"
|
||||
|
||||
void HLEMixer::Premix(short *samples, unsigned int numSamples)
|
||||
{
|
||||
// if this was called directly from the HLE
|
||||
if (IsHLEReady())
|
||||
{
|
||||
IUCode *pUCode = CDSPHandler::GetInstance().GetUCode();
|
||||
IUCode *pUCode = m_DSPHLE->GetUCode();
|
||||
if (pUCode && samples)
|
||||
pUCode->MixAdd(samples, numSamples);
|
||||
}
|
||||
|
|
|
@ -3,13 +3,17 @@
|
|||
#include "AudioCommon.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
class DSPHLE;
|
||||
|
||||
class HLEMixer : public CMixer
|
||||
{
|
||||
public:
|
||||
HLEMixer(unsigned int AISampleRate = 48000, unsigned int DACSampleRate = 48000, unsigned int BackendSampleRate = 32000)
|
||||
: CMixer(AISampleRate, DACSampleRate, BackendSampleRate) {};
|
||||
HLEMixer(DSPHLE *dsp_hle, unsigned int AISampleRate = 48000, unsigned int DACSampleRate = 48000, unsigned int BackendSampleRate = 32000)
|
||||
: CMixer(AISampleRate, DACSampleRate, BackendSampleRate), m_DSPHLE(dsp_hle) {};
|
||||
|
||||
virtual void Premix(short *samples, unsigned int numSamples);
|
||||
private:
|
||||
DSPHLE *m_DSPHLE;
|
||||
};
|
||||
|
||||
#endif // HLEMIXER_H
|
||||
|
|
|
@ -22,16 +22,15 @@
|
|||
#include "../DSPHLEGlobals.h"
|
||||
#include "Mixer.h"
|
||||
#include "../MailHandler.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "../../DSP.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_AXStructs.h"
|
||||
#include "UCode_AX.h"
|
||||
#include "UCode_AX_Voice.h"
|
||||
|
||||
CUCode_AX::CUCode_AX(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
, m_addressPBs(0xFFFFFFFF)
|
||||
CUCode_AX::CUCode_AX(DSPHLE *dsp_hle)
|
||||
: IUCode(dsp_hle)
|
||||
, m_addressPBs(0xFFFFFFFF)
|
||||
{
|
||||
// we got loaded
|
||||
m_rMailHandler.PushMail(DSP_INIT);
|
||||
|
@ -235,7 +234,7 @@ void CUCode_AX::HandleMail(u32 _uMail)
|
|||
else if (_uMail == 0xCDD10002) // Action 2 - IROM_Reset(); ( GC: NFS Carbon, FF Crystal Chronicles,...)
|
||||
{
|
||||
DEBUG_LOG(DSPHLE,"DSP IROM - Reset!");
|
||||
CDSPHandler::GetInstance().SetUCode(UCODE_ROM);
|
||||
m_DSPHLE->SetUCode(UCODE_ROM);
|
||||
return;
|
||||
}
|
||||
else if (_uMail == 0xCDD10003) // Action 3 - AX_GetNextCmdBlock();
|
||||
|
|
|
@ -29,7 +29,7 @@ enum
|
|||
class CUCode_AX : public IUCode
|
||||
{
|
||||
public:
|
||||
CUCode_AX(CMailHandler& _rMailHandler);
|
||||
CUCode_AX(DSPHLE *dsp_hle);
|
||||
virtual ~CUCode_AX();
|
||||
|
||||
void HandleMail(u32 _uMail);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "../MailHandler.h"
|
||||
#include "Mixer.h"
|
||||
#include "../DSPHandler.h"
|
||||
|
||||
#include "UCodes.h"
|
||||
#include "UCode_AXStructs.h"
|
||||
|
@ -28,8 +27,8 @@
|
|||
#include "UCode_AX_Voice.h"
|
||||
|
||||
|
||||
CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler, u32 l_CRC)
|
||||
: IUCode(_rMailHandler)
|
||||
CUCode_AXWii::CUCode_AXWii(DSPHLE *dsp_hle, u32 l_CRC)
|
||||
: IUCode(dsp_hle)
|
||||
, m_addressPBs(0xFFFFFFFF)
|
||||
, _CRC(l_CRC)
|
||||
{
|
||||
|
@ -76,7 +75,7 @@ void CUCode_AXWii::HandleMail(u32 _uMail)
|
|||
|
||||
case 0xCDD10002: // Action 2 - IROM_Reset(); ( WII: De Blob, Cursed Mountain,...)
|
||||
DEBUG_LOG(DSPHLE,"DSP IROM - Reset!");
|
||||
CDSPHandler::GetInstance().SetUCode(UCODE_ROM);
|
||||
m_DSPHLE->SetUCode(UCODE_ROM);
|
||||
return;
|
||||
|
||||
case 0xCDD10003: // Action 3 - AX_GetNextCmdBlock()
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
class CUCode_AXWii : public IUCode
|
||||
{
|
||||
public:
|
||||
CUCode_AXWii(CMailHandler& _rMailHandler, u32 _CRC);
|
||||
CUCode_AXWii(DSPHLE *dsp_hle, u32 _CRC);
|
||||
virtual ~CUCode_AXWii();
|
||||
|
||||
void HandleMail(u32 _uMail);
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "../DSPHLEGlobals.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "../DSPHLE.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_CARD.h"
|
||||
#include "../../DSP.h"
|
||||
|
||||
|
||||
CUCode_CARD::CUCode_CARD(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
CUCode_CARD::CUCode_CARD(DSPHLE *dsp_hle)
|
||||
: IUCode(dsp_hle)
|
||||
{
|
||||
DEBUG_LOG(DSPHLE, "CUCode_CARD - initialized");
|
||||
m_rMailHandler.PushMail(DSP_INIT);
|
||||
|
@ -57,7 +57,7 @@ void CUCode_CARD::HandleMail(u32 _uMail)
|
|||
}
|
||||
|
||||
m_rMailHandler.PushMail(DSP_DONE);
|
||||
CDSPHandler::GetInstance().SetUCode(UCODE_ROM);
|
||||
m_DSPHLE->SetUCode(UCODE_ROM);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
class CUCode_CARD : public IUCode
|
||||
{
|
||||
public:
|
||||
CUCode_CARD(CMailHandler& _rMailHandler);
|
||||
CUCode_CARD(DSPHLE *dsp_hle);
|
||||
virtual ~CUCode_CARD();
|
||||
|
||||
void HandleMail(u32 _uMail);
|
||||
|
|
|
@ -16,14 +16,13 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "../DSPHLEGlobals.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_GBA.h"
|
||||
|
||||
#include "../../DSP.h"
|
||||
|
||||
CUCode_GBA::CUCode_GBA(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
CUCode_GBA::CUCode_GBA(DSPHLE *dsp_hle)
|
||||
: IUCode(dsp_hle)
|
||||
{
|
||||
m_rMailHandler.PushMail(DSP_INIT);
|
||||
}
|
||||
|
@ -142,7 +141,7 @@ void CUCode_GBA::HandleMail(u32 _uMail)
|
|||
m_UploadSetupInProgress = true;
|
||||
break;
|
||||
case 2:
|
||||
CDSPHandler::GetInstance().SetUCode(UCODE_ROM);
|
||||
m_DSPHLE->SetUCode(UCODE_ROM);
|
||||
break;
|
||||
default:
|
||||
DEBUG_LOG(DSPHLE, "CUCode_GBA - unknown 0xcdd1 cmd: %08x", _uMail);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
struct CUCode_GBA : public IUCode
|
||||
{
|
||||
CUCode_GBA(CMailHandler& _rMailHandler);
|
||||
CUCode_GBA(DSPHLE *dsp_hle);
|
||||
virtual ~CUCode_GBA();
|
||||
|
||||
void HandleMail(u32 _uMail);
|
||||
|
|
|
@ -16,12 +16,11 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "../DSPHLEGlobals.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_InitAudioSystem.h"
|
||||
|
||||
CUCode_InitAudioSystem::CUCode_InitAudioSystem(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
CUCode_InitAudioSystem::CUCode_InitAudioSystem(DSPHLE *dsp_hle)
|
||||
: IUCode(dsp_hle)
|
||||
{
|
||||
DEBUG_LOG(DSPHLE, "CUCode_InitAudioSystem - initialized");
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
class CUCode_InitAudioSystem : public IUCode
|
||||
{
|
||||
public:
|
||||
CUCode_InitAudioSystem(CMailHandler& _rMailHandler);
|
||||
CUCode_InitAudioSystem(DSPHLE *dsp_hle);
|
||||
virtual ~CUCode_InitAudioSystem();
|
||||
|
||||
void HandleMail(u32 _uMail);
|
||||
|
|
|
@ -16,14 +16,13 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "../DSPHLEGlobals.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_ROM.h"
|
||||
#include "Hash.h"
|
||||
#include "../../Memmap.h"
|
||||
|
||||
CUCode_Rom::CUCode_Rom(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
CUCode_Rom::CUCode_Rom(DSPHLE *dsp_hle)
|
||||
: IUCode(dsp_hle)
|
||||
, m_CurrentUCode()
|
||||
, m_BootTask_numSteps(0)
|
||||
, m_NextParameter(0)
|
||||
|
@ -120,7 +119,7 @@ void CUCode_Rom::BootUCode()
|
|||
DEBUG_LOG(DSPHLE, "CurrentUCode CRC: 0x%08x", ector_crc);
|
||||
DEBUG_LOG(DSPHLE, "BootTask - done");
|
||||
|
||||
CDSPHandler::GetInstance().SetUCode(ector_crc);
|
||||
m_DSPHLE->SetUCode(ector_crc);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
class CUCode_Rom : public IUCode
|
||||
{
|
||||
public:
|
||||
CUCode_Rom(CMailHandler& _rMailHandler);
|
||||
CUCode_Rom(DSPHLE *dsp_hle);
|
||||
virtual ~CUCode_Rom();
|
||||
|
||||
void HandleMail(u32 _uMail);
|
||||
|
|
|
@ -27,13 +27,12 @@
|
|||
#include "Mixer.h"
|
||||
|
||||
#include "WaveFile.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "../../DSP.h"
|
||||
|
||||
|
||||
CUCode_Zelda::CUCode_Zelda(CMailHandler& _rMailHandler, u32 _CRC)
|
||||
CUCode_Zelda::CUCode_Zelda(DSPHLE *dsp_hle, u32 _CRC)
|
||||
:
|
||||
IUCode(_rMailHandler),
|
||||
IUCode(dsp_hle),
|
||||
m_CRC(_CRC),
|
||||
|
||||
m_bSyncInProgress(false),
|
||||
|
@ -413,7 +412,7 @@ void CUCode_Zelda::HandleMail_NormalVersion(u32 _uMail)
|
|||
return;
|
||||
|
||||
case 0x0002: // Let IROM play us off
|
||||
CDSPHandler::GetInstance().SetUCode(UCODE_ROM);
|
||||
m_DSPHLE->SetUCode(UCODE_ROM);
|
||||
return;
|
||||
|
||||
case 0x0000: // Halt
|
||||
|
|
|
@ -136,7 +136,7 @@ namespace {
|
|||
class CUCode_Zelda : public IUCode
|
||||
{
|
||||
public:
|
||||
CUCode_Zelda(CMailHandler& _rMailHandler, u32 _CRC);
|
||||
CUCode_Zelda(DSPHLE *dsp_hle, u32 _CRC);
|
||||
virtual ~CUCode_Zelda();
|
||||
|
||||
void HandleMail(u32 _uMail);
|
||||
|
|
|
@ -27,27 +27,26 @@
|
|||
#include "UCode_InitAudioSystem.h"
|
||||
#include "UCode_GBA.h"
|
||||
#include "Hash.h"
|
||||
#include "../DSPHandler.h"
|
||||
|
||||
IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler, bool bWii)
|
||||
IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
|
||||
{
|
||||
switch (_CRC)
|
||||
{
|
||||
case UCODE_ROM:
|
||||
INFO_LOG(DSPHLE, "Switching to ROM ucode");
|
||||
return new CUCode_Rom(_rMailHandler);
|
||||
return new CUCode_Rom(dsp_hle);
|
||||
|
||||
case UCODE_INIT_AUDIO_SYSTEM:
|
||||
INFO_LOG(DSPHLE, "Switching to INIT ucode");
|
||||
return new CUCode_InitAudioSystem(_rMailHandler);
|
||||
return new CUCode_InitAudioSystem(dsp_hle);
|
||||
|
||||
case 0x65d6cc6f: // CARD
|
||||
INFO_LOG(DSPHLE, "Switching to CARD ucode");
|
||||
return new CUCode_CARD(_rMailHandler);
|
||||
return new CUCode_CARD(dsp_hle);
|
||||
|
||||
case 0xdd7e72d5:
|
||||
INFO_LOG(DSPHLE, "Switching to GBA ucode");
|
||||
return new CUCode_GBA(_rMailHandler);
|
||||
return new CUCode_GBA(dsp_hle);
|
||||
|
||||
case 0x3ad3b7ac: // Naruto3, Paper Mario - The Thousand Year Door
|
||||
case 0x3daf59b9: // Alien Hominid
|
||||
|
@ -59,14 +58,14 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler, bool bWii)
|
|||
// Zelda:OOT, Tony hawk, viewtiful joe
|
||||
case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080
|
||||
INFO_LOG(DSPHLE, "CRC %08x: AX ucode chosen", _CRC);
|
||||
return new CUCode_AX(_rMailHandler);
|
||||
return new CUCode_AX(dsp_hle);
|
||||
|
||||
case 0x6ba3b3ea: // IPL - PAL
|
||||
case 0x24b22038: // IPL - NTSC/NTSC-JAP
|
||||
case 0x42f64ac4: // Luigi
|
||||
case 0x4be6a5cb: // AC, Pikmin
|
||||
INFO_LOG(DSPHLE, "CRC %08x: JAC (early Zelda) ucode chosen", _CRC);
|
||||
return new CUCode_Zelda(_rMailHandler, _CRC);
|
||||
return new CUCode_Zelda(dsp_hle, _CRC);
|
||||
|
||||
case 0x6CA33A6D: // DK Jungle Beat
|
||||
case 0x86840740: // Zelda WW - US
|
||||
|
@ -74,7 +73,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler, bool bWii)
|
|||
case 0x2fcdf1ec: // Mario Kart, zelda 4 swords
|
||||
case 0x267fd05a: // Pikmin PAL
|
||||
INFO_LOG(DSPHLE, "CRC %08x: Zelda ucode chosen", _CRC);
|
||||
return new CUCode_Zelda(_rMailHandler, _CRC);
|
||||
return new CUCode_Zelda(dsp_hle, _CRC);
|
||||
|
||||
// WII CRCs
|
||||
case 0xb7eb9a9c: // Wii Pikmin - PAL
|
||||
|
@ -82,7 +81,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler, bool bWii)
|
|||
case 0x6c3f6f94: // Zelda TP - PAL
|
||||
case 0xd643001f: // Mario Galaxy - PAL / WII DK Jungle Beat - PAL
|
||||
INFO_LOG(DSPHLE, "CRC %08x: Zelda Wii ucode chosen\n", _CRC);
|
||||
return new CUCode_Zelda(_rMailHandler, _CRC);
|
||||
return new CUCode_Zelda(dsp_hle, _CRC);
|
||||
|
||||
case 0x2ea36ce6: // Some Wii demos
|
||||
case 0x5ef56da3: // AX demo
|
||||
|
@ -92,18 +91,18 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler, bool bWii)
|
|||
case 0x4cc52064: // Bleach: Versus Crusade
|
||||
case 0xd9c4bf34: // WiiMenu
|
||||
INFO_LOG(DSPHLE, "CRC %08x: Wii - AXWii chosen", _CRC);
|
||||
return new CUCode_AXWii(_rMailHandler, _CRC);
|
||||
return new CUCode_AXWii(dsp_hle, _CRC);
|
||||
|
||||
default:
|
||||
if (bWii)
|
||||
{
|
||||
PanicAlert("DSPHLE: Unknown ucode (CRC = %08x) - forcing AXWii.\n\nTry LLE plugin if this is homebrew.", _CRC);
|
||||
return new CUCode_AXWii(_rMailHandler, _CRC);
|
||||
return new CUCode_AXWii(dsp_hle, _CRC);
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("DSPHLE: Unknown ucode (CRC = %08x) - forcing AX.\n\nTry LLE plugin if this is homebrew.", _CRC);
|
||||
return new CUCode_AX(_rMailHandler);
|
||||
return new CUCode_AX(dsp_hle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,6 +180,6 @@ void IUCode::PrepareBootUCode(u32 mail)
|
|||
"Trying to boot new ucode with dram upload - not implemented");
|
||||
}
|
||||
|
||||
CDSPHandler::GetInstance().SwapUCode(ector_crc);
|
||||
m_DSPHLE->SwapUCode(ector_crc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "ChunkFile.h"
|
||||
#include "Thread.h"
|
||||
|
||||
#include "../DSPHLE.h"
|
||||
|
||||
#define UCODE_ROM 0x0000000
|
||||
#define UCODE_INIT_AUDIO_SYSTEM 0x0000001
|
||||
|
||||
|
@ -30,12 +32,13 @@ class CMailHandler;
|
|||
class IUCode
|
||||
{
|
||||
public:
|
||||
IUCode(CMailHandler& _rMailHandler)
|
||||
: m_rMailHandler(_rMailHandler)
|
||||
IUCode(DSPHLE *dsphle)
|
||||
: m_rMailHandler(dsphle->AccessMailHandler())
|
||||
, m_UploadSetupInProgress(false)
|
||||
, m_NextUCode()
|
||||
, m_NextUCode_steps(0)
|
||||
, m_NeedsResumeMail(false)
|
||||
, m_DSPHLE(dsphle)
|
||||
{}
|
||||
|
||||
virtual ~IUCode()
|
||||
|
@ -74,6 +77,9 @@ protected:
|
|||
// UCode only needs to set this to true, IUCode will set to false when done!
|
||||
bool m_UploadSetupInProgress;
|
||||
|
||||
// Need a pointer back to DSPHLE to switch ucodes.
|
||||
DSPHLE *m_DSPHLE;
|
||||
|
||||
private:
|
||||
struct SUCode
|
||||
{
|
||||
|
@ -94,6 +100,6 @@ private:
|
|||
bool m_NeedsResumeMail;
|
||||
};
|
||||
|
||||
extern IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler, bool bWii);
|
||||
extern IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue