summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Dubé <159546+serprex@users.noreply.github.com>2026-08-07 06:36:37 +0000
committerGitHub <noreply@github.com>2026-08-07 06:36:37 +0000
commit7f9d453fff9ab99b0cbfc6cfdcbaaaee879da122 (patch)
tree6c57f0dfcd55f575320938a284f043fb367c3b71
parent6706b49d1ce3a1e4bafbdb6ff896480dc1195664 (diff)
use spdlog::fmt_lib over fmt, opens up SPDLOG_USE_STD_FORMAT in future (#7030)
requires spdlog 1.10
-rw-r--r--CMakeLists.txt3
-rw-r--r--soh/soh/Enhancements/Presets/Presets.cpp17
-rw-r--r--soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp9
-rw-r--r--soh/soh/Enhancements/debugger/actorViewer.cpp4
-rw-r--r--soh/soh/Enhancements/debugger/debugSaveEditor.cpp8
-rw-r--r--soh/soh/Enhancements/gameplaystats.cpp18
-rw-r--r--soh/soh/Enhancements/randomizer/3drando/hints.cpp2
-rw-r--r--soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp5
-rw-r--r--soh/soh/Enhancements/randomizer/item_location.cpp2
-rw-r--r--soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp4
-rw-r--r--soh/soh/Enhancements/speechsynthesizer/SAPISpeechSynthesizer.cpp4
-rw-r--r--soh/soh/Enhancements/timesplits/TimeSplits.cpp3
-rw-r--r--soh/soh/Network/CrowdControl/CrowdControl.cpp1
-rw-r--r--soh/soh/OTRGlobals.cpp4
-rw-r--r--soh/soh/ResourceManagerHelpers.cpp5
-rw-r--r--soh/soh/SohGui/Menu.cpp17
-rw-r--r--soh/soh/SohGui/ResolutionEditor.cpp11
-rw-r--r--soh/soh/SohGui/UIWidgets.cpp10
18 files changed, 67 insertions, 60 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a176a8b24..558a2464d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -216,7 +216,8 @@ endif()
# wins, which leaves libultraship's find_package(spdlog REQUIRED) with no config to find.
# Declaring it here first keeps that working. See HarbourMasters/Torch#233.
if(_use_system_spdlog)
- find_package(spdlog QUIET)
+ # 1.10 is minimum for spdlog::fmt_lib
+ find_package(spdlog 1.10 QUIET)
endif()
if(NOT spdlog_FOUND)
FetchContent_Declare(
diff --git a/soh/soh/Enhancements/Presets/Presets.cpp b/soh/soh/Enhancements/Presets/Presets.cpp
index af7f71d85..9e236e4da 100644
--- a/soh/soh/Enhancements/Presets/Presets.cpp
+++ b/soh/soh/Enhancements/Presets/Presets.cpp
@@ -1,6 +1,7 @@
#include "Presets.h"
#include <string>
#include <fstream>
+#include <spdlog/common.h>
#include <ship/config/Config.h>
#include <nlohmann/json.hpp>
#include <ship/resource/type/Json.h>
@@ -99,7 +100,7 @@ static BlockInfo blockInfo[PRESET_SECTION_MAX] = {
};
std::string FormatPresetPath(std::string name) {
- return fmt::format("{}/{}.json", presetFolder, SanitizeFilename(name));
+ return spdlog::fmt_lib::format("{}/{}.json", presetFolder, SanitizeFilename(name));
}
void applyPreset(std::string presetName, std::vector<PresetSection> includeSections) {
@@ -141,8 +142,8 @@ void applyPreset(std::string presetName, std::vector<PresetSection> includeSecti
}
}
- Ship::Context::GetRawInstance()->GetConfig()->SetBlock(fmt::format("{}.{}", "CVars", item.key()),
- block);
+ Ship::Context::GetRawInstance()->GetConfig()->SetBlock(
+ spdlog::fmt_lib::format("{}.{}", "CVars", item.key()), block);
Ship::Context::GetRawInstance()->GetConsoleVariables()->Load();
}
}
@@ -173,7 +174,7 @@ void DrawPresetSelector(std::vector<PresetSection> includeSections, std::string
ImGui::PopStyleColor();
return;
}
- std::string selectorCvar = fmt::format(CVAR_GENERAL("{}SelectedPreset"), presetLoc);
+ std::string selectorCvar = spdlog::fmt_lib::format(CVAR_GENERAL("{}SelectedPreset"), presetLoc);
std::string currentIndex = CVarGetString(selectorCvar.c_str(), includedPresets[0].c_str());
if (!presets.contains(currentIndex)) {
currentIndex = *includedPresets.begin();
@@ -246,8 +247,8 @@ void LoadPresets() {
try {
std::ifstream ifs(preset.path());
if (auto json = nlohmann::json::parse(ifs); !json.contains("presetName")) {
- spdlog::error(fmt::format("Attempted to load file {} as a preset, but was not a preset file.",
- preset.path().filename().string()));
+ spdlog::error("Attempted to load file {} as a preset, but was not a preset file.",
+ preset.path().filename().string());
} else {
ParsePreset(json, preset.path().filename().stem().string());
}
@@ -326,7 +327,7 @@ void DrawEditPresetPopup() {
(newPresetName.empty() ? "Preset name is empty"
: (noneSelected ? "No sections selected" : "Preset name already exists"));
for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) {
- UIWidgets::Checkbox(fmt::format("Save {}", blockInfo[i].names[0]).c_str(), &saveSection[i],
+ UIWidgets::Checkbox(spdlog::fmt_lib::format("Save {}", blockInfo[i].names[0]).c_str(), &saveSection[i],
UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({ 6.0f, 6.0f }));
}
if (UIWidgets::Button(
@@ -446,7 +447,7 @@ void PresetsCustomWidget(WidgetInfo& info) {
ImGui::TableNextColumn();
for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) {
ImGui::TableNextColumn();
- ImGui::Button(fmt::format("{}##header{}", blockInfo[i].icon, blockInfo[i].names[1]).c_str());
+ ImGui::Button(spdlog::fmt_lib::format("{}##header{}", blockInfo[i].icon, blockInfo[i].names[1]).c_str());
UIWidgets::Tooltip(blockInfo[i].names[0].c_str());
}
UIWidgets::PopStyleButton();
diff --git a/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp b/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp
index 760b9969e..34e84b4f5 100644
--- a/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp
+++ b/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp
@@ -9,6 +9,7 @@
#include <fast/Fast3dGui.h>
#include <libultraship/bridge/consolevariablebridge.h>
#include <ship/Context.h>
+#include <spdlog/common.h>
extern "C" {
#include "macros.h"
@@ -54,20 +55,20 @@ std::string convertDayTime(uint32_t dayTime) {
uint32_t ss = static_cast<uint32_t>(static_cast<double>(dayTime) * (totalSeconds - 1) / 65535);
uint32_t hh = ss / 3600;
uint32_t mm = (ss % 3600) / 60;
- return fmt::format("{:0>2}:{:0>2}", hh, mm);
+ return spdlog::fmt_lib::format("{:0>2}:{:0>2}", hh, mm);
}
std::string convertNaviTime(uint32_t value) {
uint32_t totalSeconds = value / 20;
uint32_t ss = totalSeconds % 60;
uint32_t mm = totalSeconds / 60;
- return fmt::format("{:0>2}:{:0>2}", mm, ss);
+ return spdlog::fmt_lib::format("{:0>2}:{:0>2}", mm, ss);
}
std::string formatHotWaterDisplay(uint32_t value) {
uint32_t ss = value % 60;
uint32_t mm = value / 60;
- return fmt::format("{:0>2}:{:0>2}", mm, ss);
+ return spdlog::fmt_lib::format("{:0>2}:{:0>2}", mm, ss);
}
std::string formatTimeDisplay(uint64_t value) {
@@ -76,7 +77,7 @@ std::string formatTimeDisplay(uint64_t value) {
uint64_t mm = (sec - hh * 3600) / 60;
uint64_t ss = sec - hh * 3600 - mm * 60;
uint64_t ds = value % 10;
- return fmt::format("{}:{:0>2}:{:0>2}.{}", hh, mm, ss, ds);
+ return spdlog::fmt_lib::format("{}:{:0>2}:{:0>2}.{}", hh, mm, ss, ds);
}
static void TimeDisplayGetTimer(uint32_t timeID) {
diff --git a/soh/soh/Enhancements/debugger/actorViewer.cpp b/soh/soh/Enhancements/debugger/actorViewer.cpp
index 79f730a24..48a991375 100644
--- a/soh/soh/Enhancements/debugger/actorViewer.cpp
+++ b/soh/soh/Enhancements/debugger/actorViewer.cpp
@@ -11,7 +11,7 @@
#include <array>
#include <unordered_map>
#include <string>
-#include <spdlog/fmt/fmt.h>
+#include <spdlog/common.h>
#include "soh/OTRGlobals.h"
#include "soh/cvar_prefixes.h"
#include "soh/ObjectExtension/ActorListIndex.h"
@@ -825,7 +825,7 @@ void ActorViewer_AddTagForActor(Actor* actor) {
parts.push_back(acMapping[actor->category]);
}
if (CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayParams"), 0)) {
- parts.push_back(fmt::format("0x{:04X} ({})", (u16)actor->params, actor->params));
+ parts.push_back(spdlog::fmt_lib::format("0x{:04X} ({})", (u16)actor->params, actor->params));
}
std::string tag = "";
diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp
index 074b4ed2e..e33718eaa 100644
--- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp
+++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp
@@ -8,7 +8,7 @@
#include "soh/SohGui/SohGui.hpp"
#include "soh/SaveManager.h"
-#include <spdlog/fmt/fmt.h>
+#include <spdlog/common.h>
#include <array>
#include <bit>
#include <map>
@@ -764,7 +764,7 @@ static void DrawFlagTableSearchResults(const FlagTable& flagTable, ImGuiTextFilt
uint16_t index = static_cast<uint16_t>(row * 16 + flagIndex);
auto descIt = flagTable.flagDescriptions.find(index);
const char* desc = descIt != flagTable.flagDescriptions.end() ? descIt->second : "";
- std::string searchable = fmt::format("0x{:02X} {}", index, desc);
+ std::string searchable = spdlog::fmt_lib::format("0x{:02X} {}", index, desc);
if (!filter.PassFilter(searchable.c_str())) {
continue;
}
@@ -1171,7 +1171,7 @@ void DrawFlagsTab() {
}
}
- ImGui::Text("%s", fmt::format("{:<2X}", j).c_str());
+ ImGui::Text("%s", spdlog::fmt_lib::format("{:<2X}", j).c_str());
switch (flagTable.flagTableType) {
case EVENT_CHECK_INF:
@@ -1925,7 +1925,7 @@ void DrawPlayerTab() {
std::vector<std::vector<std::string>> flag_strs = { state1, state2, state3 };
for (int j = 0; j <= 2; j++) {
- std::string label = fmt::format("State Flags {}", j + 1);
+ std::string label = spdlog::fmt_lib::format("State Flags {}", j + 1);
DrawGroupWithBorder(
[&]() {
ImGui::Text("%s", label.c_str());
diff --git a/soh/soh/Enhancements/gameplaystats.cpp b/soh/soh/Enhancements/gameplaystats.cpp
index 2a647dcef..a2179e2c5 100644
--- a/soh/soh/Enhancements/gameplaystats.cpp
+++ b/soh/soh/Enhancements/gameplaystats.cpp
@@ -9,6 +9,7 @@
#include "soh/util.h"
#include <string>
+#include <spdlog/common.h>
#include "soh/Enhancements/enhancementTypes.h"
#include "soh/OTRGlobals.h"
@@ -260,19 +261,19 @@ std::string formatTimestampGameplayStat(uint32_t value) {
uint32_t mm = (sec - hh * 3600) / 60;
uint32_t ss = sec - hh * 3600 - mm * 60;
uint32_t ds = value % 10;
- return fmt::format("{}:{:0>2}:{:0>2}.{}", hh, mm, ss, ds);
+ return spdlog::fmt_lib::format("{}:{:0>2}:{:0>2}.{}", hh, mm, ss, ds);
}
std::string formatIntGameplayStat(uint32_t value) {
- return fmt::format("{}", value);
+ return spdlog::fmt_lib::format("{}", value);
}
std::string formatHexGameplayStat(uint32_t value) {
- return fmt::format("{:#x} ({:d})", value, value);
+ return spdlog::fmt_lib::format("{:#x} ({:d})", value, value);
}
std::string formatHexOnlyGameplayStat(uint32_t value) {
- return fmt::format("{:#x}", value, value);
+ return spdlog::fmt_lib::format("{:#x}", value, value);
}
extern "C" char* GameplayStats_GetCurrentTime() {
@@ -595,7 +596,8 @@ void DrawGameplayStatsBreakdownTab() {
std::string name;
if (CVarGetInteger(CVAR_GAMEPLAY_STATS("RoomBreakdown"), 0) &&
gSaveContext.ship.stats.sceneTimestamps[i].scene != SCENE_GROTTOS) {
- name = fmt::format("{:s} Room {:d}", sceneName, gSaveContext.ship.stats.sceneTimestamps[i].room);
+ name =
+ spdlog::fmt_lib::format("{:s} Room {:d}", sceneName, gSaveContext.ship.stats.sceneTimestamps[i].room);
} else {
name = sceneName;
}
@@ -619,9 +621,9 @@ void DrawGameplayStatsBreakdownTab() {
}
std::string toPass;
if (CVarGetInteger(CVAR_GAMEPLAY_STATS("RoomBreakdown"), 0) && gSaveContext.ship.stats.sceneNum != SCENE_GROTTOS) {
- toPass = fmt::format("{:s} Room {:d}",
- ResolveSceneID(gSaveContext.ship.stats.sceneNum, gSaveContext.ship.stats.roomNum),
- gSaveContext.ship.stats.roomNum);
+ toPass = spdlog::fmt_lib::format(
+ "{:s} Room {:d}", ResolveSceneID(gSaveContext.ship.stats.sceneNum, gSaveContext.ship.stats.roomNum),
+ gSaveContext.ship.stats.roomNum);
} else {
toPass = ResolveSceneID(gSaveContext.ship.stats.sceneNum, gSaveContext.ship.stats.roomNum);
}
diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp
index cc028c4c8..f16b88a1a 100644
--- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp
+++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp
@@ -769,7 +769,7 @@ void CreateStaticHintFromData(RandomizerHint hint, StaticHintInfo staticData) {
// If we get to here then it means a location got through with no area assignment, which means
// something went wrong elsewhere.
SPDLOG_DEBUG("Attempted to hint location with no areas: ");
- SPDLOG_DEBUG(Rando::StaticData::GetLocation(loc)->GetName());
+ SPDLOG_DEBUG("{}", Rando::StaticData::GetLocation(loc)->GetName());
// assert(false);
areas.push_back(RA_NONE);
} else {
diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp
index c2eacbdbc..ec49f36ad 100644
--- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp
+++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp
@@ -8,7 +8,6 @@
#include "pool_functions.hpp"
#include "soh/Enhancements/randomizer/randomizer_entrance_tracker.h"
#include <nlohmann/json.hpp>
-#include <spdlog/fmt/fmt.h>
#include <spdlog/spdlog.h>
#include <cstdio>
@@ -232,7 +231,7 @@ static void WritePlaythrough() {
auto ctx = Rando::Context::GetInstance();
for (size_t i = 0; i < ctx->playthroughLocations.size(); i++) {
- std::string sphereString = fmt::format("sphere {:0>2}", i);
+ std::string sphereString = spdlog::fmt_lib::format("sphere {:0>2}", i);
for (const RandomizerCheck key : ctx->playthroughLocations[i]) {
if (!ctx->GetItemLocation(key)->IsHidden()) {
WriteLocation(sphereString, key, true);
@@ -245,7 +244,7 @@ static void WritePlaythrough() {
static void WriteShuffledEntrances() {
auto ctx = Rando::Context::GetInstance();
for (size_t i = 0; i < ctx->GetEntranceShuffler()->playthroughEntrances.size(); i++) {
- std::string sphereString = fmt::format("sphere {:0>2}", i);
+ std::string sphereString = spdlog::fmt_lib::format("sphere {:0>2}", i);
for (Entrance* entrance : ctx->GetEntranceShuffler()->playthroughEntrances[i]) {
WriteShuffledEntrance(sphereString, entrance);
}
diff --git a/soh/soh/Enhancements/randomizer/item_location.cpp b/soh/soh/Enhancements/randomizer/item_location.cpp
index 3a4e7d2e0..5164bdff9 100644
--- a/soh/soh/Enhancements/randomizer/item_location.cpp
+++ b/soh/soh/Enhancements/randomizer/item_location.cpp
@@ -91,7 +91,7 @@ RandomizerArea ItemLocation::GetFirstArea() const {
RandomizerArea ItemLocation::GetRandomArea() const {
if (areas.empty()) {
SPDLOG_DEBUG("Attempted to get random area of location with no areas: ");
- SPDLOG_DEBUG(Rando::StaticData::GetLocation(rc)->GetName());
+ SPDLOG_DEBUG("{}", Rando::StaticData::GetLocation(rc)->GetName());
assert(false);
return RA_NONE;
} else {
diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp
index 13bbe75ee..58c9db182 100644
--- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp
+++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp
@@ -24,6 +24,7 @@
#include <sstream>
#include <vector>
#include <set>
+#include <spdlog/common.h>
#include <libultraship/controller/controldeck/ControlDeck.h>
#include "location.h"
#include "item_location.h"
@@ -2305,7 +2306,8 @@ void DrawLocation(RandomizerCheck rc) {
}
if (itemLoc->CanBePurchased() && IsVisibleInCheckTracker(rc) && status == RCSHOW_IDENTIFIED) {
auto price = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->GetPrice();
- txt = !txt.empty() ? fmt::format("{} - {}", txt, price) : fmt::format("{}", price);
+ txt = !txt.empty() ? spdlog::fmt_lib::format("{} - {}", txt, price)
+ : spdlog::fmt_lib::format("{}", price);
}
} else {
if (IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID())) {
diff --git a/soh/soh/Enhancements/speechsynthesizer/SAPISpeechSynthesizer.cpp b/soh/soh/Enhancements/speechsynthesizer/SAPISpeechSynthesizer.cpp
index ccdf20719..f7b160d72 100644
--- a/soh/soh/Enhancements/speechsynthesizer/SAPISpeechSynthesizer.cpp
+++ b/soh/soh/Enhancements/speechsynthesizer/SAPISpeechSynthesizer.cpp
@@ -9,7 +9,7 @@
#include <sapi.h>
#include <thread>
#include <string>
-#include <spdlog/fmt/fmt.h>
+#include <spdlog/common.h>
#include <spdlog/fmt/xchar.h>
ISpVoice* ispVoice = NULL;
@@ -41,7 +41,7 @@ void SpeakThreadTask(std::string text, std::string language) {
auto wText = CharToWideString(text);
auto wLanguage = CharToWideString(language);
- auto speakText = fmt::format(
+ auto speakText = spdlog::fmt_lib::format(
L"<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xml:lang='{}'>{}</speak>", wLanguage, wText);
ispVoice->Speak(speakText.c_str(), SPF_IS_XML | SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL);
}
diff --git a/soh/soh/Enhancements/timesplits/TimeSplits.cpp b/soh/soh/Enhancements/timesplits/TimeSplits.cpp
index e32a2f651..9376419e9 100644
--- a/soh/soh/Enhancements/timesplits/TimeSplits.cpp
+++ b/soh/soh/Enhancements/timesplits/TimeSplits.cpp
@@ -1,5 +1,6 @@
#include <vector>
#include <fstream>
+#include <spdlog/common.h>
#include <ship/Context.h>
#include "TimeSplits.h"
@@ -252,7 +253,7 @@ std::string formatTimestampTimeSplit(uint32_t value) {
uint32_t mm = (sec - hh * 3600) / 60;
uint32_t ss = sec - hh * 3600 - mm * 60;
uint32_t ds = value % 10;
- return fmt::format("{}:{:0>2}:{:0>2}.{}", hh, mm, ss, ds);
+ return spdlog::fmt_lib::format("{}:{:0>2}:{:0>2}.{}", hh, mm, ss, ds);
}
nlohmann::json ImVec4_to_json(const ImVec4& vec) {
diff --git a/soh/soh/Network/CrowdControl/CrowdControl.cpp b/soh/soh/Network/CrowdControl/CrowdControl.cpp
index 49bdc1179..1537d5d6d 100644
--- a/soh/soh/Network/CrowdControl/CrowdControl.cpp
+++ b/soh/soh/Network/CrowdControl/CrowdControl.cpp
@@ -2,7 +2,6 @@
#include "CrowdControlTypes.h"
#include <nlohmann/json.hpp>
#include <spdlog/spdlog.h>
-#include <spdlog/fmt/fmt.h>
#include "soh/ShipInit.hpp"
extern "C" {
diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp
index fea881d86..658bd7afa 100644
--- a/soh/soh/OTRGlobals.cpp
+++ b/soh/soh/OTRGlobals.cpp
@@ -7,6 +7,7 @@
#include <vector>
#include <chrono>
#include <optional>
+#include <spdlog/common.h>
#include <imgui.h>
#include "ResourceManagerHelpers.h"
@@ -751,7 +752,8 @@ void OTRGlobals::RunExtract(int argc, char* argv[]) {
auto filename = std::filesystem::path(file).filename().string();
ImGui::Text("Extracting %s...%s", filename.c_str(),
roundf(progress) == 100.0f ? " Done. Finishing up." : "");
- std::string overlay = extractCount > 0 ? fmt::format("{:.0f}%", progress) : "Starting Up";
+ std::string overlay =
+ extractCount > 0 ? spdlog::fmt_lib::format("{:.0f}%", progress) : "Starting Up";
ImGui::ProgressBar(progress / 100.0f, ImVec2(600.0f, 50.0f), overlay.c_str());
ImGui::EndPopup();
}
diff --git a/soh/soh/ResourceManagerHelpers.cpp b/soh/soh/ResourceManagerHelpers.cpp
index aa7601df5..d3463a34d 100644
--- a/soh/soh/ResourceManagerHelpers.cpp
+++ b/soh/soh/ResourceManagerHelpers.cpp
@@ -20,6 +20,7 @@
#include <ship/resource/ResourceManager.h>
#include <stb_image.h>
+#include <spdlog/common.h>
extern "C" PlayState* gPlayState;
@@ -73,8 +74,8 @@ static const char* ResourceMgr_ResolveLinkTunicDListPath(const char* path) {
return it->second.c_str();
}
- const std::string candidate =
- fmt::format("__OTR__objects/{}_{}/{}", objectFolder, tunicSuffix, originalPath + objectPrefix.size());
+ const std::string candidate = spdlog::fmt_lib::format("__OTR__objects/{}_{}/{}", objectFolder, tunicSuffix,
+ originalPath + objectPrefix.size());
if (!ResourceMgr_IsAltAssetsEnabled() || !ResourceMgr_FileAltExists(candidate.c_str()) ||
!ResourceGetIsCustomByName(candidate.c_str())) {
diff --git a/soh/soh/SohGui/Menu.cpp b/soh/soh/SohGui/Menu.cpp
index 5608ab540..06aa6cf3c 100644
--- a/soh/soh/SohGui/Menu.cpp
+++ b/soh/soh/SohGui/Menu.cpp
@@ -6,7 +6,7 @@
#include <ship/window/gui/GuiElement.h>
#include "SohModals.h"
#include <variant>
-#include <spdlog/fmt/fmt.h>
+#include <spdlog/common.h>
#include <tuple>
extern "C" {
@@ -241,7 +241,7 @@ uint32_t Menu::DrawSearchResults(std::string& menuSearchText) {
MenuDrawItem(info, 400, menuThemeIndex);
ImGui::PushStyleColor(ImGuiCol_Text, UIWidgets::ColorValues.at(UIWidgets::Colors::Gray));
std::string origin =
- fmt::format(" ({} -> {}, Col {})", menuEntry.label, sidebarLabel, i + 1);
+ spdlog::fmt_lib::format(" ({} -> {}, Col {})", menuEntry.label, sidebarLabel, i + 1);
ImGui::Text("%s", origin.c_str());
ImGui::PopStyleColor();
searchCount++;
@@ -268,7 +268,8 @@ uint32_t Menu::DrawSearchResults(std::string& menuSearchText) {
if (widgetStr.find(menuSearchText) != std::string::npos) {
MenuDrawItem(entry.info, 400, menuThemeIndex);
ImGui::PushStyleColor(ImGuiCol_Text, UIWidgets::ColorValues.at(UIWidgets::Colors::Gray));
- std::string origin = fmt::format(" ({} -> {}, {})", entry.menuName, entry.sidebarName, entry.location);
+ std::string origin =
+ spdlog::fmt_lib::format(" ({} -> {}, {})", entry.menuName, entry.sidebarName, entry.location);
ImGui::Text("%s", origin.c_str());
ImGui::PopStyleColor();
searchCount++;
@@ -498,16 +499,12 @@ void Menu::MenuDrawItem(WidgetInfo& widget, uint32_t width, UIWidgets::Colors me
} break;
case WIDGET_WINDOW_BUTTON: {
if (widget.windowName == nullptr || widget.windowName[0] == '\0') {
- std::string msg =
- fmt::format("Error drawing window contents for {}: windowName not defined", widget.name);
- SPDLOG_ERROR(msg.c_str());
+ SPDLOG_ERROR("Error drawing window contents for {}: windowName not defined", widget.name);
break;
}
auto window = Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow(widget.windowName);
if (!window) {
- std::string msg =
- fmt::format("Error drawing window contents: windowName {} does not exist", widget.windowName);
- SPDLOG_ERROR(msg.c_str());
+ SPDLOG_ERROR("Error drawing window contents: windowName {} does not exist", widget.windowName);
break;
}
auto options = std::static_pointer_cast<UIWidgets::WindowButtonOptions>(widget.options);
@@ -925,7 +922,7 @@ void Menu::DrawElement() {
}
}
for (size_t i = 0; i < columnFuncs; i++) {
- std::string sectionId = fmt::format("{} Column {}", sectionMenuId, i);
+ std::string sectionId = spdlog::fmt_lib::format("{} Column {}", sectionMenuId, i);
if (useColumns) {
ImGui::SetNextWindowSizeConstraints({ columnWidth, 0 }, { columnWidth, columnHeight });
ImGui::BeginChild(sectionId.c_str(), { columnWidth, windowHeight * 4 }, ImGuiChildFlags_AutoResizeY,
diff --git a/soh/soh/SohGui/ResolutionEditor.cpp b/soh/soh/SohGui/ResolutionEditor.cpp
index c494f3bdc..fd9871d1f 100644
--- a/soh/soh/SohGui/ResolutionEditor.cpp
+++ b/soh/soh/SohGui/ResolutionEditor.cpp
@@ -1,5 +1,6 @@
#include "ResolutionEditor.h"
#include <imgui.h>
+#include <spdlog/common.h>
#include "soh/SohGui/UIWidgets.hpp"
#include <fast/Fast3dWindow.h>
@@ -195,7 +196,7 @@ void ResolutionCustomWidget(WidgetInfo& info) {
// Integer Scaling
UIWidgets::CVarSliderInt(
- fmt::format("Integer scale factor: {}", max_integerScaleFactor).c_str(),
+ spdlog::fmt_lib::format("Integer scale factor: {}", max_integerScaleFactor).c_str(),
CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.Factor",
UIWidgets::IntSliderOptions(
{ { .disabled = disabled_pixelPerfectMode ||
@@ -388,15 +389,15 @@ void RegisterResolutionWidgets() {
.RaceDisable(false)
.PreFunc([](WidgetInfo& info) {
auto gfx_current_game_window_viewport = GetInterpreter().get()->mGameWindowViewport;
- info.name = fmt::format("Viewport dimensions: {} x {}", gfx_current_game_window_viewport.width,
- gfx_current_game_window_viewport.height);
+ info.name = spdlog::fmt_lib::format("Viewport dimensions: {} x {}", gfx_current_game_window_viewport.width,
+ gfx_current_game_window_viewport.height);
});
mSohMenu->AddWidget(path, "Internal resolution: {} x {}", WIDGET_TEXT)
.RaceDisable(false)
.PreFunc([](WidgetInfo& info) {
auto gfx_current_dimensions = GetInterpreter().get()->mCurDimensions;
- info.name = fmt::format("Internal resolution: {} x {}", gfx_current_dimensions.width,
- gfx_current_dimensions.height);
+ info.name = spdlog::fmt_lib::format("Internal resolution: {} x {}", gfx_current_dimensions.width,
+ gfx_current_dimensions.height);
});
// Activator
diff --git a/soh/soh/SohGui/UIWidgets.cpp b/soh/soh/SohGui/UIWidgets.cpp
index 617809453..988f0b016 100644
--- a/soh/soh/SohGui/UIWidgets.cpp
+++ b/soh/soh/SohGui/UIWidgets.cpp
@@ -4,7 +4,7 @@
#include <string>
#include <unordered_map>
#include <libultraship/libultra/types.h>
-#include <spdlog/fmt/fmt.h>
+#include <spdlog/common.h>
#include "soh/OTRGlobals.h"
namespace UIWidgets {
@@ -1065,7 +1065,7 @@ void DrawFlagArray32(const std::string& name, uint32_t& flags, Colors color) {
bool flag = (flags & bitMask) != 0;
PushStyleCheckbox(color);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4.0f, 3.0f));
- std::string id = fmt::format("##{}{}", name, flagIndex);
+ std::string id = spdlog::fmt_lib::format("##{}{}", name, flagIndex);
if (ImGui::Checkbox(id.c_str(), &flag)) {
if (flag) {
flags |= bitMask;
@@ -1091,7 +1091,7 @@ void DrawFlagArray16(const std::string& name, uint16_t& flags, Colors color) {
bool flag = (flags & bitMask) != 0;
PushStyleCheckbox(color);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4.0f, 3.0f));
- std::string id = fmt::format("##{}{}", name, flagIndex);
+ std::string id = spdlog::fmt_lib::format("##{}{}", name, flagIndex);
if (ImGui::Checkbox(id.c_str(), &flag)) {
if (flag) {
flags |= bitMask;
@@ -1117,7 +1117,7 @@ void DrawFlagArray8(const std::string& name, uint8_t& flags, Colors color) {
bool flag = (flags & bitMask) != 0;
PushStyleCheckbox(color);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4.0f, 3.0f));
- std::string id = fmt::format("##{}{}", name, flagIndex);
+ std::string id = spdlog::fmt_lib::format("##{}{}", name, flagIndex);
if (ImGui::Checkbox(id.c_str(), &flag)) {
if (flag) {
flags |= bitMask;
@@ -1143,7 +1143,7 @@ void DrawFlagArray8Mask(const std::string& name, uint8_t& flags, Colors color) {
bool flag = (flags & bitMask) != 0;
PushStyleCheckbox(color);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4.0f, 3.0f));
- std::string id = fmt::format("##{}{}", name, flagIndex);
+ std::string id = spdlog::fmt_lib::format("##{}{}", name, flagIndex);
if (ImGui::Checkbox(id.c_str(), &flag)) {
if (flag) {
flags |= bitMask;