Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Rubberduckycooly
GitHub Repository: Rubberduckycooly/RSDKv5-Decompilation
Path: blob/master/RSDKv5/RSDK/Dev/Debug.hpp
1163 views
1
#ifndef DEBUG_H
2
#define DEBUG_H
3
4
// These being different sizes will surely cause issues if more then VIEWVAR_LIST_COUNT values are set
5
// But that's how the code is in the original so what can ya do
6
#define VIEWVAR_COUNT (0x900)
7
#define VIEWVAR_LIST_COUNT (0x40)
8
9
#include <stdarg.h>
10
11
namespace RSDK
12
{
13
14
enum PrintModes {
15
PRINT_NORMAL,
16
PRINT_POPUP,
17
PRINT_ERROR,
18
PRINT_FATAL,
19
#if RETRO_REV0U
20
PRINT_SCRIPTERR,
21
#endif
22
};
23
24
#if !RETRO_USE_ORIGINAL_CODE
25
enum TouchCornerButtons {
26
CORNERBUTTON_START,
27
CORNERBUTTON_LEFTRIGHT,
28
CORNERBUTTON_SLIDER,
29
};
30
#endif
31
32
extern bool32 engineDebugMode;
33
extern bool32 useEndLine;
34
extern char outputString[0x400];
35
36
void PrintLog(int32 mode, const char *message, ...);
37
38
#if !RETRO_REV02
39
enum PrintMessageTypes {
40
MESSAGE_STRING,
41
MESSAGE_INT32,
42
MESSAGE_UINT32,
43
MESSAGE_FLOAT,
44
};
45
46
void PrintMessage(void *msg, uint8 type);
47
#endif
48
49
#if RETRO_REV02
50
inline void PrintText(int32 mode, const char *message) { PrintLog(mode, "%s", message); }
51
inline void PrintString(int32 mode, String *message)
52
{
53
useEndLine = false;
54
55
for (int32 c = 0; c < message->length; ++c) PrintLog(mode, "%c", message->chars[c]);
56
PrintLog(mode, "\n");
57
58
useEndLine = true;
59
}
60
inline void PrintUInt32(int32 mode, const char *message, uint32 integer) { PrintLog(mode, "%s: %u", message, integer); }
61
inline void PrintInt32(int32 mode, const char *message, int32 integer) { PrintLog(mode, "%s: %d", message, integer); }
62
inline void PrintFloat(int32 mode, const char *message, float f) { PrintLog(mode, "%s: %f", message, f); }
63
inline void PrintVector2(int32 mode, const char *message, Vector2 vec)
64
{
65
PrintLog(mode, "%s: <%c%08X, %c%08X>", message, vec.x < 0 ? '-' : ' ', abs(vec.x), vec.y < 0 ? '-' : ' ', abs(vec.y));
66
}
67
inline void PrintHitbox(int32 mode, const char *message, Hitbox hitbox)
68
{
69
PrintLog(mode, "%s: <l: %d, r: %d, t: %d, b: %d>", message, hitbox.left, hitbox.right, hitbox.top, hitbox.bottom);
70
}
71
72
struct ViewableVariable {
73
char name[0x10];
74
void *value;
75
int32 type;
76
int32 size;
77
int32 min;
78
int32 max;
79
};
80
81
typedef enum {
82
VIEWVAR_INVALID,
83
VIEWVAR_BOOL,
84
VIEWVAR_UINT8,
85
VIEWVAR_UINT16,
86
VIEWVAR_UINT32,
87
VIEWVAR_INT8,
88
VIEWVAR_INT16,
89
VIEWVAR_INT32,
90
} ViewableVarTypes;
91
92
typedef enum {
93
VIEWVAR_DISPLAY_BOOL,
94
VIEWVAR_DISPLAY_UNSIGNED,
95
VIEWVAR_DISPLAY_SIGNED,
96
} DebugVarDisplayTypes;
97
98
extern int32 viewableVarCount;
99
extern ViewableVariable viewableVarList[VIEWVAR_LIST_COUNT];
100
101
inline void ClearViewableVariables() { viewableVarCount = 0; }
102
void AddViewableVariable(const char *name, void *value, int32 type, int32 min, int32 max);
103
#endif
104
105
struct DevMenu {
106
void (*state)();
107
int32 selection;
108
int32 scrollPos;
109
int32 timer;
110
bool32 windowed;
111
int8 sceneState;
112
int8 listPos;
113
int8 windowScale;
114
int8 windowAspect;
115
#if RETRO_USE_MOD_LOADER
116
bool32 modsChanged;
117
uint8 startingVersion;
118
bool32 modMenuCalled;
119
#if RETRO_REV0U
120
int32 playerListPos;
121
#endif
122
#endif
123
};
124
125
extern DevMenu devMenu;
126
127
void DevMenu_MainMenu();
128
void DevMenu_CategorySelectMenu();
129
void DevMenu_SceneSelectMenu();
130
void DevMenu_OptionsMenu();
131
void DevMenu_VideoOptionsMenu();
132
void DevMenu_AudioOptionsMenu();
133
void DevMenu_InputOptionsMenu();
134
void DevMenu_KeyMappingsMenu();
135
#if RETRO_REV02
136
void DevMenu_DebugOptionsMenu();
137
#endif
138
#if RETRO_USE_MOD_LOADER
139
void DevMenu_ModsMenu();
140
#endif
141
#if RETRO_REV0U && RETRO_USE_MOD_LOADER
142
void DevMenu_PlayerSelectMenu();
143
#endif
144
145
void OpenDevMenu();
146
void CloseDevMenu();
147
148
#if RETRO_USE_MOD_LOADER
149
void OpenModMenu();
150
#endif
151
152
#endif
153
154
} // namespace RSDK
155