diff --git a/hecl/driver/ToolCook.hpp b/hecl/driver/ToolCook.hpp index 0d17d9b8c..928bd50f3 100644 --- a/hecl/driver/ToolCook.hpp +++ b/hecl/driver/ToolCook.hpp @@ -38,7 +38,7 @@ public: } } if (!m_spec) - LogModule.report(logvisor::Fatal, fmt("unable to find data spec '{}'"), specName); + LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to find data spec '{}'")), specName); continue; } else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-')) continue; diff --git a/hecl/driver/ToolExtract.hpp b/hecl/driver/ToolExtract.hpp index 1f16e93b3..eb3206e81 100644 --- a/hecl/driver/ToolExtract.hpp +++ b/hecl/driver/ToolExtract.hpp @@ -62,7 +62,7 @@ public: newProjRoot.makeDir(); m_fallbackProj.reset(new hecl::Database::Project(newProjRoot)); if (logvisor::ErrorCount > ErrorRef) - LogModule.report(logvisor::Fatal, fmt("unable to init project at '{}'"), rootDir); + LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to init project at '{}'")), rootDir); LogModule.report(logvisor::Info, fmt(_SYS_STR("initialized project at '{}/.hecl'")), rootDir); m_useProj = m_fallbackProj.get(); } else diff --git a/hecl/driver/ToolPackage.hpp b/hecl/driver/ToolPackage.hpp index 495b75896..d5c42329d 100644 --- a/hecl/driver/ToolPackage.hpp +++ b/hecl/driver/ToolPackage.hpp @@ -82,7 +82,7 @@ public: } } if (!m_spec) - LogModule.report(logvisor::Fatal, fmt("unable to find data spec '{}'"), specName); + LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to find data spec '{}'")), specName); continue; } else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-')) continue; diff --git a/hecl/extern/athena b/hecl/extern/athena index 0ada695c7..ffbd1a0bc 160000 --- a/hecl/extern/athena +++ b/hecl/extern/athena @@ -1 +1 @@ -Subproject commit 0ada695c7a9a774a233211fe73e86b0779c3073a +Subproject commit ffbd1a0bcda633d324eb82cd55fa14dcb2f33401 diff --git a/hecl/extern/boo b/hecl/extern/boo index ae5d7e513..af50bc0bc 160000 --- a/hecl/extern/boo +++ b/hecl/extern/boo @@ -1 +1 @@ -Subproject commit ae5d7e51316d149e1f52ff715a7e72a5c6906db5 +Subproject commit af50bc0bc21855dbe2b49cb5b40fdde1f4a925f9 diff --git a/hecl/include/hecl/FourCC.hpp b/hecl/include/hecl/FourCC.hpp index a407425f5..63cf98439 100644 --- a/hecl/include/hecl/FourCC.hpp +++ b/hecl/include/hecl/FourCC.hpp @@ -85,5 +85,7 @@ struct hash { }; } // namespace std -FMT_CUSTOM_FORMATTER(hecl::FourCC, fmt("{:.4s}"), obj.getChars()) -FMT_CUSTOM_FORMATTER(hecl::DNAFourCC, fmt("{:.4s}"), obj.getChars()) +FMT_CUSTOM_FORMATTER(hecl::FourCC, "{:c}{:c}{:c}{:c}", + obj.getChars()[0], obj.getChars()[1], obj.getChars()[2], obj.getChars()[3]) +FMT_CUSTOM_FORMATTER(hecl::DNAFourCC, "{:c}{:c}{:c}{:c}", + obj.getChars()[0], obj.getChars()[1], obj.getChars()[2], obj.getChars()[3]) diff --git a/hecl/include/hecl/hecl.hpp b/hecl/include/hecl/hecl.hpp index 6d41c84fb..57d51c93a 100644 --- a/hecl/include/hecl/hecl.hpp +++ b/hecl/include/hecl/hecl.hpp @@ -577,7 +577,7 @@ public: return SystemString(beginIt, absPathForward.cend()); } } - LogModule.report(logvisor::Fatal, fmt("unable to resolve '{}' as project relative '{}'"), absPath, m_projRoot); + LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve '{}' as project relative '{}'")), absPath, m_projRoot); return SystemString(); } @@ -1269,5 +1269,5 @@ struct hash { }; } // namespace std -FMT_CUSTOM_FORMATTER(hecl::SystemUTF8Conv, fmt("{}"), obj.str()) -FMT_CUSTOM_FORMATTER(hecl::SystemStringConv, fmt("{}"), obj.sys_str()) \ No newline at end of file +FMT_CUSTOM_FORMATTER(hecl::SystemUTF8Conv, "{}", obj.str()) +FMT_CUSTOM_FORMATTER(hecl::SystemStringConv, "{}", obj.sys_str()) diff --git a/hecl/lib/Blender/Connection.cpp b/hecl/lib/Blender/Connection.cpp index 897e85c1e..b4ad59278 100644 --- a/hecl/lib/Blender/Connection.cpp +++ b/hecl/lib/Blender/Connection.cpp @@ -284,7 +284,7 @@ Connection::Connection(int verbosityLevel) { /* User-specified blender path */ #if _WIN32 - wchar_t BLENDER_BIN_BUF[2048]; + std::wstring blenderBinBuf; const wchar_t* blenderBin = _wgetenv(L"BLENDER_BIN"); #else const char* blenderBin = getenv("BLENDER_BIN"); @@ -307,18 +307,16 @@ Connection::Connection(int verbosityLevel) { /* No steam; try default */ wchar_t progFiles[256]; if (!GetEnvironmentVariableW(L"ProgramFiles", progFiles, 256)) - BlenderLog.report(logvisor::Fatal, L"unable to determine 'Program Files' path"); - _snwprintf(BLENDER_BIN_BUF, 2048, L"%s\\Blender Foundation\\Blender\\blender.exe", progFiles); - blenderBin = BLENDER_BIN_BUF; + BlenderLog.report(logvisor::Fatal, fmt(L"unable to determine 'Program Files' path")); + blenderBinBuf = fmt::format(fmt(L"{}\\Blender Foundation\\Blender\\blender.exe"), progFiles); + blenderBin = blenderBinBuf.c_str(); if (!RegFileExists(blenderBin)) - BlenderLog.report(logvisor::Fatal, L"unable to find blender.exe"); + BlenderLog.report(logvisor::Fatal, fmt(L"unable to find blender.exe")); } } - wchar_t cmdLine[2048]; - _snwprintf(cmdLine, 2048, L" --background -P \"%s\" -- %" PRIuPTR " %" PRIuPTR " %d \"%s\"", - blenderShellPath.c_str(), uintptr_t(writehandle), uintptr_t(readhandle), verbosityLevel, - blenderAddonPath.c_str()); + std::wstring cmdLine = fmt::format(fmt(L" --background -P \"{}\" -- {} {} {} \"{}\""), + blenderShellPath, uintptr_t(writehandle), uintptr_t(readhandle), verbosityLevel, blenderAddonPath); STARTUPINFO sinfo = {sizeof(STARTUPINFO)}; HANDLE nulHandle = CreateFileW(L"nul", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, &sattrs, OPEN_EXISTING, @@ -333,11 +331,12 @@ Connection::Connection(int verbosityLevel) { sinfo.hStdOutput = consoleOutWrite; } - if (!CreateProcessW(blenderBin, cmdLine, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &sinfo, &m_pinfo)) { + if (!CreateProcessW(blenderBin, const_cast(cmdLine.c_str()), NULL, NULL, TRUE, + NORMAL_PRIORITY_CLASS, NULL, NULL, &sinfo, &m_pinfo)) { LPWSTR messageBuffer = nullptr; FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL); - BlenderLog.report(logvisor::Fatal, L"unable to launch blender from %s: %s", blenderBin, messageBuffer); + BlenderLog.report(logvisor::Fatal, fmt(L"unable to launch blender from {}: {}"), blenderBin, messageBuffer); } close(m_writepipe[0]); @@ -359,7 +358,7 @@ 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("Error with ReadFile: {:08X}"), err); // Something bad happened. } // Display the character read on the screen. @@ -461,11 +460,15 @@ Connection::Connection(int verbosityLevel) { BlenderLog.report(logvisor::Fatal, fmt("Unable to launch blender: {}"), lineBuf + 9); } else if (!strncmp(lineBuf, "NOBLENDER", 9)) { _closePipe(); +#if _WIN32 + BlenderLog.report(logvisor::Fatal, fmt(_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, DEFAULT_BLENDER_BIN); else BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}'")), DEFAULT_BLENDER_BIN); +#endif } else if (!strcmp(lineBuf, "NOT280")) { _closePipe(); BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Installed blender version must be >= 2.80"))); diff --git a/hecl/lib/CMakeLists.txt b/hecl/lib/CMakeLists.txt index 6e040e753..f6d253b24 100644 --- a/hecl/lib/CMakeLists.txt +++ b/hecl/lib/CMakeLists.txt @@ -87,8 +87,10 @@ target_atdna(hecl-light atdna_HMDLMeta_light.cpp ../include/hecl/HMDLMeta.hpp) target_atdna(hecl-light atdna_CVar_light.cpp ../include/hecl/CVar.hpp) add_library(hecl-compilers Compilers.cpp WideStringConvert.cpp) -target_include_directories(hecl-compilers PUBLIC ../include) -target_link_libraries(hecl-compilers PUBLIC boo athena-core logvisor) +get_target_property(BOO_INCLUDES boo INTERFACE_INCLUDE_DIRECTORIES) +target_include_directories(hecl-compilers PUBLIC ../include ${BOO_INCLUDES}) +target_link_libraries(hecl-compilers PUBLIC athena-core logvisor xxhash + glslang OSDependent OGLCompiler SPIRV glslang-default-resource-limits) if(COMMAND add_sanitizers) add_sanitizers(hecl-full) diff --git a/hecl/lib/ClientProcess.cpp b/hecl/lib/ClientProcess.cpp index 051c7b207..bdf539375 100644 --- a/hecl/lib/ClientProcess.cpp +++ b/hecl/lib/ClientProcess.cpp @@ -89,7 +89,8 @@ ClientProcess::Worker::Worker(ClientProcess& proc, int idx) : m_proc(proc), m_id void ClientProcess::Worker::proc() { ClientProcess::ThreadWorker.reset(this); - logvisor::RegisterThreadName(fmt::format(fmt("HECL Worker {}"), m_idx).c_str()); + std::string thrName = fmt::format(fmt("HECL Worker {}"), m_idx); + logvisor::RegisterThreadName(thrName.c_str()); std::unique_lock lk(m_proc.m_mutex); while (m_proc.m_running) { diff --git a/hecl/lib/Compilers.cpp b/hecl/lib/Compilers.cpp index eb47087e4..1f29236eb 100644 --- a/hecl/lib/Compilers.cpp +++ b/hecl/lib/Compilers.cpp @@ -100,7 +100,7 @@ struct ShaderCompiler { if (FAILED(D3DCompilePROC(text.data(), text.size(), "Boo HLSL Source", nullptr, nullptr, "main", D3DShaderTypes[int(S::Enum)], BOO_D3DCOMPILE_FLAG, 0, &blobOut, &errBlob))) { printf("%s\n", text.data()); - Log.report(logvisor::Fatal, fmt("error compiling shader: %s"), errBlob->GetBufferPointer()); + Log.report(logvisor::Fatal, fmt("error compiling shader: {}"), (char*)errBlob->GetBufferPointer()); return {}; } std::pair ret(MakeStageBinaryData(blobOut->GetBufferSize()), blobOut->GetBufferSize()); diff --git a/hecl/lib/Project.cpp b/hecl/lib/Project.cpp index 0eb788f67..9243c805e 100644 --- a/hecl/lib/Project.cpp +++ b/hecl/lib/Project.cpp @@ -219,7 +219,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("Unable to find spec '{}'"), spec.m_name); + LogModule.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find spec '{}'")), spec.m_name); return m_cookedRoot; } diff --git a/hecl/lib/hecl.cpp b/hecl/lib/hecl.cpp index 39625ca1b..5122f53a0 100644 --- a/hecl/lib/hecl.cpp +++ b/hecl/lib/hecl.cpp @@ -747,7 +747,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, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL); - LogModule.report(logvisor::Error, L"unable to launch process from %s: %s", path, messageBuffer); + LogModule.report(logvisor::Error, fmt(L"unable to launch process from {}: {}"), path, messageBuffer); LocalFree(messageBuffer); CloseHandle(nulHandle); @@ -773,7 +773,7 @@ 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("Error with ReadFile: {:08X}"), err); // Something bad happened. } // Display the character read on the screen. diff --git a/hecl/shaderc/main.cpp b/hecl/shaderc/main.cpp index a31cd9aaa..28e476757 100644 --- a/hecl/shaderc/main.cpp +++ b/hecl/shaderc/main.cpp @@ -85,7 +85,7 @@ int main(int argc, const hecl::SystemChar** argv) else c.addDefine(defineU8, ""); } else { - Log.report(logvisor::Error, fmt("Unrecognized flag option '{:c}'"), argv[i][1]); + Log.report(logvisor::Error, fmt(_SYS_STR("Unrecognized flag option '{:c}'")), argv[i][1]); return 1; } } else {