diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp index 261e96e73e..3f523add10 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp @@ -12,13 +12,13 @@ #define AX_GC #include "Core/HW/DSPHLE/UCodes/AXVoice.h" -AXUCode::AXUCode(DSPHLE* dsp_hle, u32 crc) - : UCodeInterface(dsp_hle, crc) +AXUCode::AXUCode(DSPHLE* dsphle, u32 crc) + : UCodeInterface(dsphle, crc) , m_work_available(false) , m_cmdlist_size(0) { WARN_LOG(DSPHLE, "Instantiating AXUCode: crc=%08x", crc); - m_rMailHandler.PushMail(DSP_INIT); + m_mail_handler.PushMail(DSP_INIT); DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); LoadResamplingCoefficients(); @@ -26,7 +26,7 @@ AXUCode::AXUCode(DSPHLE* dsp_hle, u32 crc) AXUCode::~AXUCode() { - m_rMailHandler.Clear(); + m_mail_handler.Clear(); } void AXUCode::LoadResamplingCoefficients() @@ -69,7 +69,7 @@ void AXUCode::LoadResamplingCoefficients() void AXUCode::SignalWorkEnd() { // Signal end of processing - m_rMailHandler.PushMail(DSP_YIELD); + m_mail_handler.PushMail(DSP_YIELD); DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); } @@ -270,7 +270,7 @@ AXMixControl AXUCode::ConvertMixerControl(u32 mixer_control) u32 ret = 0; // TODO: find other UCode versions with different mixer_control values - if (m_CRC == 0x4e8a8b21) + if (m_crc == 0x4e8a8b21) { ret |= MIX_L | MIX_R; if (mixer_control & 0x0001) ret |= MIX_AUXA_L | MIX_AUXA_R; @@ -611,23 +611,23 @@ void AXUCode::HandleMail(u32 mail) CopyCmdList(mail, cmdlist_size); m_work_available = true; } - else if (m_UploadSetupInProgress) + else if (m_upload_setup_in_progress) { PrepareBootUCode(mail); } else if (mail == MAIL_RESUME) { // Acknowledge the resume request - m_rMailHandler.PushMail(DSP_RESUME); + m_mail_handler.PushMail(DSP_RESUME); DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); } else if (mail == MAIL_NEW_UCODE) { - m_UploadSetupInProgress = true; + m_upload_setup_in_progress = true; } else if (mail == MAIL_RESET) { - m_DSPHLE->SetUCode(UCODE_ROM); + m_dsphle->SetUCode(UCODE_ROM); } else if (mail == MAIL_CONTINUE) { @@ -666,7 +666,7 @@ void AXUCode::Update(int cycles) // Used for UCode switching. if (NeedsResumeMail()) { - m_rMailHandler.PushMail(DSP_RESUME); + m_mail_handler.PushMail(DSP_RESUME); DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); } else if (m_work_available) diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AX.h b/Source/Core/Core/HW/DSPHLE/UCodes/AX.h index debda907a2..194f0d671f 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AX.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AX.h @@ -52,7 +52,7 @@ enum AXMixControl class AXUCode : public UCodeInterface { public: - AXUCode(DSPHLE* dsp_hle, u32 crc); + AXUCode(DSPHLE* dsphle, u32 crc); virtual ~AXUCode(); virtual void HandleMail(u32 mail) override; diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp index 62379e46d4..cdf8cc332a 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp @@ -15,8 +15,8 @@ #include "Core/HW/DSPHLE/UCodes/UCodes.h" -AXWiiUCode::AXWiiUCode(DSPHLE *dsp_hle, u32 l_CRC) - : AXUCode(dsp_hle, l_CRC), +AXWiiUCode::AXWiiUCode(DSPHLE *dsphle, u32 crc) + : AXUCode(dsphle, crc), m_last_main_volume(0x8000) { for (u16& volume : m_last_aux_volumes) @@ -24,7 +24,7 @@ AXWiiUCode::AXWiiUCode(DSPHLE *dsp_hle, u32 l_CRC) WARN_LOG(DSPHLE, "Instantiating AXWiiUCode"); - m_old_axwii = (l_CRC == 0xfa450138); + m_old_axwii = (crc == 0xfa450138); } AXWiiUCode::~AXWiiUCode() diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.h b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.h index 813d098d19..94565078b6 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.h @@ -9,7 +9,7 @@ class AXWiiUCode : public AXUCode { public: - AXWiiUCode(DSPHLE *dsp_hle, u32 _CRC); + AXWiiUCode(DSPHLE *dsphle, u32 crc); virtual ~AXWiiUCode(); u32 GetUpdateMs() override; diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/CARD.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/CARD.cpp index fdc74e8390..4179a7eeb8 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/CARD.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/CARD.cpp @@ -9,24 +9,24 @@ #include "Core/HW/DSPHLE/UCodes/UCodes.h" -CARDUCode::CARDUCode(DSPHLE *dsp_hle, u32 crc) - : UCodeInterface(dsp_hle, crc) +CARDUCode::CARDUCode(DSPHLE *dsphle, u32 crc) + : UCodeInterface(dsphle, crc) { DEBUG_LOG(DSPHLE, "CARDUCode - initialized"); - m_rMailHandler.PushMail(DSP_INIT); + m_mail_handler.PushMail(DSP_INIT); } CARDUCode::~CARDUCode() { - m_rMailHandler.Clear(); + m_mail_handler.Clear(); } void CARDUCode::Update(int cycles) { // check if we have to sent something - if (!m_rMailHandler.IsEmpty()) + if (!m_mail_handler.IsEmpty()) { DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); } @@ -37,19 +37,19 @@ u32 CARDUCode::GetUpdateMs() return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5; } -void CARDUCode::HandleMail(u32 _uMail) +void CARDUCode::HandleMail(u32 mail) { - if (_uMail == 0xFF000000) // unlock card + if (mail == 0xFF000000) // unlock card { // m_Mails.push(0x00000001); // ACK (actually anything != 0) } else { - DEBUG_LOG(DSPHLE, "CARDUCode - unknown command: %x", _uMail); + DEBUG_LOG(DSPHLE, "CARDUCode - unknown command: %x", mail); } - m_rMailHandler.PushMail(DSP_DONE); - m_DSPHLE->SetUCode(UCODE_ROM); + m_mail_handler.PushMail(DSP_DONE); + m_dsphle->SetUCode(UCODE_ROM); } diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/CARD.h b/Source/Core/Core/HW/DSPHLE/UCodes/CARD.h index 352c4a65ab..5e8e4df5dd 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/CARD.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/CARD.h @@ -9,11 +9,11 @@ class CARDUCode : public UCodeInterface { public: - CARDUCode(DSPHLE *dsp_hle, u32 crc); + CARDUCode(DSPHLE *dsphle, u32 crc); virtual ~CARDUCode(); u32 GetUpdateMs() override; - void HandleMail(u32 _uMail) override; + void HandleMail(u32 mail) override; void Update(int cycles) override; }; diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/GBA.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/GBA.cpp index 335993932e..23c99c1eb4 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/GBA.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/GBA.cpp @@ -7,21 +7,21 @@ #include "Core/HW/DSPHLE/UCodes/GBA.h" #include "Core/HW/DSPHLE/UCodes/UCodes.h" -GBAUCode::GBAUCode(DSPHLE *dsp_hle, u32 crc) -: UCodeInterface(dsp_hle, crc) +GBAUCode::GBAUCode(DSPHLE *dsphle, u32 crc) +: UCodeInterface(dsphle, crc) { - m_rMailHandler.PushMail(DSP_INIT); + m_mail_handler.PushMail(DSP_INIT); } GBAUCode::~GBAUCode() { - m_rMailHandler.Clear(); + m_mail_handler.Clear(); } void GBAUCode::Update(int cycles) { // check if we have to send something - if (!m_rMailHandler.IsEmpty()) + if (!m_mail_handler.IsEmpty()) { DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); } @@ -32,23 +32,23 @@ u32 GBAUCode::GetUpdateMs() return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5; } -void GBAUCode::HandleMail(u32 _uMail) +void GBAUCode::HandleMail(u32 mail) { static bool nextmail_is_mramaddr = false; static bool calc_done = false; - if (m_UploadSetupInProgress) + if (m_upload_setup_in_progress) { - PrepareBootUCode(_uMail); + PrepareBootUCode(mail); } - else if ((_uMail >> 16 == 0xabba) && !nextmail_is_mramaddr) + else if ((mail >> 16 == 0xabba) && !nextmail_is_mramaddr) { nextmail_is_mramaddr = true; } else if (nextmail_is_mramaddr) { nextmail_is_mramaddr = false; - u32 mramaddr = _uMail; + u32 mramaddr = mail; struct sec_params_t { @@ -123,25 +123,25 @@ void GBAUCode::HandleMail(u32 _uMail) x22, x23); calc_done = true; - m_rMailHandler.PushMail(DSP_DONE); + m_mail_handler.PushMail(DSP_DONE); } - else if ((_uMail >> 16 == 0xcdd1) && calc_done) + else if ((mail >> 16 == 0xcdd1) && calc_done) { - switch (_uMail & 0xffff) + switch (mail & 0xffff) { case 1: - m_UploadSetupInProgress = true; + m_upload_setup_in_progress = true; break; case 2: - m_DSPHLE->SetUCode(UCODE_ROM); + m_dsphle->SetUCode(UCODE_ROM); break; default: - DEBUG_LOG(DSPHLE, "GBAUCode - unknown 0xcdd1 command: %08x", _uMail); + DEBUG_LOG(DSPHLE, "GBAUCode - unknown 0xcdd1 command: %08x", mail); break; } } else { - DEBUG_LOG(DSPHLE, "GBAUCode - unknown command: %08x", _uMail); + DEBUG_LOG(DSPHLE, "GBAUCode - unknown command: %08x", mail); } } diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/GBA.h b/Source/Core/Core/HW/DSPHLE/UCodes/GBA.h index c4b7985d13..77964da9b4 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/GBA.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/GBA.h @@ -8,10 +8,10 @@ struct GBAUCode : public UCodeInterface { - GBAUCode(DSPHLE *dsp_hle, u32 crc); + GBAUCode(DSPHLE *dsphle, u32 crc); virtual ~GBAUCode(); u32 GetUpdateMs() override; - void HandleMail(u32 _uMail) override; + void HandleMail(u32 mail) override; void Update(int cycles) override; }; diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/INIT.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/INIT.cpp index d0d480057f..d2eb7a3296 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/INIT.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/INIT.cpp @@ -6,8 +6,8 @@ #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) +INITUCode::INITUCode(DSPHLE *dsphle, u32 crc) + : UCodeInterface(dsphle, crc) { DEBUG_LOG(DSPHLE, "INITUCode - initialized"); } @@ -25,9 +25,9 @@ void INITUCode::Init() void INITUCode::Update(int cycles) { - if (m_rMailHandler.IsEmpty()) + if (m_mail_handler.IsEmpty()) { - m_rMailHandler.PushMail(0x80544348); + m_mail_handler.PushMail(0x80544348); // HALT } } @@ -37,7 +37,7 @@ u32 INITUCode::GetUpdateMs() return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 3 : 5; } -void INITUCode::HandleMail(u32 _uMail) +void INITUCode::HandleMail(u32 mail) { } diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/INIT.h b/Source/Core/Core/HW/DSPHLE/UCodes/INIT.h index 280ec1821a..c70b99f778 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/INIT.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/INIT.h @@ -9,11 +9,11 @@ class INITUCode : public UCodeInterface { public: - INITUCode(DSPHLE *dsp_hle, u32 crc); + INITUCode(DSPHLE *dsphle, u32 crc); virtual ~INITUCode(); u32 GetUpdateMs() override; - void HandleMail(u32 _uMail) override; + void HandleMail(u32 mail) override; void Update(int cycles) override; void Init(); }; diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/ROM.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/ROM.cpp index 5f42aedc5c..0c10d0c1d1 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/ROM.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/ROM.cpp @@ -7,21 +7,22 @@ #endif #include "Common/Hash.h" +#include "Common/StringUtil.h" #include "Core/ConfigManager.h" #include "Core/HW/Memmap.h" #include "Core/HW/DSPHLE/UCodes/ROM.h" #include "Core/HW/DSPHLE/UCodes/UCodes.h" -ROMUCode::ROMUCode(DSPHLE *dsp_hle, u32 crc) - : UCodeInterface(dsp_hle, crc) - , m_CurrentUCode() - , m_BootTask_numSteps(0) - , m_NextParameter(0) +ROMUCode::ROMUCode(DSPHLE *dsphle, u32 crc) + : UCodeInterface(dsphle, crc) + , m_current_ucode() + , m_boot_task_num_steps(0) + , m_next_parameter(0) { DEBUG_LOG(DSPHLE, "UCode_Rom - initialized"); - m_rMailHandler.Clear(); - m_rMailHandler.PushMail(0x8071FEED); + m_mail_handler.Clear(); + m_mail_handler.PushMail(0x8071FEED); } ROMUCode::~ROMUCode() @@ -30,46 +31,46 @@ ROMUCode::~ROMUCode() void ROMUCode::Update(int cycles) {} -void ROMUCode::HandleMail(u32 _uMail) +void ROMUCode::HandleMail(u32 mail) { - if (m_NextParameter == 0) + if (m_next_parameter == 0) { // wait for beginning of UCode - if ((_uMail & 0xFFFF0000) != 0x80F30000) + if ((mail & 0xFFFF0000) != 0x80F30000) { - u32 Message = 0xFEEE0000 | (_uMail & 0xFFFF); - m_rMailHandler.PushMail(Message); + u32 Message = 0xFEEE0000 | (mail & 0xFFFF); + m_mail_handler.PushMail(Message); } else { - m_NextParameter = _uMail; + m_next_parameter = mail; } } else { - switch (m_NextParameter) + switch (m_next_parameter) { case 0x80F3A001: - m_CurrentUCode.m_RAMAddress = _uMail; + m_current_ucode.m_ram_address = mail; break; case 0x80F3A002: - m_CurrentUCode.m_Length = _uMail & 0xffff; + m_current_ucode.m_length = mail & 0xffff; break; case 0x80F3B002: - m_CurrentUCode.m_DMEMLength = _uMail & 0xffff; - if (m_CurrentUCode.m_DMEMLength) { - NOTICE_LOG(DSPHLE,"m_CurrentUCode.m_DMEMLength = 0x%04x.", m_CurrentUCode.m_DMEMLength); + m_current_ucode.m_dmem_length = mail & 0xffff; + if (m_current_ucode.m_dmem_length) { + NOTICE_LOG(DSPHLE,"m_current_ucode.m_dmem_length = 0x%04x.", m_current_ucode.m_dmem_length); } break; case 0x80F3C002: - m_CurrentUCode.m_IMEMAddress = _uMail & 0xffff; + m_current_ucode.m_imem_address = mail & 0xffff; break; case 0x80F3D001: - m_CurrentUCode.m_StartPC = _uMail & 0xffff; + m_current_ucode.m_start_pc = mail & 0xffff; BootUCode(); return; // Important! BootUCode indirectly does "delete this;". Must exit immediately. @@ -78,33 +79,37 @@ void ROMUCode::HandleMail(u32 _uMail) } // THE GODDAMN OVERWRITE WAS HERE. Without the return above, since BootUCode may delete "this", well ... - m_NextParameter = 0; + m_next_parameter = 0; } } void ROMUCode::BootUCode() { u32 ector_crc = HashEctor( - (u8*)HLEMemory_Get_Pointer(m_CurrentUCode.m_RAMAddress), - m_CurrentUCode.m_Length); + (u8*)HLEMemory_Get_Pointer(m_current_ucode.m_ram_address), + m_current_ucode.m_length); #if defined(_DEBUG) || defined(DEBUGFAST) - char binFile[MAX_PATH]; - sprintf(binFile, "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); + std::string ucode_dump_path = StringFromFormat( + "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); - File::IOFile pFile(binFile, "wb"); - pFile.WriteArray((u8*)Memory::GetPointer(m_CurrentUCode.m_RAMAddress), m_CurrentUCode.m_Length); + File::IOFile fp(ucode_dump_path, "wb"); + if (fp) + { + fp.WriteArray((u8*)HLEMemory_Get_Pointer(m_current_ucode.m_ram_address), + m_current_ucode.m_length); + } #endif - DEBUG_LOG(DSPHLE, "CurrentUCode SOURCE Addr: 0x%08x", m_CurrentUCode.m_RAMAddress); - DEBUG_LOG(DSPHLE, "CurrentUCode Length: 0x%08x", m_CurrentUCode.m_Length); - DEBUG_LOG(DSPHLE, "CurrentUCode DEST Addr: 0x%08x", m_CurrentUCode.m_IMEMAddress); - DEBUG_LOG(DSPHLE, "CurrentUCode DMEM Length: 0x%08x", m_CurrentUCode.m_DMEMLength); - DEBUG_LOG(DSPHLE, "CurrentUCode init_vector: 0x%08x", m_CurrentUCode.m_StartPC); + DEBUG_LOG(DSPHLE, "CurrentUCode SOURCE Addr: 0x%08x", m_current_ucode.m_ram_address); + DEBUG_LOG(DSPHLE, "CurrentUCode Length: 0x%08x", m_current_ucode.m_length); + DEBUG_LOG(DSPHLE, "CurrentUCode DEST Addr: 0x%08x", m_current_ucode.m_imem_address); + DEBUG_LOG(DSPHLE, "CurrentUCode DMEM Length: 0x%08x", m_current_ucode.m_dmem_length); + DEBUG_LOG(DSPHLE, "CurrentUCode init_vector: 0x%08x", m_current_ucode.m_start_pc); DEBUG_LOG(DSPHLE, "CurrentUCode CRC: 0x%08x", ector_crc); DEBUG_LOG(DSPHLE, "BootTask - done"); - m_DSPHLE->SetUCode(ector_crc); + m_dsphle->SetUCode(ector_crc); } u32 ROMUCode::GetUpdateMs() @@ -114,9 +119,9 @@ u32 ROMUCode::GetUpdateMs() void ROMUCode::DoState(PointerWrap &p) { - p.Do(m_CurrentUCode); - p.Do(m_BootTask_numSteps); - p.Do(m_NextParameter); + p.Do(m_current_ucode); + p.Do(m_boot_task_num_steps); + p.Do(m_next_parameter); DoStateShared(p); } diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/ROM.h b/Source/Core/Core/HW/DSPHLE/UCodes/ROM.h index 92f7ddb7bd..749369ea21 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/ROM.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/ROM.h @@ -9,28 +9,28 @@ class ROMUCode : public UCodeInterface { public: - ROMUCode(DSPHLE *dsp_hle, u32 _crc); + ROMUCode(DSPHLE *dsphle, u32 crc); virtual ~ROMUCode(); u32 GetUpdateMs() override; - void HandleMail(u32 _uMail) override; + void HandleMail(u32 mail) override; void Update(int cycles) override; void DoState(PointerWrap &p) override; private: - struct SUCode + struct UCodeBootInfo { - u32 m_RAMAddress; - u32 m_Length; - u32 m_IMEMAddress; - u32 m_DMEMLength; - u32 m_StartPC; + u32 m_ram_address; + u32 m_length; + u32 m_imem_address; + u32 m_dmem_length; + u32 m_start_pc; }; - SUCode m_CurrentUCode; - int m_BootTask_numSteps; + UCodeBootInfo m_current_ucode; + int m_boot_task_num_steps; - u32 m_NextParameter; + u32 m_next_parameter; void BootUCode(); }; diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp index 99e368ca8a..8b73d14d98 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp @@ -7,6 +7,7 @@ #endif #include "Common/Hash.h" +#include "Common/StringUtil.h" #include "Core/HW/DSPHLE/UCodes/AX.h" #include "Core/HW/DSPHLE/UCodes/AXWii.h" @@ -17,25 +18,25 @@ #include "Core/HW/DSPHLE/UCodes/UCodes.h" #include "Core/HW/DSPHLE/UCodes/Zelda.h" -UCodeInterface* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii) +UCodeInterface* UCodeFactory(u32 crc, DSPHLE *dsphle, bool wii) { - switch (_CRC) + switch (crc) { case UCODE_ROM: INFO_LOG(DSPHLE, "Switching to ROM ucode"); - return new ROMUCode(dsp_hle, _CRC); + return new ROMUCode(dsphle, crc); case UCODE_INIT_AUDIO_SYSTEM: INFO_LOG(DSPHLE, "Switching to INIT ucode"); - return new INITUCode(dsp_hle, _CRC); + return new INITUCode(dsphle, crc); case 0x65d6cc6f: // CARD INFO_LOG(DSPHLE, "Switching to CARD ucode"); - return new CARDUCode(dsp_hle, _CRC); + return new CARDUCode(dsphle, crc); case 0xdd7e72d5: INFO_LOG(DSPHLE, "Switching to GBA ucode"); - return new GBAUCode(dsp_hle, _CRC); + return new GBAUCode(dsphle, crc); case 0x3ad3b7ac: // Naruto3, Paper Mario - The Thousand Year Door case 0x3daf59b9: // Alien Hominid @@ -47,31 +48,31 @@ UCodeInterface* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii) // Zelda:OOT, Tony hawk, viewtiful joe 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 AXUCode(dsp_hle, _CRC); + INFO_LOG(DSPHLE, "CRC %08x: AX ucode chosen", crc); + return new AXUCode(dsphle, 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 ZeldaUCode(dsp_hle, _CRC); + INFO_LOG(DSPHLE, "CRC %08x: JAC (early Zelda) ucode chosen", crc); + return new ZeldaUCode(dsphle, crc); case 0x6CA33A6D: // DK Jungle Beat case 0x86840740: // Zelda WW - US case 0x56d36052: // Mario Sunshine case 0x2fcdf1ec: // Mario Kart, zelda 4 swords case 0x267fd05a: // Pikmin PAL - INFO_LOG(DSPHLE, "CRC %08x: Zelda ucode chosen", _CRC); - return new ZeldaUCode(dsp_hle, _CRC); + INFO_LOG(DSPHLE, "CRC %08x: Zelda ucode chosen", crc); + return new ZeldaUCode(dsphle, crc); // WII CRCs case 0xb7eb9a9c: // Wii Pikmin - PAL case 0xeaeb38cc: // Wii Pikmin 2 - PAL 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 ZeldaUCode(dsp_hle, _CRC); + INFO_LOG(DSPHLE, "CRC %08x: Zelda Wii ucode chosen\n", crc); + return new ZeldaUCode(dsphle, crc); case 0x2ea36ce6: // Some Wii demos case 0x5ef56da3: // AX demo @@ -80,19 +81,19 @@ UCodeInterface* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii) case 0xadbc06bd: // Elebits case 0x4cc52064: // Bleach: Versus Crusade case 0xd9c4bf34: // WiiMenu - INFO_LOG(DSPHLE, "CRC %08x: Wii - AXWii chosen", _CRC); - return new AXWiiUCode(dsp_hle, _CRC); + INFO_LOG(DSPHLE, "CRC %08x: Wii - AXWii chosen", crc); + return new AXWiiUCode(dsphle, crc); default: - if (bWii) + if (wii) { - PanicAlert("DSPHLE: Unknown ucode (CRC = %08x) - forcing AXWii.\n\nTry LLE emulator if this is homebrew.", _CRC); - return new AXWiiUCode(dsp_hle, _CRC); + PanicAlert("DSPHLE: Unknown ucode (CRC = %08x) - forcing AXWii.\n\nTry LLE emulator if this is homebrew.", crc); + return new AXWiiUCode(dsphle, crc); } else { - PanicAlert("DSPHLE: Unknown ucode (CRC = %08x) - forcing AX.\n\nTry LLE emulator if this is homebrew.", _CRC); - return new AXUCode(dsp_hle, _CRC); + PanicAlert("DSPHLE: Unknown ucode (CRC = %08x) - forcing AX.\n\nTry LLE emulator if this is homebrew.", crc); + return new AXUCode(dsphle, crc); } case UCODE_NULL: @@ -104,9 +105,9 @@ UCodeInterface* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii) bool UCodeInterface::NeedsResumeMail() { - if (m_NeedsResumeMail) + if (m_needs_resume_mail) { - m_NeedsResumeMail = false; + m_needs_resume_mail = false; return true; } return false; @@ -114,70 +115,73 @@ bool UCodeInterface::NeedsResumeMail() void UCodeInterface::PrepareBootUCode(u32 mail) { - switch (m_NextUCode_steps) + switch (m_next_ucode_steps) { - case 0: m_NextUCode.mram_dest_addr = mail; break; - case 1: m_NextUCode.mram_size = mail & 0xffff; break; - case 2: m_NextUCode.mram_dram_addr = mail & 0xffff; break; - case 3: m_NextUCode.iram_mram_addr = mail; break; - case 4: m_NextUCode.iram_size = mail & 0xffff; break; - case 5: m_NextUCode.iram_dest = mail & 0xffff; break; - case 6: m_NextUCode.iram_startpc = mail & 0xffff; break; - case 7: m_NextUCode.dram_mram_addr = mail; break; - case 8: m_NextUCode.dram_size = mail & 0xffff; break; - case 9: m_NextUCode.dram_dest = mail & 0xffff; break; + case 0: m_next_ucode.mram_dest_addr = mail; break; + case 1: m_next_ucode.mram_size = mail & 0xffff; break; + case 2: m_next_ucode.mram_dram_addr = mail & 0xffff; break; + case 3: m_next_ucode.iram_mram_addr = mail; break; + case 4: m_next_ucode.iram_size = mail & 0xffff; break; + case 5: m_next_ucode.iram_dest = mail & 0xffff; break; + case 6: m_next_ucode.iram_startpc = mail & 0xffff; break; + case 7: m_next_ucode.dram_mram_addr = mail; break; + case 8: m_next_ucode.dram_size = mail & 0xffff; break; + case 9: m_next_ucode.dram_dest = mail & 0xffff; break; } - m_NextUCode_steps++; + m_next_ucode_steps++; - if (m_NextUCode_steps == 10) + if (m_next_ucode_steps == 10) { - m_NextUCode_steps = 0; - m_NeedsResumeMail = true; - m_UploadSetupInProgress = false; + m_next_ucode_steps = 0; + m_needs_resume_mail = true; + m_upload_setup_in_progress = false; u32 ector_crc = HashEctor( - (u8*)HLEMemory_Get_Pointer(m_NextUCode.iram_mram_addr), - m_NextUCode.iram_size); + (u8*)HLEMemory_Get_Pointer(m_next_ucode.iram_mram_addr), + m_next_ucode.iram_size); #if defined(_DEBUG) || defined(DEBUGFAST) - char binFile[MAX_PATH]; - sprintf(binFile, "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); + std::string ucode_dump_path = StringFromFormat( + "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); - File::IOFile pFile(binFile, "wb"); - if (pFile) - pFile.WriteArray((u8*)Memory::GetPointer(m_NextUCode.iram_mram_addr), m_NextUCode.iram_size); + File::IOFile fp(ucode_dump_path, "wb"); + if (fp) + { + fp.WriteArray((u8*)Memory::GetPointer(m_next_ucode.iram_mram_addr), + m_next_ucode.iram_size); + } #endif DEBUG_LOG(DSPHLE, "PrepareBootUCode 0x%08x", ector_crc); DEBUG_LOG(DSPHLE, "DRAM -> MRAM: src %04x dst %08x size %04x", - m_NextUCode.mram_dram_addr, m_NextUCode.mram_dest_addr, - m_NextUCode.mram_size); + m_next_ucode.mram_dram_addr, m_next_ucode.mram_dest_addr, + m_next_ucode.mram_size); DEBUG_LOG(DSPHLE, "MRAM -> IRAM: src %08x dst %04x size %04x startpc %04x", - m_NextUCode.iram_mram_addr, m_NextUCode.iram_dest, - m_NextUCode.iram_size, m_NextUCode.iram_startpc); + m_next_ucode.iram_mram_addr, m_next_ucode.iram_dest, + m_next_ucode.iram_size, m_next_ucode.iram_startpc); DEBUG_LOG(DSPHLE, "MRAM -> DRAM: src %08x dst %04x size %04x", - m_NextUCode.dram_mram_addr, m_NextUCode.dram_dest, - m_NextUCode.dram_size); + m_next_ucode.dram_mram_addr, m_next_ucode.dram_dest, + m_next_ucode.dram_size); - if (m_NextUCode.mram_size) + if (m_next_ucode.mram_size) { WARN_LOG(DSPHLE, "Trying to boot new ucode with dram download - not implemented"); } - if (m_NextUCode.dram_size) + if (m_next_ucode.dram_size) { WARN_LOG(DSPHLE, "Trying to boot new ucode with dram upload - not implemented"); } - m_DSPHLE->SwapUCode(ector_crc); + m_dsphle->SwapUCode(ector_crc); } } void UCodeInterface::DoStateShared(PointerWrap &p) { - p.Do(m_UploadSetupInProgress); - p.Do(m_NextUCode); - p.Do(m_NextUCode_steps); - p.Do(m_NeedsResumeMail); + p.Do(m_upload_setup_in_progress); + p.Do(m_next_ucode); + p.Do(m_next_ucode_steps); + p.Do(m_needs_resume_mail); } diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.h b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.h index 32b296fc26..ae007a61be 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.h @@ -17,63 +17,63 @@ class CMailHandler; -inline bool ExramRead(u32 _uAddress) +inline bool ExramRead(u32 address) { - if (_uAddress & 0x10000000) + if (address & 0x10000000) return true; else return false; } -inline u8 HLEMemory_Read_U8(u32 _uAddress) +inline u8 HLEMemory_Read_U8(u32 address) { - if (ExramRead(_uAddress)) - return Memory::m_pEXRAM[_uAddress & Memory::EXRAM_MASK]; + if (ExramRead(address)) + return Memory::m_pEXRAM[address & Memory::EXRAM_MASK]; else - return Memory::m_pRAM[_uAddress & Memory::RAM_MASK]; + return Memory::m_pRAM[address & Memory::RAM_MASK]; } -inline u16 HLEMemory_Read_U16(u32 _uAddress) +inline u16 HLEMemory_Read_U16(u32 address) { - if (ExramRead(_uAddress)) - return Common::swap16(*(u16*)&Memory::m_pEXRAM[_uAddress & Memory::EXRAM_MASK]); + if (ExramRead(address)) + return Common::swap16(*(u16*)&Memory::m_pEXRAM[address & Memory::EXRAM_MASK]); else - return Common::swap16(*(u16*)&Memory::m_pRAM[_uAddress & Memory::RAM_MASK]); + return Common::swap16(*(u16*)&Memory::m_pRAM[address & Memory::RAM_MASK]); } -inline u32 HLEMemory_Read_U32(u32 _uAddress) +inline u32 HLEMemory_Read_U32(u32 address) { - if (ExramRead(_uAddress)) - return Common::swap32(*(u32*)&Memory::m_pEXRAM[_uAddress & Memory::EXRAM_MASK]); + if (ExramRead(address)) + return Common::swap32(*(u32*)&Memory::m_pEXRAM[address & Memory::EXRAM_MASK]); else - return Common::swap32(*(u32*)&Memory::m_pRAM[_uAddress & Memory::RAM_MASK]); + return Common::swap32(*(u32*)&Memory::m_pRAM[address & Memory::RAM_MASK]); } -inline void* HLEMemory_Get_Pointer(u32 _uAddress) +inline void* HLEMemory_Get_Pointer(u32 address) { - if (ExramRead(_uAddress)) - return &Memory::m_pEXRAM[_uAddress & Memory::EXRAM_MASK]; + if (ExramRead(address)) + return &Memory::m_pEXRAM[address & Memory::EXRAM_MASK]; else - return &Memory::m_pRAM[_uAddress & Memory::RAM_MASK]; + return &Memory::m_pRAM[address & Memory::RAM_MASK]; } class UCodeInterface { public: - UCodeInterface(DSPHLE *dsphle, u32 _crc) - : m_rMailHandler(dsphle->AccessMailHandler()) - , m_UploadSetupInProgress(false) - , m_DSPHLE(dsphle) - , m_CRC(_crc) - , m_NextUCode() - , m_NextUCode_steps(0) - , m_NeedsResumeMail(false) + UCodeInterface(DSPHLE *dsphle, u32 crc) + : m_mail_handler(dsphle->AccessMailHandler()) + , m_upload_setup_in_progress(false) + , m_dsphle(dsphle) + , m_crc(crc) + , m_next_ucode() + , m_next_ucode_steps(0) + , m_needs_resume_mail(false) {} virtual ~UCodeInterface() {} - virtual void HandleMail(u32 _uMail) = 0; + virtual void HandleMail(u32 mail) = 0; // Cycles are out of the 81/121mhz the DSP runs at. virtual void Update(int cycles) = 0; @@ -81,7 +81,7 @@ public: virtual void DoState(PointerWrap &p) { DoStateShared(p); } - static u32 GetCRC(UCodeInterface* pUCode) { return pUCode ? pUCode->m_CRC : UCODE_NULL; } + static u32 GetCRC(UCodeInterface* ucode) { return ucode ? ucode->m_crc : UCODE_NULL; } protected: void PrepareBootUCode(u32 mail); @@ -93,7 +93,7 @@ protected: void DoStateShared(PointerWrap &p); - CMailHandler& m_rMailHandler; + CMailHandler& m_mail_handler; enum EDSP_Codes { @@ -107,17 +107,17 @@ protected: // UCode is forwarding mails to PrepareBootUCode // UCode only needs to set this to true, UCodeInterface will set to false when done! - bool m_UploadSetupInProgress; + bool m_upload_setup_in_progress; // Need a pointer back to DSPHLE to switch ucodes. - DSPHLE *m_DSPHLE; + DSPHLE *m_dsphle; // used for reconstruction when loading saves, // and for variations within certain ucodes. - u32 m_CRC; + u32 m_crc; private: - struct SUCode + struct NextUCodeInfo { u32 mram_dest_addr; u16 mram_size; @@ -130,10 +130,10 @@ private: u16 dram_size; u16 dram_dest; }; - SUCode m_NextUCode; - int m_NextUCode_steps; + NextUCodeInfo m_next_ucode; + int m_next_ucode_steps; - bool m_NeedsResumeMail; + bool m_needs_resume_mail; }; -extern UCodeInterface* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii); +extern UCodeInterface* UCodeFactory(u32 crc, DSPHLE *dsphle, bool wii); diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp index 6804eb9b92..cf068ffd57 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp @@ -13,9 +13,9 @@ #include "Core/HW/DSPHLE/UCodes/Zelda.h" -ZeldaUCode::ZeldaUCode(DSPHLE *dsp_hle, u32 _CRC) +ZeldaUCode::ZeldaUCode(DSPHLE *dsphle, u32 crc) : - UCodeInterface(dsp_hle, _CRC), + UCodeInterface(dsphle, crc), m_bSyncInProgress(false), m_MaxVoice(0), @@ -56,13 +56,13 @@ ZeldaUCode::ZeldaUCode(DSPHLE *dsp_hle, u32 _CRC) if (IsLightVersion()) { DEBUG_LOG(DSPHLE, "Luigi Stylee!"); - m_rMailHandler.PushMail(0x88881111); + m_mail_handler.PushMail(0x88881111); } else { - m_rMailHandler.PushMail(DSP_INIT); + m_mail_handler.PushMail(DSP_INIT); DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); - m_rMailHandler.PushMail(0xF3551111); // handshake + m_mail_handler.PushMail(0xF3551111); // handshake } m_VoiceBuffer = new s32[256 * 1024]; @@ -78,7 +78,7 @@ ZeldaUCode::ZeldaUCode(DSPHLE *dsp_hle, u32 _CRC) ZeldaUCode::~ZeldaUCode() { - m_rMailHandler.Clear(); + m_mail_handler.Clear(); delete [] m_VoiceBuffer; delete [] m_ResampleBuffer; @@ -98,31 +98,31 @@ void ZeldaUCode::Update(int cycles) { if (!IsLightVersion()) { - if (m_rMailHandler.GetNextMail() == DSP_FRAME_END) + if (m_mail_handler.GetNextMail() == DSP_FRAME_END) DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); } if (NeedsResumeMail()) { - m_rMailHandler.PushMail(DSP_RESUME); + m_mail_handler.PushMail(DSP_RESUME); DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); } } -void ZeldaUCode::HandleMail(u32 _uMail) +void ZeldaUCode::HandleMail(u32 mail) { if (IsLightVersion()) - HandleMail_LightVersion(_uMail); + HandleMail_LightVersion(mail); else if (IsSMSVersion()) - HandleMail_SMSVersion(_uMail); + HandleMail_SMSVersion(mail); else - HandleMail_NormalVersion(_uMail); + HandleMail_NormalVersion(mail); } -void ZeldaUCode::HandleMail_LightVersion(u32 _uMail) +void ZeldaUCode::HandleMail_LightVersion(u32 mail) { //ERROR_LOG(DSPHLE, "Light version mail %08X, list in progress: %s, step: %i/%i", - // _uMail, m_bListInProgress ? "yes":"no", m_step, m_numSteps); + // mail, m_bListInProgress ? "yes":"no", m_step, m_numSteps); if (m_bSyncCmdPending) { @@ -142,7 +142,7 @@ void ZeldaUCode::HandleMail_LightVersion(u32 _uMail) if (!m_bListInProgress) { - switch ((_uMail >> 24) & 0x7F) + switch ((mail >> 24) & 0x7F) { case 0x00: m_numSteps = 1; break; // dummy case 0x01: m_numSteps = 5; break; // DsetupTable @@ -151,7 +151,7 @@ void ZeldaUCode::HandleMail_LightVersion(u32 _uMail) default: { m_numSteps = 0; - PanicAlert("Zelda uCode (light version): unknown/unsupported command %02X", (_uMail >> 24) & 0x7F); + PanicAlert("Zelda uCode (light version): unknown/unsupported command %02X", (mail >> 24) & 0x7F); } return; } @@ -163,7 +163,7 @@ void ZeldaUCode::HandleMail_LightVersion(u32 _uMail) if (m_step >= sizeof(m_Buffer) / 4) PanicAlert("m_step out of range"); - ((u32*)m_Buffer)[m_step] = _uMail; + ((u32*)m_Buffer)[m_step] = mail; m_step++; if (m_step >= m_numSteps) @@ -173,14 +173,14 @@ void ZeldaUCode::HandleMail_LightVersion(u32 _uMail) } } -void ZeldaUCode::HandleMail_SMSVersion(u32 _uMail) +void ZeldaUCode::HandleMail_SMSVersion(u32 mail) { if (m_bSyncInProgress) { if (m_bSyncCmdPending) { - m_SyncFlags[(m_NumSyncMail << 1) ] = _uMail >> 16; - m_SyncFlags[(m_NumSyncMail << 1) + 1] = _uMail & 0xFFFF; + m_SyncFlags[(m_NumSyncMail << 1) ] = mail >> 16; + m_SyncFlags[(m_NumSyncMail << 1) + 1] = mail & 0xFFFF; m_NumSyncMail++; if (m_NumSyncMail == 2) @@ -192,13 +192,13 @@ void ZeldaUCode::HandleMail_SMSVersion(u32 _uMail) m_CurBuffer++; - m_rMailHandler.PushMail(DSP_SYNC); + m_mail_handler.PushMail(DSP_SYNC); DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); - m_rMailHandler.PushMail(0xF355FF00 | m_CurBuffer); + m_mail_handler.PushMail(0xF355FF00 | m_CurBuffer); if (m_CurBuffer == m_NumBuffers) { - m_rMailHandler.PushMail(DSP_FRAME_END); + m_mail_handler.PushMail(DSP_FRAME_END); // DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); m_bSyncCmdPending = false; @@ -218,7 +218,7 @@ void ZeldaUCode::HandleMail_SMSVersion(u32 _uMail) if (m_step >= sizeof(m_Buffer) / 4) PanicAlert("m_step out of range"); - ((u32*)m_Buffer)[m_step] = _uMail; + ((u32*)m_Buffer)[m_step] = mail; m_step++; if (m_step >= m_numSteps) @@ -232,23 +232,23 @@ void ZeldaUCode::HandleMail_SMSVersion(u32 _uMail) // Here holds: m_bSyncInProgress == false && m_bListInProgress == false - if (_uMail == 0) + if (mail == 0) { m_bSyncInProgress = true; m_NumSyncMail = 0; } - else if ((_uMail >> 16) == 0) + else if ((mail >> 16) == 0) { m_bListInProgress = true; - m_numSteps = _uMail; + m_numSteps = mail; m_step = 0; } - else if ((_uMail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_SYNCEND mail + else if ((mail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_SYNCEND mail { // The low part of the mail tells the operation to perform // Seeing as every possible operation number halts the uCode, // except 3, that thing seems to be intended for debugging - switch (_uMail & 0xFFFF) + switch (mail & 0xFFFF) { case 0x0003: // Do nothing return; @@ -256,27 +256,27 @@ void ZeldaUCode::HandleMail_SMSVersion(u32 _uMail) case 0x0000: // Halt case 0x0001: // Dump memory? and halt case 0x0002: // Do something and halt - WARN_LOG(DSPHLE, "Zelda uCode(SMS version): received halting operation %04X", _uMail & 0xFFFF); + WARN_LOG(DSPHLE, "Zelda uCode(SMS version): received halting operation %04X", mail & 0xFFFF); return; default: // Invalid (the real ucode would likely crash) - WARN_LOG(DSPHLE, "Zelda uCode(SMS version): received invalid operation %04X", _uMail & 0xFFFF); + WARN_LOG(DSPHLE, "Zelda uCode(SMS version): received invalid operation %04X", mail & 0xFFFF); return; } } else { - WARN_LOG(DSPHLE, "Zelda uCode (SMS version): unknown mail %08X", _uMail); + WARN_LOG(DSPHLE, "Zelda uCode (SMS version): unknown mail %08X", mail); } } -void ZeldaUCode::HandleMail_NormalVersion(u32 _uMail) +void ZeldaUCode::HandleMail_NormalVersion(u32 mail) { - // WARN_LOG(DSPHLE, "Zelda uCode: Handle mail %08X", _uMail); + // WARN_LOG(DSPHLE, "Zelda uCode: Handle mail %08X", mail); - if (m_UploadSetupInProgress) // evaluated first! + if (m_upload_setup_in_progress) // evaluated first! { - PrepareBootUCode(_uMail); + PrepareBootUCode(mail); return; } @@ -284,9 +284,9 @@ void ZeldaUCode::HandleMail_NormalVersion(u32 _uMail) { if (m_bSyncCmdPending) { - u32 n = (_uMail >> 16) & 0xF; + u32 n = (mail >> 16) & 0xF; m_MaxVoice = (n + 1) << 4; - m_SyncFlags[n] = _uMail & 0xFFFF; + m_SyncFlags[n] = mail & 0xFFFF; m_bSyncInProgress = false; m_CurVoice = m_MaxVoice; @@ -297,16 +297,16 @@ void ZeldaUCode::HandleMail_NormalVersion(u32 _uMail) m_CurBuffer++; - m_rMailHandler.PushMail(DSP_SYNC); + m_mail_handler.PushMail(DSP_SYNC); DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); - m_rMailHandler.PushMail(0xF355FF00 | m_CurBuffer); + m_mail_handler.PushMail(0xF355FF00 | m_CurBuffer); m_CurVoice = 0; if (m_CurBuffer == m_NumBuffers) { if (!IsDMAVersion()) // this is a hack... without it Pikmin 1 Wii/ Zelda TP Wii mail-s stopped - m_rMailHandler.PushMail(DSP_FRAME_END); + m_mail_handler.PushMail(DSP_FRAME_END); //g_dspInitialize.pGenerateDSPInterrupt(); m_bSyncCmdPending = false; @@ -326,7 +326,7 @@ void ZeldaUCode::HandleMail_NormalVersion(u32 _uMail) if (m_step >= sizeof(m_Buffer) / 4) PanicAlert("m_step out of range"); - ((u32*)m_Buffer)[m_step] = _uMail; + ((u32*)m_Buffer)[m_step] = mail; m_step++; if (m_step >= m_numSteps) @@ -345,47 +345,47 @@ void ZeldaUCode::HandleMail_NormalVersion(u32 _uMail) // - 00000000, 000X0000 - Sync mails // - CDD1XXXX - comes after DsyncFrame completed, seems to be debugging stuff - if (_uMail == 0) + if (mail == 0) { m_bSyncInProgress = true; } - else if ((_uMail >> 16) == 0) + else if ((mail >> 16) == 0) { m_bListInProgress = true; - m_numSteps = _uMail; + m_numSteps = mail; m_step = 0; } - else if ((_uMail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_FRAME_END mail + else if ((mail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_FRAME_END mail { // The low part of the mail tells the operation to perform // Seeing as every possible operation number halts the uCode, // except 3, that thing seems to be intended for debugging - switch (_uMail & 0xFFFF) + switch (mail & 0xFFFF) { case 0x0003: // Do nothing - continue normally return; case 0x0001: // accepts params to either dma to iram and/or dram (used for hotbooting a new ucode) // TODO find a better way to protect from HLEMixer? - m_UploadSetupInProgress = true; + m_upload_setup_in_progress = true; return; case 0x0002: // Let IROM play us off - m_DSPHLE->SetUCode(UCODE_ROM); + m_dsphle->SetUCode(UCODE_ROM); return; case 0x0000: // Halt - WARN_LOG(DSPHLE, "Zelda uCode: received halting operation %04X", _uMail & 0xFFFF); + WARN_LOG(DSPHLE, "Zelda uCode: received halting operation %04X", mail & 0xFFFF); return; default: // Invalid (the real ucode would likely crash) - WARN_LOG(DSPHLE, "Zelda uCode: received invalid operation %04X", _uMail & 0xFFFF); + WARN_LOG(DSPHLE, "Zelda uCode: received invalid operation %04X", mail & 0xFFFF); return; } } else { - WARN_LOG(DSPHLE, "Zelda uCode: unknown mail %08X", _uMail); + WARN_LOG(DSPHLE, "Zelda uCode: unknown mail %08X", mail); } } @@ -514,15 +514,15 @@ void ZeldaUCode::ExecuteList() if (IsLightVersion()) { if (m_bSyncCmdPending) - m_rMailHandler.PushMail(0x80000000 | m_NumBuffers); // after CMD_2 + m_mail_handler.PushMail(0x80000000 | m_NumBuffers); // after CMD_2 else - m_rMailHandler.PushMail(0x80000000 | Sync); // after CMD_0, CMD_1 + m_mail_handler.PushMail(0x80000000 | Sync); // after CMD_0, CMD_1 } else { - m_rMailHandler.PushMail(DSP_SYNC); + m_mail_handler.PushMail(DSP_SYNC); DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); - m_rMailHandler.PushMail(0xF3550000 | Sync); + m_mail_handler.PushMail(0xF3550000 | Sync); } } diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.h b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.h index 2571ab9c3c..7cb536606b 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.h @@ -117,14 +117,14 @@ union ZeldaUnkPB class ZeldaUCode : public UCodeInterface { public: - ZeldaUCode(DSPHLE *dsp_hle, u32 _CRC); + ZeldaUCode(DSPHLE *dsphle, u32 crc); virtual ~ZeldaUCode(); u32 GetUpdateMs() override; - void HandleMail(u32 _uMail) override; - void HandleMail_LightVersion(u32 _uMail); - void HandleMail_SMSVersion(u32 _uMail); - void HandleMail_NormalVersion(u32 _uMail); + void HandleMail(u32 mail) override; + void HandleMail_LightVersion(u32 mail); + void HandleMail_SMSVersion(u32 mail); + void HandleMail_NormalVersion(u32 mail); void Update(int cycles) override; void CopyPBsFromRAM(); @@ -152,7 +152,7 @@ private: // - sound data transferred using DMA instead of accelerator bool IsDMAVersion() const { - switch (m_CRC) + switch (m_crc) { case 0xb7eb9a9c: // Wii Pikmin - PAL case 0xeaeb38cc: // Wii Pikmin 2 - PAL @@ -169,7 +169,7 @@ private: // - exceptions and interrupts not used bool IsLightVersion() const { - switch (m_CRC) + switch (m_crc) { case 0x6ba3b3ea: // IPL - PAL case 0x24b22038: // IPL - NTSC/NTSC-JAP @@ -187,7 +187,7 @@ private: // and I couldn't find a better name) bool IsSMSVersion() const { - switch (m_CRC) + switch (m_crc) { case 0x56d36052: // Super Mario Sunshine case 0x267fd05a: // Pikmin PAL