diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2f6d494 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.h linguist-language=C++ diff --git a/include/Debug.h b/include/Debug.h new file mode 100644 index 0000000..da76abf --- /dev/null +++ b/include/Debug.h @@ -0,0 +1,28 @@ +/* Debug.h */ +#pragma once + +#include + +/* Comment the following line in order to disable debug mode */ +#define DEBUG + +#ifdef DEBUG + +VOID CreateDebugConsole(); + +#define ERROR_BUF_SIZE (MAX_PATH * 2) +#define GET_FILENAME(Path) \ + (Primitive::StringFindLastChar((PCHAR)Path, '\\') ? \ + Primitive::StringFindLastChar((PCHAR)Path, '\\') + 1 : (PCHAR)Path) + +#define DBGPRINT(STR, ...) \ + if (1) { \ + LPSTR cBuffer = (LPSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ERROR_BUF_SIZE); \ + if (cBuffer){ \ + int Length = wsprintfA(cBuffer, STR, __VA_ARGS__); \ + WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), cBuffer, Length, nullptr, nullptr); \ + HeapFree(GetProcessHeap(), 0, cBuffer); \ + } \ + } + +#endif // DEBUG \ No newline at end of file