/* Debug utils, you can safely include and use without #ifdef if using capital macros */
#pragma once
#include <Windows.h>
#include <stdio.h>
#include "..\Runtime\Runtime.h"

#ifdef _DEBUG

#define MAX_DEBUG_STRING 8192

VOID OutputDebug(LPSTR strFormat, ...);
VOID HexDump(CHAR *desc, VOID *addr, UINT len);
VOID handleLastError(LPSTR szMessage);
VOID OutputDebugLastError(VOID);
VOID OutputDebugRuntime(PRUNTIME pRuntime, LPSTR strFormat, ...);

#define OUTPUTDEBUG(s, ...) OutputDebug(s, __VA_ARGS__)
#define OUTPUTDEBUGRUNTIME(pRuntime, s, ...) OutputDebugRuntime(pRuntime, s, __VA_ARGS__)
#define HEXDUMP(desc, addr, len) HexDump(desc, addr, len);

#elif _DEBUG_RUNTIME

#include "../Runtime/Runtime.h"

#define OUTPUTDEBUG(s, ...)  pRuntime->pKernel32->fp_OutputDebugStringA(s, __VA_ARGS__)

#else

#define OUTPUTDEBUG(s, ...) printf(s, __VA_ARGS__) //OutputDebug(s, __VA_ARGS__)
#define OUTPUTDEBUG(s, ...) 
#define HEXDUMP(desc, addr, len)

#endif
