2020-01-15 12:07:48 +00:00
|
|
|
#include "Runtime/Audio/CAudioGroupSet.hpp"
|
2016-07-24 22:51:15 +00:00
|
|
|
|
2020-03-25 05:14:24 +00:00
|
|
|
#include <cstring>
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2023-10-22 16:21:20 +00:00
|
|
|
/*
|
2018-12-08 05:30:43 +00:00
|
|
|
amuse::AudioGroupData CAudioGroupSet::LoadData() {
|
2020-03-25 05:14:24 +00:00
|
|
|
const auto readU32 = [](const u8* ptr) {
|
|
|
|
uint32_t value;
|
|
|
|
std::memcpy(&value, ptr, sizeof(value));
|
2022-02-16 05:21:24 +00:00
|
|
|
return SBig(value);
|
2020-03-25 05:14:24 +00:00
|
|
|
};
|
|
|
|
|
2022-02-18 07:37:54 +00:00
|
|
|
CMemoryInStream r(m_buffer.get(), INT32_MAX, CMemoryInStream::EOwnerShip::NotOwned);
|
|
|
|
x10_baseName = r.Get<std::string>();
|
|
|
|
x20_name = r.Get<std::string>();
|
2016-07-24 22:51:15 +00:00
|
|
|
|
2022-02-18 07:37:54 +00:00
|
|
|
u8* buf = m_buffer.get() + r.GetReadPosition();
|
2020-03-25 05:14:24 +00:00
|
|
|
const uint32_t poolLen = readU32(buf);
|
2018-12-08 05:30:43 +00:00
|
|
|
unsigned char* pool = buf + 4;
|
|
|
|
buf += poolLen + 4;
|
2020-03-25 05:14:24 +00:00
|
|
|
const uint32_t projLen = readU32(buf);
|
2018-12-08 05:30:43 +00:00
|
|
|
unsigned char* proj = buf + 4;
|
|
|
|
buf += projLen + 4;
|
2020-03-25 05:14:24 +00:00
|
|
|
const uint32_t sampLen = readU32(buf);
|
2018-12-08 05:30:43 +00:00
|
|
|
unsigned char* samp = buf + 4;
|
|
|
|
buf += sampLen + 4;
|
2020-03-25 05:14:24 +00:00
|
|
|
const uint32_t sdirLen = readU32(buf);
|
2018-12-08 05:30:43 +00:00
|
|
|
unsigned char* sdir = buf + 4;
|
2016-07-24 22:51:15 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return {proj, projLen, pool, poolLen, sdir, sdirLen, samp, sampLen, amuse::GCNDataTag{}};
|
2016-07-24 22:51:15 +00:00
|
|
|
}
|
2023-10-22 16:21:20 +00:00
|
|
|
*/
|
|
|
|
CAudioGroupSet::CAudioGroupSet(std::unique_ptr<u8[]>&& in) : m_buffer(std::move(in)) {}
|
2016-07-24 22:51:15 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
CFactoryFnReturn FAudioGroupSetDataFactory(const metaforce::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len,
|
|
|
|
const metaforce::CVParamTransfer& vparms, CObjectReference* selfRef) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return TToken<CAudioGroupSet>::GetIObjObjectFor(std::make_unique<CAudioGroupSet>(std::move(in)));
|
2016-07-24 22:51:15 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|