diff --git a/.gitmodules b/.gitmodules index cb00ad485..e3d4671e4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,22 +10,10 @@ path = extern/jbus url = ../jbus.git branch = master -[submodule "extern/discord-rpc"] - path = extern/discord-rpc - url = https://github.com/discordapp/discord-rpc.git - branch = master -[submodule "extern/rapidjson"] - path = extern/rapidjson - url = https://github.com/Tencent/rapidjson.git - branch = master [submodule "extern/fixNES"] path = extern/fixNES url = https://github.com/FIX94/fixNES.git branch = master -[submodule "extern/athena"] - path = extern/athena - url = ../../libAthena/athena.git - branch = master [submodule "extern/libjpeg-turbo"] path = extern/libjpeg-turbo url = ../libjpeg-turbo.git @@ -45,3 +33,7 @@ path = extern/aurora url = https://github.com/encounter/aurora.git branch = main +[submodule "extern/spdlog"] + path = extern/spdlog + url = https://github.com/gabime/spdlog.git + branch = v1.x diff --git a/CMakeLists.txt b/CMakeLists.txt index c3496bbf9..d3a5a2000 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,25 +77,6 @@ if (EMSCRIPTEN) set(CMAKE_EXECUTABLE_SUFFIX .html) endif () -string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ATHENA_ARCH) -string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ATHENA_HOST_ARCH) -string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" HOST_PLATFORM_NAME) -string(TOLOWER "${CMAKE_SYSTEM_NAME}" PLATFORM_NAME) -set(ATHENA_EXTENSION "tar.gz") -if (CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin) - set(HOST_PLATFORM_NAME macos) - set(ATHENA_ARCH universal) - set(ATHENA_HOST_ARCH universal) -elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL Windows) - set(HOST_PLATFORM_NAME win32) - set(ATHENA_EXTENSION ".7z") -endif () -if (CMAKE_SYSTEM_NAME STREQUAL Darwin) - set(PLATFORM_NAME macos) -elseif (CMAKE_SYSTEM_NAME STREQUAL Windows) - set(PLATFORM_NAME win32) -endif () - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries) if(APPLE AND NOT CMAKE_OSX_SYSROOT) diff --git a/NESEmulator/CNESEmulator.cpp b/NESEmulator/CNESEmulator.cpp index f28ac81ab..67f644515 100644 --- a/NESEmulator/CNESEmulator.cpp +++ b/NESEmulator/CNESEmulator.cpp @@ -1,7 +1,7 @@ #include "CNESEmulator.hpp" #include "CGameState.hpp" #include "Input/CFinalInput.hpp" -#include "logvisor/logvisor.hpp" +#include "Runtime/Logging.hpp" #include #include #include @@ -168,7 +168,6 @@ int audioUpdate() { namespace metaforce::MP1 { bool CNESEmulator::EmulatorConstructed = false; -static logvisor::Module Log("CNESEmulator"); #define NESEMUP_ROM_OFFSET 0xa3f8 @@ -182,7 +181,7 @@ static logvisor::Module Log("CNESEmulator"); CNESEmulator::CNESEmulator() { if (EmulatorConstructed) - Log.report(logvisor::Fatal, FMT_STRING("Attempted constructing more than 1 CNESEmulator")); + spdlog::fatal("Attempted constructing more than 1 CNESEmulator"); EmulatorConstructed = true; CDvdFile NESEmuFile("NESemuP.rel"); @@ -190,7 +189,7 @@ CNESEmulator::CNESEmulator() { m_nesEmuPBuf.reset(new u8[0x20000]); m_dvdReq = NESEmuFile.AsyncSeekRead(m_nesEmuPBuf.get(), 0x20000, ESeekOrigin::Begin, NESEMUP_ROM_OFFSET); } else { - Log.report(logvisor::Fatal, FMT_STRING("Unable to open NESemuP.rel")); + spdlog::fatal("Unable to open NESemuP.rel"); } } diff --git a/Runtime/AutoMapper/CAutoMapper.cpp b/Runtime/AutoMapper/CAutoMapper.cpp index 5f33b51de..28e090aad 100644 --- a/Runtime/AutoMapper/CAutoMapper.cpp +++ b/Runtime/AutoMapper/CAutoMapper.cpp @@ -1050,15 +1050,15 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager } else { x2fc_textpane_hint->TextSupport().SetText(u""); std::u16string str = - fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x24_lStick[x2e4_lStickPos]); + fmt::format(u"&image=SI,0.6,1.0,{};", g_tweakPlayerRes->x24_lStick[x2e4_lStickPos]); str += g_MainStringTable->GetString(46 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Rotate x300_textpane_instructions->TextSupport().SetText(str); - str = fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos]); + str = fmt::format(u"&image=SI,0.6,1.0,{};", g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos]); str += g_MainStringTable->GetString(47 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Move x304_textpane_instructions1->TextSupport().SetText(str); - str = fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos]); + str = fmt::format(u"&image={};", g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos]); str += g_MainStringTable->GetString(48 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Zoom - str += fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos]); + str += fmt::format(u"&image={};", g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos]); x308_textpane_instructions2->TextSupport().SetText(str); } } @@ -1132,7 +1132,7 @@ void CAutoMapper::Update(float dt, CStateManager& mgr) { std::u16string string; if (x1bc_state == EAutoMapperState::MapScreenUniverse || (x1bc_state == EAutoMapperState::MapScreen && HasCurrentMapUniverseWorld())) - string = fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos]); + string = fmt::format(u"&image={};", g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos]); right1->TextSupport().SetText(string); CGuiTextPane* right = static_cast(x28_frmeMapScreen->FindWidget("textpane_right")); if (x1bc_state == EAutoMapperState::MapScreenUniverse) diff --git a/Runtime/CBasicsPC.cpp b/Runtime/CBasicsPC.cpp index 0d78f70f4..9afabf186 100644 --- a/Runtime/CBasicsPC.cpp +++ b/Runtime/CBasicsPC.cpp @@ -30,10 +30,8 @@ #endif #include "Runtime/CBasics.hpp" - #include "Runtime/CStopwatch.hpp" - -#include +#include "Runtime/Logging.hpp" #if __APPLE__ static u64 MachToDolphinNum; @@ -43,7 +41,6 @@ static LARGE_INTEGER PerfFrequency; #endif namespace metaforce { -static logvisor::Module LogModule("metaforce::CBasics"); void CBasics::Initialize() { CStopwatch::InitGlobalTimer(); #if __APPLE__ @@ -352,11 +349,11 @@ void CBasics::MakeDir(const char* dir) { const nowide::wstackstring wdir(dir); if (!CreateDirectoryW(wdir.get(), NULL)) if ((err = GetLastError()) != ERROR_ALREADY_EXISTS) - LogModule.report(logvisor::Fatal, FMT_STRING("MakeDir({})"), dir); + LogModule.report(logvisor::Fatal, "MakeDir({})", dir); #else if (mkdir(dir, 0755)) if (errno != EEXIST) - LogModule.report(logvisor::Fatal, FMT_STRING("MakeDir({}): {}"), dir, strerror(errno)); + spdlog::fatal("MakeDir({}): {}", dir, strerror(errno)); #endif } diff --git a/Runtime/CDvdFile.cpp b/Runtime/CDvdFile.cpp index 297d8fb0c..a6d74caf6 100644 --- a/Runtime/CDvdFile.cpp +++ b/Runtime/CDvdFile.cpp @@ -154,7 +154,6 @@ void CDvdFile::DoWork() { void CDvdFile::WorkerProc() { #ifdef HAS_DVD_THREAD - logvisor::RegisterThreadName("CDvdFile"); OPTICK_THREAD("CDvdFile"); while (m_WorkerRun.load()) { diff --git a/Runtime/CGameAllocator.cpp b/Runtime/CGameAllocator.cpp index 71369a62d..4f590d839 100644 --- a/Runtime/CGameAllocator.cpp +++ b/Runtime/CGameAllocator.cpp @@ -1,10 +1,7 @@ #include "Runtime/CGameAllocator.hpp" - -#include +#include "Runtime/Logging.hpp" namespace metaforce { -static logvisor::Module Log("metaforce::CGameAllocator"); - #pragma GCC diagnostic ignored "-Wclass-memaccess" std::vector CGameAllocator::m_allocations; @@ -46,8 +43,7 @@ u8* CGameAllocator::Alloc(size_t len) { void CGameAllocator::Free(u8* ptr) { SChunkDescription* info = reinterpret_cast(ptr - sizeof(SChunkDescription)); if (info->magic != 0xE8E8E8E8 || info->sentinal != 0xEFEFEFEF) { - Log.report(logvisor::Fatal, FMT_STRING("Invalid chunk description, memory corruption!")); - return; + spdlog::fatal("Invalid chunk description, memory corruption!"); } SAllocationDescription& alloc = *info->parent; diff --git a/Runtime/CInGameTweakManagerBase.hpp b/Runtime/CInGameTweakManagerBase.hpp index 7c75ea903..61f1be945 100644 --- a/Runtime/CInGameTweakManagerBase.hpp +++ b/Runtime/CInGameTweakManagerBase.hpp @@ -5,6 +5,7 @@ #include #include "Runtime/RetroTypes.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { @@ -69,7 +70,7 @@ public: bool ReadFromMemoryCard(std::string_view name) { return true; } static std::string GetIdentifierForMidiEvent(CAssetId world, CAssetId area, std::string_view midiObj) { - return fmt::format(FMT_STRING("World {} Area {} MidiObject: {}"), world, area, midiObj); + return fmt::format("World {} Area {} MidiObject: {}", world, area, midiObj); } }; diff --git a/Runtime/CInfiniteLoopDetector.cpp b/Runtime/CInfiniteLoopDetector.cpp index 0d4c2b56c..a06cab53f 100644 --- a/Runtime/CInfiniteLoopDetector.cpp +++ b/Runtime/CInfiniteLoopDetector.cpp @@ -1,9 +1,8 @@ #include "Runtime/CInfiniteLoopDetector.hpp" -#include +#include "Runtime/Logging.hpp" namespace metaforce { namespace { -logvisor::Module Log("CInfiniteLoopDetector"); std::chrono::system_clock::time_point g_WatchDog = std::chrono::system_clock::now(); std::mutex g_mutex; } // namespace @@ -22,7 +21,7 @@ void CInfiniteLoopDetector::run() { std::lock_guard guard(g_mutex); if (std::chrono::duration_cast(std::chrono::system_clock::now() - g_WatchDog) > std::chrono::milliseconds(m_duration)) { - Log.report(logvisor::Fatal, FMT_STRING("INFINITE LOOP DETECTED!")); + spdlog::fatal("INFINITE LOOP DETECTED!"); } } } diff --git a/Runtime/CMain.cpp b/Runtime/CMain.cpp index af2fca73b..728825a3f 100644 --- a/Runtime/CMain.cpp +++ b/Runtime/CMain.cpp @@ -9,9 +9,8 @@ #include "Runtime/ConsoleVariables/FileStoreManager.hpp" #include "Runtime/ConsoleVariables/CVarManager.hpp" #include "Runtime/CInfiniteLoopDetector.hpp" -//#include "amuse/BooBackend.hpp" - -#include "logvisor/logvisor.hpp" +#include "Runtime/Logging.hpp" +// #include "amuse/BooBackend.hpp" #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN @@ -113,8 +112,6 @@ private: extern std::string ExeDir; namespace metaforce { -static logvisor::Module Log{"Metaforce"}; - std::optional g_mainMP1; static std::string CPUFeatureString(const zeus::CPUInfo& cpuInf) { @@ -160,8 +157,8 @@ private: std::string m_deferredProject; bool m_projectInitialized = false; - //std::optional m_amuseAllocWrapper; - //std::unique_ptr m_voiceEngine; + // std::optional m_amuseAllocWrapper; + // std::unique_ptr m_voiceEngine; Limiter m_limiter{}; @@ -187,12 +184,11 @@ public: void onAppLaunched(const AuroraInfo& info) noexcept { initialize(); - VISetWindowTitle( - fmt::format(FMT_STRING("Metaforce {} [{}]"), METAFORCE_WC_DESCRIBE, backend_name(info.backend)).c_str()); + VISetWindowTitle(fmt::format("Metaforce {} [{}]", METAFORCE_WC_DESCRIBE, backend_name(info.backend)).c_str()); -// m_voiceEngine = boo::NewAudioVoiceEngine("metaforce", "Metaforce"); -// m_voiceEngine->setVolume(0.7f); -// m_amuseAllocWrapper.emplace(*m_voiceEngine); + // m_voiceEngine = boo::NewAudioVoiceEngine("metaforce", "Metaforce"); + // m_voiceEngine->setVolume(0.7f); + // m_amuseAllocWrapper.emplace(*m_voiceEngine); #if TARGET_OS_IOS || TARGET_OS_TV m_deferredProject = std::string{m_fileMgr.getStoreRoot()} + "game.iso"; @@ -208,16 +204,16 @@ public: } #endif - //m_voiceEngine->startPump(); + // m_voiceEngine->startPump(); } void initialize() { zeus::detectCPU(); const zeus::CPUInfo& cpuInf = zeus::cpuFeatures(); - Log.report(logvisor::Info, FMT_STRING("CPU Name: {}"), cpuInf.cpuBrand); - Log.report(logvisor::Info, FMT_STRING("CPU Vendor: {}"), cpuInf.cpuVendor); - Log.report(logvisor::Info, FMT_STRING("CPU Features: {}"), CPUFeatureString(cpuInf)); + spdlog::info("CPU Name: {}", cpuInf.cpuBrand); + spdlog::info("CPU Vendor: {}", cpuInf.cpuVendor); + spdlog::info("CPU Features: {}", CPUFeatureString(cpuInf)); } void onSdlEvent(const SDL_Event& event) noexcept { @@ -244,13 +240,13 @@ public: #endif if (!m_projectInitialized && !m_deferredProject.empty()) { - Log.report(logvisor::Info, FMT_STRING("Loading game from '{}'"), m_deferredProject); + spdlog::info("Loading game from '{}'", m_deferredProject); if (CDvdFile::Initialize(m_deferredProject)) { m_projectInitialized = true; m_cvarCommons.m_lastDiscPath->fromLiteral(m_deferredProject); } else { - Log.report(logvisor::Error, FMT_STRING("Failed to open disc image '{}'"), m_deferredProject); - m_imGuiConsole.m_errorString = fmt::format(FMT_STRING("Failed to open disc image '{}'"), m_deferredProject); + spdlog::error("Failed to open disc image '{}'", m_deferredProject); + m_imGuiConsole.m_errorString = fmt::format("Failed to open disc image '{}'", m_deferredProject); } m_deferredProject.clear(); } @@ -292,10 +288,9 @@ public: if (!g_mainMP1 && m_projectInitialized) { g_mainMP1.emplace(nullptr, nullptr); - auto result = - g_mainMP1->Init(m_argc, m_argv, m_fileMgr, &m_cvarManager); + auto result = g_mainMP1->Init(m_argc, m_argv, m_fileMgr, &m_cvarManager); if (!result.empty()) { - Log.report(logvisor::Error, FMT_STRING("{}"), result); + spdlog::error("{}", result); m_imGuiConsole.m_errorString = result; g_mainMP1.reset(); CDvdFile::Shutdown(); @@ -311,15 +306,15 @@ public: m_imGuiConsole.PreUpdate(); if (g_mainMP1) { -// if (m_voiceEngine) { -// m_voiceEngine->lockPump(); -// } + // if (m_voiceEngine) { + // m_voiceEngine->lockPump(); + // } if (g_mainMP1->Proc(dt)) { return false; } -// if (m_voiceEngine) { -// m_voiceEngine->unlockPump(); -// } + // if (m_voiceEngine) { + // m_voiceEngine->unlockPump(); + // } } m_imGuiConsole.PostUpdate(); if (!g_mainMP1 && m_imGuiConsole.m_gameDiscSelected) { @@ -358,7 +353,6 @@ public: CDvdFile::DoWork(); #endif CGraphics::TickRenderTimings(); - ++logvisor::FrameIndex; } void onAppWindowResized(const AuroraWindowSize& size) noexcept { @@ -370,7 +364,8 @@ public: } void onAppWindowMoved(const AuroraWindowPos& pos) { - if (pos.x > 0 && pos.y > 0 && (pos.x != m_cvarCommons.getWindowPos().x || pos.y != m_cvarCommons.getWindowPos().y)) { + if (pos.x > 0 && pos.y > 0 && + (pos.x != m_cvarCommons.getWindowPos().x || pos.y != m_cvarCommons.getWindowPos().y)) { m_cvarCommons.m_windowPos->fromVec2i(zeus::CVector2i(pos.x, pos.y)); } } @@ -383,17 +378,17 @@ public: void onAppExiting() noexcept { m_imGuiConsole.Shutdown(); -// if (m_voiceEngine) { -// m_voiceEngine->unlockPump(); -// m_voiceEngine->stopPump(); -// } + // if (m_voiceEngine) { + // m_voiceEngine->unlockPump(); + // m_voiceEngine->stopPump(); + // } if (g_mainMP1) { g_mainMP1->Shutdown(); } g_mainMP1.reset(); m_cvarManager.serialize(); -// m_amuseAllocWrapper.reset(); -// m_voiceEngine.reset(); + // m_amuseAllocWrapper.reset(); + // m_voiceEngine.reset(); CDvdFile::Shutdown(); } @@ -415,12 +410,11 @@ static void SetupBasics() { auto result = zeus::validateCPU(); if (!result.first) { #if _WIN32 && !WINDOWS_STORE - std::string msg = - fmt::format(FMT_STRING("ERROR: This build of Metaforce requires the following CPU features:\n{}\n"), - metaforce::CPUFeatureString(result.second)); + std::string msg = fmt::format("ERROR: This build of Metaforce requires the following CPU features:\n{}\n", + metaforce::CPUFeatureString(result.second)); MessageBoxW(nullptr, nowide::widen(msg).c_str(), L"CPU error", MB_OK | MB_ICONERROR); #else - fmt::print(stderr, FMT_STRING("ERROR: This build of Metaforce requires the following CPU features:\n{}\n"), + fmt::print(stderr, "ERROR: This build of Metaforce requires the following CPU features:\n{}\n", metaforce::CPUFeatureString(result.second)); #endif exit(1); @@ -449,27 +443,30 @@ static std::unique_ptr g_app; static SDL_Window* g_window; static bool g_paused; -static void aurora_log_callback(AuroraLogLevel level, const char* message, unsigned int len) { - logvisor::Level severity = logvisor::Fatal; +static void aurora_log_callback(AuroraLogLevel level, const char* module, const char* message, unsigned int len) { + spdlog::level::level_enum severity = spdlog::level::critical; switch (level) { case LOG_DEBUG: + severity = spdlog::level::debug; + break; case LOG_INFO: - severity = logvisor::Info; + severity = spdlog::level::info; break; case LOG_WARNING: - severity = logvisor::Warning; + severity = spdlog::level::warn; break; case LOG_ERROR: - severity = logvisor::Error; + severity = spdlog::level::err; break; default: break; } + const std::string_view view(message, len); if (level == LOG_FATAL) { - auto msg = fmt::format(FMT_STRING("Metaforce encountered an internal error:\n\n{}"), message); + auto msg = fmt::format("Metaforce encountered an internal error:\n\n{}", view); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Metaforce", msg.c_str(), g_window); } - metaforce::Log.report(severity, FMT_STRING("{}"), message); + spdlog::log(severity, "[{}] {}", module, view); } static void aurora_imgui_init_callback(const AuroraWindowSize* size) { g_app->onImGuiInit(size->scale); } @@ -481,7 +478,7 @@ int main(int argc, char** argv) { // for now it's disabled // fesetround(FE_TOWARDZERO); if (argc > 1 && !strcmp(argv[1], "--dlpackage")) { - fmt::print(FMT_STRING("{}\n"), METAFORCE_DLPACKAGE); + fmt::print("{}\n", METAFORCE_DLPACKAGE); return 100; } @@ -507,30 +504,29 @@ int main(int argc, char** argv) { if (!restart) { // TODO add clear loggers func to logvisor so we can recreate loggers on restart bool logging = IsClientLoggingEnabled(argc, argv); -#if _WIN32 - if (logging && GetFileType(GetStdHandle(STD_ERROR_HANDLE)) == FILE_TYPE_UNKNOWN) { - logvisor::CreateWin32Console(); - } -#endif - logvisor::RegisterStandardExceptions(); - if (logging) { - logvisor::RegisterConsoleLogger(); - } + // #if _WIN32 + // if (logging && GetFileType(GetStdHandle(STD_ERROR_HANDLE)) == FILE_TYPE_UNKNOWN) { + // logvisor::CreateWin32Console(); + // } + // #endif + // logvisor::RegisterStandardExceptions(); + // if (logging) { + // logvisor::RegisterConsoleLogger(); + // } std::string logFile = cvarCmns.getLogFile(); if (!logFile.empty()) { std::time_t time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); char buf[100]; std::strftime(buf, 100, "%Y-%m-%d_%H-%M-%S", std::localtime(&time)); - logFilePath = fmt::format(FMT_STRING("{}/{}-{}"), fileMgr.getStoreRoot(), buf, logFile); - logvisor::RegisterFileLogger(logFilePath.c_str()); + logFilePath = fmt::format("{}/{}-{}", fileMgr.getStoreRoot(), buf, logFile); + // logvisor::RegisterFileLogger(logFilePath.c_str()); } } g_app = std::make_unique(argc, argv, fileMgr, cvarMgr, cvarCmns); std::string configPath{fileMgr.getStoreRoot()}; - const AuroraConfig config{ .appName = "Metaforce", .configPath = configPath.c_str(), @@ -540,7 +536,7 @@ int main(int argc, char** argv) { .startFullscreen = cvarCmns.getFullscreen(), .allowJoystickBackgroundEvents = cvarCmns.getAllowJoystickInBackground(), .windowPosX = cvarCmns.getWindowPos().x, - .windowPosY = cvarCmns.getWindowPos().y, + .windowPosY = cvarCmns.getWindowPos().y, .windowWidth = static_cast(cvarCmns.getWindowSize().x < 0 ? 0 : cvarCmns.getWindowSize().x), .windowHeight = static_cast(cvarCmns.getWindowSize().y < 0 ? 0 : cvarCmns.getWindowSize().y), .iconRGBA8 = icon.data.get(), @@ -600,7 +596,9 @@ int main(int argc, char** argv) { if (g_paused) { continue; } - aurora_begin_frame(); + if (!aurora_begin_frame()) { + continue; + } g_app->onAppIdle(1.f / 60.f /* TODO */); g_app->onAppDraw(); aurora_end_frame(); diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index 02dedca35..8945f0773 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -149,13 +149,8 @@ function(add_runtime_common_library name) endfunction() set(RUNTIME_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) -set(DISCORD_RPC_LIBRARY "") -if (NOT GEKKO AND NOT NX AND NOT IOS AND NOT TVOS) - set(DISCORD_RPC_LIBRARY "discord-rpc") -endif() -set(RUNTIME_LIBRARIES zeus nod NESEmulator libjpeg-turbo jbus kabufuda logvisor OptickCore - imgui_support aurora::aurora - ${DISCORD_RPC_LIBRARY} +set(RUNTIME_LIBRARIES zeus nod NESEmulator libjpeg-turbo jbus kabufuda OptickCore + imgui_support aurora::aurora spdlog::spdlog ${ZLIB_LIBRARIES} ) diff --git a/Runtime/CMemoryCardSysNix.cpp b/Runtime/CMemoryCardSysNix.cpp index 517c79101..3d0a4a97d 100644 --- a/Runtime/CMemoryCardSysNix.cpp +++ b/Runtime/CMemoryCardSysNix.cpp @@ -1,7 +1,11 @@ #include "CMemoryCardSys.hpp" + #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/IMain.hpp" -#include +#include "Runtime/CBasics.hpp" +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" + #include namespace metaforce { @@ -23,7 +27,7 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) { return {}; } auto path = *dolphinPath; - path += fmt::format(FMT_STRING("GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); + path += fmt::format("GC/MemoryCard{:c}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); CBasics::Sstat theStat{}; if (CBasics::Stat(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) { @@ -35,10 +39,10 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) { path = home; #ifndef __APPLE__ - path += fmt::format(FMT_STRING("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw"), + path += fmt::format("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); #else - path += fmt::format(FMT_STRING("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"), + path += fmt::format("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); #endif if (CBasics::Stat(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) { @@ -64,7 +68,7 @@ std::string CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot, bool do return {}; } - path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); + path += fmt::format("/MemoryCard{:c}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); auto* file = fopen(path.c_str(), "wbe"); if (file != nullptr) { fclose(file); diff --git a/Runtime/CMemoryCardSysOSX.cpp b/Runtime/CMemoryCardSysOSX.cpp index 2922308fe..19c80619a 100644 --- a/Runtime/CMemoryCardSysOSX.cpp +++ b/Runtime/CMemoryCardSysOSX.cpp @@ -10,7 +10,7 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) { return {}; std::string path = home; - path += fmt::format(FMT_STRING("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"), + path += fmt::format("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); hecl::Sstat theStat; @@ -34,7 +34,7 @@ std::string CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot, bool do if (hecl::RecursiveMakeDir(path.c_str()) < 0) return {}; - path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); + path += fmt::format("/MemoryCard{:c}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); const auto fp = hecl::FopenUnique(path.c_str(), "wb"); if (fp == nullptr) { return {}; diff --git a/Runtime/CMemoryCardSysWin.cpp b/Runtime/CMemoryCardSysWin.cpp index fc5d68191..9615ce537 100644 --- a/Runtime/CMemoryCardSysWin.cpp +++ b/Runtime/CMemoryCardSysWin.cpp @@ -63,7 +63,7 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) { std::string path(localFolder->Path->Data()); #endif - path += fmt::format(FMT_STRING("/GC/MemoryCard{}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); + path += fmt::format("/GC/MemoryCard{}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); struct _stat64 theStat{}; if (_stat64(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode)) @@ -116,7 +116,7 @@ std::string CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot, bool do if (CBasics::RecursiveMakeDir(path.c_str()) < 0) return {}; - path += fmt::format(FMT_STRING("/MemoryCard{}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); + path += fmt::format("/MemoryCard{}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); const nowide::wstackstring wpath(path); FILE* fp = _wfopen(wpath.get(), L"wb"); if (fp == nullptr) { diff --git a/Runtime/CObjectList.cpp b/Runtime/CObjectList.cpp index f6d62d30e..b256477b8 100644 --- a/Runtime/CObjectList.cpp +++ b/Runtime/CObjectList.cpp @@ -1,10 +1,9 @@ #include "Runtime/CObjectList.hpp" +#ifndef NDEBUG +#include "Runtime/Logging.hpp" +#endif -#include namespace metaforce { -namespace { -logvisor::Module Log("metaforce::CObjectList"); -} CObjectList::CObjectList(EGameObjectList listEnum) : x2004_listEnum(listEnum) {} @@ -13,9 +12,8 @@ void CObjectList::AddObject(CEntity& entity) { #ifndef NDEBUG if (x0_list[entity.GetUniqueId().Value()].entity != nullptr && x0_list[entity.GetUniqueId().Value()].entity != &entity) - Log.report(logvisor::Level::Fatal, - FMT_STRING("INVALID USAGE DETECTED: Attempting to assign entity '{} ({})' to existing node '{}'!!!"), - entity.GetName(), entity.GetEditorId(), entity.GetUniqueId().Value()); + spdlog::fatal("INVALID USAGE DETECTED: Attempting to assign entity '{} ({})' to existing node '{}'!!!", + entity.GetName(), entity.GetEditorId(), entity.GetUniqueId().Value()); #endif s16 prevFirst = -1; if (x2008_firstId != -1) { diff --git a/Runtime/CPakFile.cpp b/Runtime/CPakFile.cpp index ba921a4b6..d16b9885d 100644 --- a/Runtime/CPakFile.cpp +++ b/Runtime/CPakFile.cpp @@ -1,11 +1,11 @@ #include "Runtime/CPakFile.hpp" -namespace metaforce { -static logvisor::Module Log("metaforce::CPakFile"); +#include "Runtime/Logging.hpp" +namespace metaforce { CPakFile::CPakFile(std::string_view filename, bool buildDepList, bool worldPak, bool override) : CDvdFile(filename) { if (!CDvdFile::operator bool()) - Log.report(logvisor::Fatal, FMT_STRING("{}: Unable to open"), GetPath()); + spdlog::fatal("{}: Unable to open", GetPath()); x28_24_buildDepList = buildDepList; // x28_24_buildDepList = true; // Always do this so metaforce can rapidly pre-warm shaders x28_26_worldPak = worldPak; @@ -65,10 +65,8 @@ void CPakFile::InitialHeaderLoad() { x30_dvdReq.reset(); u32 version = r.ReadLong(); if (version != 0x00030005) { - Log.report(logvisor::Fatal, - FMT_STRING("{}: Incompatible pak file version -- Current version is {:08X}, you're using {:08X}"), - GetPath(), 0x00030005, version); - return; + spdlog::fatal("{}: Incompatible pak file version -- Current version is {:08X}, you're using {:08X}", GetPath(), + 0x00030005, version); } r.ReadLong(); diff --git a/Runtime/CResFactory.cpp b/Runtime/CResFactory.cpp index 459988fde..9b2b7f730 100644 --- a/Runtime/CResFactory.cpp +++ b/Runtime/CResFactory.cpp @@ -2,11 +2,12 @@ #include "Runtime/CSimplePool.hpp" #include "Runtime/CStopwatch.hpp" +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" + #include "optick.h" namespace metaforce { -static logvisor::Module Log("CResFactory"); - void CResFactory::AddToLoadList(SLoadingData&& data) { const SObjectTag tag = data.x0_tag; m_loadMap.insert_or_assign(tag, m_loadList.insert(m_loadList.end(), std::move(data))); @@ -29,7 +30,7 @@ CFactoryFnReturn CResFactory::BuildSync(const SObjectTag& tag, const CVParamTran else ret = std::make_unique(nullptr); } - Log.report(logvisor::Warning, FMT_STRING("sync-built {}"), tag); + spdlog::warn("sync-built {}", tag); return ret; } @@ -40,7 +41,7 @@ bool CResFactory::PumpResource(SLoadingData& data) { *data.xc_targetPtr = x5c_factoryMgr.MakeObjectFromMemory(data.x0_tag, std::move(data.x10_loadBuffer), data.x14_resSize, data.m_compressed, data.x18_cvXfer, data.m_selfRef); - Log.report(logvisor::Info, FMT_STRING("async-built {}"), data.x0_tag); + spdlog::info("async-built {}", data.x0_tag); return true; } return false; diff --git a/Runtime/CResLoader.cpp b/Runtime/CResLoader.cpp index 99a1b1d9d..d6dbd7228 100644 --- a/Runtime/CResLoader.cpp +++ b/Runtime/CResLoader.cpp @@ -1,10 +1,10 @@ #include "Runtime/CResLoader.hpp" #include "Runtime/CPakFile.hpp" +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { -static logvisor::Module Log("CResLoader"); - CResLoader::CResLoader() { x48_curPak = x18_pakLoadedList.end(); } const std::vector* CResLoader::GetTagListForFile(std::string_view name) const { @@ -213,7 +213,7 @@ bool CResLoader::FindResource(CAssetId id) const { return true; } - Log.report(logvisor::Warning, FMT_STRING("Unable to find asset {}"), id); + spdlog::warn("Unable to find asset {}", id); return false; } @@ -237,7 +237,7 @@ CPakFile* CResLoader::FindResourceForLoad(CAssetId id) { } } - Log.report(logvisor::Error, FMT_STRING("Unable to find asset {}"), id); + spdlog::error("Unable to find asset {}", id); return nullptr; } diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index df9cac33b..ef9c4a422 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -48,6 +48,7 @@ #include "Runtime/World/CWallCrawlerSwarm.hpp" #include "Runtime/World/CWorld.hpp" #include "Runtime/ConsoleVariables/CVarManager.hpp" +#include "Runtime/Logging.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path #include @@ -61,7 +62,6 @@ CVar* debugToolDrawMazePath = nullptr; CVar* debugToolDrawPlatformCollision = nullptr; CVar* sm_logScripting = nullptr; } // namespace -logvisor::Module LogModule("metaforce::CStateManager"); CStateManager::CStateManager(const std::weak_ptr& mailbox, const std::weak_ptr& mwInfo, const std::weak_ptr& playerState, const std::weak_ptr& wtMgr, @@ -545,7 +545,7 @@ void CStateManager::BuildDynamicLightListForWorld() { } } } - + std::sort(x8e0_dynamicLights.begin(), x8e0_dynamicLights.end(), [](const CLight& a, const CLight& b) { if (b.GetPriority() > a.GetPriority()) { return true; @@ -1209,11 +1209,10 @@ void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMes if (m_logScripting) { auto srcObj = GetObjectById(src); if (srcObj != nullptr) { - LogModule.report(logvisor::Info, FMT_STRING("{} is sending '{}' to '{}' id= {} -> {}"), srcObj->GetName(), - ScriptObjectMessageToStr(msg), dest->GetName(), dest->GetUniqueId(), src, dest->GetUniqueId()); + spdlog::info("{} is sending '{}' to '{}' id= {} -> {}", srcObj->GetName(), ScriptObjectMessageToStr(msg), + dest->GetName(), dest->GetUniqueId(), src, dest->GetUniqueId()); } else { - LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg), - dest->GetName(), dest->GetUniqueId()); + spdlog::info("Sending '{}' to '{}' id= {}", ScriptObjectMessageToStr(msg), dest->GetName(), dest->GetUniqueId()); } } @@ -1234,11 +1233,10 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb if (m_logScripting) { auto srcObj = GetObjectById(src); if (srcObj != nullptr) { - LogModule.report(logvisor::Info, FMT_STRING("{} is sending '{}' to '{}' id= {} -> {}"), srcObj->GetName(), - ScriptObjectMessageToStr(msg), dst->GetName(), dst->GetUniqueId(), src, dst->GetUniqueId()); + spdlog::info("{} is sending '{}' to '{}' id= {} -> {}", srcObj->GetName(), ScriptObjectMessageToStr(msg), + dst->GetName(), dst->GetUniqueId(), src, dst->GetUniqueId()); } else { - LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg), - dst->GetName(), dst->GetUniqueId()); + spdlog::info("Sending '{}' to '{}' id= {}", ScriptObjectMessageToStr(msg), dst->GetName(), dst->GetUniqueId()); } } @@ -1308,7 +1306,7 @@ void CStateManager::FreeScriptObject(TUniqueId id) { } if (m_logScripting) { - LogModule.report(logvisor::Info, FMT_STRING("Removed '{}'"), ent->GetName()); + spdlog::info("Removed '{}'", ent->GetName()); } } @@ -1424,8 +1422,7 @@ std::pair CStateManager::LoadScriptObject(TAreaId aid, ESc const u32 readAmt = in.GetReadPosition() - startPos; if (readAmt > length) { - LogModule.report(logvisor::Fatal, FMT_STRING("Script object overread while reading {}"), - ScriptObjectTypeToStr(type)); + spdlog::fatal("Script object overread while reading {}", ScriptObjectTypeToStr(type)); } const u32 leftover = length - readAmt; @@ -1434,12 +1431,11 @@ std::pair CStateManager::LoadScriptObject(TAreaId aid, ESc } if (error || ent == nullptr) { - LogModule.report(logvisor::Error, FMT_STRING("Script load error while loading {} (Editor ID: {}, Area: {})"), - ScriptObjectTypeToStr(type), id, aid); + spdlog::error("Script load error while loading {} (Editor ID: {}, Area: {})", ScriptObjectTypeToStr(type), id, aid); return {kInvalidEditorId, kInvalidUniqueId}; } else { #ifndef NDEBUG - LogModule.report(logvisor::Info, FMT_STRING("Loaded {} in area {}"), ent->GetName(), ent->GetAreaIdAlways()); + LogModule.report(logvisor::Info, "Loaded {} in area {}", ent->GetName(), ent->GetAreaIdAlways()); #endif return {id, ent->GetUniqueId()}; } @@ -2669,7 +2665,7 @@ void CStateManager::AddObject(CEntity& ent) { } if (m_logScripting) { - LogModule.report(logvisor::Info, FMT_STRING("Added '{}'"), ent.GetName()); + spdlog::info("Added '{}'", ent.GetName()); } } @@ -2721,7 +2717,7 @@ TUniqueId CStateManager::AllocateUniqueId() { ourIndex = x0_nextFreeIndex; x0_nextFreeIndex = (ourIndex + 1) & 0x3ff; if (x0_nextFreeIndex == lastIndex) { - LogModule.report(logvisor::Fatal, FMT_STRING("Object list full!")); + spdlog::fatal("Object list full!"); } } while (GetAllObjectList().GetObjectByIndex(ourIndex) != nullptr); diff --git a/Runtime/Character/CAllFormatsAnimSource.cpp b/Runtime/Character/CAllFormatsAnimSource.cpp index e3c01f9cc..8dd47722b 100644 --- a/Runtime/Character/CAllFormatsAnimSource.cpp +++ b/Runtime/Character/CAllFormatsAnimSource.cpp @@ -3,12 +3,9 @@ #include "Runtime/CSimplePool.hpp" #include "Runtime/Character/CAnimSourceReader.hpp" #include "Runtime/Character/CFBStreamedAnimReader.hpp" - -#include +#include "Runtime/Logging.hpp" namespace metaforce { -static logvisor::Module Log("metaforce::CAllFormatsAnimSource"); - void CAnimFormatUnion::SubConstruct(u8* storage, EAnimFormat fmt, CInputStream& in, IObjectStore& store) { switch (fmt) { case EAnimFormat::Uncompressed: @@ -21,7 +18,7 @@ void CAnimFormatUnion::SubConstruct(u8* storage, EAnimFormat fmt, CInputStream& new (storage) CFBStreamedCompression(in, store, true); break; default: - Log.report(logvisor::Fatal, FMT_STRING("unable to read ANIM format {}"), int(fmt)); + spdlog::fatal("unable to read ANIM format {}", static_cast(fmt)); } } diff --git a/Runtime/Character/CAnimData.cpp b/Runtime/Character/CAnimData.cpp index 720645f39..eee469b3e 100644 --- a/Runtime/Character/CAnimData.cpp +++ b/Runtime/Character/CAnimData.cpp @@ -24,12 +24,9 @@ #include "Runtime/Character/IAnimReader.hpp" #include "Runtime/Graphics/CSkinnedModel.hpp" #include "Runtime/Graphics/CGX.hpp" - -#include +#include "Runtime/Logging.hpp" namespace metaforce { -static logvisor::Module Log("CAnimData"); - rstl::reserved_vector CAnimData::g_BoolPOINodes; rstl::reserved_vector CAnimData::g_Int32POINodes; rstl::reserved_vector CAnimData::g_ParticlePOINodes; @@ -81,8 +78,7 @@ CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAn if (defaultAnim == -1) { defaultAnim = 0; - Log.report(logvisor::Warning, FMT_STRING("Character {} has invalid initial animation, so defaulting to first."), - character.GetCharacterName()); + spdlog::warn("Character {} has invalid initial animation, so defaulting to first.", character.GetCharacterName()); } auto treeNode = GetAnimationManager()->GetAnimationTree(character.GetAnimationIndex(defaultAnim), diff --git a/Runtime/Character/CModelData.cpp b/Runtime/Character/CModelData.cpp index c5c912293..0aab38f45 100644 --- a/Runtime/Character/CModelData.cpp +++ b/Runtime/Character/CModelData.cpp @@ -13,12 +13,10 @@ #include "Runtime/Graphics/CSkinnedModel.hpp" #include "Runtime/Graphics/CVertexMorphEffect.hpp" #include "Runtime/Graphics/CCubeRenderer.hpp" - -#include +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { -static logvisor::Module Log("metaforce::CModelData"); - CModelData::~CModelData() = default; CModelData::CModelData() {} @@ -27,7 +25,7 @@ CModelData CModelData::CModelDataNull() { return CModelData(); } CModelData::CModelData(const CStaticRes& res) : x0_scale(res.GetScale()) { x1c_normalModel = g_SimplePool->GetObj({SBIG('CMDL'), res.GetId()}); if (!x1c_normalModel) - Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), res.GetId()); + spdlog::fatal("unable to find CMDL {}", res.GetId()); } CModelData::CModelData(const CAnimRes& res) : x0_scale(res.GetScale()) { @@ -142,7 +140,7 @@ void CModelData::SetXRayModel(const std::pair& modelSkin) { } else { x2c_xrayModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first}); if (!x2c_xrayModel) - Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), modelSkin.first); + spdlog::fatal("unable to find CMDL {}", modelSkin.first); } } } @@ -158,7 +156,7 @@ void CModelData::SetInfraModel(const std::pair& modelSkin) { } else { x3c_infraModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first}); if (!x3c_infraModel) - Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), modelSkin.first); + spdlog::fatal("unable to find CMDL {}", modelSkin.first); } } } diff --git a/Runtime/Collision/CAreaOctTree.hpp b/Runtime/Collision/CAreaOctTree.hpp index 359f1a9be..f3616e64e 100644 --- a/Runtime/Collision/CAreaOctTree.hpp +++ b/Runtime/Collision/CAreaOctTree.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include "Runtime/RetroTypes.hpp" #include "Runtime/Collision/CCollisionEdge.hpp" diff --git a/Runtime/ConsoleVariables/CVar.cpp b/Runtime/ConsoleVariables/CVar.cpp index 701e3403b..c0a5cf1f3 100644 --- a/Runtime/ConsoleVariables/CVar.cpp +++ b/Runtime/ConsoleVariables/CVar.cpp @@ -1,10 +1,6 @@ -#include "Runtime/ConsoleVariables/CVar.hpp" -#include "Runtime/CBasics.hpp" -#include "Runtime/CStringExtras.hpp" - -#include - -#include +#include "Runtime/CStringExtras.hpp" +#include "Runtime/ConsoleVariables/CVar.hpp" +#include "Runtime/Formatting.hpp" #include "Runtime/ConsoleVariables/CVarManager.hpp" @@ -269,7 +265,7 @@ bool CVar::fromVec2i(const zeus::CVector2i& val) { if (!safeToModify(EType::Vec2i)) return false; - m_value.assign(fmt::format(FMT_STRING("{} {}"), val.x, val.y)); + m_value.assign(fmt::format("{} {}", val.x, val.y)); m_flags |= EFlags::Modified; return true; } @@ -278,7 +274,7 @@ bool CVar::fromVec2f(const zeus::CVector2f& val) { if (!safeToModify(EType::Vec2f)) return false; - m_value.assign(fmt::format(FMT_STRING("{} {}"), val.x(), val.y())); + m_value.assign(fmt::format("{} {}", val.x(), val.y())); m_flags |= EFlags::Modified; return true; } @@ -287,7 +283,7 @@ bool CVar::fromVec2d(const zeus::CVector2d& val) { if (!safeToModify(EType::Vec2d)) return false; - m_value.assign(fmt::format(FMT_STRING("{} {}"), val.x(), val.y())); + m_value.assign(fmt::format("{} {}", val.x(), val.y())); m_flags |= EFlags::Modified; return true; } @@ -296,7 +292,7 @@ bool CVar::fromVec3f(const zeus::CVector3f& val) { if (!safeToModify(EType::Vec3f)) return false; - m_value.assign(fmt::format(FMT_STRING("{} {} {}"), val.x(), val.y(), val.z())); + m_value.assign(fmt::format("{} {} {}", val.x(), val.y(), val.z())); m_flags |= EFlags::Modified; return true; } @@ -305,7 +301,7 @@ bool CVar::fromVec3d(const zeus::CVector3d& val) { if (!safeToModify(EType::Vec3d)) return false; - m_value.assign(fmt::format(FMT_STRING("{} {} {}"), val.x(), val.y(), val.z())); + m_value.assign(fmt::format("{} {} {}", val.x(), val.y(), val.z())); m_flags |= EFlags::Modified; return true; } @@ -314,7 +310,7 @@ bool CVar::fromVec4f(const zeus::CVector4f& val) { if (!safeToModify(EType::Vec4f)) return false; - m_value.assign(fmt::format(FMT_STRING("{} {} {} {}"), val.x(), val.y(), val.z(), val.w())); + m_value.assign(fmt::format("{} {} {} {}", val.x(), val.y(), val.z(), val.w())); m_flags |= EFlags::Modified; return true; } @@ -323,7 +319,7 @@ bool CVar::fromVec4d(const zeus::CVector4d& val) { if (!safeToModify(EType::Vec4d)) return false; - m_value.assign(fmt::format(FMT_STRING("{} {} {} {}"), val.x(), val.y(), val.z(), val.w())); + m_value.assign(fmt::format("{} {} {} {}", val.x(), val.y(), val.z(), val.w())); m_flags |= EFlags::Modified; return true; } @@ -332,7 +328,7 @@ bool CVar::fromReal(double val) { if (!safeToModify(EType::Real)) return false; - m_value.assign(fmt::format(FMT_STRING("{}"), val)); + m_value.assign(fmt::format("{}", val)); setModified(); return true; } @@ -363,7 +359,7 @@ bool CVar::fromInteger(int32_t val) { return false; // Properly format based on signedness - m_value = fmt::format(FMT_STRING("{}"), (m_type == EType::Signed ? val : static_cast(val))); + m_value = fmt::format("{}", (m_type == EType::Signed ? val : static_cast(val))); setModified(); return true; } @@ -381,7 +377,7 @@ bool CVar::fromInteger(uint32_t val) { return false; // Properly format based on signedness - m_value = fmt::format(FMT_STRING("{}"), (m_type == EType::Unsigned ? val : static_cast(val))); + m_value = fmt::format("{}", (m_type == EType::Unsigned ? val : static_cast(val))); setModified(); return true; } diff --git a/Runtime/ConsoleVariables/CVarManager.cpp b/Runtime/ConsoleVariables/CVarManager.cpp index 0252c1efd..7a82579a2 100644 --- a/Runtime/ConsoleVariables/CVarManager.cpp +++ b/Runtime/ConsoleVariables/CVarManager.cpp @@ -7,17 +7,18 @@ #include "Runtime/Streams/CMemoryInStream.hpp" #include "Runtime/Streams/CMemoryStreamOut.hpp" #include "Runtime/CStringExtras.hpp" -#include +#include "Runtime/Formatting.hpp" + #include #include #include #if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG) -#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif #if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR) -#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif namespace metaforce { @@ -30,7 +31,6 @@ CVar* com_cubemaps = nullptr; static const std::regex cmdLineRegex(R"(\+([\w\.]+)([=])?([\/\\\s\w\.\-]+)?)"); CVarManager* CVarManager::m_instance = nullptr; -static logvisor::Module CVarLog("CVarManager"); CVarManager::CVarManager(FileStoreManager& store, bool useBinary) : m_store(store), m_useBinary(useBinary) { m_instance = this; com_configfile = @@ -175,7 +175,7 @@ void CVarManager::serialize() { CMemoryStreamOut memOut(workBuf.get(), requiredLen, CMemoryStreamOut::EOwnerShip::NotOwned, 32); CTextOutStream textOut(memOut); for (const auto& cvar : container) { - auto str = fmt::format(FMT_STRING("{}: {}"), cvar.m_name, cvar.m_value); + auto str = fmt::format("{}: {}", cvar.m_name, cvar.m_value); textOut.WriteString(str); } @@ -208,7 +208,7 @@ std::vector CVarManager::loadCVars(const std::string& filename) #else "rbe" #endif - ); + ); if (file != nullptr) { std::unique_ptr inBuf(new u8[st.st_size]); diff --git a/Runtime/ConsoleVariables/FileStoreManager.cpp b/Runtime/ConsoleVariables/FileStoreManager.cpp index d97acce98..e702e3a9b 100644 --- a/Runtime/ConsoleVariables/FileStoreManager.cpp +++ b/Runtime/ConsoleVariables/FileStoreManager.cpp @@ -1,9 +1,9 @@ #include "Runtime/ConsoleVariables/FileStoreManager.hpp" #include "Runtime/CBasics.hpp" +#include "Runtime/Logging.hpp" #include -#include #if _WIN32 #include #endif @@ -18,14 +18,12 @@ using namespace Windows::Storage; namespace metaforce { namespace { -static logvisor::Module Log("FileStoreManager"); FileStoreManager* g_instance = nullptr; } FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain) : m_org(org), m_domain(domain) { if (g_instance != nullptr) { - Log.report(logvisor::Fatal, FMT_STRING("Attempting to build another FileStoreManager!!")); - return; + spdlog::fatal("Attempting to build another FileStoreManager!!"); } auto prefPath = SDL_GetPrefPath(org.data(), domain.data()); @@ -34,7 +32,7 @@ FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain #if !WINDOWS_STORE WCHAR home[MAX_PATH]; if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, home))) - Log.report(logvisor::Fatal, FMT_STRING("unable to locate profile for file store")); + spdlog::fatal("unable to locate profile for file store"); std::string path = nowide::narrow(home); #else @@ -54,18 +52,18 @@ FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain std::string path; if (xdg_data_home) { if (xdg_data_home[0] != '/') - Log.report(logvisor::Fatal, FMT_STRING("invalid $XDG_DATA_HOME for file store (must be absolute)")); + spdlog::fatal("invalid $XDG_DATA_HOME for file store (must be absolute)"); path = xdg_data_home; } else { const char* home = getenv("HOME"); if (!home) - Log.report(logvisor::Fatal, FMT_STRING("unable to locate $HOME for file store")); + spdlog::fatal("unable to locate $HOME for file store"); path = home; path += "/.local/share"; } path += "/" + m_org + "/" + domain.data(); if (CBasics::RecursiveMakeDir(path.c_str()) != 0) { - Log.report(logvisor::Fatal, FMT_STRING("unable to mkdir at {}"), path); + spdlog::fatal("unable to mkdir at {}", path); } m_storeRoot = path; #endif @@ -78,9 +76,8 @@ FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain FileStoreManager* FileStoreManager::instance() { if (g_instance == nullptr) { - Log.report(logvisor::Fatal, FMT_STRING("Requested FileStoreManager instance before it's built!")); - return nullptr; + spdlog::fatal("Requested FileStoreManager instance before it's built!"); } return g_instance; } -} // namespace hecl::Runtime +} // namespace metaforce diff --git a/Runtime/Formatting.hpp b/Runtime/Formatting.hpp new file mode 100644 index 000000000..fa071a6c3 --- /dev/null +++ b/Runtime/Formatting.hpp @@ -0,0 +1,57 @@ +#pragma once + +#include "Runtime/RetroTypes.hpp" + +#include // IWYU pragma: export +#include + +#include +#include +#include +#include +#include + +#define FMT_CUSTOM_FORMATTER(Type, str, ...) \ + template \ + struct fmt::formatter : fmt::formatter, CharT> { \ + template \ + auto format(const Type& obj, FormatContext& ctx) const -> decltype(ctx.out()) { \ + if constexpr (std::is_same_v) { \ + return fmt::format_to(ctx.out(), str __VA_OPT__(, ) __VA_ARGS__); \ + } else if constexpr (std::is_same_v) { \ + return fmt::format_to(ctx.out(), u##str __VA_OPT__(, ) __VA_ARGS__); \ + } else { \ + static_assert(false, "Unsupported character type for formatter"); \ + } \ + } \ + } + +FMT_CUSTOM_FORMATTER(metaforce::CAssetId, "{:08X}", obj.Value()); +FMT_CUSTOM_FORMATTER(metaforce::FourCC, "{:c}{:c}{:c}{:c}", obj.getChars()[0], obj.getChars()[1], obj.getChars()[2], + obj.getChars()[3]); +FMT_CUSTOM_FORMATTER(metaforce::SObjectTag, "{} {}", obj.type, obj.id); +FMT_CUSTOM_FORMATTER(metaforce::TEditorId, "{:08X}", obj.id); +static_assert(sizeof(metaforce::kUniqueIdType) == sizeof(u16), + "TUniqueId size does not match expected size! Update TUniqueId format string!"); +FMT_CUSTOM_FORMATTER(metaforce::TUniqueId, "{:04X}", obj.id); + +FMT_CUSTOM_FORMATTER(zeus::CVector3f, "({} {} {})", obj.x(), obj.y(), obj.z()); +FMT_CUSTOM_FORMATTER(zeus::CVector2f, "({} {})", obj.x(), obj.y()); +FMT_CUSTOM_FORMATTER(zeus::CMatrix3f, + "\n({} {} {})" + "\n({} {} {})" + "\n({} {} {})", + obj[0][0], obj[1][0], obj[2][0], obj[0][1], obj[1][1], obj[2][1], obj[0][2], obj[1][2], obj[2][2]); +FMT_CUSTOM_FORMATTER(zeus::CMatrix4f, + "\n({} {} {} {})" + "\n({} {} {} {})" + "\n({} {} {} {})" + "\n({} {} {} {})", + obj[0][0], obj[1][0], obj[2][0], obj[3][0], obj[0][1], obj[1][1], obj[2][1], obj[3][1], obj[0][2], + obj[1][2], obj[2][2], obj[3][2], obj[0][3], obj[1][3], obj[2][3], obj[3][3]); +FMT_CUSTOM_FORMATTER(zeus::CTransform, + "\n({} {} {} {})" + "\n({} {} {} {})" + "\n({} {} {} {})", + obj.basis[0][0], obj.basis[1][0], obj.basis[2][0], obj.origin[0], obj.basis[0][1], obj.basis[1][1], + obj.basis[2][1], obj.origin[1], obj.basis[0][2], obj.basis[1][2], obj.basis[2][2], obj.origin[2]); \ No newline at end of file diff --git a/Runtime/Graphics/CBooRenderer.cpp b/Runtime/Graphics/CBooRenderer.cpp index f5a41d77d..c00eba34f 100644 --- a/Runtime/Graphics/CBooRenderer.cpp +++ b/Runtime/Graphics/CBooRenderer.cpp @@ -147,7 +147,7 @@ void Buckets::Sort() { if (bucket.size() < bucket.capacity()) bucket.push_back(&drawable); // else - // Log.report(logvisor::Fatal, FMT_STRING("Full bucket!!!")); + // spdlog::fatal("Full bucket!!!"); } u16 bucketIdx = u16(sBuckets->size()); @@ -182,7 +182,7 @@ void Buckets::InsertPlaneObject(float closeDist, float farDist, const zeus::CAAB void Buckets::Insert(const zeus::CVector3f& pos, const zeus::CAABox& aabb, EDrawableType dtype, void* data, const zeus::CPlane& plane, u16 extraSort) { if (sData->size() == sData->capacity()) { - Log.report(logvisor::Fatal, FMT_STRING("Rendering buckets filled to capacity")); + spdlog::fatal("Rendering buckets filled to capacity"); return; } diff --git a/Runtime/Graphics/CCubeRenderer.cpp b/Runtime/Graphics/CCubeRenderer.cpp index e4014a8a2..c2684f6f9 100644 --- a/Runtime/Graphics/CCubeRenderer.cpp +++ b/Runtime/Graphics/CCubeRenderer.cpp @@ -15,12 +15,11 @@ #include "Runtime/Particle/CDecal.hpp" #include "Runtime/Particle/CElementGen.hpp" #include "Runtime/CDvdFile.hpp" +#include "Runtime/Logging.hpp" #include namespace metaforce { -static logvisor::Module Log("CCubeRenderer"); - /* TODO: This is to fix some areas exceeding the max drawable count, the proper number is 128 drawables per bucket */ // using BucketHolderType = rstl::reserved_vector; using BucketHolderType = rstl::reserved_vector; @@ -127,7 +126,7 @@ void Buckets::Sort() { bucket.push_back(&drawable); } // else - // Log.report(logvisor::Fatal, FMT_STRING("Full bucket!!!")); + // spdlog::fatal("Full bucket!!!"); } u16 bucketIdx = u16(sBuckets->size()); @@ -162,7 +161,7 @@ void Buckets::InsertPlaneObject(float closeDist, float farDist, const zeus::CAAB void Buckets::Insert(const zeus::CVector3f& pos, const zeus::CAABox& aabb, EDrawableType dtype, void* data, const zeus::CPlane& plane, u16 extraSort) { if (sData->size() == sData->capacity()) { - Log.report(logvisor::Fatal, FMT_STRING("Rendering buckets filled to capacity")); + spdlog::fatal("Rendering buckets filled to capacity"); return; } @@ -330,7 +329,7 @@ void CCubeRenderer::RemoveStaticGeometry(const std::vectorx18_areaIdx).c_str(), zeus::skBlue); + fmt::format("CCubeRenderer::RenderBucketItems areaIdx={}", item->x18_areaIdx).c_str(), zeus::skBlue); CCubeModel* lastModel = nullptr; EDrawableType lastDrawableType = EDrawableType::Invalid; diff --git a/Runtime/Graphics/CLineRenderer.cpp b/Runtime/Graphics/CLineRenderer.cpp index c1bbff3f0..90d4e4ef7 100644 --- a/Runtime/Graphics/CLineRenderer.cpp +++ b/Runtime/Graphics/CLineRenderer.cpp @@ -1,12 +1,9 @@ #include "Runtime/Graphics/CLineRenderer.hpp" #include "Runtime/Graphics/Shaders/CLineRendererShaders.hpp" - -#include +#include "Runtime/Logging.hpp" namespace metaforce { -logvisor::Module LineRendererLog("metaforce::CLineRenderer"); - void CLineRenderer::Initialize() { CLineRendererShaders::Initialize(); } void CLineRenderer::Shutdown() { @@ -25,7 +22,7 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, u32 texture, : m_mode(mode), m_maxVerts(maxVerts) { OPTICK_EVENT(); if (maxVerts < 2) { - LineRendererLog.report(logvisor::Fatal, FMT_STRING("maxVerts < 2, maxVerts = {}"), maxVerts); + spdlog::fatal("maxVerts < 2, maxVerts = {}", maxVerts); return; } m_textured = bool(texture); diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 32ad5ea45..6309dc031 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -253,7 +253,7 @@ CBooModel::CBooModel(TToken& token, CModel* parent, std::vector= 512) { -// Log.report(logvisor::Fatal, FMT_STRING("Model buffer overflow")); +// spdlog::fatal("Model buffer overflow"); // } // // ModelInstance& newInst = m_instances.emplace_back(); @@ -1163,7 +1163,7 @@ CModel::CModel(std::unique_ptr&& in, u32 /* dataLen */, IObjectStore* stor u32 version = CBasics::SwapBytes(*reinterpret_cast(data.get() + 0x4)); m_flags = CBasics::SwapBytes(*reinterpret_cast(data.get() + 0x8)); if (version != 0x10002) { - Log.report(logvisor::Error, FMT_STRING("invalid CMDL for loading with boo")); + spdlog::error("invalid CMDL for loading with boo"); return; } diff --git a/Runtime/Graphics/CMoviePlayer.cpp b/Runtime/Graphics/CMoviePlayer.cpp index a5b6e24ce..978888ef8 100644 --- a/Runtime/Graphics/CMoviePlayer.cpp +++ b/Runtime/Graphics/CMoviePlayer.cpp @@ -306,24 +306,24 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo // if (deinterlace) { // /* metaforce addition: this way interlaced THPs don't look horrible */ // set.Y[0] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height / 2, 1, GX_TF_I8, - // fmt::format(FMT_STRING("Movie {} Texture Set {} Y[0]"), path, + // fmt::format("Movie {} Texture Set {} Y[0]", path, // i)); // set.Y[1] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height / 2, 1, GX_TF_I8, - // fmt::format(FMT_STRING("Movie {} Texture Set {} Y[1]"), path, + // fmt::format("Movie {} Texture Set {} Y[1]", path, // i)); // set.U = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8, - // fmt::format(FMT_STRING("Movie {} Texture Set {} U"), path, i)); + // fmt::format("Movie {} Texture Set {} U", path, i)); // set.V = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8, - // fmt::format(FMT_STRING("Movie {} Texture Set {} V"), path, i)); + // fmt::format("Movie {} Texture Set {} V", path, i)); // } else { // /* normal progressive presentation */ // set.Y[0] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height, 1, GX_TF_I8, - // fmt::format(FMT_STRING("Movie {} Texture Set {} Y"), path, + // fmt::format("Movie {} Texture Set {} Y", path, // i)); // set.U = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8, - // fmt::format(FMT_STRING("Movie {} Texture Set {} U"), path, i)); + // fmt::format("Movie {} Texture Set {} U", path, i)); // set.V = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8, - // fmt::format(FMT_STRING("Movie {} Texture Set {} V"), path, i)); + // fmt::format("Movie {} Texture Set {} V", path, i)); // } if (xf4_25_hasAudio) set.audioBuf.reset(new s16[x28_thpHead.maxAudioSamples * 2]); diff --git a/Runtime/Graphics/CSkinnedModel.cpp b/Runtime/Graphics/CSkinnedModel.cpp index 0ffa5b318..d78ffa6ff 100644 --- a/Runtime/Graphics/CSkinnedModel.cpp +++ b/Runtime/Graphics/CSkinnedModel.cpp @@ -3,13 +3,11 @@ #include "Runtime/Character/CSkinRules.hpp" #include "Runtime/Graphics/CCubeRenderer.hpp" #include "Runtime/Graphics/CVertexMorphEffect.hpp" +#include "Runtime/Logging.hpp" -#include #include namespace metaforce { -static logvisor::Module Log("metaforce::CSkinnedModel"); - CSkinnedModel::CSkinnedModel(const TLockedToken& model, const TLockedToken& skinRules, const TLockedToken& layoutInfo) : x4_model(std::move(model)) @@ -17,13 +15,13 @@ CSkinnedModel::CSkinnedModel(const TLockedToken& model, const TLockedTok , x1c_layoutInfo(std::move(layoutInfo)) , m_workspace(*x10_skinRules) { if (!x4_model) { - Log.report(logvisor::Fatal, FMT_STRING("bad model token provided to CSkinnedModel")); + spdlog::fatal("bad model token provided to CSkinnedModel"); } if (!x10_skinRules) { - Log.report(logvisor::Fatal, FMT_STRING("bad skin token provided to CSkinnedModel")); + spdlog::fatal("bad skin token provided to CSkinnedModel"); } if (!x1c_layoutInfo) { - Log.report(logvisor::Fatal, FMT_STRING("bad character layout token provided to CSkinnedModel")); + spdlog::fatal("bad character layout token provided to CSkinnedModel"); } } diff --git a/Runtime/Graphics/CTevCombiners.hpp b/Runtime/Graphics/CTevCombiners.hpp index 91087f25f..ab0643d7c 100644 --- a/Runtime/Graphics/CTevCombiners.hpp +++ b/Runtime/Graphics/CTevCombiners.hpp @@ -3,6 +3,8 @@ #include "Graphics/GX.hpp" #include "RetroTypes.hpp" +#include + namespace metaforce { enum class ERglTevStage : std::underlying_type_t { Stage0 = GX_TEVSTAGE0, diff --git a/Runtime/Graphics/CTexture.cpp b/Runtime/Graphics/CTexture.cpp index cea30657c..13b4870ee 100644 --- a/Runtime/Graphics/CTexture.cpp +++ b/Runtime/Graphics/CTexture.cpp @@ -1,6 +1,7 @@ #include "Graphics/CTexture.hpp" -#include "CToken.hpp" +#include "Runtime/CToken.hpp" +#include "Runtime/Formatting.hpp" #include #include @@ -15,7 +16,7 @@ CTexture::CTexture(ETexelFormat fmt, u16 w, u16 h, s32 mips, std::string_view la , x8_mips(mips) , x9_bitsPerPixel(TexelFormatBitsPerPixel(fmt)) , x64_frameAllocated(sCurrentFrameCount) -, m_label(fmt::format(FMT_STRING("{} ({})"), label, magic_enum::enum_name(fmt))) { +, m_label(fmt::format("{} ({})", label, magic_enum::enum_name(fmt))) { InitBitmapBuffers(fmt, w, h, mips); InitTextureObjs(); } @@ -26,7 +27,7 @@ CTexture::CTexture(CInputStream& in, std::string_view label, EAutoMipmap automip , x6_h(in.ReadShort()) , x8_mips(in.ReadLong()) , x64_frameAllocated(sCurrentFrameCount) -, m_label(fmt::format(FMT_STRING("{} ({})"), label, magic_enum::enum_name(x0_fmt))) { +, m_label(fmt::format("{} ({})", label, magic_enum::enum_name(x0_fmt))) { bool hasPalette = (x0_fmt == ETexelFormat::C4 || x0_fmt == ETexelFormat::C8 || x0_fmt == ETexelFormat::C14X2); if (hasPalette) { x10_graphicsPalette = std::make_unique(in); @@ -284,7 +285,7 @@ void CTexture::InvalidateTexMap(GXTexMapID id) { sLoadedTextures[id] = nullptr; CFactoryFnReturn FTextureFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms, CObjectReference* selfRef) { - const auto label = fmt::format(FMT_STRING("{} {}"), tag.type, tag.id); + const auto label = fmt::format("{} {}", tag.type, tag.id); return TToken::GetIObjObjectFor(std::make_unique(in, label)); } } // namespace metaforce diff --git a/Runtime/Graphics/CTextureBoo.cpp b/Runtime/Graphics/CTextureBoo.cpp index beba48d5e..c0ef8e92d 100644 --- a/Runtime/Graphics/CTextureBoo.cpp +++ b/Runtime/Graphics/CTextureBoo.cpp @@ -358,7 +358,7 @@ void CTexture::BuildC8FromGCN(CInputStream& in, aurora::zstring_view label) { } void CTexture::BuildC14X2FromGCN(CInputStream& in, aurora::zstring_view label) { - Log.report(logvisor::Fatal, FMT_STRING("C14X2 not implemented")); + spdlog::fatal("C14X2 not implemented"); } void CTexture::BuildRGB565FromGCN(CInputStream& in, aurora::zstring_view label) { @@ -543,7 +543,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length, aurora::zstring_view size_t texelCount = ComputeMippedTexelCount(); size_t expectedSize = texelCount * 4; if (expectedSize > length) - Log.report(logvisor::Fatal, FMT_STRING("insufficient TXTR length ({}/{})"), length, expectedSize); + spdlog::fatal("insufficient TXTR length ({}/{})", length, expectedSize); m_tex = aurora::gfx::new_static_texture_2d(x4_w, x6_h, x8_mips, aurora::gfx::TextureFormat::RGBA8, {reinterpret_cast(data), expectedSize}, label); @@ -552,7 +552,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length, aurora::zstring_view void CTexture::BuildC8(const void* data, size_t length, aurora::zstring_view label) { size_t texelCount = ComputeMippedTexelCount(); if (texelCount > length) - Log.report(logvisor::Fatal, FMT_STRING("insufficient TXTR length ({}/{})"), length, texelCount); + spdlog::fatal("insufficient TXTR length ({}/{})", length, texelCount); uint32_t nentries = CBasics::SwapBytes(*reinterpret_cast(data)); const u8* paletteTexels = reinterpret_cast(data) + 4; @@ -758,7 +758,7 @@ CTexture::CTexture(std::unique_ptr&& in, u32 length, bool otex, const CTex x9_bitsPerPixel = TexelFormatBitsPerPixel(x0_fmt); m_textureInfo = inf; - auto label = fmt::format(FMT_STRING("TXTR {:08X} ({})"), id.Value(), TextureFormatString(x0_fmt)); + auto label = fmt::format("TXTR {:08X} ({})", id.Value(), TextureFormatString(x0_fmt)); switch (x0_fmt) { case ETexelFormat::I4: BuildI4FromGCN(r, label); @@ -794,8 +794,7 @@ CTexture::CTexture(std::unique_ptr&& in, u32 length, bool otex, const CTex if (aurora::gfx::get_dxt_compression_supported()) { BuildDXT1FromGCN(r, label); } else { - Log.report(logvisor::Error, FMT_STRING("BC/DXT1 compression is not supported on your GPU, unable to load {}"), - label); + spdlog::error("BC/DXT1 compression is not supported on your GPU, unable to load {}", label); x0_fmt = ETexelFormat::RGBA8PC; x8_mips = 1; std::unique_ptr data = std::make_unique(x4_w * x6_h * 4); @@ -825,7 +824,7 @@ CTexture::CTexture(std::unique_ptr&& in, u32 length, bool otex, const CTex BuildDXT3(owned.get() + 12, length - 12, label); break; default: - Log.report(logvisor::Fatal, FMT_STRING("invalid texture type {} for boo"), int(x0_fmt)); + spdlog::fatal("invalid texture type {} for boo", int(x0_fmt)); } if (otex) @@ -837,7 +836,7 @@ void CTexture::Load(int slot, EClampMode clamp) const {} std::unique_ptr CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut, std::unique_ptr& paletteOut) const { if (!m_otex) - Log.report(logvisor::Fatal, FMT_STRING("MemoryCard TXTR not loaded with 'otex'")); + spdlog::fatal("MemoryCard TXTR not loaded with 'otex'"); size_t texelCount = x4_w * x6_h; std::unique_ptr ret; @@ -914,7 +913,7 @@ std::unique_ptr CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f } } } else - Log.report(logvisor::Fatal, FMT_STRING("MemoryCard texture may only use RGBA8PC or C8PC format")); + spdlog::fatal("MemoryCard texture may only use RGBA8PC or C8PC format"); return ret; } diff --git a/Runtime/GuiSys/CAuiImagePane.cpp b/Runtime/GuiSys/CAuiImagePane.cpp index 870ca35fe..1258433b5 100644 --- a/Runtime/GuiSys/CAuiImagePane.cpp +++ b/Runtime/GuiSys/CAuiImagePane.cpp @@ -162,7 +162,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) { if (!GetIsVisible() || !xb8_tex0Tok.IsLoaded()) { return; } - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CAuiImagePane::Draw {}"), m_name).c_str(), zeus::skCyan); + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CAuiImagePane::Draw {}", m_name).c_str(), zeus::skCyan); GetIsFinishedLoadingWidgetSpecific(); zeus::CColor color = xa8_color2; color.a() *= params.x0_alphaMod; diff --git a/Runtime/GuiSys/CCompoundTargetReticle.cpp b/Runtime/GuiSys/CCompoundTargetReticle.cpp index f19fbb48b..a8b83e4f9 100644 --- a/Runtime/GuiSys/CCompoundTargetReticle.cpp +++ b/Runtime/GuiSys/CCompoundTargetReticle.cpp @@ -9,6 +9,7 @@ #include "Runtime/World/CPlayer.hpp" #include "Runtime/World/CScriptGrapplePoint.hpp" #include "Runtime/World/CWorld.hpp" +#include "Runtime/Formatting.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path @@ -64,7 +65,7 @@ CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr) , x208_lockonTimer(g_tweakTargeting->GetLockonDuration()) { xe0_outerBeamIconSquares.reserve(9); for (size_t i = 0; i < xe0_outerBeamIconSquares.capacity(); ++i) { - xe0_outerBeamIconSquares.emplace_back(fmt::format(FMT_STRING("{}{}"), skOuterBeamIconSquareNameBase, i)); + xe0_outerBeamIconSquares.emplace_back(fmt::format("{}{}", skOuterBeamIconSquareNameBase, i)); } x34_crosshairs.Lock(); } diff --git a/Runtime/GuiSys/CGuiFrame.cpp b/Runtime/GuiSys/CGuiFrame.cpp index f8c6d98ef..11e880339 100644 --- a/Runtime/GuiSys/CGuiFrame.cpp +++ b/Runtime/GuiSys/CGuiFrame.cpp @@ -122,7 +122,7 @@ void CGuiFrame::Reset() { x10_rootWidget->Reset(ETraversalMode::Children); } void CGuiFrame::Update(float dt) { xc_headWidget->Update(dt); } void CGuiFrame::Draw(const CGuiWidgetDrawParms& parms) const { - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CGuiFrame::Draw FRME_{}"), x0_id).c_str(), zeus::skMagenta); + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CGuiFrame::Draw FRME_{}", x0_id).c_str(), zeus::skMagenta); CGraphics::SetCullMode(ERglCullMode::None); CGraphics::ResetGfxStates(); CGraphics::SetAmbientColor(zeus::skWhite); diff --git a/Runtime/GuiSys/CGuiModel.cpp b/Runtime/GuiSys/CGuiModel.cpp index b23ac59ab..711fd93c1 100644 --- a/Runtime/GuiSys/CGuiModel.cpp +++ b/Runtime/GuiSys/CGuiModel.cpp @@ -47,7 +47,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) { } if (GetIsVisible()) { - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CGuiModel::Draw {}"), m_name).c_str(), zeus::skCyan); + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CGuiModel::Draw {}", m_name).c_str(), zeus::skCyan); zeus::CColor moduCol = xa8_color2; moduCol.a() *= parms.x0_alphaMod; xb0_frame->EnableLights(xcc_lightMask); diff --git a/Runtime/GuiSys/CGuiObject.hpp b/Runtime/GuiSys/CGuiObject.hpp index ce3cffd97..c52e825f8 100644 --- a/Runtime/GuiSys/CGuiObject.hpp +++ b/Runtime/GuiSys/CGuiObject.hpp @@ -6,6 +6,8 @@ #include #include +#include + namespace metaforce { struct CGuiWidgetDrawParms; diff --git a/Runtime/GuiSys/CGuiTextPane.cpp b/Runtime/GuiSys/CGuiTextPane.cpp index b87e079d2..914c103f0 100644 --- a/Runtime/GuiSys/CGuiTextPane.cpp +++ b/Runtime/GuiSys/CGuiTextPane.cpp @@ -54,7 +54,7 @@ void CGuiTextPane::Draw(const CGuiWidgetDrawParms& parms) { if (!GetIsVisible()) { return; } - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CGuiTextPane::Draw {}"), m_name).c_str(), zeus::skCyan); + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CGuiTextPane::Draw {}", m_name).c_str(), zeus::skCyan); zeus::CVector2f dims = GetDimensions(); diff --git a/Runtime/GuiSys/CGuiTextSupport.cpp b/Runtime/GuiSys/CGuiTextSupport.cpp index 3feda7dab..d89004efe 100644 --- a/Runtime/GuiSys/CGuiTextSupport.cpp +++ b/Runtime/GuiSys/CGuiTextSupport.cpp @@ -1,7 +1,5 @@ #include "Runtime/GuiSys/CGuiTextSupport.hpp" -#include - #include "Runtime/CSimplePool.hpp" #include "Runtime/Graphics/CGraphics.hpp" #include "Runtime/Graphics/CGraphicsPalette.hpp" @@ -11,6 +9,7 @@ #include "Runtime/GuiSys/CTextExecuteBuffer.hpp" #include "Runtime/GuiSys/CTextParser.hpp" #include "Runtime/CStringExtras.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { @@ -178,7 +177,7 @@ void CGuiTextSupport::CheckAndRebuildTextBuffer() { std::u16string initStr; if (x5c_fontId.IsValid()) - initStr = fmt::format(FMT_STRING(u"&font={};"), x5c_fontId); + initStr = fmt::format(u"&font={};", x5c_fontId); initStr += x0_string; g_TextParser->ParseText(*g_TextExecuteBuf, initStr.c_str(), initStr.size(), x14_props.xc_txtrMap); diff --git a/Runtime/GuiSys/CGuiWidget.cpp b/Runtime/GuiSys/CGuiWidget.cpp index b13a9d33e..186a14648 100644 --- a/Runtime/GuiSys/CGuiWidget.cpp +++ b/Runtime/GuiSys/CGuiWidget.cpp @@ -1,12 +1,9 @@ #include "Runtime/Graphics/CGraphics.hpp" #include "Runtime/GuiSys/CGuiWidget.hpp" #include "Runtime/GuiSys/CGuiFrame.hpp" - -#include +#include "Runtime/Logging.hpp" namespace metaforce { -static logvisor::Module Log("metaforce::CGuiWidget"); - CGuiWidget::CGuiWidget(const CGuiWidgetParms& parms) : x70_selfId(parms.x6_selfId) , x72_parentId(parms.x8_parentId) @@ -64,8 +61,7 @@ void CGuiWidget::ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWid in.ReadShort(); if (isWorker) { if (!parent->AddWorkerWidget(this)) { - Log.report(logvisor::Warning, - FMT_STRING("Warning: Discarding useless worker id. Parent is not a compound widget.")); + spdlog::warn("Warning: Discarding useless worker id. Parent is not a compound widget."); xb4_workerId = -1; } } diff --git a/Runtime/GuiSys/CHudBallInterface.cpp b/Runtime/GuiSys/CHudBallInterface.cpp index fde28f18d..8120ec61a 100644 --- a/Runtime/GuiSys/CHudBallInterface.cpp +++ b/Runtime/GuiSys/CHudBallInterface.cpp @@ -6,6 +6,7 @@ #include "Runtime/GuiSys/CGuiGroup.hpp" #include "Runtime/GuiSys/CGuiModel.hpp" #include "Runtime/GuiSys/CGuiTextPane.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { @@ -18,7 +19,7 @@ CHudBallInterface::CHudBallInterface(CGuiFrame& selHud, int pbAmount, int pbCapa xc_model_bombicon = static_cast(selHud.FindWidget("model_bombicon")); x10_textpane_bombdigits = static_cast(selHud.FindWidget("textpane_bombdigits")); for (int i = 0; i < 3; ++i) { - CGuiGroup* grp = static_cast(selHud.FindWidget(fmt::format(FMT_STRING("group_bombcount{}"), i))); + CGuiGroup* grp = static_cast(selHud.FindWidget(fmt::format("group_bombcount{}", i))); CGuiWidget* filled = grp->GetWorkerWidget(1); CGuiWidget* empty = grp->GetWorkerWidget(0); x14_group_bombfilled.push_back(filled); @@ -65,7 +66,7 @@ void CHudBallInterface::UpdatePowerBombReadoutColors() { void CHudBallInterface::SetBombParams(int pbAmount, int pbCapacity, int availableBombs, bool hasBombs, bool hasPb, bool init) { if (pbAmount != x40_pbAmount || init) { - x10_textpane_bombdigits->TextSupport().SetText(fmt::format(FMT_STRING("{:02d}"), pbAmount)); + x10_textpane_bombdigits->TextSupport().SetText(fmt::format("{:02d}", pbAmount)); x40_pbAmount = pbAmount; UpdatePowerBombReadoutColors(); } diff --git a/Runtime/GuiSys/CHudEnergyInterface.cpp b/Runtime/GuiSys/CHudEnergyInterface.cpp index f1587be8f..0d461ac5e 100644 --- a/Runtime/GuiSys/CHudEnergyInterface.cpp +++ b/Runtime/GuiSys/CHudEnergyInterface.cpp @@ -9,6 +9,7 @@ #include "Runtime/GuiSys/CGuiFrame.hpp" #include "Runtime/GuiSys/CGuiTextPane.hpp" #include "Runtime/GuiSys/CStringTable.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { @@ -96,7 +97,7 @@ void CHudEnergyInterface::Update(float dt, float energyLowPulse) { x1c_26_barDirty = false; x18_cachedBarEnergy = x2c_energybart01_energybar->GetFilledEnergy(); std::string string = - fmt::format(FMT_STRING("{:02d}"), int(std::fmod(x18_cachedBarEnergy, CPlayerState::GetEnergyTankCapacity()))); + fmt::format("{:02d}", int(std::fmod(x18_cachedBarEnergy, CPlayerState::GetEnergyTankCapacity()))); x20_textpane_energydigits->TextSupport().SetText(string); } diff --git a/Runtime/GuiSys/CHudMissileInterface.cpp b/Runtime/GuiSys/CHudMissileInterface.cpp index ab530339e..bd16818aa 100644 --- a/Runtime/GuiSys/CHudMissileInterface.cpp +++ b/Runtime/GuiSys/CHudMissileInterface.cpp @@ -9,6 +9,7 @@ #include "Runtime/GuiSys/CGuiModel.hpp" #include "Runtime/GuiSys/CGuiTextPane.hpp" #include "Runtime/GuiSys/CStringTable.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { @@ -214,7 +215,7 @@ void CHudMissileInterface::SetChargeBeamFactor(float t) { x4c_chargeBeamFactor = void CHudMissileInterface::SetNumMissiles(int numMissiles, const CStateManager& mgr) { numMissiles = zeus::clamp(0, numMissiles, 999); - x60_textpane_missiledigits->TextSupport().SetText(fmt::format(FMT_STRING("{:3d}"), numMissiles)); + x60_textpane_missiledigits->TextSupport().SetText(fmt::format("{:3d}", numMissiles)); if (x8_numMissles < numMissiles) { xc_arrowTimer = g_tweakGui->GetMissileArrowVisTime(); diff --git a/Runtime/GuiSys/CHudThreatInterface.cpp b/Runtime/GuiSys/CHudThreatInterface.cpp index 30fb727a1..4e5ec2685 100644 --- a/Runtime/GuiSys/CHudThreatInterface.cpp +++ b/Runtime/GuiSys/CHudThreatInterface.cpp @@ -9,6 +9,7 @@ #include "Runtime/GuiSys/CGuiTextPane.hpp" #include "Runtime/GuiSys/CStringTable.hpp" #include "Runtime/Audio/CSfxManager.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { @@ -87,7 +88,7 @@ void CHudThreatInterface::Update(float dt) { if (x10_threatDist < maxThreatEnergy) { x70_textpane_threatdigits->SetIsVisible(true); x70_textpane_threatdigits->TextSupport().SetText( - fmt::format(FMT_STRING("{:01.1f}"), std::max(0.f, x10_threatDist))); + fmt::format("{:01.1f}", std::max(0.f, x10_threatDist))); } else { x70_textpane_threatdigits->SetIsVisible(false); } diff --git a/Runtime/GuiSys/CHudVisorBeamMenu.cpp b/Runtime/GuiSys/CHudVisorBeamMenu.cpp index 7a930efab..d933a82f4 100644 --- a/Runtime/GuiSys/CHudVisorBeamMenu.cpp +++ b/Runtime/GuiSys/CHudVisorBeamMenu.cpp @@ -9,6 +9,7 @@ #include "Runtime/GuiSys/CGuiModel.hpp" #include "Runtime/GuiSys/CGuiTextPane.hpp" #include "Runtime/GuiSys/CStringTable.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { @@ -64,7 +65,7 @@ CHudVisorBeamMenu::CHudVisorBeamMenu(CGuiFrame& baseHud, EHudVisorBeamMenu type, x18_basewidget_menu = x0_baseHud.FindWidget(BaseMenuNames[size_t(swappedType)]); x24_model_ghost = - static_cast(x0_baseHud.FindWidget(fmt::format(FMT_STRING("{}ghost"), ModelNames[size_t(x4_type)]))); + static_cast(x0_baseHud.FindWidget(fmt::format("{}ghost", ModelNames[size_t(x4_type)]))); x28_menuItems.resize(4); for (size_t i = 0; i < x28_menuItems.size(); i++) { @@ -73,9 +74,9 @@ CHudVisorBeamMenu::CHudVisorBeamMenu(CGuiFrame& baseHud, EHudVisorBeamMenu type, SMenuItem& item = x28_menuItems[i]; item.x0_model_loz = - static_cast(x0_baseHud.FindWidget(fmt::format(FMT_STRING("{}loz{}"), modelName, menuItemOrder))); + static_cast(x0_baseHud.FindWidget(fmt::format("{}loz{}", modelName, menuItemOrder))); item.x4_model_icon = - static_cast(x0_baseHud.FindWidget(fmt::format(FMT_STRING("{}icon{}"), modelName, menuItemOrder))); + static_cast(x0_baseHud.FindWidget(fmt::format("{}icon{}", modelName, menuItemOrder))); item.xc_opacity = enables[i] ? 1.f : 0.f; } diff --git a/Runtime/ImGuiConsole.cpp b/Runtime/ImGuiConsole.cpp index b1a31dc44..7c7926cc8 100644 --- a/Runtime/ImGuiConsole.cpp +++ b/Runtime/ImGuiConsole.cpp @@ -20,7 +20,8 @@ #include #endif -#include +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" #include @@ -44,8 +45,6 @@ extern size_t g_lastStorageSize; #include "TCastTo.hpp" // Generated file, do not modify include path namespace metaforce { -static logvisor::Module Log{"Console"}; - std::array ImGuiConsole::entities; std::set ImGuiConsole::inspectingEntities; ImGuiPlayerLoadouts ImGuiConsole::loadouts; @@ -235,7 +234,7 @@ void ImGuiConsole::BeginEntityRow(const ImGuiEntityEntry& entry) { ImGui::PushStyleColor(ImGuiCol_Text, textColor); if (ImGui::TableNextColumn()) { - auto text = fmt::format(FMT_STRING("0x{:04X}"), entry.uid.Value()); + auto text = fmt::format("0x{:04X}", entry.uid.Value()); ImGui::Selectable(text.c_str(), &entry.ent->m_debugSelected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap); if (ImGui::IsItemHovered()) { @@ -396,7 +395,7 @@ bool ImGuiConsole::ShowEntityInfoWindow(TUniqueId uid) { if (entry.ent == nullptr) { return false; } - auto name = fmt::format(FMT_STRING("{}##0x{:04X}"), !entry.name.empty() ? entry.name : entry.type, uid.Value()); + auto name = fmt::format("{}##0x{:04X}", !entry.name.empty() ? entry.name : entry.type, uid.Value()); if (ImGui::Begin(name.c_str(), &open, ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::PushID(uid.Value()); entry.ent->ImGuiInspect(); @@ -699,7 +698,7 @@ void ImGuiConsole::ShowAboutWindow(bool preLaunch) { if (nfdResult == NFD_OKAY) { m_gameDiscSelected = outPath.get(); } else if (nfdResult != NFD_CANCEL) { - Log.report(logvisor::Error, FMT_STRING("nativefiledialog error: {}"), NFD::GetError()); + spdlog::error("nativefiledialog error: {}", NFD::GetError()); } } #endif @@ -807,9 +806,9 @@ static std::string BytesToString(size_t bytes) { count /= 1024.0; } if (count - floor(count) == 0.0) { - return fmt::format(FMT_STRING("{}{}"), static_cast(count), suffixes[s]); + return fmt::format("{}{}", static_cast(count), suffixes[s]); } - return fmt::format(FMT_STRING("{:.1f}{}"), count, suffixes[s]); + return fmt::format("{:.1f}{}", count, suffixes[s]); } void ImGuiConsole::ShowDebugOverlay() { @@ -831,7 +830,7 @@ void ImGuiConsole::ShowDebugOverlay() { if (ImGui::Begin("Debug Overlay", nullptr, windowFlags)) { bool hasPrevious = false; if (m_frameCounter && g_StateManager != nullptr) { - ImGuiStringViewText(fmt::format(FMT_STRING("Frame: {}\n"), g_StateManager->GetUpdateFrameIndex())); + ImGuiStringViewText(fmt::format("Frame: {}\n", g_StateManager->GetUpdateFrameIndex())); hasPrevious = true; } if (m_frameRate) { @@ -840,7 +839,7 @@ void ImGuiConsole::ShowDebugOverlay() { } hasPrevious = true; - ImGuiStringViewText(fmt::format(FMT_STRING("FPS: {:.1f}\n"), io.Framerate)); + ImGuiStringViewText(fmt::format("FPS: {:.1f}\n", io.Framerate)); } if (m_inGameTime && g_GameState != nullptr) { if (hasPrevious) { @@ -852,7 +851,7 @@ void ImGuiConsole::ShowDebugOverlay() { u32 ms = u64(igt * 1000) % 1000; auto pt = std::div(int(igt), 3600); ImGuiStringViewText( - fmt::format(FMT_STRING("Play Time: {:02d}:{:02d}:{:02d}.{:03d}\n"), pt.quot, pt.rem / 60, pt.rem % 60, ms)); + fmt::format("Play Time: {:02d}:{:02d}:{:02d}.{:03d}\n", pt.quot, pt.rem / 60, pt.rem % 60, ms)); } if (m_roomTimer && g_StateManager != nullptr) { if (hasPrevious) { @@ -864,8 +863,8 @@ void ImGuiConsole::ShowDebugOverlay() { double currentRoomTime = igt - m_currentRoomStart; u32 curFrames = u32(std::round(u32(currentRoomTime * 60))); u32 lastFrames = u32(std::round(u32(m_lastRoomTime * 60))); - ImGuiStringViewText(fmt::format(FMT_STRING("Room Time: {:7.3f} / {:5d} | Last Room:{:7.3f} / {:5d}\n"), - currentRoomTime, curFrames, m_lastRoomTime, lastFrames)); + ImGuiStringViewText(fmt::format("Room Time: {:7.3f} / {:5d} | Last Room:{:7.3f} / {:5d}\n", currentRoomTime, + curFrames, m_lastRoomTime, lastFrames)); } if (m_playerInfo && g_StateManager != nullptr && g_StateManager->Player() != nullptr && m_developer) { if (hasPrevious) { @@ -878,12 +877,12 @@ void ImGuiConsole::ShowDebugOverlay() { const zeus::CTransform camXf = g_StateManager->GetCameraManager()->GetCurrentCameraTransform(*g_StateManager); const zeus::CQuaternion camQ = zeus::CQuaternion(camXf.getRotation().buildMatrix3f()); ImGuiStringViewText( - fmt::format(FMT_STRING("Player Position x: {: .2f}, y: {: .2f}, z: {: .2f}\n" - " Roll: {: .2f}, Pitch: {: .2f}, Yaw: {: .2f}\n" - " Momentum x: {: .2f}, y: {: .2f}, z: {: .2f}\n" - " Velocity x: {: .2f}, y: {: .2f}, z: {: .2f}\n" - "Camera Position x: {: .2f}, y: {: .2f}, z {: .2f}\n" - " Roll: {: .2f}, Pitch: {: .2f}, Yaw: {: .2f}\n"), + fmt::format("Player Position x: {: .2f}, y: {: .2f}, z: {: .2f}\n" + " Roll: {: .2f}, Pitch: {: .2f}, Yaw: {: .2f}\n" + " Momentum x: {: .2f}, y: {: .2f}, z: {: .2f}\n" + " Velocity x: {: .2f}, y: {: .2f}, z: {: .2f}\n" + "Camera Position x: {: .2f}, y: {: .2f}, z {: .2f}\n" + " Roll: {: .2f}, Pitch: {: .2f}, Yaw: {: .2f}\n", pl.GetTranslation().x(), pl.GetTranslation().y(), pl.GetTranslation().z(), zeus::radToDeg(plQ.roll()), zeus::radToDeg(plQ.pitch()), zeus::radToDeg(plQ.yaw()), pl.GetMomentum().x(), pl.GetMomentum().y(), pl.GetMomentum().z(), pl.GetVelocity().x(), @@ -897,8 +896,7 @@ void ImGuiConsole::ShowDebugOverlay() { hasPrevious = true; const std::string name = ImGuiLoadStringTable(g_StateManager->GetWorld()->IGetStringTableAssetId(), 0); - ImGuiStringViewText( - fmt::format(FMT_STRING("World Asset ID: 0x{}, Name: {}\n"), g_GameState->CurrentWorldAssetId(), name)); + ImGuiStringViewText(fmt::format("World Asset ID: 0x{}, Name: {}\n", g_GameState->CurrentWorldAssetId(), name)); } if (m_areaInfo && g_StateManager != nullptr && m_developer) { const metaforce::TAreaId aId = g_GameState->CurrentWorldState().GetCurrentAreaId(); @@ -921,9 +919,9 @@ void ImGuiConsole::ShowDebugOverlay() { } CGameArea* pArea = g_StateManager->GetWorld()->GetArea(aId); CAssetId stringId = pArea->IGetStringTableAssetId(); - ImGuiStringViewText( - fmt::format(FMT_STRING("Area Asset ID: 0x{}, Name: {}\nArea ID: {}, Active Layer bits: {}\n"), - pArea->GetAreaAssetId(), ImGuiLoadStringTable(stringId, 0), pArea->GetAreaId(), layerBits)); + ImGuiStringViewText(fmt::format("Area Asset ID: 0x{}, Name: {}\nArea ID: {}, Active Layer bits: {}\n", + pArea->GetAreaAssetId(), ImGuiLoadStringTable(stringId, 0), pArea->GetAreaId(), + layerBits)); } } if (m_layerInfo && g_StateManager != nullptr && m_developer) { @@ -962,9 +960,8 @@ void ImGuiConsole::ShowDebugOverlay() { } hasPrevious = true; - ImGuiStringViewText( - fmt::format(FMT_STRING("CRandom16::Next calls: {}\n"), metaforce::CRandom16::GetNumNextCalls())); - ImGuiStringViewText(fmt::format(FMT_STRING("CRandom16::LastSeed: 0x{:08X}\n"), CRandom16::GetLastSeed())); + ImGuiStringViewText(fmt::format("CRandom16::Next calls: {}\n", metaforce::CRandom16::GetNumNextCalls())); + ImGuiStringViewText(fmt::format("CRandom16::LastSeed: 0x{:08X}\n", CRandom16::GetLastSeed())); } if (m_resourceStats && g_SimplePool != nullptr) { if (hasPrevious) { @@ -972,7 +969,7 @@ void ImGuiConsole::ShowDebugOverlay() { } hasPrevious = true; - ImGuiStringViewText(fmt::format(FMT_STRING("Resource Objects: {}\n"), g_SimplePool->GetLiveObjects())); + ImGuiStringViewText(fmt::format("Resource Objects: {}\n", g_SimplePool->GetLiveObjects())); } if (m_pipelineInfo && m_developer) { if (hasPrevious) { @@ -980,8 +977,8 @@ void ImGuiConsole::ShowDebugOverlay() { } hasPrevious = true; - ImGuiStringViewText(fmt::format(FMT_STRING("Queued pipelines: {}\n"), aurora::gfx::queuedPipelines)); - ImGuiStringViewText(fmt::format(FMT_STRING("Done pipelines: {}\n"), aurora::gfx::createdPipelines)); + ImGuiStringViewText(fmt::format("Queued pipelines: {}\n", aurora::gfx::queuedPipelines.load())); + ImGuiStringViewText(fmt::format("Done pipelines: {}\n", aurora::gfx::createdPipelines.load())); } if (m_drawCallInfo && m_developer) { if (hasPrevious) { @@ -989,8 +986,8 @@ void ImGuiConsole::ShowDebugOverlay() { } hasPrevious = true; - ImGuiStringViewText(fmt::format(FMT_STRING("Draw call count: {}\n"), aurora::gfx::g_drawCallCount)); - ImGuiStringViewText(fmt::format(FMT_STRING("Merged draw calls: {}\n"), aurora::gfx::g_mergedDrawCallCount)); + ImGuiStringViewText(fmt::format("Draw call count: {}\n", aurora::gfx::g_drawCallCount)); + ImGuiStringViewText(fmt::format("Merged draw calls: {}\n", aurora::gfx::g_mergedDrawCallCount)); } if (m_bufferInfo && m_developer) { if (hasPrevious) { @@ -998,15 +995,11 @@ void ImGuiConsole::ShowDebugOverlay() { } hasPrevious = true; - ImGuiStringViewText( - fmt::format(FMT_STRING("Vertex size: {}\n"), BytesToString(aurora::gfx::g_lastVertSize))); - ImGuiStringViewText( - fmt::format(FMT_STRING("Uniform size: {}\n"), BytesToString(aurora::gfx::g_lastUniformSize))); - ImGuiStringViewText( - fmt::format(FMT_STRING("Index size: {}\n"), BytesToString(aurora::gfx::g_lastIndexSize))); - ImGuiStringViewText( - fmt::format(FMT_STRING("Storage size: {}\n"), BytesToString(aurora::gfx::g_lastStorageSize))); - ImGuiStringViewText(fmt::format(FMT_STRING("Total: {}\n"), + ImGuiStringViewText(fmt::format("Vertex size: {}\n", BytesToString(aurora::gfx::g_lastVertSize))); + ImGuiStringViewText(fmt::format("Uniform size: {}\n", BytesToString(aurora::gfx::g_lastUniformSize))); + ImGuiStringViewText(fmt::format("Index size: {}\n", BytesToString(aurora::gfx::g_lastIndexSize))); + ImGuiStringViewText(fmt::format("Storage size: {}\n", BytesToString(aurora::gfx::g_lastStorageSize))); + ImGuiStringViewText(fmt::format("Total: {}\n", BytesToString(aurora::gfx::g_lastVertSize + aurora::gfx::g_lastUniformSize + aurora::gfx::g_lastIndexSize + aurora::gfx::g_lastStorageSize))); } @@ -1858,7 +1851,7 @@ void ImGuiConsole::ShowPipelineProgress() { ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing); const auto percent = static_cast(createdPipelines) / static_cast(totalPipelines); - const auto progressStr = fmt::format(FMT_STRING("Processing pipelines: {} / {}"), createdPipelines, totalPipelines); + const auto progressStr = fmt::format("Processing pipelines: {} / {}", createdPipelines, totalPipelines); const auto textSize = ImGui::CalcTextSize(progressStr.data(), progressStr.data() + progressStr.size()); ImGui::NewLine(); ImGui::SameLine(ImGui::GetWindowWidth() / 2.f - textSize.x + textSize.x / 2.f); @@ -1870,14 +1863,14 @@ void ImGuiConsole::ShowPipelineProgress() { void ImGuiConsole::ControllerAdded(uint32_t idx) { const char* name = PADGetName(idx); if (name != nullptr) { - m_toasts.emplace_back(fmt::format(FMT_STRING("Controller {} ({}) connected"), idx, name), 5.f); + m_toasts.emplace_back(fmt::format("Controller {} ({}) connected", idx, name), 5.f); } else { - m_toasts.emplace_back(fmt::format(FMT_STRING("Controller {} connected"), idx), 5.f); + m_toasts.emplace_back(fmt::format("Controller {} connected", idx), 5.f); } } void ImGuiConsole::ControllerRemoved(uint32_t idx) { - m_toasts.emplace_back(fmt::format(FMT_STRING("Controller {} disconnected"), idx), 5.f); + m_toasts.emplace_back(fmt::format("Controller {} disconnected", idx), 5.f); } static void ImGuiCVarCheckbox(CVarManager& mgr, std::string_view cvarName, const char* label, bool* ptr = nullptr) { @@ -1910,7 +1903,7 @@ void ImGuiConsole::ShowPreLaunchSettingsWindow() { if (ImGui::BeginTabItem("Graphics")) { size_t backendCount = 0; const auto* backends = aurora_get_available_backends(&backendCount); - ImGuiStringViewText(fmt::format(FMT_STRING("Current backend: {}"), backend_name(aurora_get_backend()))); + ImGuiStringViewText(fmt::format("Current backend: {}", backend_name(aurora_get_backend()))); auto desiredBackend = static_cast(BACKEND_AUTO); if (auto* cvar = m_cvarMgr.findCVar("graphicsApi")) { bool valid = false; diff --git a/Runtime/ImGuiControllerConfig.cpp b/Runtime/ImGuiControllerConfig.cpp index 39a564942..12dcdc4d5 100644 --- a/Runtime/ImGuiControllerConfig.cpp +++ b/Runtime/ImGuiControllerConfig.cpp @@ -4,6 +4,7 @@ #include "Runtime/Streams/CFileOutStream.hpp" #include "Runtime/Streams/ContainerReaders.hpp" #include "Runtime/Streams/ContainerWriters.hpp" +#include "Runtime/Formatting.hpp" #include @@ -77,23 +78,23 @@ void ImGuiControllerConfig::show(bool& visible) { std::vector controllers; controllers.push_back("None"); for (u32 i = 0; i < PADCount(); ++i) { - controllers.push_back(fmt::format(FMT_STRING("{}-{}"), PADGetNameForControllerIndex(i), i)); + controllers.push_back(fmt::format("{}-{}", PADGetNameForControllerIndex(i), i)); } m_pendingValid = false; if (ImGui::Begin("Controller Config", &visible)) { if (ImGui::CollapsingHeader("Ports")) { for (u32 i = 0; i < 4; ++i) { - ImGui::PushID(fmt::format(FMT_STRING("PortConf-{}"), i).c_str()); + ImGui::PushID(fmt::format("PortConf-{}", i).c_str()); s32 index = PADGetIndexForPort(i); int sel = 0; std::string name = "None"; const char* tmpName = PADGetName(i); bool changed = false; if (tmpName != nullptr) { - name = fmt::format(FMT_STRING("{}-{}"), tmpName, index); + name = fmt::format("{}-{}", tmpName, index); } - if (ImGui::BeginCombo(fmt::format(FMT_STRING("Port {}"), i + 1).c_str(), name.c_str())) { + if (ImGui::BeginCombo(fmt::format("Port {}", i + 1).c_str(), name.c_str())) { for (u32 j = 0; const auto& s : controllers) { if (ImGui::Selectable(s.c_str(), name == s)) { sel = j; @@ -116,8 +117,8 @@ void ImGuiControllerConfig::show(bool& visible) { } if (ImGui::BeginTabBar("Controllers")) { for (u32 i = 0; i < 4; ++i) { - if (ImGui::BeginTabItem(fmt::format(FMT_STRING("Port {}"), i + 1).c_str())) { - ImGui::PushID(fmt::format(FMT_STRING("Port_{}"), i + 1).c_str()); + if (ImGui::BeginTabItem(fmt::format("Port {}", i + 1).c_str())) { + ImGui::PushID(fmt::format("Port_{}", i + 1).c_str()); /* If the tab is changed while pending for input, cancel the pending port */ if (m_pendingMapping != nullptr && m_pendingPort != i) { m_pendingMapping = nullptr; diff --git a/Runtime/ImGuiEntitySupport.cpp b/Runtime/ImGuiEntitySupport.cpp index aedaed71c..ced38947b 100644 --- a/Runtime/ImGuiEntitySupport.cpp +++ b/Runtime/ImGuiEntitySupport.cpp @@ -158,6 +158,7 @@ #include "Runtime/World/CWorld.hpp" #include "Runtime/World/CGameArea.hpp" #include "Runtime/GameGlobalObjects.hpp" +#include "Runtime/Formatting.hpp" #include "ImGuiConsole.hpp" #include "imgui.h" @@ -797,7 +798,7 @@ IMGUI_ENTITY_INSPECT(CScriptDock, CPhysicsActor, ScriptDock, { auto areaId = dock->GetConnectedAreaId(dock->GetReferenceCount()); if (areaId != kInvalidAreaId) { CAssetId stringId = g_StateManager->GetWorld()->GetArea(areaId)->IGetStringTableAssetId(); - ImGuiStringViewText(fmt::format(FMT_STRING("Connected Area: {}"), ImGuiLoadStringTable(stringId, 0))); + ImGuiStringViewText(fmt::format("Connected Area: {}", ImGuiLoadStringTable(stringId, 0))); } } } diff --git a/Runtime/ImGuiPlayerLoadouts.cpp b/Runtime/ImGuiPlayerLoadouts.cpp index 5ecae7a27..c0027f53e 100644 --- a/Runtime/ImGuiPlayerLoadouts.cpp +++ b/Runtime/ImGuiPlayerLoadouts.cpp @@ -1,15 +1,15 @@ #include "Runtime/ImGuiPlayerLoadouts.hpp" #include "Runtime/Streams/ContainerReaders.hpp" #include "Runtime/Streams/ContainerWriters.hpp" - -#include +#include "Runtime/Logging.hpp" #include "magic_enum.hpp" + namespace metaforce { namespace { -logvisor::Module Log("metaforce::ImGuiPlayerLoadouts"); constexpr u32 CurrentVersion = 1; } // namespace + ImGuiPlayerLoadouts::Item::Item(CInputStream& in) : type(magic_enum::enum_cast(in.Get()).value()), amount(in.ReadLong()) {} @@ -29,7 +29,7 @@ ImGuiPlayerLoadouts::ImGuiPlayerLoadouts(CInputStream& in) { in.Get(reinterpret_cast(&magic), 4); auto version = in.ReadLong(); if (magic != FOURCC('LOAD') && version != CurrentVersion) { - Log.report(logvisor::Error, FMT_STRING("Incorrect loadout version, expected {} got {}"), CurrentVersion, version); + spdlog::error("Incorrect loadout version, expected {} got {}", CurrentVersion, version); return; } read_vector(loadouts, in); diff --git a/Runtime/Input/CDolphinController.cpp b/Runtime/Input/CDolphinController.cpp index 24bfc24cd..21fae28f0 100644 --- a/Runtime/Input/CDolphinController.cpp +++ b/Runtime/Input/CDolphinController.cpp @@ -1,6 +1,9 @@ #include "Runtime/Input/CDolphinController.hpp" #include +#include + +#include namespace metaforce { CDolphinController::CDolphinController() { diff --git a/Runtime/Input/CFinalInput.hpp b/Runtime/Input/CFinalInput.hpp index d0b59e4b7..d3b5dd828 100644 --- a/Runtime/Input/CFinalInput.hpp +++ b/Runtime/Input/CFinalInput.hpp @@ -1,6 +1,8 @@ #pragma once #include +#include +#include #include "Runtime/Input/CKeyboardMouseController.hpp" #include "Runtime/Input/CControllerGamepadData.hpp" diff --git a/Runtime/Input/CRumbleGenerator.cpp b/Runtime/Input/CRumbleGenerator.cpp index 315e53510..1b094d92f 100644 --- a/Runtime/Input/CRumbleGenerator.cpp +++ b/Runtime/Input/CRumbleGenerator.cpp @@ -36,7 +36,7 @@ void CRumbleGenerator::Update(float dt) { if (xe0_commandArray[i] != EMotorState::Stop) { #if PWM_MONITOR s_tp = now; - fmt::print(FMT_STRING("{}ms ON\n"), ms); + spdlog::debug("{}ms ON\n", ms); #endif xe0_commandArray[i] = EMotorState::Stop; updated = true; @@ -48,7 +48,7 @@ void CRumbleGenerator::Update(float dt) { if (xe0_commandArray[i] != EMotorState::Rumble) { #if PWM_MONITOR s_tp = now; - fmt::print(FMT_STRING("{}ms Off\n"), ms); + spdlog::debug("{}ms Off\n", ms); #endif xe0_commandArray[i] = EMotorState::Rumble; updated = true; @@ -60,7 +60,7 @@ void CRumbleGenerator::Update(float dt) { if (xe0_commandArray[i] != EMotorState::Stop) { #if PWM_MONITOR s_tp = now; - fmt::print(FMT_STRING("{}ms ON\n"), ms); + spdlog::debug("{}ms ON\n", ms); #endif xe0_commandArray[i] = EMotorState::Stop; updated = true; diff --git a/Runtime/Logging.hpp b/Runtime/Logging.hpp new file mode 100644 index 000000000..e8e0b26b6 --- /dev/null +++ b/Runtime/Logging.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include // IWYU pragma: export + +namespace spdlog { +template +[[noreturn]] inline void fatal(format_string_t fmt, Args&&... args) { + default_logger_raw()->critical(fmt, std::forward(args)...); + default_logger_raw()->flush(); + std::terminate(); +} +} // namespace spdlog diff --git a/Runtime/MP1/CCredits.cpp b/Runtime/MP1/CCredits.cpp index 1495989cb..452e03cd7 100644 --- a/Runtime/MP1/CCredits.cpp +++ b/Runtime/MP1/CCredits.cpp @@ -13,8 +13,6 @@ #include "Runtime/MP1/CPlayMovie.hpp" namespace metaforce::MP1 { -static logvisor::Module Log("CCredits"); - CCredits::CCredits() : CIOWin("Credits") , x18_creditsTable(g_SimplePool->GetObj(g_tweakGui->GetCreditsTable())) diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp index 0e644b6a3..e0c913368 100644 --- a/Runtime/MP1/CFrontEndUI.cpp +++ b/Runtime/MP1/CFrontEndUI.cpp @@ -459,9 +459,9 @@ std::u16string GetTimeString(const CGameState::GameFileStateInfo* data) { if (data) { auto pt = std::div(data->x0_playTime, 3600); #if FE_USE_SECONDS_IN_ELAPSED - return fmt::format(FMT_STRING(u"{:02d}:{:02d}:{:02d}"), pt.quot, pt.rem / 60, pt.rem % 60); + return fmt::format(u"{:02d}:{:02d}:{:02d}", pt.quot, pt.rem / 60, pt.rem % 60); #else - return fmt::format(FMT_STRING(u"{:02d}:{:02d}"), pt.quot, pt.rem / 60); + return fmt::format(u"{:02d}:{:02d}", pt.quot, pt.rem / 60); #endif } if (!g_Main->IsUSA() || g_Main->IsTrilogy()) @@ -500,7 +500,7 @@ void CFrontEndUI::SNewFileSelectFrame::SetupFrameContents() { strIdx = (strIdx == 106 ? 100 : 40); std::u16string fileStr = g_MainStringTable->GetString(strIdx + int(i)); - str = fileStr + fmt::format(FMT_STRING(u" {:02d}%"), data->x18_itemPercent); + str = fileStr + fmt::format(u" {:02d}%", data->x18_itemPercent); break; } str = g_MainStringTable->GetString(36); @@ -637,11 +637,11 @@ void CFrontEndUI::SNewFileSelectFrame::DoFileMenuAdvance(CGuiTableGroup* caller) CFrontEndUI::SFileMenuOption CFrontEndUI::SNewFileSelectFrame::FindFileSelectOption(CGuiFrame* frame, int idx) { SFileMenuOption ret; - ret.x0_base = frame->FindWidget(fmt::format(FMT_STRING("basewidget_file{}"), idx)); - ret.x4_textpanes[0] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_filename{}"), idx)); - ret.x4_textpanes[1] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_world{}"), idx)); - ret.x4_textpanes[2] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_playtime{}"), idx)); - ret.x4_textpanes[3] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_date{}"), idx)); + ret.x0_base = frame->FindWidget(fmt::format("basewidget_file{}", idx)); + ret.x4_textpanes[0] = FindTextPanePair(frame, fmt::format("textpane_filename{}", idx)); + ret.x4_textpanes[1] = FindTextPanePair(frame, fmt::format("textpane_world{}", idx)); + ret.x4_textpanes[2] = FindTextPanePair(frame, fmt::format("textpane_playtime{}", idx)); + ret.x4_textpanes[3] = FindTextPanePair(frame, fmt::format("textpane_date{}", idx)); return ret; } @@ -1066,14 +1066,14 @@ void CFrontEndUI::SGuiTextPair::SetPairText(std::u16string_view str) { CFrontEndUI::SGuiTextPair CFrontEndUI::FindTextPanePair(CGuiFrame* frame, std::string_view name) { SGuiTextPair ret; ret.x0_panes[0] = static_cast(frame->FindWidget(name)); - ret.x0_panes[1] = static_cast(frame->FindWidget(fmt::format(FMT_STRING("{}b"), name))); + ret.x0_panes[1] = static_cast(frame->FindWidget(fmt::format("{}b", name))); return ret; } void CFrontEndUI::FindAndSetPairText(CGuiFrame* frame, std::string_view name, std::u16string_view str) { CGuiTextPane* w1 = static_cast(frame->FindWidget(name)); w1->TextSupport().SetText(str); - CGuiTextPane* w2 = static_cast(frame->FindWidget(fmt::format(FMT_STRING("{}b"), name))); + CGuiTextPane* w2 = static_cast(frame->FindWidget(fmt::format("{}b", name))); w2->TextSupport().SetText(str); } @@ -1469,7 +1469,7 @@ void CFrontEndUI::SOptionsFrontEndFrame::SetRightUIText() { (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? GameOptionsRegistry[userSel] : GameOptionsRegistryNew[userSel]; for (int i = 0; i < 5; ++i) { - std::string name = fmt::format(FMT_STRING("textpane_right{}"), i); + std::string name = fmt::format("textpane_right{}", i); if (i < static_cast(options.first)) { FindTextPanePair(x1c_loadedFrame, name).SetPairText(x20_loadedPauseStrg->GetString(options.second[i].stringId)); x28_tablegroup_rightmenu->GetWorkerWidget(i)->SetIsSelectable(true); @@ -1537,7 +1537,7 @@ void CFrontEndUI::SOptionsFrontEndFrame::FinishedLoading() { // Visor, Display, Sound, Controller for (int i = 0; i < 4; ++i) { - const std::string name = fmt::format(FMT_STRING("textpane_filename{}"), i); + const std::string name = fmt::format("textpane_filename{}", i); FindTextPanePair(x1c_loadedFrame, name) .SetPairText(x20_loadedPauseStrg->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy() ? 16 : 18) + i)); } @@ -1653,7 +1653,7 @@ void CFrontEndUI::StartSlideShow(CArchitectureQueue& queue) { } std::string CFrontEndUI::GetAttractMovieFileName(int idx) { - return fmt::format(FMT_STRING("Video/attract{}.thp"), idx); + return fmt::format("Video/attract{}.thp", idx); } std::string CFrontEndUI::GetNextAttractMovieFileName() { diff --git a/Runtime/MP1/CMemoryCardDriver.cpp b/Runtime/MP1/CMemoryCardDriver.cpp index fbcc9675b..8aac15515 100644 --- a/Runtime/MP1/CMemoryCardDriver.cpp +++ b/Runtime/MP1/CMemoryCardDriver.cpp @@ -671,7 +671,7 @@ void CMemoryCardDriver::InitializeFileInfo() { ExportPersistentOptions(); OSCalendarTime time = CBasics::ToCalendarTime(std::chrono::system_clock::now()); - std::string timeString = fmt::format(FMT_STRING("{:02d}.{:02d}.{:02d} {:02d}:{:02d}"), time.x10_mon + 1, + std::string timeString = fmt::format("{:02d}.{:02d}.{:02d} {:02d}:{:02d}", time.x10_mon + 1, time.xc_mday, time.x14_year % 100, time.x8_hour, time.x4_min); std::string comment("Metroid Prime "); comment += timeString; diff --git a/Runtime/MP1/CPauseScreen.cpp b/Runtime/MP1/CPauseScreen.cpp index 50a39ba0c..6939efc87 100644 --- a/Runtime/MP1/CPauseScreen.cpp +++ b/Runtime/MP1/CPauseScreen.cpp @@ -9,6 +9,7 @@ #include "Runtime/Input/ControlMapper.hpp" #include "Runtime/MP1/CLogBookScreen.hpp" #include "Runtime/MP1/COptionsScreen.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce::MP1 { @@ -218,21 +219,21 @@ void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinal } x38_textpane_l1->TextSupport().SetText(fmt::format( - FMT_STRING("&image={};"), + "&image={};", g_tweakPlayerRes ->x74_lTrigger[ControlMapper::GetDigitalInput(ControlMapper::ECommands::PreviousPauseScreen, useInput) || m_lDown])); x3c_textpane_r->TextSupport().SetText(fmt::format( - FMT_STRING("&image={};"), + "&image={};", g_tweakPlayerRes ->x80_rTrigger[ControlMapper::GetDigitalInput(ControlMapper::ECommands::NextPauseScreen, useInput) || m_rDown])); x48_textpane_return->TextSupport().SetText( - fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->x8c_startButton[useInput.DStart() || m_returnDown])); + fmt::format("&image={};", g_tweakPlayerRes->x8c_startButton[useInput.DStart() || m_returnDown])); x50_textpane_back->TextSupport().SetText( - fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->x98_aButton[useInput.DA() || m_backDown])); + fmt::format("&image={};", g_tweakPlayerRes->x98_aButton[useInput.DA() || m_backDown])); x4c_textpane_next->TextSupport().SetText( - fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->xa4_bButton[useInput.DB() || m_nextDown])); + fmt::format("&image={};", g_tweakPlayerRes->xa4_bButton[useInput.DB() || m_nextDown])); } void CPauseScreen::TransitionComplete() { diff --git a/Runtime/MP1/CPauseScreenBase.cpp b/Runtime/MP1/CPauseScreenBase.cpp index 0f8c6aad6..da1182bc6 100644 --- a/Runtime/MP1/CPauseScreenBase.cpp +++ b/Runtime/MP1/CPauseScreenBase.cpp @@ -1,7 +1,6 @@ #include "Runtime/MP1/CPauseScreenBase.hpp" #include -#include #include "Runtime/CGameState.hpp" #include "Runtime/GameGlobalObjects.hpp" @@ -15,6 +14,7 @@ #include "Runtime/GuiSys/CGuiWidgetDrawParms.hpp" #include "Runtime/GuiSys/CStringTable.hpp" #include "Runtime/IMain.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce::MP1 { @@ -66,7 +66,7 @@ void CPauseScreenBase::InitializeFrameGlue() { x17c_model_textalpha = static_cast(x8_frame.FindWidget("model_textalpha")); x184_textpane_yicon = static_cast(x8_frame.FindWidget("textpane_yicon")); x188_textpane_ytext = static_cast(x8_frame.FindWidget("textpane_ytext")); - x184_textpane_yicon->TextSupport().SetText(fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->xbc_yButton[0])); + x184_textpane_yicon->TextSupport().SetText(fmt::format(u"&image={};", g_tweakPlayerRes->xbc_yButton[0])); x188_textpane_ytext->TextSupport().SetText( xc_pauseStrg.GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 99 : 102)); x188_textpane_ytext->SetColor(g_tweakGuiColors->GetPauseItemAmberColor()); @@ -93,20 +93,18 @@ void CPauseScreenBase::InitializeFrameGlue() { for (int i = 0; i < 5; ++i) { xd8_textpane_titles.push_back( - static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("textpane_title{}"), i + 1)))); + static_cast(x8_frame.FindWidget(fmt::format("textpane_title{}", i + 1)))); xd8_textpane_titles.back()->TextSupport().SetText(u""); - x144_model_titles.push_back( - static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("model_title{}"), i + 1)))); + x144_model_titles.push_back(static_cast(x8_frame.FindWidget(fmt::format("model_title{}", i + 1)))); m_model_lefttitledecos.push_back( - static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("model_lefttitledeco{}"), i)))); + static_cast(x8_frame.FindWidget(fmt::format("model_lefttitledeco{}", i)))); m_model_lefttitledecos.back()->SetMouseActive(true); x15c_model_righttitledecos.push_back( - static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("model_righttitledeco{}"), i + 1)))); + static_cast(x8_frame.FindWidget(fmt::format("model_righttitledeco{}", i + 1)))); x15c_model_righttitledecos.back()->SetMouseActive(true); xa8_textpane_categories.push_back( - static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("textpane_category{}"), i)))); - xc0_model_categories.push_back( - static_cast(x8_frame.FindWidget(fmt::format(FMT_STRING("model_category{}"), i)))); + static_cast(x8_frame.FindWidget(fmt::format("textpane_category{}", i)))); + xc0_model_categories.push_back(static_cast(x8_frame.FindWidget(fmt::format("model_category{}", i)))); } for (int i = 0; i < 20; ++i) @@ -535,7 +533,7 @@ std::string CPauseScreenBase::GetImagePaneName(size_t i) { "4", "5", "6", "7", "45", "56", "67", "456", "567", "4567", }; - return fmt::format(FMT_STRING("imagepane_pane{}"), PaneSuffixes[i]); + return fmt::format("imagepane_pane{}", PaneSuffixes[i]); } } // namespace metaforce::MP1 diff --git a/Runtime/MP1/CSamusHud.cpp b/Runtime/MP1/CSamusHud.cpp index 99d6d003b..d179c182c 100644 --- a/Runtime/MP1/CSamusHud.cpp +++ b/Runtime/MP1/CSamusHud.cpp @@ -13,6 +13,7 @@ #include "Runtime/World/CPlayer.hpp" #include "Runtime/World/CScriptTrigger.hpp" #include "Runtime/Graphics/CCubeRenderer.hpp" +#include "Runtime/Formatting.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path @@ -113,7 +114,7 @@ void CSamusHud::InitializeFrameGluePermanent(const CStateManager& mgr) { for (size_t i = 0; i < x5a4_videoBands.size(); ++i) { SVideoBand& band = x5a4_videoBands[i]; band.x0_videoband = - static_cast(x274_loadedFrmeBaseHud->FindWidget(fmt::format(FMT_STRING("model_videoband{}"), i))); + static_cast(x274_loadedFrmeBaseHud->FindWidget(fmt::format("model_videoband{}", i))); band.x4_randA = 6 + (std::rand() % ((66 - 6) + 1)); band.x8_randB = 16 + (std::rand() % ((256 - 16) + 1)); } @@ -1297,7 +1298,7 @@ void CSamusHud::Update(float dt, const CStateManager& mgr, CInGameGuiManager::EH int minutes = mgr.GetEscapeSequenceTimer() / 60.f; int seconds = std::fmod(mgr.GetEscapeSequenceTimer(), 60.f); int hundredths = std::fmod(mgr.GetEscapeSequenceTimer() * 100.f, 100.f); - std::string timeStr = fmt::format(FMT_STRING("{:02d}:{:02d}:{:02d}"), int(minutes), int(seconds), int(hundredths)); + std::string timeStr = fmt::format("{:02d}:{:02d}:{:02d}", int(minutes), int(seconds), int(hundredths)); x594_base_textpane_counter->TextSupport().SetText(timeStr); x594_base_textpane_counter->SetIsVisible(true); diff --git a/Runtime/MP1/CSlideShow.cpp b/Runtime/MP1/CSlideShow.cpp index 7f692b219..2e22fa6a2 100644 --- a/Runtime/MP1/CSlideShow.cpp +++ b/Runtime/MP1/CSlideShow.cpp @@ -6,6 +6,7 @@ #include "Runtime/CGameState.hpp" #include "Runtime/CSimplePool.hpp" #include "Runtime/GameGlobalObjects.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { namespace { @@ -88,7 +89,7 @@ CIOWin::EMessageReturn CSlideShow::OnMessage(const CArchitectureMessage& msg, CA if (x18_galleryTXTRDeps.empty()) { x18_galleryTXTRDeps.reserve(5); for (int i = 1; true; ++i) { - std::string depResName = fmt::format(FMT_STRING("Gallery{:02d}_DGRP"), i); + std::string depResName = fmt::format("Gallery{:02d}_DGRP", i); if (!LoadTXTRDep(depResName)) break; } diff --git a/Runtime/MP1/CTweaks.cpp b/Runtime/MP1/CTweaks.cpp index 2317b818c..4e4251cdb 100644 --- a/Runtime/MP1/CTweaks.cpp +++ b/Runtime/MP1/CTweaks.cpp @@ -18,13 +18,10 @@ #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/AutoMapper/CMappableObject.hpp" #include "Runtime/World/CPlayerCameraBob.hpp" - -#include +#include "Runtime/Logging.hpp" namespace metaforce::MP1 { -static logvisor::Module Log("MP1::CTweaks"); - void CTweaks::RegisterTweaks(CVarManager* cvarMgr) { std::optional strm; const SObjectTag* tag; diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index 4db89ce96..d42d82b52 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -40,6 +40,7 @@ #include "Runtime/World/CPlayer.hpp" #include "Runtime/World/CStateMachine.hpp" #include "Runtime/World/CScriptMazeNode.hpp" +#include "Runtime/Logging.hpp" #include "Runtime/MP1/CCredits.hpp" @@ -73,8 +74,6 @@ inline void* memmem(const void* haystack, size_t hlen, const void* needle, size_ #endif namespace metaforce::MP1 { -static logvisor::Module Log{"MP1"}; - namespace { struct AudioGroupInfo { const char* name; @@ -329,7 +328,7 @@ void CMain::AddOverridePaks() { * the higher the number the higer the priority, e.g: Override0 has less priority than Override1 etc. */ for (size_t i = 9; i > 0; --i) { - const std::string path = fmt::format(FMT_STRING("Override{}"), i); + const std::string path = fmt::format("Override{}", i); if (CDvdFile::FileExists(path + ".pak")) { loader->AddPakFileAsync(path, false, false, true); } @@ -403,8 +402,7 @@ bool CMain::LoadAudio() { void CMain::EnsureWorldPaksReady() {} -void CMain::EnsureWorldPakReady(CAssetId mlvl) { /* TODO: Schedule resource list load for World Pak containing mlvl */ -} +void CMain::EnsureWorldPakReady(CAssetId mlvl) { /* TODO: Schedule resource list load for World Pak containing mlvl */ } void CMain::StreamNewGameState(CInputStream& r, u32 idx) { bool fusionBackup = g_GameState->SystemOptions().GetPlayerFusionSuitActive(); @@ -429,8 +427,6 @@ void CMain::RefreshGameState() { g_GameState->GetPlayerState()->SetIsFusionEnabled(g_GameState->SystemOptions().GetPlayerFusionSuitActive()); } -static logvisor::Module DiscordLog("Discord"); -static logvisor::Module MainLog("MP1::CMain"); static const char* DISCORD_APPLICATION_ID = "402571593815031819"; static int64_t DiscordStartTime; static CAssetId DiscordWorldSTRG; @@ -476,7 +472,7 @@ void CMain::UpdateDiscordPresence(CAssetId worldSTRG) { const u32 itemPercent = pState->CalculateItemCollectionRate() * 100 / pState->GetPickupTotal(); if (DiscordItemPercent != itemPercent) { DiscordItemPercent = itemPercent; - DiscordState = fmt::format(FMT_STRING("{}%"), itemPercent); + DiscordState = fmt::format("{}%", itemPercent); updated = true; } } @@ -493,17 +489,13 @@ void CMain::UpdateDiscordPresence(CAssetId worldSTRG) { #endif } -void CMain::HandleDiscordReady(const DiscordUser* request) { - DiscordLog.report(logvisor::Info, FMT_STRING("Discord Ready")); -} +void CMain::HandleDiscordReady(const DiscordUser* request) { spdlog::info("Discord Ready"); } void CMain::HandleDiscordDisconnected(int errorCode, const char* message) { - DiscordLog.report(logvisor::Warning, FMT_STRING("Discord Disconnected: {}"), message); + spdlog::warn("Discord Disconnected: {}", message); } -void CMain::HandleDiscordErrored(int errorCode, const char* message) { - DiscordLog.report(logvisor::Error, FMT_STRING("Discord Error: {}"), message); -} +void CMain::HandleDiscordErrored(int errorCode, const char* message) { spdlog::error("Discord Error: {}", message); } std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarMgr) { m_cvarMgr = cvarMgr; @@ -511,7 +503,7 @@ std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr, { auto discInfo = CDvdFile::DiscInfo(); if (discInfo.gameId[4] != '0' || discInfo.gameId[5] != '1') { - return fmt::format(FMT_STRING("Unknown game ID {}"), std::string_view{discInfo.gameId.data(), 6}); + return fmt::format("Unknown game ID {}", std::string_view{discInfo.gameId.data(), 6}); } if (strncmp(discInfo.gameId.data(), "GM8", 3) == 0) { m_version.game = EGame::MetroidPrime1; @@ -532,7 +524,7 @@ std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr, m_version.game = EGame::MetroidPrimeTrilogy; m_version.platform = EPlatform::Wii; } else { - return fmt::format(FMT_STRING("Unknown game ID {}"), std::string_view{discInfo.gameId.data(), 6}); + return fmt::format("Unknown game ID {}", std::string_view{discInfo.gameId.data(), 6}); } switch (discInfo.gameId[3]) { case 'E': @@ -549,13 +541,13 @@ std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr, m_version.region = ERegion::PAL; break; default: - return fmt::format(FMT_STRING("Unknown region {}"), discInfo.gameId[3]); + return fmt::format("Unknown region {}", discInfo.gameId[3]); } m_version.gameTitle = std::move(discInfo.gameTitle); } if (m_version.game != EGame::MetroidPrime1 && m_version.game != EGame::MetroidPrimeTrilogy) { - return fmt::format(FMT_STRING("Unsupported game {}"), magic_enum::enum_name(m_version.game)); + return fmt::format("Unsupported game {}", magic_enum::enum_name(m_version.game)); } { @@ -567,18 +559,17 @@ std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr, } CDvdFile file(dolFile); if (!file) { - return fmt::format(FMT_STRING("Failed to open {}"), dolFile); + return fmt::format("Failed to open {}", dolFile); } std::unique_ptr buf = std::make_unique(file.Length()); u32 readLen = file.SyncRead(buf.get(), file.Length()); const char* buildInfo = static_cast(memmem(buf.get(), readLen, "MetroidBuildInfo", 16)) + 19; if (buildInfo == nullptr) { - return fmt::format(FMT_STRING("Failed to locate MetroidBuildInfo")); + return fmt::format("Failed to locate MetroidBuildInfo"); } m_version.version = buildInfo; } - MainLog.report(logvisor::Level::Info, FMT_STRING("Loading data from {} {} ({})"), GetGameTitle(), - magic_enum::enum_name(GetRegion()), GetVersionString()); + spdlog::info("Loading data from {} {} ({})", GetGameTitle(), magic_enum::enum_name(GetRegion()), GetVersionString()); InitializeDiscord(); if (m_version.game == EGame::MetroidPrimeTrilogy) { diff --git a/Runtime/MP1/World/CSpacePirate.cpp b/Runtime/MP1/World/CSpacePirate.cpp index 2a10d88b6..42c6f6641 100644 --- a/Runtime/MP1/World/CSpacePirate.cpp +++ b/Runtime/MP1/World/CSpacePirate.cpp @@ -18,6 +18,7 @@ #include "Runtime/World/CScriptWaypoint.hpp" #include "Runtime/World/CTeamAiMgr.hpp" #include "Runtime/World/CWorld.hpp" +#include "Runtime/Logging.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path @@ -770,8 +771,7 @@ void CSpacePirate::Think(float dt, CStateManager& mgr) { } if (!m_lastKnownGoodXf.origin.isZero() && GetTranslation().isNaN()) { - fmt::print( - FMT_STRING("BUG THIS!: Space Pirate attempted to visit it's people, resetting position to sane value\n")); + spdlog::warn("BUG THIS!: Space Pirate attempted to visit it's people, resetting position to sane value\n"); Stop(); SetTransform(m_lastKnownGoodXf); } @@ -891,7 +891,7 @@ void CSpacePirate::Think(float dt, CStateManager& mgr) { if (!GetTranslation().isNaN()) { m_lastKnownGoodXf = GetTransform(); } else { - fmt::print(FMT_STRING("BUG THIS!: Space Pirate being yeeted to the unknown\n")); + spdlog::warn("BUG THIS!: Space Pirate being yeeted to the unknown\n"); } } diff --git a/Runtime/MP1/World/CSpankWeed.cpp b/Runtime/MP1/World/CSpankWeed.cpp index c3bbef917..c4f51fa0a 100644 --- a/Runtime/MP1/World/CSpankWeed.cpp +++ b/Runtime/MP1/World/CSpankWeed.cpp @@ -6,12 +6,10 @@ #include "Runtime/Collision/CCollisionActor.hpp" #include "Runtime/World/CPatternedInfo.hpp" #include "Runtime/World/CPlayer.hpp" - -#include +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce::MP1 { -logvisor::Module SpankLog("metaforce::MP1::SpankWeed"); - constexpr std::array kArmCollision{{ {"Arm_4", 1.5f}, {"Arm_6", 1.f}, @@ -41,10 +39,10 @@ CSpankWeed::CSpankWeed(TUniqueId uid, std::string_view name, const CEntityInfo& float scale = modelScale.magnitude() / std::sqrt(3.f); GetModelData()->SetScale(zeus::CVector3f(scale)); - SpankLog.report(logvisor::Level::Warning, - FMT_STRING("WARNING: Non-uniform scale {} applied to Spank Weed" - "...changing scale to ({} {} {})\n"), - modelScale, scale, scale, scale); + spdlog::warn( + "WARNING: Non-uniform scale {} applied to Spank Weed" + "...changing scale to ({} {} {})\n", + modelScale, scale, scale, scale); } CMaterialList list = GetMaterialFilter().GetExcludeList(); list.Add(EMaterialTypes::Character); diff --git a/Runtime/MP1/World/CThardus.cpp b/Runtime/MP1/World/CThardus.cpp index 0da0f7162..9c8e97a11 100644 --- a/Runtime/MP1/World/CThardus.cpp +++ b/Runtime/MP1/World/CThardus.cpp @@ -21,6 +21,7 @@ #include "Runtime/World/CScriptDistanceFog.hpp" #include "Runtime/World/CScriptWaypoint.hpp" #include "Runtime/World/CWorld.hpp" +#include "Runtime/Formatting.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path @@ -1320,7 +1321,7 @@ void CThardus::BreakRock(CStateManager& mgr, u32 rockIndex) { void CThardus::SetRockParticle(CStateManager& mgr, const zeus::CVector3f& pos, CAssetId particle) { u32 w = x6f4_; ++x6f4_; - std::string particleName = fmt::format(FMT_STRING("ROCK_EFFECT{}-{}"), particle.Value(), w); + std::string particleName = fmt::format("ROCK_EFFECT{}-{}", particle.Value(), w); GetModelData()->GetAnimationData()->GetParticleDB().AddAuxiliaryParticleEffect( particleName, 0x40, CAuxiliaryParticleData(0, {FOURCC('PART'), particle}, pos, 1.f), 2.f * GetModelData()->GetScale(), mgr, GetAreaIdAlways(), 0); diff --git a/Runtime/MP1/World/CThardusRockProjectile.cpp b/Runtime/MP1/World/CThardusRockProjectile.cpp index d0038053a..0e29426c9 100644 --- a/Runtime/MP1/World/CThardusRockProjectile.cpp +++ b/Runtime/MP1/World/CThardusRockProjectile.cpp @@ -11,6 +11,7 @@ #include "Runtime/World/CExplosion.hpp" #include "Runtime/World/CLightParameters.hpp" #include "Runtime/World/CPlayer.hpp" +#include "Runtime/Formatting.hpp" #include "Runtime/CSimplePool.hpp" #include "Runtime/GameGlobalObjects.hpp" @@ -343,7 +344,7 @@ void CThardusRockProjectile::SetMaterialProperties(const std::unique_ptr descTok = g_SimplePool->GetObj({SBIG('PART'), particleId}); mgr.AddObject(new CExplosion(descTok, uid, true, CEntityInfo(mgr.GetNextAreaId(), NullConnectionList), name, zeus::CTransform(zeus::CMatrix3f(), pos), w2, scale, zeus::skWhite)); diff --git a/Runtime/Particle/CDecalDataFactory.cpp b/Runtime/Particle/CDecalDataFactory.cpp index a564efa6f..99ba6925c 100644 --- a/Runtime/Particle/CDecalDataFactory.cpp +++ b/Runtime/Particle/CDecalDataFactory.cpp @@ -4,12 +4,10 @@ #include "Runtime/CSimplePool.hpp" #include "Runtime/Graphics/CModel.hpp" #include "Runtime/Particle/CParticleDataFactory.hpp" - -#include +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { -static logvisor::Module Log("metaforce::CDecalDataFactory"); - using CPF = CParticleDataFactory; std::unique_ptr CDecalDataFactory::GetGeneratorDesc(CInputStream& in, CSimplePool* resPool) { return CreateGeneratorDescription(in, resPool); @@ -84,7 +82,7 @@ bool CDecalDataFactory::CreateDPSM(CDecalDescription* desc, CInputStream& in, CS desc->x5c_25_DMOO = CPF::GetBool(in); break; default: { - Log.report(logvisor::Fatal, FMT_STRING("Unknown DPSC class {} @{}"), clsId, in.GetReadPosition()); + spdlog::fatal("Unknown DPSC class {} @{}", clsId, in.GetReadPosition()); return false; } } diff --git a/Runtime/Particle/CElementGen.cpp b/Runtime/Particle/CElementGen.cpp index 6b4c5d0c3..769a6290b 100644 --- a/Runtime/Particle/CElementGen.cpp +++ b/Runtime/Particle/CElementGen.cpp @@ -13,13 +13,12 @@ #include "Runtime/Particle/CParticleSwoosh.hpp" #include "Runtime/Particle/CSwooshDescription.hpp" #include "Runtime/Particle/CWarp.hpp" +#include "Runtime/Logging.hpp" #define MAX_GLOBAL_PARTICLES 2560 namespace metaforce { namespace { -logvisor::Module Log("metaforce::CElementGen"); - // constexpr std::array ShadClsSizes{ // sizeof(SParticleInstanceTex), // sizeof(SParticleInstanceIndTex), @@ -244,7 +243,7 @@ bool CElementGen::Update(double t) { if (pswtElem && !x26d_25_warmedUp) { int pswt = 0; pswtElem->GetValue(x74_curFrame, pswt); - // Log.report(logvisor::Info, FMT_STRING("Running warmup on particle system 0x%08x for %d ticks."), desc, pswt); + // spdlog::info("Running warmup on particle system 0x%08x for %d ticks.", desc, pswt); InternalUpdate((1.f / 60.f) * pswt); x26d_25_warmedUp = true; } @@ -367,8 +366,7 @@ void CElementGen::UpdateAdvanceAccessParameters(u32 activeParticleCount, s32 par CGenDescription* desc = x28_loadedGenDesc; if (activeParticleCount >= x60_advValues.size()) { - Log.report(logvisor::Fatal, FMT_STRING("activeParticleCount ({}) >= advValues size ({})"), activeParticleCount, - x60_advValues.size()); + spdlog::fatal("activeParticleCount ({}) >= advValues size ({})", activeParticleCount, x60_advValues.size()); } std::array& arr = x60_advValues[activeParticleCount]; @@ -838,7 +836,7 @@ u32 CElementGen::GetSystemCount() const { } void CElementGen::Render() { - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::Render {}"), *x1c_genDesc.GetObjectTag()).c_str(), + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CElementGen::Render {}", *x1c_genDesc.GetObjectTag()).c_str(), zeus::skYellow); CGenDescription* desc = x1c_genDesc.GetObj(); @@ -868,7 +866,7 @@ void CElementGen::Render() { } void CElementGen::RenderModels() { - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::RenderModels")).c_str(), zeus::skYellow); + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CElementGen::RenderModels").c_str(), zeus::skYellow); CParticleGlobals::instance()->m_particleAccessParameters = nullptr; if (x26d_26_modelsUseLights) { @@ -1093,7 +1091,7 @@ void CElementGen::RenderModels() { } void CElementGen::RenderLines() { - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::RenderLines")).c_str(), zeus::skYellow); + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CElementGen::RenderLines").c_str(), zeus::skYellow); CGenDescription* desc = x1c_genDesc.GetObj(); CGlobalRandom gr(x27c_randState); @@ -1202,7 +1200,7 @@ void CElementGen::RenderParticles() { return; } - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::RenderParticles")).c_str(), zeus::skYellow); + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CElementGen::RenderParticles").c_str(), zeus::skYellow); CRealElement* size = desc->x4c_x38_SIZE.get(); if (size && size->IsConstant()) { @@ -1526,7 +1524,7 @@ void CElementGen::RenderParticles() { // g_instNoTexData.reserve(x30_particles.size() * mbspVal); // break; // default: -// Log.report(logvisor::Fatal, FMT_STRING("unexpected particle shader class")); +// spdlog::fatal("unexpected particle shader class"); // break; // } const float mbspFac = 1.f / float(mbspVal); @@ -1640,7 +1638,7 @@ void CElementGen::RenderParticles() { } void CElementGen::RenderParticlesIndirectTexture() { - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::RenderParticlesIndirectTexture")).c_str(), zeus::skYellow); + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CElementGen::RenderParticlesIndirectTexture").c_str(), zeus::skYellow); CGenDescription* desc = x1c_genDesc.GetObj(); diff --git a/Runtime/Particle/CParticleDataFactory.cpp b/Runtime/Particle/CParticleDataFactory.cpp index 2cec3dcb9..89a25a759 100644 --- a/Runtime/Particle/CParticleDataFactory.cpp +++ b/Runtime/Particle/CParticleDataFactory.cpp @@ -7,12 +7,10 @@ #include "Runtime/Particle/CElectricDescription.hpp" #include "Runtime/Particle/CGenDescription.hpp" #include "Runtime/Particle/CSwooshDescription.hpp" - -#include +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { -static logvisor::Module Log("metaforce::CParticleDataFactory"); - float CParticleDataFactory::GetReal(CInputStream& in) { return in.ReadFloat(); } s32 CParticleDataFactory::GetInt(CInputStream& in) { return in.ReadInt32(); } @@ -20,7 +18,7 @@ s32 CParticleDataFactory::GetInt(CInputStream& in) { return in.ReadInt32(); } bool CParticleDataFactory::GetBool(CInputStream& in) { FourCC cid = GetClassID(in); if (cid != FOURCC('CNST')) - Log.report(logvisor::Fatal, FMT_STRING("bool element does not begin with CNST")); + spdlog::fatal("bool element does not begin with CNST"); return in.ReadBool(); } @@ -1003,7 +1001,7 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->xec_xd8_SELC = GetElectricGeneratorDesc(in, resPool); break; default: { - Log.report(logvisor::Fatal, FMT_STRING("Unknown GPSM class {} @{}"), clsId, in.GetReadPosition()); + spdlog::fatal("Unknown GPSM class {} @{}", clsId, in.GetReadPosition()); return false; } } diff --git a/Runtime/Particle/CParticleElectric.cpp b/Runtime/Particle/CParticleElectric.cpp index db69fec33..66827a298 100644 --- a/Runtime/Particle/CParticleElectric.cpp +++ b/Runtime/Particle/CParticleElectric.cpp @@ -609,7 +609,7 @@ bool CParticleElectric::Update(double dt) { void CParticleElectric::Render() { SCOPED_GRAPHICS_DEBUG_GROUP( - fmt::format(FMT_STRING("CParticleElectric::Render {}"), *x1c_elecDesc.GetObjectTag()).c_str(), zeus::skYellow); + fmt::format("CParticleElectric::Render {}", *x1c_elecDesc.GetObjectTag()).c_str(), zeus::skYellow); if (!x3e8_electricManagers.empty()) { if (x450_29_transformDirty) { diff --git a/Runtime/Particle/CParticleElectricDataFactory.cpp b/Runtime/Particle/CParticleElectricDataFactory.cpp index 2a4f9f7d4..138825cba 100644 --- a/Runtime/Particle/CParticleElectricDataFactory.cpp +++ b/Runtime/Particle/CParticleElectricDataFactory.cpp @@ -5,12 +5,10 @@ #include "Runtime/CToken.hpp" #include "Runtime/Graphics/CModel.hpp" #include "Runtime/Particle/CElectricDescription.hpp" - -#include +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { -static logvisor::Module Log("metaforce::CParticleElectricDataFactory"); - using CPF = CParticleDataFactory; std::unique_ptr CParticleElectricDataFactory::GetGeneratorDesc(CInputStream& in, @@ -106,7 +104,7 @@ bool CParticleElectricDataFactory::CreateELSM(CElectricDescription* desc, CInput desc->x70_ZERY = CPF::GetBool(in); break; default: { - Log.report(logvisor::Fatal, FMT_STRING("Unknown ELSM class {} @{}"), clsId, in.GetReadPosition()); + spdlog::fatal("Unknown ELSM class {} @{}", clsId, in.GetReadPosition()); return false; } } diff --git a/Runtime/Particle/CParticleGlobals.hpp b/Runtime/Particle/CParticleGlobals.hpp index 86569e462..4f77c3f13 100644 --- a/Runtime/Particle/CParticleGlobals.hpp +++ b/Runtime/Particle/CParticleGlobals.hpp @@ -2,6 +2,7 @@ #include #include +#include #include "Runtime/RetroTypes.hpp" diff --git a/Runtime/Particle/CParticleSwoosh.cpp b/Runtime/Particle/CParticleSwoosh.cpp index 854d58809..13cc62d60 100644 --- a/Runtime/Particle/CParticleSwoosh.cpp +++ b/Runtime/Particle/CParticleSwoosh.cpp @@ -933,7 +933,7 @@ void CParticleSwoosh::Render() { return; } - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CParticleSwoosh::Render {}"), *x1c_desc.GetObjectTag()).c_str(), + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CParticleSwoosh::Render {}", *x1c_desc.GetObjectTag()).c_str(), zeus::skYellow); m_cachedVerts.clear(); diff --git a/Runtime/Particle/CParticleSwooshDataFactory.cpp b/Runtime/Particle/CParticleSwooshDataFactory.cpp index 9b5d048ce..95a443ed9 100644 --- a/Runtime/Particle/CParticleSwooshDataFactory.cpp +++ b/Runtime/Particle/CParticleSwooshDataFactory.cpp @@ -6,12 +6,10 @@ #include "Runtime/Particle/CElectricDescription.hpp" #include "Runtime/Particle/CGenDescription.hpp" #include "Runtime/Particle/CSwooshDescription.hpp" - -#include +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { -static logvisor::Module Log("metaforce::CParticleSwooshDataFactory"); - using CPF = CParticleDataFactory; std::unique_ptr CParticleSwooshDataFactory::GetGeneratorDesc(CInputStream& in, @@ -124,7 +122,7 @@ bool CParticleSwooshDataFactory::CreateWPSM(CSwooshDescription* desc, CInputStre desc->x45_26_CRND = CPF::GetBool(in); break; default: { - Log.report(logvisor::Fatal, FMT_STRING("Unknown SWSH class {} @{}"), clsId, in.GetReadPosition()); + spdlog::fatal("Unknown SWSH class {} @{}", clsId, in.GetReadPosition()); return false; } } diff --git a/Runtime/Particle/CProjectileWeaponDataFactory.cpp b/Runtime/Particle/CProjectileWeaponDataFactory.cpp index 8c13050c7..a498db8bb 100644 --- a/Runtime/Particle/CProjectileWeaponDataFactory.cpp +++ b/Runtime/Particle/CProjectileWeaponDataFactory.cpp @@ -8,12 +8,10 @@ #include "Runtime/Particle/CGenDescription.hpp" #include "Runtime/Particle/CSwooshDescription.hpp" #include "Runtime/Particle/CWeaponDescription.hpp" - -#include +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { -static logvisor::Module Log("metaforce::CProjectileWeaponDataFactory"); - using CPF = CParticleDataFactory; std::unique_ptr CProjectileWeaponDataFactory::GetGeneratorDesc(CInputStream& in, @@ -160,7 +158,7 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt desc->x29_FC60 = CPF::GetBool(in); break; default: { - Log.report(logvisor::Fatal, FMT_STRING("Unknown WPSM class {} @{}"), clsId, in.GetReadPosition()); + spdlog::fatal("Unknown WPSM class {} @{}", clsId, in.GetReadPosition()); return false; } } diff --git a/Runtime/RetroTypes.cpp b/Runtime/RetroTypes.cpp index b07b11747..b2e707aa9 100644 --- a/Runtime/RetroTypes.cpp +++ b/Runtime/RetroTypes.cpp @@ -2,12 +2,9 @@ #include "Runtime/Streams/IOStreams.hpp" #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/IMain.hpp" - -#include +#include "Runtime/Logging.hpp" namespace metaforce { -logvisor::Module Log("metaforce::RetroTypes::CAssetId"); - SObjectTag::SObjectTag(CInputStream& in) { in.ReadBytes(reinterpret_cast(&type), 4); id = in.Get(); @@ -25,10 +22,10 @@ CAssetId::CAssetId(CInputStream& in) { } else if (g_Main->GetExpectedIdSize() == sizeof(u64)) { Assign(in.ReadLongLong()); } else { - Log.report(logvisor::Fatal, FMT_STRING("Unsupported id length {}"), g_Main->GetExpectedIdSize()); + spdlog::fatal("Unsupported id length {}", g_Main->GetExpectedIdSize()); } } else { - Log.report(logvisor::Fatal, FMT_STRING("Input constructor called before runtime Main entered!")); + spdlog::fatal("Input constructor called before runtime Main entered!"); } } @@ -39,10 +36,10 @@ void CAssetId::PutTo(COutputStream& out) const { } else if (g_Main->GetExpectedIdSize() == sizeof(u64)) { out.Put(id); } else { - Log.report(logvisor::Fatal, FMT_STRING("Unsupported id length {}"), g_Main->GetExpectedIdSize()); + spdlog::fatal("Unsupported id length {}", g_Main->GetExpectedIdSize()); } } else { - Log.report(logvisor::Fatal, FMT_STRING("PutTo called before runtime Main entered!")); + spdlog::fatal("PutTo called before runtime Main entered!"); } } diff --git a/Runtime/RetroTypes.hpp b/Runtime/RetroTypes.hpp index 94307fd38..ca562d4da 100644 --- a/Runtime/RetroTypes.hpp +++ b/Runtime/RetroTypes.hpp @@ -3,19 +3,11 @@ #include #include #include -#include #include #include "GCNTypes.hpp" #include "rstl.hpp" -#include -#include -#include -#include -#include -#include - #undef min #undef max @@ -108,7 +100,8 @@ constexpr double SBig(double val) noexcept { return uval2.f; } #ifndef SBIG -#define SBIG(q) (((q)&0x000000FF) << 24 | ((q)&0x0000FF00) << 8 | ((q)&0x00FF0000) >> 8 | ((q)&0xFF000000) >> 24) +#define SBIG(q) \ + (((q) & 0x000000FF) << 24 | ((q) & 0x0000FF00) << 8 | ((q) & 0x00FF0000) >> 8 | ((q) & 0xFF000000) >> 24) #endif constexpr int16_t SLittle(int16_t val) noexcept { return val; } @@ -138,7 +131,8 @@ constexpr double SLittle(double val) noexcept { return *((double*)(&ival)); } #ifndef SLITTLE -#define SLITTLE(q) (((q)&0x000000FF) << 24 | ((q)&0x0000FF00) << 8 | ((q)&0x00FF0000) >> 8 | ((q)&0xFF000000) >> 24) +#define SLITTLE(q) \ + (((q) & 0x000000FF) << 24 | ((q) & 0x0000FF00) << 8 | ((q) & 0x00FF0000) >> 8 | ((q) & 0xFF000000) >> 24) #endif constexpr int16_t SBig(int16_t val) noexcept { return val; } @@ -210,7 +204,7 @@ public: [[nodiscard]] constexpr bool operator<(CAssetId other) const noexcept { return id < other.id; } }; -//#define kInvalidAssetId CAssetId() +// #define kInvalidAssetId CAssetId() struct SObjectTag { FourCC type; @@ -332,7 +326,6 @@ public: [[nodiscard]] size_t Size() const { return this->size(); } }; - } // namespace metaforce namespace std { @@ -352,40 +345,6 @@ struct hash { }; } // namespace std -FMT_CUSTOM_FORMATTER(metaforce::CAssetId, "{:08X}", obj.Value()) -FMT_CUSTOM_FORMATTER(metaforce::TEditorId, "{:08X}", obj.id) -static_assert(sizeof(metaforce::kUniqueIdType) == sizeof(u16), - "TUniqueId size does not match expected size! Update TUniqueId format string!"); -FMT_CUSTOM_FORMATTER(metaforce::TUniqueId, "{:04X}", obj.id) -FMT_CUSTOM_FORMATTER(metaforce::FourCC, "{:c}{:c}{:c}{:c}", obj.getChars()[0], obj.getChars()[1], obj.getChars()[2], - obj.getChars()[3]) -FMT_CUSTOM_FORMATTER(metaforce::SObjectTag, "{} {}", obj.type, obj.id) - -FMT_CUSTOM_FORMATTER(zeus::CVector3f, "({} {} {})", float(obj.x()), float(obj.y()), float(obj.z())) -FMT_CUSTOM_FORMATTER(zeus::CVector2f, "({} {})", float(obj.x()), float(obj.y())) -FMT_CUSTOM_FORMATTER(zeus::CMatrix3f, - "\n({} {} {})" - "\n({} {} {})" - "\n({} {} {})", - float(obj[0][0]), float(obj[1][0]), float(obj[2][0]), float(obj[0][1]), float(obj[1][1]), - float(obj[2][1]), float(obj[0][2]), float(obj[1][2]), float(obj[2][2])) -FMT_CUSTOM_FORMATTER(zeus::CMatrix4f, - "\n({} {} {} {})" - "\n({} {} {} {})" - "\n({} {} {} {})" - "\n({} {} {} {})", - float(obj[0][0]), float(obj[1][0]), float(obj[2][0]), float(obj[3][0]), float(obj[0][1]), - float(obj[1][1]), float(obj[2][1]), float(obj[3][1]), float(obj[0][2]), float(obj[1][2]), - float(obj[2][2]), float(obj[3][2]), float(obj[0][3]), float(obj[1][3]), float(obj[2][3]), - float(obj[3][3])) -FMT_CUSTOM_FORMATTER(zeus::CTransform, - "\n({} {} {} {})" - "\n({} {} {} {})" - "\n({} {} {} {})", - float(obj.basis[0][0]), float(obj.basis[1][0]), float(obj.basis[2][0]), float(obj.origin[0]), - float(obj.basis[0][1]), float(obj.basis[1][1]), float(obj.basis[2][1]), float(obj.origin[1]), - float(obj.basis[0][2]), float(obj.basis[1][2]), float(obj.basis[2][2]), float(obj.origin[2])) - #if defined(__has_feature) #if __has_feature(memory_sanitizer) #define URDE_MSAN 1 diff --git a/Runtime/Streams/CInputStream.cpp b/Runtime/Streams/CInputStream.cpp index 0b595f31a..d7446dd10 100644 --- a/Runtime/Streams/CInputStream.cpp +++ b/Runtime/Streams/CInputStream.cpp @@ -2,13 +2,13 @@ #if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ #include "Runtime/CBasics.hpp" #endif +#ifndef NDEBUG +#include "Runtime/Logging.hpp" +#endif #include -#include namespace metaforce { -static logvisor::Module Log("metaforce::CInputStream"); - static u32 min_containing_bytes(u32 v) { v = 32 - v; v = (v >> 3) - (static_cast(-(v & 7)) >> 31); @@ -51,7 +51,7 @@ void CInputStream::Get(u8* dest, u32 len) { u32 readLen = Read(dest + readCount, len); #ifndef NDEBUG if (readLen == 0) { - Log.report(logvisor::Fatal, FMT_STRING("Invalid read size!")); + spdlog::fatal("Invalid read size!"); break; } #endif @@ -112,8 +112,7 @@ u32 CInputStream::ReadBits(u32 bitCount) { const u32 mask2 = shiftAmt == 32 ? 0xffffffff : (1 << shiftAmt) - 1; u32 tmp = x20_bitOffset; x20_bitOffset = len * 8; - ret = ((mask & (bitWord >> (32 - bitOffset))) << shiftAmt) | - ((mask2 & (x1c_bitWord >> (32 - shiftAmt))) << tmp); + ret = ((mask & (bitWord >> (32 - bitOffset))) << shiftAmt) | ((mask2 & (x1c_bitWord >> (32 - shiftAmt))) << tmp); x20_bitOffset -= shiftAmt; x1c_bitWord <<= u64(shiftAmt); } else { diff --git a/Runtime/Weapon/CEnergyProjectile.cpp b/Runtime/Weapon/CEnergyProjectile.cpp index 1f21c1c97..0ac582e9e 100644 --- a/Runtime/Weapon/CEnergyProjectile.cpp +++ b/Runtime/Weapon/CEnergyProjectile.cpp @@ -212,7 +212,7 @@ void CEnergyProjectile::Think(float dt, CStateManager& mgr) { } void CEnergyProjectile::Render(CStateManager& mgr) { - SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CEnergyProjectile::Render WPSC_{}"), x2cc_wpscId).c_str(), + SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CEnergyProjectile::Render WPSC_{}", x2cc_wpscId).c_str(), zeus::skOrange); const auto visor = mgr.GetPlayerState()->GetActiveVisor(mgr); diff --git a/Runtime/Weapon/CNewFlameThrower.cpp b/Runtime/Weapon/CNewFlameThrower.cpp index cb072c5fd..98776aa35 100644 --- a/Runtime/Weapon/CNewFlameThrower.cpp +++ b/Runtime/Weapon/CNewFlameThrower.cpp @@ -228,7 +228,7 @@ void CNewFlameThrower::RenderParticles(std::array const& elem_g active_particle_count++; } } - Log.report(logvisor::Info, FMT_STRING("Active particle count (render count) {}"), active_particle_count); + Log.report(logvisor::Info, "Active particle count (render count) {}", active_particle_count); std::sort(translated_sorted_particles, translated_sorted_particles + active_particle_count, [](ParticleElement const& l, ParticleElement const& r) { return l.vec.y() > r.vec.y(); }); diff --git a/Runtime/World/CActor.cpp b/Runtime/World/CActor.cpp index 6c7d7cf6e..f06dfd3d4 100644 --- a/Runtime/World/CActor.cpp +++ b/Runtime/World/CActor.cpp @@ -213,7 +213,7 @@ void CActor::DrawTouchBounds() { void CActor::RenderInternal(const CStateManager& mgr) const { SCOPED_GRAPHICS_DEBUG_GROUP( - fmt::format(FMT_STRING("CActor::RenderInternal {} {} {}"), x8_uid, xc_editorId, x10_name).c_str(), + fmt::format("CActor::RenderInternal {} {} {}", x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange); CModelData::EWhichModel which = CModelData::GetRenderingModel(mgr); diff --git a/Runtime/World/CFishCloud.cpp b/Runtime/World/CFishCloud.cpp index f44875786..e40720f6b 100644 --- a/Runtime/World/CFishCloud.cpp +++ b/Runtime/World/CFishCloud.cpp @@ -596,7 +596,7 @@ void CFishCloud::Render(CStateManager& mgr) { } SCOPED_GRAPHICS_DEBUG_GROUP( - fmt::format(FMT_STRING("CFishCloud::Render {} {} {}"), x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange); + fmt::format("CFishCloud::Render {} {} {}", x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange); const bool thermalHot = mgr.GetThermalDrawFlag() == EThermalDrawFlag::Hot; CModelFlags flags(0, 0, 3, zeus::skWhite); diff --git a/Runtime/World/CGameArea.cpp b/Runtime/World/CGameArea.cpp index b50b98fbd..b989c6d43 100644 --- a/Runtime/World/CGameArea.cpp +++ b/Runtime/World/CGameArea.cpp @@ -9,14 +9,12 @@ #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/Graphics/CCubeRenderer.hpp" #include "Runtime/Graphics/CCubeSurface.hpp" +#include "Runtime/Logging.hpp" #include "Runtime/World/CScriptAreaAttributes.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path namespace metaforce { - -static logvisor::Module Log("CGameArea"); - CAreaRenderOctTree::CAreaRenderOctTree(const u8* buf) : x0_buf(buf) { CMemoryInStream r(x0_buf + 8, INT32_MAX); x8_bitmapCount = r.ReadLong(); @@ -259,7 +257,7 @@ std::pair, s32> GetScriptingMemoryAlways(const IGameArea& CMemoryInStream r(data.get() + 4, 96 - 4); u32 version = r.ReadLong(); if ((version & 0x10000) == 0) { - Log.report(logvisor::Fatal, FMT_STRING("Attempted to load non-URDE MREA")); + spdlog::fatal("Attempted to load non-URDE MREA"); } version &= ~0x10000; @@ -1091,7 +1089,7 @@ SMREAHeader CGameArea::VerifyHeader() const { CMemoryInStream r(x110_mreaSecBufs[0].first.get() + 4, x110_mreaSecBufs[0].second - 4); u32 version = r.ReadLong(); if ((version & 0x10000) != 0) { - Log.report(logvisor::Fatal, FMT_STRING("Attempted to load non-retail MREA")); + spdlog::fatal("Attempted to load non-retail MREA"); } SMREAHeader header; diff --git a/Runtime/World/CPathFindArea.cpp b/Runtime/World/CPathFindArea.cpp index dfe544c96..7852587f9 100644 --- a/Runtime/World/CPathFindArea.cpp +++ b/Runtime/World/CPathFindArea.cpp @@ -1,14 +1,10 @@ #include "Runtime/World/CPathFindArea.hpp" -#include - +#include "Runtime/Logging.hpp" #include "Runtime/CToken.hpp" #include "Runtime/IVParamObj.hpp" namespace metaforce { - -static logvisor::Module Log("CPathFindArea"); - CPFAreaOctree::CPFAreaOctree(CMemoryInStream& in) { x0_isLeaf = in.ReadLong(); x4_aabb = in.Get(); @@ -127,7 +123,7 @@ CPFArea::CPFArea(std::unique_ptr&& buf, u32 len) { u32 version = r.ReadLong(); if (version != 4) - Log.report(logvisor::Fatal, FMT_STRING("Unexpected PATH version {}, should be 4"), version); + spdlog::fatal("Unexpected PATH version {}, should be 4", version); u32 numNodes = r.ReadLong(); x140_nodes.reserve(numNodes); diff --git a/Runtime/World/CPhysicsActor.cpp b/Runtime/World/CPhysicsActor.cpp index 6fcc44f34..a5aa9fb7a 100644 --- a/Runtime/World/CPhysicsActor.cpp +++ b/Runtime/World/CPhysicsActor.cpp @@ -93,7 +93,7 @@ void CPhysicsActor::AddMotionState(const CMotionState& mst) { q += mst.xc_orientation; zeus::CQuaternion quat = zeus::CQuaternion::fromNUQuaternion(q); // if (TCastToPtr(this)) { - // fmt::print(FMT_STRING("ADD {}\n"), mst.x0_translation); + // spdlog::debug("ADD {}\n", mst.x0_translation); // } SetTransform(zeus::CTransform(quat, x34_transform.origin)); diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 0d6e1672a..d595e0d2d 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -29,15 +29,12 @@ #include "Runtime/World/CScriptGrapplePoint.hpp" #include "Runtime/World/CScriptPlayerHint.hpp" #include "Runtime/World/CScriptWater.hpp" - -#include +#include "Runtime/Logging.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path namespace metaforce { namespace { -logvisor::Module Log("metaforce::CPlayer"); - constexpr CMaterialFilter SolidMaterialFilter = CMaterialFilter::MakeInclude(CMaterialList(EMaterialTypes::Solid)); constexpr CMaterialFilter LineOfSightFilter = CMaterialFilter::MakeIncludeExclude( @@ -3944,7 +3941,7 @@ void CPlayer::SetOrbitState(EPlayerOrbitState state, CStateManager& mgr) { #ifndef NDEBUG if (x310_orbitTargetId != kInvalidUniqueId) { if (const CEntity* ent = mgr.GetObjectById(x310_orbitTargetId)) { - Log.report(logvisor::Info, FMT_STRING("Orbiting {} {}"), ent->GetEditorId(), ent->GetName()); + Log.report(logvisor::Info, "Orbiting {} {}", ent->GetEditorId(), ent->GetName()); } } #endif diff --git a/Runtime/World/CScriptGunTurret.cpp b/Runtime/World/CScriptGunTurret.cpp index e545b39c6..7063e57b0 100644 --- a/Runtime/World/CScriptGunTurret.cpp +++ b/Runtime/World/CScriptGunTurret.cpp @@ -406,7 +406,7 @@ void CScriptGunTurret::SetTurretState(ETurretState state, CStateManager& mgr) { if (state != ETurretState::Invalid && x520_state != state) { #ifndef NDEBUG - fmt::print(FMT_STRING("{} {} {} - {}\n"), GetUniqueId(), GetEditorId(), GetName(), StateNames[size_t(state)]); + spdlog::debug("{} {} {} - {}\n", GetUniqueId(), GetEditorId(), GetName(), StateNames[size_t(state)]); #endif } diff --git a/Runtime/World/CScriptStreamedMusic.cpp b/Runtime/World/CScriptStreamedMusic.cpp index 049d356c8..94863a6e5 100644 --- a/Runtime/World/CScriptStreamedMusic.cpp +++ b/Runtime/World/CScriptStreamedMusic.cpp @@ -27,7 +27,7 @@ void CScriptStreamedMusic::StartStream(CStateManager& mgr) { void CScriptStreamedMusic::TweakOverride(CStateManager& mgr) { const CWorld* wld = mgr.GetWorld(); const CGameArea* area = wld->GetAreaAlways(x4_areaId); - std::string twkName = fmt::format(FMT_STRING("Area {} MusicObject: {}"), area->GetAreaAssetId(), x10_name); + std::string twkName = fmt::format("Area {} MusicObject: {}", area->GetAreaAssetId(), x10_name); if (g_TweakManager->HasTweakValue(twkName)) { const CTweakValue::Audio& audio = g_TweakManager->GetTweakValue(twkName)->GetAudio(); x34_fileName = audio.GetFileName(); diff --git a/Runtime/World/CScriptTrigger.cpp b/Runtime/World/CScriptTrigger.cpp index c991e74cb..e23c31173 100644 --- a/Runtime/World/CScriptTrigger.cpp +++ b/Runtime/World/CScriptTrigger.cpp @@ -5,12 +5,10 @@ #include "Runtime/Weapon/CGameProjectile.hpp" #include "Runtime/World/CActorParameters.hpp" #include "Runtime/World/CPlayer.hpp" -#include +#include "Runtime/Logging.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path namespace metaforce { -static logvisor::Module Log("CScriptTrigger"); - CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& pos, const zeus::CAABox& bounds, const CDamageInfo& dInfo, const zeus::CVector3f& forceField, ETriggerFlags triggerFlags, bool active, @@ -28,7 +26,7 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEnti #ifndef NDEBUG // HACK: For some reason MetroidPrime's lair doesn't enable this trigger until after the cutscene, activate it in debug build if (GetEditorId() == 0x000B01DB && !GetActive()) { - Log.report(logvisor::Warning, FMT_STRING("BUG THIS!: Overriding active for trigger {} in area {}"), GetEditorId(), + Log.report(logvisor::Warning, "BUG THIS!: Overriding active for trigger {} in area {}", GetEditorId(), GetAreaIdAlways()); SetActive(true); } diff --git a/Runtime/World/CStateMachine.cpp b/Runtime/World/CStateMachine.cpp index 545c70ce9..ec6c932f2 100644 --- a/Runtime/World/CStateMachine.cpp +++ b/Runtime/World/CStateMachine.cpp @@ -2,14 +2,12 @@ #include "Runtime/CStateManager.hpp" #include "Runtime/World/CAi.hpp" +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" #include "ConsoleVariables/CVarManager.hpp" namespace metaforce { -namespace { -logvisor::Module Log("metaforce::CStateMachine"); -} - CStateMachine::CStateMachine(CInputStream& in) { CAiTrigger* lastTrig = nullptr; u32 stateCount = in.ReadLong(); @@ -99,8 +97,8 @@ void CStateMachineState::Update(CStateManager& mgr, CAi& ai, float delta) { if (andPassed && state != nullptr) { x4_state->CallFunc(mgr, ai, EStateMsg::Deactivate, 0.f); x4_state = state; - Log.report(logvisor::Info, FMT_STRING("{} {} {} - {} {}"), ai.GetUniqueId(), ai.GetEditorId(), ai.GetName(), - state->xc_name, int(state - x0_machine->GetStateVector().data())); + spdlog::info("{} {} {} - {} {}", ai.GetUniqueId(), ai.GetEditorId(), ai.GetName(), state->xc_name, + int(state - x0_machine->GetStateVector().data())); x8_time = 0.f; x18_24_codeTrigger = false; xc_random = mgr.GetActiveRandom()->Float(); diff --git a/Runtime/World/CStateMachine.hpp b/Runtime/World/CStateMachine.hpp index 8d63b1720..284c73b20 100644 --- a/Runtime/World/CStateMachine.hpp +++ b/Runtime/World/CStateMachine.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include "Runtime/CToken.hpp" diff --git a/Runtime/World/CWallCrawlerSwarm.cpp b/Runtime/World/CWallCrawlerSwarm.cpp index 1ff7681e1..95ce1eb21 100644 --- a/Runtime/World/CWallCrawlerSwarm.cpp +++ b/Runtime/World/CWallCrawlerSwarm.cpp @@ -1070,7 +1070,7 @@ void CWallCrawlerSwarm::RenderBoid(const CBoid* boid, u32& drawMask, bool therma void CWallCrawlerSwarm::Render(CStateManager& mgr) { SCOPED_GRAPHICS_DEBUG_GROUP( - fmt::format(FMT_STRING("CWallCrawlerSwarm::Render {} {} {}"), x8_uid, xc_editorId, x10_name).c_str(), + fmt::format("CWallCrawlerSwarm::Render {} {} {}", x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange); u32 drawMask = 0xffffffff; const bool r24 = x560_24_enableLighting; diff --git a/Runtime/World/CWorld.cpp b/Runtime/World/CWorld.cpp index a306d6497..2f9980269 100644 --- a/Runtime/World/CWorld.cpp +++ b/Runtime/World/CWorld.cpp @@ -357,7 +357,7 @@ bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, CAssetId mreaId) if (version > 12) { x84_defAudioTrack = r.Get(); - std::string trackKey = fmt::format(FMT_STRING("WorldDefault: {}"), x8_mlvlId); + std::string trackKey = fmt::format("WorldDefault: {}", x8_mlvlId); if (g_TweakManager->HasTweakValue(trackKey)) x84_defAudioTrack = g_TweakManager->GetTweakValue(trackKey)->GetAudio().GetFileName(); } diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index ccd4ab5d7..658843ee0 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -125,18 +125,17 @@ #include "Runtime/World/CTeamAiMgr.hpp" #include "Runtime/World/CWallCrawlerSwarm.hpp" #include "Runtime/World/CWorld.hpp" +#include "Runtime/Logging.hpp" +#include "Runtime/Formatting.hpp" namespace metaforce { -static logvisor::Module Log("metaforce::ScriptLoader"); - constexpr SObjectTag MorphballDoorANCS = {FOURCC('ANCS'), 0x1F9DA858u}; constexpr int skElitePiratePropCount = 41; static bool EnsurePropertyCount(int count, int expected, const char* structName) { if (count < expected) { - Log.report(logvisor::Warning, FMT_STRING("Insufficient number of props ({}/{}) for {} entity"), count, expected, - structName); + spdlog::warn("Insufficient number of props ({}/{}) for {} entity", count, expected, structName); return false; } return true; @@ -688,8 +687,7 @@ CEntity* ScriptLoader::LoadSound(CStateManager& mgr, CInputStream& in, int propC s32 pitch = in.ReadInt32(); if (soundId < 0) { - Log.report(logvisor::Warning, FMT_STRING("Invalid sound ID specified in Sound {} ({}), dropping..."), head.x0_name, - info.GetEditorId()); + spdlog::warn("Invalid sound ID specified in Sound {} ({}), dropping...", head.x0_name, info.GetEditorId()); return nullptr; } @@ -840,7 +838,7 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int CEntity* ScriptLoader::LoadCameraHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (propCount > 25) { - Log.report(logvisor::Warning, FMT_STRING("Too many props ({} > 25) for CameraHint entity"), propCount); + spdlog::warn("Too many props ({} > 25) for CameraHint entity", propCount); return nullptr; } @@ -1334,9 +1332,7 @@ CEntity* ScriptLoader::LoadSpacePirate(CStateManager& mgr, CInputStream& in, int return nullptr; if (animParms.GetCharacter() == 0) { - Log.report(logvisor::Warning, - FMT_STRING("SpacePirate <{}> has AnimationInformation property with invalid character selected"), - head.x0_name); + spdlog::warn("SpacePirate <{}> has AnimationInformation property with invalid character selected", head.x0_name); animParms.SetCharacter(2); } @@ -1565,7 +1561,7 @@ CEntity* ScriptLoader::LoadFlickerBat(CStateManager& mgr, CInputStream& in, int CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (propCount > 15) { - Log.report(logvisor::Warning, FMT_STRING("Too many props ({} > 15) for PathCamera entity"), propCount); + spdlog::warn("Too many props ({} > 15) for PathCamera entity", propCount); return nullptr; } @@ -2452,7 +2448,7 @@ CEntity* ScriptLoader::LoadVisorFlare(CStateManager& mgr, CInputStream& in, int CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { if (propCount < 4 || propCount > 26) { - Log.report(logvisor::Warning, FMT_STRING("Incorrect number of props for WorldTeleporter")); + spdlog::warn("Incorrect number of props for WorldTeleporter"); return nullptr; } diff --git a/Runtime/rstl.hpp b/Runtime/rstl.hpp index 5ea8f6fef..59169dc68 100644 --- a/Runtime/rstl.hpp +++ b/Runtime/rstl.hpp @@ -273,7 +273,7 @@ public: void push_back(const T& d) { #ifndef NDEBUG if (x0_size == N) { - Log.report(logvisor::Fatal, FMT_STRING("push_back() called on full rstl::reserved_vector.")); + spdlog::fatal("push_back() called on full rstl::reserved_vector."); } #endif @@ -284,7 +284,7 @@ public: void push_back(T&& d) { #ifndef NDEBUG if (x0_size == N) { - Log.report(logvisor::Fatal, FMT_STRING("push_back() called on full rstl::reserved_vector.")); + spdlog::fatal("push_back() called on full rstl::reserved_vector."); } #endif @@ -296,7 +296,7 @@ public: T& emplace_back(_Args&&... args) { #ifndef NDEBUG if (x0_size == N) { - Log.report(logvisor::Fatal, FMT_STRING("emplace_back() called on full rstl::reserved_vector.")); + spdlog::fatal("emplace_back() called on full rstl::reserved_vector."); } #endif @@ -310,7 +310,7 @@ public: void pop_back() { #ifndef NDEBUG if (x0_size == 0) { - Log.report(logvisor::Fatal, FMT_STRING("pop_back() called on empty rstl::reserved_vector.")); + spdlog::fatal("pop_back() called on empty rstl::reserved_vector."); } #endif @@ -321,7 +321,7 @@ public: iterator insert(const_iterator pos, const T& value) { #ifndef NDEBUG if (x0_size == N) { - Log.report(logvisor::Fatal, FMT_STRING("insert() called on full rstl::reserved_vector.")); + spdlog::fatal("insert() called on full rstl::reserved_vector."); } #endif @@ -342,7 +342,7 @@ public: iterator insert(const_iterator pos, T&& value) { #ifndef NDEBUG if (x0_size == N) - Log.report(logvisor::Fatal, FMT_STRING("insert() called on full rstl::reserved_vector.")); + spdlog::fatal("insert() called on full rstl::reserved_vector."); #endif auto target_it = base::_const_cast_iterator(pos); if (pos == cend()) { @@ -361,7 +361,7 @@ public: void resize(size_t size) { #ifndef NDEBUG if (size > N) { - Log.report(logvisor::Fatal, FMT_STRING("resize() call overflows rstl::reserved_vector.")); + spdlog::fatal("resize() call overflows rstl::reserved_vector."); } #endif @@ -383,7 +383,7 @@ public: void resize(size_t size, const T& value) { #ifndef NDEBUG if (size > N) { - Log.report(logvisor::Fatal, FMT_STRING("resize() call overflows rstl::reserved_vector.")); + spdlog::fatal("resize() call overflows rstl::reserved_vector."); } #endif @@ -405,7 +405,7 @@ public: iterator erase(const_iterator pos) { #ifndef NDEBUG if (x0_size == 0) { - Log.report(logvisor::Fatal, FMT_STRING("erase() called on empty rstl::reserved_vector.")); + spdlog::fatal("erase() called on empty rstl::reserved_vector."); } #endif @@ -460,7 +460,7 @@ public: [[nodiscard]] T& operator[](size_t idx) { #ifndef NDEBUG if (idx >= x0_size) { - Log.report(logvisor::Fatal, FMT_STRING("out of bounds access on reserved_vector.")); + spdlog::fatal("out of bounds access on reserved_vector."); } #endif return _value(idx); @@ -468,7 +468,7 @@ public: [[nodiscard]] const T& operator[](size_t idx) const { #ifndef NDEBUG if (idx >= x0_size) { - Log.report(logvisor::Fatal, FMT_STRING("out of bounds access on reserved_vector.")); + spdlog::fatal("out of bounds access on reserved_vector."); } #endif return _value(idx); diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index 690b2f623..3b76399e5 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -1,43 +1,3 @@ -option(BUILD_ATHENA "Build Athena libraries from source" ON) -if (CMAKE_HOST_SYSTEM_NAME STREQUAL Windows OR CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin) - # Default to binary atdna on Windows & macOS - option(BUILD_ATDNA "Build atdna utility from source (requires LLVM)" OFF) -else () - option(BUILD_ATDNA "Build atdna utility from source (requires LLVM)" ON) -endif () - -if (NOT BUILD_ATDNA) - set(ATHENA_BASE_URL "https://github.com/libAthena/athena/releases/download/latest") - if (CMAKE_HOST_SYSTEM_NAME STREQUAL Windows) - set(ATHENA_EXT 7z) - else () - set(ATHENA_EXT tar.gz) - endif () - include(FetchContent) - FetchContent_Declare(athena-host - URL "${ATHENA_BASE_URL}/athena-${HOST_PLATFORM_NAME}-${ATHENA_HOST_ARCH}.${ATHENA_EXT}") - message(STATUS "Fetching atdna host binary") - FetchContent_Populate(athena-host) - include(${athena-host_SOURCE_DIR}/lib/cmake/atdna/atdnaConfig.cmake) - set(atdna_DIR "${athena-host_SOURCE_DIR}/lib/cmake/atdna" PARENT_SCOPE) -endif () - -if (BUILD_ATHENA OR BUILD_ATDNA) - add_subdirectory(athena EXCLUDE_FROM_ALL) -else () - if (ATHENA_ARCH STREQUAL ATHENA_HOST_ARCH) - set(athena_SOURCE_DIR "${athena-host_SOURCE_DIR}") - else () - FetchContent_Declare(athena - URL "${ATHENA_BASE_URL}/athena-${HOST_PLATFORM_NAME}-${ATHENA_ARCH}.tar.gz") - FetchContent_Populate(athena) - endif () - include(${athena_SOURCE_DIR}/lib/cmake/athena/AthenaConfig.cmake) - include(${athena_SOURCE_DIR}/lib/cmake/lzokay/lzokayConfig.cmake) - add_library(lzokay ALIAS lzokay::lzokay) - include(athena/atdna/atdnaHelpers.cmake) -endif () - # Enable MoltenVK #if (CMAKE_SYSTEM_NAME STREQUAL Darwin) # set(DAWN_ENABLE_VULKAN ON CACHE BOOL "Enable compilation of the Vulkan backend" FORCE) @@ -48,30 +8,13 @@ endif () set(AURORA_NATIVE_MATRIX ON CACHE BOOL "Assume OpenGL-layout matrices, disables transposing" FORCE) add_subdirectory(aurora) -# boo must come after SDL2 -add_subdirectory(nod EXCLUDE_FROM_ALL) - -if (NOT GEKKO AND NOT NX AND NOT IOS AND NOT TVOS) - set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc) - if (NOT CMAKE_INSTALL_LIBDIR) - set(CMAKE_INSTALL_LIBDIR ${CMAKE_BINARY_DIR}/fake-prefix) - endif () - add_subdirectory(discord-rpc/src EXCLUDE_FROM_ALL) - target_include_directories(discord-rpc PRIVATE rapidjson/include PUBLIC discord-rpc/include) - if (APPLE) - # remove their nasty hack - get_target_property(DISCORD_LINK_LIBRARIES discord-rpc INTERFACE_LINK_LIBRARIES) - list(REMOVE_ITEM DISCORD_LINK_LIBRARIES "-framework AppKit, -mmacosx-version-min=10.10") - set_target_properties(discord-rpc PROPERTIES INTERFACE_LINK_LIBRARIES "${DISCORD_LINK_LIBRARIES}") - endif () - if (UNIX) - # remove another nasty hack - get_target_property(DISCORD_COMPILE_OPTIONS discord-rpc COMPILE_OPTIONS) - list(REMOVE_ITEM DISCORD_COMPILE_OPTIONS "-g") - set_target_properties(discord-rpc PROPERTIES COMPILE_OPTIONS "${DISCORD_COMPILE_OPTIONS}") - endif () +if (NOT TARGET spdlog) + set(SPDLOG_NO_EXCEPTIONS ON CACHE BOOL "Compile with -fno-exceptions. Call abort() on any spdlog exceptions" FORCE) + set(SPDLOG_FMT_EXTERNAL ON CACHE BOOL "Use external fmt library instead of bundled" FORCE) + add_subdirectory(spdlog EXCLUDE_FROM_ALL) endif () +add_subdirectory(nod EXCLUDE_FROM_ALL) add_subdirectory(jbus EXCLUDE_FROM_ALL) add_subdirectory(kabufuda EXCLUDE_FROM_ALL) diff --git a/extern/athena b/extern/athena deleted file mode 160000 index fa346ace4..000000000 --- a/extern/athena +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fa346ace4774e4ac66644be6d11908a80f0151b6 diff --git a/extern/aurora b/extern/aurora index ca3e4f527..b07d55f71 160000 --- a/extern/aurora +++ b/extern/aurora @@ -1 +1 @@ -Subproject commit ca3e4f5273d6af50634298fe73c2f4bcf1b75ac9 +Subproject commit b07d55f71d7d43099d537d23db1d9cfafd87b175 diff --git a/extern/discord-rpc b/extern/discord-rpc deleted file mode 160000 index 963aa9f3e..000000000 --- a/extern/discord-rpc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 963aa9f3e5ce81a4682c6ca3d136cddda614db33 diff --git a/extern/nod b/extern/nod index b513a7f4e..958430308 160000 --- a/extern/nod +++ b/extern/nod @@ -1 +1 @@ -Subproject commit b513a7f4e02d1b2a0c4563af73ba261d6760ab0e +Subproject commit 9584303083c8406a37a7834a443d8dfe34eb0d69 diff --git a/extern/rapidjson b/extern/rapidjson deleted file mode 160000 index 49aa0fc15..000000000 --- a/extern/rapidjson +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 49aa0fc15d63a2132ecf3ba0eda1ecf6fef215a1 diff --git a/extern/spdlog b/extern/spdlog new file mode 160000 index 000000000..48bcf39a6 --- /dev/null +++ b/extern/spdlog @@ -0,0 +1 @@ +Subproject commit 48bcf39a661a13be22666ac64db8a7f886f2637e