[APU] Added new XMA decoder as config option.

This commit is contained in:
Gliniak
2024-03-25 21:59:49 +01:00
committed by Radosław Gliński
parent 26ea81624a
commit 122f58c9dd
9 changed files with 1976 additions and 996 deletions

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2021 Ben Vanik. All rights reserved. *
* Copyright 2023 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -20,31 +20,33 @@ namespace xma {
static const uint32_t kMaxFrameLength = 0x7FFF;
// Get number of frames that /begin/ in this packet.
uint32_t GetPacketFrameCount(uint8_t* packet) {
return (uint8_t)(packet[0] >> 2);
// Get number of frames that /begin/ in this packet. This is valid only for XMA2
// packets
static const uint8_t GetPacketFrameCount(const uint8_t* packet) {
return packet[0] >> 2;
}
static const uint8_t GetPacketMetadata(const uint8_t* packet) {
return packet[2] & 0x7;
}
static const bool IsPacketXma2Type(const uint8_t* packet) {
return GetPacketMetadata(packet) == 1;
}
static const uint8_t GetPacketSkipCount(const uint8_t* packet) {
return packet[3];
}
// Get the first frame offset in bits
uint32_t GetPacketFrameOffset(uint8_t* packet) {
static uint32_t GetPacketFrameOffset(const uint8_t* packet) {
uint32_t val = (uint16_t)(((packet[0] & 0x3) << 13) | (packet[1] << 5) |
(packet[2] >> 3));
// if (val > kBitsPerPacket - kBitsPerHeader) {
// // There is no data in this packet
// return -1;
// } else {
return val + 32;
// }
}
uint32_t GetPacketMetadata(uint8_t* packet) {
return (uint8_t)(packet[2] & 0x7);
}
uint32_t GetPacketSkipCount(uint8_t* packet) { return (uint8_t)(packet[3]); }
} // namespace xma
} // namespace apu
} // namespace xe
#endif // XENIA_APU_XMA_HELPERS_H_
#endif // XENIA_APU_XMA_HELPERS_H_