From e61aeddb64253a190c3d782cd593f1b74be373e8 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Thu, 28 Nov 2024 17:38:48 -0600 Subject: [PATCH] Fixed compilation and added an option to set the logging config --- src/engine/fox_bg.c | 3 ++- src/port/Engine.cpp | 3 +++ src/port/ui/ImguiUI.cpp | 26 +++++++++++++++++++------- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/engine/fox_bg.c b/src/engine/fox_bg.c index 52392689..9a4ce815 100644 --- a/src/engine/fox_bg.c +++ b/src/engine/fox_bg.c @@ -1417,7 +1417,7 @@ void Background_DrawGround(void) { Matrix_Pop(&gGfxMatrix); break; - case LEVEL_TRAINING: + case LEVEL_TRAINING: { static Vtx trainingGroundVtx_FIX[] = { { { { 4000, 0, -6000 }, 0, { 20947, -19923 }, { 0, 120, 0, 255 } } }, { { { -4000, 0, -6000 }, 0, { 0, -19923 }, { 0, 120, 0, 255 } } }, @@ -1523,6 +1523,7 @@ void Background_DrawGround(void) { prevPlayerPath = gPlayer[gPlayerNum].xPath; prevPlayerPath2 = sp1D4; break; + } case LEVEL_AQUAS: RCP_SetupDL(&gMasterDisp, SETUPDL_20); diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 47ae579f..19597759 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -85,6 +85,9 @@ GameEngine::GameEngine() { this->context = Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3, { 44100, 1024*2, 2480*2 }); + Ship::Context::GetInstance()->GetLogger()->set_level((spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", 1)); + Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v"); + auto loader = context->GetResourceManager()->GetResourceLoader(); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Animation", static_cast(SF64::ResourceType::AnimData), 0); diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index ef9b6f45..5d110b4a 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -488,17 +488,29 @@ void DrawHit64Menu() { } } -const char* debugInfoPages[6] = { - "Object", - "Check Surface", - "Map", - "Stage", - "Effect", - "Enemy", +static const char* debugInfoPages[6] = { + "Object", + "Check Surface", + "Map", + "Stage", + "Effect", + "Enemy", +}; + +static const char* logLevels[] = { + "trace", "debug", "info", "warn", "error", "critical", "off", }; void DrawDebugMenu() { if (UIWidgets::BeginMenu("Developer")) { + if (UIWidgets::CVarCombobox("Log Level", "gDeveloperTools.LogLevel", logLevels, { + .tooltip = "The log level determines which messages are printed to the " + "console. This does not affect the log file output", + .defaultIndex = 1, + })) { + Ship::Context::GetInstance()->GetLogger()->set_level((spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", 1)); + } + UIWidgets::WindowButton("Gfx Debugger", "gGfxDebuggerEnabled", GameUI::mGfxDebuggerWindow, { .tooltip = "Enables the Gfx Debugger window, allowing you to input commands, type help for some examples" });