summaryrefslogtreecommitdiff
path: root/include/f_ap/f_ap_game.h
blob: 83f5909a2959699d171cfaefe2d1c8d45b19d794 (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#ifndef F_AP_F_AP_GAME_H
#define F_AP_F_AP_GAME_H

#include "JSystem/JUtility/TColor.h"
#include "JSystem/JHostIO/JORReflexible.h"
#include "JSystem/JFramework/JFWDisplay.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "CaptureScreen.h"
#include <cstring>

void fapGm_After();
void fapGm_Create();
void fapGm_Execute();

class fapGm_HIO_c : public JORReflexible {
public:
    fapGm_HIO_c();

    #if DEBUG
    virtual void listenPropertyEvent(const JORPropertyEvent*);
    virtual void genMessage(JORMContext*);
    #endif
    virtual ~fapGm_HIO_c() {}

    static void startCpuTimer();
    static void stopCpuTimer(const char*);
    static void printCpuTimer(const char*);
    static void executeCaptureScreen() {}

    static void createCaptureScreen() {
        mCaptureScreen = new CaptureScreen(JFWDisplay::getManager());
        JUT_ASSERT(46, mCaptureScreen != NULL);
    }

    static bool isCaptureScreen() {
#if DEBUG
        return mCaptureScreenFlag;
#else
        return false;
#endif
    }

    static void onCpuTimer() {
        m_CpuTimerOn = TRUE;
    }

    static void offCpuTimer() {
        m_CpuTimerOff = FALSE;
    }

    static u8 getCaptureScreenNumH() { return mCaptureScreenNumH; }
    static u8 getCaptureScreenNumV() { return mCaptureScreenNumV; }

    static u8 getCaptureScreenDivH() { return mCaptureScreenDivH; }
    static u8 getCaptureScreenDivV() { return mCaptureScreenDivV; }

    static u8 m_CpuTimerOn;
    static u8 m_CpuTimerOff;
    static u8 m_CpuTimerStart;
    static u32 m_CpuTimerTick;

    static CaptureScreen* mCaptureScreen;
    static void* mCaptureScreenBuffer;
    static s16 mCaptureScreenFlag;
    static u16 mCaptureScreenWidth;
    static u16 mCaptureScreenHeight;
    static u16 mCaptureScreenLinePf;
    static u16 mCaptureScreenLineNum;
    static u8 mCaptureScreenNumH;
    static u8 mCaptureScreenNumV;

    static u8 mParticle254Fix;

    static u8 mCaptureMagnification;

    static u8 mCaptureScreenDivH;
    static u8 mCaptureScreenDivV;

    static u8 mPackArchiveMode;

    /* 0x04 */ s8 field_0x04;
    /* 0x05 */ u8 field_0x03[3];
    /* 0x08 */ JUtility::TColor mColor;
    /* 0x0C */ f32 mLROnValue;
    /* 0x10 */ f32 mLROffValue;
    /* 0x14 */ u8 mUsingHostIO;
    /* 0x15 */ u8 mDisplayMeter;
    /* 0x16 */ u8 mDisplayPrint;
    /* 0x17 */ u8 mDisplay2D;
    /* 0x18 */ u8 mDisplayParticle;
    /* 0x19 */ u8 mDisplayProcessID;
    #if PLATFORM_WII || PLATFORM_SHIELD
    /* 0x1A */ u8 mTrapFilter;
    /* 0x1B */ u8 mGammaCorrection;
    #endif
    /* 0x1A */ u8 mMemBlockOff;
    /* 0x1C */ s16 mRegister0;
    /* 0x1E */ s16 mRegister1;
    /* 0x20 */ s16 mRegister2;
    /* 0x22 */ s16 mRegister3;
    #if DEBUG
    /* 0x26 */ u8 field_0x26[2];
    #endif
    /* 0x24 */ JUtility::TColor mLetterTopColor;
    /* 0x28 */ JUtility::TColor mLetterBottomColor;
    /* 0x2C */ JUtility::TColor mLetterTopShadowColor;
    /* 0x30 */ JUtility::TColor mLetterBottomShadowColor;
    /* 0x34 */ s16 mLetterPositionX;
    /* 0x36 */ s16 mLetterPositionY;
    /* 0x38 */ s16 mLineSpacing;
    /* 0x3A */ s16 mLetterSpacing;
    /* 0x3C */ s16 mLetterFontSize;
    /* 0x3E */ u8 mBackgroundAlpha;
};  // Size: 0x40

extern fapGm_HIO_c g_HIO;

inline void fapGmHIO_offMenu() {
    g_HIO.mDisplayPrint &= (u8)~2;
}

inline void fapGmHIO_onMenu() {
    g_HIO.mDisplayPrint |= (u8)2;
}

inline BOOL fapGmHIO_isMenu() {
    return g_HIO.mDisplayPrint & 2;
}

inline BOOL fapGmHIO_isPrint() {
    return g_HIO.mDisplayPrint & 1;
}

inline u8 fapGmHIO_getMeter() {
    return g_HIO.mDisplayMeter;
}

inline f32 fapGmHIO_getLROnValue() {
    return g_HIO.mLROnValue;
}

inline f32 fapGmHIO_getLROffValue() {
    return g_HIO.mLROffValue;
}

inline u8 fapGmHIO_getHostIO() {
    return g_HIO.mUsingHostIO;
}

inline void fapGmHIO_set2Ddraw(u8 param_0) {
    g_HIO.mDisplay2D = param_0;
}

inline u8 fapGmHIO_get2Ddraw() {
    #if DEBUG
    return g_HIO.mDisplay2D;
    #else
    return TRUE;
    #endif
}

inline void fapGmHIO_offPrint() {
    g_HIO.mDisplayPrint &= (u8)~0x1;
}

inline void fapGmHIO_onPrint() {
    g_HIO.mDisplayPrint |= (u8)0x1;
}

inline u8 fapGmHIO_getParticle() {
    #if DEBUG
    return g_HIO.mDisplayParticle;
    #else
    return TRUE;
    #endif
}

#if PLATFORM_WII || PLATFORM_SHIELD
inline u8 fapGmHIO_getTrapFilter() {
    return g_HIO.mTrapFilter;
}

inline u8 fapGmHIO_getGamma() {
    return g_HIO.mGammaCorrection;
}
#endif

inline u8 fapGmHIO_getMemoryBlockOff() {
    return g_HIO.mMemBlockOff;
}

struct fapGm_dataMem {
    enum HeapType_e {
        HeapType_Error_e,
        HeapType_ARAM_e,
        HeapType_Root_e,
        HeapType_System_e,
        HeapType_Zelda_e,
        HeapType_Archive_e,
        HeapType_Game_e,
        HeapType_Command_e,
        HeapType_Stage_e,
        HeapType_J2D_e,
        HeapType_Dynamic_e,
    };

    enum TagAttribute_e {
        TagAtt_Fixed_e,
        TagAtt_Variable_e,
    };

    enum TagType_e {
        TagType_Audio_e,
        TagType_Particle_e,
        TagType_System_e,
        TagType_Unknown_e,
        TagType_Message_e,
        TagType_2D_e,
        TagType_Player_e,
        TagType_Archive_e,
        TagType_ArchiveSub_e,
        TagType_ArchiveStage_e,
        TagType_ArchiveStageSub_e,
        TagType_Program_e,
        TagType_Object_e,
        TagType_Stage_e,
        TagType_Heap_e,
    };

    static void printfTag(int, int, int, const char*, void*, u32, const char*, const char*);
    static int findParentHeap(void*);
    static void dumpTag();
    static void dumpCsv();

    static int getCsvSize() { return strlen(mCsv); }
    static char* getCsv() { return mCsv; }
    static inline char* getCsvEnd() { return mCsv + strlen(mCsv); }

    static char mCsv[0x8000];
};

#endif /* F_AP_F_AP_GAME_H */