mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
DSPHLE: Amend variable casing
This commit is contained in:
parent
a57b378116
commit
0f70650e93
@ -23,16 +23,16 @@ DSPHLE::DSPHLE()
|
|||||||
bool DSPHLE::Initialize(bool wii, bool dsp_thread)
|
bool DSPHLE::Initialize(bool wii, bool dsp_thread)
|
||||||
{
|
{
|
||||||
m_wii = wii;
|
m_wii = wii;
|
||||||
m_pUCode = nullptr;
|
m_ucode = nullptr;
|
||||||
m_lastUCode = nullptr;
|
m_last_ucode = nullptr;
|
||||||
m_bHalt = false;
|
m_halt = false;
|
||||||
m_bAssertInt = false;
|
m_assert_interrupt = false;
|
||||||
|
|
||||||
SetUCode(UCODE_ROM);
|
SetUCode(UCODE_ROM);
|
||||||
m_DSPControl.DSPHalt = 1;
|
m_dsp_control.DSPHalt = 1;
|
||||||
m_DSPControl.DSPInit = 1;
|
m_dsp_control.DSPInit = 1;
|
||||||
|
|
||||||
m_dspState.Reset();
|
m_dsp_state.Reset();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -43,14 +43,14 @@ void DSPHLE::DSP_StopSoundStream()
|
|||||||
|
|
||||||
void DSPHLE::Shutdown()
|
void DSPHLE::Shutdown()
|
||||||
{
|
{
|
||||||
delete m_pUCode;
|
delete m_ucode;
|
||||||
m_pUCode = nullptr;
|
m_ucode = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPHLE::DSP_Update(int cycles)
|
void DSPHLE::DSP_Update(int cycles)
|
||||||
{
|
{
|
||||||
if (m_pUCode != nullptr)
|
if (m_ucode != nullptr)
|
||||||
m_pUCode->Update();
|
m_ucode->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 DSPHLE::DSP_UpdateRate()
|
u32 DSPHLE::DSP_UpdateRate()
|
||||||
@ -60,56 +60,56 @@ u32 DSPHLE::DSP_UpdateRate()
|
|||||||
return SystemTimers::GetTicksPerSecond() / 1000;
|
return SystemTimers::GetTicksPerSecond() / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPHLE::SendMailToDSP(u32 _uMail)
|
void DSPHLE::SendMailToDSP(u32 mail)
|
||||||
{
|
{
|
||||||
if (m_pUCode != nullptr)
|
if (m_ucode != nullptr)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", _uMail);
|
DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", mail);
|
||||||
m_pUCode->HandleMail(_uMail);
|
m_ucode->HandleMail(mail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UCodeInterface* DSPHLE::GetUCode()
|
UCodeInterface* DSPHLE::GetUCode()
|
||||||
{
|
{
|
||||||
return m_pUCode;
|
return m_ucode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPHLE::SetUCode(u32 _crc)
|
void DSPHLE::SetUCode(u32 crc)
|
||||||
{
|
{
|
||||||
delete m_pUCode;
|
delete m_ucode;
|
||||||
|
|
||||||
m_pUCode = nullptr;
|
m_ucode = nullptr;
|
||||||
m_MailHandler.Clear();
|
m_mail_handler.Clear();
|
||||||
m_pUCode = UCodeFactory(_crc, this, m_wii);
|
m_ucode = UCodeFactory(crc, this, m_wii);
|
||||||
m_pUCode->Initialize();
|
m_ucode->Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO do it better?
|
// TODO do it better?
|
||||||
// Assumes that every odd call to this func is by the persistent ucode.
|
// Assumes that every odd call to this func is by the persistent ucode.
|
||||||
// Even callers are deleted.
|
// Even callers are deleted.
|
||||||
void DSPHLE::SwapUCode(u32 _crc)
|
void DSPHLE::SwapUCode(u32 crc)
|
||||||
{
|
{
|
||||||
m_MailHandler.Clear();
|
m_mail_handler.Clear();
|
||||||
|
|
||||||
if (m_lastUCode == nullptr)
|
if (m_last_ucode == nullptr)
|
||||||
{
|
{
|
||||||
m_lastUCode = m_pUCode;
|
m_last_ucode = m_ucode;
|
||||||
m_pUCode = UCodeFactory(_crc, this, m_wii);
|
m_ucode = UCodeFactory(crc, this, m_wii);
|
||||||
m_pUCode->Initialize();
|
m_ucode->Initialize();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete m_pUCode;
|
delete m_ucode;
|
||||||
m_pUCode = m_lastUCode;
|
m_ucode = m_last_ucode;
|
||||||
m_lastUCode = nullptr;
|
m_last_ucode = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPHLE::DoState(PointerWrap& p)
|
void DSPHLE::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
bool isHLE = true;
|
bool is_hle = true;
|
||||||
p.Do(isHLE);
|
p.Do(is_hle);
|
||||||
if (isHLE != true && p.GetMode() == PointerWrap::MODE_READ)
|
if (!is_hle && p.GetMode() == PointerWrap::MODE_READ)
|
||||||
{
|
{
|
||||||
Core::DisplayMessage("State is incompatible with current DSP engine. Aborting load state.",
|
Core::DisplayMessage("State is incompatible with current DSP engine. Aborting load state.",
|
||||||
3000);
|
3000);
|
||||||
@ -117,33 +117,33 @@ void DSPHLE::DoState(PointerWrap& p)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.DoPOD(m_DSPControl);
|
p.DoPOD(m_dsp_control);
|
||||||
p.DoPOD(m_dspState);
|
p.DoPOD(m_dsp_state);
|
||||||
|
|
||||||
int ucode_crc = UCodeInterface::GetCRC(m_pUCode);
|
int ucode_crc = UCodeInterface::GetCRC(m_ucode);
|
||||||
int ucode_crc_beforeLoad = ucode_crc;
|
int ucode_crc_beforeLoad = ucode_crc;
|
||||||
int lastucode_crc = UCodeInterface::GetCRC(m_lastUCode);
|
int last_ucode_crc = UCodeInterface::GetCRC(m_last_ucode);
|
||||||
int lastucode_crc_beforeLoad = lastucode_crc;
|
int last_ucode_crc_before_load = last_ucode_crc;
|
||||||
|
|
||||||
p.Do(ucode_crc);
|
p.Do(ucode_crc);
|
||||||
p.Do(lastucode_crc);
|
p.Do(last_ucode_crc);
|
||||||
|
|
||||||
// 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.
|
||||||
UCodeInterface* ucode =
|
UCodeInterface* ucode =
|
||||||
(ucode_crc == ucode_crc_beforeLoad) ? m_pUCode : UCodeFactory(ucode_crc, this, m_wii);
|
(ucode_crc == ucode_crc_beforeLoad) ? m_ucode : UCodeFactory(ucode_crc, this, m_wii);
|
||||||
UCodeInterface* lastucode = (lastucode_crc != lastucode_crc_beforeLoad) ?
|
UCodeInterface* last_ucode = (last_ucode_crc != last_ucode_crc_before_load) ?
|
||||||
m_lastUCode :
|
m_last_ucode :
|
||||||
UCodeFactory(lastucode_crc, this, m_wii);
|
UCodeFactory(last_ucode_crc, this, m_wii);
|
||||||
|
|
||||||
if (ucode)
|
if (ucode)
|
||||||
ucode->DoState(p);
|
ucode->DoState(p);
|
||||||
if (lastucode)
|
if (last_ucode)
|
||||||
lastucode->DoState(p);
|
last_ucode->DoState(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,
|
||||||
// discard it if we're not loading, otherwise discard the old one and keep the new one.
|
// discard it if we're not loading, otherwise discard the old one and keep the new one.
|
||||||
if (ucode != m_pUCode)
|
if (ucode != m_ucode)
|
||||||
{
|
{
|
||||||
if (p.GetMode() != PointerWrap::MODE_READ)
|
if (p.GetMode() != PointerWrap::MODE_READ)
|
||||||
{
|
{
|
||||||
@ -151,32 +151,32 @@ void DSPHLE::DoState(PointerWrap& p)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete m_pUCode;
|
delete m_ucode;
|
||||||
m_pUCode = ucode;
|
m_ucode = ucode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lastucode != m_lastUCode)
|
if (last_ucode != m_last_ucode)
|
||||||
{
|
{
|
||||||
if (p.GetMode() != PointerWrap::MODE_READ)
|
if (p.GetMode() != PointerWrap::MODE_READ)
|
||||||
{
|
{
|
||||||
delete lastucode;
|
delete last_ucode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete m_lastUCode;
|
delete m_last_ucode;
|
||||||
m_lastUCode = lastucode;
|
m_last_ucode = last_ucode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_MailHandler.DoState(p);
|
m_mail_handler.DoState(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mailbox functions
|
// Mailbox functions
|
||||||
unsigned short DSPHLE::DSP_ReadMailBoxHigh(bool _CPUMailbox)
|
u16 DSPHLE::DSP_ReadMailBoxHigh(bool cpu_mailbox)
|
||||||
{
|
{
|
||||||
if (_CPUMailbox)
|
if (cpu_mailbox)
|
||||||
{
|
{
|
||||||
return (m_dspState.CPUMailbox >> 16) & 0xFFFF;
|
return (m_dsp_state.cpu_mailbox >> 16) & 0xFFFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -184,11 +184,11 @@ unsigned short DSPHLE::DSP_ReadMailBoxHigh(bool _CPUMailbox)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short DSPHLE::DSP_ReadMailBoxLow(bool _CPUMailbox)
|
u16 DSPHLE::DSP_ReadMailBoxLow(bool cpu_mailbox)
|
||||||
{
|
{
|
||||||
if (_CPUMailbox)
|
if (cpu_mailbox)
|
||||||
{
|
{
|
||||||
return m_dspState.CPUMailbox & 0xFFFF;
|
return m_dsp_state.cpu_mailbox & 0xFFFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -196,60 +196,60 @@ unsigned short DSPHLE::DSP_ReadMailBoxLow(bool _CPUMailbox)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPHLE::DSP_WriteMailBoxHigh(bool _CPUMailbox, unsigned short _Value)
|
void DSPHLE::DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value)
|
||||||
{
|
{
|
||||||
if (_CPUMailbox)
|
if (cpu_mailbox)
|
||||||
{
|
{
|
||||||
m_dspState.CPUMailbox = (m_dspState.CPUMailbox & 0xFFFF) | (_Value << 16);
|
m_dsp_state.cpu_mailbox = (m_dsp_state.cpu_mailbox & 0xFFFF) | (value << 16);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
|
PanicAlert("CPU can't write %08x to DSP mailbox", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPHLE::DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short _Value)
|
void DSPHLE::DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value)
|
||||||
{
|
{
|
||||||
if (_CPUMailbox)
|
if (cpu_mailbox)
|
||||||
{
|
{
|
||||||
m_dspState.CPUMailbox = (m_dspState.CPUMailbox & 0xFFFF0000) | _Value;
|
m_dsp_state.cpu_mailbox = (m_dsp_state.cpu_mailbox & 0xFFFF0000) | value;
|
||||||
SendMailToDSP(m_dspState.CPUMailbox);
|
SendMailToDSP(m_dsp_state.cpu_mailbox);
|
||||||
// Mail sent so clear MSB to show that it is progressed
|
// Mail sent so clear MSB to show that it is progressed
|
||||||
m_dspState.CPUMailbox &= 0x7FFFFFFF;
|
m_dsp_state.cpu_mailbox &= 0x7FFFFFFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
|
PanicAlert("CPU can't write %08x to DSP mailbox", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other DSP functions
|
// Other DSP functions
|
||||||
u16 DSPHLE::DSP_WriteControlRegister(unsigned short _Value)
|
u16 DSPHLE::DSP_WriteControlRegister(u16 value)
|
||||||
{
|
{
|
||||||
DSP::UDSPControl Temp(_Value);
|
DSP::UDSPControl temp(value);
|
||||||
|
|
||||||
if (Temp.DSPReset)
|
if (temp.DSPReset)
|
||||||
{
|
{
|
||||||
SetUCode(UCODE_ROM);
|
SetUCode(UCODE_ROM);
|
||||||
Temp.DSPReset = 0;
|
temp.DSPReset = 0;
|
||||||
}
|
}
|
||||||
if (Temp.DSPInit == 0)
|
if (temp.DSPInit == 0)
|
||||||
{
|
{
|
||||||
// copy 128 byte from ARAM 0x000000 to IMEM
|
// copy 128 byte from ARAM 0x000000 to IMEM
|
||||||
SetUCode(UCODE_INIT_AUDIO_SYSTEM);
|
SetUCode(UCODE_INIT_AUDIO_SYSTEM);
|
||||||
Temp.DSPInitCode = 0;
|
temp.DSPInitCode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DSPControl.Hex = Temp.Hex;
|
m_dsp_control.Hex = temp.Hex;
|
||||||
return m_DSPControl.Hex;
|
return m_dsp_control.Hex;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 DSPHLE::DSP_ReadControlRegister()
|
u16 DSPHLE::DSP_ReadControlRegister()
|
||||||
{
|
{
|
||||||
return m_DSPControl.Hex;
|
return m_dsp_control.Hex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPHLE::PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
void DSPHLE::PauseAndLock(bool do_lock, bool unpause_on_unlock)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
|
@ -26,51 +26,51 @@ public:
|
|||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
bool IsLLE() override { return false; }
|
bool IsLLE() override { return false; }
|
||||||
void DoState(PointerWrap& p) override;
|
void DoState(PointerWrap& p) override;
|
||||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock = true) override;
|
void PauseAndLock(bool do_lock, bool unpause_on_unlock = true) override;
|
||||||
|
|
||||||
void DSP_WriteMailBoxHigh(bool _CPUMailbox, unsigned short) override;
|
void DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value) override;
|
||||||
void DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short) override;
|
void DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value) override;
|
||||||
unsigned short DSP_ReadMailBoxHigh(bool _CPUMailbox) override;
|
u16 DSP_ReadMailBoxHigh(bool cpu_mailbox) override;
|
||||||
unsigned short DSP_ReadMailBoxLow(bool _CPUMailbox) override;
|
u16 DSP_ReadMailBoxLow(bool cpu_mailbox) override;
|
||||||
unsigned short DSP_ReadControlRegister() override;
|
u16 DSP_ReadControlRegister() override;
|
||||||
unsigned short DSP_WriteControlRegister(unsigned short) override;
|
u16 DSP_WriteControlRegister(u16 value) override;
|
||||||
void DSP_Update(int cycles) override;
|
void DSP_Update(int cycles) override;
|
||||||
void DSP_StopSoundStream() override;
|
void DSP_StopSoundStream() override;
|
||||||
u32 DSP_UpdateRate() override;
|
u32 DSP_UpdateRate() override;
|
||||||
|
|
||||||
CMailHandler& AccessMailHandler() { return m_MailHandler; }
|
CMailHandler& AccessMailHandler() { return m_mail_handler; }
|
||||||
// Formerly DSPHandler
|
// Formerly DSPHandler
|
||||||
UCodeInterface* GetUCode();
|
UCodeInterface* GetUCode();
|
||||||
void SetUCode(u32 _crc);
|
void SetUCode(u32 crc);
|
||||||
void SwapUCode(u32 _crc);
|
void SwapUCode(u32 crc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SendMailToDSP(u32 _uMail);
|
void SendMailToDSP(u32 mail);
|
||||||
|
|
||||||
// Fake mailbox utility
|
// Fake mailbox utility
|
||||||
struct DSPState
|
struct DSPState
|
||||||
{
|
{
|
||||||
u32 CPUMailbox;
|
u32 cpu_mailbox;
|
||||||
u32 DSPMailbox;
|
u32 dsp_mailbox;
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
CPUMailbox = 0x00000000;
|
cpu_mailbox = 0x00000000;
|
||||||
DSPMailbox = 0x00000000;
|
dsp_mailbox = 0x00000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPState() { Reset(); }
|
DSPState() { Reset(); }
|
||||||
};
|
};
|
||||||
DSPState m_dspState;
|
DSPState m_dsp_state;
|
||||||
|
|
||||||
UCodeInterface* m_pUCode;
|
UCodeInterface* m_ucode;
|
||||||
UCodeInterface* m_lastUCode;
|
UCodeInterface* m_last_ucode;
|
||||||
|
|
||||||
DSP::UDSPControl m_DSPControl;
|
DSP::UDSPControl m_dsp_control;
|
||||||
CMailHandler m_MailHandler;
|
CMailHandler m_mail_handler;
|
||||||
|
|
||||||
bool m_bHalt;
|
bool m_halt;
|
||||||
bool m_bAssertInt;
|
bool m_assert_interrupt;
|
||||||
};
|
};
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace DSP
|
} // namespace DSP
|
||||||
|
Loading…
Reference in New Issue
Block a user