summaryrefslogtreecommitdiff
path: root/src/KingSystem/System/KingEditor.h
blob: 25b40aa152e1a7027db6d4a361eaa9065c0f9492 (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
51
#pragma once

#include <container/seadOffsetList.h>
#include <heap/seadDisposer.h>
#include <thread/seadCriticalSection.h>
#include "KingSystem/Utils/Types.h"

namespace ksys {

class KingEditorComponent {
public:
    virtual const char* getName() const = 0;
    virtual void syncData(char* data) = 0;

    void log(const char* message, void* x = {}, int y = {}) const;

    static constexpr size_t getListNodeOffset() { return offsetof(KingEditorComponent, mListNode); }

private:
    sead::ListNode mListNode;
};

// FIXME
class KingEditor {
    SEAD_SINGLETON_DISPOSER(KingEditor)
    KingEditor() = default;

public:
    void init(sead::Heap* heap);
    void calc();
    void registerComponent(KingEditorComponent* component);
    void log(const char* system, const char* message, void* = {}, int = {});

    u32 get88() const { return _88; }

private:
    sead::OffsetList<KingEditorComponent> mComponents;
    sead::ListNode mListNode;
    sead::CriticalSection mCS;
    u32 _88 = 0;
    u32 _8c = 0;
    void* _90 = nullptr;
    u32 _98 = 0;
    void* _a0 = nullptr;
    void* _a8 = nullptr;
    void* mPlayerLink = nullptr;
    bool _b8 = false;
};
KSYS_CHECK_SIZE_NX150(KingEditor, 0xc0);

}  // namespace ksys