feat(gx): Implemented CGxDevice::LogOpen()

The OsCreateDirectory and SlogCreate functions still need to be implemented.
This commit is contained in:
Tristan Cormier 2023-01-19 20:34:51 -05:00
parent 49c938a6be
commit 5acc19abdd
6 changed files with 29 additions and 0 deletions

View File

@ -1,5 +1,6 @@
#include "client/Console.hpp"
#include "gx/Device.hpp"
#include "gx/Gx.hpp"
#include "util/CVar.hpp"
#include <cstring>
@ -148,6 +149,7 @@ void ConsoleInitializeClientCVar(const char* a1) {
}
void ConsoleDeviceInitialize(const char* title) {
GxLogOpen();
// TODO
// TODO proper logic

View File

@ -3,6 +3,7 @@
#include "gx/Shader.hpp"
#include "gx/texture/CGxTex.hpp"
#include "util/SFile.hpp"
#include "util/Filesystem.hpp"
#include <algorithm>
#include <cstring>
#include <limits>
@ -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;

View File

@ -10,6 +10,7 @@
#include "gx/Shader.hpp"
#include <cstdint>
#include <storm/Hash.hpp>
#include <util/Log.hpp>
#include <tempest/Box.hpp>
#include <tempest/Rect.hpp>
@ -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)

View File

@ -94,3 +94,7 @@ void GxFormatColor(CImVector& color) {
color = formattedColor;
}
}
void GxLogOpen() {
CGxDevice::LogOpen();
}

View File

@ -18,4 +18,6 @@ void GxCapsWindowSize(CRect&);
void GxFormatColor(CImVector&);
void GxLogOpen();
#endif

View File

@ -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*, ...);