Add VS trace function

VS OutputDebugString doesn't support %hh* %ll*, so let vsnprint handle it then write a simple string to debug console.
The purpose of this is that its faster than writing logs to a file. (Only when debugging with VS tho).

This can be enabled by defining preprocessor: VS_TRACE_DEBUG
This commit is contained in:
Nemirtingas 2019-07-14 22:53:43 +02:00
parent 0677b8e2ff
commit ba23e904ad
2 changed files with 41 additions and 0 deletions

View file

@ -44,7 +44,12 @@
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
#define PATH_SEPARATOR "\\"
#ifndef EMU_RELEASE_BUILD
#ifdef VS_TRACE_DEBUG
bool _trace(const char* format, ...);
#define PRINT_DEBUG(FMT, ...) _trace(FMT, ##__VA_ARGS__)
#else // VS_TRACE_DEBUG
#define PRINT_DEBUG(a, ...) do {FILE *t = fopen("STEAM_LOG.txt", "a"); fprintf(t, "%u " a, GetCurrentThreadId(), __VA_ARGS__); fclose(t); WSASetLastError(0);} while (0)
#endif // VS_TRACE_DEBUG
#endif
#else
#include <arpa/inet.h>