2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-05-13 07:51:21 +00:00

Replace logvisor with spdlog; remove athena, discord-rpc, rapidjson

This commit is contained in:
Luke Street 2025-04-03 21:07:07 -06:00
parent 99d5f30ed8
commit b45f808e2c
106 changed files with 514 additions and 651 deletions

16
.gitmodules vendored
View File

@ -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

View File

@ -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)

View File

@ -1,7 +1,7 @@
#include "CNESEmulator.hpp"
#include "CGameState.hpp"
#include "Input/CFinalInput.hpp"
#include "logvisor/logvisor.hpp"
#include "Runtime/Logging.hpp"
#include <cstring>
#include <cstdio>
#include <cstdlib>
@ -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");
}
}

View File

@ -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<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_right"));
if (x1bc_state == EAutoMapperState::MapScreenUniverse)

View File

@ -30,10 +30,8 @@
#endif
#include "Runtime/CBasics.hpp"
#include "Runtime/CStopwatch.hpp"
#include <logvisor/logvisor.hpp>
#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
}

View File

@ -154,7 +154,6 @@ void CDvdFile::DoWork() {
void CDvdFile::WorkerProc() {
#ifdef HAS_DVD_THREAD
logvisor::RegisterThreadName("CDvdFile");
OPTICK_THREAD("CDvdFile");
while (m_WorkerRun.load()) {

View File

@ -1,10 +1,7 @@
#include "Runtime/CGameAllocator.hpp"
#include <logvisor/logvisor.hpp>
#include "Runtime/Logging.hpp"
namespace metaforce {
static logvisor::Module Log("metaforce::CGameAllocator");
#pragma GCC diagnostic ignored "-Wclass-memaccess"
std::vector<CGameAllocator::SAllocationDescription> CGameAllocator::m_allocations;
@ -46,8 +43,7 @@ u8* CGameAllocator::Alloc(size_t len) {
void CGameAllocator::Free(u8* ptr) {
SChunkDescription* info = reinterpret_cast<SChunkDescription*>(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;

View File

@ -5,6 +5,7 @@
#include <vector>
#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);
}
};

View File

@ -1,9 +1,8 @@
#include "Runtime/CInfiniteLoopDetector.hpp"
#include <logvisor/logvisor.hpp>
#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<std::mutex> guard(g_mutex);
if (std::chrono::duration_cast<std::chrono::milliseconds>(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!");
}
}
}

View File

@ -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<MP1::CMain> 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<amuse::BooBackendVoiceAllocator> m_amuseAllocWrapper;
//std::unique_ptr<boo::IAudioVoiceEngine> m_voiceEngine;
// std::optional<amuse::BooBackendVoiceAllocator> m_amuseAllocWrapper;
// std::unique_ptr<boo::IAudioVoiceEngine> 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"),
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<metaforce::Application> 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<metaforce::Application>(argc, argv, fileMgr, cvarMgr, cvarCmns);
std::string configPath{fileMgr.getStoreRoot()};
const AuroraConfig config{
.appName = "Metaforce",
.configPath = configPath.c_str(),
@ -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();

View File

@ -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}
)

View File

@ -1,7 +1,11 @@
#include "CMemoryCardSys.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/IMain.hpp"
#include <Runtime/CBasics.hpp>
#include "Runtime/CBasics.hpp"
#include "Runtime/Logging.hpp"
#include "Runtime/Formatting.hpp"
#include <SDL3/SDL_filesystem.h>
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);

View File

@ -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 {};

View File

@ -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) {

View File

@ -1,10 +1,9 @@
#include "Runtime/CObjectList.hpp"
#ifndef NDEBUG
#include "Runtime/Logging.hpp"
#endif
#include <logvisor/logvisor.hpp>
namespace metaforce {
namespace {
logvisor::Module Log("metaforce::CObjectList");
}
CObjectList::CObjectList(EGameObjectList listEnum) : x2004_listEnum(listEnum) {}
@ -13,8 +12,7 @@ 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 '{}'!!!"),
spdlog::fatal("INVALID USAGE DETECTED: Attempting to assign entity '{} ({})' to existing node '{}'!!!",
entity.GetName(), entity.GetEditorId(), entity.GetUniqueId().Value());
#endif
s16 prevFirst = -1;

View File

@ -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();

View File

@ -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<TObjOwnerDerivedFromIObjUntyped>(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;

View File

@ -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<CAssetId>* 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;
}

View File

@ -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 <zeus/CMRay.hpp>
@ -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<CScriptMailbox>& mailbox, const std::weak_ptr<CMapWorldInfo>& mwInfo,
const std::weak_ptr<CPlayerState>& playerState,
const std::weak_ptr<CWorldTransManager>& wtMgr,
@ -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<TEditorId, TUniqueId> 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<TEditorId, TUniqueId> 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);

View File

@ -3,12 +3,9 @@
#include "Runtime/CSimplePool.hpp"
#include "Runtime/Character/CAnimSourceReader.hpp"
#include "Runtime/Character/CFBStreamedAnimReader.hpp"
#include <logvisor/logvisor.hpp>
#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<int>(fmt));
}
}

View File

@ -24,12 +24,9 @@
#include "Runtime/Character/IAnimReader.hpp"
#include "Runtime/Graphics/CSkinnedModel.hpp"
#include "Runtime/Graphics/CGX.hpp"
#include <logvisor/logvisor.hpp>
#include "Runtime/Logging.hpp"
namespace metaforce {
static logvisor::Module Log("CAnimData");
rstl::reserved_vector<CBoolPOINode, 8> CAnimData::g_BoolPOINodes;
rstl::reserved_vector<CInt32POINode, 16> CAnimData::g_Int32POINodes;
rstl::reserved_vector<CParticlePOINode, 20> 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),

View File

@ -13,12 +13,10 @@
#include "Runtime/Graphics/CSkinnedModel.hpp"
#include "Runtime/Graphics/CVertexMorphEffect.hpp"
#include "Runtime/Graphics/CCubeRenderer.hpp"
#include <logvisor/logvisor.hpp>
#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<CAssetId, CAssetId>& 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<CAssetId, CAssetId>& 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);
}
}
}

View File

@ -1,6 +1,7 @@
#pragma once
#include <optional>
#include <memory>
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Collision/CCollisionEdge.hpp"

View File

@ -1,10 +1,6 @@
#include "Runtime/ConsoleVariables/CVar.hpp"
#include "Runtime/CBasics.hpp"
#include "Runtime/CStringExtras.hpp"
#include <logvisor/logvisor.hpp>
#include <sstream>
#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<uint32_t>(val)));
m_value = fmt::format("{}", (m_type == EType::Signed ? val : static_cast<uint32_t>(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<int32_t>(val)));
m_value = fmt::format("{}", (m_type == EType::Unsigned ? val : static_cast<int32_t>(val)));
setModified();
return true;
}

View File

@ -7,17 +7,18 @@
#include "Runtime/Streams/CMemoryInStream.hpp"
#include "Runtime/Streams/CMemoryStreamOut.hpp"
#include "Runtime/CStringExtras.hpp"
#include <logvisor/logvisor.hpp>
#include "Runtime/Formatting.hpp"
#include <algorithm>
#include <memory>
#include <regex>
#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);
}

View File

@ -1,9 +1,9 @@
#include "Runtime/ConsoleVariables/FileStoreManager.hpp"
#include "Runtime/CBasics.hpp"
#include "Runtime/Logging.hpp"
#include <SDL3/SDL.h>
#include <logvisor/logvisor.hpp>
#if _WIN32
#include <nowide/convert.hpp>
#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

57
Runtime/Formatting.hpp Normal file
View File

@ -0,0 +1,57 @@
#pragma once
#include "Runtime/RetroTypes.hpp"
#include <fmt/format.h> // IWYU pragma: export
#include <fmt/xchar.h>
#include <zeus/CMatrix3f.hpp>
#include <zeus/CMatrix4f.hpp>
#include <zeus/CTransform.hpp>
#include <zeus/CVector2f.hpp>
#include <zeus/CVector3f.hpp>
#define FMT_CUSTOM_FORMATTER(Type, str, ...) \
template <typename CharT> \
struct fmt::formatter<Type, CharT> : fmt::formatter<std::basic_string_view<CharT>, CharT> { \
template <typename FormatContext> \
auto format(const Type& obj, FormatContext& ctx) const -> decltype(ctx.out()) { \
if constexpr (std::is_same_v<CharT, char>) { \
return fmt::format_to(ctx.out(), str __VA_OPT__(, ) __VA_ARGS__); \
} else if constexpr (std::is_same_v<CharT, char16_t>) { \
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]);

View File

@ -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;
}

View File

@ -15,12 +15,11 @@
#include "Runtime/Particle/CDecal.hpp"
#include "Runtime/Particle/CElementGen.hpp"
#include "Runtime/CDvdFile.hpp"
#include "Runtime/Logging.hpp"
#include <utility>
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<CDrawable*, 128>;
using BucketHolderType = rstl::reserved_vector<CDrawable*, 132>;
@ -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::vector<CMetroidModelInstance
void CCubeRenderer::DrawUnsortedGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
SCOPED_GRAPHICS_DEBUG_GROUP(
fmt::format(FMT_STRING("CCubeRenderer::DrawUnsortedGeometry areaIdx={} mask={} targetMask={}"), areaIdx, mask,
fmt::format("CCubeRenderer::DrawUnsortedGeometry areaIdx={} mask={} targetMask={}", areaIdx, mask,
targetMask)
.c_str(),
zeus::skBlue);
@ -408,7 +407,7 @@ void CCubeRenderer::DrawUnsortedGeometry(s32 areaIdx, s32 mask, s32 targetMask)
void CCubeRenderer::DrawSortedGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
SCOPED_GRAPHICS_DEBUG_GROUP(
fmt::format(FMT_STRING("CCubeRenderer::DrawSortedGeometry areaIdx={} mask={} targetMask={}"), areaIdx, mask,
fmt::format("CCubeRenderer::DrawSortedGeometry areaIdx={} mask={} targetMask={}", areaIdx, mask,
targetMask)
.c_str(),
zeus::skBlue);
@ -442,7 +441,7 @@ void CCubeRenderer::DrawStaticGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
void CCubeRenderer::DrawAreaGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
SCOPED_GRAPHICS_DEBUG_GROUP(
fmt::format(FMT_STRING("CCubeRenderer::DrawAreaGeometry areaIdx={} mask={} targetMask={}"), areaIdx, mask,
fmt::format("CCubeRenderer::DrawAreaGeometry areaIdx={} mask={} targetMask={}", areaIdx, mask,
targetMask)
.c_str(),
zeus::skBlue);
@ -490,7 +489,7 @@ void CCubeRenderer::DrawAreaGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
void CCubeRenderer::RenderBucketItems(const CAreaListItem* item) {
SCOPED_GRAPHICS_DEBUG_GROUP(
fmt::format(FMT_STRING("CCubeRenderer::RenderBucketItems areaIdx={}"), item->x18_areaIdx).c_str(), zeus::skBlue);
fmt::format("CCubeRenderer::RenderBucketItems areaIdx={}", item->x18_areaIdx).c_str(), zeus::skBlue);
CCubeModel* lastModel = nullptr;
EDrawableType lastDrawableType = EDrawableType::Invalid;

View File

@ -1,12 +1,9 @@
#include "Runtime/Graphics/CLineRenderer.hpp"
#include "Runtime/Graphics/Shaders/CLineRendererShaders.hpp"
#include <logvisor/logvisor.hpp>
#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);

View File

@ -253,7 +253,7 @@ CBooModel::CBooModel(TToken<CModel>& token, CModel* parent, std::vector<CBooSurf
// }
//
// if (m_instances.size() >= 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<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
u32 version = CBasics::SwapBytes(*reinterpret_cast<u32*>(data.get() + 0x4));
m_flags = CBasics::SwapBytes(*reinterpret_cast<u32*>(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;
}

View File

@ -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]);

View File

@ -3,13 +3,11 @@
#include "Runtime/Character/CSkinRules.hpp"
#include "Runtime/Graphics/CCubeRenderer.hpp"
#include "Runtime/Graphics/CVertexMorphEffect.hpp"
#include "Runtime/Logging.hpp"
#include <logvisor/logvisor.hpp>
#include <list>
namespace metaforce {
static logvisor::Module Log("metaforce::CSkinnedModel");
CSkinnedModel::CSkinnedModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules,
const TLockedToken<CCharLayoutInfo>& layoutInfo)
: x4_model(std::move(model))
@ -17,13 +15,13 @@ CSkinnedModel::CSkinnedModel(const TLockedToken<CModel>& 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");
}
}

View File

@ -3,6 +3,8 @@
#include "Graphics/GX.hpp"
#include "RetroTypes.hpp"
#include <cstring>
namespace metaforce {
enum class ERglTevStage : std::underlying_type_t<GXTevStageID> {
Stage0 = GX_TEVSTAGE0,

View File

@ -1,6 +1,7 @@
#include "Graphics/CTexture.hpp"
#include "CToken.hpp"
#include "Runtime/CToken.hpp"
#include "Runtime/Formatting.hpp"
#include <zeus/Math.hpp>
#include <magic_enum.hpp>
@ -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<CGraphicsPalette>(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<CTexture>::GetIObjObjectFor(std::make_unique<CTexture>(in, label));
}
} // namespace metaforce

View File

@ -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<const uint8_t*>(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<const uint32_t*>(data));
const u8* paletteTexels = reinterpret_cast<const u8*>(data) + 4;
@ -758,7 +758,7 @@ CTexture::CTexture(std::unique_ptr<u8[]>&& 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<u8[]>&& 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<u8[]> data = std::make_unique<u8[]>(x4_w * x6_h * 4);
@ -825,7 +824,7 @@ CTexture::CTexture(std::unique_ptr<u8[]>&& 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<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut,
std::unique_ptr<u8[]>& 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<u8[]> ret;
@ -914,7 +913,7 @@ std::unique_ptr<u8[]> 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;
}

View File

@ -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;

View File

@ -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();
}

View File

@ -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);

View File

@ -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);

View File

@ -6,6 +6,8 @@
#include <zeus/CTransform.hpp>
#include <zeus/CVector3f.hpp>
#include <memory>
namespace metaforce {
struct CGuiWidgetDrawParms;

View File

@ -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();

View File

@ -1,7 +1,5 @@
#include "Runtime/GuiSys/CGuiTextSupport.hpp"
#include <fmt/xchar.h>
#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);

View File

@ -1,12 +1,9 @@
#include "Runtime/Graphics/CGraphics.hpp"
#include "Runtime/GuiSys/CGuiWidget.hpp"
#include "Runtime/GuiSys/CGuiFrame.hpp"
#include <logvisor/logvisor.hpp>
#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;
}
}

View File

@ -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<CGuiModel*>(selHud.FindWidget("model_bombicon"));
x10_textpane_bombdigits = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_bombdigits"));
for (int i = 0; i < 3; ++i) {
CGuiGroup* grp = static_cast<CGuiGroup*>(selHud.FindWidget(fmt::format(FMT_STRING("group_bombcount{}"), i)));
CGuiGroup* grp = static_cast<CGuiGroup*>(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();
}

View File

@ -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);
}

View File

@ -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();

View File

@ -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);
}

View File

@ -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<CGuiModel*>(x0_baseHud.FindWidget(fmt::format(FMT_STRING("{}ghost"), ModelNames[size_t(x4_type)])));
static_cast<CGuiModel*>(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<CGuiModel*>(x0_baseHud.FindWidget(fmt::format(FMT_STRING("{}loz{}"), modelName, menuItemOrder)));
static_cast<CGuiModel*>(x0_baseHud.FindWidget(fmt::format("{}loz{}", modelName, menuItemOrder)));
item.x4_model_icon =
static_cast<CGuiModel*>(x0_baseHud.FindWidget(fmt::format(FMT_STRING("{}icon{}"), modelName, menuItemOrder)));
static_cast<CGuiModel*>(x0_baseHud.FindWidget(fmt::format("{}icon{}", modelName, menuItemOrder)));
item.xc_opacity = enables[i] ? 1.f : 0.f;
}

View File

@ -20,7 +20,8 @@
#include <nfd.hpp>
#endif
#include <cstdarg>
#include "Runtime/Logging.hpp"
#include "Runtime/Formatting.hpp"
#include <zeus/CEulerAngles.hpp>
@ -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<ImGuiEntityEntry, kMaxEntities> ImGuiConsole::entities;
std::set<TUniqueId> 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<size_t>(count), suffixes[s]);
return fmt::format("{}{}", static_cast<size_t>(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"
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"),
" 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<float>(createdPipelines) / static_cast<float>(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<int>(BACKEND_AUTO);
if (auto* cvar = m_cvarMgr.findCVar("graphicsApi")) {
bool valid = false;

View File

@ -4,6 +4,7 @@
#include "Runtime/Streams/CFileOutStream.hpp"
#include "Runtime/Streams/ContainerReaders.hpp"
#include "Runtime/Streams/ContainerWriters.hpp"
#include "Runtime/Formatting.hpp"
#include <imgui.h>
@ -77,23 +78,23 @@ void ImGuiControllerConfig::show(bool& visible) {
std::vector<std::string> 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;

View File

@ -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)));
}
}
}

View File

@ -1,15 +1,15 @@
#include "Runtime/ImGuiPlayerLoadouts.hpp"
#include "Runtime/Streams/ContainerReaders.hpp"
#include "Runtime/Streams/ContainerWriters.hpp"
#include <logvisor/logvisor.hpp>
#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<CPlayerState::EItemType>(in.Get<std::string>()).value()), amount(in.ReadLong()) {}
@ -29,7 +29,7 @@ ImGuiPlayerLoadouts::ImGuiPlayerLoadouts(CInputStream& in) {
in.Get(reinterpret_cast<u8*>(&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);

View File

@ -1,6 +1,9 @@
#include "Runtime/Input/CDolphinController.hpp"
#include <dolphin/si.h>
#include <zeus/Math.hpp>
#include <cstring>
namespace metaforce {
CDolphinController::CDolphinController() {

View File

@ -1,6 +1,8 @@
#pragma once
#include <array>
#include <cstring>
#include <bitset>
#include "Runtime/Input/CKeyboardMouseController.hpp"
#include "Runtime/Input/CControllerGamepadData.hpp"

View File

@ -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;

12
Runtime/Logging.hpp Normal file
View File

@ -0,0 +1,12 @@
#pragma once
#include <spdlog/spdlog.h> // IWYU pragma: export
namespace spdlog {
template <typename... Args>
[[noreturn]] inline void fatal(format_string_t<Args...> fmt, Args&&... args) {
default_logger_raw()->critical(fmt, std::forward<Args>(args)...);
default_logger_raw()->flush();
std::terminate();
}
} // namespace spdlog

View File

@ -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()))

View File

@ -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<CGuiTextPane*>(frame->FindWidget(name));
ret.x0_panes[1] = static_cast<CGuiTextPane*>(frame->FindWidget(fmt::format(FMT_STRING("{}b"), name)));
ret.x0_panes[1] = static_cast<CGuiTextPane*>(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<CGuiTextPane*>(frame->FindWidget(name));
w1->TextSupport().SetText(str);
CGuiTextPane* w2 = static_cast<CGuiTextPane*>(frame->FindWidget(fmt::format(FMT_STRING("{}b"), name)));
CGuiTextPane* w2 = static_cast<CGuiTextPane*>(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<int>(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() {

View File

@ -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;

View File

@ -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() {

View File

@ -1,7 +1,6 @@
#include "Runtime/MP1/CPauseScreenBase.hpp"
#include <array>
#include <fmt/xchar.h>
#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<CGuiModel*>(x8_frame.FindWidget("model_textalpha"));
x184_textpane_yicon = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_yicon"));
x188_textpane_ytext = static_cast<CGuiTextPane*>(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<CGuiTextPane*>(x8_frame.FindWidget(fmt::format(FMT_STRING("textpane_title{}"), i + 1))));
static_cast<CGuiTextPane*>(x8_frame.FindWidget(fmt::format("textpane_title{}", i + 1))));
xd8_textpane_titles.back()->TextSupport().SetText(u"");
x144_model_titles.push_back(
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format(FMT_STRING("model_title{}"), i + 1))));
x144_model_titles.push_back(static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format("model_title{}", i + 1))));
m_model_lefttitledecos.push_back(
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format(FMT_STRING("model_lefttitledeco{}"), i))));
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format("model_lefttitledeco{}", i))));
m_model_lefttitledecos.back()->SetMouseActive(true);
x15c_model_righttitledecos.push_back(
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format(FMT_STRING("model_righttitledeco{}"), i + 1))));
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format("model_righttitledeco{}", i + 1))));
x15c_model_righttitledecos.back()->SetMouseActive(true);
xa8_textpane_categories.push_back(
static_cast<CGuiTextPane*>(x8_frame.FindWidget(fmt::format(FMT_STRING("textpane_category{}"), i))));
xc0_model_categories.push_back(
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format(FMT_STRING("model_category{}"), i))));
static_cast<CGuiTextPane*>(x8_frame.FindWidget(fmt::format("textpane_category{}", i))));
xc0_model_categories.push_back(static_cast<CGuiModel*>(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

View File

@ -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<CGuiModel*>(x274_loadedFrmeBaseHud->FindWidget(fmt::format(FMT_STRING("model_videoband{}"), i)));
static_cast<CGuiModel*>(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);

View File

@ -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;
}

View File

@ -18,13 +18,10 @@
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/AutoMapper/CMappableObject.hpp"
#include "Runtime/World/CPlayerCameraBob.hpp"
#include <logvisor/logvisor.hpp>
#include "Runtime/Logging.hpp"
namespace metaforce::MP1 {
static logvisor::Module Log("MP1::CTweaks");
void CTweaks::RegisterTweaks(CVarManager* cvarMgr) {
std::optional<CMemoryInStream> strm;
const SObjectTag* tag;

View File

@ -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<u8[]> buf = std::make_unique<u8[]>(file.Length());
u32 readLen = file.SyncRead(buf.get(), file.Length());
const char* buildInfo = static_cast<char*>(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) {

View File

@ -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");
}
}

View File

@ -6,12 +6,10 @@
#include "Runtime/Collision/CCollisionActor.hpp"
#include "Runtime/World/CPatternedInfo.hpp"
#include "Runtime/World/CPlayer.hpp"
#include <logvisor/logvisor.hpp>
#include "Runtime/Logging.hpp"
#include "Runtime/Formatting.hpp"
namespace metaforce::MP1 {
logvisor::Module SpankLog("metaforce::MP1::SpankWeed");
constexpr std::array<SSphereJointInfo, 7> kArmCollision{{
{"Arm_4", 1.5f},
{"Arm_6", 1.f},
@ -41,9 +39,9 @@ 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"),
spdlog::warn(
"WARNING: Non-uniform scale {} applied to Spank Weed"
"...changing scale to ({} {} {})\n",
modelScale, scale, scale, scale);
}
CMaterialList list = GetMaterialFilter().GetExcludeList();

View File

@ -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);

View File

@ -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<CCollis
void CThardusRockProjectile::DoExplosion(CStateManager& mgr, CAssetId particleId, const zeus::CVector3f& pos,
const zeus::CVector3f& scale, u32 w2) {
TUniqueId uid = mgr.AllocateUniqueId();
std::string name = fmt::format(FMT_STRING("ROCK_PROJECTILE_EFFECT-{}-{}"), particleId.Value(), uid.Value());
std::string name = fmt::format("ROCK_PROJECTILE_EFFECT-{}-{}", particleId.Value(), uid.Value());
TLockedToken<CGenDescription> 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));

View File

@ -4,12 +4,10 @@
#include "Runtime/CSimplePool.hpp"
#include "Runtime/Graphics/CModel.hpp"
#include "Runtime/Particle/CParticleDataFactory.hpp"
#include <logvisor/logvisor.hpp>
#include "Runtime/Logging.hpp"
#include "Runtime/Formatting.hpp"
namespace metaforce {
static logvisor::Module Log("metaforce::CDecalDataFactory");
using CPF = CParticleDataFactory;
std::unique_ptr<CDecalDescription> 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;
}
}

View File

@ -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<float, 8>& 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();

View File

@ -7,12 +7,10 @@
#include "Runtime/Particle/CElectricDescription.hpp"
#include "Runtime/Particle/CGenDescription.hpp"
#include "Runtime/Particle/CSwooshDescription.hpp"
#include <logvisor/logvisor.hpp>
#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;
}
}

View File

@ -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) {

View File

@ -5,12 +5,10 @@
#include "Runtime/CToken.hpp"
#include "Runtime/Graphics/CModel.hpp"
#include "Runtime/Particle/CElectricDescription.hpp"
#include <logvisor/logvisor.hpp>
#include "Runtime/Logging.hpp"
#include "Runtime/Formatting.hpp"
namespace metaforce {
static logvisor::Module Log("metaforce::CParticleElectricDataFactory");
using CPF = CParticleDataFactory;
std::unique_ptr<CElectricDescription> 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;
}
}

View File

@ -2,6 +2,7 @@
#include <array>
#include <vector>
#include <memory>
#include "Runtime/RetroTypes.hpp"

View File

@ -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();

View File

@ -6,12 +6,10 @@
#include "Runtime/Particle/CElectricDescription.hpp"
#include "Runtime/Particle/CGenDescription.hpp"
#include "Runtime/Particle/CSwooshDescription.hpp"
#include <logvisor/logvisor.hpp>
#include "Runtime/Logging.hpp"
#include "Runtime/Formatting.hpp"
namespace metaforce {
static logvisor::Module Log("metaforce::CParticleSwooshDataFactory");
using CPF = CParticleDataFactory;
std::unique_ptr<CSwooshDescription> 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;
}
}

View File

@ -8,12 +8,10 @@
#include "Runtime/Particle/CGenDescription.hpp"
#include "Runtime/Particle/CSwooshDescription.hpp"
#include "Runtime/Particle/CWeaponDescription.hpp"
#include <logvisor/logvisor.hpp>
#include "Runtime/Logging.hpp"
#include "Runtime/Formatting.hpp"
namespace metaforce {
static logvisor::Module Log("metaforce::CProjectileWeaponDataFactory");
using CPF = CParticleDataFactory;
std::unique_ptr<CWeaponDescription> 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;
}
}

View File

@ -2,12 +2,9 @@
#include "Runtime/Streams/IOStreams.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/IMain.hpp"
#include <logvisor/logvisor.hpp>
#include "Runtime/Logging.hpp"
namespace metaforce {
logvisor::Module Log("metaforce::RetroTypes::CAssetId");
SObjectTag::SObjectTag(CInputStream& in) {
in.ReadBytes(reinterpret_cast<u8*>(&type), 4);
id = in.Get<CAssetId>();
@ -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!");
}
}

View File

@ -3,19 +3,11 @@
#include <functional>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "GCNTypes.hpp"
#include "rstl.hpp"
#include <logvisor/logvisor.hpp>
#include <zeus/CMatrix3f.hpp>
#include <zeus/CMatrix4f.hpp>
#include <zeus/CTransform.hpp>
#include <zeus/CVector2f.hpp>
#include <zeus/CVector3f.hpp>
#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<metaforce::CAssetId> {
};
} // 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

View File

@ -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 <cstring>
#include <logvisor/logvisor.hpp>
namespace metaforce {
static logvisor::Module Log("metaforce::CInputStream");
static u32 min_containing_bytes(u32 v) {
v = 32 - v;
v = (v >> 3) - (static_cast<s32>(-(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 {

View File

@ -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);

View File

@ -228,7 +228,7 @@ void CNewFlameThrower::RenderParticles(std::array<CElementGen*, 5> 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(); });

View File

@ -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);

View File

@ -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);

View File

@ -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<std::unique_ptr<u8[]>, 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;

View File

@ -1,14 +1,10 @@
#include "Runtime/World/CPathFindArea.hpp"
#include <logvisor/logvisor.hpp>
#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<zeus::CAABox>();
@ -127,7 +123,7 @@ CPFArea::CPFArea(std::unique_ptr<u8[]>&& 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);

View File

@ -93,7 +93,7 @@ void CPhysicsActor::AddMotionState(const CMotionState& mst) {
q += mst.xc_orientation;
zeus::CQuaternion quat = zeus::CQuaternion::fromNUQuaternion(q);
// if (TCastToPtr<CPlayer>(this)) {
// fmt::print(FMT_STRING("ADD {}\n"), mst.x0_translation);
// spdlog::debug("ADD {}\n", mst.x0_translation);
// }
SetTransform(zeus::CTransform(quat, x34_transform.origin));

View File

@ -29,15 +29,12 @@
#include "Runtime/World/CScriptGrapplePoint.hpp"
#include "Runtime/World/CScriptPlayerHint.hpp"
#include "Runtime/World/CScriptWater.hpp"
#include <logvisor/logvisor.hpp>
#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

View File

@ -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
}

View File

@ -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();

View File

@ -5,12 +5,10 @@
#include "Runtime/Weapon/CGameProjectile.hpp"
#include "Runtime/World/CActorParameters.hpp"
#include "Runtime/World/CPlayer.hpp"
#include <logvisor/logvisor.hpp>
#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);
}

View File

@ -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();

View File

@ -1,5 +1,6 @@
#pragma once
#include <cstring>
#include <vector>
#include "Runtime/CToken.hpp"

View File

@ -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;

View File

@ -357,7 +357,7 @@ bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, CAssetId mreaId)
if (version > 12) {
x84_defAudioTrack = r.Get<std::string>();
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();
}

View File

@ -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;
}

View File

@ -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);

67
extern/CMakeLists.txt vendored
View File

@ -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)

Some files were not shown because too many files have changed in this diff Show More