DSPHLE: Implement 2024 libasnd uCodes

This commit is contained in:
Pokechu22 2024-03-24 11:59:32 -07:00
parent c85f5f8023
commit cd5f6ddd9b
3 changed files with 15 additions and 2 deletions

View File

@ -64,7 +64,8 @@ bool ASndUCode::SwapLeftRight() const
bool ASndUCode::UseNewFlagMasks() const
{
return m_crc == HASH_2011 || m_crc == HASH_2020 || m_crc == HASH_2020_PAD ||
m_crc == HASH_DESERT_BUS_2011 || m_crc == HASH_DESERT_BUS_2012;
m_crc == HASH_DESERT_BUS_2011 || m_crc == HASH_DESERT_BUS_2012 || m_crc == HASH_2024 ||
m_crc == HASH_2024_PAD;
}
ASndUCode::ASndUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
@ -403,7 +404,7 @@ void ASndUCode::DoMixing(u32 return_mail)
if (SwapLeftRight())
{
// Most versions of the ASnd ucode have the right channel come before the left channel.
// The Desert Bus versions swapped the left and right input channels so that left
// The Desert Bus and 2024 versions swapped the left and right input channels so that left
// comes first, and then right, matching mp3/ogg files.
std::swap(new_r, new_l);
}

View File

@ -60,6 +60,16 @@ public:
// instructions were added to the start, which do not change behavior in any way. Padded to 0x0620
// bytes.
static constexpr u32 HASH_DESERT_BUS_2012 = 0x614dd145;
// March 22, 2024 version (0x0606 bytes) - libogc fixed left and right channels being reversed,
// which apparently has been the case from the start but was not obvious in earlier testing
// because of the oggplayer sample using a mono sound file.
// https://github.com/devkitPro/libogc/commit/a0b4b5680944ee7c2ae1b7af63a721623c1a6b69
static constexpr u32 HASH_2024 = 0x5dbf8bf1;
// March 22, 2024 version (padded to 0x0620 bytes) - same as above, but padded as it's used by
// libogc2 and libogc-rice.
// https://github.com/extremscorner/libogc2/commit/f3fd10635d4b3fbc6ee03cec335eeb2a2237fd56
// https://github.com/extremscorner/libogc-rice/commit/5ebbf8b96d7433bc2af9e882f730e67a5eb20f00
static constexpr u32 HASH_2024_PAD = 0x373a950e;
private:
void DMAInVoiceData();

View File

@ -293,6 +293,8 @@ std::unique_ptr<UCodeInterface> UCodeFactory(u32 crc, DSPHLE* dsphle, bool wii)
case ASndUCode::HASH_2020_PAD:
case ASndUCode::HASH_DESERT_BUS_2011:
case ASndUCode::HASH_DESERT_BUS_2012:
case ASndUCode::HASH_2024:
case ASndUCode::HASH_2024_PAD:
INFO_LOG_FMT(DSPHLE, "CRC {:08x}: ASnd chosen (Homebrew)", crc);
return std::make_unique<ASndUCode>(dsphle, crc);