Merge pull request #231 from delroth/dsphle-cleanups

DSPHLE: Rename files to remove redundant 'UCode' prefix.
This commit is contained in:
Pierre Bourdon 2014-03-30 00:03:42 +01:00
commit 5955cb8c6b
28 changed files with 267 additions and 267 deletions

View File

@ -67,17 +67,17 @@ set(SRCS ActionReplay.cpp
HW/AudioInterface.cpp HW/AudioInterface.cpp
HW/CPU.cpp HW/CPU.cpp
HW/DSP.cpp HW/DSP.cpp
HW/DSPHLE/UCodes/UCode_AX.cpp HW/DSPHLE/UCodes/AX.cpp
HW/DSPHLE/UCodes/UCode_AXWii.cpp HW/DSPHLE/UCodes/AXWii.cpp
HW/DSPHLE/UCodes/UCode_CARD.cpp HW/DSPHLE/UCodes/CARD.cpp
HW/DSPHLE/UCodes/UCode_InitAudioSystem.cpp HW/DSPHLE/UCodes/GBA.cpp
HW/DSPHLE/UCodes/UCode_ROM.cpp HW/DSPHLE/UCodes/INIT.cpp
HW/DSPHLE/UCodes/ROM.cpp
HW/DSPHLE/UCodes/UCodes.cpp HW/DSPHLE/UCodes/UCodes.cpp
HW/DSPHLE/UCodes/UCode_GBA.cpp HW/DSPHLE/UCodes/Zelda.cpp
HW/DSPHLE/UCodes/UCode_Zelda.cpp HW/DSPHLE/UCodes/ZeldaADPCM.cpp
HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp HW/DSPHLE/UCodes/ZeldaSynth.cpp
HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp HW/DSPHLE/UCodes/ZeldaVoice.cpp
HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp
HW/DSPHLE/MailHandler.cpp HW/DSPHLE/MailHandler.cpp
HW/DSPHLE/DSPHLE.cpp HW/DSPHLE/DSPHLE.cpp
HW/DSPLLE/DSPDebugInterface.cpp HW/DSPLLE/DSPDebugInterface.cpp

View File

@ -108,16 +108,16 @@
<ClCompile Include="HW\DSPHLE\DSPHLE.cpp" /> <ClCompile Include="HW\DSPHLE\DSPHLE.cpp" />
<ClCompile Include="HW\DSPHLE\MailHandler.cpp" /> <ClCompile Include="HW\DSPHLE\MailHandler.cpp" />
<ClCompile Include="HW\DSPHLE\UCodes\UCodes.cpp" /> <ClCompile Include="HW\DSPHLE\UCodes\UCodes.cpp" />
<ClCompile Include="HW\DSPHLE\UCodes\UCode_AX.cpp" /> <ClCompile Include="HW\DSPHLE\UCodes\AX.cpp" />
<ClCompile Include="HW\DSPHLE\UCodes\UCode_AXWii.cpp" /> <ClCompile Include="HW\DSPHLE\UCodes\AXWii.cpp" />
<ClCompile Include="HW\DSPHLE\UCodes\UCode_CARD.cpp" /> <ClCompile Include="HW\DSPHLE\UCodes\CARD.cpp" />
<ClCompile Include="HW\DSPHLE\UCodes\UCode_GBA.cpp" /> <ClCompile Include="HW\DSPHLE\UCodes\GBA.cpp" />
<ClCompile Include="HW\DSPHLE\UCodes\UCode_InitAudioSystem.cpp" /> <ClCompile Include="HW\DSPHLE\UCodes\INIT.cpp" />
<ClCompile Include="HW\DSPHLE\UCodes\UCode_ROM.cpp" /> <ClCompile Include="HW\DSPHLE\UCodes\ROM.cpp" />
<ClCompile Include="HW\DSPHLE\UCodes\UCode_Zelda.cpp" /> <ClCompile Include="HW\DSPHLE\UCodes\Zelda.cpp" />
<ClCompile Include="HW\DSPHLE\UCodes\UCode_Zelda_ADPCM.cpp" /> <ClCompile Include="HW\DSPHLE\UCodes\ZeldaADPCM.cpp" />
<ClCompile Include="HW\DSPHLE\UCodes\UCode_Zelda_Synth.cpp" /> <ClCompile Include="HW\DSPHLE\UCodes\ZeldaSynth.cpp" />
<ClCompile Include="HW\DSPHLE\UCodes\UCode_Zelda_Voice.cpp" /> <ClCompile Include="HW\DSPHLE\UCodes\ZeldaVoice.cpp" />
<ClCompile Include="HW\DSPLLE\DSPDebugInterface.cpp" /> <ClCompile Include="HW\DSPLLE\DSPDebugInterface.cpp" />
<ClCompile Include="HW\DSPLLE\DSPHost.cpp" /> <ClCompile Include="HW\DSPLLE\DSPHost.cpp" />
<ClCompile Include="HW\DSPLLE\DSPLLE.cpp" /> <ClCompile Include="HW\DSPLLE\DSPLLE.cpp" />
@ -306,15 +306,15 @@
<ClInclude Include="HW\DSPHLE\DSPHLE.h" /> <ClInclude Include="HW\DSPHLE\DSPHLE.h" />
<ClInclude Include="HW\DSPHLE\MailHandler.h" /> <ClInclude Include="HW\DSPHLE\MailHandler.h" />
<ClInclude Include="HW\DSPHLE\UCodes\UCodes.h" /> <ClInclude Include="HW\DSPHLE\UCodes\UCodes.h" />
<ClInclude Include="HW\DSPHLE\UCodes\UCode_AX.h" /> <ClInclude Include="HW\DSPHLE\UCodes\AX.h" />
<ClInclude Include="HW\DSPHLE\UCodes\UCode_AXStructs.h" /> <ClInclude Include="HW\DSPHLE\UCodes\AXStructs.h" />
<ClInclude Include="HW\DSPHLE\UCodes\UCode_AXWii.h" /> <ClInclude Include="HW\DSPHLE\UCodes\AXWii.h" />
<ClInclude Include="HW\DSPHLE\UCodes\UCode_AX_Voice.h" /> <ClInclude Include="HW\DSPHLE\UCodes\AXVoice.h" />
<ClInclude Include="HW\DSPHLE\UCodes\UCode_CARD.h" /> <ClInclude Include="HW\DSPHLE\UCodes\CARD.h" />
<ClInclude Include="HW\DSPHLE\UCodes\UCode_GBA.h" /> <ClInclude Include="HW\DSPHLE\UCodes\GBA.h" />
<ClInclude Include="HW\DSPHLE\UCodes\UCode_InitAudioSystem.h" /> <ClInclude Include="HW\DSPHLE\UCodes\INIT.h" />
<ClInclude Include="HW\DSPHLE\UCodes\UCode_ROM.h" /> <ClInclude Include="HW\DSPHLE\UCodes\ROM.h" />
<ClInclude Include="HW\DSPHLE\UCodes\UCode_Zelda.h" /> <ClInclude Include="HW\DSPHLE\UCodes\Zelda.h" />
<ClInclude Include="HW\DSPLLE\DSPDebugInterface.h" /> <ClInclude Include="HW\DSPLLE\DSPDebugInterface.h" />
<ClInclude Include="HW\DSPLLE\DSPLLE.h" /> <ClInclude Include="HW\DSPLLE\DSPLLE.h" />
<ClInclude Include="HW\DSPLLE\DSPLLEGlobals.h" /> <ClInclude Include="HW\DSPLLE\DSPLLEGlobals.h" />

View File

@ -311,34 +311,34 @@
<ClCompile Include="HW\DVDInterface.cpp"> <ClCompile Include="HW\DVDInterface.cpp">
<Filter>HW %28Flipper/Hollywood%29\DI - Drive Interface</Filter> <Filter>HW %28Flipper/Hollywood%29\DI - Drive Interface</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\DSPHLE\UCodes\UCode_AX.cpp"> <ClCompile Include="HW\DSPHLE\UCodes\AX.cpp">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\DSPHLE\UCodes\UCode_AXWii.cpp"> <ClCompile Include="HW\DSPHLE\UCodes\AXWii.cpp">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\DSPHLE\UCodes\UCode_CARD.cpp"> <ClCompile Include="HW\DSPHLE\UCodes\CARD.cpp">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\DSPHLE\UCodes\UCode_GBA.cpp"> <ClCompile Include="HW\DSPHLE\UCodes\GBA.cpp">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\DSPHLE\UCodes\UCode_InitAudioSystem.cpp"> <ClCompile Include="HW\DSPHLE\UCodes\INIT.cpp">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\DSPHLE\UCodes\UCode_ROM.cpp"> <ClCompile Include="HW\DSPHLE\UCodes\ROM.cpp">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\DSPHLE\UCodes\UCode_Zelda.cpp"> <ClCompile Include="HW\DSPHLE\UCodes\Zelda.cpp">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\DSPHLE\UCodes\UCode_Zelda_ADPCM.cpp"> <ClCompile Include="HW\DSPHLE\UCodes\ZeldaADPCM.cpp">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\DSPHLE\UCodes\UCode_Zelda_Synth.cpp"> <ClCompile Include="HW\DSPHLE\UCodes\ZeldaSynth.cpp">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\DSPHLE\UCodes\UCode_Zelda_Voice.cpp"> <ClCompile Include="HW\DSPHLE\UCodes\ZeldaVoice.cpp">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="HW\DSPHLE\UCodes\UCodes.cpp"> <ClCompile Include="HW\DSPHLE\UCodes\UCodes.cpp">
@ -837,31 +837,31 @@
<ClInclude Include="HW\DVDInterface.h"> <ClInclude Include="HW\DVDInterface.h">
<Filter>HW %28Flipper/Hollywood%29\DI - Drive Interface</Filter> <Filter>HW %28Flipper/Hollywood%29\DI - Drive Interface</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="HW\DSPHLE\UCodes\UCode_AX.h"> <ClInclude Include="HW\DSPHLE\UCodes\AX.h">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="HW\DSPHLE\UCodes\UCode_AX_Voice.h"> <ClInclude Include="HW\DSPHLE\UCodes\AXVoice.h">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="HW\DSPHLE\UCodes\UCode_AXStructs.h"> <ClInclude Include="HW\DSPHLE\UCodes\AXStructs.h">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="HW\DSPHLE\UCodes\UCode_AXWii.h"> <ClInclude Include="HW\DSPHLE\UCodes\AXWii.h">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="HW\DSPHLE\UCodes\UCode_CARD.h"> <ClInclude Include="HW\DSPHLE\UCodes\CARD.h">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="HW\DSPHLE\UCodes\UCode_GBA.h"> <ClInclude Include="HW\DSPHLE\UCodes\GBA.h">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="HW\DSPHLE\UCodes\UCode_InitAudioSystem.h"> <ClInclude Include="HW\DSPHLE\UCodes\INIT.h">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="HW\DSPHLE\UCodes\UCode_ROM.h"> <ClInclude Include="HW\DSPHLE\UCodes\ROM.h">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="HW\DSPHLE\UCodes\UCode_Zelda.h"> <ClInclude Include="HW\DSPHLE\UCodes\Zelda.h">
<Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter> <Filter>HW %28Flipper/Hollywood%29\DSP Interface + HLE\HLE\uCodes</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="HW\DSPHLE\UCodes\UCodes.h"> <ClInclude Include="HW\DSPHLE\UCodes\UCodes.h">

View File

@ -95,7 +95,7 @@ void DSPHLE::SendMailToDSP(u32 _uMail)
} }
} }
IUCode* DSPHLE::GetUCode() UCodeInterface* DSPHLE::GetUCode()
{ {
return m_pUCode; return m_pUCode;
} }
@ -160,9 +160,9 @@ void DSPHLE::DoState(PointerWrap &p)
p.DoPOD(m_DSPControl); p.DoPOD(m_DSPControl);
p.DoPOD(m_dspState); 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 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; int lastucode_crc_beforeLoad = lastucode_crc;
p.Do(ucode_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, // 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. // 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); UCodeInterface* 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* lastucode = (lastucode_crc != lastucode_crc_beforeLoad) ? m_lastUCode : UCodeFactory(lastucode_crc, this, m_bWii);
if (ucode) if (ucode)
ucode->DoState(p); ucode->DoState(p);

View File

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

View File

@ -7,29 +7,29 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/DSP.h" #include "Core/HW/DSP.h"
#include "Core/HW/DSPHLE/UCodes/UCode_AX.h" #include "Core/HW/DSPHLE/UCodes/AX.h"
#define AX_GC #define AX_GC
#include "Core/HW/DSPHLE/UCodes/UCode_AX_Voice.h" #include "Core/HW/DSPHLE/UCodes/AXVoice.h"
CUCode_AX::CUCode_AX(DSPHLE* dsp_hle, u32 crc) AXUCode::AXUCode(DSPHLE* dsp_hle, u32 crc)
: IUCode(dsp_hle, crc) : UCodeInterface(dsp_hle, crc)
, m_work_available(false) , m_work_available(false)
, m_cmdlist_size(0) , 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); m_rMailHandler.PushMail(DSP_INIT);
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
LoadResamplingCoefficients(); LoadResamplingCoefficients();
} }
CUCode_AX::~CUCode_AX() AXUCode::~AXUCode()
{ {
m_rMailHandler.Clear(); m_rMailHandler.Clear();
} }
void CUCode_AX::LoadResamplingCoefficients() void AXUCode::LoadResamplingCoefficients()
{ {
m_coeffs_available = false; m_coeffs_available = false;
@ -66,14 +66,14 @@ void CUCode_AX::LoadResamplingCoefficients()
m_coeffs_available = true; m_coeffs_available = true;
} }
void CUCode_AX::SignalWorkEnd() void AXUCode::SignalWorkEnd()
{ {
// Signal end of processing // Signal end of processing
m_rMailHandler.PushMail(DSP_YIELD); m_rMailHandler.PushMail(DSP_YIELD);
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
} }
void CUCode_AX::HandleCommandList() void AXUCode::HandleCommandList()
{ {
// Temp variables for addresses computation // Temp variables for addresses computation
u16 addr_hi, addr_lo; 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; u32 start_idx = 0;
for (int i = 0; i < curr_ms; ++i) 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; u32 ret = 0;
@ -313,7 +313,7 @@ AXMixControl CUCode_AX::ConvertMixerControl(u32 mixer_control)
return (AXMixControl)ret; return (AXMixControl)ret;
} }
void CUCode_AX::SetupProcessing(u32 init_addr) void AXUCode::SetupProcessing(u32 init_addr)
{ {
u16 init_data[0x20]; 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_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 }; 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 // Samples per millisecond. In theory DSP sampling rate can be changed from
// 32KHz to 48KHz, but AX always process at 32KHz. // 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 }; 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++); sample += (int)Common::swap32(*ptr++);
} }
void CUCode_AX::UploadLRS(u32 dst_addr) void AXUCode::UploadLRS(u32 dst_addr)
{ {
int buffers[3][5 * 32]; 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)); 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); int* ptr = (int*)HLEMemory_Get_Pointer(src_addr);
for (u32 i = 0; i < 5 * 32; ++i) 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]; 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)); 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 // Upload AUXB L/R
int* ptr = (int*)HLEMemory_Get_Pointer(ul_addr); 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); int* ptr = (int*)HLEMemory_Get_Pointer(src_addr);
for (u32 i = 0; i < 5 * 32; ++i) 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) u32 main_r_dl, u32 auxb_l_dl, u32 auxb_r_dl)
{ {
// Buffers to upload first // 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. // Indicates if the next message is a command list address.
static bool next_is_cmdlist = false; static bool next_is_cmdlist = false;
@ -648,7 +648,7 @@ void CUCode_AX::HandleMail(u32 mail)
next_is_cmdlist = set_next_is_cmdlist; 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))) if (size >= (sizeof (m_cmdlist) / sizeof (u16)))
{ {
@ -661,7 +661,7 @@ void CUCode_AX::CopyCmdList(u32 addr, u16 size)
m_cmdlist_size = size; m_cmdlist_size = size;
} }
void CUCode_AX::Update(int cycles) void AXUCode::Update(int cycles)
{ {
// Used for UCode switching. // Used for UCode switching.
if (NeedsResumeMail()) if (NeedsResumeMail())
@ -677,12 +677,12 @@ void CUCode_AX::Update(int cycles)
} }
} }
u32 CUCode_AX::GetUpdateMs() u32 AXUCode::GetUpdateMs()
{ {
return 5; return 5;
} }
void CUCode_AX::DoAXState(PointerWrap& p) void AXUCode::DoAXState(PointerWrap& p)
{ {
p.Do(m_cmdlist); p.Do(m_cmdlist);
p.Do(m_cmdlist_size); p.Do(m_cmdlist_size);
@ -698,7 +698,7 @@ void CUCode_AX::DoAXState(PointerWrap& p)
p.Do(m_samples_auxB_surround); p.Do(m_samples_auxB_surround);
} }
void CUCode_AX::DoState(PointerWrap& p) void AXUCode::DoState(PointerWrap& p)
{ {
DoStateShared(p); DoStateShared(p);
DoAXState(p); DoAXState(p);

View File

@ -12,7 +12,7 @@
#pragma once #pragma once
#include "Core/HW/DSPHLE/UCodes/UCode_AXStructs.h" #include "Core/HW/DSPHLE/UCodes/AXStructs.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h" #include "Core/HW/DSPHLE/UCodes/UCodes.h"
// We can't directly use the mixer_control field from the PB because it does // We can't directly use the mixer_control field from the PB because it does
@ -49,11 +49,11 @@ enum AXMixControl
MIX_AUXC_S_RAMP = 0x800000 MIX_AUXC_S_RAMP = 0x800000
}; };
class CUCode_AX : public IUCode class AXUCode : public UCodeInterface
{ {
public: public:
CUCode_AX(DSPHLE* dsp_hle, u32 crc); AXUCode(DSPHLE* dsp_hle, u32 crc);
virtual ~CUCode_AX(); virtual ~AXUCode();
virtual void HandleMail(u32 mail) override; virtual void HandleMail(u32 mail) override;
virtual void Update(int cycles) override; virtual void Update(int cycles) override;

View File

@ -9,7 +9,7 @@
#pragma once #pragma once
#if !defined(AX_GC) && !defined(AX_WII) #if !defined(AX_GC) && !defined(AX_WII)
#error UCode_AX_Voice.h included without specifying version #error AXVoice.h included without specifying version
#endif #endif
#include <functional> #include <functional>
@ -18,8 +18,8 @@
#include "Common/MathUtil.h" #include "Common/MathUtil.h"
#include "Core/HW/DSP.h" #include "Core/HW/DSP.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/HW/DSPHLE/UCodes/UCode_AX.h" #include "Core/HW/DSPHLE/UCodes/AX.h"
#include "Core/HW/DSPHLE/UCodes/UCode_AXStructs.h" #include "Core/HW/DSPHLE/UCodes/AXStructs.h"
#ifdef AX_GC #ifdef AX_GC
# define PB_TYPE AXPB # define PB_TYPE AXPB

View File

@ -2,36 +2,36 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
// //
#define AX_WII // Used in UCode_AX_Voice. #define AX_WII // Used in AXVoice.
#include "Common/MathUtil.h" #include "Common/MathUtil.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/HW/DSPHLE/MailHandler.h" #include "Core/HW/DSPHLE/MailHandler.h"
#include "Core/HW/DSPHLE/UCodes/UCode_AX_Voice.h" #include "Core/HW/DSPHLE/UCodes/AXStructs.h"
#include "Core/HW/DSPHLE/UCodes/UCode_AXStructs.h" #include "Core/HW/DSPHLE/UCodes/AXVoice.h"
#include "Core/HW/DSPHLE/UCodes/UCode_AXWii.h" #include "Core/HW/DSPHLE/UCodes/AXWii.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h" #include "Core/HW/DSPHLE/UCodes/UCodes.h"
CUCode_AXWii::CUCode_AXWii(DSPHLE *dsp_hle, u32 l_CRC) AXWiiUCode::AXWiiUCode(DSPHLE *dsp_hle, u32 l_CRC)
: CUCode_AX(dsp_hle, l_CRC), : AXUCode(dsp_hle, l_CRC),
m_last_main_volume(0x8000) m_last_main_volume(0x8000)
{ {
for (u16& volume : m_last_aux_volumes) for (u16& volume : m_last_aux_volumes)
volume = 0x8000; volume = 0x8000;
WARN_LOG(DSPHLE, "Instantiating CUCode_AXWii"); WARN_LOG(DSPHLE, "Instantiating AXWiiUCode");
m_old_axwii = (l_CRC == 0xfa450138); m_old_axwii = (l_CRC == 0xfa450138);
} }
CUCode_AXWii::~CUCode_AXWii() AXWiiUCode::~AXWiiUCode()
{ {
} }
void CUCode_AXWii::HandleCommandList() void AXWiiUCode::HandleCommandList()
{ {
// Temp variables for addresses computation // Temp variables for addresses computation
u16 addr_hi, addr_lo; 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 // TODO: should be easily factorizable with AX
s16 init_data[60]; 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); int* ptr = (int*)HLEMemory_Get_Pointer(val_addr);
for (int i = 0; i < 32 * 3; ++i) 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); int* ptr = (int*)HLEMemory_Get_Pointer(val_addr);
for (int i = 0; i < 32 * 3; ++i) 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; u32 ret = 0;
@ -359,7 +359,7 @@ AXMixControl CUCode_AXWii::ConvertMixerControl(u32 mixer_control)
return (AXMixControl)ret; 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; float curr = vol1;
for (size_t i = 0; i < nvals; ++i) 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) u32* updates_addr)
{ {
u16* pb_mem = (u16*)&pb; u16* pb_mem = (u16*)&pb;
@ -409,7 +409,7 @@ bool CUCode_AXWii::ExtractUpdatesFields(AXPBWii& pb, u16* num_updates, u16* upda
return true; 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; 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; pb_mem[45] = updates_addr & 0xFFFF;
} }
void CUCode_AXWii::ProcessPBList(u32 pb_addr) void AXWiiUCode::ProcessPBList(u32 pb_addr)
{ {
AXPBWii pb; 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]; u16 volume_ramp[96];
GenerateVolumeRamp(volume_ramp, m_last_aux_volumes[aux_id], volume, 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_left = aux_id ? m_samples_auxB_left : m_samples_auxA_left;
int* aux_right = aux_id ? m_samples_auxB_right : m_samples_auxA_right; 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) bool upload_auxc)
{ {
u16 volume_ramp[96]; 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. // sounds to go at half speed. I have no idea why.
} }
void CUCode_AXWii::OutputWMSamples(u32* addresses) void AXWiiUCode::OutputWMSamples(u32* addresses)
{ {
int* buffers[] = { int* buffers[] = {
m_samples_wm0, m_samples_wm0,
@ -659,12 +659,12 @@ void CUCode_AXWii::OutputWMSamples(u32* addresses)
} }
} }
u32 CUCode_AXWii::GetUpdateMs() u32 AXWiiUCode::GetUpdateMs()
{ {
return 3; return 3;
} }
void CUCode_AXWii::DoState(PointerWrap &p) void AXWiiUCode::DoState(PointerWrap &p)
{ {
DoStateShared(p); DoStateShared(p);
DoAXState(p); DoAXState(p);

View File

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

View File

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

View File

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

View File

@ -4,21 +4,21 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/DSP.h" #include "Core/HW/DSP.h"
#include "Core/HW/DSPHLE/UCodes/UCode_GBA.h" #include "Core/HW/DSPHLE/UCodes/GBA.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h" #include "Core/HW/DSPHLE/UCodes/UCodes.h"
CUCode_GBA::CUCode_GBA(DSPHLE *dsp_hle, u32 crc) GBAUCode::GBAUCode(DSPHLE *dsp_hle, u32 crc)
: IUCode(dsp_hle, crc) : UCodeInterface(dsp_hle, crc)
{ {
m_rMailHandler.PushMail(DSP_INIT); m_rMailHandler.PushMail(DSP_INIT);
} }
CUCode_GBA::~CUCode_GBA() GBAUCode::~GBAUCode()
{ {
m_rMailHandler.Clear(); m_rMailHandler.Clear();
} }
void CUCode_GBA::Update(int cycles) void GBAUCode::Update(int cycles)
{ {
// check if we have to send something // check if we have to send something
if (!m_rMailHandler.IsEmpty()) 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; 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 nextmail_is_mramaddr = false;
static bool calc_done = false; static bool calc_done = false;
@ -136,12 +136,12 @@ void CUCode_GBA::HandleMail(u32 _uMail)
m_DSPHLE->SetUCode(UCODE_ROM); m_DSPHLE->SetUCode(UCODE_ROM);
break; break;
default: default:
DEBUG_LOG(DSPHLE, "CUCode_GBA - unknown 0xcdd1 command: %08x", _uMail); DEBUG_LOG(DSPHLE, "GBAUCode - unknown 0xcdd1 command: %08x", _uMail);
break; break;
} }
} }
else 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" #include "Core/HW/DSPHLE/UCodes/UCodes.h"
struct CUCode_GBA : public IUCode struct GBAUCode : public UCodeInterface
{ {
CUCode_GBA(DSPHLE *dsp_hle, u32 crc); GBAUCode(DSPHLE *dsp_hle, u32 crc);
virtual ~CUCode_GBA(); virtual ~GBAUCode();
u32 GetUpdateMs() override; u32 GetUpdateMs() override;
void HandleMail(u32 _uMail) override; void HandleMail(u32 _uMail) override;

View File

@ -0,0 +1,44 @@
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Core/ConfigManager.h"
#include "Core/HW/DSPHLE/UCodes/INIT.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
INITUCode::INITUCode(DSPHLE *dsp_hle, u32 crc)
: UCodeInterface(dsp_hle, crc)
{
DEBUG_LOG(DSPHLE, "INITUCode - initialized");
}
INITUCode::~INITUCode()
{
}
void INITUCode::Init()
{
}
void INITUCode::Update(int cycles)
{
if (m_rMailHandler.IsEmpty())
{
m_rMailHandler.PushMail(0x80544348);
// HALT
}
}
u32 INITUCode::GetUpdateMs()
{
return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5;
}
void INITUCode::HandleMail(u32 _uMail)
{
}

View File

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

View File

@ -10,11 +10,11 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/HW/DSPHLE/UCodes/UCode_ROM.h" #include "Core/HW/DSPHLE/UCodes/ROM.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h" #include "Core/HW/DSPHLE/UCodes/UCodes.h"
CUCode_Rom::CUCode_Rom(DSPHLE *dsp_hle, u32 crc) ROMUCode::ROMUCode(DSPHLE *dsp_hle, u32 crc)
: IUCode(dsp_hle, crc) : UCodeInterface(dsp_hle, crc)
, m_CurrentUCode() , m_CurrentUCode()
, m_BootTask_numSteps(0) , m_BootTask_numSteps(0)
, m_NextParameter(0) , m_NextParameter(0)
@ -24,13 +24,13 @@ CUCode_Rom::CUCode_Rom(DSPHLE *dsp_hle, u32 crc)
m_rMailHandler.PushMail(0x8071FEED); 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) 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( u32 ector_crc = HashEctor(
(u8*)HLEMemory_Get_Pointer(m_CurrentUCode.m_RAMAddress), (u8*)HLEMemory_Get_Pointer(m_CurrentUCode.m_RAMAddress),
@ -107,12 +107,12 @@ void CUCode_Rom::BootUCode()
m_DSPHLE->SetUCode(ector_crc); m_DSPHLE->SetUCode(ector_crc);
} }
u32 CUCode_Rom::GetUpdateMs() u32 ROMUCode::GetUpdateMs()
{ {
return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5; 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_CurrentUCode);
p.Do(m_BootTask_numSteps); p.Do(m_BootTask_numSteps);

View File

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

View File

@ -1,44 +0,0 @@
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Core/ConfigManager.h"
#include "Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h"
CUCode_InitAudioSystem::CUCode_InitAudioSystem(DSPHLE *dsp_hle, u32 crc)
: IUCode(dsp_hle, crc)
{
DEBUG_LOG(DSPHLE, "CUCode_InitAudioSystem - initialized");
}
CUCode_InitAudioSystem::~CUCode_InitAudioSystem()
{
}
void CUCode_InitAudioSystem::Init()
{
}
void CUCode_InitAudioSystem::Update(int cycles)
{
if (m_rMailHandler.IsEmpty())
{
m_rMailHandler.PushMail(0x80544348);
// HALT
}
}
u32 CUCode_InitAudioSystem::GetUpdateMs()
{
return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5;
}
void CUCode_InitAudioSystem::HandleMail(u32 _uMail)
{
}

View File

@ -8,34 +8,34 @@
#include "Common/Hash.h" #include "Common/Hash.h"
#include "Core/HW/DSPHLE/UCodes/UCode_AX.h" #include "Core/HW/DSPHLE/UCodes/AX.h"
#include "Core/HW/DSPHLE/UCodes/UCode_AXWii.h" #include "Core/HW/DSPHLE/UCodes/AXWii.h"
#include "Core/HW/DSPHLE/UCodes/UCode_CARD.h" #include "Core/HW/DSPHLE/UCodes/CARD.h"
#include "Core/HW/DSPHLE/UCodes/UCode_GBA.h" #include "Core/HW/DSPHLE/UCodes/GBA.h"
#include "Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h" #include "Core/HW/DSPHLE/UCodes/INIT.h"
#include "Core/HW/DSPHLE/UCodes/UCode_ROM.h" #include "Core/HW/DSPHLE/UCodes/ROM.h"
#include "Core/HW/DSPHLE/UCodes/UCode_Zelda.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h" #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) switch (_CRC)
{ {
case UCODE_ROM: case UCODE_ROM:
INFO_LOG(DSPHLE, "Switching to ROM ucode"); 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: case UCODE_INIT_AUDIO_SYSTEM:
INFO_LOG(DSPHLE, "Switching to INIT ucode"); INFO_LOG(DSPHLE, "Switching to INIT ucode");
return new CUCode_InitAudioSystem(dsp_hle, _CRC); return new INITUCode(dsp_hle, _CRC);
case 0x65d6cc6f: // CARD case 0x65d6cc6f: // CARD
INFO_LOG(DSPHLE, "Switching to CARD ucode"); INFO_LOG(DSPHLE, "Switching to CARD ucode");
return new CUCode_CARD(dsp_hle, _CRC); return new CARDUCode(dsp_hle, _CRC);
case 0xdd7e72d5: case 0xdd7e72d5:
INFO_LOG(DSPHLE, "Switching to GBA ucode"); 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 0x3ad3b7ac: // Naruto3, Paper Mario - The Thousand Year Door
case 0x3daf59b9: // Alien Hominid 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 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080
case 0x3389a79e: // MP1/MP2 Wii (Metroid Prime Trilogy) case 0x3389a79e: // MP1/MP2 Wii (Metroid Prime Trilogy)
INFO_LOG(DSPHLE, "CRC %08x: AX ucode chosen", _CRC); 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 0x6ba3b3ea: // IPL - PAL
case 0x24b22038: // IPL - NTSC/NTSC-JAP case 0x24b22038: // IPL - NTSC/NTSC-JAP
case 0x42f64ac4: // Luigi case 0x42f64ac4: // Luigi
case 0x4be6a5cb: // AC, Pikmin case 0x4be6a5cb: // AC, Pikmin
INFO_LOG(DSPHLE, "CRC %08x: JAC (early Zelda) ucode chosen", _CRC); 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 0x6CA33A6D: // DK Jungle Beat
case 0x86840740: // Zelda WW - US 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 0x2fcdf1ec: // Mario Kart, zelda 4 swords
case 0x267fd05a: // Pikmin PAL case 0x267fd05a: // Pikmin PAL
INFO_LOG(DSPHLE, "CRC %08x: Zelda ucode chosen", _CRC); INFO_LOG(DSPHLE, "CRC %08x: Zelda ucode chosen", _CRC);
return new CUCode_Zelda(dsp_hle, _CRC); return new ZeldaUCode(dsp_hle, _CRC);
// WII CRCs // WII CRCs
case 0xb7eb9a9c: // Wii Pikmin - PAL case 0xb7eb9a9c: // Wii Pikmin - PAL
@ -71,7 +71,7 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
case 0x6c3f6f94: // Zelda TP - PAL case 0x6c3f6f94: // Zelda TP - PAL
case 0xd643001f: // Mario Galaxy - PAL / WII DK Jungle Beat - PAL case 0xd643001f: // Mario Galaxy - PAL / WII DK Jungle Beat - PAL
INFO_LOG(DSPHLE, "CRC %08x: Zelda Wii ucode chosen\n", _CRC); 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 0x2ea36ce6: // Some Wii demos
case 0x5ef56da3: // AX demo case 0x5ef56da3: // AX demo
@ -81,18 +81,18 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
case 0x4cc52064: // Bleach: Versus Crusade case 0x4cc52064: // Bleach: Versus Crusade
case 0xd9c4bf34: // WiiMenu case 0xd9c4bf34: // WiiMenu
INFO_LOG(DSPHLE, "CRC %08x: Wii - AXWii chosen", _CRC); INFO_LOG(DSPHLE, "CRC %08x: Wii - AXWii chosen", _CRC);
return new CUCode_AXWii(dsp_hle, _CRC); return new AXWiiUCode(dsp_hle, _CRC);
default: default:
if (bWii) if (bWii)
{ {
PanicAlert("DSPHLE: Unknown ucode (CRC = %08x) - forcing AXWii.\n\nTry LLE emulator if this is homebrew.", _CRC); 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 else
{ {
PanicAlert("DSPHLE: Unknown ucode (CRC = %08x) - forcing AX.\n\nTry LLE emulator if this is homebrew.", _CRC); 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: case UCODE_NULL:
@ -102,7 +102,7 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
return nullptr; return nullptr;
} }
bool IUCode::NeedsResumeMail() bool UCodeInterface::NeedsResumeMail()
{ {
if (m_NeedsResumeMail) if (m_NeedsResumeMail)
{ {
@ -112,7 +112,7 @@ bool IUCode::NeedsResumeMail()
return false; return false;
} }
void IUCode::PrepareBootUCode(u32 mail) void UCodeInterface::PrepareBootUCode(u32 mail)
{ {
switch (m_NextUCode_steps) 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_UploadSetupInProgress);
p.Do(m_NextUCode); 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]; return &Memory::m_pRAM[_uAddress & Memory::RAM_MASK];
} }
class IUCode class UCodeInterface
{ {
public: public:
IUCode(DSPHLE *dsphle, u32 _crc) UCodeInterface(DSPHLE *dsphle, u32 _crc)
: m_rMailHandler(dsphle->AccessMailHandler()) : m_rMailHandler(dsphle->AccessMailHandler())
, m_UploadSetupInProgress(false) , m_UploadSetupInProgress(false)
, m_DSPHLE(dsphle) , m_DSPHLE(dsphle)
@ -70,7 +70,7 @@ public:
, m_NeedsResumeMail(false) , m_NeedsResumeMail(false)
{} {}
virtual ~IUCode() virtual ~UCodeInterface()
{} {}
virtual void HandleMail(u32 _uMail) = 0; virtual void HandleMail(u32 _uMail) = 0;
@ -81,7 +81,7 @@ public:
virtual void DoState(PointerWrap &p) { DoStateShared(p); } 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: protected:
void PrepareBootUCode(u32 mail); void PrepareBootUCode(u32 mail);
@ -106,7 +106,7 @@ protected:
}; };
// UCode is forwarding mails to PrepareBootUCode // 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; bool m_UploadSetupInProgress;
// Need a pointer back to DSPHLE to switch ucodes. // Need a pointer back to DSPHLE to switch ucodes.
@ -136,4 +136,4 @@ private:
bool m_NeedsResumeMail; 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

@ -9,13 +9,13 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/DSP.h" #include "Core/HW/DSP.h"
#include "Core/HW/DSPHLE/MailHandler.h" #include "Core/HW/DSPHLE/MailHandler.h"
#include "Core/HW/DSPHLE/UCodes/UCode_Zelda.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h" #include "Core/HW/DSPHLE/UCodes/UCodes.h"
#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_bSyncInProgress(false),
m_MaxVoice(0), m_MaxVoice(0),
@ -76,7 +76,7 @@ CUCode_Zelda::CUCode_Zelda(DSPHLE *dsp_hle, u32 _CRC)
memset(m_PBMask, 0, sizeof(m_PBMask)); memset(m_PBMask, 0, sizeof(m_PBMask));
} }
CUCode_Zelda::~CUCode_Zelda() ZeldaUCode::~ZeldaUCode()
{ {
m_rMailHandler.Clear(); m_rMailHandler.Clear();
@ -86,7 +86,7 @@ CUCode_Zelda::~CUCode_Zelda()
delete [] m_RightBuffer; delete [] m_RightBuffer;
} }
u8 *CUCode_Zelda::GetARAMPointer(u32 address) u8 *ZeldaUCode::GetARAMPointer(u32 address)
{ {
if (IsDMAVersion()) if (IsDMAVersion())
return Memory::GetPointer(m_DMABaseAddr) + address; return Memory::GetPointer(m_DMABaseAddr) + address;
@ -94,7 +94,7 @@ u8 *CUCode_Zelda::GetARAMPointer(u32 address)
return DSP::GetARAMPtr() + address; return DSP::GetARAMPtr() + address;
} }
void CUCode_Zelda::Update(int cycles) void ZeldaUCode::Update(int cycles)
{ {
if (!IsLightVersion()) 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()) if (IsLightVersion())
HandleMail_LightVersion(_uMail); HandleMail_LightVersion(_uMail);
@ -119,7 +119,7 @@ void CUCode_Zelda::HandleMail(u32 _uMail)
HandleMail_NormalVersion(_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", //ERROR_LOG(DSPHLE, "Light version mail %08X, list in progress: %s, step: %i/%i",
// _uMail, m_bListInProgress ? "yes":"no", m_step, m_numSteps); // _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) 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); // WARN_LOG(DSPHLE, "Zelda uCode: Handle mail %08X", _uMail);
@ -390,7 +390,7 @@ void CUCode_Zelda::HandleMail_NormalVersion(u32 _uMail)
} }
// zelda debug ..803F6418 // zelda debug ..803F6418
void CUCode_Zelda::ExecuteList() void ZeldaUCode::ExecuteList()
{ {
// begin with the list // begin with the list
m_readOffset = 0; 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; 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_AFCCoefTable);
p.Do(m_MiscTable); p.Do(m_MiscTable);

View File

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

View File

@ -4,9 +4,9 @@
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/MathUtil.h" #include "Common/MathUtil.h"
#include "Core/HW/DSPHLE/UCodes/UCode_Zelda.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. // First 2 nibbles are ADPCM scale etc.
short delta = 1 << (((*src) >> 4) & 0xf); short delta = 1 << (((*src) >> 4) & 0xf);

View File

@ -1,6 +1,6 @@
#if 0 #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; u16* pTest = (u16*)&_rPB;

View File

@ -4,10 +4,10 @@
#include <cmath> #include <cmath>
#include "Core/HW/DSPHLE/UCodes/UCode_Zelda.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h" #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 ratio = ((s64)PB.RatioInt << 16) * 16;
s64 TrueSamplePosition = PB.CurSampleFrac; s64 TrueSamplePosition = PB.CurSampleFrac;
@ -79,7 +79,7 @@ _lRestart:
PB.CurSampleFrac = TrueSamplePosition & 0xFFFF; 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); s32 ratio = (s32)ceil((float)PB.RatioInt / 3);
s64 pos = PB.CurSampleFrac; s64 pos = PB.CurSampleFrac;
@ -93,7 +93,7 @@ void CUCode_Zelda::RenderSynth_SawWave(ZeldaVoicePB &PB, s32* _Buffer, int _Size
PB.CurSampleFrac = pos & 0xFFFF; 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 // TODO: Header, footer
for (int i = 0; i < _Size; i++) for (int i = 0; i < _Size; i++)
@ -122,7 +122,7 @@ inline u16 AddValueToReg(u32 ar, s32 ix)
return nar; 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; u16 address;

View File

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