mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-13 20:06:10 +00:00
Replace logvisor with spdlog; remove athena, discord-rpc, rapidjson
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ std::vector<StoreCVar::CVar> CVarManager::loadCVars(const std::string& filename)
|
||||
#else
|
||||
"rbe"
|
||||
#endif
|
||||
);
|
||||
);
|
||||
if (file != nullptr) {
|
||||
|
||||
std::unique_ptr<u8[]> inBuf(new u8[st.st_size]);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user