mirror of https://github.com/AxioDL/nod.git
Windows build fixes
This commit is contained in:
parent
e964a013fe
commit
f87b286ff3
|
@ -26,10 +26,10 @@ int main(int argc, char* argv[])
|
|||
#endif
|
||||
{
|
||||
if (argc < 3 ||
|
||||
(!strcasecmp(argv[1], _S("makegcn")) && argc < 3) ||
|
||||
(!strcasecmp(argv[1], _S("makewii")) && argc < 3) ||
|
||||
(!strcasecmp(argv[1], _S("mergegcn")) && argc < 4) ||
|
||||
(!strcasecmp(argv[1], _S("mergewii")) && argc < 4))
|
||||
(!strcasecmp(argv[1], _SYS_STR("makegcn")) && argc < 3) ||
|
||||
(!strcasecmp(argv[1], _SYS_STR("makewii")) && argc < 3) ||
|
||||
(!strcasecmp(argv[1], _SYS_STR("mergegcn")) && argc < 4) ||
|
||||
(!strcasecmp(argv[1], _SYS_STR("mergewii")) && argc < 4))
|
||||
{
|
||||
printHelp();
|
||||
return 1;
|
||||
|
@ -46,7 +46,7 @@ int main(int argc, char* argv[])
|
|||
fprintf(stderr, "Current node: %s, Extraction %g%% Complete\n", str.data(), c * 100.f);
|
||||
}};
|
||||
const nod::SystemChar* inDir = nullptr;
|
||||
const nod::SystemChar* outDir = _S(".");
|
||||
const nod::SystemChar* outDir = _SYS_STR(".");
|
||||
|
||||
for (int a=2 ; a<argc ; ++a)
|
||||
{
|
||||
|
@ -63,15 +63,15 @@ int main(int argc, char* argv[])
|
|||
|
||||
auto progFunc = [&](float prog, nod::SystemStringView name, size_t bytes)
|
||||
{
|
||||
nod::Printf(_S("\r "));
|
||||
nod::Printf(_SYS_STR("\r "));
|
||||
if (bytes != -1)
|
||||
nod::Printf(_S("\r%g%% %s %" PRISize " B"), prog * 100.f, name.data(), bytes);
|
||||
nod::Printf(_SYS_STR("\r%g%% %s %" PRISize " B"), prog * 100.f, name.data(), bytes);
|
||||
else
|
||||
nod::Printf(_S("\r%g%% %s"), prog * 100.f, name.data());
|
||||
nod::Printf(_SYS_STR("\r%g%% %s"), prog * 100.f, name.data());
|
||||
fflush(stdout);
|
||||
};
|
||||
|
||||
if (!strcasecmp(argv[1], _S("extract")))
|
||||
if (!strcasecmp(argv[1], _SYS_STR("extract")))
|
||||
{
|
||||
bool isWii;
|
||||
std::unique_ptr<nod::DiscBase> disc = nod::OpenDiscFromImage(inDir, isWii);
|
||||
|
@ -87,13 +87,13 @@ int main(int argc, char* argv[])
|
|||
if (!dataPart->extractToDirectory(outDir, ctx))
|
||||
return 1;
|
||||
}
|
||||
else if (!strcasecmp(argv[1], _S("makegcn")))
|
||||
else if (!strcasecmp(argv[1], _SYS_STR("makegcn")))
|
||||
{
|
||||
/* Pre-validate path */
|
||||
nod::Sstat theStat;
|
||||
if (nod::Stat(argv[2], &theStat) || !S_ISDIR(theStat.st_mode))
|
||||
{
|
||||
nod::LogModule.report(logvisor::Error, _S("unable to stat %s as directory"), argv[2]);
|
||||
nod::LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s as directory"), argv[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ int main(int argc, char* argv[])
|
|||
if (argc < 4)
|
||||
{
|
||||
nod::SystemString outPath(argv[2]);
|
||||
outPath.append(_S(".iso"));
|
||||
outPath.append(_SYS_STR(".iso"));
|
||||
nod::DiscBuilderGCN b(outPath, progFunc);
|
||||
ret = b.buildFromDirectory(argv[2]);
|
||||
}
|
||||
|
@ -119,13 +119,13 @@ int main(int argc, char* argv[])
|
|||
if (ret != nod::EBuildResult::Success)
|
||||
return 1;
|
||||
}
|
||||
else if (!strcasecmp(argv[1], _S("makewii")))
|
||||
else if (!strcasecmp(argv[1], _SYS_STR("makewii")))
|
||||
{
|
||||
/* Pre-validate path */
|
||||
nod::Sstat theStat;
|
||||
if (nod::Stat(argv[2], &theStat) || !S_ISDIR(theStat.st_mode))
|
||||
{
|
||||
nod::LogModule.report(logvisor::Error, _S("unable to stat %s as directory"), argv[4]);
|
||||
nod::LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s as directory"), argv[4]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ int main(int argc, char* argv[])
|
|||
if (argc < 4)
|
||||
{
|
||||
nod::SystemString outPath(argv[2]);
|
||||
outPath.append(_S(".iso"));
|
||||
outPath.append(_SYS_STR(".iso"));
|
||||
nod::DiscBuilderWii b(outPath.c_str(), dual, progFunc);
|
||||
ret = b.buildFromDirectory(argv[2]);
|
||||
}
|
||||
|
@ -152,18 +152,18 @@ int main(int argc, char* argv[])
|
|||
if (ret != nod::EBuildResult::Success)
|
||||
return 1;
|
||||
}
|
||||
else if (!strcasecmp(argv[1], _S("mergegcn")))
|
||||
else if (!strcasecmp(argv[1], _SYS_STR("mergegcn")))
|
||||
{
|
||||
/* Pre-validate paths */
|
||||
nod::Sstat theStat;
|
||||
if (nod::Stat(argv[2], &theStat) || !S_ISDIR(theStat.st_mode))
|
||||
{
|
||||
nod::LogModule.report(logvisor::Error, _S("unable to stat %s as directory"), argv[2]);
|
||||
nod::LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s as directory"), argv[2]);
|
||||
return 1;
|
||||
}
|
||||
if (nod::Stat(argv[3], &theStat) || !S_ISREG(theStat.st_mode))
|
||||
{
|
||||
nod::LogModule.report(logvisor::Error, _S("unable to stat %s as file"), argv[3]);
|
||||
nod::LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s as file"), argv[3]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -171,12 +171,12 @@ int main(int argc, char* argv[])
|
|||
std::unique_ptr<nod::DiscBase> disc = nod::OpenDiscFromImage(argv[3], isWii);
|
||||
if (!disc)
|
||||
{
|
||||
nod::LogModule.report(logvisor::Error, _S("unable to open image %s"), argv[3]);
|
||||
nod::LogModule.report(logvisor::Error, _SYS_STR("unable to open image %s"), argv[3]);
|
||||
return 1;
|
||||
}
|
||||
if (isWii)
|
||||
{
|
||||
nod::LogModule.report(logvisor::Error, _S("Wii images should be merged with 'mergewii'"));
|
||||
nod::LogModule.report(logvisor::Error, _SYS_STR("Wii images should be merged with 'mergewii'"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ int main(int argc, char* argv[])
|
|||
if (argc < 5)
|
||||
{
|
||||
nod::SystemString outPath(argv[2]);
|
||||
outPath.append(_S(".iso"));
|
||||
outPath.append(_SYS_STR(".iso"));
|
||||
nod::DiscMergerGCN b(outPath.c_str(), static_cast<nod::DiscGCN&>(*disc), progFunc);
|
||||
ret = b.mergeFromDirectory(argv[2]);
|
||||
}
|
||||
|
@ -202,18 +202,18 @@ int main(int argc, char* argv[])
|
|||
if (ret != nod::EBuildResult::Success)
|
||||
return 1;
|
||||
}
|
||||
else if (!strcasecmp(argv[1], _S("mergewii")))
|
||||
else if (!strcasecmp(argv[1], _SYS_STR("mergewii")))
|
||||
{
|
||||
/* Pre-validate paths */
|
||||
nod::Sstat theStat;
|
||||
if (nod::Stat(argv[2], &theStat) || !S_ISDIR(theStat.st_mode))
|
||||
{
|
||||
nod::LogModule.report(logvisor::Error, _S("unable to stat %s as directory"), argv[2]);
|
||||
nod::LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s as directory"), argv[2]);
|
||||
return 1;
|
||||
}
|
||||
if (nod::Stat(argv[3], &theStat) || !S_ISREG(theStat.st_mode))
|
||||
{
|
||||
nod::LogModule.report(logvisor::Error, _S("unable to stat %s as file"), argv[3]);
|
||||
nod::LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s as file"), argv[3]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -221,12 +221,12 @@ int main(int argc, char* argv[])
|
|||
std::unique_ptr<nod::DiscBase> disc = nod::OpenDiscFromImage(argv[3], isWii);
|
||||
if (!disc)
|
||||
{
|
||||
nod::LogModule.report(logvisor::Error, _S("unable to open image %s"), argv[3]);
|
||||
nod::LogModule.report(logvisor::Error, _SYS_STR("unable to open image %s"), argv[3]);
|
||||
return 1;
|
||||
}
|
||||
if (!isWii)
|
||||
{
|
||||
nod::LogModule.report(logvisor::Error, _S("GameCube images should be merged with 'mergegcn'"));
|
||||
nod::LogModule.report(logvisor::Error, _SYS_STR("GameCube images should be merged with 'mergegcn'"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ int main(int argc, char* argv[])
|
|||
if (argc < 5)
|
||||
{
|
||||
nod::SystemString outPath(argv[2]);
|
||||
outPath.append(_S(".iso"));
|
||||
outPath.append(_SYS_STR(".iso"));
|
||||
nod::DiscMergerWii b(outPath.c_str(), static_cast<nod::DiscWii&>(*disc), dual, progFunc);
|
||||
ret = b.mergeFromDirectory(argv[2]);
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ int main(int argc, char* argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
nod::LogModule.report(logvisor::Info, _S("Success!"));
|
||||
nod::LogModule.report(logvisor::Info, _SYS_STR("Success!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,8 +111,8 @@ public:
|
|||
inline SystemStringView sys_str() const {return m_sys;}
|
||||
inline const SystemChar* c_str() const {return m_sys.c_str();}
|
||||
};
|
||||
#ifndef _S
|
||||
#define _S(val) L ## val
|
||||
#ifndef _SYS_STR
|
||||
#define _SYS_STR(val) L ## val
|
||||
#endif
|
||||
#else
|
||||
typedef char SystemChar;
|
||||
|
@ -321,14 +321,14 @@ static inline bool CheckFreeSpace(const SystemChar* path, size_t reqSz)
|
|||
DWORD ret = GetFullPathNameW(path, 1024, buf, &end);
|
||||
if (!ret || ret > 1024)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("GetFullPathNameW %s"), path);
|
||||
LogModule.report(logvisor::Error, _SYS_STR("GetFullPathNameW %s"), path);
|
||||
return false;
|
||||
}
|
||||
if (end)
|
||||
end[0] = L'\0';
|
||||
if (!GetDiskFreeSpaceExW(buf, &freeBytes, nullptr, nullptr))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("GetDiskFreeSpaceExW %s: %d"), path, GetLastError());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("GetDiskFreeSpaceExW %s: %d"), path, GetLastError());
|
||||
return false;
|
||||
}
|
||||
return reqSz < freeBytes.QuadPart;
|
||||
|
|
|
@ -21,7 +21,7 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
|
|||
|
||||
#if _WIN32
|
||||
SystemString wc(path);
|
||||
wc += _S("/*");
|
||||
wc += _SYS_STR("/*");
|
||||
WIN32_FIND_DATAW d;
|
||||
HANDLE dir = FindFirstFileW(wc.c_str(), &d);
|
||||
if (dir == INVALID_HANDLE_VALUE)
|
||||
|
@ -31,12 +31,12 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
|
|||
case Mode::Native:
|
||||
do
|
||||
{
|
||||
if (!wcscmp(d.cFileName, _S(".")) || !wcscmp(d.cFileName, _S("..")))
|
||||
if (!wcscmp(d.cFileName, _SYS_STR(".")) || !wcscmp(d.cFileName, _SYS_STR("..")))
|
||||
continue;
|
||||
if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0))
|
||||
continue;
|
||||
SystemString fp(path);
|
||||
fp += _S('/');
|
||||
fp += _SYS_STR('/');
|
||||
fp += d.cFileName;
|
||||
Sstat st;
|
||||
if (Stat(fp.c_str(), &st))
|
||||
|
@ -60,12 +60,12 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
|
|||
std::map<SystemString, Entry, CaseInsensitiveCompare> sort;
|
||||
do
|
||||
{
|
||||
if (!wcscmp(d.cFileName, _S(".")) || !wcscmp(d.cFileName, _S("..")))
|
||||
if (!wcscmp(d.cFileName, _SYS_STR(".")) || !wcscmp(d.cFileName, _SYS_STR("..")))
|
||||
continue;
|
||||
if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0))
|
||||
continue;
|
||||
SystemString fp(path);
|
||||
fp +=_S('/');
|
||||
fp +=_SYS_STR('/');
|
||||
fp += d.cFileName;
|
||||
Sstat st;
|
||||
if (Stat(fp.c_str(), &st) || !S_ISDIR(st.st_mode))
|
||||
|
@ -96,12 +96,12 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
|
|||
std::multimap<size_t, Entry> sort;
|
||||
do
|
||||
{
|
||||
if (!wcscmp(d.cFileName, _S(".")) || !wcscmp(d.cFileName, _S("..")))
|
||||
if (!wcscmp(d.cFileName, _SYS_STR(".")) || !wcscmp(d.cFileName, _SYS_STR("..")))
|
||||
continue;
|
||||
if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0))
|
||||
continue;
|
||||
SystemString fp(path);
|
||||
fp += _S('/');
|
||||
fp += _SYS_STR('/');
|
||||
fp += d.cFileName;
|
||||
Sstat st;
|
||||
if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode))
|
||||
|
@ -122,12 +122,12 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
|
|||
std::map<SystemString, Entry, CaseInsensitiveCompare> sort;
|
||||
do
|
||||
{
|
||||
if (!wcscmp(d.cFileName, _S(".")) || !wcscmp(d.cFileName, _S("..")))
|
||||
if (!wcscmp(d.cFileName, _SYS_STR(".")) || !wcscmp(d.cFileName, _SYS_STR("..")))
|
||||
continue;
|
||||
if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0))
|
||||
continue;
|
||||
SystemString fp(path);
|
||||
fp += _S('/');
|
||||
fp += _SYS_STR('/');
|
||||
fp += d.cFileName;
|
||||
Sstat st;
|
||||
if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode))
|
||||
|
|
106
lib/DiscBase.cpp
106
lib/DiscBase.cpp
|
@ -43,11 +43,11 @@ const SystemChar* getKindString(PartitionKind kind)
|
|||
switch (kind)
|
||||
{
|
||||
case PartitionKind::Data:
|
||||
return _S("DATA");
|
||||
return _SYS_STR("DATA");
|
||||
case PartitionKind::Update:
|
||||
return _S("UPDATE");
|
||||
return _SYS_STR("UPDATE");
|
||||
case PartitionKind::Channel:
|
||||
return _S("CHANNEL");
|
||||
return _SYS_STR("CHANNEL");
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ std::unique_ptr<uint8_t[]> Node::getBuf() const
|
|||
bool Node::extractToDirectory(SystemStringView basePath, const ExtractionContext& ctx) const
|
||||
{
|
||||
SystemStringConv nameView(getName());
|
||||
SystemString path = SystemString(basePath) + _S('/') + nameView.sys_str().data();
|
||||
SystemString path = SystemString(basePath) + _SYS_STR('/') + nameView.sys_str().data();
|
||||
|
||||
if (m_kind == Kind::Directory)
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ bool Node::extractToDirectory(SystemStringView basePath, const ExtractionContext
|
|||
ctx.progressCB(getName(), m_parent.m_curNodeIdx / float(m_parent.getNodeCount()));
|
||||
if (Mkdir(path.c_str(), 0755) && errno != EEXIST)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to mkdir '%s'"), path.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to mkdir '%s'"), path.c_str());
|
||||
return false;
|
||||
}
|
||||
for (Node& subnode : *this)
|
||||
|
@ -181,16 +181,16 @@ bool IPartition::extractToDirectory(SystemStringView path, const ExtractionConte
|
|||
m_curNodeIdx = 0;
|
||||
if (Mkdir(path.data(), 0755) && errno != EEXIST)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to mkdir '%s'"), path.data());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to mkdir '%s'"), path.data());
|
||||
return false;
|
||||
}
|
||||
|
||||
SystemString basePath = m_isWii ? SystemString(path) + _S("/") + getKindString(m_kind) : SystemString(path);
|
||||
SystemString basePath = m_isWii ? SystemString(path) + _SYS_STR("/") + getKindString(m_kind) : SystemString(path);
|
||||
if (m_isWii)
|
||||
{
|
||||
if (Mkdir(basePath.c_str(), 0755) && errno != EEXIST)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to mkdir '%s'"), basePath.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to mkdir '%s'"), basePath.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -207,10 +207,10 @@ bool IPartition::extractToDirectory(SystemStringView path, const ExtractionConte
|
|||
return false;
|
||||
|
||||
/* Extract Filesystem */
|
||||
SystemString fsPath = basePath + _S("/files");
|
||||
SystemString fsPath = basePath + _SYS_STR("/files");
|
||||
if (Mkdir(fsPath.c_str(), 0755) && errno != EEXIST)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to mkdir '%s'"), fsPath.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to mkdir '%s'"), fsPath.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -220,15 +220,15 @@ bool IPartition::extractToDirectory(SystemStringView path, const ExtractionConte
|
|||
bool IPartition::extractSysFiles(SystemStringView basePath, const ExtractionContext& ctx) const
|
||||
{
|
||||
SystemString basePathStr(basePath);
|
||||
if (Mkdir((basePathStr + _S("/sys")).c_str(), 0755) && errno != EEXIST)
|
||||
if (Mkdir((basePathStr + _SYS_STR("/sys")).c_str(), 0755) && errno != EEXIST)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to mkdir '%s/sys'"), basePath.data());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to mkdir '%s/sys'"), basePath.data());
|
||||
return false;
|
||||
}
|
||||
|
||||
Sstat theStat;
|
||||
/* Extract Apploader */
|
||||
SystemString apploaderPath = basePathStr + _S("/sys/apploader.img");
|
||||
SystemString apploaderPath = basePathStr + _SYS_STR("/sys/apploader.img");
|
||||
if (ctx.force || Stat(apploaderPath.c_str(), &theStat))
|
||||
{
|
||||
if (ctx.progressCB)
|
||||
|
@ -241,7 +241,7 @@ bool IPartition::extractSysFiles(SystemStringView basePath, const ExtractionCont
|
|||
}
|
||||
|
||||
/* Extract Dol */
|
||||
SystemString dolPath = basePathStr + _S("/sys/main.dol");
|
||||
SystemString dolPath = basePathStr + _SYS_STR("/sys/main.dol");
|
||||
if (ctx.force || Stat(dolPath.c_str(), &theStat))
|
||||
{
|
||||
if (ctx.progressCB)
|
||||
|
@ -254,7 +254,7 @@ bool IPartition::extractSysFiles(SystemStringView basePath, const ExtractionCont
|
|||
}
|
||||
|
||||
/* Extract Boot info */
|
||||
SystemString bootPath = basePathStr + _S("/sys/boot.bin");
|
||||
SystemString bootPath = basePathStr + _SYS_STR("/sys/boot.bin");
|
||||
if (ctx.force || Stat(bootPath.c_str(), &theStat))
|
||||
{
|
||||
if (ctx.progressCB)
|
||||
|
@ -266,7 +266,7 @@ bool IPartition::extractSysFiles(SystemStringView basePath, const ExtractionCont
|
|||
}
|
||||
|
||||
/* Extract BI2 info */
|
||||
SystemString bi2Path = basePathStr + _S("/sys/bi2.bin");
|
||||
SystemString bi2Path = basePathStr + _SYS_STR("/sys/bi2.bin");
|
||||
if (ctx.force || Stat(bi2Path.c_str(), &theStat))
|
||||
{
|
||||
if (ctx.progressCB)
|
||||
|
@ -287,22 +287,22 @@ static bool IsSystemFile(SystemStringView name, bool& isDol)
|
|||
if (name.size() < 4)
|
||||
return false;
|
||||
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".dol")))
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _SYS_STR(".dol")))
|
||||
{
|
||||
isDol = true;
|
||||
return true;
|
||||
}
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".rel")))
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _SYS_STR(".rel")))
|
||||
return true;
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".rso")))
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _SYS_STR(".rso")))
|
||||
return true;
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".sel")))
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _SYS_STR(".sel")))
|
||||
return true;
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".bnr")))
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _SYS_STR(".bnr")))
|
||||
return true;
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".elf")))
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _SYS_STR(".elf")))
|
||||
return true;
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".wad")))
|
||||
if (!StrCaseCmp((&*(name.cend() - 4)), _SYS_STR(".wad")))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -375,7 +375,7 @@ bool DiscBuilderBase::PartitionBuilderBase::recursiveBuildNodes(IPartWriteStream
|
|||
{
|
||||
bool patched;
|
||||
xferSz = PatchDOL(*rs, ws, e.m_fileSz, patched);
|
||||
m_parent.m_progressCB(m_parent.getProgressFactor(), e.m_name + (patched ? _S(" [PATCHED]") : _S("")), xferSz);
|
||||
m_parent.m_progressCB(m_parent.getProgressFactor(), e.m_name + (patched ? _SYS_STR(" [PATCHED]") : _SYS_STR("")), xferSz);
|
||||
++m_parent.m_progressIdx;
|
||||
}
|
||||
else
|
||||
|
@ -516,7 +516,7 @@ bool DiscBuilderBase::PartitionBuilderBase::recursiveMergeNodes(IPartWriteStream
|
|||
for (const DirectoryEnumerator::Entry& e : dEnum)
|
||||
{
|
||||
SystemUTF8Conv nameView(e.m_name);
|
||||
SystemString chKeyPath = SystemString(keyPath) + _S('/') + e.m_name;
|
||||
SystemString chKeyPath = SystemString(keyPath) + _SYS_STR('/') + e.m_name;
|
||||
|
||||
if (e.m_isDir)
|
||||
{
|
||||
|
@ -556,7 +556,7 @@ bool DiscBuilderBase::PartitionBuilderBase::recursiveMergeNodes(IPartWriteStream
|
|||
bool patched;
|
||||
xferSz = PatchDOL(*rs, ws, e.m_fileSz, patched);
|
||||
m_parent.m_progressCB(m_parent.getProgressFactor(), e.m_name +
|
||||
(patched ? _S(" [PATCHED]") : _S("")), xferSz);
|
||||
(patched ? _SYS_STR(" [PATCHED]") : _SYS_STR("")), xferSz);
|
||||
++m_parent.m_progressIdx;
|
||||
}
|
||||
else
|
||||
|
@ -583,7 +583,7 @@ bool DiscBuilderBase::PartitionBuilderBase::recursiveMergeNodes(IPartWriteStream
|
|||
for (const auto& p : dirNodes)
|
||||
{
|
||||
SystemStringConv sysName(p.second->getName());
|
||||
SystemString chKeyPath = SystemString(keyPath) + _S('/') + sysName.c_str();
|
||||
SystemString chKeyPath = SystemString(keyPath) + _SYS_STR('/') + sysName.c_str();
|
||||
if (!recursiveMergeNodes(ws, system, p.second, nullptr, chKeyPath))
|
||||
return false;
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ bool DiscBuilderBase::PartitionBuilderBase::recursiveMergeNodes(IPartWriteStream
|
|||
{
|
||||
const Node& ch = *p.second;
|
||||
SystemStringConv sysName(ch.getName());
|
||||
SystemString chKeyPath = SystemString(keyPath) + _S('/') + sysName.c_str();
|
||||
SystemString chKeyPath = SystemString(keyPath) + _SYS_STR('/') + sysName.c_str();
|
||||
|
||||
bool isDol;
|
||||
bool isSys = IsSystemFile(sysName.sys_str(), isDol);
|
||||
|
@ -617,7 +617,7 @@ bool DiscBuilderBase::PartitionBuilderBase::recursiveMergeNodes(IPartWriteStream
|
|||
PatchDOL(dolBuf, xferSz, patched);
|
||||
ws.write(dolBuf.get(), xferSz);
|
||||
m_parent.m_progressCB(m_parent.getProgressFactor(), SystemString(sysName.sys_str()) +
|
||||
(patched ? _S(" [PATCHED]") : _S("")), xferSz);
|
||||
(patched ? _SYS_STR(" [PATCHED]") : _SYS_STR("")), xferSz);
|
||||
++m_parent.m_progressIdx;
|
||||
}
|
||||
else
|
||||
|
@ -669,7 +669,7 @@ bool DiscBuilderBase::PartitionBuilderBase::recursiveMergeFST(const Node* nodeIn
|
|||
for (const DirectoryEnumerator::Entry& e : dEnum)
|
||||
{
|
||||
SystemUTF8Conv nameView(e.m_name);
|
||||
SystemString chKeyPath = SystemString(keyPath) + _S('/') + e.m_name;
|
||||
SystemString chKeyPath = SystemString(keyPath) + _SYS_STR('/') + e.m_name;
|
||||
|
||||
if (e.m_isDir)
|
||||
{
|
||||
|
@ -711,7 +711,7 @@ bool DiscBuilderBase::PartitionBuilderBase::recursiveMergeFST(const Node* nodeIn
|
|||
for (const auto& p : dirNodes)
|
||||
{
|
||||
SystemStringConv sysName(p.second->getName());
|
||||
SystemString chKeyPath = SystemString(keyPath) + _S('/') + sysName.sys_str().data();
|
||||
SystemString chKeyPath = SystemString(keyPath) + _SYS_STR('/') + sysName.sys_str().data();
|
||||
|
||||
size_t dirNodeIdx = m_buildNodes.size();
|
||||
m_buildNodes.emplace_back(true, m_buildNameOff, 0, dirNodeIdx+1);
|
||||
|
@ -729,7 +729,7 @@ bool DiscBuilderBase::PartitionBuilderBase::recursiveMergeFST(const Node* nodeIn
|
|||
{
|
||||
const Node& ch = *p.second;
|
||||
SystemStringConv sysName(ch.getName());
|
||||
SystemString chKeyPath = SystemString(keyPath) + _S('/') + sysName.sys_str().data();
|
||||
SystemString chKeyPath = SystemString(keyPath) + _SYS_STR('/') + sysName.sys_str().data();
|
||||
|
||||
std::pair<uint64_t,uint64_t> fileOffSz = m_fileOffsetsSizes.at(chKeyPath);
|
||||
m_buildNodes.emplace_back(false, m_buildNameOff, packOffset(fileOffSz.first), fileOffSz.second);
|
||||
|
@ -813,33 +813,33 @@ bool DiscBuilderBase::PartitionBuilderBase::buildFromDirectory(IPartWriteStream&
|
|||
{
|
||||
if (dirIn.empty())
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("all arguments must be supplied to buildFromDirectory()"));
|
||||
LogModule.report(logvisor::Error, _SYS_STR("all arguments must be supplied to buildFromDirectory()"));
|
||||
return false;
|
||||
}
|
||||
|
||||
SystemString dirStr(dirIn);
|
||||
SystemString basePath = m_isWii ? dirStr + _S("/") + getKindString(m_kind) : dirStr;
|
||||
SystemString dolIn = basePath + _S("/sys/main.dol");
|
||||
SystemString filesIn = basePath + _S("/files");
|
||||
SystemString basePath = m_isWii ? dirStr + _SYS_STR("/") + getKindString(m_kind) : dirStr;
|
||||
SystemString dolIn = basePath + _SYS_STR("/sys/main.dol");
|
||||
SystemString filesIn = basePath + _SYS_STR("/files");
|
||||
|
||||
/* 1st pass - Tally up total progress steps */
|
||||
m_parent.m_progressTotal += 2; /* Prep and DOL */
|
||||
recursiveBuildNodesPre(filesIn.c_str());
|
||||
|
||||
/* Clear file */
|
||||
m_parent.m_progressCB(m_parent.getProgressFactor(), _S("Preparing output image"), -1);
|
||||
m_parent.m_progressCB(m_parent.getProgressFactor(), _SYS_STR("Preparing output image"), -1);
|
||||
++m_parent.m_progressIdx;
|
||||
|
||||
/* Add root node */
|
||||
m_buildNodes.emplace_back(true, m_buildNameOff, 0, 1);
|
||||
addBuildName(_S("<root>"));
|
||||
addBuildName(_SYS_STR("<root>"));
|
||||
|
||||
/* Write Boot DOL first (first thing seeked to after Apploader) */
|
||||
{
|
||||
Sstat dolStat;
|
||||
if (Stat(dolIn.c_str(), &dolStat))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to stat %s"), dolIn.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), dolIn.c_str());
|
||||
return false;
|
||||
}
|
||||
size_t fileSz = ROUND_UP_32(dolStat.st_size);
|
||||
|
@ -854,7 +854,7 @@ bool DiscBuilderBase::PartitionBuilderBase::buildFromDirectory(IPartWriteStream&
|
|||
bool patched;
|
||||
size_t xferSz = PatchDOL(*rs, ws, dolStat.st_size, patched);
|
||||
m_parent.m_progressCB(m_parent.getProgressFactor(), dolIn +
|
||||
(patched ? _S(" [PATCHED]") : _S("")), xferSz);
|
||||
(patched ? _SYS_STR(" [PATCHED]") : _SYS_STR("")), xferSz);
|
||||
++m_parent.m_progressIdx;
|
||||
for (size_t i=0 ; i<fileSz-xferSz ; ++i)
|
||||
ws.write("\xff", 1);
|
||||
|
@ -875,14 +875,14 @@ uint64_t DiscBuilderBase::PartitionBuilderBase::CalculateTotalSizeBuild(SystemSt
|
|||
PartitionKind kind, bool isWii)
|
||||
{
|
||||
SystemString dirStr(dirIn);
|
||||
SystemString basePath = isWii ? dirStr + _S("/") + getKindString(kind) : dirStr;
|
||||
SystemString dolIn = basePath + _S("/sys/main.dol");
|
||||
SystemString filesIn = basePath + _S("/files");
|
||||
SystemString basePath = isWii ? dirStr + _SYS_STR("/") + getKindString(kind) : dirStr;
|
||||
SystemString dolIn = basePath + _SYS_STR("/sys/main.dol");
|
||||
SystemString filesIn = basePath + _SYS_STR("/files");
|
||||
|
||||
Sstat dolStat;
|
||||
if (Stat(dolIn.c_str(), &dolStat))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to stat %s"), dolIn.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), dolIn.c_str());
|
||||
return -1;
|
||||
}
|
||||
uint64_t totalSz = ROUND_UP_32(dolStat.st_size);
|
||||
|
@ -897,25 +897,25 @@ bool DiscBuilderBase::PartitionBuilderBase::mergeFromDirectory(IPartWriteStream&
|
|||
{
|
||||
if (dirIn.empty())
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("all arguments must be supplied to mergeFromDirectory()"));
|
||||
LogModule.report(logvisor::Error, _SYS_STR("all arguments must be supplied to mergeFromDirectory()"));
|
||||
return false;
|
||||
}
|
||||
|
||||
SystemString dirStr(dirIn);
|
||||
SystemString basePath = m_isWii ? dirStr + _S("/") + getKindString(m_kind) : dirStr;
|
||||
SystemString filesIn = basePath + _S("/files");
|
||||
SystemString basePath = m_isWii ? dirStr + _SYS_STR("/") + getKindString(m_kind) : dirStr;
|
||||
SystemString filesIn = basePath + _SYS_STR("/files");
|
||||
|
||||
/* 1st pass - Tally up total progress steps */
|
||||
m_parent.m_progressTotal += 2; /* Prep and DOL */
|
||||
recursiveMergeNodesPre(&partIn->getFSTRoot(), filesIn.c_str());
|
||||
|
||||
/* Clear file */
|
||||
m_parent.m_progressCB(m_parent.getProgressFactor(), _S("Preparing output image"), -1);
|
||||
m_parent.m_progressCB(m_parent.getProgressFactor(), _SYS_STR("Preparing output image"), -1);
|
||||
++m_parent.m_progressIdx;
|
||||
|
||||
/* Add root node */
|
||||
m_buildNodes.emplace_back(true, m_buildNameOff, 0, 1);
|
||||
addBuildName(_S("<root>"));
|
||||
addBuildName(_SYS_STR("<root>"));
|
||||
|
||||
/* Write Boot DOL first (first thing seeked to after Apploader) */
|
||||
{
|
||||
|
@ -930,8 +930,8 @@ bool DiscBuilderBase::PartitionBuilderBase::mergeFromDirectory(IPartWriteStream&
|
|||
bool patched;
|
||||
PatchDOL(dolBuf, xferSz, patched);
|
||||
ws.write(dolBuf.get(), xferSz);
|
||||
m_parent.m_progressCB(m_parent.getProgressFactor(), SystemString(_S("<boot-dol>")) +
|
||||
(patched ? _S(" [PATCHED]") : _S("")), xferSz);
|
||||
m_parent.m_progressCB(m_parent.getProgressFactor(), SystemString(_SYS_STR("<boot-dol>")) +
|
||||
(patched ? _SYS_STR(" [PATCHED]") : _SYS_STR("")), xferSz);
|
||||
++m_parent.m_progressIdx;
|
||||
for (size_t i=0 ; i<fileSz-xferSz ; ++i)
|
||||
ws.write("\xff", 1);
|
||||
|
@ -953,8 +953,8 @@ uint64_t DiscBuilderBase::PartitionBuilderBase::CalculateTotalSizeMerge(const IP
|
|||
SystemStringView dirIn)
|
||||
{
|
||||
SystemString dirStr(dirIn);
|
||||
SystemString basePath = partIn->isWii() ? dirStr + _S("/") + getKindString(partIn->getKind()) : dirStr;
|
||||
SystemString filesIn = basePath + _S("/files");
|
||||
SystemString basePath = partIn->isWii() ? dirStr + _SYS_STR("/") + getKindString(partIn->getKind()) : dirStr;
|
||||
SystemString filesIn = basePath + _SYS_STR("/files");
|
||||
|
||||
uint64_t totalSz = ROUND_UP_32(partIn->getDOLSize());
|
||||
if (!RecursiveCalculateTotalSize(totalSz, &partIn->getFSTRoot(), filesIn.c_str()))
|
||||
|
|
|
@ -256,29 +256,29 @@ public:
|
|||
SystemString dirStr(dirIn);
|
||||
|
||||
/* Check Apploader */
|
||||
SystemString apploaderIn = dirStr + _S("/sys/apploader.img");
|
||||
SystemString apploaderIn = dirStr + _SYS_STR("/sys/apploader.img");
|
||||
Sstat apploaderStat;
|
||||
if (Stat(apploaderIn.c_str(), &apploaderStat))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to stat %s"), apploaderIn.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), apploaderIn.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check Boot */
|
||||
SystemString bootIn = dirStr + _S("/sys/boot.bin");
|
||||
SystemString bootIn = dirStr + _SYS_STR("/sys/boot.bin");
|
||||
Sstat bootStat;
|
||||
if (Stat(bootIn.c_str(), &bootStat))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to stat %s"), bootIn.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), bootIn.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check BI2 */
|
||||
SystemString bi2In = dirStr + _S("/sys/bi2.bin");
|
||||
SystemString bi2In = dirStr + _SYS_STR("/sys/bi2.bin");
|
||||
Sstat bi2Stat;
|
||||
if (Stat(bi2In.c_str(), &bi2Stat))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to stat %s"), bi2In.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), bi2In.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -368,7 +368,7 @@ public:
|
|||
{
|
||||
std::unique_ptr<uint8_t[]> apploaderBuf = partIn->getApploaderBuf();
|
||||
size_t apploaderSz = partIn->getApploaderSize();
|
||||
SystemString apploaderName(_S("<apploader>"));
|
||||
SystemString apploaderName(_SYS_STR("<apploader>"));
|
||||
ws.write(apploaderBuf.get(), apploaderSz);
|
||||
xferSz += apploaderSz;
|
||||
if (0x2440 + xferSz >= m_curUser)
|
||||
|
@ -390,10 +390,10 @@ EBuildResult DiscBuilderGCN::buildFromDirectory(SystemStringView dirIn)
|
|||
return EBuildResult::Failed;
|
||||
if (!CheckFreeSpace(m_outPath.c_str(), 0x57058000))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("not enough free disk space for %s"), m_outPath.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("not enough free disk space for %s"), m_outPath.c_str());
|
||||
return EBuildResult::DiskFull;
|
||||
}
|
||||
m_progressCB(getProgressFactor(), _S("Preallocating image"), -1);
|
||||
m_progressCB(getProgressFactor(), _SYS_STR("Preallocating image"), -1);
|
||||
++m_progressIdx;
|
||||
{
|
||||
auto ws = m_fileIO->beginWriteStream(0);
|
||||
|
@ -416,7 +416,7 @@ uint64_t DiscBuilderGCN::CalculateTotalSizeRequired(SystemStringView dirIn)
|
|||
sz += 0x30000;
|
||||
if (sz > 0x57058000)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("disc capacity exceeded [%" PRIu64 " / %" PRIu64 "]"), sz, 0x57058000);
|
||||
LogModule.report(logvisor::Error, _SYS_STR("disc capacity exceeded [%" PRIu64 " / %" PRIu64 "]"), sz, 0x57058000);
|
||||
return -1;
|
||||
}
|
||||
return sz;
|
||||
|
@ -439,10 +439,10 @@ EBuildResult DiscMergerGCN::mergeFromDirectory(SystemStringView dirIn)
|
|||
return EBuildResult::Failed;
|
||||
if (!CheckFreeSpace(m_builder.m_outPath.c_str(), 0x57058000))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("not enough free disk space for %s"), m_builder.m_outPath.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("not enough free disk space for %s"), m_builder.m_outPath.c_str());
|
||||
return EBuildResult::DiskFull;
|
||||
}
|
||||
m_builder.m_progressCB(m_builder.getProgressFactor(), _S("Preallocating image"), -1);
|
||||
m_builder.m_progressCB(m_builder.getProgressFactor(), _SYS_STR("Preallocating image"), -1);
|
||||
++m_builder.m_progressIdx;
|
||||
{
|
||||
auto ws = m_builder.m_fileIO->beginWriteStream(0);
|
||||
|
@ -467,7 +467,7 @@ uint64_t DiscMergerGCN::CalculateTotalSizeRequired(DiscGCN& sourceDisc, SystemSt
|
|||
sz += 0x30000;
|
||||
if (sz > 0x57058000)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("disc capacity exceeded [%" PRIu64 " / %" PRIu64 "]"), sz, 0x57058000);
|
||||
LogModule.report(logvisor::Error, _SYS_STR("disc capacity exceeded [%" PRIu64 " / %" PRIu64 "]"), sz, 0x57058000);
|
||||
return -1;
|
||||
}
|
||||
return sz;
|
||||
|
|
|
@ -456,7 +456,7 @@ public:
|
|||
uint32_t h3;
|
||||
if (rs->read(&h3, 4) != 4)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to read H3 offset apploader"));
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to read H3 offset apploader"));
|
||||
return {};
|
||||
}
|
||||
h3 = SBig(h3);
|
||||
|
@ -479,7 +479,7 @@ public:
|
|||
SystemString basePathStr(basePath);
|
||||
|
||||
/* Extract Ticket */
|
||||
SystemString ticketPath = basePathStr + _S("/ticket.bin");
|
||||
SystemString ticketPath = basePathStr + _SYS_STR("/ticket.bin");
|
||||
if (ctx.force || Stat(ticketPath.c_str(), &theStat))
|
||||
{
|
||||
if (ctx.progressCB)
|
||||
|
@ -491,7 +491,7 @@ public:
|
|||
}
|
||||
|
||||
/* Extract TMD */
|
||||
SystemString tmdPath = basePathStr + _S("/tmd.bin");
|
||||
SystemString tmdPath = basePathStr + _SYS_STR("/tmd.bin");
|
||||
if (ctx.force || Stat(tmdPath.c_str(), &theStat))
|
||||
{
|
||||
if (ctx.progressCB)
|
||||
|
@ -503,7 +503,7 @@ public:
|
|||
}
|
||||
|
||||
/* Extract Certs */
|
||||
SystemString certPath = basePathStr + _S("/cert.bin");
|
||||
SystemString certPath = basePathStr + _SYS_STR("/cert.bin");
|
||||
if (ctx.force || Stat(certPath.c_str(), &theStat))
|
||||
{
|
||||
if (ctx.progressCB)
|
||||
|
@ -517,7 +517,7 @@ public:
|
|||
}
|
||||
|
||||
/* Extract H3 */
|
||||
SystemString h3Path = basePathStr + _S("/h3.bin");
|
||||
SystemString h3Path = basePathStr + _SYS_STR("/h3.bin");
|
||||
if (ctx.force || Stat(h3Path.c_str(), &theStat))
|
||||
{
|
||||
if (ctx.progressCB)
|
||||
|
@ -606,16 +606,16 @@ bool DiscWii::extractDiscHeaderFiles(SystemStringView basePath, const Extraction
|
|||
{
|
||||
SystemString basePathStr(basePath);
|
||||
|
||||
if (Mkdir((basePathStr + _S("/disc")).c_str(), 0755) && errno != EEXIST)
|
||||
if (Mkdir((basePathStr + _SYS_STR("/disc")).c_str(), 0755) && errno != EEXIST)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to mkdir '%s/disc'"), basePathStr.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to mkdir '%s/disc'"), basePathStr.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
Sstat theStat;
|
||||
|
||||
/* Extract Header */
|
||||
SystemString headerPath = basePathStr + _S("/disc/header.bin");
|
||||
SystemString headerPath = basePathStr + _SYS_STR("/disc/header.bin");
|
||||
if (ctx.force || Stat(headerPath.c_str(), &theStat))
|
||||
{
|
||||
if (ctx.progressCB)
|
||||
|
@ -632,7 +632,7 @@ bool DiscWii::extractDiscHeaderFiles(SystemStringView basePath, const Extraction
|
|||
}
|
||||
|
||||
/* Extract Region info */
|
||||
SystemString regionPath = basePathStr + _S("/disc/region.bin");
|
||||
SystemString regionPath = basePathStr + _SYS_STR("/disc/region.bin");
|
||||
if (ctx.force || Stat(regionPath.c_str(), &theStat))
|
||||
{
|
||||
if (ctx.progressCB)
|
||||
|
@ -988,7 +988,7 @@ public:
|
|||
}* bfWindow = (BFWindow*)(tmdData.get() + 0x19A);
|
||||
bool good = false;
|
||||
uint64_t attempts = 0;
|
||||
SystemString bfName(_S("Brute force attempts"));
|
||||
SystemString bfName(_SYS_STR("Brute force attempts"));
|
||||
for (int w=0 ; w<7 ; ++w)
|
||||
{
|
||||
for (uint64_t i=0 ; i<UINT64_MAX ; ++i)
|
||||
|
@ -1022,59 +1022,59 @@ public:
|
|||
uint64_t buildFromDirectory(SystemStringView dirIn)
|
||||
{
|
||||
SystemString dirStr(dirIn);
|
||||
SystemString basePath = dirStr + _S("/") + getKindString(m_kind);
|
||||
SystemString basePath = dirStr + _SYS_STR("/") + getKindString(m_kind);
|
||||
|
||||
/* Check Ticket */
|
||||
SystemString ticketIn = basePath + _S("/ticket.bin");
|
||||
SystemString ticketIn = basePath + _SYS_STR("/ticket.bin");
|
||||
Sstat theStat;
|
||||
if (Stat(ticketIn.c_str(), &theStat))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to stat %s"), ticketIn.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), ticketIn.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check TMD */
|
||||
SystemString tmdIn = basePath + _S("/tmd.bin");
|
||||
SystemString tmdIn = basePath + _SYS_STR("/tmd.bin");
|
||||
Sstat tmdStat;
|
||||
if (Stat(tmdIn.c_str(), &tmdStat))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to stat %s"), tmdIn.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), tmdIn.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check Cert */
|
||||
SystemString certIn = basePath + _S("/cert.bin");
|
||||
SystemString certIn = basePath + _SYS_STR("/cert.bin");
|
||||
Sstat certStat;
|
||||
if (Stat(certIn.c_str(), &certStat))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to stat %s"), certIn.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), certIn.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check Apploader */
|
||||
SystemString apploaderIn = basePath + _S("/sys/apploader.img");
|
||||
SystemString apploaderIn = basePath + _SYS_STR("/sys/apploader.img");
|
||||
Sstat apploaderStat;
|
||||
if (Stat(apploaderIn.c_str(), &apploaderStat))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to stat %s"), apploaderIn.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), apploaderIn.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check Boot */
|
||||
SystemString bootIn = basePath + _S("/sys/boot.bin");
|
||||
SystemString bootIn = basePath + _SYS_STR("/sys/boot.bin");
|
||||
Sstat bootStat;
|
||||
if (Stat(bootIn.c_str(), &bootStat))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to stat %s"), bootIn.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), bootIn.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check BI2 */
|
||||
SystemString bi2In = basePath + _S("/sys/bi2.bin");
|
||||
SystemString bi2In = basePath + _SYS_STR("/sys/bi2.bin");
|
||||
Sstat bi2Stat;
|
||||
if (Stat(bi2In.c_str(), &bi2Stat))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to stat %s"), bi2In.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), bi2In.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1235,7 +1235,7 @@ public:
|
|||
{
|
||||
std::unique_ptr<uint8_t[]> apploaderBuf = partIn->getApploaderBuf();
|
||||
size_t apploaderSz = partIn->getApploaderSize();
|
||||
SystemString apploaderName(_S("<apploader>"));
|
||||
SystemString apploaderName(_SYS_STR("<apploader>"));
|
||||
cws.write(apploaderBuf.get(), apploaderSz);
|
||||
xferSz += apploaderSz;
|
||||
if (0x2440 + xferSz >= 0x1F0000)
|
||||
|
@ -1258,7 +1258,7 @@ public:
|
|||
EBuildResult DiscBuilderWii::buildFromDirectory(SystemStringView dirIn)
|
||||
{
|
||||
SystemString dirStr(dirIn);
|
||||
SystemString basePath = SystemString(dirStr) + _S("/") + getKindString(PartitionKind::Data);
|
||||
SystemString basePath = SystemString(dirStr) + _SYS_STR("/") + getKindString(PartitionKind::Data);
|
||||
|
||||
PartitionBuilderWii& pb = static_cast<PartitionBuilderWii&>(*m_partitions[0]);
|
||||
uint64_t filledSz = pb.m_baseOffset;
|
||||
|
@ -1267,10 +1267,10 @@ EBuildResult DiscBuilderWii::buildFromDirectory(SystemStringView dirIn)
|
|||
|
||||
if (!CheckFreeSpace(m_outPath.c_str(), m_discCapacity))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("not enough free disk space for %s"), m_outPath.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("not enough free disk space for %s"), m_outPath.c_str());
|
||||
return EBuildResult::DiskFull;
|
||||
}
|
||||
m_progressCB(getProgressFactor(), _S("Preallocating image"), -1);
|
||||
m_progressCB(getProgressFactor(), _SYS_STR("Preallocating image"), -1);
|
||||
++m_progressIdx;
|
||||
{
|
||||
std::unique_ptr<IFileIO::IWriteStream> ws = m_fileIO->beginWriteStream(0);
|
||||
|
@ -1291,14 +1291,14 @@ EBuildResult DiscBuilderWii::buildFromDirectory(SystemStringView dirIn)
|
|||
return EBuildResult::Failed;
|
||||
}
|
||||
|
||||
m_progressCB(getProgressFactor(), _S("Finishing Disc"), -1);
|
||||
m_progressCB(getProgressFactor(), _SYS_STR("Finishing Disc"), -1);
|
||||
++m_progressIdx;
|
||||
|
||||
/* Populate disc header */
|
||||
std::unique_ptr<IFileIO::IWriteStream> ws = m_fileIO->beginWriteStream(0);
|
||||
if (!ws)
|
||||
return EBuildResult::Failed;
|
||||
SystemString headerPath = basePath + _S("/disc/header.bin");
|
||||
SystemString headerPath = basePath + _SYS_STR("/disc/header.bin");
|
||||
std::unique_ptr<IFileIO::IReadStream> rs = NewFileIO(headerPath.c_str())->beginReadStream();
|
||||
if (!rs)
|
||||
return EBuildResult::Failed;
|
||||
|
@ -1320,7 +1320,7 @@ EBuildResult DiscBuilderWii::buildFromDirectory(SystemStringView dirIn)
|
|||
ws->write(vals, 4);
|
||||
|
||||
/* Populate region info */
|
||||
SystemString regionPath = basePath + _S("/disc/region.bin");
|
||||
SystemString regionPath = basePath + _SYS_STR("/disc/region.bin");
|
||||
rs = NewFileIO(regionPath.c_str())->beginReadStream();
|
||||
if (!rs)
|
||||
return EBuildResult::Failed;
|
||||
|
@ -1364,7 +1364,7 @@ uint64_t DiscBuilderWii::CalculateTotalSizeRequired(SystemStringView dirIn, bool
|
|||
dualLayer = (sz > 0x118240000);
|
||||
if (sz > 0x1FB4E0000)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("disc capacity exceeded [%" PRIu64 " / %" PRIu64 "]"), sz, 0x1FB4E0000);
|
||||
LogModule.report(logvisor::Error, _SYS_STR("disc capacity exceeded [%" PRIu64 " / %" PRIu64 "]"), sz, 0x1FB4E0000);
|
||||
return -1;
|
||||
}
|
||||
return sz;
|
||||
|
@ -1391,10 +1391,10 @@ EBuildResult DiscMergerWii::mergeFromDirectory(SystemStringView dirIn)
|
|||
|
||||
if (!CheckFreeSpace(m_builder.m_outPath.c_str(), m_builder.m_discCapacity))
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("not enough free disk space for %s"), m_builder.m_outPath.c_str());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("not enough free disk space for %s"), m_builder.m_outPath.c_str());
|
||||
return EBuildResult::DiskFull;
|
||||
}
|
||||
m_builder.m_progressCB(m_builder.getProgressFactor(), _S("Preallocating image"), -1);
|
||||
m_builder.m_progressCB(m_builder.getProgressFactor(), _SYS_STR("Preallocating image"), -1);
|
||||
++m_builder.m_progressIdx;
|
||||
{
|
||||
std::unique_ptr<IFileIO::IWriteStream> ws = m_builder.m_fileIO->beginWriteStream(0);
|
||||
|
@ -1415,7 +1415,7 @@ EBuildResult DiscMergerWii::mergeFromDirectory(SystemStringView dirIn)
|
|||
return EBuildResult::Failed;
|
||||
}
|
||||
|
||||
m_builder.m_progressCB(m_builder.getProgressFactor(), _S("Finishing Disc"), -1);
|
||||
m_builder.m_progressCB(m_builder.getProgressFactor(), _SYS_STR("Finishing Disc"), -1);
|
||||
++m_builder.m_progressIdx;
|
||||
|
||||
/* Populate disc header */
|
||||
|
@ -1483,7 +1483,7 @@ uint64_t DiscMergerWii::CalculateTotalSizeRequired(DiscWii& sourceDisc,
|
|||
dualLayer = (sz > 0x118240000);
|
||||
if (sz > 0x1FB4E0000)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("disc capacity exceeded [%" PRIu64 " / %" PRIu64 "]"), sz, 0x1FB4E0000);
|
||||
LogModule.report(logvisor::Error, _SYS_STR("disc capacity exceeded [%" PRIu64 " / %" PRIu64 "]"), sz, 0x1FB4E0000);
|
||||
return -1;
|
||||
}
|
||||
return sz;
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
|
||||
bool exists()
|
||||
{
|
||||
FILE* fp = Fopen(m_path.c_str(), _S("rb"));
|
||||
FILE* fp = Fopen(m_path.c_str(), _SYS_STR("rb"));
|
||||
if (!fp)
|
||||
return false;
|
||||
fclose(fp);
|
||||
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
uint64_t size()
|
||||
{
|
||||
FILE* fp = Fopen(m_path.c_str(), _S("rb"));
|
||||
FILE* fp = Fopen(m_path.c_str(), _SYS_STR("rb"));
|
||||
if (!fp)
|
||||
return 0;
|
||||
FSeek(fp, 0, SEEK_END);
|
||||
|
@ -42,27 +42,27 @@ public:
|
|||
WriteStream(SystemStringView path, int64_t maxWriteSize, bool& err)
|
||||
: m_maxWriteSize(maxWriteSize)
|
||||
{
|
||||
fp = Fopen(path.data(), _S("wb"));
|
||||
fp = Fopen(path.data(), _SYS_STR("wb"));
|
||||
if (!fp)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to open '%s' for writing"), path.data());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to open '%s' for writing"), path.data());
|
||||
err = true;
|
||||
}
|
||||
}
|
||||
WriteStream(SystemStringView path, uint64_t offset, int64_t maxWriteSize, bool& err)
|
||||
: m_maxWriteSize(maxWriteSize)
|
||||
{
|
||||
fp = Fopen(path.data(), _S("ab"));
|
||||
fp = Fopen(path.data(), _SYS_STR("ab"));
|
||||
if (!fp)
|
||||
goto FailLoc;
|
||||
fclose(fp);
|
||||
fp = Fopen(path.data(), _S("r+b"));
|
||||
fp = Fopen(path.data(), _SYS_STR("r+b"));
|
||||
if (!fp)
|
||||
goto FailLoc;
|
||||
FSeek(fp, offset, SEEK_SET);
|
||||
return;
|
||||
FailLoc:
|
||||
LogModule.report(logvisor::Error, _S("unable to open '%s' for writing"), path.data());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to open '%s' for writing"), path.data());
|
||||
err = true;
|
||||
}
|
||||
~WriteStream()
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
{
|
||||
if (FTell(fp) + length > m_maxWriteSize)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("write operation exceeds file's %" PRIi64 "-byte limit"), m_maxWriteSize);
|
||||
LogModule.report(logvisor::Error, _SYS_STR("write operation exceeds file's %" PRIi64 "-byte limit"), m_maxWriteSize);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -104,11 +104,11 @@ public:
|
|||
FILE* fp;
|
||||
ReadStream(SystemStringView path, bool& err)
|
||||
{
|
||||
fp = Fopen(path.data(), _S("rb"));
|
||||
fp = Fopen(path.data(), _SYS_STR("rb"));
|
||||
if (!fp)
|
||||
{
|
||||
err = true;
|
||||
LogModule.report(logvisor::Error, _S("unable to open '%s' for reading"), path.data());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to open '%s' for reading"), path.data());
|
||||
}
|
||||
}
|
||||
ReadStream(SystemStringView path, uint64_t offset, bool& err)
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
#endif
|
||||
if (fp == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to open '%s' for writing"), path.data());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to open '%s' for writing"), path.data());
|
||||
err = true;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
#endif
|
||||
if (fp == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("unable to open '%s' for writing"), path.data());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to open '%s' for writing"), path.data());
|
||||
err = true;
|
||||
return;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
SetFilePointerEx(fp, li, &res, FILE_CURRENT);
|
||||
if (res.QuadPart + int64_t(length) > m_maxWriteSize)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("write operation exceeds file's %" PRIi64 "-byte limit"), m_maxWriteSize);
|
||||
LogModule.report(logvisor::Error, _SYS_STR("write operation exceeds file's %" PRIi64 "-byte limit"), m_maxWriteSize);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
if (fp == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
err = true;
|
||||
LogModule.report(logvisor::Error, _S("unable to open '%s' for reading"), path.data());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to open '%s' for reading"), path.data());
|
||||
}
|
||||
}
|
||||
ReadStream(SystemStringView path, uint64_t offset, bool& err)
|
||||
|
|
|
@ -16,7 +16,7 @@ std::unique_ptr<DiscBase> OpenDiscFromImage(SystemStringView path, bool& isWii)
|
|||
std::unique_ptr<IFileIO> fio = NewFileIO(path);
|
||||
if (!fio->exists())
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("Unable to open '%s'"), path.data());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("Unable to open '%s'"), path.data());
|
||||
return {};
|
||||
}
|
||||
std::unique_ptr<IFileIO::IReadStream> rs = fio->beginReadStream();
|
||||
|
@ -28,7 +28,7 @@ std::unique_ptr<DiscBase> OpenDiscFromImage(SystemStringView path, bool& isWii)
|
|||
uint32_t magic = 0;
|
||||
if (rs->read(&magic, 4) != 4)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("Unable to read magic from '%s'"), path.data());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("Unable to read magic from '%s'"), path.data());
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ std::unique_ptr<DiscBase> OpenDiscFromImage(SystemStringView path, bool& isWii)
|
|||
|
||||
if (!discIO)
|
||||
{
|
||||
LogModule.report(logvisor::Error, _S("'%s' is not a valid image"), path.data());
|
||||
LogModule.report(logvisor::Error, _SYS_STR("'%s' is not a valid image"), path.data());
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue