1:1 source port of the engine and game code; Windows build and system layer; docs. No game files or SDK headers.
This commit is contained in:
parent
c3b032a45a
commit
0ecb47e9cb
3871 changed files with 91080 additions and 1640063 deletions
|
|
@ -1,43 +0,0 @@
|
|||
#pragma once
|
||||
#include "core/inflate.h"
|
||||
#include <cstdint>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace choco {
|
||||
|
||||
enum class CadiKind { OggVorbis, Xml };
|
||||
enum class CadiChannel { Sfx, Music, Environment };
|
||||
struct CadiEventInfo {
|
||||
std::vector<size_t> clips;
|
||||
CadiChannel channel = CadiChannel::Sfx;
|
||||
bool loop = false;
|
||||
};
|
||||
struct CadiRecord {
|
||||
uint32_t token = 0; // opaque bank index value; Project URL maps through resource index order
|
||||
uint32_t offset = 0;
|
||||
uint32_t size = 0;
|
||||
CadiKind kind = CadiKind::OggVorbis;
|
||||
};
|
||||
|
||||
// Read-only parser for the bundled CADI audio bank; does not execute CadiApi.dll.
|
||||
class CadiBank {
|
||||
public:
|
||||
bool load(Bytes bytes, std::string* error = nullptr);
|
||||
const std::vector<CadiRecord>& records() const { return records_; }
|
||||
std::span<const uint8_t> data(size_t index) const;
|
||||
std::optional<size_t> clipForEvent(std::string_view event) const;
|
||||
std::vector<size_t> clipsForEvent(std::string_view event) const;
|
||||
std::optional<CadiEventInfo> eventInfo(std::string_view event) const;
|
||||
size_t mappedEventCount() const { return eventClips_.size(); }
|
||||
private:
|
||||
Bytes bytes_;
|
||||
std::vector<CadiRecord> records_;
|
||||
std::unordered_map<std::string,CadiEventInfo> eventClips_;
|
||||
};
|
||||
|
||||
} // namespace choco
|
||||
Loading…
Add table
Add a link
Reference in a new issue