From a92727e8623af9d5ee3959729cba677dad514ea9 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Tue, 1 Apr 2014 21:55:19 +0200 Subject: [PATCH] DSPHLE: Add a config parameter to dump UCode to disk --- Source/Core/Core/ConfigManager.cpp | 2 ++ Source/Core/Core/ConfigManager.h | 1 + Source/Core/Core/HW/DSPHLE/UCodes/ROM.cpp | 19 ++++++++++--------- Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp | 20 +++++++++++--------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 3f1ba69e06..68aaada219 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -284,6 +284,7 @@ void SConfig::SaveDSPSettings(IniFile& ini) dsp->Set("EnableJIT", m_DSPEnableJIT); dsp->Set("DumpAudio", m_DumpAudio); + dsp->Set("DumpUCode", m_DumpUCode); dsp->Set("Backend", sBackend); dsp->Set("Volume", m_Volume); dsp->Set("CaptureLog", m_DSPCaptureLog); @@ -543,6 +544,7 @@ void SConfig::LoadDSPSettings(IniFile& ini) dsp->Get("EnableJIT", &m_DSPEnableJIT, true); dsp->Get("DumpAudio", &m_DumpAudio, false); + dsp->Get("DumpUCode", &m_DumpUCode, false); #if defined __linux__ && HAVE_ALSA dsp->Get("Backend", &sBackend, BACKEND_ALSA); #elif defined __APPLE__ diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index b37b742e5e..caeec25152 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -255,6 +255,7 @@ struct SConfig : NonCopyable bool m_DSPCaptureLog; bool m_DumpAudio; bool m_IsMuted; + bool m_DumpUCode; int m_Volume; std::string sBackend; diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/ROM.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/ROM.cpp index 6492fd2d1d..0d54b6efa0 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/ROM.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/ROM.cpp @@ -92,17 +92,18 @@ void ROMUCode::BootUCode() (u8*)HLEMemory_Get_Pointer(m_current_ucode.m_ram_address), m_current_ucode.m_length); -#if defined(_DEBUG) || defined(DEBUGFAST) - std::string ucode_dump_path = StringFromFormat( - "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); - - File::IOFile fp(ucode_dump_path, "wb"); - if (fp) + if (SConfig::GetInstance().m_DumpUCode) { - fp.WriteArray((u8*)HLEMemory_Get_Pointer(m_current_ucode.m_ram_address), - m_current_ucode.m_length); + std::string ucode_dump_path = StringFromFormat( + "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); + + 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_current_ucode.m_ram_address); DEBUG_LOG(DSPHLE, "CurrentUCode Length: 0x%08x", m_current_ucode.m_length); diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp index f3c17a69e2..24e3732b61 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp @@ -9,6 +9,7 @@ #include "Common/Hash.h" #include "Common/StringUtil.h" +#include "Core/ConfigManager.h" #include "Core/HW/DSPHLE/UCodes/AX.h" #include "Core/HW/DSPHLE/UCodes/AXWii.h" #include "Core/HW/DSPHLE/UCodes/CARD.h" @@ -142,17 +143,18 @@ void UCodeInterface::PrepareBootUCode(u32 mail) (u8*)HLEMemory_Get_Pointer(m_next_ucode.iram_mram_addr), m_next_ucode.iram_size); -#if defined(_DEBUG) || defined(DEBUGFAST) - std::string ucode_dump_path = StringFromFormat( - "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); - - File::IOFile fp(ucode_dump_path, "wb"); - if (fp) + if (SConfig::GetInstance().m_DumpUCode) { - fp.WriteArray((u8*)Memory::GetPointer(m_next_ucode.iram_mram_addr), - m_next_ucode.iram_size); + std::string ucode_dump_path = StringFromFormat( + "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); + + 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",