summaryrefslogtreecommitdiff
path: root/include/m/m_pad.h
blob: 14b100c3f9daaacc08e11e54f48c0c51422373c4 (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
#ifndef M_PAD_H
#define M_PAD_H

#include "egg/core/eggController.h"
#include "m/m_vec.h"

namespace mPad {

extern EGG::CoreControllerMgr *g_padMg;
extern int g_currentCoreId;
extern EGG::CoreController *g_currentCore;
extern EGG::CoreController *g_core[4];

enum Button {
    BUTTON_LEFT = 0x1,
    BUTTON_RIGHT = 0x2,
    BUTTON_DOWN = 0x4,
    BUTTON_UP = 0x8,
    BUTTON_PLUS = 0x10,
    BUTTON_2 = 0x100,
    BUTTON_1 = 0x200,
    BUTTON_B = 0x400,
    BUTTON_A = 0x800,
    BUTTON_MINUS = 0x1000,
    BUTTON_Z = 0x2000,
    BUTTON_C = 0x4000,
    BUTTON_HOME = 0x8000,
};

inline EGG::CoreController *getCore(const int i) {
    return g_core[i];
}
inline void stopRumbleMgr(int i) {
    g_core[i]->stopRumbleMgr();
}
inline EGG::CoreController *getCore() {
    return g_currentCore;
}
inline EGG::CoreControllerMgr *getMgr() {
    return g_padMg;
}
inline int getCurrentCoreID() {
    return g_currentCoreId;
}

inline bool isMpls(const int i) {
    return g_padMg->getDevType(i) == EGG::cDEV_MPLS ? true : false;
}
inline bool isMplsPtFS(const int i) {
    return g_padMg->getDevType(i) == EGG::cDEV_MPLS_PT_FS;
}

inline mVec2_c getDpdRawPos() {
    return g_currentCore->getDpdRawPos();
}

inline mVec2_c getDpdRawPos(int i) {
    return g_core[i]->getDpdRawPos();
}

// Defined in dPad, referenced in both mPad and dPad
extern "C" void async_info_callback(s32 chan, s32 result);

void create();
void beginPad();
void endPad();

}; // namespace mPad

#endif