diff --git a/src/client/Console.cpp b/src/client/Console.cpp index 580bba3..1bad4fc 100644 --- a/src/client/Console.cpp +++ b/src/client/Console.cpp @@ -1,5 +1,6 @@ #include "client/Console.hpp" #include "gx/Device.hpp" +#include "gx/Gx.hpp" #include "util/CVar.hpp" #include @@ -148,6 +149,7 @@ void ConsoleInitializeClientCVar(const char* a1) { } void ConsoleDeviceInitialize(const char* title) { + GxLogOpen(); // TODO // TODO proper logic diff --git a/src/gx/CGxDevice.cpp b/src/gx/CGxDevice.cpp index e98a89e..fae77e6 100644 --- a/src/gx/CGxDevice.cpp +++ b/src/gx/CGxDevice.cpp @@ -3,6 +3,7 @@ #include "gx/Shader.hpp" #include "gx/texture/CGxTex.hpp" #include "util/SFile.hpp" +#include "util/Filesystem.hpp" #include #include #include @@ -70,6 +71,17 @@ uint32_t CGxDevice::s_texFormatBytesPerBlock[] = { 4 // GxTex_D24X8 }; +HSLOG* CGxDevice::m_log = nullptr; +uint32_t CGxDevice::m_logbytes = 0; + +void CGxDevice::LogOpen() { + if (!CGxDevice::m_log) { + OsCreateDirectory("Logs",0); + SLogCreate("Logs\\gx.log",0,CGxDevice::m_log); + CGxDevice::m_logbytes = 0; + } +} + CGxDevice* CGxDevice::NewD3d() { // TODO return nullptr; diff --git a/src/gx/CGxDevice.hpp b/src/gx/CGxDevice.hpp index ba2fa63..eda08dc 100644 --- a/src/gx/CGxDevice.hpp +++ b/src/gx/CGxDevice.hpp @@ -10,6 +10,7 @@ #include "gx/Shader.hpp" #include #include +#include #include #include @@ -44,8 +45,12 @@ class CGxDevice { static uint32_t s_streamPoolSize[]; static uint32_t s_texFormatBitDepth[]; static uint32_t s_texFormatBytesPerBlock[]; + static HSLOG* m_log; + static uint32_t m_logbytes; // Static functions + static void LogOpen(); + static CGxDevice* NewD3d(); static CGxDevice* NewD3d9Ex(); #if defined(WHOA_SYSTEM_MAC) diff --git a/src/gx/Gx.cpp b/src/gx/Gx.cpp index d58a567..47db751 100644 --- a/src/gx/Gx.cpp +++ b/src/gx/Gx.cpp @@ -94,3 +94,7 @@ void GxFormatColor(CImVector& color) { color = formattedColor; } } + +void GxLogOpen() { + CGxDevice::LogOpen(); +} diff --git a/src/gx/Gx.hpp b/src/gx/Gx.hpp index e0c2a3c..b194e8e 100644 --- a/src/gx/Gx.hpp +++ b/src/gx/Gx.hpp @@ -18,4 +18,6 @@ void GxCapsWindowSize(CRect&); void GxFormatColor(CImVector&); +void GxLogOpen(); + #endif diff --git a/src/util/Log.hpp b/src/util/Log.hpp index 5b2e3b6..6b80df5 100644 --- a/src/util/Log.hpp +++ b/src/util/Log.hpp @@ -11,6 +11,10 @@ enum SYSMSG_TYPE { SYSMSG_NUMTYPES = 0x4 }; +struct HSLOG { + int32_t unused; +}; + bool SLogCreate(const char*, uint32_t, void*); void SysMsgPrintf(SYSMSG_TYPE, const char*, ...);