DSPHLE: Support 2023 libaesnd uCode

Fixes https://bugs.dolphin-emu.org/issues/13401
This commit is contained in:
Pokechu22 2023-11-18 12:56:23 -08:00
parent dc0814ae46
commit 2d7a078d53
3 changed files with 10 additions and 8 deletions

View File

@ -72,13 +72,13 @@ constexpr u32 ACCELERATOR_GAIN_16_BIT = 0x0800;
bool AESndUCode::SwapLeftRight() const bool AESndUCode::SwapLeftRight() const
{ {
return m_crc == HASH_2012 || m_crc == HASH_EDUKE32 || m_crc == HASH_2020 || return m_crc == HASH_2012 || m_crc == HASH_EDUKE32 || m_crc == HASH_2020 ||
m_crc == HASH_2020_PAD || m_crc == HASH_2022_PAD; m_crc == HASH_2020_PAD || m_crc == HASH_2022_PAD || m_crc == HASH_2023;
} }
bool AESndUCode::UseNewFlagMasks() const bool AESndUCode::UseNewFlagMasks() const
{ {
return m_crc == HASH_EDUKE32 || m_crc == HASH_2020 || m_crc == HASH_2020_PAD || return m_crc == HASH_EDUKE32 || m_crc == HASH_2020 || m_crc == HASH_2020_PAD ||
m_crc == HASH_2022_PAD; m_crc == HASH_2022_PAD || m_crc == HASH_2023;
} }
AESndUCode::AESndUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc) AESndUCode::AESndUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
@ -164,7 +164,7 @@ void AESndUCode::HandleMail(u32 mail)
break; break;
case MAIL_TERMINATE: case MAIL_TERMINATE:
INFO_LOG_FMT(DSPHLE, "AESndUCode - MAIL_TERMINATE: {:08x}", mail); INFO_LOG_FMT(DSPHLE, "AESndUCode - MAIL_TERMINATE: {:08x}", mail);
if (m_crc != HASH_2022_PAD) if (m_crc != HASH_2022_PAD && m_crc != HASH_2023)
{ {
// The relevant code looks like this: // The relevant code looks like this:
// //
@ -181,9 +181,6 @@ void AESndUCode::HandleMail(u32 mail)
// AESND_Reset never returns, resulting in a hang. We always send the mail to avoid this // AESND_Reset never returns, resulting in a hang. We always send the mail to avoid this
// hang. (It's possible to exit without calling AESND_Reset, so most homebrew probably // hang. (It's possible to exit without calling AESND_Reset, so most homebrew probably
// isn't affected by this bug in the first place.) // isn't affected by this bug in the first place.)
//
// A fix exists, but has not yet been added to mainline libogc:
// https://github.com/extremscorner/libogc2/commit/38edc9db93232faa612f680c91be1eb4d95dd1c6
WARN_LOG_FMT(DSPHLE, "AESndUCode - MAIL_TERMINATE is broken in this version of the " WARN_LOG_FMT(DSPHLE, "AESndUCode - MAIL_TERMINATE is broken in this version of the "
"uCode; this will hang on real hardware or with DSP LLE"); "uCode; this will hang on real hardware or with DSP LLE");
} }

View File

@ -45,10 +45,14 @@ public:
// https://github.com/extremscorner/libogc-rice/commit/cfddd4f3bec77812d6d333954e39d401d2276cd8 // https://github.com/extremscorner/libogc-rice/commit/cfddd4f3bec77812d6d333954e39d401d2276cd8
// https://github.com/extremscorner/libogc2/commit/89ae39544e22f720a9c986af3524f7e6f20e7293 // https://github.com/extremscorner/libogc2/commit/89ae39544e22f720a9c986af3524f7e6f20e7293
static constexpr u32 HASH_2020_PAD = 0xa02a6131; static constexpr u32 HASH_2020_PAD = 0xa02a6131;
// July 19, 2022 version (padded to 0x0400 bytes) - fixed MAIL_TERMINATE. This is not currently // July 19, 2022 version (padded to 0x0400 bytes) - fixed MAIL_TERMINATE. This padded version
// included in libogc, only in libogc2 and libogc-rice (which generate a padded header file). // is only in libogc2 and libogc-rice (which generate a padded header file).
// https://github.com/extremscorner/libogc2/commit/38edc9db93232faa612f680c91be1eb4d95dd1c6 // https://github.com/extremscorner/libogc2/commit/38edc9db93232faa612f680c91be1eb4d95dd1c6
static constexpr u32 HASH_2022_PAD = 0x2e5e4100; static constexpr u32 HASH_2022_PAD = 0x2e5e4100;
// March 13, 2023 version (0x03e8 bytes) - fixed MAIL_TERMINATE. This is the same fix as the
// above version, and was released in regular libogc 2.4.0 on April 17, 2023.
// https://github.com/devkitPro/libogc/commit/a7e4bcd3ad4477d8dfc3aa196cfeb10cf195cd6a
static constexpr u32 HASH_2023 = 0x002e5e41;
private: private:
void DMAInParameterBlock(); void DMAInParameterBlock();

View File

@ -324,6 +324,7 @@ std::unique_ptr<UCodeInterface> UCodeFactory(u32 crc, DSPHLE* dsphle, bool wii)
case AESndUCode::HASH_2020: case AESndUCode::HASH_2020:
case AESndUCode::HASH_2020_PAD: case AESndUCode::HASH_2020_PAD:
case AESndUCode::HASH_2022_PAD: case AESndUCode::HASH_2022_PAD:
case AESndUCode::HASH_2023:
INFO_LOG_FMT(DSPHLE, "CRC {:08x}: AESnd chosen (Homebrew)", crc); INFO_LOG_FMT(DSPHLE, "CRC {:08x}: AESnd chosen (Homebrew)", crc);
return std::make_unique<AESndUCode>(dsphle, crc); return std::make_unique<AESndUCode>(dsphle, crc);