2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 12:24:56 +00:00

Windows sync fixes for API changes

This commit is contained in:
Jack Andersen
2018-10-14 10:09:15 -10:00
parent aef455e1ab
commit 61a50aa57e
33 changed files with 767 additions and 682 deletions

View File

@@ -59,9 +59,9 @@ protected:
if (!m_info.yes)
{
if (XTERM_COLOR)
hecl::Printf(_S("\n" BLUE BOLD "Continue?" NORMAL " (Y/n) "));
hecl::Printf(_SYS_STR("\n" BLUE BOLD "Continue?" NORMAL " (Y/n) "));
else
hecl::Printf(_S("\nContinue? (Y/n) "));
hecl::Printf(_SYS_STR("\nContinue? (Y/n) "));
fflush(stdout);
int ch;
@@ -78,7 +78,7 @@ protected:
{
if (ch == 'n' || ch == 'N')
{
hecl::Printf(_S("\n"));
hecl::Printf(_SYS_STR("\n"));
return false;
}
if (ch == 'y' || ch == 'Y' || ch == '\r' || ch == '\n')
@@ -88,7 +88,7 @@ protected:
tcsetattr(0, TCSANOW, &tioOld);
#endif
}
hecl::Printf(_S("\n"));
hecl::Printf(_SYS_STR("\n"));
return true;
}
@@ -130,7 +130,7 @@ private:
{
if (it >= string.end())
return;
if (*it == _S('\n'))
if (*it == _SYS_STR('\n'))
{
counter = WRAP_INDENT;
++it;
@@ -138,17 +138,17 @@ private:
if (counter == WRAP_INDENT)
{
for (int i=0 ; i<WRAP_INDENT ; ++i)
it = string.insert(it, _S(' ')) + 1;
it = string.insert(it, _SYS_STR(' ')) + 1;
}
if (it >= string.end())
return;
if (*it != _S('\n'))
if (*it != _SYS_STR('\n'))
++it;
}
/* check for whitespace */
if (isspace(*it))
{
*it = _S('\n');
*it = _SYS_STR('\n');
counter = WRAP_INDENT;
++it;
}
@@ -161,9 +161,9 @@ private:
{
counter = WRAP_INDENT;
if (k - string.begin() < v)
k = string.insert(it, _S('\n'));
k = string.insert(it, _SYS_STR('\n'));
else
*k = _S('\n');
*k = _SYS_STR('\n');
it = k + 1;
break;
}
@@ -200,31 +200,31 @@ public:
void print(const hecl::SystemChar* str)
{
hecl::FPrintf(m_sout, _S("%s"), str);
hecl::FPrintf(m_sout, _SYS_STR("%s"), str);
}
void printBold(const hecl::SystemChar* str)
{
if (XTERM_COLOR)
hecl::FPrintf(m_sout, _S("" BOLD "%s" NORMAL ""), str);
hecl::FPrintf(m_sout, _SYS_STR("" BOLD "%s" NORMAL ""), str);
else
hecl::FPrintf(m_sout, _S("%s"), str);
hecl::FPrintf(m_sout, _SYS_STR("%s"), str);
}
void secHead(const hecl::SystemChar* headName)
{
if (XTERM_COLOR)
hecl::FPrintf(m_sout, _S("" BOLD "%s" NORMAL "\n"), headName);
hecl::FPrintf(m_sout, _SYS_STR("" BOLD "%s" NORMAL "\n"), headName);
else
hecl::FPrintf(m_sout, _S("%s\n"), headName);
hecl::FPrintf(m_sout, _SYS_STR("%s\n"), headName);
}
void optionHead(const hecl::SystemChar* flag, const hecl::SystemChar* synopsis)
{
if (XTERM_COLOR)
hecl::FPrintf(m_sout, _S("" BOLD "%s" NORMAL " (%s)\n"), flag, synopsis);
hecl::FPrintf(m_sout, _SYS_STR("" BOLD "%s" NORMAL " (%s)\n"), flag, synopsis);
else
hecl::FPrintf(m_sout, _S("%s (%s)\n"), flag, synopsis);
hecl::FPrintf(m_sout, _SYS_STR("%s (%s)\n"), flag, synopsis);
}
void beginWrap()
@@ -240,17 +240,17 @@ public:
void wrapBold(const hecl::SystemChar* str)
{
if (XTERM_COLOR)
m_wrapBuffer += _S("" BOLD "");
m_wrapBuffer += _SYS_STR("" BOLD "");
m_wrapBuffer += str;
if (XTERM_COLOR)
m_wrapBuffer += _S("" NORMAL "");
m_wrapBuffer += _SYS_STR("" NORMAL "");
}
void endWrap()
{
_wrapBuf(m_wrapBuffer);
m_wrapBuffer += _S('\n');
hecl::FPrintf(m_sout, _S("%s"), m_wrapBuffer.c_str());
m_wrapBuffer += _SYS_STR('\n');
hecl::FPrintf(m_sout, _SYS_STR("%s"), m_wrapBuffer.c_str());
m_wrapBuffer.clear();
}
};
@@ -259,17 +259,17 @@ static hecl::SystemString MakePathArgAbsolute(const hecl::SystemString& arg,
const hecl::SystemString& cwd)
{
#if _WIN32
if (arg.size() >= 2 && iswalpha(arg[0]) && arg[1] == _S(':'))
if (arg.size() >= 2 && iswalpha(arg[0]) && arg[1] == _SYS_STR(':'))
return arg;
if (arg[0] == _S('\\') || arg[0] == _S('/'))
if (arg[0] == _SYS_STR('\\') || arg[0] == _SYS_STR('/'))
return arg;
return cwd + _S('\\') + arg;
return cwd + _SYS_STR('\\') + arg;
#else
if (arg[0] == _S('/') || arg[0] == _S('\\'))
if (arg[0] == _SYS_STR('/') || arg[0] == _SYS_STR('\\'))
return arg;
if (cwd.back() == _S('/') || cwd.back() == _S('\\'))
if (cwd.back() == _SYS_STR('/') || cwd.back() == _SYS_STR('\\'))
return cwd + arg;
return cwd + _S('/') + arg;
return cwd + _SYS_STR('/') + arg;
#endif
}

View File

@@ -18,7 +18,7 @@ public:
{
/* Check for recursive flag */
for (hecl::SystemChar arg : info.flags)
if (arg == _S('r'))
if (arg == _SYS_STR('r'))
m_recursive = true;
/* Scan args */
@@ -30,12 +30,12 @@ public:
{
if (arg.empty())
continue;
else if (!arg.compare(_S("--fast")))
else if (!arg.compare(_SYS_STR("--fast")))
{
m_fast = true;
continue;
}
else if (arg.size() >= 8 && !arg.compare(0, 7, _S("--spec=")))
else if (arg.size() >= 8 && !arg.compare(0, 7, _SYS_STR("--spec=")))
{
hecl::SystemString specName(arg.begin() + 7, arg.end());
for (const hecl::Database::DataSpecEntry* spec : hecl::Database::DATA_SPEC_REGISTRY)
@@ -50,7 +50,7 @@ public:
LogModule.report(logvisor::Fatal, "unable to find data spec '%s'", specName.c_str());
continue;
}
else if (arg.size() >= 2 && arg[0] == _S('-') && arg[1] == _S('-'))
else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
continue;
hecl::SystemString subPath;
@@ -64,8 +64,8 @@ public:
}
else if (m_fallbackProj->getProjectRootPath() != root)
LogModule.report(logvisor::Fatal,
_S("hecl cook can only process multiple items in the same project; ")
_S("'%s' and '%s' are different projects"),
_SYS_STR("hecl cook can only process multiple items in the same project; ")
_SYS_STR("'%s' and '%s' are different projects"),
m_fallbackProj->getProjectRootPath().getAbsolutePath().data(),
root.getAbsolutePath().data());
m_selectedItems.emplace_back(*m_useProj, subPath);
@@ -81,87 +81,87 @@ public:
if (m_selectedItems.empty())
{
m_selectedItems.reserve(1);
m_selectedItems.push_back({hecl::ProjectPath(*m_useProj, _S(""))});
m_selectedItems.push_back({hecl::ProjectPath(*m_useProj, _SYS_STR(""))});
m_recursive = true;
}
}
static void Help(HelpOutput& help)
{
help.secHead(_S("NAME"));
help.secHead(_SYS_STR("NAME"));
help.beginWrap();
help.wrap(_S("hecl-cook - Cook objects within the project database\n"));
help.wrap(_SYS_STR("hecl-cook - Cook objects within the project database\n"));
help.endWrap();
help.secHead(_S("SYNOPSIS"));
help.secHead(_SYS_STR("SYNOPSIS"));
help.beginWrap();
help.wrap(_S("hecl cook [-rf] [--fast] [--spec=<spec>] [<pathspec>...]\n"));
help.wrap(_SYS_STR("hecl cook [-rf] [--fast] [--spec=<spec>] [<pathspec>...]\n"));
help.endWrap();
help.secHead(_S("DESCRIPTION"));
help.secHead(_SYS_STR("DESCRIPTION"));
help.beginWrap();
help.wrap(_S("This command initiates a cooking pass on the project database. Cooking ")
_S("is analogous to compiling in software development. The resulting object buffers ")
_S("are cached within the project database. HECL performs the following ")
_S("tasks for each object during the cook process:\n\n"));
help.wrapBold(_S("- Object Gather: "));
help.wrap(_S("Files added with "));
help.wrapBold(_S("hecl add"));
help.wrap(_S(" are queried for their dependent files (e.g. "));
help.wrapBold(_S(".blend"));
help.wrap(_S(" files return any linked "));
help.wrapBold(_S(".png"));
help.wrap(_S(" images). If the dependent files are unable to be found, the cook process aborts.\n\n"));
help.wrapBold(_S("- Modtime Comparison: "));
help.wrap(_S("Files that have previously finished a cook pass are inspected for their time of ")
_S("last modification. If the file hasn't changed since its previous cook-pass, the ")
_S("process is skipped. If the file has been moved or deleted, the object is automatically ")
_S("removed from the project database.\n\n"));
help.wrapBold(_S("- Cook: "));
help.wrap(_S("A type-specific procedure compiles the file's contents into an efficient format ")
_S("for use by the runtime. A data-buffer is provided to HECL.\n\n"));
help.wrapBold(_S("- Hash and Compress: "));
help.wrap(_S("The data-buffer is hashed and compressed before being cached in the object database.\n\n"));
help.wrap(_SYS_STR("This command initiates a cooking pass on the project database. Cooking ")
_SYS_STR("is analogous to compiling in software development. The resulting object buffers ")
_SYS_STR("are cached within the project database. HECL performs the following ")
_SYS_STR("tasks for each object during the cook process:\n\n"));
help.wrapBold(_SYS_STR("- Object Gather: "));
help.wrap(_SYS_STR("Files added with "));
help.wrapBold(_SYS_STR("hecl add"));
help.wrap(_SYS_STR(" are queried for their dependent files (e.g. "));
help.wrapBold(_SYS_STR(".blend"));
help.wrap(_SYS_STR(" files return any linked "));
help.wrapBold(_SYS_STR(".png"));
help.wrap(_SYS_STR(" images). If the dependent files are unable to be found, the cook process aborts.\n\n"));
help.wrapBold(_SYS_STR("- Modtime Comparison: "));
help.wrap(_SYS_STR("Files that have previously finished a cook pass are inspected for their time of ")
_SYS_STR("last modification. If the file hasn't changed since its previous cook-pass, the ")
_SYS_STR("process is skipped. If the file has been moved or deleted, the object is automatically ")
_SYS_STR("removed from the project database.\n\n"));
help.wrapBold(_SYS_STR("- Cook: "));
help.wrap(_SYS_STR("A type-specific procedure compiles the file's contents into an efficient format ")
_SYS_STR("for use by the runtime. A data-buffer is provided to HECL.\n\n"));
help.wrapBold(_SYS_STR("- Hash and Compress: "));
help.wrap(_SYS_STR("The data-buffer is hashed and compressed before being cached in the object database.\n\n"));
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("<pathspec>..."), _S("input file(s)"));
help.secHead(_SYS_STR("OPTIONS"));
help.optionHead(_SYS_STR("<pathspec>..."), _SYS_STR("input file(s)"));
help.beginWrap();
help.wrap(_S("Specifies working file(s) containing production data to be cooked by HECL. ")
_S("Glob-strings may be specified (e.g. "));
help.wrapBold(_S("*.blend"));
help.wrap(_S(") to automatically cook all matching current-directory files in the project database. ")
_S("If no path specified, all files in the project database are cooked.\n"));
help.wrap(_SYS_STR("Specifies working file(s) containing production data to be cooked by HECL. ")
_SYS_STR("Glob-strings may be specified (e.g. "));
help.wrapBold(_SYS_STR("*.blend"));
help.wrap(_SYS_STR(") to automatically cook all matching current-directory files in the project database. ")
_SYS_STR("If no path specified, all files in the project database are cooked.\n"));
help.endWrap();
help.optionHead(_S("-r"), _S("recursion"));
help.optionHead(_SYS_STR("-r"), _SYS_STR("recursion"));
help.beginWrap();
help.wrap(_S("Enables recursive file-matching for cooking entire directories of working files.\n"));
help.wrap(_SYS_STR("Enables recursive file-matching for cooking entire directories of working files.\n"));
help.endWrap();
help.optionHead(_S("-f"), _S("force"));
help.optionHead(_SYS_STR("-f"), _SYS_STR("force"));
help.beginWrap();
help.wrap(_S("Forces cooking of all matched files, ignoring timestamp differences.\n"));
help.wrap(_SYS_STR("Forces cooking of all matched files, ignoring timestamp differences.\n"));
help.endWrap();
help.optionHead(_S("--fast"), _S("fast cook"));
help.optionHead(_SYS_STR("--fast"), _SYS_STR("fast cook"));
help.beginWrap();
help.wrap(_S("Performs draft-optimization cooking for supported data types.\n"));
help.wrap(_SYS_STR("Performs draft-optimization cooking for supported data types.\n"));
help.endWrap();
help.optionHead(_S("--spec=<spec>"), _S("data specification"));
help.optionHead(_SYS_STR("--spec=<spec>"), _SYS_STR("data specification"));
help.beginWrap();
help.wrap(_S("Specifies a DataSpec to use when cooking. ")
_S("This build of hecl supports the following values of <spec>:\n"));
help.wrap(_SYS_STR("Specifies a DataSpec to use when cooking. ")
_SYS_STR("This build of hecl supports the following values of <spec>:\n"));
for (const hecl::Database::DataSpecEntry* spec : hecl::Database::DATA_SPEC_REGISTRY)
{
if (!spec->m_factory)
continue;
help.wrap(_S(" "));
help.wrap(_SYS_STR(" "));
help.wrapBold(spec->m_name.data());
help.wrap(_S("\n"));
help.wrap(_SYS_STR("\n"));
}
}
hecl::SystemString toolName() const {return _S("cook");}
hecl::SystemString toolName() const {return _SYS_STR("cook");}
int run()
{

View File

@@ -43,12 +43,12 @@ public:
{
/* Get name from input file and init project there */
hecl::SystemString baseFile = info.args.front();
size_t slashPos = baseFile.rfind(_S('/'));
size_t slashPos = baseFile.rfind(_SYS_STR('/'));
if (slashPos == hecl::SystemString::npos)
slashPos = baseFile.rfind(_S('\\'));
slashPos = baseFile.rfind(_SYS_STR('\\'));
if (slashPos != hecl::SystemString::npos)
baseFile.assign(baseFile.begin() + slashPos + 1, baseFile.end());
size_t dotPos = baseFile.rfind(_S('.'));
size_t dotPos = baseFile.rfind(_SYS_STR('.'));
if (dotPos != hecl::SystemString::npos)
baseFile.assign(baseFile.begin(), baseFile.begin() + dotPos);
@@ -71,7 +71,7 @@ public:
m_fallbackProj.reset(new hecl::Database::Project(newProjRoot));
if (logvisor::ErrorCount > ErrorRef)
LogModule.report(logvisor::Fatal, "unable to init project at '%s'", rootDir.c_str());
LogModule.report(logvisor::Info, _S("initialized project at '%s/.hecl'"), rootDir.c_str());
LogModule.report(logvisor::Info, _SYS_STR("initialized project at '%s/.hecl'"), rootDir.c_str());
m_useProj = m_fallbackProj.get();
}
else
@@ -99,45 +99,45 @@ public:
static void Help(HelpOutput& help)
{
help.secHead(_S("NAME"));
help.secHead(_SYS_STR("NAME"));
help.beginWrap();
help.wrap(_S("hecl-extract - Extract objects from supported package/image formats\n"));
help.wrap(_SYS_STR("hecl-extract - Extract objects from supported package/image formats\n"));
help.endWrap();
help.secHead(_S("SYNOPSIS"));
help.secHead(_SYS_STR("SYNOPSIS"));
help.beginWrap();
help.wrap(_S("hecl extract <packagefile> [<subnode>...]\n"));
help.wrap(_SYS_STR("hecl extract <packagefile> [<subnode>...]\n"));
help.endWrap();
help.secHead(_S("DESCRIPTION"));
help.secHead(_SYS_STR("DESCRIPTION"));
help.beginWrap();
help.wrap(_S("This command recursively extracts all or part of a dataspec-supported ")
_S("package format. Each object is decoded to a working format and added to the project.\n\n"));
help.wrap(_SYS_STR("This command recursively extracts all or part of a dataspec-supported ")
_SYS_STR("package format. Each object is decoded to a working format and added to the project.\n\n"));
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("<packagefile>[/<subnode>...]"), _S("input file"));
help.secHead(_SYS_STR("OPTIONS"));
help.optionHead(_SYS_STR("<packagefile>[/<subnode>...]"), _SYS_STR("input file"));
help.beginWrap();
help.wrap(_S("Specifies the package file or disc image to source data from. ")
_S("An optional subnode specifies a named hierarchical-node specific ")
_S("to the game architecture (levels/areas)."));
help.wrap(_SYS_STR("Specifies the package file or disc image to source data from. ")
_SYS_STR("An optional subnode specifies a named hierarchical-node specific ")
_SYS_STR("to the game architecture (levels/areas)."));
help.endWrap();
}
hecl::SystemString toolName() const {return _S("extract");}
hecl::SystemString toolName() const {return _SYS_STR("extract");}
static void _recursivePrint(int level, hecl::Database::IDataSpec::ExtractReport& rep)
{
for (int l=0 ; l<level ; ++l)
hecl::Printf(_S(" "));
hecl::Printf(_SYS_STR(" "));
if (XTERM_COLOR)
hecl::Printf(_S("" BOLD "%s" NORMAL ""), rep.name.c_str());
hecl::Printf(_SYS_STR("" BOLD "%s" NORMAL ""), rep.name.c_str());
else
hecl::Printf(_S("%s"), rep.name.c_str());
hecl::Printf(_SYS_STR("%s"), rep.name.c_str());
if (rep.desc.size())
hecl::Printf(_S(" [%s]"), rep.desc.c_str());
hecl::Printf(_S("\n"));
hecl::Printf(_SYS_STR(" [%s]"), rep.desc.c_str());
hecl::Printf(_SYS_STR("\n"));
for (hecl::Database::IDataSpec::ExtractReport& child : rep.childOpts)
_recursivePrint(level + 1, child);
}
@@ -147,21 +147,21 @@ public:
if (m_specPasses.empty())
{
if (XTERM_COLOR)
hecl::Printf(_S("" RED BOLD "NOTHING TO EXTRACT" NORMAL "\n"));
hecl::Printf(_SYS_STR("" RED BOLD "NOTHING TO EXTRACT" NORMAL "\n"));
else
hecl::Printf(_S("NOTHING TO EXTRACT\n"));
hecl::Printf(_SYS_STR("NOTHING TO EXTRACT\n"));
return 1;
}
if (XTERM_COLOR)
hecl::Printf(_S("" GREEN BOLD "ABOUT TO EXTRACT:" NORMAL "\n"));
hecl::Printf(_SYS_STR("" GREEN BOLD "ABOUT TO EXTRACT:" NORMAL "\n"));
else
hecl::Printf(_S("ABOUT TO EXTRACT:\n"));
hecl::Printf(_SYS_STR("ABOUT TO EXTRACT:\n"));
for (hecl::Database::IDataSpec::ExtractReport& rep : m_reps)
{
_recursivePrint(0, rep);
hecl::Printf(_S("\n"));
hecl::Printf(_SYS_STR("\n"));
}
fflush(stdout);
@@ -170,12 +170,12 @@ public:
for (SpecExtractPass& ds : m_specPasses)
{
if (XTERM_COLOR)
hecl::Printf(_S("" MAGENTA BOLD "Using DataSpec %s:" NORMAL "\n"), ds.m_entry->m_name.data());
hecl::Printf(_SYS_STR("" MAGENTA BOLD "Using DataSpec %s:" NORMAL "\n"), ds.m_entry->m_name.data());
else
hecl::Printf(_S("Using DataSpec %s:\n"), ds.m_entry->m_name.data());
hecl::Printf(_SYS_STR("Using DataSpec %s:\n"), ds.m_entry->m_name.data());
ds.m_instance->doExtract(m_einfo, {true});
hecl::Printf(_S("\n\n"));
hecl::Printf(_SYS_STR("\n\n"));
}
}

View File

@@ -29,51 +29,51 @@ public:
static void Help(HelpOutput& help)
{
help.printBold(
_S(" ___________ \n")
_S(" ,.-'\"...........``~., \n")
_S(" ,.-\".......................\"-., \n")
_S(" ,/..................................\":, \n")
_S(" .,?........................................, \n")
_S(" /...........................................,}\n")
_S(" ./........................................,:`^`..}\n")
_S(" ./.......................................,:\"...../\n")
_S(" ?.....__..................................:`...../\n")
_S(" /__.(...\"~-,_...........................,:`....../\n")
_S(" /(_....\"~,_....\"~,_.....................,:`...._/ \n")
_S(" {.._$;_....\"=,_.....\"-,_......,.-~-,},.~\";/....} \n")
_S(" ((...*~_......\"=-._...\";,,./`........../\"..../ \n")
_S(" ,,,___.`~,......\"~.,....................`......}....../ \n")
_S("............(....`=-,,...`.........................(...;_,,-\" \n")
_S("............/.`~,......`-.................................../ \n")
_S(".............`~.*-,.....................................|,./...,__ \n")
_S(",,_..........}.>-._...................................|.......`=~-, \n")
_S(".....`=~-,__......`,................................. \n")
_S("...................`=~-,,.,........................... \n")
_S(".........................`:,,..........................`\n")
_S("...........................`=-,...............,%%`>--==`` \n")
_S(".................................._.........._,-%%...` \n")
_S("...................................,\n"));
_SYS_STR(" ___________ \n")
_SYS_STR(" ,.-'\"...........``~., \n")
_SYS_STR(" ,.-\".......................\"-., \n")
_SYS_STR(" ,/..................................\":, \n")
_SYS_STR(" .,?........................................, \n")
_SYS_STR(" /...........................................,}\n")
_SYS_STR(" ./........................................,:`^`..}\n")
_SYS_STR(" ./.......................................,:\"...../\n")
_SYS_STR(" ?.....__..................................:`...../\n")
_SYS_STR(" /__.(...\"~-,_...........................,:`....../\n")
_SYS_STR(" /(_....\"~,_....\"~,_.....................,:`...._/ \n")
_SYS_STR(" {.._$;_....\"=,_.....\"-,_......,.-~-,},.~\";/....} \n")
_SYS_STR(" ((...*~_......\"=-._...\";,,./`........../\"..../ \n")
_SYS_STR(" ,,,___.`~,......\"~.,....................`......}....../ \n")
_SYS_STR("............(....`=-,,...`.........................(...;_,,-\" \n")
_SYS_STR("............/.`~,......`-.................................../ \n")
_SYS_STR(".............`~.*-,.....................................|,./...,__ \n")
_SYS_STR(",,_..........}.>-._...................................|.......`=~-, \n")
_SYS_STR(".....`=~-,__......`,................................. \n")
_SYS_STR("...................`=~-,,.,........................... \n")
_SYS_STR(".........................`:,,..........................`\n")
_SYS_STR("...........................`=-,...............,%%`>--==`` \n")
_SYS_STR(".................................._.........._,-%%...` \n")
_SYS_STR("...................................,\n"));
}
static void ShowHelp(const hecl::SystemString& toolName)
{
/* Select tool's help-text streamer */
HelpOutput::HelpFunc helpFunc = NULL;
if (toolName == _S("init"))
if (toolName == _SYS_STR("init"))
helpFunc = ToolInit::Help;
else if (toolName == _S("spec"))
else if (toolName == _SYS_STR("spec"))
helpFunc = ToolSpec::Help;
else if (toolName == _S("extract"))
else if (toolName == _SYS_STR("extract"))
helpFunc = ToolExtract::Help;
else if (toolName == _S("cook"))
else if (toolName == _SYS_STR("cook"))
helpFunc = ToolCook::Help;
else if (toolName == _S("package") || toolName == _S("pack"))
else if (toolName == _SYS_STR("package") || toolName == _SYS_STR("pack"))
helpFunc = ToolPackage::Help;
else if (toolName == _S("help"))
else if (toolName == _SYS_STR("help"))
helpFunc = ToolHelp::Help;
else
{
LogModule.report(logvisor::Error, _S("unrecognized tool '%s' - can't help"), toolName.c_str());
LogModule.report(logvisor::Error, _SYS_STR("unrecognized tool '%s' - can't help"), toolName.c_str());
return;
}
@@ -81,7 +81,7 @@ public:
ho.go();
}
hecl::SystemString toolName() const {return _S("help");}
hecl::SystemString toolName() const {return _SYS_STR("help");}
int run()
{

View File

@@ -57,69 +57,69 @@ public:
static void Help(HelpOutput& help)
{
help.secHead(_S("NAME"));
help.secHead(_SYS_STR("NAME"));
help.beginWrap();
help.wrap(_S("hecl-image - Generate GameCube/Wii disc image from packaged files\n"));
help.wrap(_SYS_STR("hecl-image - Generate GameCube/Wii disc image from packaged files\n"));
help.endWrap();
help.secHead(_S("SYNOPSIS"));
help.secHead(_SYS_STR("SYNOPSIS"));
help.beginWrap();
help.wrap(_S("hecl image [<input-dir>]\n"));
help.wrap(_SYS_STR("hecl image [<input-dir>]\n"));
help.endWrap();
help.secHead(_S("DESCRIPTION"));
help.secHead(_SYS_STR("DESCRIPTION"));
help.beginWrap();
help.wrap(_S("This command uses the current contents of `out` to generate a GameCube or ")
_S("Wii disc image. `hecl package` must have been run previously to be effective.\n"));
help.wrap(_SYS_STR("This command uses the current contents of `out` to generate a GameCube or ")
_SYS_STR("Wii disc image. `hecl package` must have been run previously to be effective.\n"));
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("<input-dir>"), _S("input directory"));
help.secHead(_SYS_STR("OPTIONS"));
help.optionHead(_SYS_STR("<input-dir>"), _SYS_STR("input directory"));
help.beginWrap();
help.wrap(_S("Specifies a project subdirectory to root the resulting image from. ")
_S("Project must contain an out/sys and out/files directory to succeed.\n"));
help.wrap(_SYS_STR("Specifies a project subdirectory to root the resulting image from. ")
_SYS_STR("Project must contain an out/sys and out/files directory to succeed.\n"));
help.endWrap();
}
hecl::SystemString toolName() const {return _S("image");}
hecl::SystemString toolName() const {return _SYS_STR("image");}
int run()
{
if (XTERM_COLOR)
hecl::Printf(_S("" GREEN BOLD "ABOUT TO IMAGE:" NORMAL "\n"));
hecl::Printf(_SYS_STR("" GREEN BOLD "ABOUT TO IMAGE:" NORMAL "\n"));
else
hecl::Printf(_S("ABOUT TO IMAGE:\n"));
hecl::Printf(_SYS_STR("ABOUT TO IMAGE:\n"));
hecl::Printf(_S(" %s\n"), m_useProj->getProjectRootPath().getAbsolutePath().data());
hecl::Printf(_SYS_STR(" %s\n"), m_useProj->getProjectRootPath().getAbsolutePath().data());
fflush(stdout);
if (continuePrompt())
{
hecl::ProjectPath outPath(m_useProj->getProjectWorkingPath(), _S("out"));
hecl::ProjectPath outPath(m_useProj->getProjectWorkingPath(), _SYS_STR("out"));
if (!outPath.isDirectory())
{
LogModule.report(logvisor::Error, _S("%s is not a directory"), outPath.getAbsolutePath().data());
LogModule.report(logvisor::Error, _SYS_STR("%s is not a directory"), outPath.getAbsolutePath().data());
return 1;
}
hecl::ProjectPath bootBinPath(outPath, _S("sys/boot.bin"));
hecl::ProjectPath bootBinPath(outPath, _SYS_STR("sys/boot.bin"));
if (!bootBinPath.isFile())
{
LogModule.report(logvisor::Error, _S("%s is not a file"), bootBinPath.getAbsolutePath().data());
LogModule.report(logvisor::Error, _SYS_STR("%s is not a file"), bootBinPath.getAbsolutePath().data());
return 1;
}
athena::io::FileReader r(bootBinPath.getAbsolutePath());
if (r.hasError())
{
LogModule.report(logvisor::Error, _S("unable to open %s"), bootBinPath.getAbsolutePath().data());
LogModule.report(logvisor::Error, _SYS_STR("unable to open %s"), bootBinPath.getAbsolutePath().data());
return 1;
}
std::string id = r.readString(6);
r.close();
hecl::SystemStringConv idView(id);
hecl::SystemString fileOut = hecl::SystemString(outPath.getAbsolutePath()) + _S('/') + idView.c_str();
hecl::SystemString fileOut = hecl::SystemString(outPath.getAbsolutePath()) + _SYS_STR('/') + idView.c_str();
hecl::MultiProgressPrinter printer(true);
auto progFunc = [&printer](float totalProg, nod::SystemStringView fileName, size_t fileBytesXfered)
{
@@ -127,22 +127,22 @@ public:
};
if (id[0] == 'G')
{
fileOut += _S(".gcm");
fileOut += _SYS_STR(".gcm");
if (nod::DiscBuilderGCN::CalculateTotalSizeRequired(outPath.getAbsolutePath()) == -1)
return 1;
LogModule.report(logvisor::Info, _S("Generating %s as GameCube image"), fileOut.c_str());
LogModule.report(logvisor::Info, _SYS_STR("Generating %s as GameCube image"), fileOut.c_str());
nod::DiscBuilderGCN db(fileOut, progFunc);
if (db.buildFromDirectory(outPath.getAbsolutePath()) != nod::EBuildResult::Success)
return 1;
}
else
{
fileOut += _S(".iso");
fileOut += _SYS_STR(".iso");
bool dualLayer;
if (nod::DiscBuilderWii::CalculateTotalSizeRequired(outPath.getAbsolutePath(), dualLayer) == -1)
return 1;
LogModule.report(logvisor::Info, _S("Generating %s as %s-layer Wii image"), fileOut.c_str(),
dualLayer ? _S("dual") : _S("single"));
LogModule.report(logvisor::Info, _SYS_STR("Generating %s as %s-layer Wii image"), fileOut.c_str(),
dualLayer ? _SYS_STR("dual") : _SYS_STR("single"));
nod::DiscBuilderWii db(fileOut, dualLayer, progFunc);
if (db.buildFromDirectory(outPath.getAbsolutePath()) != nod::EBuildResult::Success)
return 1;

View File

@@ -22,20 +22,20 @@ public:
hecl::MakeDir(dir->c_str());
if (hecl::Stat(dir->c_str(), &theStat))
{
LogModule.report(logvisor::Fatal, _S("unable to stat '%s'"), dir->c_str());
LogModule.report(logvisor::Fatal, _SYS_STR("unable to stat '%s'"), dir->c_str());
return;
}
}
if (!S_ISDIR(theStat.st_mode))
{
LogModule.report(logvisor::Fatal, _S("'%s' is not a directory"), dir->c_str());
LogModule.report(logvisor::Fatal, _SYS_STR("'%s' is not a directory"), dir->c_str());
return;
}
hecl::SystemString testPath = *dir + _S("/.hecl/beacon");
hecl::SystemString testPath = *dir + _SYS_STR("/.hecl/beacon");
if (!hecl::Stat(testPath.c_str(), &theStat))
{
LogModule.report(logvisor::Fatal, _S("project already exists at '%s'"), dir->c_str());
LogModule.report(logvisor::Fatal, _SYS_STR("project already exists at '%s'"), dir->c_str());
return;
}
@@ -50,37 +50,37 @@ public:
hecl::Database::Project proj((hecl::ProjectRootPath(*m_dir)));
if (logvisor::ErrorCount > ErrorRef)
return 1;
LogModule.report(logvisor::Info, _S("initialized project at '%s/.hecl'"), m_dir->c_str());
LogModule.report(logvisor::Info, _SYS_STR("initialized project at '%s/.hecl'"), m_dir->c_str());
return 0;
}
static void Help(HelpOutput& help)
{
help.secHead(_S("NAME"));
help.secHead(_SYS_STR("NAME"));
help.beginWrap();
help.wrap(_S("hecl-init - Initialize a brand-new project database\n"));
help.wrap(_SYS_STR("hecl-init - Initialize a brand-new project database\n"));
help.endWrap();
help.secHead(_S("SYNOPSIS"));
help.secHead(_SYS_STR("SYNOPSIS"));
help.beginWrap();
help.wrap(_S("hecl init [<dir>]\n"));
help.wrap(_SYS_STR("hecl init [<dir>]\n"));
help.endWrap();
help.secHead(_S("DESCRIPTION"));
help.secHead(_SYS_STR("DESCRIPTION"));
help.beginWrap();
help.wrap(_S("Creates a "));
help.wrapBold(_S(".hecl"));
help.wrap(_S(" directory within the selected directory with an initialized database index. ")
_S("This constitutes an empty HECL project, ready for making stuff!!\n"));
help.wrap(_SYS_STR("Creates a "));
help.wrapBold(_SYS_STR(".hecl"));
help.wrap(_SYS_STR(" directory within the selected directory with an initialized database index. ")
_SYS_STR("This constitutes an empty HECL project, ready for making stuff!!\n"));
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("<dir>"), _S("group directory path"));
help.secHead(_SYS_STR("OPTIONS"));
help.optionHead(_SYS_STR("<dir>"), _SYS_STR("group directory path"));
help.beginWrap();
help.wrap(_S("Directory to create new project database in. If not specified, current directory is used.\n"));
help.wrap(_SYS_STR("Directory to create new project database in. If not specified, current directory is used.\n"));
help.endWrap();
}
hecl::SystemString toolName() const {return _S("init");}
hecl::SystemString toolName() const {return _SYS_STR("init");}
};

View File

@@ -23,13 +23,13 @@ class ToolPackage final : public ToolBase
void CheckFile(const hecl::ProjectPath& path)
{
if (!hecl::StrCmp(path.getLastComponent().data(), _S("!world.blend")))
if (!hecl::StrCmp(path.getLastComponent().data(), _SYS_STR("!world.blend")))
AddSelectedItem(path);
#if RUNTIME_ORIGINAL_IDS
else if (!hecl::StrCmp(path.getLastComponent().data(), _S("!original_ids.yaml")))
else if (!hecl::StrCmp(path.getLastComponent().data(), _SYS_STR("!original_ids.yaml")))
{
auto pathComps = path.getPathComponents();
if (pathComps.size() == 2 && pathComps[0] != _S("out"))
if (pathComps.size() == 2 && pathComps[0] != _SYS_STR("out"))
AddSelectedItem(path);
}
#endif
@@ -60,8 +60,8 @@ class ToolPackage final : public ToolBase
if (checkGeneral && origSize == m_selectedItems.size())
{
auto pathComps = path.getPathComponents();
if (pathComps.size() == 2 && pathComps[0] != _S("out") &&
pathComps[1] != _S("Shared") && pathComps[0].find(_S(".app")) == hecl::SystemString::npos)
if (pathComps.size() == 2 && pathComps[0] != _SYS_STR("out") &&
pathComps[1] != _SYS_STR("Shared") && pathComps[0].find(_SYS_STR(".app")) == hecl::SystemString::npos)
AddSelectedItem(path);
}
}
@@ -82,12 +82,12 @@ public:
{
if (arg.empty())
continue;
else if (!arg.compare(_S("--fast")))
else if (!arg.compare(_SYS_STR("--fast")))
{
m_fast = true;
continue;
}
else if (arg.size() >= 8 && !arg.compare(0, 7, _S("--spec=")))
else if (arg.size() >= 8 && !arg.compare(0, 7, _SYS_STR("--spec=")))
{
hecl::SystemString specName(arg.begin() + 7, arg.end());
for (const hecl::Database::DataSpecEntry* spec : hecl::Database::DATA_SPEC_REGISTRY)
@@ -102,7 +102,7 @@ public:
LogModule.report(logvisor::Fatal, "unable to find data spec '%s'", specName.c_str());
continue;
}
else if (arg.size() >= 2 && arg[0] == _S('-') && arg[1] == _S('-'))
else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
continue;
hecl::SystemString subPath;
@@ -117,8 +117,8 @@ public:
}
else if (m_fallbackProj->getProjectRootPath() != root)
LogModule.report(logvisor::Fatal,
_S("hecl package can only process multiple items in the same project; ")
_S("'%s' and '%s' are different projects"),
_SYS_STR("hecl package can only process multiple items in the same project; ")
_SYS_STR("'%s' and '%s' are different projects"),
m_fallbackProj->getProjectRootPath().getAbsolutePath().data(),
root.getAbsolutePath().data());
@@ -133,64 +133,64 @@ public:
/* Default case: recursive at root */
if (m_selectedItems.empty())
FindSelectedItems({*m_useProj, _S("")}, true);
FindSelectedItems({*m_useProj, _SYS_STR("")}, true);
}
static void Help(HelpOutput& help)
{
help.secHead(_S("NAME"));
help.secHead(_SYS_STR("NAME"));
help.beginWrap();
help.wrap(_S("hecl-pack\n")
_S("hecl-package - Package objects within the project database\n"));
help.wrap(_SYS_STR("hecl-pack\n")
_SYS_STR("hecl-package - Package objects within the project database\n"));
help.endWrap();
help.secHead(_S("SYNOPSIS"));
help.secHead(_SYS_STR("SYNOPSIS"));
help.beginWrap();
help.wrap(_S("hecl package [--spec=<spec>] [<input-dir>]\n"));
help.wrap(_SYS_STR("hecl package [--spec=<spec>] [<input-dir>]\n"));
help.endWrap();
help.secHead(_S("DESCRIPTION"));
help.secHead(_SYS_STR("DESCRIPTION"));
help.beginWrap();
help.wrap(_S("This command initiates a packaging pass on the project database. Packaging ")
_S("is analogous to linking in software development. All objects necessary to ")
_S("generate a complete package are gathered, grouped, and indexed within a .upak file.\n"));
help.wrap(_SYS_STR("This command initiates a packaging pass on the project database. Packaging ")
_SYS_STR("is analogous to linking in software development. All objects necessary to ")
_SYS_STR("generate a complete package are gathered, grouped, and indexed within a .upak file.\n"));
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("--spec=<spec>"), _S("data specification"));
help.secHead(_SYS_STR("OPTIONS"));
help.optionHead(_SYS_STR("--spec=<spec>"), _SYS_STR("data specification"));
help.beginWrap();
help.wrap(_S("Specifies a DataSpec to use when cooking and generating the package. ")
_S("This build of hecl supports the following values of <spec>:\n"));
help.wrap(_SYS_STR("Specifies a DataSpec to use when cooking and generating the package. ")
_SYS_STR("This build of hecl supports the following values of <spec>:\n"));
for (const hecl::Database::DataSpecEntry* spec : hecl::Database::DATA_SPEC_REGISTRY)
{
if (!spec->m_factory)
continue;
help.wrap(_S(" "));
help.wrap(_SYS_STR(" "));
help.wrapBold(spec->m_name.data());
help.wrap(_S("\n"));
help.wrap(_SYS_STR("\n"));
}
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("<input-dir>"), _S("input directory"));
help.secHead(_SYS_STR("OPTIONS"));
help.optionHead(_SYS_STR("<input-dir>"), _SYS_STR("input directory"));
help.beginWrap();
help.wrap(_S("Specifies a project subdirectory to root the resulting package from. ")
_S("If any dependent files fall outside this subdirectory, they will be implicitly ")
_S("gathered and packaged.\n"));
help.wrap(_SYS_STR("Specifies a project subdirectory to root the resulting package from. ")
_SYS_STR("If any dependent files fall outside this subdirectory, they will be implicitly ")
_SYS_STR("gathered and packaged.\n"));
help.endWrap();
}
hecl::SystemString toolName() const {return _S("package");}
hecl::SystemString toolName() const {return _SYS_STR("package");}
int run()
{
if (XTERM_COLOR)
hecl::Printf(_S("" GREEN BOLD "ABOUT TO PACKAGE:" NORMAL "\n"));
hecl::Printf(_SYS_STR("" GREEN BOLD "ABOUT TO PACKAGE:" NORMAL "\n"));
else
hecl::Printf(_S("ABOUT TO PACKAGE:\n"));
hecl::Printf(_SYS_STR("ABOUT TO PACKAGE:\n"));
for (auto& item : m_selectedItems)
hecl::Printf(_S(" %s\n"), item.getRelativePath().data());
hecl::Printf(_SYS_STR(" %s\n"), item.getRelativePath().data());
fflush(stdout);
if (continuePrompt())
@@ -200,7 +200,7 @@ public:
for (const hecl::ProjectPath& path : m_selectedItems)
{
if (!m_useProj->packagePath(path, printer, m_fast, m_spec, &cp))
LogModule.report(logvisor::Error, _S("Unable to package %s"), path.getAbsolutePath().data());
LogModule.report(logvisor::Error, _SYS_STR("Unable to package %s"), path.getAbsolutePath().data());
}
cp.waitUntilComplete();
}

View File

@@ -27,9 +27,9 @@ public:
hecl::SystemString firstArg = info.args.front();
hecl::ToLower(firstArg);
if (!firstArg.compare(_S("enable")))
if (!firstArg.compare(_SYS_STR("enable")))
mode = MENABLE;
else if (!firstArg.compare(_S("disable")))
else if (!firstArg.compare(_SYS_STR("disable")))
mode = MDISABLE;
else
return;
@@ -54,38 +54,38 @@ public:
}
if (!found)
LogModule.report(logvisor::Fatal,
_S("'%s' is not found in the dataspec registry"),
_SYS_STR("'%s' is not found in the dataspec registry"),
it->c_str());
}
}
static void Help(HelpOutput& help)
{
help.secHead(_S("NAME"));
help.secHead(_SYS_STR("NAME"));
help.beginWrap();
help.wrap(_S("hecl-spec - Configure target data options\n"));
help.wrap(_SYS_STR("hecl-spec - Configure target data options\n"));
help.endWrap();
help.secHead(_S("SYNOPSIS"));
help.secHead(_SYS_STR("SYNOPSIS"));
help.beginWrap();
help.wrap(_S("hecl spec [enable|disable] [<specname>...]\n"));
help.wrap(_SYS_STR("hecl spec [enable|disable] [<specname>...]\n"));
help.endWrap();
help.secHead(_S("DESCRIPTION"));
help.secHead(_SYS_STR("DESCRIPTION"));
help.beginWrap();
help.wrap(_S("This command configures the HECL project with the user's preferred target DataSpecs.\n\n")
_S("Providing enable/disable argument will bulk-set the enable status of the provided spec(s)")
_S("list. If enable/disable is not provided, a list of supported DataSpecs is printed.\n\n"));
help.wrap(_SYS_STR("This command configures the HECL project with the user's preferred target DataSpecs.\n\n")
_SYS_STR("Providing enable/disable argument will bulk-set the enable status of the provided spec(s)")
_SYS_STR("list. If enable/disable is not provided, a list of supported DataSpecs is printed.\n\n"));
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("<specname>..."), _S("DataSpec name(s)"));
help.secHead(_SYS_STR("OPTIONS"));
help.optionHead(_SYS_STR("<specname>..."), _SYS_STR("DataSpec name(s)"));
help.beginWrap();
help.wrap(_S("Specifies platform-names to enable/disable"));
help.wrap(_SYS_STR("Specifies platform-names to enable/disable"));
help.endWrap();
}
hecl::SystemString toolName() const {return _S("spec");}
hecl::SystemString toolName() const {return _SYS_STR("spec");}
int run()
{
@@ -94,10 +94,10 @@ public:
for (const hecl::Database::DataSpecEntry* spec : hecl::Database::DATA_SPEC_REGISTRY)
{
if (XTERM_COLOR)
hecl::Printf(_S("" BOLD CYAN "%s" NORMAL "\n"), spec->m_name.data());
hecl::Printf(_SYS_STR("" BOLD CYAN "%s" NORMAL "\n"), spec->m_name.data());
else
hecl::Printf(_S("%s\n"), spec->m_name.data());
hecl::Printf(_S(" %s\n"), spec->m_desc.data());
hecl::Printf(_SYS_STR("%s\n"), spec->m_name.data());
hecl::Printf(_SYS_STR(" %s\n"), spec->m_desc.data());
}
return 0;
}
@@ -108,17 +108,17 @@ public:
for (auto& spec : specs)
{
if (XTERM_COLOR)
hecl::Printf(_S("" BOLD CYAN "%s" NORMAL ""), spec.spec.m_name.data());
hecl::Printf(_SYS_STR("" BOLD CYAN "%s" NORMAL ""), spec.spec.m_name.data());
else
hecl::Printf(_S("%s"), spec.spec.m_name.data());
hecl::Printf(_SYS_STR("%s"), spec.spec.m_name.data());
if (spec.active)
{
if (XTERM_COLOR)
hecl::Printf(_S(" " BOLD GREEN "[ENABLED]" NORMAL ""));
hecl::Printf(_SYS_STR(" " BOLD GREEN "[ENABLED]" NORMAL ""));
else
hecl::Printf(_S(" [ENABLED]"));
hecl::Printf(_SYS_STR(" [ENABLED]"));
}
hecl::Printf(_S("\n %s\n"), spec.spec.m_desc.data());
hecl::Printf(_SYS_STR("\n %s\n"), spec.spec.m_desc.data());
}
return 0;
}

View File

@@ -47,25 +47,25 @@ bool XTERM_COLOR = false;
static void printHelp(const hecl::SystemChar* pname)
{
if (XTERM_COLOR)
hecl::Printf(_S("" BOLD "HECL" NORMAL ""));
hecl::Printf(_SYS_STR("" BOLD "HECL" NORMAL ""));
else
hecl::Printf(_S("HECL"));
hecl::Printf(_SYS_STR("HECL"));
#if HECL_HAS_NOD
# define TOOL_LIST "extract|init|cook|package|image|help"
#else
# define TOOL_LIST "extract|init|cook|package|help"
#endif
#if HECL_GIT
hecl::Printf(_S(" Commit " HECL_GIT_S " " HECL_BRANCH_S "\nUsage: %s " TOOL_LIST "\n"), pname);
hecl::Printf(_SYS_STR(" Commit " HECL_GIT_S " " HECL_BRANCH_S "\nUsage: %s " TOOL_LIST "\n"), pname);
#elif HECL_VER
hecl::Printf(_S(" Version " HECL_VER_S "\nUsage: %s " TOOL_LIST "\n"), pname);
hecl::Printf(_SYS_STR(" Version " HECL_VER_S "\nUsage: %s " TOOL_LIST "\n"), pname);
#else
hecl::Printf(_S("\nUsage: %s " TOOL_LIST "\n"), pname);
hecl::Printf(_SYS_STR("\nUsage: %s " TOOL_LIST "\n"), pname);
#endif
}
/* Regex patterns */
static const hecl::SystemRegex regOPEN(_S("-o([^\"]*|\\S*)"), std::regex::ECMAScript|std::regex::optimize);
static const hecl::SystemRegex regOPEN(_SYS_STR("-o([^\"]*|\\S*)"), std::regex::ECMAScript|std::regex::optimize);
static ToolBase* ToolPtr = nullptr;
@@ -100,7 +100,7 @@ static void SIGWINCHHandler(int sig) {}
int main(int argc, const char** argv)
#endif
{
if (argc > 1 && !hecl::StrCmp(argv[1], _S("--dlpackage")))
if (argc > 1 && !hecl::StrCmp(argv[1], _SYS_STR("--dlpackage")))
{
printf("%s\n", HECL_DLPACKAGE);
return 100;
@@ -140,7 +140,7 @@ int main(int argc, const char** argv)
}
else if (argc == 0)
{
printHelp(_S("hecl"));
printHelp(_SYS_STR("hecl"));
#if WIN_PAUSE
system("PAUSE");
#endif
@@ -156,17 +156,17 @@ int main(int argc, const char** argv)
if (hecl::Getcwd(cwdbuf, 1024))
{
info.cwd = cwdbuf;
if (info.cwd.size() && info.cwd.back() != _S('/') && info.cwd.back() != _S('\\'))
if (info.cwd.size() && info.cwd.back() != _SYS_STR('/') && info.cwd.back() != _SYS_STR('\\'))
#if _WIN32
info.cwd += _S('\\');
info.cwd += _SYS_STR('\\');
#else
info.cwd += _S('/');
info.cwd += _SYS_STR('/');
#endif
if (hecl::PathRelative(argv[0]))
ExeDir = hecl::SystemString(cwdbuf) + _S('/');
ExeDir = hecl::SystemString(cwdbuf) + _SYS_STR('/');
hecl::SystemString Argv0(argv[0]);
hecl::SystemString::size_type lastIdx = Argv0.find_last_of(_S("/\\"));
hecl::SystemString::size_type lastIdx = Argv0.find_last_of(_SYS_STR("/\\"));
if (lastIdx != hecl::SystemString::npos)
ExeDir.insert(ExeDir.end(), Argv0.begin(), Argv0.begin() + lastIdx);
}
@@ -211,7 +211,7 @@ int main(int argc, const char** argv)
for (auto it = args.cbegin() ; it != args.cend() ;)
{
const hecl::SystemString& arg = *it;
if (arg.size() < 2 || arg[0] != _S('-') || arg[1] == _S('-'))
if (arg.size() < 2 || arg[0] != _SYS_STR('-') || arg[1] == _SYS_STR('-'))
{
++it;
continue;
@@ -219,13 +219,13 @@ int main(int argc, const char** argv)
for (auto chit = arg.cbegin() + 1 ; chit != arg.cend() ; ++chit)
{
if (*chit == _S('v'))
if (*chit == _SYS_STR('v'))
++info.verbosityLevel;
else if (*chit == _S('f'))
else if (*chit == _SYS_STR('f'))
info.force = true;
else if (*chit == _S('y'))
else if (*chit == _SYS_STR('y'))
info.yes = true;
else if (*chit == _S('g'))
else if (*chit == _SYS_STR('g'))
info.gui = true;
else
info.flags.push_back(*chit);
@@ -265,27 +265,27 @@ int main(int argc, const char** argv)
std::unique_ptr<ToolBase> tool;
size_t ErrorRef = logvisor::ErrorCount;
if (toolName == _S("init"))
if (toolName == _SYS_STR("init"))
tool.reset(new ToolInit(info));
else if (toolName == _S("spec"))
else if (toolName == _SYS_STR("spec"))
tool.reset(new ToolSpec(info));
else if (toolName == _S("extract"))
else if (toolName == _SYS_STR("extract"))
tool.reset(new ToolExtract(info));
else if (toolName == _S("cook"))
else if (toolName == _SYS_STR("cook"))
tool.reset(new ToolCook(info));
else if (toolName == _S("package") || toolName == _S("pack"))
else if (toolName == _SYS_STR("package") || toolName == _SYS_STR("pack"))
tool.reset(new ToolPackage(info));
#if HECL_HAS_NOD
else if (toolName == _S("image"))
else if (toolName == _SYS_STR("image"))
tool.reset(new ToolImage(info));
#endif
else if (toolName == _S("help"))
else if (toolName == _SYS_STR("help"))
tool.reset(new ToolHelp(info));
else
{
FILE* fp = hecl::Fopen(argv[1], _S("rb"));
FILE* fp = hecl::Fopen(argv[1], _SYS_STR("rb"));
if (!fp)
LogModule.report(logvisor::Error, _S("unrecognized tool '%s'"), toolName.c_str());
LogModule.report(logvisor::Error, _SYS_STR("unrecognized tool '%s'"), toolName.c_str());
else
{
/* Shortcut-case: implicit extract */
@@ -304,7 +304,7 @@ int main(int argc, const char** argv)
}
if (info.verbosityLevel)
LogModule.report(logvisor::Info, _S("Constructed tool '%s' %d\n"),
LogModule.report(logvisor::Info, _SYS_STR("Constructed tool '%s' %d\n"),
tool->toolName().c_str(), info.verbosityLevel);
/* Run tool */