summaryrefslogtreecommitdiff
path: root/src/KingSystem/Resource/Event/resDemoASLoader.h
blob: 3c203bd93346896c0fcdb221b430a2cf8d19e45e (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
50
#pragma once

#include <container/seadBuffer.h>
#include <prim/seadSafeString.h>
#include "KingSystem/Utils/Types.h"

namespace al {
class ByamlIter;
}

namespace sead {
class Heap;
}

namespace ksys::res {

class AS;
class Handle;

class DemoASLoader {
public:
    DemoASLoader(const sead::SafeString& event_name, sead::Heap* heap);
    virtual ~DemoASLoader();

    void load(const al::ByamlIter& iter, bool synchronous, Handle* pack_handle);

    const char* getName(int idx) const;
    AS* getAS(int idx) const;

    /// @return whether the load has finished (succeeded or failed).
    bool finishLoad();

private:
    enum class Status {
        Uninitialized = 0,
        Loading = 1,
        Succeeded = 2,
        Failed = 3,
    };

    sead::Heap* mHeap = nullptr;
    sead::Buffer<Handle> mHandles;
    sead::Buffer<sead::FixedSafeString<64>> mNames;
    sead::FixedSafeString<64> mEventName;
    int mNumAS = 0;
    Status mStatus = Status::Uninitialized;
};
KSYS_CHECK_SIZE_NX150(DemoASLoader, 0x90);

}  // namespace ksys::res