DSP-HLE: use DumpDSPCode to de-duplicate logic (and gain disassembly)

This change centralizes all of the path handling and file writing logic
in DumpDSPCode. DSP-HLE also gains the feature of DSP-LLE to
automatically disassemble dumped code and write it to an accompanying
text file.
This commit is contained in:
Michael Maltese 2017-05-14 20:33:42 -07:00
parent f985e0faac
commit c67bae5491
2 changed files with 6 additions and 17 deletions

View File

@ -17,6 +17,7 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/DSP/DSPCodeUtil.h"
#include "Core/HW/DSPHLE/DSPHLE.h" #include "Core/HW/DSPHLE/DSPHLE.h"
#include "Core/HW/DSPHLE/MailHandler.h" #include "Core/HW/DSPHLE/MailHandler.h"
#include "Core/HW/DSPHLE/UCodes/UCodes.h" #include "Core/HW/DSPHLE/UCodes/UCodes.h"
@ -107,15 +108,8 @@ void ROMUCode::BootUCode()
if (SConfig::GetInstance().m_DumpUCode) if (SConfig::GetInstance().m_DumpUCode)
{ {
std::string ucode_dump_path = DSP::DumpDSPCode(static_cast<u8*>(HLEMemory_Get_Pointer(m_current_ucode.m_ram_address)),
StringFromFormat("%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); m_current_ucode.m_length, 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);
}
} }
INFO_LOG(DSPHLE, "CurrentUCode SOURCE Addr: 0x%08x", m_current_ucode.m_ram_address); INFO_LOG(DSPHLE, "CurrentUCode SOURCE Addr: 0x%08x", m_current_ucode.m_ram_address);

View File

@ -19,6 +19,7 @@
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/Swap.h" #include "Common/Swap.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/DSP/DSPCodeUtil.h"
#include "Core/HW/DSPHLE/DSPHLE.h" #include "Core/HW/DSPHLE/DSPHLE.h"
#include "Core/HW/DSPHLE/UCodes/AX.h" #include "Core/HW/DSPHLE/UCodes/AX.h"
#include "Core/HW/DSPHLE/UCodes/AXWii.h" #include "Core/HW/DSPHLE/UCodes/AXWii.h"
@ -187,14 +188,8 @@ void UCodeInterface::PrepareBootUCode(u32 mail)
if (SConfig::GetInstance().m_DumpUCode) if (SConfig::GetInstance().m_DumpUCode)
{ {
std::string ucode_dump_path = StringFromFormat( DSP::DumpDSPCode(static_cast<u8*>(Memory::GetPointer(m_next_ucode.iram_mram_addr)),
"%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); m_next_ucode.iram_size, 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);
}
} }
DEBUG_LOG(DSPHLE, "PrepareBootUCode 0x%08x", ector_crc); DEBUG_LOG(DSPHLE, "PrepareBootUCode 0x%08x", ector_crc);