mirror of https://github.com/AxioDL/metaforce.git
Update fmtlib
This commit is contained in:
parent
7ce829d134
commit
6a8714c1f3
|
@ -55,9 +55,9 @@ protected:
|
||||||
bool continuePrompt() {
|
bool continuePrompt() {
|
||||||
if (!m_info.yes) {
|
if (!m_info.yes) {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(fmt(_SYS_STR("\n" BLUE BOLD "Continue?" NORMAL " (Y/n) ")));
|
fmt::print(FMT_STRING(_SYS_STR("\n" BLUE BOLD "Continue?" NORMAL " (Y/n) ")));
|
||||||
else
|
else
|
||||||
fmt::print(fmt(_SYS_STR("\nContinue? (Y/n) ")));
|
fmt::print(FMT_STRING(_SYS_STR("\nContinue? (Y/n) ")));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
int ch;
|
int ch;
|
||||||
|
@ -73,7 +73,7 @@ protected:
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (ch == 'n' || ch == 'N') {
|
if (ch == 'n' || ch == 'N') {
|
||||||
fmt::print(fmt(_SYS_STR("\n")));
|
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ch == 'y' || ch == 'Y' || ch == '\r' || ch == '\n')
|
if (ch == 'y' || ch == 'Y' || ch == '\r' || ch == '\n')
|
||||||
|
@ -83,7 +83,7 @@ protected:
|
||||||
tcsetattr(0, TCSANOW, &tioOld);
|
tcsetattr(0, TCSANOW, &tioOld);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
fmt::print(fmt(_SYS_STR("\n")));
|
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,27 +175,27 @@ public:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void print(const hecl::SystemChar* str) { fmt::print(m_sout, fmt(_SYS_STR("{}")), str); }
|
void print(const hecl::SystemChar* str) { fmt::print(m_sout, FMT_STRING(_SYS_STR("{}")), str); }
|
||||||
|
|
||||||
void printBold(const hecl::SystemChar* str) {
|
void printBold(const hecl::SystemChar* str) {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(m_sout, fmt(_SYS_STR("" BOLD "{}" NORMAL "")), str);
|
fmt::print(m_sout, FMT_STRING(_SYS_STR("" BOLD "{}" NORMAL "")), str);
|
||||||
else
|
else
|
||||||
fmt::print(m_sout, fmt(_SYS_STR("{}")), str);
|
fmt::print(m_sout, FMT_STRING(_SYS_STR("{}")), str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void secHead(const hecl::SystemChar* headName) {
|
void secHead(const hecl::SystemChar* headName) {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(m_sout, fmt(_SYS_STR("" BOLD "{}" NORMAL "\n")), headName);
|
fmt::print(m_sout, FMT_STRING(_SYS_STR("" BOLD "{}" NORMAL "\n")), headName);
|
||||||
else
|
else
|
||||||
fmt::print(m_sout, fmt(_SYS_STR("{}\n")), headName);
|
fmt::print(m_sout, FMT_STRING(_SYS_STR("{}\n")), headName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void optionHead(const hecl::SystemChar* flag, const hecl::SystemChar* synopsis) {
|
void optionHead(const hecl::SystemChar* flag, const hecl::SystemChar* synopsis) {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(m_sout, fmt(_SYS_STR("" BOLD "{}" NORMAL " ({})\n")), flag, synopsis);
|
fmt::print(m_sout, FMT_STRING(_SYS_STR("" BOLD "{}" NORMAL " ({})\n")), flag, synopsis);
|
||||||
else
|
else
|
||||||
fmt::print(m_sout, fmt(_SYS_STR("{} ({})\n")), flag, synopsis);
|
fmt::print(m_sout, FMT_STRING(_SYS_STR("{} ({})\n")), flag, synopsis);
|
||||||
}
|
}
|
||||||
|
|
||||||
void beginWrap() { m_wrapBuffer.clear(); }
|
void beginWrap() { m_wrapBuffer.clear(); }
|
||||||
|
@ -213,7 +213,7 @@ public:
|
||||||
void endWrap() {
|
void endWrap() {
|
||||||
_wrapBuf(m_wrapBuffer);
|
_wrapBuf(m_wrapBuffer);
|
||||||
m_wrapBuffer += _SYS_STR('\n');
|
m_wrapBuffer += _SYS_STR('\n');
|
||||||
fmt::print(m_sout, fmt(_SYS_STR("{}")), m_wrapBuffer);
|
fmt::print(m_sout, FMT_STRING(_SYS_STR("{}")), m_wrapBuffer);
|
||||||
m_wrapBuffer.clear();
|
m_wrapBuffer.clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!m_spec)
|
if (!m_spec)
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to find data spec '{}'")), specName);
|
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find data spec '{}'")), specName);
|
||||||
continue;
|
continue;
|
||||||
} else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
|
} else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
|
||||||
continue;
|
continue;
|
||||||
|
@ -51,7 +51,7 @@ public:
|
||||||
m_useProj = m_fallbackProj.get();
|
m_useProj = m_fallbackProj.get();
|
||||||
} else if (m_fallbackProj->getProjectRootPath() != root)
|
} else if (m_fallbackProj->getProjectRootPath() != root)
|
||||||
LogModule.report(logvisor::Fatal,
|
LogModule.report(logvisor::Fatal,
|
||||||
fmt(_SYS_STR("hecl cook can only process multiple items in the same project; ")
|
FMT_STRING(_SYS_STR("hecl cook can only process multiple items in the same project; ")
|
||||||
_SYS_STR("'{}' and '{}' are different projects")),
|
_SYS_STR("'{}' and '{}' are different projects")),
|
||||||
m_fallbackProj->getProjectRootPath().getAbsolutePath(),
|
m_fallbackProj->getProjectRootPath().getAbsolutePath(),
|
||||||
root.getAbsolutePath());
|
root.getAbsolutePath());
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
}
|
}
|
||||||
if (!m_useProj)
|
if (!m_useProj)
|
||||||
LogModule.report(logvisor::Fatal,
|
LogModule.report(logvisor::Fatal,
|
||||||
fmt("hecl cook must be ran within a project directory or "
|
FMT_STRING("hecl cook must be ran within a project directory or "
|
||||||
"provided a path within a project"));
|
"provided a path within a project"));
|
||||||
|
|
||||||
/* Default case: recursive at root */
|
/* Default case: recursive at root */
|
||||||
|
|
|
@ -29,7 +29,7 @@ class ToolExtract final : public ToolBase {
|
||||||
public:
|
public:
|
||||||
explicit ToolExtract(const ToolPassInfo& info) : ToolBase(info) {
|
explicit ToolExtract(const ToolPassInfo& info) : ToolBase(info) {
|
||||||
if (!m_info.args.size())
|
if (!m_info.args.size())
|
||||||
LogModule.report(logvisor::Fatal, fmt("hecl extract needs a source path as its first argument"));
|
LogModule.report(logvisor::Fatal, FMT_STRING("hecl extract needs a source path as its first argument"));
|
||||||
|
|
||||||
if (!info.project) {
|
if (!info.project) {
|
||||||
hecl::SystemString rootDir;
|
hecl::SystemString rootDir;
|
||||||
|
@ -47,7 +47,7 @@ public:
|
||||||
baseFile.assign(baseFile.begin(), baseFile.begin() + dotPos);
|
baseFile.assign(baseFile.begin(), baseFile.begin() + dotPos);
|
||||||
|
|
||||||
if (baseFile.empty())
|
if (baseFile.empty())
|
||||||
LogModule.report(logvisor::Fatal, fmt("hecl extract must be ran within a project directory"));
|
LogModule.report(logvisor::Fatal, FMT_STRING("hecl extract must be ran within a project directory"));
|
||||||
|
|
||||||
rootDir = info.cwd + baseFile;
|
rootDir = info.cwd + baseFile;
|
||||||
} else {
|
} else {
|
||||||
|
@ -62,8 +62,8 @@ public:
|
||||||
newProjRoot.makeDir();
|
newProjRoot.makeDir();
|
||||||
m_fallbackProj.reset(new hecl::Database::Project(newProjRoot));
|
m_fallbackProj.reset(new hecl::Database::Project(newProjRoot));
|
||||||
if (logvisor::ErrorCount > ErrorRef)
|
if (logvisor::ErrorCount > ErrorRef)
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to init project at '{}'")), rootDir);
|
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to init project at '{}'")), rootDir);
|
||||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("initialized project at '{}/.hecl'")), rootDir);
|
LogModule.report(logvisor::Info, FMT_STRING(_SYS_STR("initialized project at '{}/.hecl'")), rootDir);
|
||||||
m_useProj = m_fallbackProj.get();
|
m_useProj = m_fallbackProj.get();
|
||||||
} else
|
} else
|
||||||
m_useProj = info.project;
|
m_useProj = info.project;
|
||||||
|
@ -116,15 +116,15 @@ public:
|
||||||
|
|
||||||
static void _recursivePrint(int level, hecl::Database::IDataSpec::ExtractReport& rep) {
|
static void _recursivePrint(int level, hecl::Database::IDataSpec::ExtractReport& rep) {
|
||||||
for (int l = 0; l < level; ++l)
|
for (int l = 0; l < level; ++l)
|
||||||
fmt::print(fmt(_SYS_STR(" ")));
|
fmt::print(FMT_STRING(_SYS_STR(" ")));
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(fmt(_SYS_STR("" BOLD "{}" NORMAL "")), rep.name);
|
fmt::print(FMT_STRING(_SYS_STR("" BOLD "{}" NORMAL "")), rep.name);
|
||||||
else
|
else
|
||||||
fmt::print(fmt(_SYS_STR("{}")), rep.name);
|
fmt::print(FMT_STRING(_SYS_STR("{}")), rep.name);
|
||||||
|
|
||||||
if (rep.desc.size())
|
if (rep.desc.size())
|
||||||
fmt::print(fmt(_SYS_STR(" [{}]")), rep.desc);
|
fmt::print(FMT_STRING(_SYS_STR(" [{}]")), rep.desc);
|
||||||
fmt::print(fmt(_SYS_STR("\n")));
|
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||||
for (hecl::Database::IDataSpec::ExtractReport& child : rep.childOpts)
|
for (hecl::Database::IDataSpec::ExtractReport& child : rep.childOpts)
|
||||||
_recursivePrint(level + 1, child);
|
_recursivePrint(level + 1, child);
|
||||||
}
|
}
|
||||||
|
@ -132,32 +132,32 @@ public:
|
||||||
int run() override {
|
int run() override {
|
||||||
if (m_specPasses.empty()) {
|
if (m_specPasses.empty()) {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(fmt(_SYS_STR("" RED BOLD "NOTHING TO EXTRACT" NORMAL "\n")));
|
fmt::print(FMT_STRING(_SYS_STR("" RED BOLD "NOTHING TO EXTRACT" NORMAL "\n")));
|
||||||
else
|
else
|
||||||
fmt::print(fmt(_SYS_STR("NOTHING TO EXTRACT\n")));
|
fmt::print(FMT_STRING(_SYS_STR("NOTHING TO EXTRACT\n")));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(fmt(_SYS_STR("" GREEN BOLD "ABOUT TO EXTRACT:" NORMAL "\n")));
|
fmt::print(FMT_STRING(_SYS_STR("" GREEN BOLD "ABOUT TO EXTRACT:" NORMAL "\n")));
|
||||||
else
|
else
|
||||||
fmt::print(fmt(_SYS_STR("ABOUT TO EXTRACT:\n")));
|
fmt::print(FMT_STRING(_SYS_STR("ABOUT TO EXTRACT:\n")));
|
||||||
|
|
||||||
for (hecl::Database::IDataSpec::ExtractReport& rep : m_reps) {
|
for (hecl::Database::IDataSpec::ExtractReport& rep : m_reps) {
|
||||||
_recursivePrint(0, rep);
|
_recursivePrint(0, rep);
|
||||||
fmt::print(fmt(_SYS_STR("\n")));
|
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
if (continuePrompt()) {
|
if (continuePrompt()) {
|
||||||
for (SpecExtractPass& ds : m_specPasses) {
|
for (SpecExtractPass& ds : m_specPasses) {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(fmt(_SYS_STR("" MAGENTA BOLD "Using DataSpec {}:" NORMAL "\n")), ds.m_entry->m_name);
|
fmt::print(FMT_STRING(_SYS_STR("" MAGENTA BOLD "Using DataSpec {}:" NORMAL "\n")), ds.m_entry->m_name);
|
||||||
else
|
else
|
||||||
fmt::print(fmt(_SYS_STR("Using DataSpec {}:\n")), ds.m_entry->m_name);
|
fmt::print(FMT_STRING(_SYS_STR("Using DataSpec {}:\n")), ds.m_entry->m_name);
|
||||||
|
|
||||||
ds.m_instance->doExtract(m_einfo, {true});
|
ds.m_instance->doExtract(m_einfo, {true});
|
||||||
fmt::print(fmt(_SYS_STR("\n\n")));
|
fmt::print(FMT_STRING(_SYS_STR("\n\n")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class ToolHelp final : public ToolBase {
|
||||||
public:
|
public:
|
||||||
explicit ToolHelp(const ToolPassInfo& info) : ToolBase(info) {
|
explicit ToolHelp(const ToolPassInfo& info) : ToolBase(info) {
|
||||||
if (m_info.args.empty()) {
|
if (m_info.args.empty()) {
|
||||||
LogModule.report(logvisor::Error, fmt("help requires a tool name argument"));
|
LogModule.report(logvisor::Error, FMT_STRING("help requires a tool name argument"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_good = true;
|
m_good = true;
|
||||||
|
@ -63,7 +63,7 @@ public:
|
||||||
else if (toolName == _SYS_STR("help"))
|
else if (toolName == _SYS_STR("help"))
|
||||||
helpFunc = ToolHelp::Help;
|
helpFunc = ToolHelp::Help;
|
||||||
else {
|
else {
|
||||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unrecognized tool '{}' - can't help")), toolName);
|
LogModule.report(logvisor::Error, FMT_STRING(_SYS_STR("unrecognized tool '{}' - can't help")), toolName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class ToolImage final : public ToolBase {
|
||||||
public:
|
public:
|
||||||
explicit ToolImage(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) {
|
explicit ToolImage(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) {
|
||||||
if (!info.project)
|
if (!info.project)
|
||||||
LogModule.report(logvisor::Fatal, fmt("hecl image must be ran within a project directory"));
|
LogModule.report(logvisor::Fatal, FMT_STRING("hecl image must be ran within a project directory"));
|
||||||
|
|
||||||
/* Scan args */
|
/* Scan args */
|
||||||
if (info.args.size()) {
|
if (info.args.size()) {
|
||||||
|
@ -40,7 +40,7 @@ public:
|
||||||
}
|
}
|
||||||
if (!m_useProj)
|
if (!m_useProj)
|
||||||
LogModule.report(logvisor::Fatal,
|
LogModule.report(logvisor::Fatal,
|
||||||
fmt("hecl image must be ran within a project directory or "
|
FMT_STRING("hecl image must be ran within a project directory or "
|
||||||
"provided a path within a project"));
|
"provided a path within a project"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,29 +75,29 @@ public:
|
||||||
|
|
||||||
int run() override {
|
int run() override {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(fmt(_SYS_STR("" GREEN BOLD "ABOUT TO IMAGE:" NORMAL "\n")));
|
fmt::print(FMT_STRING(_SYS_STR("" GREEN BOLD "ABOUT TO IMAGE:" NORMAL "\n")));
|
||||||
else
|
else
|
||||||
fmt::print(fmt(_SYS_STR("ABOUT TO IMAGE:\n")));
|
fmt::print(FMT_STRING(_SYS_STR("ABOUT TO IMAGE:\n")));
|
||||||
|
|
||||||
fmt::print(fmt(_SYS_STR(" {}\n")), m_useProj->getProjectRootPath().getAbsolutePath());
|
fmt::print(FMT_STRING(_SYS_STR(" {}\n")), m_useProj->getProjectRootPath().getAbsolutePath());
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
if (continuePrompt()) {
|
if (continuePrompt()) {
|
||||||
hecl::ProjectPath outPath(m_useProj->getProjectWorkingPath(), _SYS_STR("out"));
|
hecl::ProjectPath outPath(m_useProj->getProjectWorkingPath(), _SYS_STR("out"));
|
||||||
if (!outPath.isDirectory()) {
|
if (!outPath.isDirectory()) {
|
||||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("{} is not a directory")), outPath.getAbsolutePath());
|
LogModule.report(logvisor::Error, FMT_STRING(_SYS_STR("{} is not a directory")), outPath.getAbsolutePath());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hecl::ProjectPath bootBinPath(outPath, _SYS_STR("sys/boot.bin"));
|
hecl::ProjectPath bootBinPath(outPath, _SYS_STR("sys/boot.bin"));
|
||||||
if (!bootBinPath.isFile()) {
|
if (!bootBinPath.isFile()) {
|
||||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("{} is not a file")), bootBinPath.getAbsolutePath());
|
LogModule.report(logvisor::Error, FMT_STRING(_SYS_STR("{} is not a file")), bootBinPath.getAbsolutePath());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
athena::io::FileReader r(bootBinPath.getAbsolutePath());
|
athena::io::FileReader r(bootBinPath.getAbsolutePath());
|
||||||
if (r.hasError()) {
|
if (r.hasError()) {
|
||||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unable to open {}")), bootBinPath.getAbsolutePath());
|
LogModule.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to open {}")), bootBinPath.getAbsolutePath());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
std::string id = r.readString(6);
|
std::string id = r.readString(6);
|
||||||
|
@ -113,7 +113,7 @@ public:
|
||||||
fileOut += _SYS_STR(".gcm");
|
fileOut += _SYS_STR(".gcm");
|
||||||
if (nod::DiscBuilderGCN::CalculateTotalSizeRequired(outPath.getAbsolutePath()) == UINT64_MAX)
|
if (nod::DiscBuilderGCN::CalculateTotalSizeRequired(outPath.getAbsolutePath()) == UINT64_MAX)
|
||||||
return 1;
|
return 1;
|
||||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("Generating {} as GameCube image")), fileOut);
|
LogModule.report(logvisor::Info, FMT_STRING(_SYS_STR("Generating {} as GameCube image")), fileOut);
|
||||||
nod::DiscBuilderGCN db(fileOut, progFunc);
|
nod::DiscBuilderGCN db(fileOut, progFunc);
|
||||||
if (db.buildFromDirectory(outPath.getAbsolutePath()) != nod::EBuildResult::Success)
|
if (db.buildFromDirectory(outPath.getAbsolutePath()) != nod::EBuildResult::Success)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -122,7 +122,7 @@ public:
|
||||||
bool dualLayer;
|
bool dualLayer;
|
||||||
if (nod::DiscBuilderWii::CalculateTotalSizeRequired(outPath.getAbsolutePath(), dualLayer) == UINT64_MAX)
|
if (nod::DiscBuilderWii::CalculateTotalSizeRequired(outPath.getAbsolutePath(), dualLayer) == UINT64_MAX)
|
||||||
return 1;
|
return 1;
|
||||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("Generating {} as {}-layer Wii image")), fileOut,
|
LogModule.report(logvisor::Info, FMT_STRING(_SYS_STR("Generating {} as {}-layer Wii image")), fileOut,
|
||||||
dualLayer ? _SYS_STR("dual") : _SYS_STR("single"));
|
dualLayer ? _SYS_STR("dual") : _SYS_STR("single"));
|
||||||
nod::DiscBuilderWii db(fileOut, dualLayer, progFunc);
|
nod::DiscBuilderWii db(fileOut, dualLayer, progFunc);
|
||||||
if (db.buildFromDirectory(outPath.getAbsolutePath()) != nod::EBuildResult::Success)
|
if (db.buildFromDirectory(outPath.getAbsolutePath()) != nod::EBuildResult::Success)
|
||||||
|
|
|
@ -18,18 +18,18 @@ public:
|
||||||
if (hecl::Stat(dir->c_str(), &theStat)) {
|
if (hecl::Stat(dir->c_str(), &theStat)) {
|
||||||
hecl::MakeDir(dir->c_str());
|
hecl::MakeDir(dir->c_str());
|
||||||
if (hecl::Stat(dir->c_str(), &theStat)) {
|
if (hecl::Stat(dir->c_str(), &theStat)) {
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to stat '{}'")), *dir);
|
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to stat '{}'")), *dir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!S_ISDIR(theStat.st_mode)) {
|
if (!S_ISDIR(theStat.st_mode)) {
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("'{}' is not a directory")), *dir);
|
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("'{}' is not a directory")), *dir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hecl::SystemString testPath = *dir + _SYS_STR("/.hecl/beacon");
|
hecl::SystemString testPath = *dir + _SYS_STR("/.hecl/beacon");
|
||||||
if (!hecl::Stat(testPath.c_str(), &theStat)) {
|
if (!hecl::Stat(testPath.c_str(), &theStat)) {
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("project already exists at '{}'")), *dir);
|
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("project already exists at '{}'")), *dir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public:
|
||||||
hecl::Database::Project proj((hecl::ProjectRootPath(*m_dir)));
|
hecl::Database::Project proj((hecl::ProjectRootPath(*m_dir)));
|
||||||
if (logvisor::ErrorCount > ErrorRef)
|
if (logvisor::ErrorCount > ErrorRef)
|
||||||
return 1;
|
return 1;
|
||||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("initialized project at '{}/.hecl'")), *m_dir);
|
LogModule.report(logvisor::Info, FMT_STRING(_SYS_STR("initialized project at '{}/.hecl'")), *m_dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class ToolPackage final : public ToolBase {
|
||||||
public:
|
public:
|
||||||
explicit ToolPackage(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) {
|
explicit ToolPackage(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) {
|
||||||
if (!info.project)
|
if (!info.project)
|
||||||
LogModule.report(logvisor::Fatal, fmt("hecl package must be ran within a project directory"));
|
LogModule.report(logvisor::Fatal, FMT_STRING("hecl package must be ran within a project directory"));
|
||||||
|
|
||||||
/* Scan args */
|
/* Scan args */
|
||||||
if (info.args.size()) {
|
if (info.args.size()) {
|
||||||
|
@ -77,7 +77,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!m_spec)
|
if (!m_spec)
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to find data spec '{}'")), specName);
|
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find data spec '{}'")), specName);
|
||||||
continue;
|
continue;
|
||||||
} else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
|
} else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
|
||||||
continue;
|
continue;
|
||||||
|
@ -91,7 +91,7 @@ public:
|
||||||
m_useProj = m_fallbackProj.get();
|
m_useProj = m_fallbackProj.get();
|
||||||
} else if (m_fallbackProj->getProjectRootPath() != root)
|
} else if (m_fallbackProj->getProjectRootPath() != root)
|
||||||
LogModule.report(logvisor::Fatal,
|
LogModule.report(logvisor::Fatal,
|
||||||
fmt(_SYS_STR("hecl package can only process multiple items in the same project; ")
|
FMT_STRING(_SYS_STR("hecl package can only process multiple items in the same project; ")
|
||||||
_SYS_STR("'{}' and '{}' are different projects")),
|
_SYS_STR("'{}' and '{}' are different projects")),
|
||||||
m_fallbackProj->getProjectRootPath().getAbsolutePath(),
|
m_fallbackProj->getProjectRootPath().getAbsolutePath(),
|
||||||
root.getAbsolutePath());
|
root.getAbsolutePath());
|
||||||
|
@ -102,7 +102,7 @@ public:
|
||||||
}
|
}
|
||||||
if (!m_useProj)
|
if (!m_useProj)
|
||||||
LogModule.report(logvisor::Fatal,
|
LogModule.report(logvisor::Fatal,
|
||||||
fmt("hecl package must be ran within a project directory or "
|
FMT_STRING("hecl package must be ran within a project directory or "
|
||||||
"provided a path within a project"));
|
"provided a path within a project"));
|
||||||
|
|
||||||
/* Default case: recursive at root */
|
/* Default case: recursive at root */
|
||||||
|
@ -155,12 +155,12 @@ public:
|
||||||
|
|
||||||
int run() override {
|
int run() override {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(fmt(_SYS_STR("" GREEN BOLD "ABOUT TO PACKAGE:" NORMAL "\n")));
|
fmt::print(FMT_STRING(_SYS_STR("" GREEN BOLD "ABOUT TO PACKAGE:" NORMAL "\n")));
|
||||||
else
|
else
|
||||||
fmt::print(fmt(_SYS_STR("ABOUT TO PACKAGE:\n")));
|
fmt::print(FMT_STRING(_SYS_STR("ABOUT TO PACKAGE:\n")));
|
||||||
|
|
||||||
for (auto& item : m_selectedItems)
|
for (auto& item : m_selectedItems)
|
||||||
fmt::print(fmt(_SYS_STR(" {}\n")), item.getRelativePath());
|
fmt::print(FMT_STRING(_SYS_STR(" {}\n")), item.getRelativePath());
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
if (continuePrompt()) {
|
if (continuePrompt()) {
|
||||||
|
@ -168,7 +168,7 @@ public:
|
||||||
hecl::ClientProcess cp(&printer);
|
hecl::ClientProcess cp(&printer);
|
||||||
for (const hecl::ProjectPath& path : m_selectedItems) {
|
for (const hecl::ProjectPath& path : m_selectedItems) {
|
||||||
if (!m_useProj->packagePath(path, printer, m_fast, m_spec, &cp))
|
if (!m_useProj->packagePath(path, printer, m_fast, m_spec, &cp))
|
||||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("Unable to package {}")), path.getAbsolutePath());
|
LogModule.report(logvisor::Error, FMT_STRING(_SYS_STR("Unable to package {}")), path.getAbsolutePath());
|
||||||
}
|
}
|
||||||
cp.waitUntilComplete();
|
cp.waitUntilComplete();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ public:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!info.project)
|
if (!info.project)
|
||||||
LogModule.report(logvisor::Fatal, fmt("hecl spec must be ran within a project directory"));
|
LogModule.report(logvisor::Fatal, FMT_STRING("hecl spec must be ran within a project directory"));
|
||||||
|
|
||||||
const auto& specs = info.project->getDataSpecs();
|
const auto& specs = info.project->getDataSpecs();
|
||||||
hecl::SystemString firstArg = info.args.front();
|
hecl::SystemString firstArg = info.args.front();
|
||||||
|
@ -27,7 +27,7 @@ public:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (info.args.size() < 2)
|
if (info.args.size() < 2)
|
||||||
LogModule.report(logvisor::Fatal, fmt("Speclist argument required"));
|
LogModule.report(logvisor::Fatal, FMT_STRING("Speclist argument required"));
|
||||||
|
|
||||||
auto it = info.args.begin();
|
auto it = info.args.begin();
|
||||||
++it;
|
++it;
|
||||||
|
@ -41,7 +41,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("'{}' is not found in the dataspec registry")), *it);
|
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("'{}' is not found in the dataspec registry")), *it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,10 +77,10 @@ public:
|
||||||
if (!m_info.project) {
|
if (!m_info.project) {
|
||||||
for (const hecl::Database::DataSpecEntry* spec : hecl::Database::DATA_SPEC_REGISTRY) {
|
for (const hecl::Database::DataSpecEntry* spec : hecl::Database::DATA_SPEC_REGISTRY) {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(fmt(_SYS_STR("" BOLD CYAN "{}" NORMAL "\n")), spec->m_name);
|
fmt::print(FMT_STRING(_SYS_STR("" BOLD CYAN "{}" NORMAL "\n")), spec->m_name);
|
||||||
else
|
else
|
||||||
fmt::print(fmt(_SYS_STR("{}\n")), spec->m_name);
|
fmt::print(FMT_STRING(_SYS_STR("{}\n")), spec->m_name);
|
||||||
fmt::print(fmt(_SYS_STR(" {}\n")), spec->m_desc);
|
fmt::print(FMT_STRING(_SYS_STR(" {}\n")), spec->m_desc);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -89,16 +89,16 @@ public:
|
||||||
if (mode == MLIST) {
|
if (mode == MLIST) {
|
||||||
for (auto& spec : specs) {
|
for (auto& spec : specs) {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(fmt(_SYS_STR("" BOLD CYAN "{}" NORMAL "")), spec.spec.m_name);
|
fmt::print(FMT_STRING(_SYS_STR("" BOLD CYAN "{}" NORMAL "")), spec.spec.m_name);
|
||||||
else
|
else
|
||||||
fmt::print(fmt(_SYS_STR("{}")), spec.spec.m_name);
|
fmt::print(FMT_STRING(_SYS_STR("{}")), spec.spec.m_name);
|
||||||
if (spec.active) {
|
if (spec.active) {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(fmt(_SYS_STR(" " BOLD GREEN "[ENABLED]" NORMAL "")));
|
fmt::print(FMT_STRING(_SYS_STR(" " BOLD GREEN "[ENABLED]" NORMAL "")));
|
||||||
else
|
else
|
||||||
fmt::print(fmt(_SYS_STR(" [ENABLED]")));
|
fmt::print(FMT_STRING(_SYS_STR(" [ENABLED]")));
|
||||||
}
|
}
|
||||||
fmt::print(fmt(_SYS_STR("\n {}\n")), spec.spec.m_desc);
|
fmt::print(FMT_STRING(_SYS_STR("\n {}\n")), spec.spec.m_desc);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,20 +46,20 @@ bool XTERM_COLOR = false;
|
||||||
/* Main usage message */
|
/* Main usage message */
|
||||||
static void printHelp(const hecl::SystemChar* pname) {
|
static void printHelp(const hecl::SystemChar* pname) {
|
||||||
if (XTERM_COLOR)
|
if (XTERM_COLOR)
|
||||||
fmt::print(fmt(_SYS_STR("" BOLD "HECL" NORMAL "")));
|
fmt::print(FMT_STRING(_SYS_STR("" BOLD "HECL" NORMAL "")));
|
||||||
else
|
else
|
||||||
fmt::print(fmt(_SYS_STR("HECL")));
|
fmt::print(FMT_STRING(_SYS_STR("HECL")));
|
||||||
#if HECL_HAS_NOD
|
#if HECL_HAS_NOD
|
||||||
#define TOOL_LIST "extract|init|cook|package|image|installaddon|help"
|
#define TOOL_LIST "extract|init|cook|package|image|installaddon|help"
|
||||||
#else
|
#else
|
||||||
#define TOOL_LIST "extract|init|cook|package|installaddon|help"
|
#define TOOL_LIST "extract|init|cook|package|installaddon|help"
|
||||||
#endif
|
#endif
|
||||||
#if HECL_GIT
|
#if HECL_GIT
|
||||||
fmt::print(fmt(_SYS_STR(" Commit " HECL_GIT_S " " HECL_BRANCH_S "\nUsage: {} " TOOL_LIST "\n")), pname);
|
fmt::print(FMT_STRING(_SYS_STR(" Commit " HECL_GIT_S " " HECL_BRANCH_S "\nUsage: {} " TOOL_LIST "\n")), pname);
|
||||||
#elif HECL_VER
|
#elif HECL_VER
|
||||||
fmt::print(fmt(_SYS_STR(" Version " HECL_VER_S "\nUsage: {} " TOOL_LIST "\n")), pname);
|
fmt::print(FMT_STRING(_SYS_STR(" Version " HECL_VER_S "\nUsage: {} " TOOL_LIST "\n")), pname);
|
||||||
#else
|
#else
|
||||||
fmt::print(fmt(_SYS_STR("\nUsage: {} " TOOL_LIST "\n")), pname);
|
fmt::print(FMT_STRING(_SYS_STR("\nUsage: {} " TOOL_LIST "\n")), pname);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ static std::unique_ptr<ToolBase> MakeSelectedTool(hecl::SystemString toolName, T
|
||||||
|
|
||||||
auto fp = hecl::FopenUnique(toolName.c_str(), _SYS_STR("rb"));
|
auto fp = hecl::FopenUnique(toolName.c_str(), _SYS_STR("rb"));
|
||||||
if (fp == nullptr) {
|
if (fp == nullptr) {
|
||||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unrecognized tool '{}'")), toolNameLower);
|
LogModule.report(logvisor::Error, FMT_STRING(_SYS_STR("unrecognized tool '{}'")), toolNameLower);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
fp.reset();
|
fp.reset();
|
||||||
|
@ -281,7 +281,7 @@ int main(int argc, const char** argv)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (argc > 1 && !hecl::StrCmp(argv[1], _SYS_STR("--dlpackage"))) {
|
if (argc > 1 && !hecl::StrCmp(argv[1], _SYS_STR("--dlpackage"))) {
|
||||||
fmt::print(fmt("{}\n"), HECL_DLPACKAGE);
|
fmt::print(FMT_STRING("{}\n"), HECL_DLPACKAGE);
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ int main(int argc, const char** argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (info.verbosityLevel) {
|
if (info.verbosityLevel) {
|
||||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("Constructed tool '{}' {}\n")), tool->toolName(),
|
LogModule.report(logvisor::Info, FMT_STRING(_SYS_STR("Constructed tool '{}' {}\n")), tool->toolName(),
|
||||||
info.verbosityLevel);
|
info.verbosityLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ebda6add23ff8e0560e5eb080752b35fb84af5dc
|
Subproject commit 30fe237210e3f2cb74f3989ff2e8b8a41b5a6db5
|
|
@ -1 +1 @@
|
||||||
Subproject commit de85119690a57b13d1258d20bc93fb54601c648c
|
Subproject commit c36895a109b37df558ba3a14cf054a2b30008bec
|
|
@ -805,7 +805,7 @@ class Connection {
|
||||||
char readBuf[16];
|
char readBuf[16];
|
||||||
_readStr(readBuf, 16);
|
_readStr(readBuf, 16);
|
||||||
if (status != readBuf)
|
if (status != readBuf)
|
||||||
BlenderLog.report(logvisor::Fatal, fmt("{}: {}: {}"), m_loadedBlend.getRelativePathUTF8(), action, readBuf);
|
BlenderLog.report(logvisor::Fatal, FMT_STRING("{}: {}: {}"), m_loadedBlend.getRelativePathUTF8(), action, readBuf);
|
||||||
}
|
}
|
||||||
void _checkReady(std::string_view action) { _checkStatus(action, "READY"sv); }
|
void _checkReady(std::string_view action) { _checkStatus(action, "READY"sv); }
|
||||||
void _checkDone(std::string_view action) { _checkStatus(action, "DONE"sv); }
|
void _checkDone(std::string_view action) { _checkStatus(action, "DONE"sv); }
|
||||||
|
@ -835,14 +835,14 @@ public:
|
||||||
PyOutStream beginPythonOut(bool deleteOnError = false) {
|
PyOutStream beginPythonOut(bool deleteOnError = false) {
|
||||||
bool expect = false;
|
bool expect = false;
|
||||||
if (!m_lock.compare_exchange_strong(expect, true))
|
if (!m_lock.compare_exchange_strong(expect, true))
|
||||||
BlenderLog.report(logvisor::Fatal, fmt("lock already held for blender::Connection::beginPythonOut()"));
|
BlenderLog.report(logvisor::Fatal, FMT_STRING("lock already held for blender::Connection::beginPythonOut()"));
|
||||||
return PyOutStream(this, deleteOnError);
|
return PyOutStream(this, deleteOnError);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataStream beginData() {
|
DataStream beginData() {
|
||||||
bool expect = false;
|
bool expect = false;
|
||||||
if (!m_lock.compare_exchange_strong(expect, true))
|
if (!m_lock.compare_exchange_strong(expect, true))
|
||||||
BlenderLog.report(logvisor::Fatal, fmt("lock already held for blender::Connection::beginDataIn()"));
|
BlenderLog.report(logvisor::Fatal, FMT_STRING("lock already held for blender::Connection::beginDataIn()"));
|
||||||
return DataStream(this);
|
return DataStream(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,7 +860,7 @@ public:
|
||||||
template <typename S, typename... Args, typename Char>
|
template <typename S, typename... Args, typename Char>
|
||||||
void PyOutStream::format(const S& format, Args&&... args) {
|
void PyOutStream::format(const S& format, Args&&... args) {
|
||||||
if (!m_parent || !m_parent->m_lock)
|
if (!m_parent || !m_parent->m_lock)
|
||||||
BlenderLog.report(logvisor::Fatal, fmt("lock not held for PyOutStream::format()"));
|
BlenderLog.report(logvisor::Fatal, FMT_STRING("lock not held for PyOutStream::format()"));
|
||||||
fmt::print(*this, format, std::forward<Args>(args)...);
|
fmt::print(*this, format, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,14 +85,14 @@ public:
|
||||||
|
|
||||||
virtual bool canExtract([[maybe_unused]] const ExtractPassInfo& info,
|
virtual bool canExtract([[maybe_unused]] const ExtractPassInfo& info,
|
||||||
[[maybe_unused]] std::vector<ExtractReport>& reps) {
|
[[maybe_unused]] std::vector<ExtractReport>& reps) {
|
||||||
LogModule.report(logvisor::Error, fmt("not implemented"));
|
LogModule.report(logvisor::Error, FMT_STRING("not implemented"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
virtual void doExtract([[maybe_unused]] const ExtractPassInfo& info,
|
virtual void doExtract([[maybe_unused]] const ExtractPassInfo& info,
|
||||||
[[maybe_unused]] const MultiProgressPrinter& progress) {}
|
[[maybe_unused]] const MultiProgressPrinter& progress) {}
|
||||||
|
|
||||||
virtual bool canCook([[maybe_unused]] const ProjectPath& path, [[maybe_unused]] blender::Token& btok) {
|
virtual bool canCook([[maybe_unused]] const ProjectPath& path, [[maybe_unused]] blender::Token& btok) {
|
||||||
LogModule.report(logvisor::Error, fmt("not implemented"));
|
LogModule.report(logvisor::Error, FMT_STRING("not implemented"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
virtual const DataSpecEntry* overrideDataSpec([[maybe_unused]] const ProjectPath& path,
|
virtual const DataSpecEntry* overrideDataSpec([[maybe_unused]] const ProjectPath& path,
|
||||||
|
|
|
@ -195,11 +195,11 @@ inline void MakeDir(const char* dir) {
|
||||||
HRESULT err;
|
HRESULT err;
|
||||||
if (!CreateDirectoryA(dir, NULL))
|
if (!CreateDirectoryA(dir, NULL))
|
||||||
if ((err = GetLastError()) != ERROR_ALREADY_EXISTS)
|
if ((err = GetLastError()) != ERROR_ALREADY_EXISTS)
|
||||||
LogModule.report(logvisor::Fatal, fmt("MakeDir({})"), dir);
|
LogModule.report(logvisor::Fatal, FMT_STRING("MakeDir({})"), dir);
|
||||||
#else
|
#else
|
||||||
if (mkdir(dir, 0755))
|
if (mkdir(dir, 0755))
|
||||||
if (errno != EEXIST)
|
if (errno != EEXIST)
|
||||||
LogModule.report(logvisor::Fatal, fmt("MakeDir({}): {}"), dir, strerror(errno));
|
LogModule.report(logvisor::Fatal, FMT_STRING("MakeDir({}): {}"), dir, strerror(errno));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ inline void MakeDir(const wchar_t* dir) {
|
||||||
HRESULT err;
|
HRESULT err;
|
||||||
if (!CreateDirectoryW(dir, NULL))
|
if (!CreateDirectoryW(dir, NULL))
|
||||||
if ((err = GetLastError()) != ERROR_ALREADY_EXISTS)
|
if ((err = GetLastError()) != ERROR_ALREADY_EXISTS)
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("MakeDir({})")), dir);
|
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("MakeDir({})")), dir);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ inline FILE* Fopen(const SystemChar* path, const SystemChar* mode, FileLockType
|
||||||
&ov);
|
&ov);
|
||||||
#else
|
#else
|
||||||
if (flock(fileno(fp), ((lock == FileLockType::Write) ? LOCK_EX : LOCK_SH) | LOCK_NB))
|
if (flock(fileno(fp), ((lock == FileLockType::Write) ? LOCK_EX : LOCK_SH) | LOCK_NB))
|
||||||
LogModule.report(logvisor::Error, fmt("flock {}: {}"), path, strerror(errno));
|
LogModule.report(logvisor::Error, FMT_STRING("flock {}: {}"), path, strerror(errno));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,16 +376,16 @@ inline bool CheckFreeSpace(const SystemChar* path, size_t reqSz) {
|
||||||
wchar_t* end;
|
wchar_t* end;
|
||||||
DWORD ret = GetFullPathNameW(path, 1024, buf, &end);
|
DWORD ret = GetFullPathNameW(path, 1024, buf, &end);
|
||||||
if (!ret || ret > 1024)
|
if (!ret || ret > 1024)
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("GetFullPathNameW {}")), path);
|
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("GetFullPathNameW {}")), path);
|
||||||
if (end)
|
if (end)
|
||||||
end[0] = L'\0';
|
end[0] = L'\0';
|
||||||
if (!GetDiskFreeSpaceExW(buf, &freeBytes, nullptr, nullptr))
|
if (!GetDiskFreeSpaceExW(buf, &freeBytes, nullptr, nullptr))
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("GetDiskFreeSpaceExW {}: {}")), path, GetLastError());
|
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("GetDiskFreeSpaceExW {}: {}")), path, GetLastError());
|
||||||
return reqSz < freeBytes.QuadPart;
|
return reqSz < freeBytes.QuadPart;
|
||||||
#else
|
#else
|
||||||
struct statvfs svfs;
|
struct statvfs svfs;
|
||||||
if (statvfs(path, &svfs))
|
if (statvfs(path, &svfs))
|
||||||
LogModule.report(logvisor::Fatal, fmt("statvfs {}: {}"), path, strerror(errno));
|
LogModule.report(logvisor::Fatal, FMT_STRING("statvfs {}: {}"), path, strerror(errno));
|
||||||
return reqSz < svfs.f_frsize * svfs.f_bavail;
|
return reqSz < svfs.f_frsize * svfs.f_bavail;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -611,7 +611,7 @@ public:
|
||||||
return SystemString(beginIt, absPathForward.cend());
|
return SystemString(beginIt, absPathForward.cend());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve '{}' as project relative '{}'")), absPath,
|
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to resolve '{}' as project relative '{}'")), absPath,
|
||||||
m_projRoot);
|
m_projRoot);
|
||||||
return SystemString();
|
return SystemString();
|
||||||
}
|
}
|
||||||
|
@ -784,7 +784,7 @@ public:
|
||||||
*/
|
*/
|
||||||
ProjectPath getParentPath() const {
|
ProjectPath getParentPath() const {
|
||||||
if (m_relPath == _SYS_STR("."))
|
if (m_relPath == _SYS_STR("."))
|
||||||
LogModule.report(logvisor::Fatal, fmt("attempted to resolve parent of root project path"));
|
LogModule.report(logvisor::Fatal, FMT_STRING("attempted to resolve parent of root project path"));
|
||||||
size_t pos = m_relPath.rfind(_SYS_STR('/'));
|
size_t pos = m_relPath.rfind(_SYS_STR('/'));
|
||||||
if (pos == SystemString::npos)
|
if (pos == SystemString::npos)
|
||||||
return ProjectPath(*m_proj, _SYS_STR(""));
|
return ProjectPath(*m_proj, _SYS_STR(""));
|
||||||
|
@ -1083,7 +1083,7 @@ public:
|
||||||
*/
|
*/
|
||||||
Database::Project& getProject() const {
|
Database::Project& getProject() const {
|
||||||
if (!m_proj)
|
if (!m_proj)
|
||||||
LogModule.report(logvisor::Fatal, fmt("ProjectPath::getProject() called on unqualified path"));
|
LogModule.report(logvisor::Fatal, FMT_STRING("ProjectPath::getProject() called on unqualified path"));
|
||||||
return *m_proj;
|
return *m_proj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ static void InstallBlendershell(const SystemChar* path) {
|
||||||
auto fp = hecl::FopenUnique(path, _SYS_STR("w"));
|
auto fp = hecl::FopenUnique(path, _SYS_STR("w"));
|
||||||
|
|
||||||
if (fp == nullptr) {
|
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());
|
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"));
|
auto fp = hecl::FopenUnique(path, _SYS_STR("wb"));
|
||||||
|
|
||||||
if (fp == nullptr) {
|
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());
|
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;
|
uint32_t readLen;
|
||||||
int ret = Read(m_readpipe[0], &readLen, sizeof(readLen));
|
int ret = Read(m_readpipe[0], &readLen, sizeof(readLen));
|
||||||
if (ret < 4) {
|
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();
|
_blenderDied();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (readLen >= bufSz) {
|
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';
|
*buf = '\0';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = Read(m_readpipe[0], buf, readLen);
|
ret = Read(m_readpipe[0], buf, readLen);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
BlenderLog.report(logvisor::Fatal, fmt("{}"), strerror(errno));
|
BlenderLog.report(logvisor::Fatal, FMT_STRING("{}"), strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,11 +266,11 @@ void Connection::_blenderDied() {
|
||||||
std::fseek(errFp.get(), 0, SEEK_SET);
|
std::fseek(errFp.get(), 0, SEEK_SET);
|
||||||
const auto buf = std::make_unique<char[]>(len + 1);
|
const auto buf = std::make_unique<char[]>(len + 1);
|
||||||
std::fread(buf.get(), 1, len, errFp.get());
|
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);
|
static std::atomic_bool BlenderFirstInit(false);
|
||||||
|
@ -287,7 +287,7 @@ static bool RegFileExists(const hecl::SystemChar* path) {
|
||||||
Connection::Connection(int verbosityLevel) {
|
Connection::Connection(int verbosityLevel) {
|
||||||
#if !WINDOWS_STORE
|
#if !WINDOWS_STORE
|
||||||
if (hecl::VerbosityLevel >= 1)
|
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 */
|
/* Put hecl_blendershell.py in temp dir */
|
||||||
const SystemChar* TMPDIR = GetTmpDir();
|
const SystemChar* TMPDIR = GetTmpDir();
|
||||||
|
@ -321,20 +321,20 @@ Connection::Connection(int verbosityLevel) {
|
||||||
SECURITY_ATTRIBUTES sattrs = {sizeof(SECURITY_ATTRIBUTES), nullptr, TRUE};
|
SECURITY_ATTRIBUTES sattrs = {sizeof(SECURITY_ATTRIBUTES), nullptr, TRUE};
|
||||||
HANDLE consoleOutReadTmp, consoleOutWrite, consoleErrWrite, consoleOutRead;
|
HANDLE consoleOutReadTmp, consoleOutWrite, consoleErrWrite, consoleOutRead;
|
||||||
if (!CreatePipe(&consoleOutReadTmp, &consoleOutWrite, &sattrs, 1024))
|
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,
|
if (!DuplicateHandle(GetCurrentProcess(), consoleOutWrite, GetCurrentProcess(), &consoleErrWrite, 0, TRUE,
|
||||||
DUPLICATE_SAME_ACCESS))
|
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(),
|
if (!DuplicateHandle(GetCurrentProcess(), consoleOutReadTmp, GetCurrentProcess(),
|
||||||
&consoleOutRead, // Address of new handle.
|
&consoleOutRead, // Address of new handle.
|
||||||
0, FALSE, // Make it uninheritable.
|
0, FALSE, // Make it uninheritable.
|
||||||
DUPLICATE_SAME_ACCESS))
|
DUPLICATE_SAME_ACCESS))
|
||||||
BlenderLog.report(logvisor::Fatal, fmt("Error with DupliateHandle"));
|
BlenderLog.report(logvisor::Fatal, FMT_STRING("Error with DupliateHandle"));
|
||||||
|
|
||||||
if (!CloseHandle(consoleOutReadTmp))
|
if (!CloseHandle(consoleOutReadTmp))
|
||||||
BlenderLog.report(logvisor::Fatal, fmt("Error with CloseHandle"));
|
BlenderLog.report(logvisor::Fatal, FMT_STRING("Error with CloseHandle"));
|
||||||
#else
|
#else
|
||||||
pipe(m_readpipe.data());
|
pipe(m_readpipe.data());
|
||||||
pipe(m_writepipe.data());
|
pipe(m_writepipe.data());
|
||||||
|
@ -365,15 +365,15 @@ Connection::Connection(int verbosityLevel) {
|
||||||
/* No steam; try default */
|
/* No steam; try default */
|
||||||
wchar_t progFiles[256];
|
wchar_t progFiles[256];
|
||||||
if (!GetEnvironmentVariableW(L"ProgramFiles", progFiles, 256))
|
if (!GetEnvironmentVariableW(L"ProgramFiles", progFiles, 256))
|
||||||
BlenderLog.report(logvisor::Fatal, fmt(L"unable to determine 'Program Files' path"));
|
BlenderLog.report(logvisor::Fatal, FMT_STRING(L"unable to determine 'Program Files' path"));
|
||||||
blenderBinBuf = fmt::format(fmt(L"{}\\Blender Foundation\\Blender\\blender.exe"), progFiles);
|
blenderBinBuf = fmt::format(FMT_STRING(L"{}\\Blender Foundation\\Blender\\blender.exe"), progFiles);
|
||||||
blenderBin = blenderBinBuf.c_str();
|
blenderBin = blenderBinBuf.c_str();
|
||||||
if (!RegFileExists(blenderBin))
|
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);
|
uintptr_t(writehandle), uintptr_t(readhandle), verbosityLevel, blenderAddonPath);
|
||||||
|
|
||||||
STARTUPINFO sinfo = {sizeof(STARTUPINFO)};
|
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,
|
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0,
|
nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0,
|
||||||
nullptr);
|
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]);
|
close(m_writepipe[0]);
|
||||||
|
@ -417,13 +417,13 @@ Connection::Connection(int verbosityLevel) {
|
||||||
if (err == ERROR_BROKEN_PIPE)
|
if (err == ERROR_BROKEN_PIPE)
|
||||||
break; // pipe done - normal exit path.
|
break; // pipe done - normal exit path.
|
||||||
else
|
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.
|
// Display the character read on the screen.
|
||||||
auto lk = logvisor::LockLog();
|
auto lk = logvisor::LockLog();
|
||||||
if (!WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), lpBuffer, nBytesRead, &nCharsWritten, nullptr)) {
|
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 errbuf;
|
||||||
std::string readfds = fmt::format(fmt("{}"), m_writepipe[0]);
|
std::string readfds = fmt::format(FMT_STRING("{}"), m_writepipe[0]);
|
||||||
std::string writefds = fmt::format(fmt("{}"), m_readpipe[1]);
|
std::string writefds = fmt::format(FMT_STRING("{}"), m_readpipe[1]);
|
||||||
std::string vLevel = fmt::format(fmt("{}"), verbosityLevel);
|
std::string vLevel = fmt::format(FMT_STRING("{}"), verbosityLevel);
|
||||||
|
|
||||||
/* Try user-specified blender first */
|
/* Try user-specified blender first */
|
||||||
if (blenderBin) {
|
if (blenderBin) {
|
||||||
execlp(blenderBin, blenderBin, "--background", "-P", blenderShellPath.c_str(), "--", readfds.c_str(),
|
execlp(blenderBin, blenderBin, "--background", "-P", blenderShellPath.c_str(), "--", readfds.c_str(),
|
||||||
writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), nullptr);
|
writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), nullptr);
|
||||||
if (errno != ENOENT) {
|
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]);
|
_writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -476,7 +476,7 @@ Connection::Connection(int verbosityLevel) {
|
||||||
execlp(blenderBin, blenderBin, "--background", "-P", blenderShellPath.c_str(), "--", readfds.c_str(),
|
execlp(blenderBin, blenderBin, "--background", "-P", blenderShellPath.c_str(), "--", readfds.c_str(),
|
||||||
writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), nullptr);
|
writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), nullptr);
|
||||||
if (errno != ENOENT) {
|
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]);
|
_writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ Connection::Connection(int verbosityLevel) {
|
||||||
execlp(DEFAULT_BLENDER_BIN, DEFAULT_BLENDER_BIN, "--background", "-P", blenderShellPath.c_str(), "--",
|
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);
|
readfds.c_str(), writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), nullptr);
|
||||||
if (errno != ENOENT) {
|
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]);
|
_writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -503,10 +503,10 @@ Connection::Connection(int verbosityLevel) {
|
||||||
/* Stash error path and unlink existing file */
|
/* Stash error path and unlink existing file */
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
m_errPath = hecl::SystemString(TMPDIR) +
|
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
|
#else
|
||||||
m_errPath = hecl::SystemString(TMPDIR) +
|
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
|
#endif
|
||||||
hecl::Unlink(m_errPath.c_str());
|
hecl::Unlink(m_errPath.c_str());
|
||||||
|
|
||||||
|
@ -515,28 +515,28 @@ Connection::Connection(int verbosityLevel) {
|
||||||
|
|
||||||
if (!lineStr.compare(0, 8, "NOLAUNCH")) {
|
if (!lineStr.compare(0, 8, "NOLAUNCH")) {
|
||||||
_closePipe();
|
_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")) {
|
} else if (!lineStr.compare(0, 9, "NOBLENDER")) {
|
||||||
_closePipe();
|
_closePipe();
|
||||||
#if _WIN32
|
#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
|
#else
|
||||||
if (blenderBin)
|
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);
|
DEFAULT_BLENDER_BIN);
|
||||||
else
|
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
|
#endif
|
||||||
} else if (lineStr == "NOT281") {
|
} else if (lineStr == "NOT281") {
|
||||||
_closePipe();
|
_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") {
|
} else if (lineStr == "NOADDON") {
|
||||||
_closePipe();
|
_closePipe();
|
||||||
if (blenderAddonPath != _SYS_STR("SKIPINSTALL"))
|
if (blenderAddonPath != _SYS_STR("SKIPINSTALL"))
|
||||||
InstallAddon(blenderAddonPath.c_str());
|
InstallAddon(blenderAddonPath.c_str());
|
||||||
++installAttempt;
|
++installAttempt;
|
||||||
if (installAttempt >= 2)
|
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());
|
blenderAddonPath.c_str());
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
waitpid(pid, nullptr, 0);
|
waitpid(pid, nullptr, 0);
|
||||||
|
@ -551,14 +551,14 @@ Connection::Connection(int verbosityLevel) {
|
||||||
continue;
|
continue;
|
||||||
} else if (lineStr != "READY") {
|
} else if (lineStr != "READY") {
|
||||||
_closePipe();
|
_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");
|
_writeStr("ACK");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
BlenderLog.report(logvisor::Fatal, fmt("BlenderConnection not available on UWP"));
|
BlenderLog.report(logvisor::Fatal, FMT_STRING("BlenderConnection not available on UWP"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ bool PyOutStream::StreamBuf::sendLine(std::string_view line) {
|
||||||
|
|
||||||
PyOutStream::StreamBuf::int_type PyOutStream::StreamBuf::overflow(int_type ch) {
|
PyOutStream::StreamBuf::int_type PyOutStream::StreamBuf::overflow(int_type ch) {
|
||||||
if (!m_parent.m_parent || !m_parent.m_parent->m_lock)
|
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') {
|
if (ch != traits_type::eof() && ch != '\n' && ch != '\0') {
|
||||||
m_lineBuf += char_type(ch);
|
m_lineBuf += char_type(ch);
|
||||||
return 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) {
|
std::streamsize PyOutStream::StreamBuf::xsputn(const char_type* __first, std::streamsize __n) {
|
||||||
if (!m_parent.m_parent || !m_parent.m_parent->m_lock)
|
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* __last = __first + __n;
|
||||||
const char_type* __s = __first;
|
const char_type* __s = __first;
|
||||||
for (const char_type* __e = __first; __e != __last; ++__e) {
|
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) {
|
bool Connection::createBlend(const ProjectPath& path, BlendType type) {
|
||||||
if (m_lock) {
|
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;
|
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()) {
|
if (_isFinished()) {
|
||||||
/* Delete immediately in case save doesn't occur */
|
/* Delete immediately in case save doesn't occur */
|
||||||
hecl::Unlink(path.getAbsolutePath().data());
|
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) {
|
bool Connection::openBlend(const ProjectPath& path, bool force) {
|
||||||
if (m_lock) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (!force && path == m_loadedBlend)
|
if (!force && path == m_loadedBlend)
|
||||||
return true;
|
return true;
|
||||||
_writeStr(fmt::format(fmt("OPEN \"{}\""), path.getAbsolutePathUTF8()));
|
_writeStr(fmt::format(FMT_STRING("OPEN \"{}\""), path.getAbsolutePathUTF8()));
|
||||||
if (_isFinished()) {
|
if (_isFinished()) {
|
||||||
m_loadedBlend = path;
|
m_loadedBlend = path;
|
||||||
_writeStr("GETTYPE");
|
_writeStr("GETTYPE");
|
||||||
|
@ -678,7 +678,7 @@ bool Connection::openBlend(const ProjectPath& path, bool force) {
|
||||||
|
|
||||||
bool Connection::saveBlend() {
|
bool Connection::saveBlend() {
|
||||||
if (m_lock) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
_writeStr("SAVE");
|
_writeStr("SAVE");
|
||||||
|
@ -688,7 +688,7 @@ bool Connection::saveBlend() {
|
||||||
void Connection::deleteBlend() {
|
void Connection::deleteBlend() {
|
||||||
if (m_loadedBlend) {
|
if (m_loadedBlend) {
|
||||||
hecl::Unlink(m_loadedBlend.getAbsolutePath().data());
|
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();
|
m_loadedBlend = ProjectPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -710,7 +710,7 @@ void PyOutStream::close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PyOutStream::linkBlend(std::string_view target, std::string_view objName, bool link) {
|
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"
|
" with bpy.data.libraries.load('''{}''', link={}, relative=True) as (data_from, data_to):\n"
|
||||||
" data_to.scenes = data_from.scenes\n"
|
" data_to.scenes = data_from.scenes\n"
|
||||||
" obj_scene = None\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) {
|
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"
|
"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"
|
" 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"
|
" 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) {
|
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"
|
"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"
|
" 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"
|
" 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) {
|
void PyOutStream::linkBackground(std::string_view target, std::string_view sceneName) {
|
||||||
if (sceneName.empty()) {
|
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"
|
" data_to.scenes = data_from.scenes\n"
|
||||||
"obj_scene = None\n"
|
"obj_scene = None\n"
|
||||||
"for scene in data_to.scenes:\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"),
|
"bpy.context.scene.background_set = obj_scene\n"),
|
||||||
target, target);
|
target, target);
|
||||||
} else {
|
} 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"
|
" with bpy.data.libraries.load('''{}''', link=True, relative=True) as (data_from, data_to):\n"
|
||||||
" data_to.scenes = data_from.scenes\n"
|
" data_to.scenes = data_from.scenes\n"
|
||||||
" obj_scene = None\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) {
|
void PyOutStream::AABBToBMesh(const atVec3f& min, const atVec3f& max) {
|
||||||
athena::simd_floats minf(min.simd);
|
athena::simd_floats minf(min.simd);
|
||||||
athena::simd_floats maxf(max.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"
|
"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) {
|
void ANIMOutStream::changeCurve(CurveType type, unsigned crvIdx, unsigned keyCount) {
|
||||||
if (m_curCount != m_totalCount)
|
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_curCount = 0;
|
||||||
m_totalCount = keyCount;
|
m_totalCount = keyCount;
|
||||||
char tp = char(type);
|
char tp = char(type);
|
||||||
|
@ -867,7 +867,7 @@ void ANIMOutStream::changeCurve(CurveType type, unsigned crvIdx, unsigned keyCou
|
||||||
|
|
||||||
void ANIMOutStream::write(unsigned frame, float val) {
|
void ANIMOutStream::write(unsigned frame, float val) {
|
||||||
if (!m_inCurve)
|
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) {
|
if (m_curCount < m_totalCount) {
|
||||||
struct {
|
struct {
|
||||||
uint32_t frm;
|
uint32_t frm;
|
||||||
|
@ -876,7 +876,7 @@ void ANIMOutStream::write(unsigned frame, float val) {
|
||||||
m_parent->_writeBuf(reinterpret_cast<const char*>(&key), 8);
|
m_parent->_writeBuf(reinterpret_cast<const char*>(&key), 8);
|
||||||
++m_curCount;
|
++m_curCount;
|
||||||
} else
|
} else
|
||||||
BlenderLog.report(logvisor::Fatal, fmt("ANIMOutStream keyCount overflow"));
|
BlenderLog.report(logvisor::Fatal, FMT_STRING("ANIMOutStream keyCount overflow"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh::SkinBind::SkinBind(Connection& conn) {
|
Mesh::SkinBind::SkinBind(Connection& conn) {
|
||||||
|
@ -1331,7 +1331,7 @@ std::vector<std::string> DataStream::getLightList() {
|
||||||
|
|
||||||
std::pair<atVec3f, atVec3f> DataStream::getMeshAABB() {
|
std::pair<atVec3f, atVec3f> DataStream::getMeshAABB() {
|
||||||
if (m_parent->m_loadedType != BlendType::Mesh && m_parent->m_loadedType != BlendType::Actor)
|
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->m_loadedBlend.getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("MESHAABB");
|
m_parent->_writeStr("MESHAABB");
|
||||||
|
@ -1349,7 +1349,7 @@ const char* DataStream::MeshOutputModeString(HMDLTopology topology) {
|
||||||
|
|
||||||
Mesh DataStream::compileMesh(HMDLTopology topology, int skinSlotCount) {
|
Mesh DataStream::compileMesh(HMDLTopology topology, int skinSlotCount) {
|
||||||
if (m_parent->getBlendType() != BlendType::Mesh)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("MESHCOMPILE");
|
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) {
|
Mesh DataStream::compileMesh(std::string_view name, HMDLTopology topology, int skinSlotCount, bool useLuv) {
|
||||||
if (m_parent->getBlendType() != BlendType::Area)
|
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->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);
|
m_parent->_checkOk("unable to cook mesh"sv);
|
||||||
|
|
||||||
return Mesh(*m_parent, topology, skinSlotCount, useLuv);
|
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) {
|
ColMesh DataStream::compileColMesh(std::string_view name) {
|
||||||
if (m_parent->getBlendType() != BlendType::Area)
|
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->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);
|
m_parent->_checkOk("unable to cook collision mesh"sv);
|
||||||
|
|
||||||
return ColMesh(*m_parent);
|
return ColMesh(*m_parent);
|
||||||
|
@ -1382,7 +1382,7 @@ ColMesh DataStream::compileColMesh(std::string_view name) {
|
||||||
|
|
||||||
std::vector<ColMesh> DataStream::compileColMeshes() {
|
std::vector<ColMesh> DataStream::compileColMeshes() {
|
||||||
if (m_parent->getBlendType() != BlendType::ColMesh)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("MESHCOMPILECOLLISIONALL");
|
m_parent->_writeStr("MESHCOMPILECOLLISIONALL");
|
||||||
|
@ -1395,7 +1395,7 @@ std::vector<ColMesh> DataStream::compileColMeshes() {
|
||||||
|
|
||||||
std::vector<Light> DataStream::compileLights() {
|
std::vector<Light> DataStream::compileLights() {
|
||||||
if (m_parent->getBlendType() != BlendType::Area)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("LIGHTCOMPILEALL");
|
m_parent->_writeStr("LIGHTCOMPILEALL");
|
||||||
|
@ -1408,7 +1408,7 @@ std::vector<Light> DataStream::compileLights() {
|
||||||
|
|
||||||
PathMesh DataStream::compilePathMesh() {
|
PathMesh DataStream::compilePathMesh() {
|
||||||
if (m_parent->getBlendType() != BlendType::PathMesh)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("MESHCOMPILEPATH");
|
m_parent->_writeStr("MESHCOMPILEPATH");
|
||||||
|
@ -1419,10 +1419,10 @@ PathMesh DataStream::compilePathMesh() {
|
||||||
|
|
||||||
std::vector<uint8_t> DataStream::compileGuiFrame(int version) {
|
std::vector<uint8_t> DataStream::compileGuiFrame(int version) {
|
||||||
if (m_parent->getBlendType() != BlendType::Frame)
|
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->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);
|
m_parent->_checkOk("unable to compile frame"sv);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -1439,7 +1439,7 @@ std::vector<uint8_t> DataStream::compileGuiFrame(int version) {
|
||||||
relative = proj.getProjectRootPath().getProjectRelativeFromAbsolute(absolute.sys_str());
|
relative = proj.getProjectRootPath().getProjectRelativeFromAbsolute(absolute.sys_str());
|
||||||
hecl::ProjectPath path(proj.getProjectWorkingPath(), relative);
|
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;
|
std::vector<uint8_t> ret;
|
||||||
|
@ -1461,7 +1461,7 @@ std::vector<ProjectPath> DataStream::getTextures() {
|
||||||
|
|
||||||
Actor DataStream::compileActor() {
|
Actor DataStream::compileActor() {
|
||||||
if (m_parent->getBlendType() != BlendType::Actor)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("ACTORCOMPILE");
|
m_parent->_writeStr("ACTORCOMPILE");
|
||||||
|
@ -1472,7 +1472,7 @@ Actor DataStream::compileActor() {
|
||||||
|
|
||||||
Actor DataStream::compileActorCharacterOnly() {
|
Actor DataStream::compileActorCharacterOnly() {
|
||||||
if (m_parent->getBlendType() != BlendType::Actor)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("ACTORCOMPILECHARACTERONLY");
|
m_parent->_writeStr("ACTORCOMPILECHARACTERONLY");
|
||||||
|
@ -1483,7 +1483,7 @@ Actor DataStream::compileActorCharacterOnly() {
|
||||||
|
|
||||||
Armature DataStream::compileArmature() {
|
Armature DataStream::compileArmature() {
|
||||||
if (m_parent->getBlendType() != BlendType::Armature)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("ARMATURECOMPILE");
|
m_parent->_writeStr("ARMATURECOMPILE");
|
||||||
|
@ -1494,10 +1494,10 @@ Armature DataStream::compileArmature() {
|
||||||
|
|
||||||
Action DataStream::compileActionChannelsOnly(std::string_view name) {
|
Action DataStream::compileActionChannelsOnly(std::string_view name) {
|
||||||
if (m_parent->getBlendType() != BlendType::Actor)
|
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->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);
|
m_parent->_checkOk("unable to compile action"sv);
|
||||||
|
|
||||||
return Action(*m_parent);
|
return Action(*m_parent);
|
||||||
|
@ -1505,7 +1505,7 @@ Action DataStream::compileActionChannelsOnly(std::string_view name) {
|
||||||
|
|
||||||
World DataStream::compileWorld() {
|
World DataStream::compileWorld() {
|
||||||
if (m_parent->getBlendType() != BlendType::World)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("WORLDCOMPILE");
|
m_parent->_writeStr("WORLDCOMPILE");
|
||||||
|
@ -1516,7 +1516,7 @@ World DataStream::compileWorld() {
|
||||||
|
|
||||||
std::vector<std::pair<std::string, std::string>> DataStream::getSubtypeNames() {
|
std::vector<std::pair<std::string, std::string>> DataStream::getSubtypeNames() {
|
||||||
if (m_parent->getBlendType() != BlendType::Actor)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("GETSUBTYPENAMES");
|
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() {
|
std::vector<std::pair<std::string, std::string>> DataStream::getActionNames() {
|
||||||
if (m_parent->getBlendType() != BlendType::Actor)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("GETACTIONNAMES");
|
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) {
|
std::vector<std::pair<std::string, std::string>> DataStream::getSubtypeOverlayNames(std::string_view name) {
|
||||||
if (m_parent->getBlendType() != BlendType::Actor)
|
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->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);
|
m_parent->_checkOk("unable to get subtype overlays of actor"sv);
|
||||||
|
|
||||||
std::vector<std::pair<std::string, std::string>> ret;
|
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() {
|
std::vector<std::pair<std::string, std::string>> DataStream::getAttachmentNames() {
|
||||||
if (m_parent->getBlendType() != BlendType::Actor)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("GETATTACHMENTNAMES");
|
m_parent->_writeStr("GETATTACHMENTNAMES");
|
||||||
|
@ -1591,10 +1591,10 @@ std::unordered_map<std::string, Matrix3f> DataStream::getBoneMatrices(std::strin
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
if (m_parent->getBlendType() != BlendType::Actor)
|
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->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);
|
m_parent->_checkOk("unable to get matrices of armature"sv);
|
||||||
|
|
||||||
std::unordered_map<std::string, Matrix3f> ret;
|
std::unordered_map<std::string, Matrix3f> ret;
|
||||||
|
@ -1626,11 +1626,11 @@ bool DataStream::renderPvs(std::string_view path, const atVec3f& location) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_parent->getBlendType() != BlendType::Area)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
athena::simd_floats f(location.simd);
|
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);
|
m_parent->_checkOk("unable to render PVS"sv);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1641,10 +1641,10 @@ bool DataStream::renderPvsLight(std::string_view path, std::string_view lightNam
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_parent->getBlendType() != BlendType::Area)
|
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->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);
|
m_parent->_checkOk("unable to render PVS light"sv);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1652,7 +1652,7 @@ bool DataStream::renderPvsLight(std::string_view path, std::string_view lightNam
|
||||||
|
|
||||||
MapArea DataStream::compileMapArea() {
|
MapArea DataStream::compileMapArea() {
|
||||||
if (m_parent->getBlendType() != BlendType::MapArea)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("MAPAREACOMPILE");
|
m_parent->_writeStr("MAPAREACOMPILE");
|
||||||
|
@ -1663,7 +1663,7 @@ MapArea DataStream::compileMapArea() {
|
||||||
|
|
||||||
MapUniverse DataStream::compileMapUniverse() {
|
MapUniverse DataStream::compileMapUniverse() {
|
||||||
if (m_parent->getBlendType() != BlendType::MapUniverse)
|
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->getBlendPath().getAbsolutePath());
|
||||||
|
|
||||||
m_parent->_writeStr("MAPUNIVERSECOMPILE");
|
m_parent->_writeStr("MAPUNIVERSECOMPILE");
|
||||||
|
@ -1711,7 +1711,7 @@ void Token::shutdown() {
|
||||||
m_conn->quitBlender();
|
m_conn->quitBlender();
|
||||||
m_conn.reset();
|
m_conn.reset();
|
||||||
if (hecl::VerbosityLevel >= 1)
|
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;
|
uint32_t skin_count;
|
||||||
conn._readValue(skin_count);
|
conn._readValue(skin_count);
|
||||||
if (skin_count > MaxSkinEntries)
|
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)
|
for (uint32_t i = 0; i < skin_count; ++i)
|
||||||
skin_ents[i] = Mesh::SkinBind(conn);
|
skin_ents[i] = Mesh::SkinBind(conn);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ MeshOptimizer::Edge::Edge(Connection& conn) {
|
||||||
uint32_t face_count;
|
uint32_t face_count;
|
||||||
conn._readValue(face_count);
|
conn._readValue(face_count);
|
||||||
if (face_count > MaxLinkFaces)
|
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)
|
for (uint32_t i = 0; i < face_count; ++i)
|
||||||
conn._readValue(link_faces[i]);
|
conn._readValue(link_faces[i]);
|
||||||
conn._readValue(is_contiguous);
|
conn._readValue(is_contiguous);
|
||||||
|
@ -384,10 +384,10 @@ MeshOptimizer::MeshOptimizer(Connection& conn, const std::vector<Material>& mate
|
||||||
: materials(materials), use_luvs(use_luvs) {
|
: materials(materials), use_luvs(use_luvs) {
|
||||||
conn._readValue(color_count);
|
conn._readValue(color_count);
|
||||||
if (color_count > MaxColorLayers)
|
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);
|
conn._readValue(uv_count);
|
||||||
if (uv_count > MaxUVLayers)
|
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 */
|
/* Simultaneously load topology objects and build unique mapping indices */
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,7 @@ bool CVar::fromVec2f(const atVec2f& val) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
athena::simd_floats f(val.simd);
|
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;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ bool CVar::fromVec2d(const atVec2d& val) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
athena::simd_doubles f(val.simd);
|
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;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ bool CVar::fromVec3f(const atVec3f& val) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
athena::simd_floats f(val.simd);
|
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;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ bool CVar::fromVec3d(const atVec3d& val) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
athena::simd_doubles f(val.simd);
|
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;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ bool CVar::fromVec4f(const atVec4f& val) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
athena::simd_floats f(val.simd);
|
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;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ bool CVar::fromVec4d(const atVec4d& val) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
athena::simd_doubles f(val.simd);
|
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;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ bool CVar::fromReal(double val) {
|
||||||
if (!safeToModify(EType::Real))
|
if (!safeToModify(EType::Real))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_value.assign(fmt::format(fmt("{}"), val));
|
m_value.assign(fmt::format(FMT_STRING("{}"), val));
|
||||||
setModified();
|
setModified();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ bool CVar::fromInteger(int32_t val) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Properly format based on signedness
|
// 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();
|
setModified();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ bool CVar::fromInteger(uint32_t val) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Properly format based on signedness
|
// 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();
|
setModified();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,13 +205,13 @@ CVarManager* CVarManager::instance() { return m_instance; }
|
||||||
void CVarManager::list(Console* con, const std::vector<std::string>& /*args*/) {
|
void CVarManager::list(Console* con, const std::vector<std::string>& /*args*/) {
|
||||||
for (const auto& cvar : m_cvars) {
|
for (const auto& cvar : m_cvars) {
|
||||||
if (!cvar.second->isHidden())
|
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) {
|
void CVarManager::setCVar(Console* con, const std::vector<std::string>& args) {
|
||||||
if (args.size() < 2) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ void CVarManager::setCVar(Console* con, const std::vector<std::string>& args) {
|
||||||
athena::utility::tolower(cvName);
|
athena::utility::tolower(cvName);
|
||||||
const auto iter = m_cvars.find(cvName);
|
const auto iter = m_cvars.find(cvName);
|
||||||
if (iter == m_cvars.end()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,14 +235,14 @@ void CVarManager::setCVar(Console* con, const std::vector<std::string>& args) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!cv->fromLiteralToType(value))
|
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
|
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) {
|
void CVarManager::getCVar(Console* con, const std::vector<std::string>& args) {
|
||||||
if (args.empty()) {
|
if (args.empty()) {
|
||||||
con->report(Console::Level::Info, fmt("Usage getCVar <cvar>"));
|
con->report(Console::Level::Info, FMT_STRING("Usage getCVar <cvar>"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,12 +250,12 @@ void CVarManager::getCVar(Console* con, const std::vector<std::string>& args) {
|
||||||
athena::utility::tolower(cvName);
|
athena::utility::tolower(cvName);
|
||||||
const auto iter = m_cvars.find(cvName);
|
const auto iter = m_cvars.find(cvName);
|
||||||
if (iter == m_cvars.end()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& cv = iter->second;
|
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) {
|
void CVarManager::setDeveloperMode(bool v, bool setDeserialized) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ static int GetCPUCount() {
|
||||||
void ClientProcess::BufferTransaction::run(blender::Token& btok) {
|
void ClientProcess::BufferTransaction::run(blender::Token& btok) {
|
||||||
athena::io::FileReader r(m_path.getAbsolutePath(), 32 * 1024, false);
|
athena::io::FileReader r(m_path.getAbsolutePath(), 32 * 1024, false);
|
||||||
if (r.hasError()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (m_offset)
|
if (m_offset)
|
||||||
|
@ -94,7 +94,7 @@ ClientProcess::Worker::Worker(ClientProcess& proc, int idx) : m_proc(proc), m_id
|
||||||
void ClientProcess::Worker::proc() {
|
void ClientProcess::Worker::proc() {
|
||||||
ClientProcess::ThreadWorker.reset(this);
|
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());
|
logvisor::RegisterThreadName(thrName.c_str());
|
||||||
|
|
||||||
std::unique_lock lk{m_proc.m_mutex};
|
std::unique_lock lk{m_proc.m_mutex};
|
||||||
|
@ -180,24 +180,24 @@ bool ClientProcess::syncCook(const hecl::ProjectPath& path, Database::IDataSpec*
|
||||||
if (m_progPrinter) {
|
if (m_progPrinter) {
|
||||||
hecl::SystemString str;
|
hecl::SystemString str;
|
||||||
if (path.getAuxInfo().empty())
|
if (path.getAuxInfo().empty())
|
||||||
str = fmt::format(fmt(_SYS_STR("Cooking {}")), path.getRelativePath());
|
str = fmt::format(FMT_STRING(_SYS_STR("Cooking {}")), path.getRelativePath());
|
||||||
else
|
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->print(str.c_str(), nullptr, -1.f, hecl::ClientProcess::GetThreadWorkerIdx());
|
||||||
m_progPrinter->flush();
|
m_progPrinter->flush();
|
||||||
} else {
|
} else {
|
||||||
if (path.getAuxInfo().empty())
|
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
|
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*) {});
|
spec->doCook(path, cooked, false, btok, [](const SystemChar*) {});
|
||||||
if (m_progPrinter) {
|
if (m_progPrinter) {
|
||||||
hecl::SystemString str;
|
hecl::SystemString str;
|
||||||
if (path.getAuxInfo().empty())
|
if (path.getAuxInfo().empty())
|
||||||
str = fmt::format(fmt(_SYS_STR("Cooked {}")), path.getRelativePath());
|
str = fmt::format(FMT_STRING(_SYS_STR("Cooked {}")), path.getRelativePath());
|
||||||
else
|
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->print(str.c_str(), nullptr, -1.f, hecl::ClientProcess::GetThreadWorkerIdx());
|
||||||
m_progPrinter->flush();
|
m_progPrinter->flush();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,15 +54,15 @@ struct ShaderCompiler<PlatformType::Vulkan> {
|
||||||
const char* strings[] = {"#version 330\n", BOO_GLSL_BINDING_HEAD, text.data()};
|
const char* strings[] = {"#version 330\n", BOO_GLSL_BINDING_HEAD, text.data()};
|
||||||
shader.setStrings(strings, 3);
|
shader.setStrings(strings, 3);
|
||||||
if (!shader.parse(&glslang::DefaultTBuiltInResource, 110, false, messages)) {
|
if (!shader.parse(&glslang::DefaultTBuiltInResource, 110, false, messages)) {
|
||||||
fmt::print(fmt("{}\n"), text);
|
fmt::print(FMT_STRING("{}\n"), text);
|
||||||
Log.report(logvisor::Fatal, fmt("unable to compile shader\n{}"), shader.getInfoLog());
|
Log.report(logvisor::Fatal, FMT_STRING("unable to compile shader\n{}"), shader.getInfoLog());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
glslang::TProgram prog;
|
glslang::TProgram prog;
|
||||||
prog.addShader(&shader);
|
prog.addShader(&shader);
|
||||||
if (!prog.link(messages)) {
|
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 {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ struct ShaderCompiler<PlatformType::D3D11> {
|
||||||
ComPtr<ID3DBlob> blobOut;
|
ComPtr<ID3DBlob> blobOut;
|
||||||
if (FAILED(D3DCompilePROC(text.data(), text.size(), "Boo HLSL Source", nullptr, nullptr, "main",
|
if (FAILED(D3DCompilePROC(text.data(), text.size(), "Boo HLSL Source", nullptr, nullptr, "main",
|
||||||
D3DShaderTypes[int(S::Enum)], BOO_D3DCOMPILE_FLAG, 0, &blobOut, &errBlob))) {
|
D3DShaderTypes[int(S::Enum)], BOO_D3DCOMPILE_FLAG, 0, &blobOut, &errBlob))) {
|
||||||
fmt::print(fmt("{}\n"), text);
|
fmt::print(FMT_STRING("{}\n"), text);
|
||||||
Log.report(logvisor::Fatal, fmt("error compiling shader: {}"), (char*)errBlob->GetBufferPointer());
|
Log.report(logvisor::Fatal, FMT_STRING("error compiling shader: {}"), (char*)errBlob->GetBufferPointer());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
std::pair<StageBinaryData, size_t> ret(MakeStageBinaryData(blobOut->GetBufferSize()), blobOut->GetBufferSize());
|
std::pair<StageBinaryData, size_t> ret(MakeStageBinaryData(blobOut->GetBufferSize()), blobOut->GetBufferSize());
|
||||||
|
@ -152,7 +152,7 @@ struct ShaderCompiler<PlatformType::Metal> {
|
||||||
|
|
||||||
pid_t pid = getpid();
|
pid_t pid = getpid();
|
||||||
const char* tmpdir = getenv("TMPDIR");
|
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 */
|
/* Pipe source write to compiler */
|
||||||
pid_t compilerPid = fork();
|
pid_t compilerPid = fork();
|
||||||
|
@ -171,7 +171,7 @@ struct ShaderCompiler<PlatformType::Metal> {
|
||||||
"-gline-tables-only", "-MO",
|
"-gline-tables-only", "-MO",
|
||||||
#endif
|
#endif
|
||||||
"-", nullptr);
|
"-", nullptr);
|
||||||
fmt::print(stderr, fmt("execlp fail {}\n"), strerror(errno));
|
fmt::print(stderr, FMT_STRING("execlp fail {}\n"), strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
close(compilerIn[0]);
|
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 */
|
/* 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);
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
close(compilerOut[0]);
|
close(compilerOut[0]);
|
||||||
|
@ -198,7 +198,7 @@ struct ShaderCompiler<PlatformType::Metal> {
|
||||||
while (inRem) {
|
while (inRem) {
|
||||||
ssize_t writeRes = write(compilerIn[1], inPtr, inRem);
|
ssize_t writeRes = write(compilerIn[1], inPtr, inRem);
|
||||||
if (writeRes < 0) {
|
if (writeRes < 0) {
|
||||||
fmt::print(stderr, fmt("write fail {}\n"), strerror(errno));
|
fmt::print(stderr, FMT_STRING("write fail {}\n"), strerror(errno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
inPtr += writeRes;
|
inPtr += writeRes;
|
||||||
|
@ -211,24 +211,24 @@ struct ShaderCompiler<PlatformType::Metal> {
|
||||||
while (waitpid(compilerPid, &compilerStat, 0) < 0) {
|
while (waitpid(compilerPid, &compilerStat, 0) < 0) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
Log.report(logvisor::Fatal, fmt("waitpid fail {}"), strerror(errno));
|
Log.report(logvisor::Fatal, FMT_STRING("waitpid fail {}"), strerror(errno));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WEXITSTATUS(compilerStat)) {
|
if (WEXITSTATUS(compilerStat)) {
|
||||||
Log.report(logvisor::Fatal, fmt("compile fail"));
|
Log.report(logvisor::Fatal, FMT_STRING("compile fail"));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
while (waitpid(linkerPid, &linkerStat, 0) < 0) {
|
while (waitpid(linkerPid, &linkerStat, 0) < 0) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
Log.report(logvisor::Fatal, fmt("waitpid fail {}"), strerror(errno));
|
Log.report(logvisor::Fatal, FMT_STRING("waitpid fail {}"), strerror(errno));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WEXITSTATUS(linkerStat)) {
|
if (WEXITSTATUS(linkerStat)) {
|
||||||
Log.report(logvisor::Fatal, fmt("link fail"));
|
Log.report(logvisor::Fatal, FMT_STRING("link fail"));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ void Console::executeString(const std::string& str) {
|
||||||
|
|
||||||
if (isInLiteral) {
|
if (isInLiteral) {
|
||||||
if ((curLiteral.back() != '\'' && curLiteral.back() != '"') || depth > 1) {
|
if ((curLiteral.back() != '\'' && curLiteral.back() != '"') || depth > 1) {
|
||||||
report(Level::Warning, fmt("Unterminated string literal"));
|
report(Level::Warning, FMT_STRING("Unterminated string literal"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
args.push_back(std::move(curLiteral));
|
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()) {
|
if (const auto iter = m_commands.find(lowComName); iter != m_commands.end()) {
|
||||||
const SConsoleCommand& cmd = iter->second;
|
const SConsoleCommand& cmd = iter->second;
|
||||||
if (bool(cmd.m_flags & SConsoleCommand::ECommandFlags::Developer) && !com_developer->toBoolean()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bool(cmd.m_flags & SConsoleCommand::ECommandFlags::Cheat) && !com_enableCheats->toBoolean()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
cmd.m_func(this, args);
|
cmd.m_func(this, args);
|
||||||
|
@ -139,32 +139,32 @@ void Console::executeString(const std::string& str) {
|
||||||
else
|
else
|
||||||
m_cvarMgr->getCVar(this, args);
|
m_cvarMgr->getCVar(this, args);
|
||||||
} else {
|
} 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) {
|
void Console::help(Console* /*con*/, const std::vector<std::string>& args) {
|
||||||
if (args.empty()) {
|
if (args.empty()) {
|
||||||
report(Level::Info, fmt("Expected usage: help <command>"));
|
report(Level::Info, FMT_STRING("Expected usage: help <command>"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string cmd = args.front();
|
std::string cmd = args.front();
|
||||||
athena::utility::tolower(cmd);
|
athena::utility::tolower(cmd);
|
||||||
auto it = m_commands.find(cmd);
|
auto it = m_commands.find(cmd);
|
||||||
if (it == m_commands.end()) {
|
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;
|
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())
|
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*/) {
|
void Console::listCommands(Console* /*con*/, const std::vector<std::string>& /*args*/) {
|
||||||
for (const auto& comPair : m_commands)
|
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 {
|
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) {
|
for (std::string& line : lines) {
|
||||||
m_log.emplace_back(std::move(line), level);
|
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) {
|
void Console::init(boo::IWindow* window) {
|
||||||
|
@ -197,7 +197,7 @@ void Console::proc() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_state == State::Opened) {
|
if (m_state == State::Opened) {
|
||||||
fmt::print(fmt("\r{} "), m_commandString);
|
fmt::print(FMT_STRING("\r{} "), m_commandString);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
} else if (m_state == State::Opening)
|
} else if (m_state == State::Opening)
|
||||||
m_state = State::Opened;
|
m_state = State::Opened;
|
||||||
|
@ -301,7 +301,7 @@ void Console::handleSpecialKeyDown(boo::ESpecialKey sp, boo::EModifierKey mod, b
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case boo::ESpecialKey::Enter: {
|
case boo::ESpecialKey::Enter: {
|
||||||
fmt::print(fmt("\n"));
|
fmt::print(FMT_STRING("\n"));
|
||||||
executeString(m_commandString);
|
executeString(m_commandString);
|
||||||
m_cursorPosition = -1;
|
m_cursorPosition = -1;
|
||||||
m_commandHistory.insert(m_commandHistory.begin(), m_commandString);
|
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);
|
auto tmp = fmt::internal::vformat(format, args);
|
||||||
std::vector<std::string> lines = athena::utility::split(tmp, '\n');
|
std::vector<std::string> lines = athena::utility::split(tmp, '\n');
|
||||||
for (const std::string& line : lines) {
|
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));
|
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);
|
auto tmp = fmt::internal::vformat(format, args);
|
||||||
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
|
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
|
||||||
for (const std::string& line : lines) {
|
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));
|
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,
|
void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level severity, const char* file,
|
||||||
unsigned linenum, fmt::string_view format, fmt::format_args args) {
|
unsigned linenum, fmt::string_view format, fmt::format_args args) {
|
||||||
auto tmp = fmt::internal::vformat(format, 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));
|
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);
|
auto tmp = fmt::internal::vformat(format, args);
|
||||||
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
|
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
|
||||||
for (const std::string& line : lines) {
|
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));
|
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) {
|
for (const auto& l : m_log) {
|
||||||
switch (l.second) {
|
switch (l.second) {
|
||||||
case Level::Info:
|
case Level::Info:
|
||||||
fmt::print(fmt("{}\n"), l.first);
|
fmt::print(FMT_STRING("{}\n"), l.first);
|
||||||
break;
|
break;
|
||||||
case Level::Warning:
|
case Level::Warning:
|
||||||
fmt::print(fmt("[Warning] {}\n"), l.first);
|
fmt::print(FMT_STRING("[Warning] {}\n"), l.first);
|
||||||
break;
|
break;
|
||||||
case Level::Error:
|
case Level::Error:
|
||||||
fmt::print(fmt("[ Error ] {}\n"), l.first);
|
fmt::print(FMT_STRING("[ Error ] {}\n"), l.first);
|
||||||
break;
|
break;
|
||||||
case Level::Fatal:
|
case Level::Fatal:
|
||||||
fmt::print(fmt("[ Fatal ] {}\n"), l.first);
|
fmt::print(FMT_STRING("[ Fatal ] {}\n"), l.first);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ std::string HumanizeNumber(int64_t quotient, size_t len, const char* suffix, int
|
||||||
if (suffix == nullptr)
|
if (suffix == nullptr)
|
||||||
suffix = "";
|
suffix = "";
|
||||||
if ((flags & HNFlags::Divisor1000) != HNFlags::None && (flags & HNFlags::IECPrefixes) != HNFlags::None)
|
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 */
|
/* setup parameters */
|
||||||
remainder = 0;
|
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 */
|
/* Check if enough room for `x y' + suffix */
|
||||||
if (len < baselen)
|
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;
|
len += 1;
|
||||||
|
|
||||||
if ((scale & int(HNScale::AutoScale)) != 0) {
|
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) {
|
(flags & HNFlags::Decimal) != HNFlags::None) {
|
||||||
s1 = (int)quotient + ((remainder * 10 + divisor / 2) / divisor / 10);
|
s1 = (int)quotient + ((remainder * 10 + divisor / 2) / divisor / 10);
|
||||||
s2 = ((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
|
} 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);
|
SCALE2PREFIX(i), suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,20 +38,20 @@ void MultiProgressPrinter::ThreadStat::print(const TermInfo& tinfo) const {
|
||||||
|
|
||||||
if (submessageLen) {
|
if (submessageLen) {
|
||||||
if (messageLen > half - submessageLen - 1)
|
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 {
|
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)
|
for (int i = half - messageLen - submessageLen - 1; i >= 0; --i)
|
||||||
fmt::print(fmt(_SYS_STR(" ")));
|
fmt::print(FMT_STRING(_SYS_STR(" ")));
|
||||||
fmt::print(fmt(_SYS_STR("{} ")), m_submessage);
|
fmt::print(FMT_STRING(_SYS_STR("{} ")), m_submessage);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (messageLen > half)
|
if (messageLen > half)
|
||||||
fmt::print(fmt(_SYS_STR(" {:.{}}... ")), m_message, half - 3);
|
fmt::print(FMT_STRING(_SYS_STR(" {:.{}}... ")), m_message, half - 3);
|
||||||
else {
|
else {
|
||||||
fmt::print(fmt(_SYS_STR(" {}")), m_message);
|
fmt::print(FMT_STRING(_SYS_STR(" {}")), m_message);
|
||||||
for (int i = half - messageLen; i >= 0; --i)
|
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;
|
int rem = nblocks - filled;
|
||||||
|
|
||||||
if (tinfo.xtermColor) {
|
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)
|
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)
|
for (int b = 0; b < rem; ++b)
|
||||||
fmt::print(fmt(_SYS_STR("-")));
|
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||||
fmt::print(fmt(_SYS_STR("]" NORMAL "")));
|
fmt::print(FMT_STRING(_SYS_STR("]" NORMAL "")));
|
||||||
} else {
|
} else {
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
SetConsoleTextAttribute(tinfo.console, FOREGROUND_INTENSITY | FOREGROUND_WHITE);
|
SetConsoleTextAttribute(tinfo.console, FOREGROUND_INTENSITY | FOREGROUND_WHITE);
|
||||||
#endif
|
#endif
|
||||||
fmt::print(fmt(_SYS_STR("{:3d}% [")), iFactor);
|
fmt::print(FMT_STRING(_SYS_STR("{:3d}% [")), iFactor);
|
||||||
for (int b = 0; b < filled; ++b)
|
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)
|
for (int b = 0; b < rem; ++b)
|
||||||
fmt::print(fmt(_SYS_STR("-")));
|
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||||
fmt::print(fmt(_SYS_STR("]")));
|
fmt::print(FMT_STRING(_SYS_STR("]")));
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
SetConsoleTextAttribute(tinfo.console, FOREGROUND_WHITE);
|
SetConsoleTextAttribute(tinfo.console, FOREGROUND_WHITE);
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,24 +100,24 @@ void MultiProgressPrinter::DrawIndeterminateBar() {
|
||||||
int rem = blocks - pre - 1;
|
int rem = blocks - pre - 1;
|
||||||
|
|
||||||
if (m_termInfo.xtermColor) {
|
if (m_termInfo.xtermColor) {
|
||||||
fmt::print(fmt(_SYS_STR("" BOLD " [")));
|
fmt::print(FMT_STRING(_SYS_STR("" BOLD " [")));
|
||||||
for (int b = 0; b < pre; ++b)
|
for (int b = 0; b < pre; ++b)
|
||||||
fmt::print(fmt(_SYS_STR("-")));
|
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||||
fmt::print(fmt(_SYS_STR("#")));
|
fmt::print(FMT_STRING(_SYS_STR("#")));
|
||||||
for (int b = 0; b < rem; ++b)
|
for (int b = 0; b < rem; ++b)
|
||||||
fmt::print(fmt(_SYS_STR("-")));
|
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||||
fmt::print(fmt(_SYS_STR("]" NORMAL "")));
|
fmt::print(FMT_STRING(_SYS_STR("]" NORMAL "")));
|
||||||
} else {
|
} else {
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_INTENSITY | FOREGROUND_WHITE);
|
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_INTENSITY | FOREGROUND_WHITE);
|
||||||
#endif
|
#endif
|
||||||
fmt::print(fmt(_SYS_STR(" [")));
|
fmt::print(FMT_STRING(_SYS_STR(" [")));
|
||||||
for (int b = 0; b < pre; ++b)
|
for (int b = 0; b < pre; ++b)
|
||||||
fmt::print(fmt(_SYS_STR("-")));
|
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||||
fmt::print(fmt(_SYS_STR("#")));
|
fmt::print(FMT_STRING(_SYS_STR("#")));
|
||||||
for (int b = 0; b < rem; ++b)
|
for (int b = 0; b < rem; ++b)
|
||||||
fmt::print(fmt(_SYS_STR("-")));
|
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||||
fmt::print(fmt(_SYS_STR("]")));
|
fmt::print(FMT_STRING(_SYS_STR("]")));
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_WHITE);
|
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_WHITE);
|
||||||
#endif
|
#endif
|
||||||
|
@ -127,7 +127,7 @@ void MultiProgressPrinter::DrawIndeterminateBar() {
|
||||||
void MultiProgressPrinter::MoveCursorUp(int n) {
|
void MultiProgressPrinter::MoveCursorUp(int n) {
|
||||||
if (n) {
|
if (n) {
|
||||||
if (m_termInfo.xtermColor) {
|
if (m_termInfo.xtermColor) {
|
||||||
fmt::print(fmt(_SYS_STR("" PREV_LINE "")), n);
|
fmt::print(FMT_STRING(_SYS_STR("" PREV_LINE "")), n);
|
||||||
}
|
}
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
else {
|
else {
|
||||||
|
@ -139,7 +139,7 @@ void MultiProgressPrinter::MoveCursorUp(int n) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} 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);
|
SetConsoleCursorInfo(m_termInfo.console, &cursorInfo);
|
||||||
#endif
|
#endif
|
||||||
if (m_termInfo.xtermColor)
|
if (m_termInfo.xtermColor)
|
||||||
fmt::print(fmt(_SYS_STR("" HIDE_CURSOR "")));
|
fmt::print(FMT_STRING(_SYS_STR("" HIDE_CURSOR "")));
|
||||||
|
|
||||||
if (m_dirty) {
|
if (m_dirty) {
|
||||||
m_termInfo.width = (hecl::GuiMode ? 120 : std::max(80, hecl::ConsoleWidth(&m_termInfo.truncate)));
|
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) {
|
for (const ThreadStat& stat : m_threadStats) {
|
||||||
if (stat.m_active) {
|
if (stat.m_active) {
|
||||||
stat.print(m_termInfo);
|
stat.print(m_termInfo);
|
||||||
fmt::print(fmt(_SYS_STR("\n")));
|
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||||
++m_curThreadLines;
|
++m_curThreadLines;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ void MultiProgressPrinter::DoPrint() {
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
DrawIndeterminateBar();
|
DrawIndeterminateBar();
|
||||||
fmt::print(fmt(_SYS_STR("\n")));
|
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||||
++m_curProgLines;
|
++m_curProgLines;
|
||||||
} else if (m_mainFactor >= 0.f) {
|
} else if (m_mainFactor >= 0.f) {
|
||||||
float factor = std::max(0.0f, std::min(1.0f, m_mainFactor));
|
float factor = std::max(0.0f, std::min(1.0f, m_mainFactor));
|
||||||
|
@ -191,34 +191,34 @@ void MultiProgressPrinter::DoPrint() {
|
||||||
int rem = blocks - filled;
|
int rem = blocks - filled;
|
||||||
|
|
||||||
if (m_termInfo.xtermColor) {
|
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)
|
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)
|
for (int b = 0; b < rem; ++b)
|
||||||
fmt::print(fmt(_SYS_STR("-")));
|
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||||
fmt::print(fmt(_SYS_STR("]" NORMAL "")));
|
fmt::print(FMT_STRING(_SYS_STR("]" NORMAL "")));
|
||||||
} else {
|
} else {
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_INTENSITY | FOREGROUND_WHITE);
|
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_INTENSITY | FOREGROUND_WHITE);
|
||||||
#endif
|
#endif
|
||||||
fmt::print(fmt(_SYS_STR(" {:3d}% [")), iFactor);
|
fmt::print(FMT_STRING(_SYS_STR(" {:3d}% [")), iFactor);
|
||||||
for (int b = 0; b < filled; ++b)
|
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)
|
for (int b = 0; b < rem; ++b)
|
||||||
fmt::print(fmt(_SYS_STR("-")));
|
fmt::print(FMT_STRING(_SYS_STR("-")));
|
||||||
fmt::print(fmt(_SYS_STR("]")));
|
fmt::print(FMT_STRING(_SYS_STR("]")));
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_WHITE);
|
SetConsoleTextAttribute(m_termInfo.console, FOREGROUND_WHITE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::print(fmt(_SYS_STR("\n")));
|
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||||
++m_curProgLines;
|
++m_curProgLines;
|
||||||
}
|
}
|
||||||
} else if (m_latestThread != -1) {
|
} else if (m_latestThread != -1) {
|
||||||
const ThreadStat& stat = m_threadStats[m_latestThread];
|
const ThreadStat& stat = m_threadStats[m_latestThread];
|
||||||
stat.print(m_termInfo);
|
stat.print(m_termInfo);
|
||||||
fmt::print(fmt(_SYS_STR("\r")));
|
fmt::print(FMT_STRING(_SYS_STR("\r")));
|
||||||
}
|
}
|
||||||
m_dirty = false;
|
m_dirty = false;
|
||||||
} else if (m_mainIndeterminate
|
} else if (m_mainIndeterminate
|
||||||
|
@ -230,12 +230,12 @@ void MultiProgressPrinter::DoPrint() {
|
||||||
MoveCursorUp(m_curProgLines);
|
MoveCursorUp(m_curProgLines);
|
||||||
m_curProgLines = 0;
|
m_curProgLines = 0;
|
||||||
DrawIndeterminateBar();
|
DrawIndeterminateBar();
|
||||||
fmt::print(fmt(_SYS_STR("\n")));
|
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||||
++m_curProgLines;
|
++m_curProgLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_termInfo.xtermColor)
|
if (m_termInfo.xtermColor)
|
||||||
fmt::print(fmt(_SYS_STR("" SHOW_CURSOR "")));
|
fmt::print(FMT_STRING(_SYS_STR("" SHOW_CURSOR "")));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
|
@ -354,7 +354,7 @@ void MultiProgressPrinter::startNewLine() const {
|
||||||
m_curThreadLines = 0;
|
m_curThreadLines = 0;
|
||||||
m_mainFactor = -1.f;
|
m_mainFactor = -1.f;
|
||||||
auto logLk = logvisor::LockLog();
|
auto logLk = logvisor::LockLog();
|
||||||
fmt::print(fmt(_SYS_STR("\n")));
|
fmt::print(FMT_STRING(_SYS_STR("\n")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiProgressPrinter::flush() const {
|
void MultiProgressPrinter::flush() const {
|
||||||
|
|
|
@ -94,7 +94,7 @@ void Project::ConfigFile::addLine(std::string_view line) {
|
||||||
|
|
||||||
void Project::ConfigFile::removeLine(std::string_view refLine) {
|
void Project::ConfigFile::removeLine(std::string_view refLine) {
|
||||||
if (!m_lockedFile) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ void Project::ConfigFile::removeLine(std::string_view refLine) {
|
||||||
|
|
||||||
bool Project::ConfigFile::checkForLine(std::string_view refLine) const {
|
bool Project::ConfigFile::checkForLine(std::string_view refLine) const {
|
||||||
if (!m_lockedFile) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ bool Project::ConfigFile::checkForLine(std::string_view refLine) const {
|
||||||
|
|
||||||
void Project::ConfigFile::unlockAndDiscard() {
|
void Project::ConfigFile::unlockAndDiscard() {
|
||||||
if (m_lockedFile == nullptr) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ void Project::ConfigFile::unlockAndDiscard() {
|
||||||
|
|
||||||
bool Project::ConfigFile::unlockAndCommit() {
|
bool Project::ConfigFile::unlockAndCommit() {
|
||||||
if (!m_lockedFile) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,12 +181,12 @@ Project::Project(const ProjectRootPath& rootPath)
|
||||||
/* Stat for existing project directory (must already exist) */
|
/* Stat for existing project directory (must already exist) */
|
||||||
Sstat myStat;
|
Sstat myStat;
|
||||||
if (hecl::Stat(m_rootPath.getAbsolutePath().data(), &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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!S_ISDIR(myStat.st_mode)) {
|
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());
|
m_rootPath.getAbsolutePath());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ Project::Project(const ProjectRootPath& rootPath)
|
||||||
bf.reset();
|
bf.reset();
|
||||||
|
|
||||||
if (beacon.magic != HECLfcc || SBig(beacon.version) != DATA_VERSION) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ const ProjectPath& Project::getProjectCookedPath(const DataSpecEntry& spec) cons
|
||||||
for (const ProjectDataSpec& sp : m_compiledSpecs)
|
for (const ProjectDataSpec& sp : m_compiledSpecs)
|
||||||
if (&sp.spec == &spec)
|
if (&sp.spec == &spec)
|
||||||
return sp.cookedPath;
|
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;
|
return m_cookedRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ bool Project::packagePath(const ProjectPath& path, const hecl::MultiProgressPrin
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!specEntry)
|
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)
|
if (!m_lastPackageSpec || m_lastPackageSpec->getDataSpecEntry() != specEntry)
|
||||||
m_lastPackageSpec = specEntry->m_factory(*this, DataSpecTool::Package);
|
m_lastPackageSpec = specEntry->m_factory(*this, DataSpecTool::Package);
|
||||||
|
|
|
@ -21,7 +21,7 @@ static SystemString CanonRelPath(SystemStringView path) {
|
||||||
else if (match == _SYS_STR("..")) {
|
else if (match == _SYS_STR("..")) {
|
||||||
if (comps.empty()) {
|
if (comps.empty()) {
|
||||||
/* Unable to resolve outside project */
|
/* 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(".");
|
return _SYS_STR(".");
|
||||||
}
|
}
|
||||||
comps.pop_back();
|
comps.pop_back();
|
||||||
|
@ -184,7 +184,7 @@ Time ProjectPath::getModtime() const {
|
||||||
return Time(latestTime);
|
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();
|
return Time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ FileStoreManager::FileStoreManager(SystemStringView domain) : m_domain(domain) {
|
||||||
#if !WINDOWS_STORE
|
#if !WINDOWS_STORE
|
||||||
WCHAR home[MAX_PATH];
|
WCHAR home[MAX_PATH];
|
||||||
if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, home)))
|
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);
|
SystemString path(home);
|
||||||
#else
|
#else
|
||||||
|
@ -40,22 +40,22 @@ FileStoreManager::FileStoreManager(SystemStringView domain) : m_domain(domain) {
|
||||||
std::string path;
|
std::string path;
|
||||||
if (xdg_data_home) {
|
if (xdg_data_home) {
|
||||||
if (xdg_data_home[0] != '/')
|
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;
|
path = xdg_data_home;
|
||||||
} else {
|
} else {
|
||||||
const char* home = getenv("HOME");
|
const char* home = getenv("HOME");
|
||||||
if (!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 = home;
|
||||||
path += "/.local/share";
|
path += "/.local/share";
|
||||||
}
|
}
|
||||||
path += "/hecl";
|
path += "/hecl";
|
||||||
if (mkdir(path.c_str(), 0755) && errno != EEXIST)
|
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 += '/';
|
||||||
path += domain.data();
|
path += domain.data();
|
||||||
if (mkdir(path.c_str(), 0755) && errno != EEXIST)
|
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;
|
m_storeRoot = path;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ HMDLData::HMDLData(boo::IGraphicsDataFactory::Context& ctx, const void* metaData
|
||||||
meta.read(r);
|
meta.read(r);
|
||||||
}
|
}
|
||||||
if (meta.magic != 'TACO')
|
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_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, vbo, meta.vertStride, meta.vertCount);
|
||||||
m_ibo = ctx.newStaticBuffer(boo::BufferUse::Index, ibo, 4, meta.indexCount);
|
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_uint8_t mb[4];
|
||||||
utf8proc_ssize_t c = utf8proc_encode_char(utf8proc_int32_t(ch), mb);
|
utf8proc_ssize_t c = utf8proc_encode_char(utf8proc_int32_t(ch), mb);
|
||||||
if (c < 0) {
|
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;
|
return retval;
|
||||||
}
|
}
|
||||||
retval.append(reinterpret_cast<char*>(mb), c);
|
retval.append(reinterpret_cast<char*>(mb), c);
|
||||||
|
@ -26,7 +26,7 @@ std::string Char16ToUTF8(std::u16string_view src) {
|
||||||
utf8proc_uint8_t mb[4];
|
utf8proc_uint8_t mb[4];
|
||||||
utf8proc_ssize_t c = utf8proc_encode_char(utf8proc_int32_t(ch), mb);
|
utf8proc_ssize_t c = utf8proc_encode_char(utf8proc_int32_t(ch), mb);
|
||||||
if (c < 0) {
|
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;
|
return retval;
|
||||||
}
|
}
|
||||||
retval.append(reinterpret_cast<char*>(mb), c);
|
retval.append(reinterpret_cast<char*>(mb), c);
|
||||||
|
@ -42,7 +42,7 @@ std::wstring UTF8ToWide(std::string_view src) {
|
||||||
utf8proc_int32_t wc;
|
utf8proc_int32_t wc;
|
||||||
utf8proc_ssize_t len = utf8proc_iterate(buf, -1, &wc);
|
utf8proc_ssize_t len = utf8proc_iterate(buf, -1, &wc);
|
||||||
if (len < 0) {
|
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;
|
return retval;
|
||||||
}
|
}
|
||||||
buf += len;
|
buf += len;
|
||||||
|
@ -59,7 +59,7 @@ std::u16string UTF8ToChar16(std::string_view src) {
|
||||||
utf8proc_int32_t wc;
|
utf8proc_int32_t wc;
|
||||||
utf8proc_ssize_t len = utf8proc_iterate(buf, -1, &wc);
|
utf8proc_ssize_t len = utf8proc_iterate(buf, -1, &wc);
|
||||||
if (len < 0) {
|
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;
|
return retval;
|
||||||
}
|
}
|
||||||
buf += len;
|
buf += len;
|
||||||
|
|
|
@ -107,7 +107,7 @@ SystemString GetcwdStr() {
|
||||||
}
|
}
|
||||||
if (errno != ERANGE) {
|
if (errno != ERANGE) {
|
||||||
// It's not ERANGE, so we don't know how to handle it
|
// 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
|
// Of course you may choose a different error reporting method
|
||||||
}
|
}
|
||||||
// Ok, the stack buffer isn't long enough; fallback to heap allocation
|
// Ok, the stack buffer isn't long enough; fallback to heap allocation
|
||||||
|
@ -121,11 +121,11 @@ SystemString GetcwdStr() {
|
||||||
}
|
}
|
||||||
if (errno != ERANGE) {
|
if (errno != ERANGE) {
|
||||||
// It's not ERANGE, so we don't know how to handle it
|
// 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
|
// 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();
|
return SystemString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ bool ResourceLock::InProgress(const ProjectPath& path) {
|
||||||
bool ResourceLock::SetThreadRes(const ProjectPath& path) {
|
bool ResourceLock::SetThreadRes(const ProjectPath& path) {
|
||||||
std::unique_lock lk{PathsMutex};
|
std::unique_lock lk{PathsMutex};
|
||||||
if (PathsInProgress.find(std::this_thread::get_id()) != PathsInProgress.cend()) {
|
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(),
|
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 consoleOutReadTmp = INVALID_HANDLE_VALUE;
|
||||||
HANDLE consoleOutWrite = INVALID_HANDLE_VALUE;
|
HANDLE consoleOutWrite = INVALID_HANDLE_VALUE;
|
||||||
if (!CreatePipe(&consoleOutReadTmp, &consoleOutWrite, &sattrs, 0)) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE consoleErrWrite = INVALID_HANDLE_VALUE;
|
HANDLE consoleErrWrite = INVALID_HANDLE_VALUE;
|
||||||
if (!DuplicateHandle(GetCurrentProcess(), consoleOutWrite, GetCurrentProcess(), &consoleErrWrite, 0, TRUE,
|
if (!DuplicateHandle(GetCurrentProcess(), consoleOutWrite, GetCurrentProcess(), &consoleErrWrite, 0, TRUE,
|
||||||
DUPLICATE_SAME_ACCESS)) {
|
DUPLICATE_SAME_ACCESS)) {
|
||||||
LogModule.report(logvisor::Fatal, fmt("Error with DuplicateHandle"));
|
LogModule.report(logvisor::Fatal, FMT_STRING("Error with DuplicateHandle"));
|
||||||
CloseHandle(consoleOutReadTmp);
|
CloseHandle(consoleOutReadTmp);
|
||||||
CloseHandle(consoleOutWrite);
|
CloseHandle(consoleOutWrite);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -731,7 +731,7 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
|
||||||
&consoleOutRead, // Address of new handle.
|
&consoleOutRead, // Address of new handle.
|
||||||
0, FALSE, // Make it uninheritable.
|
0, FALSE, // Make it uninheritable.
|
||||||
DUPLICATE_SAME_ACCESS)) {
|
DUPLICATE_SAME_ACCESS)) {
|
||||||
LogModule.report(logvisor::Fatal, fmt("Error with DuplicateHandle"));
|
LogModule.report(logvisor::Fatal, FMT_STRING("Error with DuplicateHandle"));
|
||||||
CloseHandle(consoleOutReadTmp);
|
CloseHandle(consoleOutReadTmp);
|
||||||
CloseHandle(consoleOutWrite);
|
CloseHandle(consoleOutWrite);
|
||||||
CloseHandle(consoleErrWrite);
|
CloseHandle(consoleErrWrite);
|
||||||
|
@ -762,7 +762,7 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
|
||||||
LPWSTR messageBuffer = nullptr;
|
LPWSTR messageBuffer = nullptr;
|
||||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 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);
|
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);
|
LocalFree(messageBuffer);
|
||||||
|
|
||||||
CloseHandle(nulHandle);
|
CloseHandle(nulHandle);
|
||||||
|
@ -788,13 +788,13 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
|
||||||
if (err == ERROR_BROKEN_PIPE)
|
if (err == ERROR_BROKEN_PIPE)
|
||||||
break; // pipe done - normal exit path.
|
break; // pipe done - normal exit path.
|
||||||
else
|
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.
|
// Display the character read on the screen.
|
||||||
auto lk = logvisor::LockLog();
|
auto lk = logvisor::LockLog();
|
||||||
if (!WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), lpBuffer, nBytesRead, &nCharsWritten, nullptr)) {
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,13 +43,13 @@ int main(int argc, const hecl::SystemChar** argv)
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
if (!FindBestD3DCompile()) {
|
if (!FindBestD3DCompile()) {
|
||||||
Log.report(logvisor::Info, fmt("Unable to find D3DCompiler dll"));
|
Log.report(logvisor::Info, FMT_STRING("Unable to find D3DCompiler dll"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
Log.report(logvisor::Info, fmt("Usage: shaderc -o <out-base> [-D definevar=defineval]... <in-files>..."));
|
Log.report(logvisor::Info, FMT_STRING("Usage: shaderc -o <out-base> [-D definevar=defineval]... <in-files>..."));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ int main(int argc, const hecl::SystemChar** argv)
|
||||||
++i;
|
++i;
|
||||||
outPath = argv[i];
|
outPath = argv[i];
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Error, fmt("Invalid -o argument"));
|
Log.report(logvisor::Error, FMT_STRING("Invalid -o argument"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if (argv[i][1] == 'D') {
|
} else if (argv[i][1] == 'D') {
|
||||||
|
@ -75,7 +75,7 @@ int main(int argc, const hecl::SystemChar** argv)
|
||||||
++i;
|
++i;
|
||||||
define = argv[i];
|
define = argv[i];
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Error, fmt("Invalid -D argument"));
|
Log.report(logvisor::Error, FMT_STRING("Invalid -D argument"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
hecl::SystemUTF8Conv conv(define);
|
hecl::SystemUTF8Conv conv(define);
|
||||||
|
@ -85,7 +85,7 @@ int main(int argc, const hecl::SystemChar** argv)
|
||||||
else
|
else
|
||||||
c.addDefine(defineU8, "");
|
c.addDefine(defineU8, "");
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unrecognized flag option '{:c}'")), argv[i][1]);
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Unrecognized flag option '{:c}'")), argv[i][1]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,7 +94,7 @@ int main(int argc, const hecl::SystemChar** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outPath.empty()) {
|
if (outPath.empty()) {
|
||||||
Log.report(logvisor::Error, fmt("-o option is required"));
|
Log.report(logvisor::Error, FMT_STRING("-o option is required"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ int main(int argc, const hecl::SystemChar** argv)
|
||||||
baseName = outPath;
|
baseName = outPath;
|
||||||
|
|
||||||
if (!glslang::InitializeProcess()) {
|
if (!glslang::InitializeProcess()) {
|
||||||
Log.report(logvisor::Error, fmt("Unable to initialize glslang"));
|
Log.report(logvisor::Error, FMT_STRING("Unable to initialize glslang"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ int main(int argc, const hecl::SystemChar** argv)
|
||||||
hecl::SystemString headerPath = outPath + _SYS_STR(".hpp");
|
hecl::SystemString headerPath = outPath + _SYS_STR(".hpp");
|
||||||
athena::io::FileWriter w(headerPath);
|
athena::io::FileWriter w(headerPath);
|
||||||
if (w.hasError()) {
|
if (w.hasError()) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Error opening '{}' for writing")), headerPath);
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Error opening '{}' for writing")), headerPath);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
std::string header = ret.first.str();
|
std::string header = ret.first.str();
|
||||||
|
@ -130,7 +130,7 @@ int main(int argc, const hecl::SystemChar** argv)
|
||||||
hecl::SystemString impPath = outPath + _SYS_STR(".cpp");
|
hecl::SystemString impPath = outPath + _SYS_STR(".cpp");
|
||||||
athena::io::FileWriter w(impPath);
|
athena::io::FileWriter w(impPath);
|
||||||
if (w.hasError()) {
|
if (w.hasError()) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Error opening '{}' for writing")), impPath);
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Error opening '{}' for writing")), impPath);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
std::string source = ret.second.str();
|
std::string source = ret.second.str();
|
||||||
|
|
|
@ -29,6 +29,7 @@ static const char* StageNames[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string* Compiler::getFileContents(SystemStringView path) {
|
const std::string* Compiler::getFileContents(SystemStringView path) {
|
||||||
|
// TODO: Heterogeneous lookup when C++20 available
|
||||||
auto search = m_fileContents.find(path.data());
|
auto search = m_fileContents.find(path.data());
|
||||||
if (search == m_fileContents.end()) {
|
if (search == m_fileContents.end()) {
|
||||||
athena::io::FileReader r(path);
|
athena::io::FileReader r(path);
|
||||||
|
@ -48,7 +49,7 @@ void Compiler::addInputFile(SystemStringView file) {
|
||||||
|
|
||||||
void Compiler::addDefine(std::string_view var, std::string_view val) { m_defines[var.data()] = val; }
|
void Compiler::addDefine(std::string_view var, std::string_view val) { m_defines[var.data()] = val; }
|
||||||
|
|
||||||
constexpr auto ShaderHeaderTemplate = fmt(
|
constexpr auto ShaderHeaderTemplate = FMT_STRING(
|
||||||
"class Shader_{} : public hecl::GeneralShader\n"
|
"class Shader_{} : public hecl::GeneralShader\n"
|
||||||
"{{\n"
|
"{{\n"
|
||||||
"public:\n"
|
"public:\n"
|
||||||
|
@ -61,7 +62,7 @@ constexpr auto ShaderHeaderTemplate = fmt(
|
||||||
" static constexpr uint64_t StageHash();\n"
|
" static constexpr uint64_t StageHash();\n"
|
||||||
"}};\n\n");
|
"}};\n\n");
|
||||||
|
|
||||||
constexpr auto StageObjectHeaderTemplate = fmt(
|
constexpr auto StageObjectHeaderTemplate = FMT_STRING(
|
||||||
"template<typename P, typename S>\n"
|
"template<typename P, typename S>\n"
|
||||||
"class StageObject_{} : public hecl::StageBinary<P, S>\n"
|
"class StageObject_{} : public hecl::StageBinary<P, S>\n"
|
||||||
"{{\n"
|
"{{\n"
|
||||||
|
@ -72,7 +73,7 @@ constexpr auto StageObjectHeaderTemplate = fmt(
|
||||||
"}};\n"
|
"}};\n"
|
||||||
"STAGEOBJECT_PROTOTYPE_DECLARATIONS(StageObject_{})\n\n");
|
"STAGEOBJECT_PROTOTYPE_DECLARATIONS(StageObject_{})\n\n");
|
||||||
|
|
||||||
constexpr auto StageObjectImplTemplate = fmt(
|
constexpr auto StageObjectImplTemplate = FMT_STRING(
|
||||||
"template<>\n"
|
"template<>\n"
|
||||||
"const hecl::StageBinary<hecl::PlatformType::{}, hecl::PipelineStage::{}>\n"
|
"const hecl::StageBinary<hecl::PlatformType::{}, hecl::PipelineStage::{}>\n"
|
||||||
"StageObject_{}<hecl::PlatformType::{}, hecl::PipelineStage::{}>::Prototype = \n"
|
"StageObject_{}<hecl::PlatformType::{}, hecl::PipelineStage::{}>::Prototype = \n"
|
||||||
|
@ -95,11 +96,11 @@ struct CompileStageAction {
|
||||||
if (data.second == 0)
|
if (data.second == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
fmt::print(out, fmt("static const uint8_t {}_{}_{}_data[] = {{\n"), name, P::Name, S::Name);
|
fmt::print(out, FMT_STRING("static const uint8_t {}_{}_{}_data[] = {{\n"), name, P::Name, S::Name);
|
||||||
for (size_t i = 0; i < data.second;) {
|
for (size_t i = 0; i < data.second;) {
|
||||||
out << " ";
|
out << " ";
|
||||||
for (int j = 0; j < 10 && i < data.second; ++i, ++j)
|
for (int j = 0; j < 10 && i < data.second; ++i, ++j)
|
||||||
fmt::print(out, fmt("0x{:02X}, "), data.first.get()[i]);
|
fmt::print(out, FMT_STRING("0x{:02X}, "), data.first.get()[i]);
|
||||||
out << "\n";
|
out << "\n";
|
||||||
}
|
}
|
||||||
out << "};\n\n";
|
out << "};\n\n";
|
||||||
|
@ -127,7 +128,7 @@ bool Compiler::StageAction(StageType type, const std::string& name, const std::s
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Log.report(logvisor::Error, fmt("Unknown stage type"));
|
Log.report(logvisor::Error, FMT_STRING("Unknown stage type"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +173,7 @@ bool Compiler::StageAction(const std::string& platforms, StageType type, const s
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Error, fmt("Unknown platform '{}'"), plat);
|
Log.report(logvisor::Error, FMT_STRING("Unknown platform '{}'"), plat);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
begin = match.suffix().first;
|
begin = match.suffix().first;
|
||||||
|
@ -208,13 +209,13 @@ static const std::regex regEvaluation(R"(#\s*evaluation\s+(.*))", RegexFlags);
|
||||||
|
|
||||||
bool Compiler::includeFile(SystemStringView file, std::string& out, int depth) {
|
bool Compiler::includeFile(SystemStringView file, std::string& out, int depth) {
|
||||||
if (depth > 32) {
|
if (depth > 32) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Too many levels of includes (>32) at '{}'")), file);
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Too many levels of includes (>32) at '{}'")), file);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string* data = getFileContents(file);
|
const std::string* data = getFileContents(file);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to access '{}'")), file);
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Unable to access '{}'")), file);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const std::string& sdata = *data;
|
const std::string& sdata = *data;
|
||||||
|
@ -240,7 +241,7 @@ bool Compiler::includeFile(SystemStringView file, std::string& out, int depth) {
|
||||||
if (std::regex_search(begin, nextBegin, subMatch, regInclude)) {
|
if (std::regex_search(begin, nextBegin, subMatch, regInclude)) {
|
||||||
std::string path = subMatch[1].str();
|
std::string path = subMatch[1].str();
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Empty path provided to include in '{}'")), file);
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Empty path provided to include in '{}'")), file);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +320,7 @@ inline bool StrToBlendFactor(std::string str, boo::BlendFactor& fac) {
|
||||||
else if (str == "subtract")
|
else if (str == "subtract")
|
||||||
fac = boo::BlendFactor::Subtract;
|
fac = boo::BlendFactor::Subtract;
|
||||||
else {
|
else {
|
||||||
Log.report(logvisor::Error, fmt("Unrecognized blend mode '{}'"), str);
|
Log.report(logvisor::Error, FMT_STRING("Unrecognized blend mode '{}'"), str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -346,7 +347,7 @@ inline bool StrToPrimitive(std::string str, boo::Primitive& prim) {
|
||||||
else if (str == "patches")
|
else if (str == "patches")
|
||||||
prim = boo::Primitive::Patches;
|
prim = boo::Primitive::Patches;
|
||||||
else {
|
else {
|
||||||
Log.report(logvisor::Error, fmt("Unrecognized primitive '{}'"), str);
|
Log.report(logvisor::Error, FMT_STRING("Unrecognized primitive '{}'"), str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -381,7 +382,7 @@ inline bool StrToZTest(std::string str, boo::ZTest& ztest) {
|
||||||
else if (str == "equal")
|
else if (str == "equal")
|
||||||
ztest = boo::ZTest::Equal;
|
ztest = boo::ZTest::Equal;
|
||||||
else {
|
else {
|
||||||
Log.report(logvisor::Error, fmt("Unrecognized ztest '{}'"), str);
|
Log.report(logvisor::Error, FMT_STRING("Unrecognized ztest '{}'"), str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -408,7 +409,7 @@ inline bool StrToCullMode(std::string str, boo::CullMode& cull) {
|
||||||
else if (str == "frontface")
|
else if (str == "frontface")
|
||||||
cull = boo::CullMode::Frontface;
|
cull = boo::CullMode::Frontface;
|
||||||
else {
|
else {
|
||||||
Log.report(logvisor::Error, fmt("Unrecognized cull mode '{}'"), str);
|
Log.report(logvisor::Error, FMT_STRING("Unrecognized cull mode '{}'"), str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -425,7 +426,7 @@ inline bool StrToBool(std::string str, bool& b) {
|
||||||
else if (str == "false")
|
else if (str == "false")
|
||||||
b = false;
|
b = false;
|
||||||
else {
|
else {
|
||||||
Log.report(logvisor::Error, fmt("Unrecognized bool '{}'"), str);
|
Log.report(logvisor::Error, FMT_STRING("Unrecognized bool '{}'"), str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -469,7 +470,7 @@ bool Compiler::compileFile(SystemStringView file, std::string_view baseName,
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (shaderName.empty()) {
|
if (shaderName.empty()) {
|
||||||
Log.report(logvisor::Error, fmt("`#shader <name>` must be issued before stages"));
|
Log.report(logvisor::Error, FMT_STRING("`#shader <name>` must be issued before stages"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::string stage(stageBegin, stageEnd);
|
std::string stage(stageBegin, stageEnd);
|
||||||
|
@ -533,48 +534,48 @@ bool Compiler::compileFile(SystemStringView file, std::string_view baseName,
|
||||||
shaderBase.clear();
|
shaderBase.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::print(out.second, fmt("static const boo::VertexElementDescriptor {}_vtxfmtelems[] = {{\n"), shaderName);
|
fmt::print(out.second, FMT_STRING("static const boo::VertexElementDescriptor {}_vtxfmtelems[] = {{\n"), shaderName);
|
||||||
for (const auto& attr : shaderAttributes) {
|
for (const auto& attr : shaderAttributes) {
|
||||||
switch (attr.first & boo::VertexSemantic::SemanticMask) {
|
switch (attr.first & boo::VertexSemantic::SemanticMask) {
|
||||||
case boo::VertexSemantic::Position3:
|
case boo::VertexSemantic::Position3:
|
||||||
SemanticOut(out.second, attr, fmt("{{boo::VertexSemantic::Position3{}, {}}},\n"));
|
SemanticOut(out.second, attr, FMT_STRING("{{boo::VertexSemantic::Position3{}, {}}},\n"));
|
||||||
break;
|
break;
|
||||||
case boo::VertexSemantic::Position4:
|
case boo::VertexSemantic::Position4:
|
||||||
SemanticOut(out.second, attr, fmt("{{boo::VertexSemantic::Position4{}, {}}},\n"));
|
SemanticOut(out.second, attr, FMT_STRING("{{boo::VertexSemantic::Position4{}, {}}},\n"));
|
||||||
break;
|
break;
|
||||||
case boo::VertexSemantic::Normal3:
|
case boo::VertexSemantic::Normal3:
|
||||||
SemanticOut(out.second, attr, fmt("{{boo::VertexSemantic::Normal3{}, {}}},\n"));
|
SemanticOut(out.second, attr, FMT_STRING("{{boo::VertexSemantic::Normal3{}, {}}},\n"));
|
||||||
break;
|
break;
|
||||||
case boo::VertexSemantic::Normal4:
|
case boo::VertexSemantic::Normal4:
|
||||||
SemanticOut(out.second, attr, fmt("{{boo::VertexSemantic::Normal4{}, {}}},\n"));
|
SemanticOut(out.second, attr, FMT_STRING("{{boo::VertexSemantic::Normal4{}, {}}},\n"));
|
||||||
break;
|
break;
|
||||||
case boo::VertexSemantic::Color:
|
case boo::VertexSemantic::Color:
|
||||||
SemanticOut(out.second, attr, fmt("{{boo::VertexSemantic::Color{}, {}}},\n"));
|
SemanticOut(out.second, attr, FMT_STRING("{{boo::VertexSemantic::Color{}, {}}},\n"));
|
||||||
break;
|
break;
|
||||||
case boo::VertexSemantic::ColorUNorm:
|
case boo::VertexSemantic::ColorUNorm:
|
||||||
SemanticOut(out.second, attr, fmt("{{boo::VertexSemantic::ColorUNorm{}, {}}},\n"));
|
SemanticOut(out.second, attr, FMT_STRING("{{boo::VertexSemantic::ColorUNorm{}, {}}},\n"));
|
||||||
break;
|
break;
|
||||||
case boo::VertexSemantic::UV2:
|
case boo::VertexSemantic::UV2:
|
||||||
SemanticOut(out.second, attr, fmt("{{boo::VertexSemantic::UV2{}, {}}},\n"));
|
SemanticOut(out.second, attr, FMT_STRING("{{boo::VertexSemantic::UV2{}, {}}},\n"));
|
||||||
break;
|
break;
|
||||||
case boo::VertexSemantic::UV4:
|
case boo::VertexSemantic::UV4:
|
||||||
SemanticOut(out.second, attr, fmt("{{boo::VertexSemantic::UV4{}, {}}},\n"));
|
SemanticOut(out.second, attr, FMT_STRING("{{boo::VertexSemantic::UV4{}, {}}},\n"));
|
||||||
break;
|
break;
|
||||||
case boo::VertexSemantic::Weight:
|
case boo::VertexSemantic::Weight:
|
||||||
SemanticOut(out.second, attr, fmt("{{boo::VertexSemantic::Weight{}, {}}},\n"));
|
SemanticOut(out.second, attr, FMT_STRING("{{boo::VertexSemantic::Weight{}, {}}},\n"));
|
||||||
break;
|
break;
|
||||||
case boo::VertexSemantic::ModelView:
|
case boo::VertexSemantic::ModelView:
|
||||||
SemanticOut(out.second, attr, fmt("{{boo::VertexSemantic::ModelView{}, {}}},\n"));
|
SemanticOut(out.second, attr, FMT_STRING("{{boo::VertexSemantic::ModelView{}, {}}},\n"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SemanticOut(out.second, attr, fmt("{{boo::VertexSemantic::None{}, {}}},\n"));
|
SemanticOut(out.second, attr, FMT_STRING("{{boo::VertexSemantic::None{}, {}}},\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out.second << "};\n";
|
out.second << "};\n";
|
||||||
fmt::print(out.second, fmt("const boo::VertexFormatInfo Shader_{}::VtxFmt = {{ {}_vtxfmtelems }};\n\n"),
|
fmt::print(out.second, FMT_STRING("const boo::VertexFormatInfo Shader_{}::VtxFmt = {{ {}_vtxfmtelems }};\n\n"),
|
||||||
shaderName, shaderName);
|
shaderName, shaderName);
|
||||||
fmt::print(out.second, fmt("const boo::AdditionalPipelineInfo Shader_{}::PipelineInfo = {{\n"), shaderName);
|
fmt::print(out.second, FMT_STRING("const boo::AdditionalPipelineInfo Shader_{}::PipelineInfo = {{\n"), shaderName);
|
||||||
out.second << BlendFactorToStr(shaderInfo.srcFac);
|
out.second << BlendFactorToStr(shaderInfo.srcFac);
|
||||||
out.second << ", ";
|
out.second << ", ";
|
||||||
out.second << BlendFactorToStr(shaderInfo.dstFac);
|
out.second << BlendFactorToStr(shaderInfo.dstFac);
|
||||||
|
@ -591,7 +592,7 @@ bool Compiler::compileFile(SystemStringView file, std::string_view baseName,
|
||||||
out.second << ", ";
|
out.second << ", ";
|
||||||
out.second << CullModeToStr(shaderInfo.culling);
|
out.second << CullModeToStr(shaderInfo.culling);
|
||||||
out.second << ", ";
|
out.second << ", ";
|
||||||
fmt::print(out.second, fmt("{}, "), shaderInfo.patchSize);
|
fmt::print(out.second, FMT_STRING("{}, "), shaderInfo.patchSize);
|
||||||
out.second << BoolToStr(shaderInfo.overwriteAlpha);
|
out.second << BoolToStr(shaderInfo.overwriteAlpha);
|
||||||
out.second << ", ";
|
out.second << ", ";
|
||||||
out.second << BoolToStr(shaderInfo.depthAttachment);
|
out.second << BoolToStr(shaderInfo.depthAttachment);
|
||||||
|
@ -631,7 +632,7 @@ bool Compiler::compileFile(SystemStringView file, std::string_view baseName,
|
||||||
else if (semantic == "modelview")
|
else if (semantic == "modelview")
|
||||||
shaderAttributes.push_back(std::make_pair(boo::VertexSemantic::ModelView | orsem, idxNum));
|
shaderAttributes.push_back(std::make_pair(boo::VertexSemantic::ModelView | orsem, idxNum));
|
||||||
else {
|
else {
|
||||||
Log.report(logvisor::Error, fmt("Unrecognized vertex semantic '{}'"), semantic);
|
Log.report(logvisor::Error, FMT_STRING("Unrecognized vertex semantic '{}'"), semantic);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -729,7 +730,7 @@ bool Compiler::compileFile(SystemStringView file, std::string_view baseName,
|
||||||
char* endptr;
|
char* endptr;
|
||||||
shaderInfo.patchSize = uint32_t(strtoul(str.c_str(), &endptr, 0));
|
shaderInfo.patchSize = uint32_t(strtoul(str.c_str(), &endptr, 0));
|
||||||
if (endptr == str.c_str()) {
|
if (endptr == str.c_str()) {
|
||||||
Log.report(logvisor::Error, fmt("Non-unsigned-integer value for #patchsize directive"));
|
Log.report(logvisor::Error, FMT_STRING("Non-unsigned-integer value for #patchsize directive"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (std::regex_search(begin, nextBegin, subMatch, regOverwriteAlpha)) {
|
} else if (std::regex_search(begin, nextBegin, subMatch, regOverwriteAlpha)) {
|
||||||
|
@ -767,7 +768,7 @@ bool Compiler::compileFile(SystemStringView file, std::string_view baseName,
|
||||||
if (shader.second.stageHashes[i]) {
|
if (shader.second.stageHashes[i]) {
|
||||||
out.first << "template <> constexpr uint64_t Shader_";
|
out.first << "template <> constexpr uint64_t Shader_";
|
||||||
out.first << shader.first;
|
out.first << shader.first;
|
||||||
fmt::print(out.first, fmt("::StageHash<{}>() {{ return 0x{:016X}; }}\n"),
|
fmt::print(out.first, FMT_STRING("::StageHash<{}>() {{ return 0x{:016X}; }}\n"),
|
||||||
StageNames[i], shader.second.stageHashes[i]);
|
StageNames[i], shader.second.stageHashes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -800,7 +801,7 @@ bool Compiler::compileFile(SystemStringView file, std::string_view baseName,
|
||||||
bool Compiler::compile(std::string_view baseName, std::pair<std::stringstream, std::stringstream>& out) {
|
bool Compiler::compile(std::string_view baseName, std::pair<std::stringstream, std::stringstream>& out) {
|
||||||
out.first << "#pragma once\n"
|
out.first << "#pragma once\n"
|
||||||
"#include \"hecl/PipelineBase.hpp\"\n\n";
|
"#include \"hecl/PipelineBase.hpp\"\n\n";
|
||||||
fmt::print(out.second, fmt("#include \"{}.hpp\"\n\n"), baseName);
|
fmt::print(out.second, FMT_STRING("#include \"{}.hpp\"\n\n"), baseName);
|
||||||
|
|
||||||
for (const auto& file : m_inputFiles)
|
for (const auto& file : m_inputFiles)
|
||||||
if (!compileFile(file, baseName, out))
|
if (!compileFile(file, baseName, out))
|
||||||
|
|
Loading…
Reference in New Issue