blob: 64c940ef63d90af469219e2cd160927d2e31ff78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include "AudioFactory.h"
#include <vector>
#include "audio/AudioManager.h"
#include "binarytools/BinaryReader.h"
bool AudioFactory::process(LUS::BinaryWriter* writer, nlohmann::json& data, std::vector<uint8_t>& buffer) {
auto metadata = data["offsets"];
std::string path = data["path"];
if(path.find("bank_sets") != std::string::npos){
WRITE_HEADER(LUS::ResourceType::Blob, 0);
char* raw = (char*) (buffer.data() + metadata[1]["us"][0]);
WRITE_U32(metadata[0]);
for(int i = 0; i < 0x23; i++){
int16_t value;
memcpy(&value, raw + (i * 2), 2);
WRITE_I16(BSWAP16(value));
}
writer->Write(raw + 0x46, 0x5A);
return true;
}
if(!metadata[1].contains("us")){
return false;
}
AudioManager::Instance->create_aifc(metadata[1]["us"][1], *writer);
return true;
}
|