summaryrefslogtreecommitdiff
path: root/include/m_Do/m_Do_hostIO.h
blob: 5b949f26be74936395e4b3965c3e0d415e56bcdf (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#ifndef M_DO_M_DO_HOSTIO_H
#define M_DO_M_DO_HOSTIO_H

#include "dolphin/types.h"
#include <string.h>

// move JOR stuff later
class JOREventListener;
class JORPropertyEvent;
class JORNodeEvent;
class JORGenEvent;
class JOREvent;
class JORServer;

#if VERSION == VERSION_DEMO
#define HIO(name) l_HIO.name
#else
#define HIO(name) L_HIO::name
#endif

class JORMContext {
public:
    void genCheckBox(const char* param_1, u8* param_2, u8 param_3, u32 param_4, JOREventListener* param_5, u16 param_6, u16 param_7, u16 param_8, u16 param_9) {
        genCheckBoxSub(0x108, param_1, (u32)param_2, param_4, *param_2, param_3, param_5, param_6, param_7, param_8, param_9);
    }
    void genCheckBoxSub(u32, const char*, u32, u32, u16, u16, JOREventListener*, u16, u16, u16, u16);
};

class JOREventListener {
public:
#ifdef DEBUG
    virtual void listenPropertyEvent(const JORPropertyEvent*) = 0;
#endif
};

class JORReflexible : public JOREventListener {
public:
#ifdef DEBUG
    JORReflexible() {}
    static JORServer* getJORServer();

    virtual void listenPropertyEvent(const JORPropertyEvent*) {}
    virtual void listen(u32, const JOREvent*) {}
    virtual void genObjectInfo(const JORGenEvent*) {}
    virtual void genMessage(JORMContext*) = 0;
    virtual void listenNodeEvent(const JORNodeEvent*) {}
#endif
};

class mDoHIO_child_c {
public:
    mDoHIO_child_c() {
        field_0x18 = 0;
        mPt = NULL;
    }

    ~mDoHIO_child_c() {}

    const char* getName() { return mName; }
    void setName(const char* i_name) { strncpy(mName, i_name, sizeof(mName)); }
    JORReflexible* getPt() { return mPt; }
    void setPt(JORReflexible* i_pt) { mPt = i_pt; }

    /* 0x00 */ char mName[24];
    /* 0x18 */ u8 field_0x18;
    /* 0x1C */ JORReflexible* mPt;
};

class mDoHIO_subRoot_c {
public:
    virtual ~mDoHIO_subRoot_c() {}

    s8 createChild(const char*, JORReflexible*);
    void deleteChild(s8);

    void updateChild(s8) {}

private:
    /* 0x4 */ mDoHIO_child_c mChild[64];
};

class mDoHIO_root_c {
public:
    virtual ~mDoHIO_root_c() {}

    void update();
    
    s8 createChild(const char* name, JORReflexible* hio) {
        return m_subroot.createChild(name, hio);
    }
    void deleteChild(s8 childID) {
        m_subroot.deleteChild(childID);
    }

    /* 0x0 */ mDoHIO_subRoot_c m_subroot;
};

class mDoHIO_entry_c : public JORReflexible {
public:
#if VERSION == VERSION_DEMO
    /* 0x00 */ s8 mNo;
    /* 0x01 */ u8 mCount;
    /* 0x04 */ /* vtable */

    mDoHIO_entry_c();
    virtual ~mDoHIO_entry_c();
    void entryHIO(const char*);
    void removeHIO();
#else
    virtual ~mDoHIO_entry_c() {}
#endif
};

extern mDoHIO_root_c mDoHIO_root;

inline s8 mDoHIO_createChild(const char* name, JORReflexible* hio) {
    return mDoHIO_root.createChild(name, hio);
}

inline void mDoHIO_deleteChild(s8 childID) {
    mDoHIO_root.deleteChild(childID);
}

#endif /* M_DO_M_DO_HOSTIO_H */