mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-11 20:11:18 +03:00
Logging cleanup (#69)
* Mac OS X 10.6 & More C++03 Support * Fix SDL2 options.txt loading for C++03 * Output/Logging Overhaul * Added StandardOut class * Renamed LOGX macros to LOG_X * Removed LogMsg macros in favor of LOG_X * Added console window for debug Windows builds * Updated Xcode Project + StandardOut.hpp + StandardOut.cpp * StandardOut_windows * Replaced the Windows #ifdefs in StandardOut with StandardOut_windows --------- Co-authored-by: Brent Da Mage <BrentDaMage@users.noreply.github.com>
This commit is contained in:
@@ -21,45 +21,6 @@ LPCTSTR g_WindowClassName = TEXT("MCPEClass");
|
||||
AppPlatform_windows g_AppPlatform;
|
||||
NinecraftApp* g_pApp;
|
||||
|
||||
void LogMsg(const char* fmt, ...)
|
||||
{
|
||||
va_list lst;
|
||||
va_start(lst, fmt);
|
||||
|
||||
#ifdef _WIN32
|
||||
char buf[10240];
|
||||
vsnprintf(buf, sizeof buf, fmt, lst);
|
||||
buf[sizeof buf - 1] = 0;
|
||||
|
||||
OutputDebugStringA(buf);
|
||||
OutputDebugStringA("\n");
|
||||
#else
|
||||
vfprintf(stderr, fmt, lst);
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
|
||||
va_end(lst);
|
||||
}
|
||||
|
||||
// I hate duplicating code, but yeah
|
||||
void LogMsgNoCR(const char* fmt, ...)
|
||||
{
|
||||
va_list lst;
|
||||
va_start(lst, fmt);
|
||||
|
||||
#ifdef _WIN32
|
||||
char buf[10240];
|
||||
vsnprintf(buf, sizeof buf, fmt, lst);
|
||||
buf[sizeof buf - 1] = 0;
|
||||
|
||||
OutputDebugStringA(buf);
|
||||
#else
|
||||
vfprintf(stderr, fmt, lst);
|
||||
#endif
|
||||
|
||||
va_end(lst);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (iMsg)
|
||||
@@ -162,6 +123,15 @@ void CheckOptionalTextureAvailability()
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
AllocConsole();
|
||||
FILE* ostream;
|
||||
FILE* istream;
|
||||
freopen_s(&ostream, "CONOUT$", "w", stdout);
|
||||
freopen_s(&istream, "CONIN$", "r", stdin);
|
||||
SetConsoleTitle("Minecraft C++ Debug Console");
|
||||
#endif
|
||||
|
||||
SetInstance(hInstance);
|
||||
|
||||
// register the window class:
|
||||
|
||||
Reference in New Issue
Block a user