diff --git a/platforms/windows/AppPlatform_windows.cpp b/platforms/windows/AppPlatform_windows.cpp index 3248b11..90f0d32 100644 --- a/platforms/windows/AppPlatform_windows.cpp +++ b/platforms/windows/AppPlatform_windows.cpp @@ -12,7 +12,7 @@ #include #include "AppPlatform_windows.hpp" -#include "StandardOut_windows.hpp" +#include "Logger_windows.hpp" #include "thirdparty/stb_image.h" #include "thirdparty/stb_image_write.h" @@ -33,14 +33,14 @@ AppPlatform_windows::AppPlatform_windows() m_MouseDiffX = 0, m_MouseDiffY = 0; - // This initializes the StandardOut singleton to use the Windows-specific variant + // This initializes the Logger singleton to use the Windows-specific variant // If we didn't initialize it here, the Minecraft class would have our back - m_standardOut = new StandardOut_windows(); + m_Logger = new Logger_windows(); } AppPlatform_windows::~AppPlatform_windows() { - SAFE_DELETE(m_standardOut); + SAFE_DELETE(m_Logger); } int AppPlatform_windows::checkLicense() diff --git a/platforms/windows/AppPlatform_windows.hpp b/platforms/windows/AppPlatform_windows.hpp index 928c565..2a9002d 100644 --- a/platforms/windows/AppPlatform_windows.hpp +++ b/platforms/windows/AppPlatform_windows.hpp @@ -16,7 +16,7 @@ #include "client/player/input/Mouse.hpp" #include "client/player/input/Keyboard.hpp" #include "common/Utils.hpp" -#include "StandardOut_windows.hpp" +#include "Logger_windows.hpp" class AppPlatform_windows : public AppPlatform { @@ -78,6 +78,6 @@ private: int m_MouseDiffX, m_MouseDiffY; - StandardOut_windows *m_standardOut; + Logger_windows *m_Logger; }; diff --git a/platforms/windows/StandardOut_windows.cpp b/platforms/windows/Logger_windows.cpp similarity index 52% rename from platforms/windows/StandardOut_windows.cpp rename to platforms/windows/Logger_windows.cpp index 935f3f3..7e3cca2 100644 --- a/platforms/windows/StandardOut_windows.cpp +++ b/platforms/windows/Logger_windows.cpp @@ -2,28 +2,28 @@ #include #include -#include "StandardOut_windows.hpp" +#include "Logger_windows.hpp" #include "common/Util.hpp" -void StandardOut_windows::print(const char* const str) +void Logger_windows::print(const char* const str) { - StandardOut::print(str); + Logger::print(str); OutputDebugStringA(str); OutputDebugStringA("\n"); } -void StandardOut_windows::print(std::string str) +void Logger_windows::print(std::string str) { print(str.c_str()); } -void StandardOut_windows::vprintf(const char* const fmt, va_list argPtr) +void Logger_windows::vprintf(const char* const fmt, va_list argPtr) { print(Util::vformat(fmt, argPtr)); } -void StandardOut_windows::printf(const char* const fmt, ...) +void Logger_windows::printf(const char* const fmt, ...) { va_list argList; va_start(argList, fmt); diff --git a/platforms/windows/StandardOut_windows.hpp b/platforms/windows/Logger_windows.hpp similarity index 76% rename from platforms/windows/StandardOut_windows.hpp rename to platforms/windows/Logger_windows.hpp index 89e4807..d74c71b 100644 --- a/platforms/windows/StandardOut_windows.hpp +++ b/platforms/windows/Logger_windows.hpp @@ -1,9 +1,9 @@ #pragma once #include -#include "common/StandardOut.hpp" +#include "common/Logger.hpp" -class StandardOut_windows : StandardOut +class Logger_windows : Logger { void print(const char* const str) override; void print(std::string str) override; diff --git a/platforms/windows/projects/minecraftcpp.vcxproj b/platforms/windows/projects/minecraftcpp.vcxproj index d23ff83..3ce8bfe 100644 --- a/platforms/windows/projects/minecraftcpp.vcxproj +++ b/platforms/windows/projects/minecraftcpp.vcxproj @@ -383,7 +383,7 @@ - + @@ -391,7 +391,7 @@ - + @@ -729,8 +729,8 @@ - - + + diff --git a/source/Minecraft.cpp b/source/Minecraft.cpp index cc003e4..8e0b76d 100644 --- a/source/Minecraft.cpp +++ b/source/Minecraft.cpp @@ -89,7 +89,7 @@ Minecraft::Minecraft() : m_fLastUpdated = 0; m_fDeltaTime = 0; - m_standardOut = new StandardOut(); + m_Logger = new Logger(); #ifndef ORIGINAL_CODE m_pTurnInput = new MouseTurnInput(this); @@ -799,7 +799,7 @@ Minecraft::~Minecraft() SAFE_DELETE(m_pUser); SAFE_DELETE(m_pLevelStorageSource); SAFE_DELETE(m_pTurnInput); - SAFE_DELETE(m_standardOut); + SAFE_DELETE(m_Logger); //@BUG: potentially leaking a CThread instance if this is destroyed early? } diff --git a/source/Minecraft.hpp b/source/Minecraft.hpp index e561aae..32f349f 100644 --- a/source/Minecraft.hpp +++ b/source/Minecraft.hpp @@ -89,7 +89,7 @@ public: static int customDebugId; private: - StandardOut *m_standardOut; + Logger *m_Logger; public: bool field_18; diff --git a/source/common/StandardOut.cpp b/source/common/Logger.cpp similarity index 55% rename from source/common/StandardOut.cpp rename to source/common/Logger.cpp index 39cab17..ebb4339 100644 --- a/source/common/StandardOut.cpp +++ b/source/common/Logger.cpp @@ -1,45 +1,45 @@ #include #include -#include "StandardOut.hpp" +#include "Logger.hpp" #include "Util.hpp" -StandardOut* StandardOut::m_singleton = nullptr; +Logger* Logger::m_singleton = nullptr; -StandardOut* const StandardOut::singleton() +Logger* const Logger::singleton() { return m_singleton; } -StandardOut::StandardOut() +Logger::Logger() { // Stick with the first output handle we get if (!m_singleton) m_singleton = this; } -StandardOut::~StandardOut() +Logger::~Logger() { if (m_singleton == this) m_singleton = nullptr; } -void StandardOut::print(const char* const str) +void Logger::print(const char* const str) { std::cout << str << std::endl; } -void StandardOut::print(std::string str) +void Logger::print(std::string str) { print(str.c_str()); } -void StandardOut::vprintf(const char* const fmt, va_list argPtr) +void Logger::vprintf(const char* const fmt, va_list argPtr) { print(Util::vformat(fmt, argPtr)); } -void StandardOut::printf(const char* const fmt, ...) +void Logger::printf(const char* const fmt, ...) { va_list argList; va_start(argList, fmt); diff --git a/source/common/StandardOut.hpp b/source/common/Logger.hpp similarity index 80% rename from source/common/StandardOut.hpp rename to source/common/Logger.hpp index fe97e98..852568b 100644 --- a/source/common/StandardOut.hpp +++ b/source/common/Logger.hpp @@ -2,15 +2,15 @@ #include -class StandardOut +class Logger { private: - static StandardOut* m_singleton; + static Logger* m_singleton; public: - static StandardOut* const singleton(); + static Logger* const singleton(); - StandardOut(); - ~StandardOut(); + Logger(); + ~Logger(); virtual void print(const char* const str); virtual void print(std::string str); @@ -20,7 +20,7 @@ public: #ifdef _DEBUG -#define LOG(...) StandardOut::singleton()->printf(__VA_ARGS__) +#define LOG(...) Logger::singleton()->printf(__VA_ARGS__) #ifdef PLATFORM_ANDROID #define LOG_I(...) __android_log_print(ANDROID_LOG_INFO, "MinecraftPE", __VA_ARGS__) diff --git a/source/common/Util.cpp b/source/common/Util.cpp index 398b43c..0357c25 100644 --- a/source/common/Util.cpp +++ b/source/common/Util.cpp @@ -46,7 +46,7 @@ std::string Util::stringTrim(const std::string& str) std::string Util::vformat(const char *fmt, va_list argPtr) { - char str[1024]; + char str[8192]; vsnprintf(str, sizeof(str), fmt, argPtr); diff --git a/source/common/Utils.hpp b/source/common/Utils.hpp index 5f921e3..a8b364f 100644 --- a/source/common/Utils.hpp +++ b/source/common/Utils.hpp @@ -84,7 +84,7 @@ void closedir(DIR* dir); #endif #include "../../compat/KeyCodes.hpp" -#include "StandardOut.hpp" +#include "Logger.hpp" // options: #include "../../GameMods.hpp"