DSPHLE: Redefine asnd SwapLeftRight to apply to old versions

This commit is contained in:
Pokechu22 2024-03-24 11:58:04 -07:00
parent 3948ac9513
commit c85f5f8023
2 changed files with 7 additions and 4 deletions

View File

@ -57,7 +57,8 @@ constexpr u32 SAMPLE_RATE = 48000;
bool ASndUCode::SwapLeftRight() const bool ASndUCode::SwapLeftRight() const
{ {
return m_crc == HASH_DESERT_BUS_2011 || m_crc == HASH_DESERT_BUS_2012; return m_crc == HASH_2008 || m_crc == HASH_2009 || m_crc == HASH_2011 || m_crc == HASH_2020 ||
m_crc == HASH_2020_PAD;
} }
bool ASndUCode::UseNewFlagMasks() const bool ASndUCode::UseNewFlagMasks() const
@ -398,11 +399,12 @@ void ASndUCode::DoMixing(u32 return_mail)
} }
// Both paths jmpr $AR3, which is an index into sample_selector // Both paths jmpr $AR3, which is an index into sample_selector
auto [new_r, new_l] = (this->*sample_function)(); auto [new_l, new_r] = (this->*sample_function)();
if (SwapLeftRight()) 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 versions swapped the left and right input channels so that left
// comes first, and then right. Before, right came before left. // comes first, and then right, matching mp3/ogg files.
std::swap(new_r, new_l); std::swap(new_r, new_l);
} }
// out_samp: "multiply sample x volume" - left is put in $ax0.h, right is put in $ax1.h // out_samp: "multiply sample x volume" - left is put in $ax0.h, right is put in $ax1.h

View File

@ -53,7 +53,8 @@ public:
static constexpr u32 HASH_2020_PAD = 0xbad876ef; static constexpr u32 HASH_2020_PAD = 0xbad876ef;
// Variant used in Desert Bus v1.04 - this is based off of the code in libogc (as it existed in // Variant used in Desert Bus v1.04 - this is based off of the code in libogc (as it existed in
// 2011, even though that code only became used in 2020), but the left and right channels are // 2011, even though that code only became used in 2020), but the left and right channels are
// swapped. Padded to 0x0620 bytes. // swapped (with the left channel coming before the right channel, which is the the conventional
// behavior). Padded to 0x0620 bytes.
static constexpr u32 HASH_DESERT_BUS_2011 = 0xfa9c576f; static constexpr u32 HASH_DESERT_BUS_2011 = 0xfa9c576f;
// Variant used in Desert Bus v1.05 - this is the same as the previous version, except 4 junk // Variant used in Desert Bus v1.05 - this is the same as the previous version, except 4 junk
// instructions were added to the start, which do not change behavior in any way. Padded to 0x0620 // instructions were added to the start, which do not change behavior in any way. Padded to 0x0620