Torch
Loading...
Searching...
No Matches
BKAssetFactory.h
1#pragma once
2
3#include "factories/BaseFactory.h"
4#include <string>
5#include <types/RawBuffer.h>
6#include <unordered_map>
7#include <vector>
8
9namespace BK64 {
10
25typedef struct BKAssetInfo {
26 uint32_t offset;
27 int16_t compressionFlag;
28 int16_t tFlag;
29 int32_t assetMode;
30 int32_t index;
32
33enum class BKAssetType {
34 Animation, // 0x000 - 0x0FF
35 Binary, // 0x100 - 0x1FF
36 DemoInput, // 0x200 - 0x2CF
37 Dialog, // 0x2D0 - 0x2D0
38 Model, // 0x2D1 - 0x571
39 Sprite, // 0x572 - 0x6FF
40 Map, // 0x700 - 0x7FF
41 Midi, // 0x800 - 0x8FF
42 GruntyQuestion, // 0x900 - 0x9FF
43 QuizQuestion, // 0xA00 - 0xAFF
44};
45
46class BKAssetData : public IParsedData {
47 public:
48 std::vector<BKAssetInfo> mAssetTableInfo;
49 std::unordered_map<uint32_t, std::string> mSymbolMap;
50
51 BKAssetData(std::vector<BKAssetInfo> assetTableInfo, std::unordered_map<uint32_t, std::string> symbolMap)
52 : mAssetTableInfo(std::move(assetTableInfo)), mSymbolMap(std::move(symbolMap)) {
53 }
54};
55
57 ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName,
58 YAML::Node& node, std::string* replacement) override;
59};
60
62 ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName,
63 YAML::Node& node, std::string* replacement) override;
64};
65
67 ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName,
68 YAML::Node& node, std::string* replacement) override;
69};
70
72 public:
73 std::optional<std::shared_ptr<IParsedData>> parse(std::vector<uint8_t>& buffer, YAML::Node& data) override;
74 inline std::unordered_map<ExportType, std::shared_ptr<BaseExporter>> GetExporters() override {
75 return { REGISTER(Header, BKAssetHeaderExporter) REGISTER(Binary, BKAssetBinaryExporter)
76 REGISTER(Code, BKAssetCodeExporter) };
77 }
78
79 bool HasModdedDependencies() override {
80 return true;
81 }
82
83 bool IsDialogPackRoot() const override {
84 return true;
85 }
86
87 void PreprocessConfig(YAML::Node& cfg, N64::Cartridge* cart) override;
88};
89
90} // namespace BK64
Definition BKAssetFactory.h:61
Definition BKAssetFactory.h:66
Definition BKAssetFactory.h:71
Definition BKAssetFactory.h:56
Definition BaseFactory.h:96
Definition BaseFactory.h:102
Definition BaseFactory.h:88
Definition Cartridge.h:15
Definition BKAssetFactory.h:25