summaryrefslogtreecommitdiff
path: root/src/factories/mk64/TrackSections.h
blob: 05e1ee441dd93819067ff455b16c76e4d43fa9ad (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once

#include "../BaseFactory.h"

namespace MK64 {

    struct TrackSections {
        uint32_t addr;
        uint8_t surfaceType;
        uint8_t sectionId;
        uint16_t flags;
    };

    class TrackSectionsData : public IParsedData {
    public:
        std::vector<TrackSections> mSecs;

        explicit TrackSectionsData(std::vector<TrackSections> sections) : mSecs(sections) {}
    };

    class TrackSectionsHeaderExporter : public BaseExporter {
        void Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName, YAML::Node& node, std::string* replacement) override;
    };

    class TrackSectionsBinaryExporter : public BaseExporter {
        void Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName, YAML::Node& node, std::string* replacement) override;
    };

    class TrackSectionsCodeExporter : public BaseExporter {
        void Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName, YAML::Node& node, std::string* replacement) override;
    };

    class TrackSectionsFactory : public BaseFactory {
    public:
        std::optional<std::shared_ptr<IParsedData>> parse(std::vector<uint8_t>& buffer, YAML::Node& data) override;
        std::optional<std::shared_ptr<IParsedData>> parse_modding(std::vector<uint8_t>& buffer, YAML::Node& data) override {
            return std::nullopt;
        }
        inline std::unordered_map<ExportType, std::shared_ptr<BaseExporter>> GetExporters() override {
            return {
                REGISTER(Code, TrackSectionsCodeExporter)
                REGISTER(Header, TrackSectionsHeaderExporter)
                REGISTER(Binary, TrackSectionsBinaryExporter)
            };
        }
        bool SupportModdedAssets() override { return false; }
    };

}