DSPHLE: Mass rename classes to match our coding style better.

This commit is contained in:
Pierre Bourdon 2014-03-30 00:00:28 +01:00
parent 6bc845a804
commit 17d64a1d50
22 changed files with 156 additions and 156 deletions

View File

@ -95,7 +95,7 @@ void DSPHLE::SendMailToDSP(u32 _uMail)
}
}
IUCode* DSPHLE::GetUCode()
UCodeInterface* DSPHLE::GetUCode()
{
return m_pUCode;
}
@ -160,9 +160,9 @@ void DSPHLE::DoState(PointerWrap &p)
p.DoPOD(m_DSPControl);
p.DoPOD(m_dspState);
int ucode_crc = IUCode::GetCRC(m_pUCode);
int ucode_crc = UCodeInterface::GetCRC(m_pUCode);
int ucode_crc_beforeLoad = ucode_crc;
int lastucode_crc = IUCode::GetCRC(m_lastUCode);
int lastucode_crc = UCodeInterface::GetCRC(m_lastUCode);
int lastucode_crc_beforeLoad = lastucode_crc;
p.Do(ucode_crc);
@ -170,8 +170,8 @@ void DSPHLE::DoState(PointerWrap &p)
// if a different type of ucode was being used when the savestate was created,
// we have to reconstruct the old type of ucode so that we have a valid thing to call DoState on.
IUCode* ucode = (ucode_crc == ucode_crc_beforeLoad) ? m_pUCode : UCodeFactory( ucode_crc, this, m_bWii);
IUCode* lastucode = (lastucode_crc != lastucode_crc_beforeLoad) ? m_lastUCode : UCodeFactory(lastucode_crc, this, m_bWii);
UCodeInterface* ucode = (ucode_crc == ucode_crc_beforeLoad) ? m_pUCode : UCodeFactory( ucode_crc, this, m_bWii);
UCodeInterface* lastucode = (lastucode_crc != lastucode_crc_beforeLoad) ? m_lastUCode : UCodeFactory(lastucode_crc, this, m_bWii);
if (ucode)
ucode->DoState(p);

View File

@ -10,7 +10,7 @@
#include "Core/DSPEmulator.h"
#include "Core/HW/DSPHLE/MailHandler.h"
class IUCode;
class UCodeInterface;
class DSPHLE : public DSPEmulator {
public:
@ -38,7 +38,7 @@ public:
CMailHandler& AccessMailHandler() { return m_MailHandler; }
// Formerly DSPHandler
IUCode *GetUCode();
UCodeInterface *GetUCode();
void SetUCode(u32 _crc);
void SwapUCode(u32 _crc);
@ -70,8 +70,8 @@ private:
};
DSPState m_dspState;
IUCode* m_pUCode;
IUCode* m_lastUCode;
UCodeInterface* m_pUCode;
UCodeInterface* m_lastUCode;
UDSPControl m_DSPControl;
CMailHandler m_MailHandler;

View File

@ -12,24 +12,24 @@
#define AX_GC
#include "Core/HW/DSPHLE/UCodes/AXVoice.h"
CUCode_AX::CUCode_AX(DSPHLE* dsp_hle, u32 crc)
: IUCode(dsp_hle, crc)
AXUCode::AXUCode(DSPHLE* dsp_hle, u32 crc)
: UCodeInterface(dsp_hle, crc)
, m_work_available(false)
, m_cmdlist_size(0)
{
WARN_LOG(DSPHLE, "Instantiating CUCode_AX: crc=%08x", crc);
WARN_LOG(DSPHLE, "Instantiating AXUCode: crc=%08x", crc);
m_rMailHandler.PushMail(DSP_INIT);
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
LoadResamplingCoefficients();
}
CUCode_AX::~CUCode_AX()
AXUCode::~AXUCode()
{
m_rMailHandler.Clear();
}
void CUCode_AX::LoadResamplingCoefficients()
void AXUCode::LoadResamplingCoefficients()
{
m_coeffs_available = false;
@ -66,14 +66,14 @@ void CUCode_AX::LoadResamplingCoefficients()
m_coeffs_available = true;
}
void CUCode_AX::SignalWorkEnd()
void AXUCode::SignalWorkEnd()
{
// Signal end of processing
m_rMailHandler.PushMail(DSP_YIELD);
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
}
void CUCode_AX::HandleCommandList()
void AXUCode::HandleCommandList()
{
// Temp variables for addresses computation
u16 addr_hi, addr_lo;
@ -250,7 +250,7 @@ void CUCode_AX::HandleCommandList()
}
}
void CUCode_AX::ApplyUpdatesForMs(int curr_ms, u16* pb, u16* num_updates, u16* updates)
void AXUCode::ApplyUpdatesForMs(int curr_ms, u16* pb, u16* num_updates, u16* updates)
{
u32 start_idx = 0;
for (int i = 0; i < curr_ms; ++i)
@ -265,7 +265,7 @@ void CUCode_AX::ApplyUpdatesForMs(int curr_ms, u16* pb, u16* num_updates, u16* u
}
}
AXMixControl CUCode_AX::ConvertMixerControl(u32 mixer_control)
AXMixControl AXUCode::ConvertMixerControl(u32 mixer_control)
{
u32 ret = 0;
@ -313,7 +313,7 @@ AXMixControl CUCode_AX::ConvertMixerControl(u32 mixer_control)
return (AXMixControl)ret;
}
void CUCode_AX::SetupProcessing(u32 init_addr)
void AXUCode::SetupProcessing(u32 init_addr)
{
u16 init_data[0x20];
@ -356,7 +356,7 @@ void CUCode_AX::SetupProcessing(u32 init_addr)
}
}
void CUCode_AX::DownloadAndMixWithVolume(u32 addr, u16 vol_main, u16 vol_auxa, u16 vol_auxb)
void AXUCode::DownloadAndMixWithVolume(u32 addr, u16 vol_main, u16 vol_auxa, u16 vol_auxb)
{
int* buffers_main[3] = { m_samples_left, m_samples_right, m_samples_surround };
int* buffers_auxa[3] = { m_samples_auxA_left, m_samples_auxA_right, m_samples_auxA_surround };
@ -381,7 +381,7 @@ void CUCode_AX::DownloadAndMixWithVolume(u32 addr, u16 vol_main, u16 vol_auxa, u
}
}
void CUCode_AX::ProcessPBList(u32 pb_addr)
void AXUCode::ProcessPBList(u32 pb_addr)
{
// Samples per millisecond. In theory DSP sampling rate can be changed from
// 32KHz to 48KHz, but AX always process at 32KHz.
@ -426,7 +426,7 @@ void CUCode_AX::ProcessPBList(u32 pb_addr)
}
}
void CUCode_AX::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr)
void AXUCode::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr)
{
int* buffers[3] = { nullptr };
@ -465,7 +465,7 @@ void CUCode_AX::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr)
sample += (int)Common::swap32(*ptr++);
}
void CUCode_AX::UploadLRS(u32 dst_addr)
void AXUCode::UploadLRS(u32 dst_addr)
{
int buffers[3][5 * 32];
@ -478,7 +478,7 @@ void CUCode_AX::UploadLRS(u32 dst_addr)
memcpy(HLEMemory_Get_Pointer(dst_addr), buffers, sizeof (buffers));
}
void CUCode_AX::SetMainLR(u32 src_addr)
void AXUCode::SetMainLR(u32 src_addr)
{
int* ptr = (int*)HLEMemory_Get_Pointer(src_addr);
for (u32 i = 0; i < 5 * 32; ++i)
@ -490,7 +490,7 @@ void CUCode_AX::SetMainLR(u32 src_addr)
}
}
void CUCode_AX::OutputSamples(u32 lr_addr, u32 surround_addr)
void AXUCode::OutputSamples(u32 lr_addr, u32 surround_addr)
{
int surround_buffer[5 * 32];
@ -517,7 +517,7 @@ void CUCode_AX::OutputSamples(u32 lr_addr, u32 surround_addr)
memcpy(HLEMemory_Get_Pointer(lr_addr), buffer, sizeof (buffer));
}
void CUCode_AX::MixAUXBLR(u32 ul_addr, u32 dl_addr)
void AXUCode::MixAUXBLR(u32 ul_addr, u32 dl_addr)
{
// Upload AUXB L/R
int* ptr = (int*)HLEMemory_Get_Pointer(ul_addr);
@ -542,7 +542,7 @@ void CUCode_AX::MixAUXBLR(u32 ul_addr, u32 dl_addr)
}
}
void CUCode_AX::SetOppositeLR(u32 src_addr)
void AXUCode::SetOppositeLR(u32 src_addr)
{
int* ptr = (int*)HLEMemory_Get_Pointer(src_addr);
for (u32 i = 0; i < 5 * 32; ++i)
@ -554,7 +554,7 @@ void CUCode_AX::SetOppositeLR(u32 src_addr)
}
}
void CUCode_AX::SendAUXAndMix(u32 main_auxa_up, u32 auxb_s_up, u32 main_l_dl,
void AXUCode::SendAUXAndMix(u32 main_auxa_up, u32 auxb_s_up, u32 main_l_dl,
u32 main_r_dl, u32 auxb_l_dl, u32 auxb_r_dl)
{
// Buffers to upload first
@ -598,7 +598,7 @@ void CUCode_AX::SendAUXAndMix(u32 main_auxa_up, u32 auxb_s_up, u32 main_l_dl,
}
}
void CUCode_AX::HandleMail(u32 mail)
void AXUCode::HandleMail(u32 mail)
{
// Indicates if the next message is a command list address.
static bool next_is_cmdlist = false;
@ -648,7 +648,7 @@ void CUCode_AX::HandleMail(u32 mail)
next_is_cmdlist = set_next_is_cmdlist;
}
void CUCode_AX::CopyCmdList(u32 addr, u16 size)
void AXUCode::CopyCmdList(u32 addr, u16 size)
{
if (size >= (sizeof (m_cmdlist) / sizeof (u16)))
{
@ -661,7 +661,7 @@ void CUCode_AX::CopyCmdList(u32 addr, u16 size)
m_cmdlist_size = size;
}
void CUCode_AX::Update(int cycles)
void AXUCode::Update(int cycles)
{
// Used for UCode switching.
if (NeedsResumeMail())
@ -677,12 +677,12 @@ void CUCode_AX::Update(int cycles)
}
}
u32 CUCode_AX::GetUpdateMs()
u32 AXUCode::GetUpdateMs()
{
return 5;
}
void CUCode_AX::DoAXState(PointerWrap& p)
void AXUCode::DoAXState(PointerWrap& p)
{
p.Do(m_cmdlist);
p.Do(m_cmdlist_size);
@ -698,7 +698,7 @@ void CUCode_AX::DoAXState(PointerWrap& p)
p.Do(m_samples_auxB_surround);
}
void CUCode_AX::DoState(PointerWrap& p)
void AXUCode::DoState(PointerWrap& p)
{
DoStateShared(p);
DoAXState(p);

View File

@ -49,11 +49,11 @@ enum AXMixControl
MIX_AUXC_S_RAMP = 0x800000
};
class CUCode_AX : public IUCode
class AXUCode : public UCodeInterface
{
public:
CUCode_AX(DSPHLE* dsp_hle, u32 crc);
virtual ~CUCode_AX();
AXUCode(DSPHLE* dsp_hle, u32 crc);
virtual ~AXUCode();
virtual void HandleMail(u32 mail) override;
virtual void Update(int cycles) override;

View File

@ -15,23 +15,23 @@
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
CUCode_AXWii::CUCode_AXWii(DSPHLE *dsp_hle, u32 l_CRC)
: CUCode_AX(dsp_hle, l_CRC),
AXWiiUCode::AXWiiUCode(DSPHLE *dsp_hle, u32 l_CRC)
: AXUCode(dsp_hle, l_CRC),
m_last_main_volume(0x8000)
{
for (u16& volume : m_last_aux_volumes)
volume = 0x8000;
WARN_LOG(DSPHLE, "Instantiating CUCode_AXWii");
WARN_LOG(DSPHLE, "Instantiating AXWiiUCode");
m_old_axwii = (l_CRC == 0xfa450138);
}
CUCode_AXWii::~CUCode_AXWii()
AXWiiUCode::~AXWiiUCode()
{
}
void CUCode_AXWii::HandleCommandList()
void AXWiiUCode::HandleCommandList()
{
// Temp variables for addresses computation
u16 addr_hi, addr_lo;
@ -243,7 +243,7 @@ void CUCode_AXWii::HandleCommandList()
}
}
void CUCode_AXWii::SetupProcessing(u32 init_addr)
void AXWiiUCode::SetupProcessing(u32 init_addr)
{
// TODO: should be easily factorizable with AX
s16 init_data[60];
@ -302,7 +302,7 @@ void CUCode_AXWii::SetupProcessing(u32 init_addr)
}
}
void CUCode_AXWii::AddToLR(u32 val_addr, bool neg)
void AXWiiUCode::AddToLR(u32 val_addr, bool neg)
{
int* ptr = (int*)HLEMemory_Get_Pointer(val_addr);
for (int i = 0; i < 32 * 3; ++i)
@ -316,7 +316,7 @@ void CUCode_AXWii::AddToLR(u32 val_addr, bool neg)
}
}
void CUCode_AXWii::AddSubToLR(u32 val_addr)
void AXWiiUCode::AddSubToLR(u32 val_addr)
{
int* ptr = (int*)HLEMemory_Get_Pointer(val_addr);
for (int i = 0; i < 32 * 3; ++i)
@ -331,7 +331,7 @@ void CUCode_AXWii::AddSubToLR(u32 val_addr)
}
}
AXMixControl CUCode_AXWii::ConvertMixerControl(u32 mixer_control)
AXMixControl AXWiiUCode::ConvertMixerControl(u32 mixer_control)
{
u32 ret = 0;
@ -359,7 +359,7 @@ AXMixControl CUCode_AXWii::ConvertMixerControl(u32 mixer_control)
return (AXMixControl)ret;
}
void CUCode_AXWii::GenerateVolumeRamp(u16* output, u16 vol1, u16 vol2, size_t nvals)
void AXWiiUCode::GenerateVolumeRamp(u16* output, u16 vol1, u16 vol2, size_t nvals)
{
float curr = vol1;
for (size_t i = 0; i < nvals; ++i)
@ -369,7 +369,7 @@ void CUCode_AXWii::GenerateVolumeRamp(u16* output, u16 vol1, u16 vol2, size_t nv
}
}
bool CUCode_AXWii::ExtractUpdatesFields(AXPBWii& pb, u16* num_updates, u16* updates,
bool AXWiiUCode::ExtractUpdatesFields(AXPBWii& pb, u16* num_updates, u16* updates,
u32* updates_addr)
{
u16* pb_mem = (u16*)&pb;
@ -409,7 +409,7 @@ bool CUCode_AXWii::ExtractUpdatesFields(AXPBWii& pb, u16* num_updates, u16* upda
return true;
}
void CUCode_AXWii::ReinjectUpdatesFields(AXPBWii& pb, u16* num_updates, u32 updates_addr)
void AXWiiUCode::ReinjectUpdatesFields(AXPBWii& pb, u16* num_updates, u32 updates_addr)
{
u16* pb_mem = (u16*)&pb;
@ -424,7 +424,7 @@ void CUCode_AXWii::ReinjectUpdatesFields(AXPBWii& pb, u16* num_updates, u32 upda
pb_mem[45] = updates_addr & 0xFFFF;
}
void CUCode_AXWii::ProcessPBList(u32 pb_addr)
void AXWiiUCode::ProcessPBList(u32 pb_addr)
{
AXPBWii pb;
@ -486,7 +486,7 @@ void CUCode_AXWii::ProcessPBList(u32 pb_addr)
}
}
void CUCode_AXWii::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16 volume)
void AXWiiUCode::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16 volume)
{
u16 volume_ramp[96];
GenerateVolumeRamp(volume_ramp, m_last_aux_volumes[aux_id], volume, 96);
@ -540,7 +540,7 @@ void CUCode_AXWii::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16
}
}
void CUCode_AXWii::UploadAUXMixLRSC(int aux_id, u32* addresses, u16 volume)
void AXWiiUCode::UploadAUXMixLRSC(int aux_id, u32* addresses, u16 volume)
{
int* aux_left = aux_id ? m_samples_auxB_left : m_samples_auxA_left;
int* aux_right = aux_id ? m_samples_auxB_right : m_samples_auxA_right;
@ -584,7 +584,7 @@ void CUCode_AXWii::UploadAUXMixLRSC(int aux_id, u32* addresses, u16 volume)
}
}
void CUCode_AXWii::OutputSamples(u32 lr_addr, u32 surround_addr, u16 volume,
void AXWiiUCode::OutputSamples(u32 lr_addr, u32 surround_addr, u16 volume,
bool upload_auxc)
{
u16 volume_ramp[96];
@ -637,7 +637,7 @@ void CUCode_AXWii::OutputSamples(u32 lr_addr, u32 surround_addr, u16 volume,
// sounds to go at half speed. I have no idea why.
}
void CUCode_AXWii::OutputWMSamples(u32* addresses)
void AXWiiUCode::OutputWMSamples(u32* addresses)
{
int* buffers[] = {
m_samples_wm0,
@ -659,12 +659,12 @@ void CUCode_AXWii::OutputWMSamples(u32* addresses)
}
}
u32 CUCode_AXWii::GetUpdateMs()
u32 AXWiiUCode::GetUpdateMs()
{
return 3;
}
void CUCode_AXWii::DoState(PointerWrap &p)
void AXWiiUCode::DoState(PointerWrap &p)
{
DoStateShared(p);
DoAXState(p);

View File

@ -6,11 +6,11 @@
#include "Core/HW/DSPHLE/UCodes/AX.h"
class CUCode_AXWii : public CUCode_AX
class AXWiiUCode : public AXUCode
{
public:
CUCode_AXWii(DSPHLE *dsp_hle, u32 _CRC);
virtual ~CUCode_AXWii();
AXWiiUCode(DSPHLE *dsp_hle, u32 _CRC);
virtual ~AXWiiUCode();
u32 GetUpdateMs() override;
virtual void DoState(PointerWrap &p) override;

View File

@ -9,21 +9,21 @@
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
CUCode_CARD::CUCode_CARD(DSPHLE *dsp_hle, u32 crc)
: IUCode(dsp_hle, crc)
CARDUCode::CARDUCode(DSPHLE *dsp_hle, u32 crc)
: UCodeInterface(dsp_hle, crc)
{
DEBUG_LOG(DSPHLE, "CUCode_CARD - initialized");
DEBUG_LOG(DSPHLE, "CARDUCode - initialized");
m_rMailHandler.PushMail(DSP_INIT);
}
CUCode_CARD::~CUCode_CARD()
CARDUCode::~CARDUCode()
{
m_rMailHandler.Clear();
}
void CUCode_CARD::Update(int cycles)
void CARDUCode::Update(int cycles)
{
// check if we have to sent something
if (!m_rMailHandler.IsEmpty())
@ -32,12 +32,12 @@ void CUCode_CARD::Update(int cycles)
}
}
u32 CUCode_CARD::GetUpdateMs()
u32 CARDUCode::GetUpdateMs()
{
return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5;
}
void CUCode_CARD::HandleMail(u32 _uMail)
void CARDUCode::HandleMail(u32 _uMail)
{
if (_uMail == 0xFF000000) // unlock card
{
@ -45,7 +45,7 @@ void CUCode_CARD::HandleMail(u32 _uMail)
}
else
{
DEBUG_LOG(DSPHLE, "CUCode_CARD - unknown command: %x", _uMail);
DEBUG_LOG(DSPHLE, "CARDUCode - unknown command: %x", _uMail);
}
m_rMailHandler.PushMail(DSP_DONE);

View File

@ -6,11 +6,11 @@
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
class CUCode_CARD : public IUCode
class CARDUCode : public UCodeInterface
{
public:
CUCode_CARD(DSPHLE *dsp_hle, u32 crc);
virtual ~CUCode_CARD();
CARDUCode(DSPHLE *dsp_hle, u32 crc);
virtual ~CARDUCode();
u32 GetUpdateMs() override;
void HandleMail(u32 _uMail) override;

View File

@ -7,18 +7,18 @@
#include "Core/HW/DSPHLE/UCodes/GBA.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
CUCode_GBA::CUCode_GBA(DSPHLE *dsp_hle, u32 crc)
: IUCode(dsp_hle, crc)
GBAUCode::GBAUCode(DSPHLE *dsp_hle, u32 crc)
: UCodeInterface(dsp_hle, crc)
{
m_rMailHandler.PushMail(DSP_INIT);
}
CUCode_GBA::~CUCode_GBA()
GBAUCode::~GBAUCode()
{
m_rMailHandler.Clear();
}
void CUCode_GBA::Update(int cycles)
void GBAUCode::Update(int cycles)
{
// check if we have to send something
if (!m_rMailHandler.IsEmpty())
@ -27,12 +27,12 @@ void CUCode_GBA::Update(int cycles)
}
}
u32 CUCode_GBA::GetUpdateMs()
u32 GBAUCode::GetUpdateMs()
{
return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5;
}
void CUCode_GBA::HandleMail(u32 _uMail)
void GBAUCode::HandleMail(u32 _uMail)
{
static bool nextmail_is_mramaddr = false;
static bool calc_done = false;
@ -136,12 +136,12 @@ void CUCode_GBA::HandleMail(u32 _uMail)
m_DSPHLE->SetUCode(UCODE_ROM);
break;
default:
DEBUG_LOG(DSPHLE, "CUCode_GBA - unknown 0xcdd1 command: %08x", _uMail);
DEBUG_LOG(DSPHLE, "GBAUCode - unknown 0xcdd1 command: %08x", _uMail);
break;
}
}
else
{
DEBUG_LOG(DSPHLE, "CUCode_GBA - unknown command: %08x", _uMail);
DEBUG_LOG(DSPHLE, "GBAUCode - unknown command: %08x", _uMail);
}
}

View File

@ -6,10 +6,10 @@
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
struct CUCode_GBA : public IUCode
struct GBAUCode : public UCodeInterface
{
CUCode_GBA(DSPHLE *dsp_hle, u32 crc);
virtual ~CUCode_GBA();
GBAUCode(DSPHLE *dsp_hle, u32 crc);
virtual ~GBAUCode();
u32 GetUpdateMs() override;
void HandleMail(u32 _uMail) override;

View File

@ -6,24 +6,24 @@
#include "Core/HW/DSPHLE/UCodes/INIT.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
CUCode_InitAudioSystem::CUCode_InitAudioSystem(DSPHLE *dsp_hle, u32 crc)
: IUCode(dsp_hle, crc)
INITUCode::INITUCode(DSPHLE *dsp_hle, u32 crc)
: UCodeInterface(dsp_hle, crc)
{
DEBUG_LOG(DSPHLE, "CUCode_InitAudioSystem - initialized");
DEBUG_LOG(DSPHLE, "INITUCode - initialized");
}
CUCode_InitAudioSystem::~CUCode_InitAudioSystem()
INITUCode::~INITUCode()
{
}
void CUCode_InitAudioSystem::Init()
void INITUCode::Init()
{
}
void CUCode_InitAudioSystem::Update(int cycles)
void INITUCode::Update(int cycles)
{
if (m_rMailHandler.IsEmpty())
{
@ -32,12 +32,12 @@ void CUCode_InitAudioSystem::Update(int cycles)
}
}
u32 CUCode_InitAudioSystem::GetUpdateMs()
u32 INITUCode::GetUpdateMs()
{
return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5;
}
void CUCode_InitAudioSystem::HandleMail(u32 _uMail)
void INITUCode::HandleMail(u32 _uMail)
{
}

View File

@ -6,11 +6,11 @@
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
class CUCode_InitAudioSystem : public IUCode
class INITUCode : public UCodeInterface
{
public:
CUCode_InitAudioSystem(DSPHLE *dsp_hle, u32 crc);
virtual ~CUCode_InitAudioSystem();
INITUCode(DSPHLE *dsp_hle, u32 crc);
virtual ~INITUCode();
u32 GetUpdateMs() override;
void HandleMail(u32 _uMail) override;

View File

@ -13,8 +13,8 @@
#include "Core/HW/DSPHLE/UCodes/ROM.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
CUCode_Rom::CUCode_Rom(DSPHLE *dsp_hle, u32 crc)
: IUCode(dsp_hle, crc)
ROMUCode::ROMUCode(DSPHLE *dsp_hle, u32 crc)
: UCodeInterface(dsp_hle, crc)
, m_CurrentUCode()
, m_BootTask_numSteps(0)
, m_NextParameter(0)
@ -24,13 +24,13 @@ CUCode_Rom::CUCode_Rom(DSPHLE *dsp_hle, u32 crc)
m_rMailHandler.PushMail(0x8071FEED);
}
CUCode_Rom::~CUCode_Rom()
ROMUCode::~ROMUCode()
{}
void CUCode_Rom::Update(int cycles)
void ROMUCode::Update(int cycles)
{}
void CUCode_Rom::HandleMail(u32 _uMail)
void ROMUCode::HandleMail(u32 _uMail)
{
if (m_NextParameter == 0)
{
@ -82,7 +82,7 @@ void CUCode_Rom::HandleMail(u32 _uMail)
}
}
void CUCode_Rom::BootUCode()
void ROMUCode::BootUCode()
{
u32 ector_crc = HashEctor(
(u8*)HLEMemory_Get_Pointer(m_CurrentUCode.m_RAMAddress),
@ -107,12 +107,12 @@ void CUCode_Rom::BootUCode()
m_DSPHLE->SetUCode(ector_crc);
}
u32 CUCode_Rom::GetUpdateMs()
u32 ROMUCode::GetUpdateMs()
{
return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5;
}
void CUCode_Rom::DoState(PointerWrap &p)
void ROMUCode::DoState(PointerWrap &p)
{
p.Do(m_CurrentUCode);
p.Do(m_BootTask_numSteps);

View File

@ -6,11 +6,11 @@
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
class CUCode_Rom : public IUCode
class ROMUCode : public UCodeInterface
{
public:
CUCode_Rom(DSPHLE *dsp_hle, u32 _crc);
virtual ~CUCode_Rom();
ROMUCode(DSPHLE *dsp_hle, u32 _crc);
virtual ~ROMUCode();
u32 GetUpdateMs() override;
void HandleMail(u32 _uMail) override;

View File

@ -17,25 +17,25 @@
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
#include "Core/HW/DSPHLE/UCodes/Zelda.h"
IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
UCodeInterface* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
{
switch (_CRC)
{
case UCODE_ROM:
INFO_LOG(DSPHLE, "Switching to ROM ucode");
return new CUCode_Rom(dsp_hle, _CRC);
return new ROMUCode(dsp_hle, _CRC);
case UCODE_INIT_AUDIO_SYSTEM:
INFO_LOG(DSPHLE, "Switching to INIT ucode");
return new CUCode_InitAudioSystem(dsp_hle, _CRC);
return new INITUCode(dsp_hle, _CRC);
case 0x65d6cc6f: // CARD
INFO_LOG(DSPHLE, "Switching to CARD ucode");
return new CUCode_CARD(dsp_hle, _CRC);
return new CARDUCode(dsp_hle, _CRC);
case 0xdd7e72d5:
INFO_LOG(DSPHLE, "Switching to GBA ucode");
return new CUCode_GBA(dsp_hle, _CRC);
return new GBAUCode(dsp_hle, _CRC);
case 0x3ad3b7ac: // Naruto3, Paper Mario - The Thousand Year Door
case 0x3daf59b9: // Alien Hominid
@ -48,14 +48,14 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080
case 0x3389a79e: // MP1/MP2 Wii (Metroid Prime Trilogy)
INFO_LOG(DSPHLE, "CRC %08x: AX ucode chosen", _CRC);
return new CUCode_AX(dsp_hle, _CRC);
return new AXUCode(dsp_hle, _CRC);
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(dsp_hle, _CRC);
return new ZeldaUCode(dsp_hle, _CRC);
case 0x6CA33A6D: // DK Jungle Beat
case 0x86840740: // Zelda WW - US
@ -63,7 +63,7 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, 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(dsp_hle, _CRC);
return new ZeldaUCode(dsp_hle, _CRC);
// WII CRCs
case 0xb7eb9a9c: // Wii Pikmin - PAL
@ -71,7 +71,7 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, 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(dsp_hle, _CRC);
return new ZeldaUCode(dsp_hle, _CRC);
case 0x2ea36ce6: // Some Wii demos
case 0x5ef56da3: // AX demo
@ -81,18 +81,18 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
case 0x4cc52064: // Bleach: Versus Crusade
case 0xd9c4bf34: // WiiMenu
INFO_LOG(DSPHLE, "CRC %08x: Wii - AXWii chosen", _CRC);
return new CUCode_AXWii(dsp_hle, _CRC);
return new AXWiiUCode(dsp_hle, _CRC);
default:
if (bWii)
{
PanicAlert("DSPHLE: Unknown ucode (CRC = %08x) - forcing AXWii.\n\nTry LLE emulator if this is homebrew.", _CRC);
return new CUCode_AXWii(dsp_hle, _CRC);
return new AXWiiUCode(dsp_hle, _CRC);
}
else
{
PanicAlert("DSPHLE: Unknown ucode (CRC = %08x) - forcing AX.\n\nTry LLE emulator if this is homebrew.", _CRC);
return new CUCode_AX(dsp_hle, _CRC);
return new AXUCode(dsp_hle, _CRC);
}
case UCODE_NULL:
@ -102,7 +102,7 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
return nullptr;
}
bool IUCode::NeedsResumeMail()
bool UCodeInterface::NeedsResumeMail()
{
if (m_NeedsResumeMail)
{
@ -112,7 +112,7 @@ bool IUCode::NeedsResumeMail()
return false;
}
void IUCode::PrepareBootUCode(u32 mail)
void UCodeInterface::PrepareBootUCode(u32 mail)
{
switch (m_NextUCode_steps)
{
@ -174,7 +174,7 @@ void IUCode::PrepareBootUCode(u32 mail)
}
}
void IUCode::DoStateShared(PointerWrap &p)
void UCodeInterface::DoStateShared(PointerWrap &p)
{
p.Do(m_UploadSetupInProgress);
p.Do(m_NextUCode);

View File

@ -57,10 +57,10 @@ inline void* HLEMemory_Get_Pointer(u32 _uAddress)
return &Memory::m_pRAM[_uAddress & Memory::RAM_MASK];
}
class IUCode
class UCodeInterface
{
public:
IUCode(DSPHLE *dsphle, u32 _crc)
UCodeInterface(DSPHLE *dsphle, u32 _crc)
: m_rMailHandler(dsphle->AccessMailHandler())
, m_UploadSetupInProgress(false)
, m_DSPHLE(dsphle)
@ -70,7 +70,7 @@ public:
, m_NeedsResumeMail(false)
{}
virtual ~IUCode()
virtual ~UCodeInterface()
{}
virtual void HandleMail(u32 _uMail) = 0;
@ -81,7 +81,7 @@ public:
virtual void DoState(PointerWrap &p) { DoStateShared(p); }
static u32 GetCRC(IUCode* pUCode) { return pUCode ? pUCode->m_CRC : UCODE_NULL; }
static u32 GetCRC(UCodeInterface* pUCode) { return pUCode ? pUCode->m_CRC : UCODE_NULL; }
protected:
void PrepareBootUCode(u32 mail);
@ -106,7 +106,7 @@ protected:
};
// UCode is forwarding mails to PrepareBootUCode
// UCode only needs to set this to true, IUCode will set to false when done!
// UCode only needs to set this to true, UCodeInterface will set to false when done!
bool m_UploadSetupInProgress;
// Need a pointer back to DSPHLE to switch ucodes.
@ -136,4 +136,4 @@ private:
bool m_NeedsResumeMail;
};
extern IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii);
extern UCodeInterface* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii);

View File

@ -13,9 +13,9 @@
#include "Core/HW/DSPHLE/UCodes/Zelda.h"
CUCode_Zelda::CUCode_Zelda(DSPHLE *dsp_hle, u32 _CRC)
ZeldaUCode::ZeldaUCode(DSPHLE *dsp_hle, u32 _CRC)
:
IUCode(dsp_hle, _CRC),
UCodeInterface(dsp_hle, _CRC),
m_bSyncInProgress(false),
m_MaxVoice(0),
@ -76,7 +76,7 @@ CUCode_Zelda::CUCode_Zelda(DSPHLE *dsp_hle, u32 _CRC)
memset(m_PBMask, 0, sizeof(m_PBMask));
}
CUCode_Zelda::~CUCode_Zelda()
ZeldaUCode::~ZeldaUCode()
{
m_rMailHandler.Clear();
@ -86,7 +86,7 @@ CUCode_Zelda::~CUCode_Zelda()
delete [] m_RightBuffer;
}
u8 *CUCode_Zelda::GetARAMPointer(u32 address)
u8 *ZeldaUCode::GetARAMPointer(u32 address)
{
if (IsDMAVersion())
return Memory::GetPointer(m_DMABaseAddr) + address;
@ -94,7 +94,7 @@ u8 *CUCode_Zelda::GetARAMPointer(u32 address)
return DSP::GetARAMPtr() + address;
}
void CUCode_Zelda::Update(int cycles)
void ZeldaUCode::Update(int cycles)
{
if (!IsLightVersion())
{
@ -109,7 +109,7 @@ void CUCode_Zelda::Update(int cycles)
}
}
void CUCode_Zelda::HandleMail(u32 _uMail)
void ZeldaUCode::HandleMail(u32 _uMail)
{
if (IsLightVersion())
HandleMail_LightVersion(_uMail);
@ -119,7 +119,7 @@ void CUCode_Zelda::HandleMail(u32 _uMail)
HandleMail_NormalVersion(_uMail);
}
void CUCode_Zelda::HandleMail_LightVersion(u32 _uMail)
void ZeldaUCode::HandleMail_LightVersion(u32 _uMail)
{
//ERROR_LOG(DSPHLE, "Light version mail %08X, list in progress: %s, step: %i/%i",
// _uMail, m_bListInProgress ? "yes":"no", m_step, m_numSteps);
@ -173,7 +173,7 @@ void CUCode_Zelda::HandleMail_LightVersion(u32 _uMail)
}
}
void CUCode_Zelda::HandleMail_SMSVersion(u32 _uMail)
void ZeldaUCode::HandleMail_SMSVersion(u32 _uMail)
{
if (m_bSyncInProgress)
{
@ -270,7 +270,7 @@ void CUCode_Zelda::HandleMail_SMSVersion(u32 _uMail)
}
}
void CUCode_Zelda::HandleMail_NormalVersion(u32 _uMail)
void ZeldaUCode::HandleMail_NormalVersion(u32 _uMail)
{
// WARN_LOG(DSPHLE, "Zelda uCode: Handle mail %08X", _uMail);
@ -390,7 +390,7 @@ void CUCode_Zelda::HandleMail_NormalVersion(u32 _uMail)
}
// zelda debug ..803F6418
void CUCode_Zelda::ExecuteList()
void ZeldaUCode::ExecuteList()
{
// begin with the list
m_readOffset = 0;
@ -526,12 +526,12 @@ void CUCode_Zelda::ExecuteList()
}
}
u32 CUCode_Zelda::GetUpdateMs()
u32 ZeldaUCode::GetUpdateMs()
{
return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5;
}
void CUCode_Zelda::DoState(PointerWrap &p)
void ZeldaUCode::DoState(PointerWrap &p)
{
p.Do(m_AFCCoefTable);
p.Do(m_MiscTable);

View File

@ -114,11 +114,11 @@ union ZeldaUnkPB
u16 raw[16];
};
class CUCode_Zelda : public IUCode
class ZeldaUCode : public UCodeInterface
{
public:
CUCode_Zelda(DSPHLE *dsp_hle, u32 _CRC);
virtual ~CUCode_Zelda();
ZeldaUCode(DSPHLE *dsp_hle, u32 _CRC);
virtual ~ZeldaUCode();
u32 GetUpdateMs() override;
void HandleMail(u32 _uMail) override;

View File

@ -6,7 +6,7 @@
#include "Common/MathUtil.h"
#include "Core/HW/DSPHLE/UCodes/Zelda.h"
void CUCode_Zelda::AFCdecodebuffer(const s16 *coef, const char *src, signed short *out, short *histp, short *hist2p, int type)
void ZeldaUCode::AFCdecodebuffer(const s16 *coef, const char *src, signed short *out, short *histp, short *hist2p, int type)
{
// First 2 nibbles are ADPCM scale etc.
short delta = 1 << (((*src) >> 4) & 0xf);

View File

@ -1,6 +1,6 @@
#if 0
void CUCode_Zelda::UpdatePB(ZPB& _rPB, int *templbuffer, int *temprbuffer, u32 _Size)
void ZeldaUCode::UpdatePB(ZPB& _rPB, int *templbuffer, int *temprbuffer, u32 _Size)
{
u16* pTest = (u16*)&_rPB;

View File

@ -7,7 +7,7 @@
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
#include "Core/HW/DSPHLE/UCodes/Zelda.h"
void CUCode_Zelda::RenderSynth_RectWave(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
void ZeldaUCode::RenderSynth_RectWave(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
{
s64 ratio = ((s64)PB.RatioInt << 16) * 16;
s64 TrueSamplePosition = PB.CurSampleFrac;
@ -79,7 +79,7 @@ _lRestart:
PB.CurSampleFrac = TrueSamplePosition & 0xFFFF;
}
void CUCode_Zelda::RenderSynth_SawWave(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
void ZeldaUCode::RenderSynth_SawWave(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
{
s32 ratio = (s32)ceil((float)PB.RatioInt / 3);
s64 pos = PB.CurSampleFrac;
@ -93,7 +93,7 @@ void CUCode_Zelda::RenderSynth_SawWave(ZeldaVoicePB &PB, s32* _Buffer, int _Size
PB.CurSampleFrac = pos & 0xFFFF;
}
void CUCode_Zelda::RenderSynth_Constant(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
void ZeldaUCode::RenderSynth_Constant(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
{
// TODO: Header, footer
for (int i = 0; i < _Size; i++)
@ -122,7 +122,7 @@ inline u16 AddValueToReg(u32 ar, s32 ix)
return nar;
}
void CUCode_Zelda::RenderSynth_WaveTable(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
void ZeldaUCode::RenderSynth_WaveTable(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
{
u16 address;

View File

@ -11,7 +11,7 @@
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
#include "Core/HW/DSPHLE/UCodes/Zelda.h"
void CUCode_Zelda::ReadVoicePB(u32 _Addr, ZeldaVoicePB& PB)
void ZeldaUCode::ReadVoicePB(u32 _Addr, ZeldaVoicePB& PB)
{
u16 *memory = (u16*)Memory::GetPointer(_Addr);
@ -30,7 +30,7 @@ void CUCode_Zelda::ReadVoicePB(u32 _Addr, ZeldaVoicePB& PB)
PB.UnkAddr = (PB.UnkAddr << 16) | (PB.UnkAddr >> 16);
}
void CUCode_Zelda::WritebackVoicePB(u32 _Addr, ZeldaVoicePB& PB)
void ZeldaUCode::WritebackVoicePB(u32 _Addr, ZeldaVoicePB& PB)
{
u16 *memory = (u16*)Memory::GetPointer(_Addr);
@ -45,12 +45,12 @@ void CUCode_Zelda::WritebackVoicePB(u32 _Addr, ZeldaVoicePB& PB)
memory[i] = Common::swap16(((u16*)&PB)[i]);
}
int CUCode_Zelda::ConvertRatio(int pb_ratio)
int ZeldaUCode::ConvertRatio(int pb_ratio)
{
return pb_ratio * 16;
}
int CUCode_Zelda::SizeForResampling(ZeldaVoicePB &PB, int size, int ratio) {
int ZeldaUCode::SizeForResampling(ZeldaVoicePB &PB, int size, int ratio) {
// This is the little calculation at the start of every sample decoder
// in the ucode.
return (PB.CurSampleFrac + size * ConvertRatio(PB.RatioInt)) >> 16;
@ -59,7 +59,7 @@ int CUCode_Zelda::SizeForResampling(ZeldaVoicePB &PB, int size, int ratio) {
// Simple resampler, linear interpolation.
// Any future state should be stored in PB.raw[0x3c to 0x3f].
// In must point 4 samples into a buffer.
void CUCode_Zelda::Resample(ZeldaVoicePB &PB, int size, s16 *in, s32 *out, bool do_resample)
void ZeldaUCode::Resample(ZeldaVoicePB &PB, int size, s16 *in, s32 *out, bool do_resample)
{
if (!do_resample)
{
@ -98,7 +98,7 @@ void UpdateSampleCounters10(ZeldaVoicePB &PB)
PB.ReachedEnd = 0;
}
void CUCode_Zelda::RenderVoice_PCM16(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
void ZeldaUCode::RenderVoice_PCM16(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
{
int _RealSize = SizeForResampling(PB, _Size, PB.RatioInt);
u32 rem_samples = _RealSize;
@ -156,7 +156,7 @@ void UpdateSampleCounters8(ZeldaVoicePB &PB)
PB.ReachedEnd = 0;
}
void CUCode_Zelda::RenderVoice_PCM8(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
void ZeldaUCode::RenderVoice_PCM8(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
{
int _RealSize = SizeForResampling(PB, _Size, PB.RatioInt);
u32 rem_samples = _RealSize;
@ -231,7 +231,7 @@ void PrintObject(const T &Obj)
DEBUG_LOG(DSPHLE, "AFC PB:%s", ss.str().c_str());
}
void CUCode_Zelda::RenderVoice_AFC(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
void ZeldaUCode::RenderVoice_AFC(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
{
// TODO: Compare mono, stereo and surround samples
#if defined DEBUG || defined DEBUGFAST
@ -379,7 +379,7 @@ void Decoder21_ReadAudio(ZeldaVoicePB &PB, int size, s16 *_Buffer);
// 0x21 seems to really just be reading raw 16-bit audio from RAM (not ARAM).
// The rules seem to be quite different, though.
// It's used for streaming, not for one-shot or looped sample playback.
void CUCode_Zelda::RenderVoice_Raw(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
void ZeldaUCode::RenderVoice_Raw(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
{
// Decoder0x21 starts here.
u32 _RealSize = SizeForResampling(PB, _Size, PB.RatioInt);
@ -471,7 +471,7 @@ void Decoder21_ReadAudio(ZeldaVoicePB &PB, int size, s16 *_Buffer)
}
void CUCode_Zelda::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _RightBuffer, int _Size)
void ZeldaUCode::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _RightBuffer, int _Size)
{
if (PB.IsBlank)
{
@ -735,7 +735,7 @@ ContinueWithBlock:
}
}
void CUCode_Zelda::MixAudio()
void ZeldaUCode::MixAudio()
{
const int BufferSamples = 5 * 16;