summaryrefslogtreecommitdiff
path: root/src/input/gc/DolFile.h
blob: 3f176cafbac2cee57a06d773ce6353b05ae3b621 (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
#pragma once

#include <cstdint>
#include <vector>

namespace GC {

struct DolSection {
    bool text;
    uint32_t fileOffset;
    uint32_t address;
    uint32_t size;
};

class DolFile {
public:
    explicit DolFile(const std::vector<uint8_t>& data);

    const std::vector<DolSection>& GetSections() const { return mSections; }
    uint32_t GetBssAddress() const { return mBssAddress; }
    uint32_t GetBssSize() const { return mBssSize; }
    uint32_t GetEntryPoint() const { return mEntry; }

    uint32_t GetStart() const;
    uint32_t GetEnd() const;

    void Map(uint8_t* dst, uint32_t base, uint32_t size) const;

private:
    std::vector<uint8_t> mData;
    std::vector<DolSection> mSections;
    uint32_t mBssAddress;
    uint32_t mBssSize;
    uint32_t mEntry;
};

} // namespace GC