From c7ccd6dbff2ebe07ff046ad74aefded6523bb14f Mon Sep 17 00:00:00 2001 From: Kenix3 Date: Tue, 9 Aug 2022 21:47:39 -0400 Subject: [PATCH] LUS Cleanup: Strips out the logging system created for the console Properly routes SPDLog to the console. Creates an API to be able to send command responses back to the console. Cleans up the console UI, hiding options when not needed. Removes stdout console sink for Windows. --- libultraship/libultraship/Console.cpp | 158 +++++++++++------- libultraship/libultraship/Console.h | 44 ++--- libultraship/libultraship/Cutscene.cpp | 1 + libultraship/libultraship/GameOverlay.cpp | 11 +- libultraship/libultraship/GlobalCtx2.cpp | 14 +- .../include/spdlog/sinks/sohconsole_sink.h | 37 +--- libultraship/libultraship/Resource.cpp | 1 + soh/soh/Enhancements/debugconsole.cpp | 85 +++++----- .../randomizer/3drando/entrance.cpp | 40 ++--- .../Enhancements/randomizer/3drando/fill.cpp | 28 ++-- .../Enhancements/randomizer/3drando/hints.cpp | 116 ++++++------- .../randomizer/3drando/item_location.cpp | 38 ++--- .../randomizer/3drando/item_pool.cpp | 2 +- .../Enhancements/randomizer/3drando/menu.cpp | 16 +- 14 files changed, 309 insertions(+), 282 deletions(-) diff --git a/libultraship/libultraship/Console.cpp b/libultraship/libultraship/Console.cpp index 83737e738..6990d4343 100644 --- a/libultraship/libultraship/Console.cpp +++ b/libultraship/libultraship/Console.cpp @@ -15,9 +15,9 @@ namespace Ship { std::map BindingToggle; static bool HelpCommand(const std::vector&) { - INFO("SoH Commands:"); + SohImGui::console->SendInfoMessage("SoH Commands:"); for (const auto& cmd : SohImGui::console->Commands) { - INFO("%s", (" - " + cmd.first).c_str()); + SohImGui::console->SendInfoMessage(" - " + cmd.first); } return CMD_SUCCESS; } @@ -45,7 +45,7 @@ namespace Ship { std::ostringstream imploded; std::copy(args.begin() + 2, args.end(), std::ostream_iterator(imploded, delim)); Bindings[k] = imploded.str(); - INFO("Binding '%s' to %s", args[1].c_str(), Bindings[k].c_str()); + SohImGui::console->SendInfoMessage("Binding '%s' to %s", args[1], Bindings[k]); break; } } @@ -61,7 +61,7 @@ namespace Ship { if (toLowerCase(args[1]) == toLowerCase(key)) { BindingToggle[k] = args[2]; - INFO("Binding toggle '%s' to %s", args[1].c_str(), BindingToggle[k].c_str()); + SohImGui::console->SendInfoMessage("Binding toggle '%s' to %s", args[1].c_str(), BindingToggle[k].c_str()); break; } } @@ -159,29 +159,39 @@ namespace Ship { // Renders top bar filters if (ImGui::Button("Clear")) this->Log[this->selected_channel].clear(); - ImGui::SameLine(); - ImGui::SetNextItemWidth(150); - if (ImGui::BeginCombo("##channel", this->selected_channel.c_str())) { - for (const auto& channel : log_channels) { - const bool is_selected = (channel == std::string(this->selected_channel)); - if (ImGui::Selectable(channel.c_str(), is_selected)) - this->selected_channel = channel; - if (is_selected) ImGui::SetItemDefaultFocus(); + + if (CVar_GetS32("gSinkEnabled", 0)) { + ImGui::SameLine(); + ImGui::SetNextItemWidth(150); + if (ImGui::BeginCombo("##channel", this->selected_channel.c_str())) { + for (const auto& channel : log_channels) { + const bool is_selected = (channel == std::string(this->selected_channel)); + if (ImGui::Selectable(channel.c_str(), is_selected)) + this->selected_channel = channel; + if (is_selected) ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); } - ImGui::EndCombo(); + } else { + this->selected_channel = "Console"; } ImGui::SameLine(); ImGui::SetNextItemWidth(150); - if (ImGui::BeginCombo("##level", this->level_filter.c_str())) { - for (const auto& filter : priority_filters) { - const bool is_selected = (filter == std::string(this->level_filter)); - if (ImGui::Selectable(filter.c_str(), is_selected)) - { - this->level_filter = filter; - if (is_selected) ImGui::SetItemDefaultFocus(); + + if (this->selected_channel != "Console") { + if (ImGui::BeginCombo("##level", spdlog::level::to_string_view(this->level_filter).data())) { + for (const auto& priority_filter : priority_filters) { + const bool is_selected = priority_filter == this->level_filter; + if (ImGui::Selectable(spdlog::level::to_string_view(priority_filter).data(), is_selected)) + { + this->level_filter = priority_filter; + if (is_selected) ImGui::SetItemDefaultFocus(); + } } + ImGui::EndCombo(); } - ImGui::EndCombo(); + } else { + this->level_filter = spdlog::level::trace; } ImGui::SameLine(); ImGui::PushItemWidth(-1); @@ -203,7 +213,7 @@ namespace Ship { for (int i = 0; i < static_cast(channel.size()); i++) { ConsoleLine line = channel[i]; if (!this->filter.empty() && line.text.find(this->filter) == std::string::npos) continue; - if (this->level_filter != NULLSTR && line.priority != (std::find(priority_filters.begin(), priority_filters.end(), this->level_filter) - priority_filters.begin()) - 1) continue; + if (this->level_filter > line.priority) continue; std::string id = line.text + "##" + std::to_string(i); ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); @@ -226,54 +236,56 @@ namespace Ship { ImGui::SetScrollHereY(1.0f); ImGui::EndChild(); - // Renders input textfield - constexpr ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackEdit | - ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory; - ImGui::PushItemWidth(-53); - if (ImGui::InputTextWithHint("##CMDInput", ">", this->InputBuffer, MAX_BUFFER_SIZE, flags, &Console::CallbackStub, this)) { - input_focus = true; - if (this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ') - this->Dispatch(std::string(this->InputBuffer)); - memset(this->InputBuffer, 0, MAX_BUFFER_SIZE); - } - - if (this->CMDHint != NULLSTR) { - if (ImGui::IsItemFocused()) { - ImGui::SetNextWindowPos(ImVec2(pos.x, pos.y + size.y)); - ImGui::SameLine(); - ImGui::BeginTooltip(); - ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); - ImGui::TextUnformatted(this->CMDHint.c_str()); - ImGui::PopTextWrapPos(); - ImGui::EndTooltip(); + if (this->selected_channel == "Console") { + // Renders input textfield + constexpr ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackEdit | + ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory; + ImGui::PushItemWidth(-53); + if (ImGui::InputTextWithHint("##CMDInput", ">", this->InputBuffer, MAX_BUFFER_SIZE, flags, &Console::CallbackStub, this)) { + input_focus = true; + if (this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ') + this->Dispatch(std::string(this->InputBuffer)); + memset(this->InputBuffer, 0, MAX_BUFFER_SIZE); } - } - ImGui::SameLine(); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 50); - if (ImGui::Button("Submit") && !input_focus && this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ') { - this->Dispatch(std::string(this->InputBuffer)); - memset(this->InputBuffer, 0, MAX_BUFFER_SIZE); - } + if (this->CMDHint != NULLSTR) { + if (ImGui::IsItemFocused()) { + ImGui::SetNextWindowPos(ImVec2(pos.x, pos.y + size.y)); + ImGui::SameLine(); + ImGui::BeginTooltip(); + ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); + ImGui::TextUnformatted(this->CMDHint.c_str()); + ImGui::PopTextWrapPos(); + ImGui::EndTooltip(); + } + } - ImGui::SetItemDefaultFocus(); - if (input_focus) ImGui::SetKeyboardFocusHere(-1); - ImGui::PopItemWidth(); + ImGui::SameLine(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 50); + if (ImGui::Button("Submit") && !input_focus && this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ') { + this->Dispatch(std::string(this->InputBuffer)); + memset(this->InputBuffer, 0, MAX_BUFFER_SIZE); + } + + ImGui::SetItemDefaultFocus(); + if (input_focus) ImGui::SetKeyboardFocusHere(-1); + ImGui::PopItemWidth(); + } ImGui::End(); } void Console::Dispatch(const std::string& line) { this->CMDHint = NULLSTR; this->History.push_back(line); - this->Log[this->selected_channel].push_back({ "> " + line }); + SendInfoMessage("> " + line); const std::vector cmd_args = StringHelper::Split(line, " "); if (this->Commands.contains(cmd_args[0])) { const CommandEntry entry = this->Commands[cmd_args[0]]; if (!entry.handler(cmd_args) && !entry.arguments.empty()) - this->Log[this->selected_channel].push_back({ "[SOH] Usage: " + cmd_args[0] + " " + BuildUsage(entry), ERROR_LVL }); + SendErrorMessage("[SOH] Usage: " + cmd_args[0] + " " + BuildUsage(entry)); return; } - this->Log[this->selected_channel].push_back({ "[SOH] Command not found", ERROR_LVL }); + SendErrorMessage("[SOH] Command not found"); } int Console::CallbackStub(ImGuiInputTextCallbackData* data) { @@ -325,13 +337,39 @@ namespace Ship { return 0; } - void Console::Append(const std::string& channel, Priority priority, const char* fmt, ...) { - char buf[1024]; - va_list args; - va_start(args, fmt); + void Console::Append(const std::string& channel, spdlog::level::level_enum priority, const char* fmt, va_list args) { + char buf[2048]; vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); buf[IM_ARRAYSIZE(buf) - 1] = 0; - va_end(args); this->Log[channel].push_back({ std::string(buf), priority }); } + + void Console::Append(const std::string& channel, spdlog::level::level_enum priority, const char* fmt, ...) { + va_list args; + va_start(args, fmt); + Append(channel, priority, fmt, args); + va_end(args); + } + + void Console::SendInfoMessage(const char* fmt, ...) { + va_list args; + va_start(args, fmt); + Append("Console", spdlog::level::info, fmt, args); + va_end(args); + } + + void Console::SendErrorMessage(const char* fmt, ...) { + va_list args; + va_start(args, fmt); + Append("Console", spdlog::level::err, fmt, args); + va_end(args); + } + + void Console::SendInfoMessage(const std::string& str) { + Append("Console", spdlog::level::info, str.c_str()); + } + + void Console::SendErrorMessage(const std::string& str) { + Append("Console", spdlog::level::err, str.c_str()); + } } \ No newline at end of file diff --git a/libultraship/libultraship/Console.h b/libultraship/libultraship/Console.h index a174450e1..4a99e5b5b 100644 --- a/libultraship/libultraship/Console.h +++ b/libultraship/libultraship/Console.h @@ -6,12 +6,11 @@ #include #include "Lib/ImGui/imgui.h" +#define NOGDI +#define WIN32_LEAN_AND_MEAN +#include "spdlog/spdlog.h" namespace Ship { - #define LOG(msg, ...) SohImGui::console->Append("Main", Ship::Priority::LOG_LVL, msg, ##__VA_ARGS__) - #define INFO(msg, ...) SohImGui::console->Append("Main", Ship::Priority::INFO_LVL, msg, ##__VA_ARGS__) - #define WARNING(msg, ...) SohImGui::console->Append("Main", Ship::Priority::WARNING_LVL, msg, ##__VA_ARGS__) - #define ERROR(msg, ...) SohImGui::console->Append("Main", Ship::Priority::ERROR_LVL, msg, ##__VA_ARGS__) #define CMD_SUCCESS true #define CMD_FAILED false #define MAX_BUFFER_SIZE 255 @@ -19,13 +18,6 @@ namespace Ship { typedef std::function args)> CommandHandler; - enum Priority { - INFO_LVL, - LOG_LVL, - WARNING_LVL, - ERROR_LVL - }; - enum class ArgumentType { TEXT, NUMBER, PLAYER_POS, PLAYER_ROT }; @@ -44,7 +36,7 @@ namespace Ship { struct ConsoleLine { std::string text; - Priority priority = Priority::INFO_LVL; + spdlog::level::level_enum priority = spdlog::level::info; std::string channel = "Main"; }; @@ -52,15 +44,21 @@ namespace Ship { int selectedId = -1; std::vector selectedEntries; std::string filter; - std::string level_filter = NULLSTR; - std::vector log_channels = { "Main", "SoH Logging" }; - std::vector priority_filters = { "None", "Info", "Log", "Warning", "Error" }; + spdlog::level::level_enum level_filter = spdlog::level::trace; + std::vector log_channels = { "Console", "Logs" }; + std::vector priority_filters = { spdlog::level::off, spdlog::level::critical, spdlog::level::err, spdlog::level::warn, spdlog::level::info, spdlog::level::debug, spdlog::level::trace }; std::vector priority_colors = { - ImVec4(1.0f, 1.0f, 1.0f, 1.0f), - ImVec4(0.2f, 1.0f, 0.2f, 1.0f), - ImVec4(0.9f, 0.8f, 0.4f, 0.01f), - ImVec4(1.0f, 0.2f, 0.2f, 1.0f) + ImVec4(0.8f, 0.8f, 0.8f, 1.0f), // TRACE + ImVec4(0.9f, 0.9f, 0.9f, 1.0f), // DEBUG + ImVec4(1.0f, 1.0f, 1.0f, 1.0f), // INFO + ImVec4(1.0f, 0.875f, 0.125f, 1.0f), // WARN + ImVec4(0.65f, 0.18f, 0.25, 1.0f), // ERROR + ImVec4(0.95f, 0.11f, 0.25, 1.0f), // CRITICAL + ImVec4(0.0f, 0.0f, 0.0f, 0.0f) // OFF }; + protected: + void Append(const std::string& channel, spdlog::level::level_enum priority, const char* fmt, va_list args); + public: std::map> Log; std::map Commands; @@ -71,13 +69,17 @@ namespace Ship { char* InputBuffer = nullptr; bool OpenAutocomplete = false; int HistoryIndex = -1; - std::string selected_channel = "Main"; + std::string selected_channel = "Console"; bool opened = false; void Init(); void Update(); void Draw(); - void Append(const std::string& channel, Priority priority, const char* fmt, ...) IM_FMTARGS(4); void Dispatch(const std::string& line); static int CallbackStub(ImGuiInputTextCallbackData* data); + void SendInfoMessage(const char* fmt, ...); + void SendErrorMessage(const char* fmt, ...); + void SendInfoMessage(const std::string& str); + void SendErrorMessage(const std::string& str); + void Append(const std::string& channel, spdlog::level::level_enum priority, const char* fmt, ...); }; } \ No newline at end of file diff --git a/libultraship/libultraship/Cutscene.cpp b/libultraship/libultraship/Cutscene.cpp index 5ccadbb7b..79b42b3f1 100644 --- a/libultraship/libultraship/Cutscene.cpp +++ b/libultraship/libultraship/Cutscene.cpp @@ -1,4 +1,5 @@ #include "Cutscene.h" +#include "spdlog/spdlog.h" enum class CutsceneCommands { diff --git a/libultraship/libultraship/GameOverlay.cpp b/libultraship/libultraship/GameOverlay.cpp index 00bab575f..e13fbb9fd 100644 --- a/libultraship/libultraship/GameOverlay.cpp +++ b/libultraship/libultraship/GameOverlay.cpp @@ -4,7 +4,6 @@ #include "File.h" #include "Archive.h" #include "ResourceMgr.h" -#include "Console.h" #include "ImGuiImpl.h" #include "Lib/ImGui/imgui_internal.h" #include "Utils/StringHelper.h" @@ -209,24 +208,24 @@ namespace Ship { if (args[1] == "add") { if (!overlay->RegisteredOverlays.contains(key)) { overlay->RegisteredOverlays[key] = new Overlay({ OverlayType::TEXT, ImStrdup(key), -1.0f }); - INFO("Added overlay: %s ", key); + SPDLOG_INFO("Added overlay: {} ", key); } else { - ERROR("Overlay already exists: %s", key); + SPDLOG_ERROR("Overlay already exists: %s", key); } } else if (args[1] == "remove") { if (overlay->RegisteredOverlays.contains(key)) { overlay->RegisteredOverlays.erase(key); - INFO("Removed overlay: %s ", key); + SPDLOG_INFO("Removed overlay: {} ", key); } else { - ERROR("Overlay not found: %s ", key); + SPDLOG_ERROR("Overlay not found: %s ", key); } } } else { - ERROR("CVar %s does not exist", args[2].c_str()); + SPDLOG_ERROR("CVar %s does not exist", args[2].c_str()); } return CMD_SUCCESS; diff --git a/libultraship/libultraship/GlobalCtx2.cpp b/libultraship/libultraship/GlobalCtx2.cpp index 4d6046de3..c5597d7c9 100644 --- a/libultraship/libultraship/GlobalCtx2.cpp +++ b/libultraship/libultraship/GlobalCtx2.cpp @@ -90,12 +90,20 @@ namespace Ship { // Setup Logging spdlog::init_thread_pool(8192, 1); auto SohConsoleSink = std::make_shared(); - auto ConsoleSink = std::make_shared(); - auto FileSink = std::make_shared(logPath, 1024 * 1024 * 10, 10); SohConsoleSink->set_level(spdlog::level::trace); +#if defined(__linux__) + auto ConsoleSink = std::make_shared(); ConsoleSink->set_level(spdlog::level::trace); +#endif + auto FileSink = std::make_shared(logPath, 1024 * 1024 * 10, 10); FileSink->set_level(spdlog::level::trace); - std::vector Sinks{ ConsoleSink, FileSink, SohConsoleSink }; + std::vector Sinks{ +#if defined(__linux__) + ConsoleSink, +#endif + FileSink, + SohConsoleSink + }; Logger = std::make_shared(GetName(), Sinks.begin(), Sinks.end(), spdlog::thread_pool(), spdlog::async_overflow_policy::block); GetLogger()->set_level(spdlog::level::trace); GetLogger()->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%@] [%l] %v"); diff --git a/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h b/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h index 7b5da63fd..65e98610a 100644 --- a/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h +++ b/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h @@ -31,47 +31,24 @@ public: {} protected: - void sink_it_(const details::log_msg &msg) override - { - const Ship::Priority priority = convert_to_soh(msg.level); + void sink_it_(const details::log_msg &msg) override { memory_buf_t formatted; - if (use_raw_msg_) - { + if (use_raw_msg_) { details::fmt_helper::append_string_view(msg.payload, formatted); } - else - { + else { base_sink::formatter_->format(msg, formatted); } formatted.push_back('\0'); - const char *msg_output = formatted.data(); - if (CVar_GetS32("gSinkEnabled", 0) && SohImGui::console->opened) - SohImGui::console->Append("SoH Logging", priority, "%s", msg_output); + const char* msg_output = formatted.data(); + if (CVar_GetS32("gSinkEnabled", 0) && SohImGui::console->opened) { + SohImGui::console->Append("Logs", msg.level, "%s", msg_output); + } } void flush_() override {} private: - static Ship::Priority convert_to_soh(spdlog::level::level_enum level) - { - switch (level) { - case spdlog::level::trace: - return Ship::Priority::INFO_LVL; - case spdlog::level::debug: - return Ship::Priority::LOG_LVL; - case spdlog::level::info: - return Ship::Priority::LOG_LVL; - case spdlog::level::warn: - return Ship::Priority::WARNING_LVL; - case spdlog::level::err: - return Ship::Priority::ERROR_LVL; - case spdlog::level::critical: - return Ship::Priority::ERROR_LVL; - default: - break; - } - return Ship::Priority::LOG_LVL; - } std::string tag_; bool use_raw_msg_; diff --git a/libultraship/libultraship/Resource.cpp b/libultraship/libultraship/Resource.cpp index d3af20667..cbeedb44b 100644 --- a/libultraship/libultraship/Resource.cpp +++ b/libultraship/libultraship/Resource.cpp @@ -1,6 +1,7 @@ #include "Resource.h" #include "DisplayList.h" #include "ResourceMgr.h" +#include "spdlog/spdlog.h" #include "Utils/BinaryReader.h" #include "Lib/tinyxml2/tinyxml2.h" #include "Lib/Fast3D/U64/PR/ultra64/gbi.h" diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index b50c8c9d6..afebd064b 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -34,12 +34,12 @@ extern GlobalContext* gGlobalCtx; static bool ActorSpawnHandler(const std::vector& args) { if ((args.size() != 9) && (args.size() != 3) && (args.size() != 6)) { - ERROR("Not enough arguments passed to actorspawn"); + SPDLOG_ERROR("Not enough arguments passed to actorspawn"); return CMD_FAILED; } if (gGlobalCtx == nullptr) { - ERROR("GlobalCtx == nullptr"); + SPDLOG_ERROR("GlobalCtx == nullptr"); return CMD_FAILED; } @@ -75,7 +75,7 @@ static bool ActorSpawnHandler(const std::vector& args) { if (Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, actorId, spawnPoint.pos.x, spawnPoint.pos.y, spawnPoint.pos.z, spawnPoint.rot.x, spawnPoint.rot.y, spawnPoint.rot.z, params) == NULL) { - ERROR("Failed to spawn actor. Actor_Spawn returned NULL"); + SPDLOG_ERROR("Failed to spawn actor. Actor_Spawn returned NULL"); return CMD_FAILED; } return CMD_SUCCESS; @@ -85,13 +85,13 @@ static bool ActorSpawnHandler(const std::vector& args) { static bool KillPlayerHandler([[maybe_unused]] const std::vector&) { gSaveContext.health = 0; - INFO("[SOH] You've met with a terrible fate, haven't you?"); + SPDLOG_INFO("[SOH] You've met with a terrible fate, haven't you?"); return CMD_SUCCESS; } static bool SetPlayerHealthHandler(const std::vector& args) { if (args.size() != 2) { - ERROR("[SOH] Unexpected arguments passed"); + SPDLOG_ERROR("[SOH] Unexpected arguments passed"); return CMD_FAILED; } @@ -100,18 +100,18 @@ static bool SetPlayerHealthHandler(const std::vector& args) { try { health = std::stoi(args[1]); } catch (std::invalid_argument const& ex) { - ERROR("[SOH] Health value must be an integer."); + SPDLOG_ERROR("[SOH] Health value must be an integer."); return CMD_FAILED; } if (health < 0) { - ERROR("[SOH] Health value must be a positive integer"); + SPDLOG_ERROR("[SOH] Health value must be a positive integer"); return CMD_SUCCESS; } gSaveContext.health = health * 0x10; - INFO("[SOH] Player health updated to %d", health); + SPDLOG_INFO("[SOH] Player health updated to %d", health); return CMD_SUCCESS; } @@ -133,31 +133,31 @@ static bool RuppeHandler(const std::vector& args) { rupeeAmount = std::stoi(args[1]); } catch (std::invalid_argument const& ex) { - ERROR("[SOH] Rupee count must be an integer."); + SPDLOG_ERROR("[SOH] Rupee count must be an integer."); return CMD_FAILED; } if (rupeeAmount < 0) { - ERROR("[SOH] Rupee count must be positive"); + SPDLOG_ERROR("[SOH] Rupee count must be positive"); return CMD_FAILED; } gSaveContext.rupees = rupeeAmount; - INFO("Set rupee count to %u", rupeeAmount); + SPDLOG_INFO("Set rupee count to {}", rupeeAmount); return CMD_SUCCESS; } static bool SetPosHandler(const std::vector args) { if (gGlobalCtx == nullptr) { - ERROR("GlobalCtx == nullptr"); + SPDLOG_ERROR("GlobalCtx == nullptr"); return CMD_FAILED; } Player* player = GET_PLAYER(gGlobalCtx); if (args.size() == 1) { - INFO("Player position is [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x, player->actor.world.pos.y, + SPDLOG_INFO("Player position is [ {:.2f}, {:.2f}, {:.2f} ]", player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z); return CMD_SUCCESS; } @@ -168,14 +168,14 @@ static bool SetPosHandler(const std::vector args) { player->actor.world.pos.y = std::stof(args[2]); player->actor.world.pos.z = std::stof(args[3]); - INFO("Set player position to [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x, player->actor.world.pos.y, + SPDLOG_INFO("Set player position to [ {:.2f}, {:.2f}, {:.2f} ]", player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z); return CMD_SUCCESS; } static bool ResetHandler(std::vector args) { if (gGlobalCtx == nullptr) { - ERROR("GlobalCtx == nullptr"); + SPDLOG_ERROR("GlobalCtx == nullptr"); return CMD_FAILED; } @@ -196,7 +196,7 @@ const static std::map ammoItems{ static bool AmmoHandler(const std::vector& args) { if (args.size() != 3) { - ERROR("[SOH] Unexpected arguments passed"); + SPDLOG_ERROR("[SOH] Unexpected arguments passed"); return CMD_FAILED; } @@ -205,19 +205,19 @@ static bool AmmoHandler(const std::vector& args) { try { count = std::stoi(args[2]); } catch (std::invalid_argument const& ex) { - ERROR("Ammo count must be an integer"); + SPDLOG_ERROR("Ammo count must be an integer"); return CMD_FAILED; } if (count < 0) { - ERROR("Ammo count must be positive"); + SPDLOG_ERROR("Ammo count must be positive"); return CMD_FAILED; } const auto& it = ammoItems.find(args[1]); if (it == ammoItems.end()) { - ERROR("Invalid item passed"); + SPDLOG_ERROR("Invalid item passed"); return CMD_FAILED; } @@ -239,7 +239,7 @@ const static std::map bottleItems{ static bool BottleHandler(const std::vector& args) { if (args.size() != 3) { - ERROR("[SOH] Unexpected arguments passed"); + SPDLOG_ERROR("[SOH] Unexpected arguments passed"); return CMD_FAILED; } @@ -247,19 +247,19 @@ static bool BottleHandler(const std::vector& args) { try { slot = std::stoi(args[2]); } catch (std::invalid_argument const& ex) { - ERROR("[SOH] Bottle slot must be an integer."); + SPDLOG_ERROR("[SOH] Bottle slot must be an integer."); return CMD_FAILED; } if ((slot < 1) || (slot > 4)) { - ERROR("Invalid slot passed"); + SPDLOG_ERROR("Invalid slot passed"); return CMD_FAILED; } const auto& it = bottleItems.find(args[1]); if (it == bottleItems.end()) { - ERROR("Invalid item passed"); + SPDLOG_ERROR("Invalid item passed"); return CMD_FAILED; } @@ -271,7 +271,7 @@ static bool BottleHandler(const std::vector& args) { static bool BHandler(const std::vector& args) { if (args.size() != 2) { - ERROR("[SOH] Unexpected arguments passed"); + SPDLOG_ERROR("[SOH] Unexpected arguments passed"); return CMD_FAILED; } @@ -281,7 +281,7 @@ static bool BHandler(const std::vector& args) { static bool ItemHandler(const std::vector& args) { if (args.size() != 3) { - ERROR("[SOH] Unexpected arguments passed"); + SPDLOG_ERROR("[SOH] Unexpected arguments passed"); return CMD_FAILED; } @@ -292,7 +292,7 @@ static bool ItemHandler(const std::vector& args) { static bool EntranceHandler(const std::vector& args) { if (args.size() != 2) { - ERROR("[SOH] Unexpected arguments passed"); + SPDLOG_ERROR("[SOH] Unexpected arguments passed"); return CMD_FAILED; } @@ -301,7 +301,7 @@ static bool EntranceHandler(const std::vector& args) { try { entrance = std::stoi(args[1], nullptr, 16); } catch (std::invalid_argument const& ex) { - ERROR("[SOH] Entrance value must be a Hex number."); + SPDLOG_ERROR("[SOH] Entrance value must be a Hex number."); return CMD_FAILED; } gGlobalCtx->nextEntranceIndex = entrance; @@ -317,10 +317,10 @@ static bool SaveStateHandler(const std::vector& args) { switch (rtn) { case SaveStateReturn::SUCCESS: - INFO("[SOH] Saved state to slot %u", slot); + SPDLOG_INFO("[SOH] Saved state to slot {}", slot); return CMD_SUCCESS; case SaveStateReturn::FAIL_WRONG_GAMESTATE: - ERROR("[SOH] Can not save a state outside of \"GamePlay\""); + SPDLOG_ERROR("[SOH] Can not save a state outside of \"GamePlay\""); return CMD_FAILED; } @@ -332,16 +332,16 @@ static bool LoadStateHandler(const std::vector& args) { switch (rtn) { case SaveStateReturn::SUCCESS: - INFO("[SOH] Loaded state from slot %u", slot); + SPDLOG_INFO("[SOH] Loaded state from slot ({})", slot); return CMD_SUCCESS; case SaveStateReturn::FAIL_INVALID_SLOT: - ERROR("[SOH] Invalid State Slot Number (%u)", slot); + SPDLOG_ERROR("[SOH] Invalid State Slot Number ({})", slot); return CMD_FAILED; case SaveStateReturn::FAIL_STATE_EMPTY: - ERROR("[SOH] State Slot (%u) is empty", slot); + SPDLOG_ERROR("[SOH] State Slot ({}) is empty", slot); return CMD_FAILED; case SaveStateReturn::FAIL_WRONG_GAMESTATE: - ERROR("[SOH] Can not load a state outside of \"GamePlay\""); + SPDLOG_ERROR("[SOH] Can not load a state outside of \"GamePlay\""); return CMD_FAILED; } @@ -349,7 +349,7 @@ static bool LoadStateHandler(const std::vector& args) { static bool StateSlotSelectHandler(const std::vector& args) { if (args.size() != 2) { - ERROR("[SOH] Unexpected arguments passed"); + SPDLOG_ERROR("[SOH] Unexpected arguments passed"); return CMD_FAILED; } int slot; @@ -357,17 +357,17 @@ static bool StateSlotSelectHandler(const std::vector& args) { try { slot = std::stoi(args[1], nullptr, 10); } catch (std::invalid_argument const& ex) { - ERROR("[SOH] SaveState slot value must be a number."); + SPDLOG_ERROR("[SOH] SaveState slot value must be a number."); return CMD_FAILED; } if (slot < 0) { - ERROR("[SOH] Invalid slot passed. Slot must be between 0 and 2"); + SPDLOG_ERROR("[SOH] Invalid slot passed. Slot must be between 0 and 2"); return CMD_FAILED; } OTRGlobals::Instance->gSaveStateMgr->SetCurrentSlot(slot); - INFO("[SOH] Slot %u selected", OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot()); + SPDLOG_INFO("[SOH] Slot {} selected", OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot()); return CMD_SUCCESS; } @@ -441,17 +441,18 @@ static bool GetCVarHandler(const std::vector& args) { if (cvar != nullptr) { if (cvar->type == CVarType::S32) - INFO("[SOH] Variable %s is %i", args[1].c_str(), cvar->value.valueS32); + SPDLOG_INFO("[SOH] Variable {} is {}", args[1], cvar->value.valueS32); else if (cvar->type == CVarType::Float) - INFO("[SOH] Variable %s is %f", args[1].c_str(), cvar->value.valueFloat); + SPDLOG_INFO("[SOH] Variable {} is {}", args[1], cvar->value.valueFloat); else if (cvar->type == CVarType::String) - INFO("[SOH] Variable %s is %s", args[1].c_str(), cvar->value.valueStr); + SPDLOG_INFO("[SOH] Variable {} is {}", args[1], cvar->value.valueStr); else if (cvar->type == CVarType::RGBA) - INFO("[SOH] Variable %s is %08X", args[1].c_str(), cvar->value.valueRGBA); + SPDLOG_INFO("[SOH] Variable {} is ({}, {}, {}, {})", args[1], cvar->value.valueRGBA.r, + cvar->value.valueRGBA.g, cvar->value.valueRGBA.b, cvar->value.valueRGBA.a); } else { - INFO("[SOH] Could not find variable %s", args[1].c_str()); + SPDLOG_INFO("[SOH] Could not find variable %s", args[1]); } diff --git a/soh/soh/Enhancements/randomizer/3drando/entrance.cpp b/soh/soh/Enhancements/randomizer/3drando/entrance.cpp index 51be29bdf..144759e29 100644 --- a/soh/soh/Enhancements/randomizer/3drando/entrance.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/entrance.cpp @@ -156,7 +156,7 @@ static bool AreEntrancesCompatible(Entrance* entrance, Entrance* target, std::ve //Entrances shouldn't connect to their own scene, fail in this situation if (entrance->GetParentRegion()->scene != "" && entrance->GetParentRegion()->scene == target->GetConnectedRegion()->scene) { auto message = "Entrance " + entrance->GetName() + " attempted to connect with own scene target " + target->to_string() + ". Connection failed.\n"; - SPDLOG_INFO(message); + SPDLOG_DEBUG(message); return false; } @@ -168,7 +168,7 @@ static bool AreEntrancesCompatible(Entrance* entrance, Entrance* target, std::ve //Change connections between an entrance and a target assumed entrance, in order to test the connections afterwards if necessary static void ChangeConnections(Entrance* entrance, Entrance* targetEntrance) { auto message = "Attempting to connect " + entrance->GetName() + " to " + targetEntrance->to_string() + "\n"; - SPDLOG_INFO(message); + SPDLOG_DEBUG(message); entrance->Connect(targetEntrance->Disconnect()); entrance->SetReplacement(targetEntrance->GetReplacement()); if (entrance->GetReverse() != nullptr /*&& entrances aren't decoupled*/) { @@ -208,7 +208,7 @@ static void ConfirmReplacement(Entrance* entrance, Entrance* targetEntrance) { static bool EntranceUnreachableAs(Entrance* entrance, uint8_t age, std::vector& alreadyChecked) { if (entrance == nullptr) { - SPDLOG_INFO("Entrance is nullptr in EntranceUnreachableAs()"); + SPDLOG_DEBUG("Entrance is nullptr in EntranceUnreachableAs()"); return true; } @@ -247,7 +247,7 @@ static bool EntranceUnreachableAs(Entrance* entrance, uint8_t age, std::vectorHasAccess() && !AreaTable(KAKARIKO_VILLAGE)->HasAccess()) { - SPDLOG_INFO("Invalid starting area\n"); + SPDLOG_DEBUG("Invalid starting area\n"); return false; } // Check that a region where time passes is always reachable as both ages without having collected any items if (!Areas::HasTimePassAccess(AGE_CHILD) || !Areas::HasTimePassAccess(AGE_ADULT)) { - SPDLOG_INFO("Time passing is not guaranteed as both ages\n"); + SPDLOG_DEBUG("Time passing is not guaranteed as both ages\n"); return false; } // The player should be able to get back to ToT after going through time, without having collected any items // This is important to ensure that the player never loses access to the pedestal after going through time if (Settings::ResolvedStartingAge == AGE_CHILD && !AreaTable(TEMPLE_OF_TIME)->Adult()) { - SPDLOG_INFO("Path to Temple of Time as adult is not guaranteed\n"); + SPDLOG_DEBUG("Path to Temple of Time as adult is not guaranteed\n"); return false; } else if (Settings::ResolvedStartingAge == AGE_ADULT && !AreaTable(TEMPLE_OF_TIME)->Child()) { - SPDLOG_INFO("Path to Temple of Time as child is not guaranteed\n"); + SPDLOG_DEBUG("Path to Temple of Time as child is not guaranteed\n"); return false; } } @@ -353,11 +353,11 @@ static bool ValidateWorld(Entrance* entrancePlaced) { // This is important to ensure that players can never lock their only bottles by filling them with Big Poes they can't sell if (checkPoeCollectorAccess) { if (!AreaTable(MARKET_GUARD_HOUSE)->Adult()) { - SPDLOG_INFO("Big Poe Shop access is not guarenteed as adult\n"); + SPDLOG_DEBUG("Big Poe Shop access is not guarenteed as adult\n"); return false; } } - SPDLOG_INFO("All Locations NOT REACHABLE\n"); + SPDLOG_DEBUG("All Locations NOT REACHABLE\n"); return false; } return true; @@ -476,7 +476,7 @@ static void ShuffleEntrancePool(std::vector& entrancePool, std::vecto } if (retries <= 0) { - SPDLOG_INFO("Entrance placement attempt count exceeded. Restarting randomization completely"); + SPDLOG_DEBUG("Entrance placement attempt count exceeded. Restarting randomization completely"); entranceShuffleFailure = true; } } @@ -840,7 +840,7 @@ void CreateEntranceOverrides() { if (noRandomEntrances) { return; } - SPDLOG_INFO("\nCREATING ENTRANCE OVERRIDES\n"); + SPDLOG_DEBUG("\nCREATING ENTRANCE OVERRIDES\n"); auto allShuffleableEntrances = GetShuffleableEntrances(EntranceType::All, false); for (Entrance* entrance : allShuffleableEntrances) { @@ -851,7 +851,7 @@ void CreateEntranceOverrides() { } auto message = "Setting " + entrance->to_string() + "\n"; - SPDLOG_INFO(message); + SPDLOG_DEBUG(message); int16_t originalIndex = entrance->GetIndex(); int16_t destinationIndex = entrance->GetReverse()->GetIndex(); @@ -868,9 +868,9 @@ void CreateEntranceOverrides() { }); message = "\tOriginal: " + std::to_string(originalIndex) + "\n"; - SPDLOG_INFO(message); + SPDLOG_DEBUG(message); message = "\tReplacement " + std::to_string(replacementIndex) + "\n"; - SPDLOG_INFO(message); + SPDLOG_DEBUG(message); } } diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index b9cf75518..14bf594c2 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -420,7 +420,7 @@ std::vector GetAccessibleLocations(const std::vector& allowe if (!Location(loc)->IsAddedToPool()) { allLocationsReachable = false; auto message = "Location " + Location(loc)->GetName() + " not reachable\n"; - SPDLOG_INFO(message); + SPDLOG_DEBUG(message); #ifndef ENABLE_DEBUG break; #endif @@ -567,17 +567,17 @@ static void AssumedFill(const std::vector& items, const std::vector allowedLocations.size()) { printf("\x1b[2;2HERROR: MORE ITEMS THAN LOCATIONS IN GIVEN LISTS"); - SPDLOG_INFO("Items:\n"); + SPDLOG_DEBUG("Items:\n"); for (const uint32_t item : items) { - SPDLOG_INFO("\t"); - SPDLOG_INFO(ItemTable(item).GetName().GetEnglish()); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("\t"); + SPDLOG_DEBUG(ItemTable(item).GetName().GetEnglish()); + SPDLOG_DEBUG("\n"); } - SPDLOG_INFO("\nAllowed Locations:\n"); + SPDLOG_DEBUG("\nAllowed Locations:\n"); for (const uint32_t loc : allowedLocations) { - SPDLOG_INFO("\t"); - SPDLOG_INFO(Location(loc)->GetName()); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("\t"); + SPDLOG_DEBUG(Location(loc)->GetName()); + SPDLOG_DEBUG("\n"); } placementFailure = true; return; @@ -627,9 +627,9 @@ static void AssumedFill(const std::vector& items, const std::vector& items, const std::vector& possibleHintLocations) { //return if there aren't any hintable locations or gossip stones available if (possibleHintLocations.empty()) { - SPDLOG_INFO("\tNO LOCATIONS TO HINT\n\n"); + SPDLOG_DEBUG("\tNO LOCATIONS TO HINT\n\n"); return; } uint32_t hintedLocation = RandomElement(possibleHintLocations); const std::vector accessibleGossipStones = GetAccessibleGossipStones(hintedLocation); - SPDLOG_INFO("\tLocation: "); - SPDLOG_INFO(Location(hintedLocation)->GetName()); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("\tLocation: "); + SPDLOG_DEBUG(Location(hintedLocation)->GetName()); + SPDLOG_DEBUG("\n"); - SPDLOG_INFO("\tItem: "); - SPDLOG_INFO(Location(hintedLocation)->GetPlacedItemName().GetEnglish()); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("\tItem: "); + SPDLOG_DEBUG(Location(hintedLocation)->GetPlacedItemName().GetEnglish()); + SPDLOG_DEBUG("\n"); if (accessibleGossipStones.empty()) { - SPDLOG_INFO("\tNO GOSSIP STONES TO PLACE HINT\n\n"); + SPDLOG_DEBUG("\tNO GOSSIP STONES TO PLACE HINT\n\n"); return; } @@ -235,9 +235,9 @@ static void CreateLocationHint(const std::vector& possibleHintLocation Text prefix = Hint(PREFIX).GetText(); Text finalHint = prefix + locationHintText + " #"+itemHintText+"#."; - SPDLOG_INFO("\tMessage: "); - SPDLOG_INFO(finalHint.english); - SPDLOG_INFO("\n\n"); + SPDLOG_DEBUG("\tMessage: "); + SPDLOG_DEBUG(finalHint.english); + SPDLOG_DEBUG("\n\n"); AddHint(finalHint, gossipStone, {QM_GREEN, QM_RED}); } @@ -258,24 +258,24 @@ static void CreateWothHint(uint8_t* remainingDungeonWothHints) { // If no more locations can be hinted at for woth, then just try to get another hint if (possibleHintLocations.empty()) { - SPDLOG_INFO("\tNO LOCATIONS TO HINT\n\n"); + SPDLOG_DEBUG("\tNO LOCATIONS TO HINT\n\n"); return; } uint32_t hintedLocation = RandomElement(possibleHintLocations); - SPDLOG_INFO("\tLocation: "); - SPDLOG_INFO(Location(hintedLocation)->GetName()); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("\tLocation: "); + SPDLOG_DEBUG(Location(hintedLocation)->GetName()); + SPDLOG_DEBUG("\n"); - SPDLOG_INFO("\tItem: "); - SPDLOG_INFO(Location(hintedLocation)->GetPlacedItemName().GetEnglish()); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("\tItem: "); + SPDLOG_DEBUG(Location(hintedLocation)->GetPlacedItemName().GetEnglish()); + SPDLOG_DEBUG("\n"); // get an accessible gossip stone const std::vector gossipStoneLocations = GetAccessibleGossipStones(hintedLocation); if (gossipStoneLocations.empty()) { - SPDLOG_INFO("\tNO GOSSIP STONES TO PLACE HINT\n\n"); + SPDLOG_DEBUG("\tNO GOSSIP STONES TO PLACE HINT\n\n"); return; } Location(hintedLocation)->SetAsHinted(); @@ -293,9 +293,9 @@ static void CreateWothHint(uint8_t* remainingDungeonWothHints) { locationText = GetHintRegion(parentRegion)->GetHint().GetText(); } Text finalWothHint = Hint(PREFIX).GetText() + "#" + locationText + "#" + Hint(WAY_OF_THE_HERO).GetText(); - SPDLOG_INFO("\tMessage: "); - SPDLOG_INFO(finalWothHint.english); - SPDLOG_INFO("\n\n"); + SPDLOG_DEBUG("\tMessage: "); + SPDLOG_DEBUG(finalWothHint.english); + SPDLOG_DEBUG("\n\n"); AddHint(finalWothHint, gossipStone, { QM_LBLUE }); } @@ -312,18 +312,18 @@ static void CreateBarrenHint(uint8_t* remainingDungeonBarrenHints, std::vectorGetName()); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("\tLocation: "); + SPDLOG_DEBUG(Location(hintedLocation)->GetName()); + SPDLOG_DEBUG("\n"); - SPDLOG_INFO("\tItem: "); - SPDLOG_INFO(Location(hintedLocation)->GetPlacedItemName().GetEnglish()); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("\tItem: "); + SPDLOG_DEBUG(Location(hintedLocation)->GetPlacedItemName().GetEnglish()); + SPDLOG_DEBUG("\n"); // get an accessible gossip stone const std::vector gossipStoneLocations = GetAccessibleGossipStones(hintedLocation); if (gossipStoneLocations.empty()) { - SPDLOG_INFO("\tNO GOSSIP STONES TO PLACE HINT\n\n"); + SPDLOG_DEBUG("\tNO GOSSIP STONES TO PLACE HINT\n\n"); return; } Location(hintedLocation)->SetAsHinted(); @@ -341,9 +341,9 @@ static void CreateBarrenHint(uint8_t* remainingDungeonBarrenHints, std::vectorGetName()); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("\tLocation: "); + SPDLOG_DEBUG(Location(hintedLocation)->GetName()); + SPDLOG_DEBUG("\n"); - SPDLOG_INFO("\tItem: "); - SPDLOG_INFO(Location(hintedLocation)->GetPlacedItemName().GetEnglish()); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("\tItem: "); + SPDLOG_DEBUG(Location(hintedLocation)->GetPlacedItemName().GetEnglish()); + SPDLOG_DEBUG("\n"); //get an acessible gossip stone const std::vector gossipStoneLocations = GetAccessibleGossipStones(hintedLocation); if (gossipStoneLocations.empty()) { - SPDLOG_INFO("\tNO GOSSIP STONES TO PLACE HINT\n\n"); + SPDLOG_DEBUG("\tNO GOSSIP STONES TO PLACE HINT\n\n"); return; } Location(hintedLocation)->SetAsHinted(); @@ -387,16 +387,16 @@ static void CreateRandomLocationHint(const bool goodItem = false) { uint32_t parentRegion = Location(hintedLocation)->GetParentRegionKey(); Text locationText = AreaTable(parentRegion)->GetHint().GetText(); Text finalHint = Hint(PREFIX).GetText()+"#"+locationText+"# "+Hint(HOARDS).GetText()+" #"+itemText+"#."; - SPDLOG_INFO("\tMessage: "); - SPDLOG_INFO(finalHint.english); - SPDLOG_INFO("\n\n"); + SPDLOG_DEBUG("\tMessage: "); + SPDLOG_DEBUG(finalHint.english); + SPDLOG_DEBUG("\n\n"); AddHint(finalHint, gossipStone, {QM_GREEN, QM_RED}); } else { Text locationText = GetHintRegion(Location(hintedLocation)->GetParentRegionKey())->GetHint().GetText(); Text finalHint = Hint(PREFIX).GetText()+"#"+itemText+"# "+Hint(CAN_BE_FOUND_AT).GetText()+" #"+locationText+"#."; - SPDLOG_INFO("\tMessage: "); - SPDLOG_INFO(finalHint.english); - SPDLOG_INFO("\n\n"); + SPDLOG_DEBUG("\tMessage: "); + SPDLOG_DEBUG(finalHint.english); + SPDLOG_DEBUG("\n\n"); AddHint(finalHint, gossipStone, {QM_RED, QM_GREEN}); } } @@ -411,15 +411,15 @@ static void CreateJunkHint() { LogicReset(); const std::vector gossipStones = GetAccessibleLocations(gossipStoneLocations); if (gossipStones.empty()) { - SPDLOG_INFO("\tNO GOSSIP STONES TO PLACE HINT\n\n"); + SPDLOG_DEBUG("\tNO GOSSIP STONES TO PLACE HINT\n\n"); return; } uint32_t gossipStone = RandomElement(gossipStones); Text hint = junkHint.GetText(); - SPDLOG_INFO("\tMessage: "); - SPDLOG_INFO(hint.english); - SPDLOG_INFO("\n\n"); + SPDLOG_DEBUG("\tMessage: "); + SPDLOG_DEBUG(hint.english); + SPDLOG_DEBUG("\n\n"); AddHint(hint, gossipStone, {QM_PINK}); } @@ -711,7 +711,7 @@ void CreateAllHints() { CreateGanonText(); CreateAltarText(); - SPDLOG_INFO("\nNOW CREATING HINTS\n"); + SPDLOG_DEBUG("\nNOW CREATING HINTS\n"); const HintSetting& hintSetting = hintSettingTable[Settings::HintDistribution.Value()]; uint8_t remainingDungeonWothHints = hintSetting.dungeonsWothLimit; @@ -768,9 +768,9 @@ void CreateAllHints() { barrenDungeons.push_back(barrenRegion); } } - SPDLOG_INFO("\nBarren Dungeons:\n"); + SPDLOG_DEBUG("\nBarren Dungeons:\n"); for (std::string barrenDungeon : barrenDungeons) { - SPDLOG_INFO(barrenDungeon + "\n"); + SPDLOG_DEBUG(barrenDungeon + "\n"); } //Get list of all woth dungeons @@ -783,9 +783,9 @@ void CreateAllHints() { wothDungeons.push_back(wothRegion); } } - SPDLOG_INFO("\nWoth Dungeons:\n"); + SPDLOG_DEBUG("\nWoth Dungeons:\n"); for (std::string wothDungeon : wothDungeons) { - SPDLOG_INFO(wothDungeon + "\n"); + SPDLOG_DEBUG(wothDungeon + "\n"); } //Set DungeonInfo array for each dungeon @@ -827,9 +827,9 @@ void CreateAllHints() { //get a random hint type from the remaining hints HintType type = RandomElement(remainingHintTypes, true); - SPDLOG_INFO("Attempting to make hint of type: "); - SPDLOG_INFO(hintTypeNames[static_cast(type)]); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("Attempting to make hint of type: "); + SPDLOG_DEBUG(hintTypeNames[static_cast(type)]); + SPDLOG_DEBUG("\n"); //create the appropriate hint for the type if (type == HintType::Woth) { diff --git a/soh/soh/Enhancements/randomizer/3drando/item_location.cpp b/soh/soh/Enhancements/randomizer/3drando/item_location.cpp index 18e5e8acf..27101864b 100644 --- a/soh/soh/Enhancements/randomizer/3drando/item_location.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/item_location.cpp @@ -1460,11 +1460,11 @@ void GenerateLocationPool() { void PlaceItemInLocation(uint32_t locKey, uint32_t item, bool applyEffectImmediately /*= false*/, bool setHidden /*= false*/) { auto loc = Location(locKey); - SPDLOG_INFO("\n"); - SPDLOG_INFO(ItemTable(item).GetName().GetEnglish()); - SPDLOG_INFO(" placed at "); - SPDLOG_INFO(loc->GetName()); - SPDLOG_INFO("\n\n"); + SPDLOG_DEBUG("\n"); + SPDLOG_DEBUG(ItemTable(item).GetName().GetEnglish()); + SPDLOG_DEBUG(" placed at "); + SPDLOG_DEBUG(loc->GetName()); + SPDLOG_DEBUG("\n\n"); if (applyEffectImmediately || Settings::Logic.Is(LOGIC_NONE) || Settings::Logic.Is(LOGIC_VANILLA)) { ItemTable(item).ApplyEffect(); @@ -1551,7 +1551,7 @@ void AddExcludedOptions() { } void CreateItemOverrides() { - SPDLOG_INFO("NOW CREATING OVERRIDES\n\n"); + SPDLOG_DEBUG("NOW CREATING OVERRIDES\n\n"); for (uint32_t locKey : allLocations) { auto loc = Location(locKey); ItemOverride_Value val = ItemTable(loc->GetPlaceduint32_t()).Value(); @@ -1563,18 +1563,18 @@ void CreateItemOverrides() { .key = loc->Key(), .value = val, }); - SPDLOG_INFO("\tScene: "); - SPDLOG_INFO(std::to_string(loc->Key().scene)); - SPDLOG_INFO("\tType: "); - SPDLOG_INFO(std::to_string(loc->Key().type)); - SPDLOG_INFO("\tFlag: "); - SPDLOG_INFO(std::to_string(loc->Key().flag)); - SPDLOG_INFO("\t"); - SPDLOG_INFO(loc->GetName()); - SPDLOG_INFO(": "); - SPDLOG_INFO(loc->GetPlacedItemName().GetEnglish()); - SPDLOG_INFO("\n"); + SPDLOG_DEBUG("\tScene: "); + SPDLOG_DEBUG(std::to_string(loc->Key().scene)); + SPDLOG_DEBUG("\tType: "); + SPDLOG_DEBUG(std::to_string(loc->Key().type)); + SPDLOG_DEBUG("\tFlag: "); + SPDLOG_DEBUG(std::to_string(loc->Key().flag)); + SPDLOG_DEBUG("\t"); + SPDLOG_DEBUG(loc->GetName()); + SPDLOG_DEBUG(": "); + SPDLOG_DEBUG(loc->GetPlacedItemName().GetEnglish()); + SPDLOG_DEBUG("\n"); } - SPDLOG_INFO("Overrides Created: "); - SPDLOG_INFO(std::to_string(overrides.size())); + SPDLOG_DEBUG("Overrides Created: "); + SPDLOG_DEBUG(std::to_string(overrides.size())); } \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp b/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp index b46ad395f..b7ed68ea6 100644 --- a/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp @@ -1174,6 +1174,6 @@ void GenerateItemPool() { } void AddJunk() { - SPDLOG_INFO("HAD TO PLACE EXTRA JUNK "); + SPDLOG_DEBUG("HAD TO PLACE EXTRA JUNK "); AddItemToMainPool(GetPendingJunkItem()); } diff --git a/soh/soh/Enhancements/randomizer/3drando/menu.cpp b/soh/soh/Enhancements/randomizer/3drando/menu.cpp index 7a0c16def..f7699b754 100644 --- a/soh/soh/Enhancements/randomizer/3drando/menu.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/menu.cpp @@ -26,13 +26,13 @@ Menu* currentMenu; } // namespace void PrintTopScreen() { - SPDLOG_INFO("\x1b[2;11H%sOcarina of Time 3D Randomizer%s", CYAN, RESET); - SPDLOG_INFO("\x1b[3;18H%s%s-%s%s", CYAN, RANDOMIZER_VERSION, COMMIT_NUMBER, RESET); - SPDLOG_INFO("\x1b[4;10HA/B/D-pad: Navigate Menu\n"); - SPDLOG_INFO(" Select: Exit to Homebrew Menu\n"); - SPDLOG_INFO(" Y: New Random Seed\n"); - SPDLOG_INFO(" X: Input Custom Seed\n"); - SPDLOG_INFO("\x1b[11;7HCurrent Seed: %s", Settings::seed.c_str()); + SPDLOG_DEBUG("\x1b[2;11H%sOcarina of Time 3D Randomizer%s", CYAN, RESET); + SPDLOG_DEBUG("\x1b[3;18H%s%s-%s%s", CYAN, RANDOMIZER_VERSION, COMMIT_NUMBER, RESET); + SPDLOG_DEBUG("\x1b[4;10HA/B/D-pad: Navigate Menu\n"); + SPDLOG_DEBUG(" Select: Exit to Homebrew Menu\n"); + SPDLOG_DEBUG(" Y: New Random Seed\n"); + SPDLOG_DEBUG(" X: Input Custom Seed\n"); + SPDLOG_DEBUG("\x1b[11;7HCurrent Seed: %s", Settings::seed.c_str()); } void MenuInit() { @@ -526,7 +526,7 @@ std::string GenerateRandomizer(std::unordered_map if (ret == -1) { // Failed to generate after 5 tries printf("\n\nFailed to generate after 5 tries.\nPress B to go back to the menu.\nA different seed might be " "successful."); - SPDLOG_INFO("\nRANDOMIZATION FAILED COMPLETELY. PLZ FIX\n"); + SPDLOG_DEBUG("\nRANDOMIZATION FAILED COMPLETELY. PLZ FIX\n"); return ""; } else { printf("\n\nError %d with fill.\nPress Select to exit or B to go back to the menu.\n", ret);