DSPHLE: Support padded versions of the libaesnd uCode

This is used by libogc2 and libogc-rice.
This commit is contained in:
Pokechu22 2022-07-26 19:01:57 -07:00
parent 33b63a62d1
commit cc02471da2
3 changed files with 17 additions and 3 deletions

View File

@ -70,12 +70,14 @@ constexpr u32 ACCELERATOR_GAIN_16_BIT = 0x0800;
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;
}
bool AESndUCode::UseNewFlagMasks() const
{
return m_crc == HASH_EDUKE32 || m_crc == HASH_2020;
return m_crc == HASH_EDUKE32 || m_crc == HASH_2020 || m_crc == HASH_2020_PAD ||
m_crc == HASH_2022_PAD;
}
AESndUCode::AESndUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
@ -161,7 +163,7 @@ void AESndUCode::HandleMail(u32 mail)
break;
case MAIL_TERMINATE:
INFO_LOG_FMT(DSPHLE, "AESndUCode - MAIL_TERMINATE: {:08x}", mail);
if (true) // currently no mainline libogc uCode has this issue fixed
if (m_crc != HASH_2022_PAD)
{
// The relevant code looks like this:
//

View File

@ -39,6 +39,16 @@ public:
// First included with libogc 2.1.0 on June 15, 2020: https://devkitpro.org/viewtopic.php?t=9079
// https://github.com/devkitPro/libogc/commit/eac8fe2c29aa790d552dd6166a1fb195dfdcb825
static constexpr u32 HASH_2020 = 0x84c680a9;
// Padded version of the above (0x0400 bytes), added to libogc-rice on June 16, 2012 (that's the
// commit author date; the commit date is November 24, 2016) and libogc2 on 25 May 2020. Used by
// Not64 and OpenTTD (starting with the December 1, 2012 release).
// https://github.com/extremscorner/libogc-rice/commit/cfddd4f3bec77812d6d333954e39d401d2276cd8
// https://github.com/extremscorner/libogc2/commit/89ae39544e22f720a9c986af3524f7e6f20e7293
static constexpr u32 HASH_2020_PAD = 0xa02a6131;
// July 19, 2022 version (padded to 0x0400 bytes) - fixed MAIL_TERMINATE. This is not currently
// included in libogc, only in libogc2 and libogc-rice (which generate a padded header file).
// https://github.com/extremscorner/libogc2/commit/38edc9db93232faa612f680c91be1eb4d95dd1c6
static constexpr u32 HASH_2022_PAD = 0x2e5e4100;
private:
void DMAInParameterBlock();

View File

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