Path: blob/master/RSDKv5/RSDK/Dev/Debug.hpp
1163 views
#ifndef DEBUG_H1#define DEBUG_H23// These being different sizes will surely cause issues if more then VIEWVAR_LIST_COUNT values are set4// But that's how the code is in the original so what can ya do5#define VIEWVAR_COUNT (0x900)6#define VIEWVAR_LIST_COUNT (0x40)78#include <stdarg.h>910namespace RSDK11{1213enum PrintModes {14PRINT_NORMAL,15PRINT_POPUP,16PRINT_ERROR,17PRINT_FATAL,18#if RETRO_REV0U19PRINT_SCRIPTERR,20#endif21};2223#if !RETRO_USE_ORIGINAL_CODE24enum TouchCornerButtons {25CORNERBUTTON_START,26CORNERBUTTON_LEFTRIGHT,27CORNERBUTTON_SLIDER,28};29#endif3031extern bool32 engineDebugMode;32extern bool32 useEndLine;33extern char outputString[0x400];3435void PrintLog(int32 mode, const char *message, ...);3637#if !RETRO_REV0238enum PrintMessageTypes {39MESSAGE_STRING,40MESSAGE_INT32,41MESSAGE_UINT32,42MESSAGE_FLOAT,43};4445void PrintMessage(void *msg, uint8 type);46#endif4748#if RETRO_REV0249inline void PrintText(int32 mode, const char *message) { PrintLog(mode, "%s", message); }50inline void PrintString(int32 mode, String *message)51{52useEndLine = false;5354for (int32 c = 0; c < message->length; ++c) PrintLog(mode, "%c", message->chars[c]);55PrintLog(mode, "\n");5657useEndLine = true;58}59inline void PrintUInt32(int32 mode, const char *message, uint32 integer) { PrintLog(mode, "%s: %u", message, integer); }60inline void PrintInt32(int32 mode, const char *message, int32 integer) { PrintLog(mode, "%s: %d", message, integer); }61inline void PrintFloat(int32 mode, const char *message, float f) { PrintLog(mode, "%s: %f", message, f); }62inline void PrintVector2(int32 mode, const char *message, Vector2 vec)63{64PrintLog(mode, "%s: <%c%08X, %c%08X>", message, vec.x < 0 ? '-' : ' ', abs(vec.x), vec.y < 0 ? '-' : ' ', abs(vec.y));65}66inline void PrintHitbox(int32 mode, const char *message, Hitbox hitbox)67{68PrintLog(mode, "%s: <l: %d, r: %d, t: %d, b: %d>", message, hitbox.left, hitbox.right, hitbox.top, hitbox.bottom);69}7071struct ViewableVariable {72char name[0x10];73void *value;74int32 type;75int32 size;76int32 min;77int32 max;78};7980typedef enum {81VIEWVAR_INVALID,82VIEWVAR_BOOL,83VIEWVAR_UINT8,84VIEWVAR_UINT16,85VIEWVAR_UINT32,86VIEWVAR_INT8,87VIEWVAR_INT16,88VIEWVAR_INT32,89} ViewableVarTypes;9091typedef enum {92VIEWVAR_DISPLAY_BOOL,93VIEWVAR_DISPLAY_UNSIGNED,94VIEWVAR_DISPLAY_SIGNED,95} DebugVarDisplayTypes;9697extern int32 viewableVarCount;98extern ViewableVariable viewableVarList[VIEWVAR_LIST_COUNT];99100inline void ClearViewableVariables() { viewableVarCount = 0; }101void AddViewableVariable(const char *name, void *value, int32 type, int32 min, int32 max);102#endif103104struct DevMenu {105void (*state)();106int32 selection;107int32 scrollPos;108int32 timer;109bool32 windowed;110int8 sceneState;111int8 listPos;112int8 windowScale;113int8 windowAspect;114#if RETRO_USE_MOD_LOADER115bool32 modsChanged;116uint8 startingVersion;117bool32 modMenuCalled;118#if RETRO_REV0U119int32 playerListPos;120#endif121#endif122};123124extern DevMenu devMenu;125126void DevMenu_MainMenu();127void DevMenu_CategorySelectMenu();128void DevMenu_SceneSelectMenu();129void DevMenu_OptionsMenu();130void DevMenu_VideoOptionsMenu();131void DevMenu_AudioOptionsMenu();132void DevMenu_InputOptionsMenu();133void DevMenu_KeyMappingsMenu();134#if RETRO_REV02135void DevMenu_DebugOptionsMenu();136#endif137#if RETRO_USE_MOD_LOADER138void DevMenu_ModsMenu();139#endif140#if RETRO_REV0U && RETRO_USE_MOD_LOADER141void DevMenu_PlayerSelectMenu();142#endif143144void OpenDevMenu();145void CloseDevMenu();146147#if RETRO_USE_MOD_LOADER148void OpenModMenu();149#endif150151#endif152153} // namespace RSDK154155