#if DEBUG static int32 *debugnull = NULL; #define Assert(Expression) if(!(Expression)) {*debugnull = 21;} enum valtype { d_float, d_uint, d_int }; union debugval { real32 f; uint32 u; int32 i; }; // things that get cleared every frame with the UI struct debug_temp { valtype DebugPropertyType[16]; debugval Val[16]; char *String[16]; uint32 WatchedProperties; }; struct project_debug { debug_temp Temp; bool32 ToggleWindow; }; static project_debug Debug; #if ARM #define DEBUG_CycleCountStart(ID) #define DEBUG_CycleCountEnd(ID) #else #define DEBUG_CycleCountStart(ID) Debug.CycleCount[ID] = __rdtsc(); #define DEBUG_CycleCountEnd(ID) Debug.EndCycleCount[ID] += __rdtsc() - Debug.CycleCount[ID]; Debug.ExecutionAmount[ID]++; #endif static void DebugWatchVar(char *Name, void *Address, valtype Type) { uint32 i = Debug.Temp.WatchedProperties; Debug.Temp.String[i] = Name; if (Type == d_float) Debug.Temp.Val[i].f = *(real32 *)Address; if (Type == d_uint) Debug.Temp.Val[i].u = *(uint32 *)Address; if (Type == d_int) Debug.Temp.Val[i].i = *(int32 *)Address; Debug.Temp.DebugPropertyType[i] = Type; Debug.Temp.WatchedProperties++; } #else #define Assert(Expression) enum valtype { }; union debugval { }; struct debug_temp { }; struct project_debug { }; #define DEBUG_CycleCountStart(ID) #define DEBUG_CycleCountEnd(ID) static void DebugWatchVar(char *Name, void *Address, valtype Type) { } #endif