#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; }; struct project_debug { uint32 Markers[8]; uint32 MarkerIndex = 0; uint64 CycleCount[8]; uint64 EndCycleCount[8]; uint64 ExecutionAmount[8]; valtype DebugPropertyType[16]; debugval Val[16]; char *String[16]; uint32 WatchedProperties; 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.WatchedProperties; Debug.String[i] = Name; if (Type == d_float) Debug.Val[i].f = *(real32 *)Address; if (Type == d_uint) Debug.Val[i].u = *(uint32 *)Address; if (Type == d_int) Debug.Val[i].i = *(int32 *)Address; Debug.DebugPropertyType[i] = Type; Debug.WatchedProperties++; } #else #define Assert(Expression) enum valtype { }; union debugval { }; struct project_debug { }; #define DEBUG_CycleCountStart(ID) #define DEBUG_CycleCountEnd(ID) static void DebugWatchVar(char *Name, void *Address, valtype Type) { } #endif