DSPHLE: Cleanup UCodes.{cpp,h}
This commit is contained in:
parent
17d64a1d50
commit
d3abe3824f
|
@ -18,7 +18,7 @@ AXUCode::AXUCode(DSPHLE* dsp_hle, u32 crc)
|
|||
, 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)
|
||||
|
|
|
@ -13,20 +13,20 @@ CARDUCode::CARDUCode(DSPHLE *dsp_hle, u32 crc)
|
|||
: UCodeInterface(dsp_hle, 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);
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ void CARDUCode::HandleMail(u32 _uMail)
|
|||
DEBUG_LOG(DSPHLE, "CARDUCode - unknown command: %x", _uMail);
|
||||
}
|
||||
|
||||
m_rMailHandler.PushMail(DSP_DONE);
|
||||
m_DSPHLE->SetUCode(UCODE_ROM);
|
||||
m_mail_handler.PushMail(DSP_DONE);
|
||||
m_dsphle->SetUCode(UCODE_ROM);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,18 +10,18 @@
|
|||
GBAUCode::GBAUCode(DSPHLE *dsp_hle, u32 crc)
|
||||
: UCodeInterface(dsp_hle, 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);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ void GBAUCode::HandleMail(u32 _uMail)
|
|||
static bool nextmail_is_mramaddr = false;
|
||||
static bool calc_done = false;
|
||||
|
||||
if (m_UploadSetupInProgress)
|
||||
if (m_upload_setup_in_progress)
|
||||
{
|
||||
PrepareBootUCode(_uMail);
|
||||
}
|
||||
|
@ -123,17 +123,17 @@ 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)
|
||||
{
|
||||
switch (_uMail & 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);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ ROMUCode::ROMUCode(DSPHLE *dsp_hle, u32 crc)
|
|||
, m_NextParameter(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()
|
||||
|
@ -38,7 +38,7 @@ void ROMUCode::HandleMail(u32 _uMail)
|
|||
if ((_uMail & 0xFFFF0000) != 0x80F30000)
|
||||
{
|
||||
u32 Message = 0xFEEE0000 | (_uMail & 0xFFFF);
|
||||
m_rMailHandler.PushMail(Message);
|
||||
m_mail_handler.PushMail(Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ void ROMUCode::BootUCode()
|
|||
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()
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,13 +98,13 @@ 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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -274,7 +274,7 @@ void ZeldaUCode::HandleMail_NormalVersion(u32 _uMail)
|
|||
{
|
||||
// WARN_LOG(DSPHLE, "Zelda uCode: Handle mail %08X", _uMail);
|
||||
|
||||
if (m_UploadSetupInProgress) // evaluated first!
|
||||
if (m_upload_setup_in_progress) // evaluated first!
|
||||
{
|
||||
PrepareBootUCode(_uMail);
|
||||
return;
|
||||
|
@ -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;
|
||||
|
@ -367,11 +367,11 @@ void ZeldaUCode::HandleMail_NormalVersion(u32 _uMail)
|
|||
|
||||
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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue