mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 13:04:56 +00:00
Update fmtlib
This commit is contained in:
@@ -70,7 +70,7 @@ static void InstallBlendershell(const SystemChar* path) {
|
||||
auto fp = hecl::FopenUnique(path, _SYS_STR("w"));
|
||||
|
||||
if (fp == nullptr) {
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("unable to open {} for writing")), path);
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to open {} for writing")), path);
|
||||
}
|
||||
|
||||
std::fwrite(HECL_BLENDERSHELL, 1, HECL_BLENDERSHELL_SZ, fp.get());
|
||||
@@ -80,7 +80,7 @@ static void InstallAddon(const SystemChar* path) {
|
||||
auto fp = hecl::FopenUnique(path, _SYS_STR("wb"));
|
||||
|
||||
if (fp == nullptr) {
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to install blender addon at '{}'")), path);
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to install blender addon at '{}'")), path);
|
||||
}
|
||||
|
||||
std::fwrite(HECL_ADDON, 1, HECL_ADDON_SZ, fp.get());
|
||||
@@ -128,20 +128,20 @@ uint32_t Connection::_readStr(char* buf, uint32_t bufSz) {
|
||||
uint32_t readLen;
|
||||
int ret = Read(m_readpipe[0], &readLen, sizeof(readLen));
|
||||
if (ret < 4) {
|
||||
BlenderLog.report(logvisor::Error, fmt("Pipe error {} {}"), ret, strerror(errno));
|
||||
BlenderLog.report(logvisor::Error, FMT_STRING("Pipe error {} {}"), ret, strerror(errno));
|
||||
_blenderDied();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (readLen >= bufSz) {
|
||||
BlenderLog.report(logvisor::Fatal, fmt("Pipe buffer overrun [{}/{}]"), readLen, bufSz);
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Pipe buffer overrun [{}/{}]"), readLen, bufSz);
|
||||
*buf = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = Read(m_readpipe[0], buf, readLen);
|
||||
if (ret < 0) {
|
||||
BlenderLog.report(logvisor::Fatal, fmt("{}"), strerror(errno));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("{}"), strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -266,11 +266,11 @@ void Connection::_blenderDied() {
|
||||
std::fseek(errFp.get(), 0, SEEK_SET);
|
||||
const auto buf = std::make_unique<char[]>(len + 1);
|
||||
std::fread(buf.get(), 1, len, errFp.get());
|
||||
BlenderLog.report(logvisor::Fatal, fmt("\n{:.{}s}"), buf.get(), len);
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("\n{:.{}s}"), buf.get(), len);
|
||||
}
|
||||
}
|
||||
|
||||
BlenderLog.report(logvisor::Fatal, fmt("Blender Exception"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Blender Exception"));
|
||||
}
|
||||
|
||||
static std::atomic_bool BlenderFirstInit(false);
|
||||
@@ -287,7 +287,7 @@ static bool RegFileExists(const hecl::SystemChar* path) {
|
||||
Connection::Connection(int verbosityLevel) {
|
||||
#if !WINDOWS_STORE
|
||||
if (hecl::VerbosityLevel >= 1)
|
||||
BlenderLog.report(logvisor::Info, fmt("Establishing BlenderConnection..."));
|
||||
BlenderLog.report(logvisor::Info, FMT_STRING("Establishing BlenderConnection..."));
|
||||
|
||||
/* Put hecl_blendershell.py in temp dir */
|
||||
const SystemChar* TMPDIR = GetTmpDir();
|
||||
@@ -321,20 +321,20 @@ Connection::Connection(int verbosityLevel) {
|
||||
SECURITY_ATTRIBUTES sattrs = {sizeof(SECURITY_ATTRIBUTES), nullptr, TRUE};
|
||||
HANDLE consoleOutReadTmp, consoleOutWrite, consoleErrWrite, consoleOutRead;
|
||||
if (!CreatePipe(&consoleOutReadTmp, &consoleOutWrite, &sattrs, 1024))
|
||||
BlenderLog.report(logvisor::Fatal, fmt("Error with CreatePipe"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Error with CreatePipe"));
|
||||
|
||||
if (!DuplicateHandle(GetCurrentProcess(), consoleOutWrite, GetCurrentProcess(), &consoleErrWrite, 0, TRUE,
|
||||
DUPLICATE_SAME_ACCESS))
|
||||
BlenderLog.report(logvisor::Fatal, fmt("Error with DuplicateHandle"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Error with DuplicateHandle"));
|
||||
|
||||
if (!DuplicateHandle(GetCurrentProcess(), consoleOutReadTmp, GetCurrentProcess(),
|
||||
&consoleOutRead, // Address of new handle.
|
||||
0, FALSE, // Make it uninheritable.
|
||||
DUPLICATE_SAME_ACCESS))
|
||||
BlenderLog.report(logvisor::Fatal, fmt("Error with DupliateHandle"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Error with DupliateHandle"));
|
||||
|
||||
if (!CloseHandle(consoleOutReadTmp))
|
||||
BlenderLog.report(logvisor::Fatal, fmt("Error with CloseHandle"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Error with CloseHandle"));
|
||||
#else
|
||||
pipe(m_readpipe.data());
|
||||
pipe(m_writepipe.data());
|
||||
@@ -365,15 +365,15 @@ Connection::Connection(int verbosityLevel) {
|
||||
/* No steam; try default */
|
||||
wchar_t progFiles[256];
|
||||
if (!GetEnvironmentVariableW(L"ProgramFiles", progFiles, 256))
|
||||
BlenderLog.report(logvisor::Fatal, fmt(L"unable to determine 'Program Files' path"));
|
||||
blenderBinBuf = fmt::format(fmt(L"{}\\Blender Foundation\\Blender\\blender.exe"), progFiles);
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(L"unable to determine 'Program Files' path"));
|
||||
blenderBinBuf = fmt::format(FMT_STRING(L"{}\\Blender Foundation\\Blender\\blender.exe"), progFiles);
|
||||
blenderBin = blenderBinBuf.c_str();
|
||||
if (!RegFileExists(blenderBin))
|
||||
BlenderLog.report(logvisor::Fatal, fmt(L"unable to find blender.exe"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(L"unable to find blender.exe"));
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring cmdLine = fmt::format(fmt(L" --background -P \"{}\" -- {} {} {} \"{}\""), blenderShellPath,
|
||||
std::wstring cmdLine = fmt::format(FMT_STRING(L" --background -P \"{}\" -- {} {} {} \"{}\""), blenderShellPath,
|
||||
uintptr_t(writehandle), uintptr_t(readhandle), verbosityLevel, blenderAddonPath);
|
||||
|
||||
STARTUPINFO sinfo = {sizeof(STARTUPINFO)};
|
||||
@@ -395,7 +395,7 @@ Connection::Connection(int verbosityLevel) {
|
||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0,
|
||||
nullptr);
|
||||
BlenderLog.report(logvisor::Fatal, fmt(L"unable to launch blender from {}: {}"), blenderBin, messageBuffer);
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(L"unable to launch blender from {}: {}"), blenderBin, messageBuffer);
|
||||
}
|
||||
|
||||
close(m_writepipe[0]);
|
||||
@@ -417,13 +417,13 @@ Connection::Connection(int verbosityLevel) {
|
||||
if (err == ERROR_BROKEN_PIPE)
|
||||
break; // pipe done - normal exit path.
|
||||
else
|
||||
BlenderLog.report(logvisor::Error, fmt("Error with ReadFile: {:08X}"), err); // Something bad happened.
|
||||
BlenderLog.report(logvisor::Error, FMT_STRING("Error with ReadFile: {:08X}"), err); // Something bad happened.
|
||||
}
|
||||
|
||||
// Display the character read on the screen.
|
||||
auto lk = logvisor::LockLog();
|
||||
if (!WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), lpBuffer, nBytesRead, &nCharsWritten, nullptr)) {
|
||||
// BlenderLog.report(logvisor::Error, fmt("Error with WriteConsole: %08X"), GetLastError());
|
||||
// BlenderLog.report(logvisor::Error, FMT_STRING("Error with WriteConsole: %08X"), GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,16 +449,16 @@ Connection::Connection(int verbosityLevel) {
|
||||
}
|
||||
|
||||
std::string errbuf;
|
||||
std::string readfds = fmt::format(fmt("{}"), m_writepipe[0]);
|
||||
std::string writefds = fmt::format(fmt("{}"), m_readpipe[1]);
|
||||
std::string vLevel = fmt::format(fmt("{}"), verbosityLevel);
|
||||
std::string readfds = fmt::format(FMT_STRING("{}"), m_writepipe[0]);
|
||||
std::string writefds = fmt::format(FMT_STRING("{}"), m_readpipe[1]);
|
||||
std::string vLevel = fmt::format(FMT_STRING("{}"), verbosityLevel);
|
||||
|
||||
/* Try user-specified blender first */
|
||||
if (blenderBin) {
|
||||
execlp(blenderBin, blenderBin, "--background", "-P", blenderShellPath.c_str(), "--", readfds.c_str(),
|
||||
writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), nullptr);
|
||||
if (errno != ENOENT) {
|
||||
errbuf = fmt::format(fmt("NOLAUNCH {}"), strerror(errno));
|
||||
errbuf = fmt::format(FMT_STRING("NOLAUNCH {}"), strerror(errno));
|
||||
_writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]);
|
||||
exit(1);
|
||||
}
|
||||
@@ -476,7 +476,7 @@ Connection::Connection(int verbosityLevel) {
|
||||
execlp(blenderBin, blenderBin, "--background", "-P", blenderShellPath.c_str(), "--", readfds.c_str(),
|
||||
writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), nullptr);
|
||||
if (errno != ENOENT) {
|
||||
errbuf = fmt::format(fmt("NOLAUNCH {}"), strerror(errno));
|
||||
errbuf = fmt::format(FMT_STRING("NOLAUNCH {}"), strerror(errno));
|
||||
_writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]);
|
||||
exit(1);
|
||||
}
|
||||
@@ -486,7 +486,7 @@ Connection::Connection(int verbosityLevel) {
|
||||
execlp(DEFAULT_BLENDER_BIN, DEFAULT_BLENDER_BIN, "--background", "-P", blenderShellPath.c_str(), "--",
|
||||
readfds.c_str(), writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), nullptr);
|
||||
if (errno != ENOENT) {
|
||||
errbuf = fmt::format(fmt("NOLAUNCH {}"), strerror(errno));
|
||||
errbuf = fmt::format(FMT_STRING("NOLAUNCH {}"), strerror(errno));
|
||||
_writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]);
|
||||
exit(1);
|
||||
}
|
||||
@@ -503,10 +503,10 @@ Connection::Connection(int verbosityLevel) {
|
||||
/* Stash error path and unlink existing file */
|
||||
#if _WIN32
|
||||
m_errPath = hecl::SystemString(TMPDIR) +
|
||||
fmt::format(fmt(_SYS_STR("/hecl_{:016X}.derp")), (unsigned long long)m_pinfo.dwProcessId);
|
||||
fmt::format(FMT_STRING(_SYS_STR("/hecl_{:016X}.derp")), (unsigned long long)m_pinfo.dwProcessId);
|
||||
#else
|
||||
m_errPath = hecl::SystemString(TMPDIR) +
|
||||
fmt::format(fmt(_SYS_STR("/hecl_{:016X}.derp")), (unsigned long long)m_blenderProc);
|
||||
fmt::format(FMT_STRING(_SYS_STR("/hecl_{:016X}.derp")), (unsigned long long)m_blenderProc);
|
||||
#endif
|
||||
hecl::Unlink(m_errPath.c_str());
|
||||
|
||||
@@ -515,28 +515,28 @@ Connection::Connection(int verbosityLevel) {
|
||||
|
||||
if (!lineStr.compare(0, 8, "NOLAUNCH")) {
|
||||
_closePipe();
|
||||
BlenderLog.report(logvisor::Fatal, fmt("Unable to launch blender: {}"), lineStr.c_str() + 9);
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Unable to launch blender: {}"), lineStr.c_str() + 9);
|
||||
} else if (!lineStr.compare(0, 9, "NOBLENDER")) {
|
||||
_closePipe();
|
||||
#if _WIN32
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}'")), blenderBin);
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find blender at '{}'")), blenderBin);
|
||||
#else
|
||||
if (blenderBin)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}' or '{}'")), blenderBin,
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find blender at '{}' or '{}'")), blenderBin,
|
||||
DEFAULT_BLENDER_BIN);
|
||||
else
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}'")), DEFAULT_BLENDER_BIN);
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find blender at '{}'")), DEFAULT_BLENDER_BIN);
|
||||
#endif
|
||||
} else if (lineStr == "NOT281") {
|
||||
_closePipe();
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Installed blender version must be >= 2.81")));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Installed blender version must be >= 2.81")));
|
||||
} else if (lineStr == "NOADDON") {
|
||||
_closePipe();
|
||||
if (blenderAddonPath != _SYS_STR("SKIPINSTALL"))
|
||||
InstallAddon(blenderAddonPath.c_str());
|
||||
++installAttempt;
|
||||
if (installAttempt >= 2)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("unable to install blender addon using '{}'")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to install blender addon using '{}'")),
|
||||
blenderAddonPath.c_str());
|
||||
#ifndef _WIN32
|
||||
waitpid(pid, nullptr, 0);
|
||||
@@ -551,14 +551,14 @@ Connection::Connection(int verbosityLevel) {
|
||||
continue;
|
||||
} else if (lineStr != "READY") {
|
||||
_closePipe();
|
||||
BlenderLog.report(logvisor::Fatal, fmt("read '{}' from blender; expected 'READY'"), lineStr);
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("read '{}' from blender; expected 'READY'"), lineStr);
|
||||
}
|
||||
_writeStr("ACK");
|
||||
|
||||
break;
|
||||
}
|
||||
#else
|
||||
BlenderLog.report(logvisor::Fatal, fmt("BlenderConnection not available on UWP"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("BlenderConnection not available on UWP"));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ bool PyOutStream::StreamBuf::sendLine(std::string_view line) {
|
||||
|
||||
PyOutStream::StreamBuf::int_type PyOutStream::StreamBuf::overflow(int_type ch) {
|
||||
if (!m_parent.m_parent || !m_parent.m_parent->m_lock)
|
||||
BlenderLog.report(logvisor::Fatal, fmt("lock not held for PyOutStream writing"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("lock not held for PyOutStream writing"));
|
||||
if (ch != traits_type::eof() && ch != '\n' && ch != '\0') {
|
||||
m_lineBuf += char_type(ch);
|
||||
return ch;
|
||||
@@ -597,7 +597,7 @@ PyOutStream::StreamBuf::int_type PyOutStream::StreamBuf::overflow(int_type ch) {
|
||||
|
||||
std::streamsize PyOutStream::StreamBuf::xsputn(const char_type* __first, std::streamsize __n) {
|
||||
if (!m_parent.m_parent || !m_parent.m_parent->m_lock)
|
||||
BlenderLog.report(logvisor::Fatal, fmt("lock not held for PyOutStream writing"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("lock not held for PyOutStream writing"));
|
||||
const char_type* __last = __first + __n;
|
||||
const char_type* __s = __first;
|
||||
for (const char_type* __e = __first; __e != __last; ++__e) {
|
||||
@@ -630,10 +630,10 @@ constexpr std::array<std::string_view, 12> BlendTypeStrs{
|
||||
|
||||
bool Connection::createBlend(const ProjectPath& path, BlendType type) {
|
||||
if (m_lock) {
|
||||
BlenderLog.report(logvisor::Fatal, fmt("BlenderConnection::createBlend() musn't be called with stream active"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("BlenderConnection::createBlend() musn't be called with stream active"));
|
||||
return false;
|
||||
}
|
||||
_writeStr(fmt::format(fmt("CREATE \"{}\" {}"), path.getAbsolutePathUTF8(), BlendTypeStrs[int(type)]));
|
||||
_writeStr(fmt::format(FMT_STRING("CREATE \"{}\" {}"), path.getAbsolutePathUTF8(), BlendTypeStrs[int(type)]));
|
||||
if (_isFinished()) {
|
||||
/* Delete immediately in case save doesn't occur */
|
||||
hecl::Unlink(path.getAbsolutePath().data());
|
||||
@@ -646,12 +646,12 @@ bool Connection::createBlend(const ProjectPath& path, BlendType type) {
|
||||
|
||||
bool Connection::openBlend(const ProjectPath& path, bool force) {
|
||||
if (m_lock) {
|
||||
BlenderLog.report(logvisor::Fatal, fmt("BlenderConnection::openBlend() musn't be called with stream active"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("BlenderConnection::openBlend() musn't be called with stream active"));
|
||||
return false;
|
||||
}
|
||||
if (!force && path == m_loadedBlend)
|
||||
return true;
|
||||
_writeStr(fmt::format(fmt("OPEN \"{}\""), path.getAbsolutePathUTF8()));
|
||||
_writeStr(fmt::format(FMT_STRING("OPEN \"{}\""), path.getAbsolutePathUTF8()));
|
||||
if (_isFinished()) {
|
||||
m_loadedBlend = path;
|
||||
_writeStr("GETTYPE");
|
||||
@@ -678,7 +678,7 @@ bool Connection::openBlend(const ProjectPath& path, bool force) {
|
||||
|
||||
bool Connection::saveBlend() {
|
||||
if (m_lock) {
|
||||
BlenderLog.report(logvisor::Fatal, fmt("BlenderConnection::saveBlend() musn't be called with stream active"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("BlenderConnection::saveBlend() musn't be called with stream active"));
|
||||
return false;
|
||||
}
|
||||
_writeStr("SAVE");
|
||||
@@ -688,7 +688,7 @@ bool Connection::saveBlend() {
|
||||
void Connection::deleteBlend() {
|
||||
if (m_loadedBlend) {
|
||||
hecl::Unlink(m_loadedBlend.getAbsolutePath().data());
|
||||
BlenderLog.report(logvisor::Info, fmt(_SYS_STR("Deleted '{}'")), m_loadedBlend.getAbsolutePath());
|
||||
BlenderLog.report(logvisor::Info, FMT_STRING(_SYS_STR("Deleted '{}'")), m_loadedBlend.getAbsolutePath());
|
||||
m_loadedBlend = ProjectPath();
|
||||
}
|
||||
}
|
||||
@@ -710,7 +710,7 @@ void PyOutStream::close() {
|
||||
}
|
||||
|
||||
void PyOutStream::linkBlend(std::string_view target, std::string_view objName, bool link) {
|
||||
format(fmt("if '{}' not in bpy.data.scenes:\n"
|
||||
format(FMT_STRING("if '{}' not in bpy.data.scenes:\n"
|
||||
" with bpy.data.libraries.load('''{}''', link={}, relative=True) as (data_from, data_to):\n"
|
||||
" data_to.scenes = data_from.scenes\n"
|
||||
" obj_scene = None\n"
|
||||
@@ -731,7 +731,7 @@ void PyOutStream::linkBlend(std::string_view target, std::string_view objName, b
|
||||
}
|
||||
|
||||
void PyOutStream::linkArmature(std::string_view target, std::string_view armName) {
|
||||
format(fmt("target_arm_name = '{}'\n"
|
||||
format(FMT_STRING("target_arm_name = '{}'\n"
|
||||
"if target_arm_name not in bpy.data.armatures:\n"
|
||||
" with bpy.data.libraries.load('''{}''', link=True, relative=True) as (data_from, data_to):\n"
|
||||
" if target_arm_name not in data_from.armatures:\n"
|
||||
@@ -745,7 +745,7 @@ void PyOutStream::linkArmature(std::string_view target, std::string_view armName
|
||||
}
|
||||
|
||||
void PyOutStream::linkMesh(std::string_view target, std::string_view meshName) {
|
||||
format(fmt("target_mesh_name = '{}'\n"
|
||||
format(FMT_STRING("target_mesh_name = '{}'\n"
|
||||
"if target_mesh_name not in bpy.data.objects:\n"
|
||||
" with bpy.data.libraries.load('''{}''', link=True, relative=True) as (data_from, data_to):\n"
|
||||
" if target_mesh_name not in data_from.objects:\n"
|
||||
@@ -758,7 +758,7 @@ void PyOutStream::linkMesh(std::string_view target, std::string_view meshName) {
|
||||
|
||||
void PyOutStream::linkBackground(std::string_view target, std::string_view sceneName) {
|
||||
if (sceneName.empty()) {
|
||||
format(fmt("with bpy.data.libraries.load('''{}''', link=True, relative=True) as (data_from, data_to):\n"
|
||||
format(FMT_STRING("with bpy.data.libraries.load('''{}''', link=True, relative=True) as (data_from, data_to):\n"
|
||||
" data_to.scenes = data_from.scenes\n"
|
||||
"obj_scene = None\n"
|
||||
"for scene in data_to.scenes:\n"
|
||||
@@ -770,7 +770,7 @@ void PyOutStream::linkBackground(std::string_view target, std::string_view scene
|
||||
"bpy.context.scene.background_set = obj_scene\n"),
|
||||
target, target);
|
||||
} else {
|
||||
format(fmt("if '{}' not in bpy.data.scenes:\n"
|
||||
format(FMT_STRING("if '{}' not in bpy.data.scenes:\n"
|
||||
" with bpy.data.libraries.load('''{}''', link=True, relative=True) as (data_from, data_to):\n"
|
||||
" data_to.scenes = data_from.scenes\n"
|
||||
" obj_scene = None\n"
|
||||
@@ -789,7 +789,7 @@ void PyOutStream::linkBackground(std::string_view target, std::string_view scene
|
||||
void PyOutStream::AABBToBMesh(const atVec3f& min, const atVec3f& max) {
|
||||
athena::simd_floats minf(min.simd);
|
||||
athena::simd_floats maxf(max.simd);
|
||||
format(fmt("bm = bmesh.new()\n"
|
||||
format(FMT_STRING("bm = bmesh.new()\n"
|
||||
"bm.verts.new(({},{},{}))\n"
|
||||
"bm.verts.new(({},{},{}))\n"
|
||||
"bm.verts.new(({},{},{}))\n"
|
||||
@@ -852,7 +852,7 @@ ANIMOutStream::~ANIMOutStream() {
|
||||
|
||||
void ANIMOutStream::changeCurve(CurveType type, unsigned crvIdx, unsigned keyCount) {
|
||||
if (m_curCount != m_totalCount)
|
||||
BlenderLog.report(logvisor::Fatal, fmt("incomplete ANIMOutStream for change"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("incomplete ANIMOutStream for change"));
|
||||
m_curCount = 0;
|
||||
m_totalCount = keyCount;
|
||||
char tp = char(type);
|
||||
@@ -867,7 +867,7 @@ void ANIMOutStream::changeCurve(CurveType type, unsigned crvIdx, unsigned keyCou
|
||||
|
||||
void ANIMOutStream::write(unsigned frame, float val) {
|
||||
if (!m_inCurve)
|
||||
BlenderLog.report(logvisor::Fatal, fmt("changeCurve not called before write"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("changeCurve not called before write"));
|
||||
if (m_curCount < m_totalCount) {
|
||||
struct {
|
||||
uint32_t frm;
|
||||
@@ -876,7 +876,7 @@ void ANIMOutStream::write(unsigned frame, float val) {
|
||||
m_parent->_writeBuf(reinterpret_cast<const char*>(&key), 8);
|
||||
++m_curCount;
|
||||
} else
|
||||
BlenderLog.report(logvisor::Fatal, fmt("ANIMOutStream keyCount overflow"));
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("ANIMOutStream keyCount overflow"));
|
||||
}
|
||||
|
||||
Mesh::SkinBind::SkinBind(Connection& conn) {
|
||||
@@ -1331,7 +1331,7 @@ std::vector<std::string> DataStream::getLightList() {
|
||||
|
||||
std::pair<atVec3f, atVec3f> DataStream::getMeshAABB() {
|
||||
if (m_parent->m_loadedType != BlendType::Mesh && m_parent->m_loadedType != BlendType::Actor)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not a MESH or ACTOR blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not a MESH or ACTOR blend")),
|
||||
m_parent->m_loadedBlend.getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("MESHAABB");
|
||||
@@ -1349,7 +1349,7 @@ const char* DataStream::MeshOutputModeString(HMDLTopology topology) {
|
||||
|
||||
Mesh DataStream::compileMesh(HMDLTopology topology, int skinSlotCount) {
|
||||
if (m_parent->getBlendType() != BlendType::Mesh)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not a MESH blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not a MESH blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("MESHCOMPILE");
|
||||
@@ -1360,10 +1360,10 @@ Mesh DataStream::compileMesh(HMDLTopology topology, int skinSlotCount) {
|
||||
|
||||
Mesh DataStream::compileMesh(std::string_view name, HMDLTopology topology, int skinSlotCount, bool useLuv) {
|
||||
if (m_parent->getBlendType() != BlendType::Area)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an AREA blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an AREA blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr(fmt::format(fmt("MESHCOMPILENAME {} {}"), name, int(useLuv)));
|
||||
m_parent->_writeStr(fmt::format(FMT_STRING("MESHCOMPILENAME {} {}"), name, int(useLuv)));
|
||||
m_parent->_checkOk("unable to cook mesh"sv);
|
||||
|
||||
return Mesh(*m_parent, topology, skinSlotCount, useLuv);
|
||||
@@ -1371,10 +1371,10 @@ Mesh DataStream::compileMesh(std::string_view name, HMDLTopology topology, int s
|
||||
|
||||
ColMesh DataStream::compileColMesh(std::string_view name) {
|
||||
if (m_parent->getBlendType() != BlendType::Area)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an AREA blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an AREA blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr(fmt::format(fmt("MESHCOMPILENAMECOLLISION {}"), name));
|
||||
m_parent->_writeStr(fmt::format(FMT_STRING("MESHCOMPILENAMECOLLISION {}"), name));
|
||||
m_parent->_checkOk("unable to cook collision mesh"sv);
|
||||
|
||||
return ColMesh(*m_parent);
|
||||
@@ -1382,7 +1382,7 @@ ColMesh DataStream::compileColMesh(std::string_view name) {
|
||||
|
||||
std::vector<ColMesh> DataStream::compileColMeshes() {
|
||||
if (m_parent->getBlendType() != BlendType::ColMesh)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not a CMESH blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not a CMESH blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("MESHCOMPILECOLLISIONALL");
|
||||
@@ -1395,7 +1395,7 @@ std::vector<ColMesh> DataStream::compileColMeshes() {
|
||||
|
||||
std::vector<Light> DataStream::compileLights() {
|
||||
if (m_parent->getBlendType() != BlendType::Area)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an AREA blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an AREA blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("LIGHTCOMPILEALL");
|
||||
@@ -1408,7 +1408,7 @@ std::vector<Light> DataStream::compileLights() {
|
||||
|
||||
PathMesh DataStream::compilePathMesh() {
|
||||
if (m_parent->getBlendType() != BlendType::PathMesh)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not a PATH blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not a PATH blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("MESHCOMPILEPATH");
|
||||
@@ -1419,10 +1419,10 @@ PathMesh DataStream::compilePathMesh() {
|
||||
|
||||
std::vector<uint8_t> DataStream::compileGuiFrame(int version) {
|
||||
if (m_parent->getBlendType() != BlendType::Frame)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not a FRAME blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not a FRAME blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr(fmt::format(fmt("FRAMECOMPILE {}"), version));
|
||||
m_parent->_writeStr(fmt::format(FMT_STRING("FRAMECOMPILE {}"), version));
|
||||
m_parent->_checkOk("unable to compile frame"sv);
|
||||
|
||||
while (true) {
|
||||
@@ -1439,7 +1439,7 @@ std::vector<uint8_t> DataStream::compileGuiFrame(int version) {
|
||||
relative = proj.getProjectRootPath().getProjectRelativeFromAbsolute(absolute.sys_str());
|
||||
hecl::ProjectPath path(proj.getProjectWorkingPath(), relative);
|
||||
|
||||
m_parent->_writeStr(fmt::format(fmt("{:08X}"), path.parsedHash32()));
|
||||
m_parent->_writeStr(fmt::format(FMT_STRING("{:08X}"), path.parsedHash32()));
|
||||
}
|
||||
|
||||
std::vector<uint8_t> ret;
|
||||
@@ -1461,7 +1461,7 @@ std::vector<ProjectPath> DataStream::getTextures() {
|
||||
|
||||
Actor DataStream::compileActor() {
|
||||
if (m_parent->getBlendType() != BlendType::Actor)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an ACTOR blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an ACTOR blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("ACTORCOMPILE");
|
||||
@@ -1472,7 +1472,7 @@ Actor DataStream::compileActor() {
|
||||
|
||||
Actor DataStream::compileActorCharacterOnly() {
|
||||
if (m_parent->getBlendType() != BlendType::Actor)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an ACTOR blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an ACTOR blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("ACTORCOMPILECHARACTERONLY");
|
||||
@@ -1483,7 +1483,7 @@ Actor DataStream::compileActorCharacterOnly() {
|
||||
|
||||
Armature DataStream::compileArmature() {
|
||||
if (m_parent->getBlendType() != BlendType::Armature)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an ARMATURE blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an ARMATURE blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("ARMATURECOMPILE");
|
||||
@@ -1494,10 +1494,10 @@ Armature DataStream::compileArmature() {
|
||||
|
||||
Action DataStream::compileActionChannelsOnly(std::string_view name) {
|
||||
if (m_parent->getBlendType() != BlendType::Actor)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an ACTOR blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an ACTOR blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr(fmt::format(fmt("ACTIONCOMPILECHANNELSONLY {}"), name));
|
||||
m_parent->_writeStr(fmt::format(FMT_STRING("ACTIONCOMPILECHANNELSONLY {}"), name));
|
||||
m_parent->_checkOk("unable to compile action"sv);
|
||||
|
||||
return Action(*m_parent);
|
||||
@@ -1505,7 +1505,7 @@ Action DataStream::compileActionChannelsOnly(std::string_view name) {
|
||||
|
||||
World DataStream::compileWorld() {
|
||||
if (m_parent->getBlendType() != BlendType::World)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an WORLD blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an WORLD blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("WORLDCOMPILE");
|
||||
@@ -1516,7 +1516,7 @@ World DataStream::compileWorld() {
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> DataStream::getSubtypeNames() {
|
||||
if (m_parent->getBlendType() != BlendType::Actor)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an ACTOR blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an ACTOR blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("GETSUBTYPENAMES");
|
||||
@@ -1534,7 +1534,7 @@ std::vector<std::pair<std::string, std::string>> DataStream::getSubtypeNames() {
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> DataStream::getActionNames() {
|
||||
if (m_parent->getBlendType() != BlendType::Actor)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an ACTOR blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an ACTOR blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("GETACTIONNAMES");
|
||||
@@ -1552,10 +1552,10 @@ std::vector<std::pair<std::string, std::string>> DataStream::getActionNames() {
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> DataStream::getSubtypeOverlayNames(std::string_view name) {
|
||||
if (m_parent->getBlendType() != BlendType::Actor)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an ACTOR blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an ACTOR blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr(fmt::format(fmt("GETSUBTYPEOVERLAYNAMES {}"), name));
|
||||
m_parent->_writeStr(fmt::format(FMT_STRING("GETSUBTYPEOVERLAYNAMES {}"), name));
|
||||
m_parent->_checkOk("unable to get subtype overlays of actor"sv);
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> ret;
|
||||
@@ -1570,7 +1570,7 @@ std::vector<std::pair<std::string, std::string>> DataStream::getSubtypeOverlayNa
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> DataStream::getAttachmentNames() {
|
||||
if (m_parent->getBlendType() != BlendType::Actor)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an ACTOR blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an ACTOR blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("GETATTACHMENTNAMES");
|
||||
@@ -1591,10 +1591,10 @@ std::unordered_map<std::string, Matrix3f> DataStream::getBoneMatrices(std::strin
|
||||
return {};
|
||||
|
||||
if (m_parent->getBlendType() != BlendType::Actor)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an ACTOR blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an ACTOR blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr(fmt::format(fmt("GETBONEMATRICES {}"), name));
|
||||
m_parent->_writeStr(fmt::format(FMT_STRING("GETBONEMATRICES {}"), name));
|
||||
m_parent->_checkOk("unable to get matrices of armature"sv);
|
||||
|
||||
std::unordered_map<std::string, Matrix3f> ret;
|
||||
@@ -1626,11 +1626,11 @@ bool DataStream::renderPvs(std::string_view path, const atVec3f& location) {
|
||||
return false;
|
||||
|
||||
if (m_parent->getBlendType() != BlendType::Area)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an AREA blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an AREA blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
athena::simd_floats f(location.simd);
|
||||
m_parent->_writeStr(fmt::format(fmt("RENDERPVS {} {} {} {}"), path, f[0], f[1], f[2]));
|
||||
m_parent->_writeStr(fmt::format(FMT_STRING("RENDERPVS {} {} {} {}"), path, f[0], f[1], f[2]));
|
||||
m_parent->_checkOk("unable to render PVS"sv);
|
||||
|
||||
return true;
|
||||
@@ -1641,10 +1641,10 @@ bool DataStream::renderPvsLight(std::string_view path, std::string_view lightNam
|
||||
return false;
|
||||
|
||||
if (m_parent->getBlendType() != BlendType::Area)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not an AREA blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not an AREA blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr(fmt::format(fmt("RENDERPVSLIGHT {} {}"), path, lightName));
|
||||
m_parent->_writeStr(fmt::format(FMT_STRING("RENDERPVSLIGHT {} {}"), path, lightName));
|
||||
m_parent->_checkOk("unable to render PVS light"sv);
|
||||
|
||||
return true;
|
||||
@@ -1652,7 +1652,7 @@ bool DataStream::renderPvsLight(std::string_view path, std::string_view lightNam
|
||||
|
||||
MapArea DataStream::compileMapArea() {
|
||||
if (m_parent->getBlendType() != BlendType::MapArea)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not a MAPAREA blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not a MAPAREA blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("MAPAREACOMPILE");
|
||||
@@ -1663,7 +1663,7 @@ MapArea DataStream::compileMapArea() {
|
||||
|
||||
MapUniverse DataStream::compileMapUniverse() {
|
||||
if (m_parent->getBlendType() != BlendType::MapUniverse)
|
||||
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("{} is not a MAPUNIVERSE blend")),
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{} is not a MAPUNIVERSE blend")),
|
||||
m_parent->getBlendPath().getAbsolutePath());
|
||||
|
||||
m_parent->_writeStr("MAPUNIVERSECOMPILE");
|
||||
@@ -1711,7 +1711,7 @@ void Token::shutdown() {
|
||||
m_conn->quitBlender();
|
||||
m_conn.reset();
|
||||
if (hecl::VerbosityLevel >= 1)
|
||||
BlenderLog.report(logvisor::Info, fmt("Blender Shutdown Successful"));
|
||||
BlenderLog.report(logvisor::Info, FMT_STRING("Blender Shutdown Successful"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ MeshOptimizer::Vertex::Vertex(Connection& conn) {
|
||||
uint32_t skin_count;
|
||||
conn._readValue(skin_count);
|
||||
if (skin_count > MaxSkinEntries)
|
||||
Log.report(logvisor::Fatal, fmt("Skin entry overflow {}/{}"), skin_count, MaxSkinEntries);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("Skin entry overflow {}/{}"), skin_count, MaxSkinEntries);
|
||||
for (uint32_t i = 0; i < skin_count; ++i)
|
||||
skin_ents[i] = Mesh::SkinBind(conn);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ MeshOptimizer::Edge::Edge(Connection& conn) {
|
||||
uint32_t face_count;
|
||||
conn._readValue(face_count);
|
||||
if (face_count > MaxLinkFaces)
|
||||
Log.report(logvisor::Fatal, fmt("Face overflow {}/{}"), face_count, MaxLinkFaces);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("Face overflow {}/{}"), face_count, MaxLinkFaces);
|
||||
for (uint32_t i = 0; i < face_count; ++i)
|
||||
conn._readValue(link_faces[i]);
|
||||
conn._readValue(is_contiguous);
|
||||
@@ -384,10 +384,10 @@ MeshOptimizer::MeshOptimizer(Connection& conn, const std::vector<Material>& mate
|
||||
: materials(materials), use_luvs(use_luvs) {
|
||||
conn._readValue(color_count);
|
||||
if (color_count > MaxColorLayers)
|
||||
Log.report(logvisor::Fatal, fmt("Color layer overflow {}/{}"), color_count, MaxColorLayers);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("Color layer overflow {}/{}"), color_count, MaxColorLayers);
|
||||
conn._readValue(uv_count);
|
||||
if (uv_count > MaxUVLayers)
|
||||
Log.report(logvisor::Fatal, fmt("UV layer overflow {}/{}"), uv_count, MaxUVLayers);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("UV layer overflow {}/{}"), uv_count, MaxUVLayers);
|
||||
|
||||
/* Simultaneously load topology objects and build unique mapping indices */
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ bool CVar::fromVec2f(const atVec2f& val) {
|
||||
return false;
|
||||
|
||||
athena::simd_floats f(val.simd);
|
||||
m_value.assign(fmt::format(fmt("{} {}"), f[0], f[1]));
|
||||
m_value.assign(fmt::format(FMT_STRING("{} {}"), f[0], f[1]));
|
||||
m_flags |= EFlags::Modified;
|
||||
return true;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ bool CVar::fromVec2d(const atVec2d& val) {
|
||||
return false;
|
||||
|
||||
athena::simd_doubles f(val.simd);
|
||||
m_value.assign(fmt::format(fmt("{} {}"), f[0], f[1]));
|
||||
m_value.assign(fmt::format(FMT_STRING("{} {}"), f[0], f[1]));
|
||||
m_flags |= EFlags::Modified;
|
||||
return true;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ bool CVar::fromVec3f(const atVec3f& val) {
|
||||
return false;
|
||||
|
||||
athena::simd_floats f(val.simd);
|
||||
m_value.assign(fmt::format(fmt("{} {} {}"), f[0], f[1], f[2]));
|
||||
m_value.assign(fmt::format(FMT_STRING("{} {} {}"), f[0], f[1], f[2]));
|
||||
m_flags |= EFlags::Modified;
|
||||
return true;
|
||||
}
|
||||
@@ -309,7 +309,7 @@ bool CVar::fromVec3d(const atVec3d& val) {
|
||||
return false;
|
||||
|
||||
athena::simd_doubles f(val.simd);
|
||||
m_value.assign(fmt::format(fmt("{} {} {}"), f[0], f[1], f[2]));
|
||||
m_value.assign(fmt::format(FMT_STRING("{} {} {}"), f[0], f[1], f[2]));
|
||||
m_flags |= EFlags::Modified;
|
||||
return true;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ bool CVar::fromVec4f(const atVec4f& val) {
|
||||
return false;
|
||||
|
||||
athena::simd_floats f(val.simd);
|
||||
m_value.assign(fmt::format(fmt("{} {} {} {}"), f[0], f[1], f[2], f[3]));
|
||||
m_value.assign(fmt::format(FMT_STRING("{} {} {} {}"), f[0], f[1], f[2], f[3]));
|
||||
m_flags |= EFlags::Modified;
|
||||
return true;
|
||||
}
|
||||
@@ -329,7 +329,7 @@ bool CVar::fromVec4d(const atVec4d& val) {
|
||||
return false;
|
||||
|
||||
athena::simd_doubles f(val.simd);
|
||||
m_value.assign(fmt::format(fmt("{} {} {} {}"), f[0], f[1], f[2], f[3]));
|
||||
m_value.assign(fmt::format(FMT_STRING("{} {} {} {}"), f[0], f[1], f[2], f[3]));
|
||||
m_flags |= EFlags::Modified;
|
||||
return true;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ bool CVar::fromReal(double val) {
|
||||
if (!safeToModify(EType::Real))
|
||||
return false;
|
||||
|
||||
m_value.assign(fmt::format(fmt("{}"), val));
|
||||
m_value.assign(fmt::format(FMT_STRING("{}"), val));
|
||||
setModified();
|
||||
return true;
|
||||
}
|
||||
@@ -369,7 +369,7 @@ bool CVar::fromInteger(int32_t val) {
|
||||
return false;
|
||||
|
||||
// Properly format based on signedness
|
||||
m_value = fmt::format(fmt("{}"), (m_type == EType::Signed ? val : static_cast<uint32_t>(val)));
|
||||
m_value = fmt::format(FMT_STRING("{}"), (m_type == EType::Signed ? val : static_cast<uint32_t>(val)));
|
||||
setModified();
|
||||
return true;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ bool CVar::fromInteger(uint32_t val) {
|
||||
return false;
|
||||
|
||||
// Properly format based on signedness
|
||||
m_value = fmt::format(fmt("{}"), (m_type == EType::Unsigned ? val : static_cast<int32_t>(val)));
|
||||
m_value = fmt::format(FMT_STRING("{}"), (m_type == EType::Unsigned ? val : static_cast<int32_t>(val)));
|
||||
setModified();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -205,13 +205,13 @@ CVarManager* CVarManager::instance() { return m_instance; }
|
||||
void CVarManager::list(Console* con, const std::vector<std::string>& /*args*/) {
|
||||
for (const auto& cvar : m_cvars) {
|
||||
if (!cvar.second->isHidden())
|
||||
con->report(Console::Level::Info, fmt("{}: {}"), cvar.second->name(), cvar.second->help());
|
||||
con->report(Console::Level::Info, FMT_STRING("{}: {}"), cvar.second->name(), cvar.second->help());
|
||||
}
|
||||
}
|
||||
|
||||
void CVarManager::setCVar(Console* con, const std::vector<std::string>& args) {
|
||||
if (args.size() < 2) {
|
||||
con->report(Console::Level::Info, fmt("Usage setCvar <cvar> <value>"));
|
||||
con->report(Console::Level::Info, FMT_STRING("Usage setCvar <cvar> <value>"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ void CVarManager::setCVar(Console* con, const std::vector<std::string>& args) {
|
||||
athena::utility::tolower(cvName);
|
||||
const auto iter = m_cvars.find(cvName);
|
||||
if (iter == m_cvars.end()) {
|
||||
con->report(Console::Level::Error, fmt("CVar '{}' does not exist"), args[0]);
|
||||
con->report(Console::Level::Error, FMT_STRING("CVar '{}' does not exist"), args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -235,14 +235,14 @@ void CVarManager::setCVar(Console* con, const std::vector<std::string>& args) {
|
||||
return;
|
||||
|
||||
if (!cv->fromLiteralToType(value))
|
||||
con->report(Console::Level::Warning, fmt("Unable to set cvar '{}' to value '{}'"), cv->name(), value);
|
||||
con->report(Console::Level::Warning, FMT_STRING("Unable to set cvar '{}' to value '{}'"), cv->name(), value);
|
||||
else
|
||||
con->report(Console::Level::Info, fmt("Set '{}' from '{}' to '{}'"), cv->name(), oldVal, value);
|
||||
con->report(Console::Level::Info, FMT_STRING("Set '{}' from '{}' to '{}'"), cv->name(), oldVal, value);
|
||||
}
|
||||
|
||||
void CVarManager::getCVar(Console* con, const std::vector<std::string>& args) {
|
||||
if (args.empty()) {
|
||||
con->report(Console::Level::Info, fmt("Usage getCVar <cvar>"));
|
||||
con->report(Console::Level::Info, FMT_STRING("Usage getCVar <cvar>"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -250,12 +250,12 @@ void CVarManager::getCVar(Console* con, const std::vector<std::string>& args) {
|
||||
athena::utility::tolower(cvName);
|
||||
const auto iter = m_cvars.find(cvName);
|
||||
if (iter == m_cvars.end()) {
|
||||
con->report(Console::Level::Error, fmt("CVar '{}' does not exist"), args[0]);
|
||||
con->report(Console::Level::Error, FMT_STRING("CVar '{}' does not exist"), args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& cv = iter->second;
|
||||
con->report(Console::Level::Info, fmt("'{}' = '{}'"), cv->name(), cv->value());
|
||||
con->report(Console::Level::Info, FMT_STRING("'{}' = '{}'"), cv->name(), cv->value());
|
||||
}
|
||||
|
||||
void CVarManager::setDeveloperMode(bool v, bool setDeserialized) {
|
||||
|
||||
@@ -64,7 +64,7 @@ static int GetCPUCount() {
|
||||
void ClientProcess::BufferTransaction::run(blender::Token& btok) {
|
||||
athena::io::FileReader r(m_path.getAbsolutePath(), 32 * 1024, false);
|
||||
if (r.hasError()) {
|
||||
CP_Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to background-buffer '{}'")), m_path.getAbsolutePath());
|
||||
CP_Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to background-buffer '{}'")), m_path.getAbsolutePath());
|
||||
return;
|
||||
}
|
||||
if (m_offset)
|
||||
@@ -94,7 +94,7 @@ ClientProcess::Worker::Worker(ClientProcess& proc, int idx) : m_proc(proc), m_id
|
||||
void ClientProcess::Worker::proc() {
|
||||
ClientProcess::ThreadWorker.reset(this);
|
||||
|
||||
std::string thrName = fmt::format(fmt("HECL Worker {}"), m_idx);
|
||||
std::string thrName = fmt::format(FMT_STRING("HECL Worker {}"), m_idx);
|
||||
logvisor::RegisterThreadName(thrName.c_str());
|
||||
|
||||
std::unique_lock lk{m_proc.m_mutex};
|
||||
@@ -180,24 +180,24 @@ bool ClientProcess::syncCook(const hecl::ProjectPath& path, Database::IDataSpec*
|
||||
if (m_progPrinter) {
|
||||
hecl::SystemString str;
|
||||
if (path.getAuxInfo().empty())
|
||||
str = fmt::format(fmt(_SYS_STR("Cooking {}")), path.getRelativePath());
|
||||
str = fmt::format(FMT_STRING(_SYS_STR("Cooking {}")), path.getRelativePath());
|
||||
else
|
||||
str = fmt::format(fmt(_SYS_STR("Cooking {}|{}")), path.getRelativePath(), path.getAuxInfo());
|
||||
str = fmt::format(FMT_STRING(_SYS_STR("Cooking {}|{}")), path.getRelativePath(), path.getAuxInfo());
|
||||
m_progPrinter->print(str.c_str(), nullptr, -1.f, hecl::ClientProcess::GetThreadWorkerIdx());
|
||||
m_progPrinter->flush();
|
||||
} else {
|
||||
if (path.getAuxInfo().empty())
|
||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("Cooking {}")), path.getRelativePath());
|
||||
LogModule.report(logvisor::Info, FMT_STRING(_SYS_STR("Cooking {}")), path.getRelativePath());
|
||||
else
|
||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("Cooking {}|{}")), path.getRelativePath(), path.getAuxInfo());
|
||||
LogModule.report(logvisor::Info, FMT_STRING(_SYS_STR("Cooking {}|{}")), path.getRelativePath(), path.getAuxInfo());
|
||||
}
|
||||
spec->doCook(path, cooked, false, btok, [](const SystemChar*) {});
|
||||
if (m_progPrinter) {
|
||||
hecl::SystemString str;
|
||||
if (path.getAuxInfo().empty())
|
||||
str = fmt::format(fmt(_SYS_STR("Cooked {}")), path.getRelativePath());
|
||||
str = fmt::format(FMT_STRING(_SYS_STR("Cooked {}")), path.getRelativePath());
|
||||
else
|
||||
str = fmt::format(fmt(_SYS_STR("Cooked {}|{}")), path.getRelativePath(), path.getAuxInfo());
|
||||
str = fmt::format(FMT_STRING(_SYS_STR("Cooked {}|{}")), path.getRelativePath(), path.getAuxInfo());
|
||||
m_progPrinter->print(str.c_str(), nullptr, -1.f, hecl::ClientProcess::GetThreadWorkerIdx());
|
||||
m_progPrinter->flush();
|
||||
}
|
||||
|
||||
@@ -54,15 +54,15 @@ struct ShaderCompiler<PlatformType::Vulkan> {
|
||||
const char* strings[] = {"#version 330\n", BOO_GLSL_BINDING_HEAD, text.data()};
|
||||
shader.setStrings(strings, 3);
|
||||
if (!shader.parse(&glslang::DefaultTBuiltInResource, 110, false, messages)) {
|
||||
fmt::print(fmt("{}\n"), text);
|
||||
Log.report(logvisor::Fatal, fmt("unable to compile shader\n{}"), shader.getInfoLog());
|
||||
fmt::print(FMT_STRING("{}\n"), text);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to compile shader\n{}"), shader.getInfoLog());
|
||||
return {};
|
||||
}
|
||||
|
||||
glslang::TProgram prog;
|
||||
prog.addShader(&shader);
|
||||
if (!prog.link(messages)) {
|
||||
Log.report(logvisor::Fatal, fmt("unable to link shader program\n{}"), prog.getInfoLog());
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to link shader program\n{}"), prog.getInfoLog());
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ struct ShaderCompiler<PlatformType::D3D11> {
|
||||
ComPtr<ID3DBlob> blobOut;
|
||||
if (FAILED(D3DCompilePROC(text.data(), text.size(), "Boo HLSL Source", nullptr, nullptr, "main",
|
||||
D3DShaderTypes[int(S::Enum)], BOO_D3DCOMPILE_FLAG, 0, &blobOut, &errBlob))) {
|
||||
fmt::print(fmt("{}\n"), text);
|
||||
Log.report(logvisor::Fatal, fmt("error compiling shader: {}"), (char*)errBlob->GetBufferPointer());
|
||||
fmt::print(FMT_STRING("{}\n"), text);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("error compiling shader: {}"), (char*)errBlob->GetBufferPointer());
|
||||
return {};
|
||||
}
|
||||
std::pair<StageBinaryData, size_t> ret(MakeStageBinaryData(blobOut->GetBufferSize()), blobOut->GetBufferSize());
|
||||
@@ -152,7 +152,7 @@ struct ShaderCompiler<PlatformType::Metal> {
|
||||
|
||||
pid_t pid = getpid();
|
||||
const char* tmpdir = getenv("TMPDIR");
|
||||
std::string libFile = fmt::format(fmt("{}boo_metal_shader{}.metallib"), tmpdir, pid);
|
||||
std::string libFile = fmt::format(FMT_STRING("{}boo_metal_shader{}.metallib"), tmpdir, pid);
|
||||
|
||||
/* Pipe source write to compiler */
|
||||
pid_t compilerPid = fork();
|
||||
@@ -171,7 +171,7 @@ struct ShaderCompiler<PlatformType::Metal> {
|
||||
"-gline-tables-only", "-MO",
|
||||
#endif
|
||||
"-", nullptr);
|
||||
fmt::print(stderr, fmt("execlp fail {}\n"), strerror(errno));
|
||||
fmt::print(stderr, FMT_STRING("execlp fail {}\n"), strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
close(compilerIn[0]);
|
||||
@@ -187,7 +187,7 @@ struct ShaderCompiler<PlatformType::Metal> {
|
||||
|
||||
/* metallib doesn't like outputting to a pipe, so temp file will have to do */
|
||||
execlp("xcrun", "xcrun", "-sdk", "macosx", "metallib", "-", "-o", libFile.c_str(), nullptr);
|
||||
fmt::print(stderr, fmt("execlp fail {}\n"), strerror(errno));
|
||||
fmt::print(stderr, FMT_STRING("execlp fail {}\n"), strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
close(compilerOut[0]);
|
||||
@@ -198,7 +198,7 @@ struct ShaderCompiler<PlatformType::Metal> {
|
||||
while (inRem) {
|
||||
ssize_t writeRes = write(compilerIn[1], inPtr, inRem);
|
||||
if (writeRes < 0) {
|
||||
fmt::print(stderr, fmt("write fail {}\n"), strerror(errno));
|
||||
fmt::print(stderr, FMT_STRING("write fail {}\n"), strerror(errno));
|
||||
break;
|
||||
}
|
||||
inPtr += writeRes;
|
||||
@@ -211,24 +211,24 @@ struct ShaderCompiler<PlatformType::Metal> {
|
||||
while (waitpid(compilerPid, &compilerStat, 0) < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
Log.report(logvisor::Fatal, fmt("waitpid fail {}"), strerror(errno));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("waitpid fail {}"), strerror(errno));
|
||||
return {};
|
||||
}
|
||||
|
||||
if (WEXITSTATUS(compilerStat)) {
|
||||
Log.report(logvisor::Fatal, fmt("compile fail"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("compile fail"));
|
||||
return {};
|
||||
}
|
||||
|
||||
while (waitpid(linkerPid, &linkerStat, 0) < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
Log.report(logvisor::Fatal, fmt("waitpid fail {}"), strerror(errno));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("waitpid fail {}"), strerror(errno));
|
||||
return {};
|
||||
}
|
||||
|
||||
if (WEXITSTATUS(linkerStat)) {
|
||||
Log.report(logvisor::Fatal, fmt("link fail"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("link fail"));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ void Console::executeString(const std::string& str) {
|
||||
|
||||
if (isInLiteral) {
|
||||
if ((curLiteral.back() != '\'' && curLiteral.back() != '"') || depth > 1) {
|
||||
report(Level::Warning, fmt("Unterminated string literal"));
|
||||
report(Level::Warning, FMT_STRING("Unterminated string literal"));
|
||||
return;
|
||||
}
|
||||
args.push_back(std::move(curLiteral));
|
||||
@@ -123,12 +123,12 @@ void Console::executeString(const std::string& str) {
|
||||
if (const auto iter = m_commands.find(lowComName); iter != m_commands.end()) {
|
||||
const SConsoleCommand& cmd = iter->second;
|
||||
if (bool(cmd.m_flags & SConsoleCommand::ECommandFlags::Developer) && !com_developer->toBoolean()) {
|
||||
report(Level::Error, fmt("This command can only be executed in developer mode"), commandName);
|
||||
report(Level::Error, FMT_STRING("This command can only be executed in developer mode"), commandName);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bool(cmd.m_flags & SConsoleCommand::ECommandFlags::Cheat) && !com_enableCheats->toBoolean()) {
|
||||
report(Level::Error, fmt("This command can only be executed with cheats enabled"), commandName);
|
||||
report(Level::Error, FMT_STRING("This command can only be executed with cheats enabled"), commandName);
|
||||
return;
|
||||
}
|
||||
cmd.m_func(this, args);
|
||||
@@ -139,32 +139,32 @@ void Console::executeString(const std::string& str) {
|
||||
else
|
||||
m_cvarMgr->getCVar(this, args);
|
||||
} else {
|
||||
report(Level::Error, fmt("'{}' is not a valid command or variable!"), commandName);
|
||||
report(Level::Error, FMT_STRING("'{}' is not a valid command or variable!"), commandName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Console::help(Console* /*con*/, const std::vector<std::string>& args) {
|
||||
if (args.empty()) {
|
||||
report(Level::Info, fmt("Expected usage: help <command>"));
|
||||
report(Level::Info, FMT_STRING("Expected usage: help <command>"));
|
||||
return;
|
||||
}
|
||||
std::string cmd = args.front();
|
||||
athena::utility::tolower(cmd);
|
||||
auto it = m_commands.find(cmd);
|
||||
if (it == m_commands.end()) {
|
||||
report(Level::Error, fmt("No such command '{}'"), args.front());
|
||||
report(Level::Error, FMT_STRING("No such command '{}'"), args.front());
|
||||
return;
|
||||
}
|
||||
|
||||
report(Level::Info, fmt("{}: {}"), it->second.m_displayName, it->second.m_helpString);
|
||||
report(Level::Info, FMT_STRING("{}: {}"), it->second.m_displayName, it->second.m_helpString);
|
||||
if (!it->second.m_usage.empty())
|
||||
report(Level::Info, fmt("Usage: {} {}"), it->second.m_displayName, it->second.m_usage);
|
||||
report(Level::Info, FMT_STRING("Usage: {} {}"), it->second.m_displayName, it->second.m_usage);
|
||||
}
|
||||
|
||||
void Console::listCommands(Console* /*con*/, const std::vector<std::string>& /*args*/) {
|
||||
for (const auto& comPair : m_commands)
|
||||
report(Level::Info, fmt("'{}': {}"), comPair.second.m_displayName, comPair.second.m_helpString);
|
||||
report(Level::Info, FMT_STRING("'{}': {}"), comPair.second.m_displayName, comPair.second.m_helpString);
|
||||
}
|
||||
|
||||
bool Console::commandExists(std::string_view cmd) const {
|
||||
@@ -180,7 +180,7 @@ void Console::vreport(Level level, fmt::string_view fmt, fmt::format_args args)
|
||||
for (std::string& line : lines) {
|
||||
m_log.emplace_back(std::move(line), level);
|
||||
}
|
||||
fmt::print(fmt("{}\n"), tmp);
|
||||
fmt::print(FMT_STRING("{}\n"), tmp);
|
||||
}
|
||||
|
||||
void Console::init(boo::IWindow* window) {
|
||||
@@ -197,7 +197,7 @@ void Console::proc() {
|
||||
}
|
||||
|
||||
if (m_state == State::Opened) {
|
||||
fmt::print(fmt("\r{} "), m_commandString);
|
||||
fmt::print(FMT_STRING("\r{} "), m_commandString);
|
||||
fflush(stdout);
|
||||
} else if (m_state == State::Opening)
|
||||
m_state = State::Opened;
|
||||
@@ -301,7 +301,7 @@ void Console::handleSpecialKeyDown(boo::ESpecialKey sp, boo::EModifierKey mod, b
|
||||
break;
|
||||
}
|
||||
case boo::ESpecialKey::Enter: {
|
||||
fmt::print(fmt("\n"));
|
||||
fmt::print(FMT_STRING("\n"));
|
||||
executeString(m_commandString);
|
||||
m_cursorPosition = -1;
|
||||
m_commandHistory.insert(m_commandHistory.begin(), m_commandString);
|
||||
@@ -388,7 +388,7 @@ void Console::LogVisorAdapter::report(const char* modName, logvisor::Level sever
|
||||
auto tmp = fmt::internal::vformat(format, args);
|
||||
std::vector<std::string> lines = athena::utility::split(tmp, '\n');
|
||||
for (const std::string& line : lines) {
|
||||
auto v = fmt::format(fmt("[{}] {}"), modName, line);
|
||||
auto v = fmt::format(FMT_STRING("[{}] {}"), modName, line);
|
||||
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
|
||||
}
|
||||
}
|
||||
@@ -398,7 +398,7 @@ void Console::LogVisorAdapter::report(const char* modName, logvisor::Level sever
|
||||
auto tmp = fmt::internal::vformat(format, args);
|
||||
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
|
||||
for (const std::string& line : lines) {
|
||||
auto v = fmt::format(fmt("[{}] {}"), modName, line);
|
||||
auto v = fmt::format(FMT_STRING("[{}] {}"), modName, line);
|
||||
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
|
||||
}
|
||||
}
|
||||
@@ -406,7 +406,7 @@ void Console::LogVisorAdapter::report(const char* modName, logvisor::Level sever
|
||||
void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level severity, const char* file,
|
||||
unsigned linenum, fmt::string_view format, fmt::format_args args) {
|
||||
auto tmp = fmt::internal::vformat(format, args);
|
||||
auto v = fmt::format(fmt("[{}] {} {}:{}"), modName, tmp, file, linenum);
|
||||
auto v = fmt::format(FMT_STRING("[{}] {} {}:{}"), modName, tmp, file, linenum);
|
||||
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level
|
||||
auto tmp = fmt::internal::vformat(format, args);
|
||||
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
|
||||
for (const std::string& line : lines) {
|
||||
auto v = fmt::format(fmt("[{}] {} {}:{}"), modName, line, file, linenum);
|
||||
auto v = fmt::format(FMT_STRING("[{}] {} {}:{}"), modName, line, file, linenum);
|
||||
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
|
||||
}
|
||||
}
|
||||
@@ -424,16 +424,16 @@ void Console::dumpLog() {
|
||||
for (const auto& l : m_log) {
|
||||
switch (l.second) {
|
||||
case Level::Info:
|
||||
fmt::print(fmt("{}\n"), l.first);
|
||||
fmt::print(FMT_STRING("{}\n"), l.first);
|
||||
break;
|
||||
case Level::Warning:
|
||||
fmt::print(fmt("[Warning] {}\n"), l.first);
|
||||
fmt::print(FMT_STRING("[Warning] {}\n"), l.first);
|
||||
break;
|
||||
case Level::Error:
|
||||
fmt::print(fmt("[ Error ] {}\n"), l.first);
|
||||
fmt::print(FMT_STRING("[ Error ] {}\n"), l.first);
|
||||
break;
|
||||
case Level::Fatal:
|
||||
fmt::print(fmt("[ Fatal ] {}\n"), l.first);
|
||||
fmt::print(FMT_STRING("[ Fatal ] {}\n"), l.first);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ std::string HumanizeNumber(int64_t quotient, size_t len, const char* suffix, int
|
||||
if (suffix == nullptr)
|
||||
suffix = "";
|
||||
if ((flags & HNFlags::Divisor1000) != HNFlags::None && (flags & HNFlags::IECPrefixes) != HNFlags::None)
|
||||
Log.report(logvisor::Fatal, fmt("invalid flags combo"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("invalid flags combo"));
|
||||
|
||||
/* setup parameters */
|
||||
remainder = 0;
|
||||
@@ -109,7 +109,7 @@ std::string HumanizeNumber(int64_t quotient, size_t len, const char* suffix, int
|
||||
|
||||
/* Check if enough room for `x y' + suffix */
|
||||
if (len < baselen)
|
||||
Log.report(logvisor::Fatal, fmt("buffer size {} insufficient for minimum size {}"), len, baselen);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("buffer size {} insufficient for minimum size {}"), len, baselen);
|
||||
len += 1;
|
||||
|
||||
if ((scale & int(HNScale::AutoScale)) != 0) {
|
||||
@@ -142,9 +142,9 @@ std::string HumanizeNumber(int64_t quotient, size_t len, const char* suffix, int
|
||||
(flags & HNFlags::Decimal) != HNFlags::None) {
|
||||
s1 = (int)quotient + ((remainder * 10 + divisor / 2) / divisor / 10);
|
||||
s2 = ((remainder * 10 + divisor / 2) / divisor) % 10;
|
||||
return fmt::format(fmt("{}{}{}{}{}{}"), sign * s1, localeconv()->decimal_point, s2, sep, SCALE2PREFIX(i), suffix);
|
||||
return fmt::format(FMT_STRING("{}{}{}{}{}{}"), sign * s1, localeconv()->decimal_point, s2, sep, SCALE2PREFIX(i), suffix);
|
||||
} else
|
||||
return fmt::format(fmt("{}{}{}{}"), sign * (quotient + (remainder + divisor / 2) / divisor), sep,
|
||||
return fmt::format(FMT_STRING("{}{}{}{}"), sign * (quotient + (remainder + divisor / 2) / divisor), sep,
|
||||
SCALE2PREFIX(i), suffix);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,20 +38,20 @@ void MultiProgressPrinter::ThreadStat::print(const TermInfo& tinfo) const {
|
||||
|
||||
if (submessageLen) {
|
||||
if (messageLen > half - submessageLen - 1)
|
||||
fmt::print(fmt(_SYS_STR(" {:.{}}... {} ")), m_message, half - submessageLen - 4, m_submessage);
|
||||
fmt::print(FMT_STRING(_SYS_STR(" {:.{}}... {} ")), m_message, half - submessageLen - 4, m_submessage);
|
||||
else {
|
||||
fmt::print(fmt(_SYS_STR(" {}")), m_message);
|
||||
fmt::print(FMT_STRING(_SYS_STR(" {}")), m_message);
|
||||
for (int i = half - messageLen - submessageLen - 1; i >= 0; --i)
|
||||
fmt::print(fmt(_SYS_STR(" ")));
|
||||
fmt::print(fmt(_SYS_STR("{} ")), m_submessage);
|
||||
fmt::print(FMT_STRING(_SYS_STR(" ")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("{} ")), m_submessage);
|
||||
}
|
||||
} else {
|
||||
if (messageLen > half)
|
||||
fmt::print(fmt(_SYS_STR(" {:.{}}... ")), m_message, half - 3);
|
||||
fmt::print(FMT_STRING(_SYS_STR(" {:.{}}... ")), m_message, half - 3);
|
||||
else {
|
||||
fmt::print(fmt(_SYS_STR(" {}")), m_message);
|
||||
fmt::print(FMT_STRING(_SYS_STR(" {}")), m_message);
|
||||
for (int i = half - messageLen; i >= 0; --i)
|
||||
fmt::print(fmt(_SYS_STR(" ")));
|
||||
fmt::print(FMT_STRING(_SYS_STR(" ")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,22 +62,22 @@ void MultiProgressPrinter::ThreadStat::print(const TermInfo& tinfo) const {
|
||||
int rem = nblocks - filled;
|
||||
|
||||
if (tinfo.xtermColor) {
|
||||
fmt::print(fmt(_SYS_STR("" BOLD "{:3d}% [")), iFactor);
|
||||
fmt::print(FMT_STRING(_SYS_STR("" BOLD "{:3d}% [")), iFactor);
|
||||
for (int b = 0; b < filled; ++b)
|
||||
fmt::print(fmt(_SYS_STR("#")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("#")));
|
||||
for (int b = 0; b < rem; ++b)
|
||||
fmt::print(fmt(_SYS_STR("-")));
|
||||
fmt::print(fmt(_SYS_STR("]" NORMAL "")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("]" NORMAL "")));
|
||||
} else {
|
||||
#if _WIN32
|
||||
SetConsoleTextAttribute(tinfo.console, FOREGROUND_INTENSITY | FOREGROUND_WHITE);
|
||||
#endif
|
||||
fmt::print(fmt(_SYS_STR("{:3d}% [")), iFactor);
|
||||
fmt::print(FMT_STRING(_SYS_STR("{:3d}% [")), iFactor);
|
||||
for (int b = 0; b < filled; ++b)
|
||||
fmt::print(fmt(_SYS_STR("#")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("#")));
|
||||
for (int b = 0; b < rem; ++b)
|
||||
fmt::print(fmt(_SYS_STR("-")));
|
||||
fmt::print(fmt(_SYS_STR("]")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("]")));
|
||||
#if _WIN32
|
||||
SetConsoleTextAttribute(tinfo.console, FOREGROUND_WHITE);
|
||||
#endif
|
||||
@@ -100,24 +100,24 @@ void MultiProgressPrinter::DrawIndeterminateBar() {
|
||||
int rem = blocks - pre - 1;
|
||||
|
||||
if (m_termInfo.xtermColor) {
|
||||
fmt::print(fmt(_SYS_STR("" BOLD " [")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("" BOLD " [")));
|
||||
for (int b = 0; b < pre; ++b)
|
||||
fmt::print(fmt(_SYS_STR("-")));
|
||||
fmt::print(fmt(_SYS_STR("#")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("#")));
|
||||
for (int b = 0; b < rem; ++b)
|
||||
fmt::print(fmt(_SYS_STR("-")));
|
||||
fmt::print(fmt(_SYS_STR("]" NORMAL "")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("]" NORMAL "")));
|
||||
} else {
|
||||
#if _WIN32
|
||||
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_INTENSITY | FOREGROUND_WHITE);
|
||||
#endif
|
||||
fmt::print(fmt(_SYS_STR(" [")));
|
||||
fmt::print(FMT_STRING(_SYS_STR(" [")));
|
||||
for (int b = 0; b < pre; ++b)
|
||||
fmt::print(fmt(_SYS_STR("-")));
|
||||
fmt::print(fmt(_SYS_STR("#")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("#")));
|
||||
for (int b = 0; b < rem; ++b)
|
||||
fmt::print(fmt(_SYS_STR("-")));
|
||||
fmt::print(fmt(_SYS_STR("]")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("]")));
|
||||
#if _WIN32
|
||||
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_WHITE);
|
||||
#endif
|
||||
@@ -127,7 +127,7 @@ void MultiProgressPrinter::DrawIndeterminateBar() {
|
||||
void MultiProgressPrinter::MoveCursorUp(int n) {
|
||||
if (n) {
|
||||
if (m_termInfo.xtermColor) {
|
||||
fmt::print(fmt(_SYS_STR("" PREV_LINE "")), n);
|
||||
fmt::print(FMT_STRING(_SYS_STR("" PREV_LINE "")), n);
|
||||
}
|
||||
#if _WIN32
|
||||
else {
|
||||
@@ -139,7 +139,7 @@ void MultiProgressPrinter::MoveCursorUp(int n) {
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
fmt::print(fmt(_SYS_STR("\r")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("\r")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ void MultiProgressPrinter::DoPrint() {
|
||||
SetConsoleCursorInfo(m_termInfo.console, &cursorInfo);
|
||||
#endif
|
||||
if (m_termInfo.xtermColor)
|
||||
fmt::print(fmt(_SYS_STR("" HIDE_CURSOR "")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("" HIDE_CURSOR "")));
|
||||
|
||||
if (m_dirty) {
|
||||
m_termInfo.width = (hecl::GuiMode ? 120 : std::max(80, hecl::ConsoleWidth(&m_termInfo.truncate)));
|
||||
@@ -168,7 +168,7 @@ void MultiProgressPrinter::DoPrint() {
|
||||
for (const ThreadStat& stat : m_threadStats) {
|
||||
if (stat.m_active) {
|
||||
stat.print(m_termInfo);
|
||||
fmt::print(fmt(_SYS_STR("\n")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||
++m_curThreadLines;
|
||||
}
|
||||
}
|
||||
@@ -179,7 +179,7 @@ void MultiProgressPrinter::DoPrint() {
|
||||
#endif
|
||||
) {
|
||||
DrawIndeterminateBar();
|
||||
fmt::print(fmt(_SYS_STR("\n")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||
++m_curProgLines;
|
||||
} else if (m_mainFactor >= 0.f) {
|
||||
float factor = std::max(0.0f, std::min(1.0f, m_mainFactor));
|
||||
@@ -191,34 +191,34 @@ void MultiProgressPrinter::DoPrint() {
|
||||
int rem = blocks - filled;
|
||||
|
||||
if (m_termInfo.xtermColor) {
|
||||
fmt::print(fmt(_SYS_STR("" BOLD " {:3d}% [")), iFactor);
|
||||
fmt::print(FMT_STRING(_SYS_STR("" BOLD " {:3d}% [")), iFactor);
|
||||
for (int b = 0; b < filled; ++b)
|
||||
fmt::print(fmt(_SYS_STR("#")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("#")));
|
||||
for (int b = 0; b < rem; ++b)
|
||||
fmt::print(fmt(_SYS_STR("-")));
|
||||
fmt::print(fmt(_SYS_STR("]" NORMAL "")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("]" NORMAL "")));
|
||||
} else {
|
||||
#if _WIN32
|
||||
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_INTENSITY | FOREGROUND_WHITE);
|
||||
#endif
|
||||
fmt::print(fmt(_SYS_STR(" {:3d}% [")), iFactor);
|
||||
fmt::print(FMT_STRING(_SYS_STR(" {:3d}% [")), iFactor);
|
||||
for (int b = 0; b < filled; ++b)
|
||||
fmt::print(fmt(_SYS_STR("#")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("#")));
|
||||
for (int b = 0; b < rem; ++b)
|
||||
fmt::print(fmt(_SYS_STR("-")));
|
||||
fmt::print(fmt(_SYS_STR("]")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("]")));
|
||||
#if _WIN32
|
||||
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_WHITE);
|
||||
#endif
|
||||
}
|
||||
|
||||
fmt::print(fmt(_SYS_STR("\n")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||
++m_curProgLines;
|
||||
}
|
||||
} else if (m_latestThread != -1) {
|
||||
const ThreadStat& stat = m_threadStats[m_latestThread];
|
||||
stat.print(m_termInfo);
|
||||
fmt::print(fmt(_SYS_STR("\r")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("\r")));
|
||||
}
|
||||
m_dirty = false;
|
||||
} else if (m_mainIndeterminate
|
||||
@@ -230,12 +230,12 @@ void MultiProgressPrinter::DoPrint() {
|
||||
MoveCursorUp(m_curProgLines);
|
||||
m_curProgLines = 0;
|
||||
DrawIndeterminateBar();
|
||||
fmt::print(fmt(_SYS_STR("\n")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||
++m_curProgLines;
|
||||
}
|
||||
|
||||
if (m_termInfo.xtermColor)
|
||||
fmt::print(fmt(_SYS_STR("" SHOW_CURSOR "")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("" SHOW_CURSOR "")));
|
||||
fflush(stdout);
|
||||
|
||||
#if _WIN32
|
||||
@@ -354,7 +354,7 @@ void MultiProgressPrinter::startNewLine() const {
|
||||
m_curThreadLines = 0;
|
||||
m_mainFactor = -1.f;
|
||||
auto logLk = logvisor::LockLog();
|
||||
fmt::print(fmt(_SYS_STR("\n")));
|
||||
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||
}
|
||||
|
||||
void MultiProgressPrinter::flush() const {
|
||||
|
||||
@@ -94,7 +94,7 @@ void Project::ConfigFile::addLine(std::string_view line) {
|
||||
|
||||
void Project::ConfigFile::removeLine(std::string_view refLine) {
|
||||
if (!m_lockedFile) {
|
||||
LogModule.reportSource(logvisor::Fatal, __FILE__, __LINE__, fmt("Project::ConfigFile::lockAndRead not yet called"));
|
||||
LogModule.reportSource(logvisor::Fatal, __FILE__, __LINE__, FMT_STRING("Project::ConfigFile::lockAndRead not yet called"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ void Project::ConfigFile::removeLine(std::string_view refLine) {
|
||||
|
||||
bool Project::ConfigFile::checkForLine(std::string_view refLine) const {
|
||||
if (!m_lockedFile) {
|
||||
LogModule.reportSource(logvisor::Fatal, __FILE__, __LINE__, fmt("Project::ConfigFile::lockAndRead not yet called"));
|
||||
LogModule.reportSource(logvisor::Fatal, __FILE__, __LINE__, FMT_STRING("Project::ConfigFile::lockAndRead not yet called"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ bool Project::ConfigFile::checkForLine(std::string_view refLine) const {
|
||||
|
||||
void Project::ConfigFile::unlockAndDiscard() {
|
||||
if (m_lockedFile == nullptr) {
|
||||
LogModule.reportSource(logvisor::Fatal, __FILE__, __LINE__, fmt("Project::ConfigFile::lockAndRead not yet called"));
|
||||
LogModule.reportSource(logvisor::Fatal, __FILE__, __LINE__, FMT_STRING("Project::ConfigFile::lockAndRead not yet called"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ void Project::ConfigFile::unlockAndDiscard() {
|
||||
|
||||
bool Project::ConfigFile::unlockAndCommit() {
|
||||
if (!m_lockedFile) {
|
||||
LogModule.reportSource(logvisor::Fatal, __FILE__, __LINE__, fmt("Project::ConfigFile::lockAndRead not yet called"));
|
||||
LogModule.reportSource(logvisor::Fatal, __FILE__, __LINE__, FMT_STRING("Project::ConfigFile::lockAndRead not yet called"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -181,12 +181,12 @@ Project::Project(const ProjectRootPath& rootPath)
|
||||
/* Stat for existing project directory (must already exist) */
|
||||
Sstat myStat;
|
||||
if (hecl::Stat(m_rootPath.getAbsolutePath().data(), &myStat)) {
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unable to stat {}")), m_rootPath.getAbsolutePath());
|
||||
LogModule.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to stat {}")), m_rootPath.getAbsolutePath());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!S_ISDIR(myStat.st_mode)) {
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("provided path must be a directory; '{}' isn't")),
|
||||
LogModule.report(logvisor::Error, FMT_STRING(_SYS_STR("provided path must be a directory; '{}' isn't")),
|
||||
m_rootPath.getAbsolutePath());
|
||||
return;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ Project::Project(const ProjectRootPath& rootPath)
|
||||
bf.reset();
|
||||
|
||||
if (beacon.magic != HECLfcc || SBig(beacon.version) != DATA_VERSION) {
|
||||
LogModule.report(logvisor::Fatal, fmt("incompatible project version"));
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("incompatible project version"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ const ProjectPath& Project::getProjectCookedPath(const DataSpecEntry& spec) cons
|
||||
for (const ProjectDataSpec& sp : m_compiledSpecs)
|
||||
if (&sp.spec == &spec)
|
||||
return sp.cookedPath;
|
||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find spec '{}'")), spec.m_name);
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find spec '{}'")), spec.m_name);
|
||||
return m_cookedRoot;
|
||||
}
|
||||
|
||||
@@ -469,7 +469,7 @@ bool Project::packagePath(const ProjectPath& path, const hecl::MultiProgressPrin
|
||||
}
|
||||
|
||||
if (!specEntry)
|
||||
LogModule.report(logvisor::Fatal, fmt("No matching DataSpec"));
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("No matching DataSpec"));
|
||||
|
||||
if (!m_lastPackageSpec || m_lastPackageSpec->getDataSpecEntry() != specEntry)
|
||||
m_lastPackageSpec = specEntry->m_factory(*this, DataSpecTool::Package);
|
||||
|
||||
@@ -21,7 +21,7 @@ static SystemString CanonRelPath(SystemStringView path) {
|
||||
else if (match == _SYS_STR("..")) {
|
||||
if (comps.empty()) {
|
||||
/* Unable to resolve outside project */
|
||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("Unable to resolve outside project root in {}")), path);
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to resolve outside project root in {}")), path);
|
||||
return _SYS_STR(".");
|
||||
}
|
||||
comps.pop_back();
|
||||
@@ -184,7 +184,7 @@ Time ProjectPath::getModtime() const {
|
||||
return Time(latestTime);
|
||||
}
|
||||
}
|
||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("invalid path type for computing modtime in '{}'")), m_absPath);
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("invalid path type for computing modtime in '{}'")), m_absPath);
|
||||
return Time();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ FileStoreManager::FileStoreManager(SystemStringView domain) : m_domain(domain) {
|
||||
#if !WINDOWS_STORE
|
||||
WCHAR home[MAX_PATH];
|
||||
if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, home)))
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to locate profile for file store")));
|
||||
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to locate profile for file store")));
|
||||
|
||||
SystemString path(home);
|
||||
#else
|
||||
@@ -40,22 +40,22 @@ FileStoreManager::FileStoreManager(SystemStringView domain) : m_domain(domain) {
|
||||
std::string path;
|
||||
if (xdg_data_home) {
|
||||
if (xdg_data_home[0] != '/')
|
||||
Log.report(logvisor::Fatal, fmt("invalid $XDG_DATA_HOME for file store (must be absolute)"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("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("unable to locate $HOME for file store"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to locate $HOME for file store"));
|
||||
path = home;
|
||||
path += "/.local/share";
|
||||
}
|
||||
path += "/hecl";
|
||||
if (mkdir(path.c_str(), 0755) && errno != EEXIST)
|
||||
Log.report(logvisor::Fatal, fmt("unable to mkdir at {}"), path);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to mkdir at {}"), path);
|
||||
path += '/';
|
||||
path += domain.data();
|
||||
if (mkdir(path.c_str(), 0755) && errno != EEXIST)
|
||||
Log.report(logvisor::Fatal, fmt("unable to mkdir at {}"), path);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to mkdir at {}"), path);
|
||||
m_storeRoot = path;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ HMDLData::HMDLData(boo::IGraphicsDataFactory::Context& ctx, const void* metaData
|
||||
meta.read(r);
|
||||
}
|
||||
if (meta.magic != 'TACO')
|
||||
HMDL_Log.report(logvisor::Fatal, fmt("invalid HMDL magic"));
|
||||
HMDL_Log.report(logvisor::Fatal, FMT_STRING("invalid HMDL magic"));
|
||||
|
||||
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, vbo, meta.vertStride, meta.vertCount);
|
||||
m_ibo = ctx.newStaticBuffer(boo::BufferUse::Index, ibo, 4, meta.indexCount);
|
||||
|
||||
@@ -11,7 +11,7 @@ std::string WideToUTF8(std::wstring_view src) {
|
||||
utf8proc_uint8_t mb[4];
|
||||
utf8proc_ssize_t c = utf8proc_encode_char(utf8proc_int32_t(ch), mb);
|
||||
if (c < 0) {
|
||||
Log.report(logvisor::Warning, fmt("invalid UTF-8 character while encoding"));
|
||||
Log.report(logvisor::Warning, FMT_STRING("invalid UTF-8 character while encoding"));
|
||||
return retval;
|
||||
}
|
||||
retval.append(reinterpret_cast<char*>(mb), c);
|
||||
@@ -26,7 +26,7 @@ std::string Char16ToUTF8(std::u16string_view src) {
|
||||
utf8proc_uint8_t mb[4];
|
||||
utf8proc_ssize_t c = utf8proc_encode_char(utf8proc_int32_t(ch), mb);
|
||||
if (c < 0) {
|
||||
Log.report(logvisor::Warning, fmt("invalid UTF-8 character while encoding"));
|
||||
Log.report(logvisor::Warning, FMT_STRING("invalid UTF-8 character while encoding"));
|
||||
return retval;
|
||||
}
|
||||
retval.append(reinterpret_cast<char*>(mb), c);
|
||||
@@ -42,7 +42,7 @@ std::wstring UTF8ToWide(std::string_view src) {
|
||||
utf8proc_int32_t wc;
|
||||
utf8proc_ssize_t len = utf8proc_iterate(buf, -1, &wc);
|
||||
if (len < 0) {
|
||||
Log.report(logvisor::Warning, fmt("invalid UTF-8 character while decoding"));
|
||||
Log.report(logvisor::Warning, FMT_STRING("invalid UTF-8 character while decoding"));
|
||||
return retval;
|
||||
}
|
||||
buf += len;
|
||||
@@ -59,7 +59,7 @@ std::u16string UTF8ToChar16(std::string_view src) {
|
||||
utf8proc_int32_t wc;
|
||||
utf8proc_ssize_t len = utf8proc_iterate(buf, -1, &wc);
|
||||
if (len < 0) {
|
||||
Log.report(logvisor::Warning, fmt("invalid UTF-8 character while decoding"));
|
||||
Log.report(logvisor::Warning, FMT_STRING("invalid UTF-8 character while decoding"));
|
||||
return retval;
|
||||
}
|
||||
buf += len;
|
||||
|
||||
@@ -107,7 +107,7 @@ SystemString GetcwdStr() {
|
||||
}
|
||||
if (errno != ERANGE) {
|
||||
// It's not ERANGE, so we don't know how to handle it
|
||||
LogModule.report(logvisor::Fatal, fmt("Cannot determine the current path."));
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("Cannot determine the current path."));
|
||||
// Of course you may choose a different error reporting method
|
||||
}
|
||||
// Ok, the stack buffer isn't long enough; fallback to heap allocation
|
||||
@@ -121,11 +121,11 @@ SystemString GetcwdStr() {
|
||||
}
|
||||
if (errno != ERANGE) {
|
||||
// It's not ERANGE, so we don't know how to handle it
|
||||
LogModule.report(logvisor::Fatal, fmt("Cannot determine the current path."));
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("Cannot determine the current path."));
|
||||
// Of course you may choose a different error reporting method
|
||||
}
|
||||
}
|
||||
LogModule.report(logvisor::Fatal, fmt("Cannot determine the current path; the path is apparently unreasonably long"));
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("Cannot determine the current path; the path is apparently unreasonably long"));
|
||||
return SystemString();
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ bool ResourceLock::InProgress(const ProjectPath& path) {
|
||||
bool ResourceLock::SetThreadRes(const ProjectPath& path) {
|
||||
std::unique_lock lk{PathsMutex};
|
||||
if (PathsInProgress.find(std::this_thread::get_id()) != PathsInProgress.cend()) {
|
||||
LogModule.report(logvisor::Fatal, fmt("multiple resource locks on thread"));
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("multiple resource locks on thread"));
|
||||
}
|
||||
|
||||
const bool isInProgress = std::any_of(PathsInProgress.cbegin(), PathsInProgress.cend(),
|
||||
@@ -713,14 +713,14 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
|
||||
HANDLE consoleOutReadTmp = INVALID_HANDLE_VALUE;
|
||||
HANDLE consoleOutWrite = INVALID_HANDLE_VALUE;
|
||||
if (!CreatePipe(&consoleOutReadTmp, &consoleOutWrite, &sattrs, 0)) {
|
||||
LogModule.report(logvisor::Fatal, fmt("Error with CreatePipe"));
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("Error with CreatePipe"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
HANDLE consoleErrWrite = INVALID_HANDLE_VALUE;
|
||||
if (!DuplicateHandle(GetCurrentProcess(), consoleOutWrite, GetCurrentProcess(), &consoleErrWrite, 0, TRUE,
|
||||
DUPLICATE_SAME_ACCESS)) {
|
||||
LogModule.report(logvisor::Fatal, fmt("Error with DuplicateHandle"));
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("Error with DuplicateHandle"));
|
||||
CloseHandle(consoleOutReadTmp);
|
||||
CloseHandle(consoleOutWrite);
|
||||
return -1;
|
||||
@@ -731,7 +731,7 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
|
||||
&consoleOutRead, // Address of new handle.
|
||||
0, FALSE, // Make it uninheritable.
|
||||
DUPLICATE_SAME_ACCESS)) {
|
||||
LogModule.report(logvisor::Fatal, fmt("Error with DuplicateHandle"));
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("Error with DuplicateHandle"));
|
||||
CloseHandle(consoleOutReadTmp);
|
||||
CloseHandle(consoleOutWrite);
|
||||
CloseHandle(consoleErrWrite);
|
||||
@@ -762,7 +762,7 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
|
||||
LPWSTR messageBuffer = nullptr;
|
||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr,
|
||||
GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, nullptr);
|
||||
LogModule.report(logvisor::Error, fmt(L"unable to launch process from {}: {}"), path, messageBuffer);
|
||||
LogModule.report(logvisor::Error, FMT_STRING(L"unable to launch process from {}: {}"), path, messageBuffer);
|
||||
LocalFree(messageBuffer);
|
||||
|
||||
CloseHandle(nulHandle);
|
||||
@@ -788,13 +788,13 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
|
||||
if (err == ERROR_BROKEN_PIPE)
|
||||
break; // pipe done - normal exit path.
|
||||
else
|
||||
LogModule.report(logvisor::Error, fmt("Error with ReadFile: {:08X}"), err); // Something bad happened.
|
||||
LogModule.report(logvisor::Error, FMT_STRING("Error with ReadFile: {:08X}"), err); // Something bad happened.
|
||||
}
|
||||
|
||||
// Display the character read on the screen.
|
||||
auto lk = logvisor::LockLog();
|
||||
if (!WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), lpBuffer, nBytesRead, &nCharsWritten, nullptr)) {
|
||||
// LogModule.report(logvisor::Error, fmt("Error with WriteConsole: {:08X}"), GetLastError());
|
||||
// LogModule.report(logvisor::Error, FMT_STRING("Error with WriteConsole: {:08X}"), GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user