summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2022-07-26 19:01:57 -0700
committerPokechu22 <Pokechu022@gmail.com>2022-07-26 19:06:05 -0700
commitcc02471da201b3733e01bca0e7eb3173934db41d (patch)
treec96808d3dfc127d031babb64d8dbcd5bac532d78 /Source/Core
parent33b63a62d1a3381f8e7a6a7fa9aea984771586ab (diff)
DSPHLE: Support padded versions of the libaesnd uCode
This is used by libogc2 and libogc-rice.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp8
-rw-r--r--Source/Core/Core/HW/DSPHLE/UCodes/AESnd.h10
-rw-r--r--Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp2
3 files changed, 17 insertions, 3 deletions
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp
index 122044dda6..831fc4b684 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp
@@ -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:
//
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.h b/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.h
index 5991d3c027..26a6dc2d5c 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.h
@@ -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();
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp
index f8ccee5deb..136eb3a87f 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp
@@ -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);