From 53929a233e316790d7dfda3909e02451808f5759 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Sun, 16 Nov 2025 20:32:13 -0600 Subject: [PATCH] feat(console): register vars for color bits and depth bits --- src/console/Device.cpp | 45 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/src/console/Device.cpp b/src/console/Device.cpp index fe529d6..824625a 100644 --- a/src/console/Device.cpp +++ b/src/console/Device.cpp @@ -1,14 +1,16 @@ #include "console/Device.hpp" #include "client/Gui.hpp" -#include "console/Console.hpp" #include "console/CVar.hpp" +#include "console/Console.hpp" #include "event/Input.hpp" #include "gx/Adapter.hpp" #include "gx/Device.hpp" -#include #include +#include static CGxDevice* s_device; +static CVar* s_cvGxColorBits; +static CVar* s_cvGxDepthBits; static CVar* s_cvGxMaximize; static CVar* s_cvGxResolution; static CVar* s_cvGxWidescreen; @@ -19,6 +21,16 @@ static bool s_hwDetect; static bool s_hwChanged; static CGxFormat s_requestedFormat; +bool CVGxColorBitsCallback(CVar*, const char*, const char*, void*) { + // TODO + return true; +} + +bool CVGxDepthBitsCallback(CVar*, const char*, const char*, void*) { + // TODO + return true; +} + bool CVGxMaximizeCallback(CVar*, const char*, const char*, void*) { // TODO return true; @@ -76,8 +88,33 @@ void RegisterGxCVars() { false ); - // TODO s_cvGxColorBits - // TODO s_cvGxDepthBits + char colorBits[260]; + SStrPrintf(colorBits, sizeof(colorBits), "%s", CGxFormat::formatToBitsString[format.colorFormat]); + s_cvGxColorBits = CVar::Register( + "gxColorBits", + "color bits", + 0x1 | 0x2, + colorBits, + &CVGxColorBitsCallback, + GRAPHICS, + false, + nullptr, + false + ); + + char depthBits[260]; + SStrPrintf(depthBits, sizeof(depthBits), "%s", CGxFormat::formatToBitsString[format.depthFormat]); + s_cvGxDepthBits = CVar::Register( + "gxDepthBits", + "depth bits", + 0x1 | 0x2, + depthBits, + &CVGxDepthBitsCallback, + GRAPHICS, + false, + nullptr, + false + ); char resolution[260]; SStrPrintf(resolution, 260, "%dx%d", format.size.x, format.size.y);