mirror of https://github.com/AxioDL/nod.git
Merge branch 'master' of https://github.com/AxioDL/NODLib
This commit is contained in:
commit
044a393ff8
|
@ -77,22 +77,24 @@ int main(int argc, char* argv[])
|
||||||
else if (!strcasecmp(argv[1], _S("makegcn")))
|
else if (!strcasecmp(argv[1], _S("makegcn")))
|
||||||
{
|
{
|
||||||
#if NOD_UCS2
|
#if NOD_UCS2
|
||||||
if (_wcslen(argv[2]) < 6)
|
if (wcslen(argv[2]) < 6)
|
||||||
NOD::LogModule.report(LogVisor::FatalError, "game-id is not at least 6 characters");
|
NOD::LogModule.report(LogVisor::FatalError, _S("game-id is not at least 6 characters"));
|
||||||
#else
|
#else
|
||||||
if (strlen(argv[2]) < 6)
|
if (strlen(argv[2]) < 6)
|
||||||
NOD::LogModule.report(LogVisor::FatalError, "game-id is not at least 6 characters");
|
NOD::LogModule.report(LogVisor::FatalError, _S("game-id is not at least 6 characters"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Pre-validate paths */
|
/* Pre-validate paths */
|
||||||
NOD::Sstat theStat;
|
NOD::Sstat theStat;
|
||||||
if (NOD::Stat(argv[4], &theStat) || !S_ISDIR(theStat.st_mode))
|
if (NOD::Stat(argv[4], &theStat) || !S_ISDIR(theStat.st_mode))
|
||||||
NOD::LogModule.report(LogVisor::FatalError, "unable to stat %s as directory", argv[4]);
|
NOD::LogModule.report(LogVisor::FatalError, _S("unable to stat %s as directory"), argv[4]);
|
||||||
if (NOD::Stat(argv[5], &theStat) || !S_ISREG(theStat.st_mode))
|
if (NOD::Stat(argv[5], &theStat) || !S_ISREG(theStat.st_mode))
|
||||||
NOD::LogModule.report(LogVisor::FatalError, "unable to stat %s as file", argv[5]);
|
NOD::LogModule.report(LogVisor::FatalError, _S("unable to stat %s as file"), argv[5]);
|
||||||
if (NOD::Stat(argv[6], &theStat) || !S_ISREG(theStat.st_mode))
|
if (NOD::Stat(argv[6], &theStat) || !S_ISREG(theStat.st_mode))
|
||||||
NOD::LogModule.report(LogVisor::FatalError, "unable to stat %s as file", argv[6]);
|
NOD::LogModule.report(LogVisor::FatalError, "unable to stat %s as file", argv[6]);
|
||||||
|
|
||||||
|
NOD::SystemUTF8View gameId(argv[2]);
|
||||||
|
NOD::SystemUTF8View gameTitle(argv[3]);
|
||||||
size_t lastIdx = -1;
|
size_t lastIdx = -1;
|
||||||
auto progFunc = [&](size_t idx, const NOD::SystemString& name, size_t bytes)
|
auto progFunc = [&](size_t idx, const NOD::SystemString& name, size_t bytes)
|
||||||
{
|
{
|
||||||
|
@ -102,9 +104,9 @@ int main(int argc, char* argv[])
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
if (bytes != -1)
|
if (bytes != -1)
|
||||||
printf("\r%s %" PRISize " B", name.c_str(), bytes);
|
NOD::Printf(_S("\r%s %" PRISize " B"), name.c_str(), bytes);
|
||||||
else
|
else
|
||||||
printf("\r%s", name.c_str());
|
NOD::Printf(_S("\r%s"), name.c_str());
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,12 +114,12 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
NOD::SystemString outPath(argv[4]);
|
NOD::SystemString outPath(argv[4]);
|
||||||
outPath.append(_S(".iso"));
|
outPath.append(_S(".iso"));
|
||||||
NOD::DiscBuilderGCN b(outPath.c_str(), argv[2], argv[3], 0x0003EB60, progFunc);
|
NOD::DiscBuilderGCN b(outPath.c_str(), gameId.utf8_str().c_str(), gameTitle.utf8_str().c_str(), 0x0003EB60, progFunc);
|
||||||
b.buildFromDirectory(argv[4], argv[5], argv[6]);
|
b.buildFromDirectory(argv[4], argv[5], argv[6]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NOD::DiscBuilderGCN b(argv[7], argv[2], argv[3], 0x0003EB60, progFunc);
|
NOD::DiscBuilderGCN b(argv[7], gameId.utf8_str().c_str(), gameTitle.utf8_str().c_str(), 0x0003EB60, progFunc);
|
||||||
b.buildFromDirectory(argv[4], argv[5], argv[6]);
|
b.buildFromDirectory(argv[4], argv[5], argv[6]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,24 +128,26 @@ int main(int argc, char* argv[])
|
||||||
else if (!strcasecmp(argv[1], _S("makewiisl")) || !strcasecmp(argv[1], _S("makewiidl")))
|
else if (!strcasecmp(argv[1], _S("makewiisl")) || !strcasecmp(argv[1], _S("makewiidl")))
|
||||||
{
|
{
|
||||||
#if NOD_UCS2
|
#if NOD_UCS2
|
||||||
if (_wcslen(argv[2]) < 6)
|
if (wcslen(argv[2]) < 6)
|
||||||
NOD::LogModule.report(LogVisor::FatalError, "game-id is not at least 6 characters");
|
NOD::LogModule.report(LogVisor::FatalError, _S("game-id is not at least 6 characters"));
|
||||||
#else
|
#else
|
||||||
if (strlen(argv[2]) < 6)
|
if (strlen(argv[2]) < 6)
|
||||||
NOD::LogModule.report(LogVisor::FatalError, "game-id is not at least 6 characters");
|
NOD::LogModule.report(LogVisor::FatalError, _S("game-id is not at least 6 characters"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Pre-validate paths */
|
/* Pre-validate paths */
|
||||||
NOD::Sstat theStat;
|
NOD::Sstat theStat;
|
||||||
if (NOD::Stat(argv[4], &theStat) || !S_ISDIR(theStat.st_mode))
|
if (NOD::Stat(argv[4], &theStat) || !S_ISDIR(theStat.st_mode))
|
||||||
NOD::LogModule.report(LogVisor::FatalError, "unable to stat %s as directory", argv[4]);
|
NOD::LogModule.report(LogVisor::FatalError, _S("unable to stat %s as directory"), argv[4]);
|
||||||
if (NOD::Stat(argv[5], &theStat) || !S_ISREG(theStat.st_mode))
|
if (NOD::Stat(argv[5], &theStat) || !S_ISREG(theStat.st_mode))
|
||||||
NOD::LogModule.report(LogVisor::FatalError, "unable to stat %s as file", argv[5]);
|
NOD::LogModule.report(LogVisor::FatalError, _S("unable to stat %s as file"), argv[5]);
|
||||||
if (NOD::Stat(argv[6], &theStat) || !S_ISREG(theStat.st_mode))
|
if (NOD::Stat(argv[6], &theStat) || !S_ISREG(theStat.st_mode))
|
||||||
NOD::LogModule.report(LogVisor::FatalError, "unable to stat %s as file", argv[6]);
|
NOD::LogModule.report(LogVisor::FatalError, _S("unable to stat %s as file"), argv[6]);
|
||||||
if (NOD::Stat(argv[7], &theStat) || !S_ISREG(theStat.st_mode))
|
if (NOD::Stat(argv[7], &theStat) || !S_ISREG(theStat.st_mode))
|
||||||
NOD::LogModule.report(LogVisor::FatalError, "unable to stat %s as file", argv[7]);
|
NOD::LogModule.report(LogVisor::FatalError, _S("unable to stat %s as file"), argv[7]);
|
||||||
|
|
||||||
|
NOD::SystemUTF8View gameId(argv[2]);
|
||||||
|
NOD::SystemUTF8View gameTitle(argv[3]);
|
||||||
size_t lastIdx = -1;
|
size_t lastIdx = -1;
|
||||||
auto progFunc = [&](size_t idx, const NOD::SystemString& name, size_t bytes)
|
auto progFunc = [&](size_t idx, const NOD::SystemString& name, size_t bytes)
|
||||||
{
|
{
|
||||||
|
@ -153,9 +157,9 @@ int main(int argc, char* argv[])
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
if (bytes != -1)
|
if (bytes != -1)
|
||||||
printf("\r%s %" PRISize " B", name.c_str(), bytes);
|
NOD::Printf(_S("\r%s %" PRISize " B"), name.c_str(), bytes);
|
||||||
else
|
else
|
||||||
printf("\r%s", name.c_str());
|
NOD::Printf(_S("\r%s"), name.c_str());
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -165,12 +169,12 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
NOD::SystemString outPath(argv[4]);
|
NOD::SystemString outPath(argv[4]);
|
||||||
outPath.append(_S(".iso"));
|
outPath.append(_S(".iso"));
|
||||||
NOD::DiscBuilderWii b(outPath.c_str(), argv[2], argv[3], dual, progFunc);
|
NOD::DiscBuilderWii b(outPath.c_str(), gameId.utf8_str().c_str(), gameTitle.utf8_str().c_str(), dual, progFunc);
|
||||||
b.buildFromDirectory(argv[4], argv[5], argv[6], argv[7]);
|
b.buildFromDirectory(argv[4], argv[5], argv[6], argv[7]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NOD::DiscBuilderWii b(argv[8], argv[2], argv[3], dual, progFunc);
|
NOD::DiscBuilderWii b(argv[8], gameId.utf8_str().c_str(), gameTitle.utf8_str().c_str(), dual, progFunc);
|
||||||
b.buildFromDirectory(argv[4], argv[5], argv[6], argv[7]);
|
b.buildFromDirectory(argv[4], argv[5], argv[6], argv[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <functional>
|
||||||
#include "Util.hpp"
|
#include "Util.hpp"
|
||||||
#include "IDiscIO.hpp"
|
#include "IDiscIO.hpp"
|
||||||
#include "IFileIO.hpp"
|
#include "IFileIO.hpp"
|
||||||
|
|
|
@ -23,11 +23,37 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <LogVisor/LogVisor.hpp>
|
#include <LogVisor/LogVisor.hpp>
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable : 4996)
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
|
||||||
|
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
|
||||||
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(S_ISLNK)
|
||||||
|
#define S_ISLNK(m) 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
|
||||||
namespace NOD
|
namespace NOD
|
||||||
{
|
{
|
||||||
|
/* define our own min/max to avoid MSVC BS */
|
||||||
|
template<typename T>
|
||||||
|
inline T min(T a, T b) { return a < b ? a : b; }
|
||||||
|
template<typename T>
|
||||||
|
inline T max(T a, T b) { return a > b ? a : b; }
|
||||||
|
|
||||||
/* Log Module */
|
/* Log Module */
|
||||||
extern LogVisor::LogModule LogModule;
|
extern LogVisor::LogModule LogModule;
|
||||||
|
@ -52,7 +78,7 @@ static inline void ToLower(SystemString& str)
|
||||||
{std::transform(str.begin(), str.end(), str.begin(), towlower);}
|
{std::transform(str.begin(), str.end(), str.begin(), towlower);}
|
||||||
static inline void ToUpper(SystemString& str)
|
static inline void ToUpper(SystemString& str)
|
||||||
{std::transform(str.begin(), str.end(), str.begin(), towupper);}
|
{std::transform(str.begin(), str.end(), str.begin(), towupper);}
|
||||||
static inline size_t StrLen(const SystemChar* str) {return _wcslen(str);}
|
static inline size_t StrLen(const SystemChar* str) {return wcslen(str);}
|
||||||
class SystemUTF8View
|
class SystemUTF8View
|
||||||
{
|
{
|
||||||
std::string m_utf8;
|
std::string m_utf8;
|
||||||
|
@ -111,7 +137,7 @@ public:
|
||||||
|
|
||||||
static inline void Unlink(const SystemChar* file)
|
static inline void Unlink(const SystemChar* file)
|
||||||
{
|
{
|
||||||
#if _WIN32
|
#if NOD_UCS2
|
||||||
_wunlink(file);
|
_wunlink(file);
|
||||||
#else
|
#else
|
||||||
unlink(file);
|
unlink(file);
|
||||||
|
@ -120,8 +146,8 @@ static inline void Unlink(const SystemChar* file)
|
||||||
|
|
||||||
static inline int StrCmp(const SystemChar* str1, const SystemChar* str2)
|
static inline int StrCmp(const SystemChar* str1, const SystemChar* str2)
|
||||||
{
|
{
|
||||||
#if HECL_UCS2
|
#if NOD_UCS2
|
||||||
return _wcscmp(str1, str2);
|
return wcscmp(str1, str2);
|
||||||
#else
|
#else
|
||||||
return strcmp(str1, str2);
|
return strcmp(str1, str2);
|
||||||
#endif
|
#endif
|
||||||
|
@ -129,7 +155,7 @@ static inline int StrCmp(const SystemChar* str1, const SystemChar* str2)
|
||||||
|
|
||||||
static inline int StrCaseCmp(const SystemChar* str1, const SystemChar* str2)
|
static inline int StrCaseCmp(const SystemChar* str1, const SystemChar* str2)
|
||||||
{
|
{
|
||||||
#if HECL_UCS2
|
#if NOD_UCS2
|
||||||
return _wcsicmp(str1, str2);
|
return _wcsicmp(str1, str2);
|
||||||
#else
|
#else
|
||||||
return strcasecmp(str1, str2);
|
return strcasecmp(str1, str2);
|
||||||
|
@ -279,6 +305,21 @@ static inline bool CheckFreeSpace(const SystemChar* path, size_t reqSz)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __GNUC__
|
||||||
|
__attribute__((__format__ (__printf__, 1, 2)))
|
||||||
|
#endif
|
||||||
|
static inline void Printf(const SystemChar* fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
#if NOD_UCS2
|
||||||
|
vwprintf(fmt, args);
|
||||||
|
#else
|
||||||
|
vprintf(fmt, args);
|
||||||
|
#endif
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __NOD_UTIL_HPP__
|
#endif // __NOD_UTIL_HPP__
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,9 +146,14 @@ static uint64_t GetInode(const SystemChar* path)
|
||||||
{
|
{
|
||||||
uint64_t inode;
|
uint64_t inode;
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
OFSTRUCT ofs;
|
HANDLE fp = CreateFileW(path,
|
||||||
HFILE fp = OpenFile(path, &ofs, OF_READ);
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
if (fp == HFILE_ERROR)
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
|
nullptr,
|
||||||
|
OPEN_EXISTING,
|
||||||
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
|
nullptr);
|
||||||
|
if (!fp)
|
||||||
LogModule.report(LogVisor::FatalError, _S("unable to open %s"), path);
|
LogModule.report(LogVisor::FatalError, _S("unable to open %s"), path);
|
||||||
BY_HANDLE_FILE_INFORMATION info;
|
BY_HANDLE_FILE_INFORMATION info;
|
||||||
if (!GetFileInformationByHandle(fp, &info))
|
if (!GetFileInformationByHandle(fp, &info))
|
||||||
|
@ -170,22 +176,22 @@ static bool IsSystemFile(const SystemString& name, bool& isDol)
|
||||||
if (name.size() < 4)
|
if (name.size() < 4)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!StrCaseCmp((&*name.cend()) - 4, _S(".dol")))
|
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".dol")))
|
||||||
{
|
{
|
||||||
isDol = true;
|
isDol = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!StrCaseCmp((&*name.cend()) - 4, _S(".rel")))
|
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".rel")))
|
||||||
return true;
|
return true;
|
||||||
if (!StrCaseCmp((&*name.cend()) - 4, _S(".rso")))
|
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".rso")))
|
||||||
return true;
|
return true;
|
||||||
if (!StrCaseCmp((&*name.cend()) - 4, _S(".sel")))
|
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".sel")))
|
||||||
return true;
|
return true;
|
||||||
if (!StrCaseCmp((&*name.cend()) - 4, _S(".bnr")))
|
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".bnr")))
|
||||||
return true;
|
return true;
|
||||||
if (!StrCaseCmp((&*name.cend()) - 4, _S(".elf")))
|
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".elf")))
|
||||||
return true;
|
return true;
|
||||||
if (!StrCaseCmp((&*name.cend()) - 4, _S(".wad")))
|
if (!StrCaseCmp((&*(name.cend() - 4)), _S(".wad")))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -243,7 +249,7 @@ void DiscBuilderBase::PartitionBuilderBase::recursiveBuildNodes(IPartWriteStream
|
||||||
++m_parent.m_progressIdx;
|
++m_parent.m_progressIdx;
|
||||||
while (xferSz < e.m_fileSz)
|
while (xferSz < e.m_fileSz)
|
||||||
{
|
{
|
||||||
size_t rdSz = rs->read(buf, std::min(0x8000ul, e.m_fileSz - xferSz));
|
size_t rdSz = rs->read(buf, NOD::min(size_t(0x8000ul), e.m_fileSz - xferSz));
|
||||||
if (!rdSz)
|
if (!rdSz)
|
||||||
break;
|
break;
|
||||||
ws.write(buf, rdSz);
|
ws.write(buf, rdSz);
|
||||||
|
@ -295,11 +301,11 @@ bool DiscBuilderBase::PartitionBuilderBase::buildFromDirectory(IPartWriteStream&
|
||||||
const SystemChar* apploaderIn)
|
const SystemChar* apploaderIn)
|
||||||
{
|
{
|
||||||
if (!dirIn || !dolIn || !apploaderIn)
|
if (!dirIn || !dolIn || !apploaderIn)
|
||||||
LogModule.report(LogVisor::FatalError, "all arguments must be supplied to buildFromDirectory()");
|
LogModule.report(LogVisor::FatalError, _S("all arguments must be supplied to buildFromDirectory()"));
|
||||||
|
|
||||||
/* Clear file */
|
/* Clear file */
|
||||||
++m_parent.m_progressIdx;
|
++m_parent.m_progressIdx;
|
||||||
m_parent.m_progressCB(m_parent.m_progressIdx, "Preparing output image", -1);
|
m_parent.m_progressCB(m_parent.m_progressIdx, _S("Preparing output image"), -1);
|
||||||
|
|
||||||
/* Add root node */
|
/* Add root node */
|
||||||
m_buildNodes.emplace_back(true, m_buildNameOff, 0, 1);
|
m_buildNodes.emplace_back(true, m_buildNameOff, 0, 1);
|
||||||
|
@ -314,9 +320,30 @@ bool DiscBuilderBase::PartitionBuilderBase::buildFromDirectory(IPartWriteStream&
|
||||||
uint64_t fileOff = userAllocate(fileSz, ws);
|
uint64_t fileOff = userAllocate(fileSz, ws);
|
||||||
m_dolOffset = fileOff;
|
m_dolOffset = fileOff;
|
||||||
m_dolSize = fileSz;
|
m_dolSize = fileSz;
|
||||||
|
<<<<<<< HEAD
|
||||||
std::unique_ptr<IFileIO::IReadStream> rs = NewFileIO(dolIn)->beginReadStream();
|
std::unique_ptr<IFileIO::IReadStream> rs = NewFileIO(dolIn)->beginReadStream();
|
||||||
size_t xferSz = PatchDOL(*rs, ws, dolStat.st_size);
|
size_t xferSz = PatchDOL(*rs, ws, dolStat.st_size);
|
||||||
m_parent.m_progressCB(++m_parent.m_progressIdx, SystemString(dolIn) + _S(" [PATCHED]"), xferSz);
|
m_parent.m_progressCB(++m_parent.m_progressIdx, SystemString(dolIn) + _S(" [PATCHED]"), xferSz);
|
||||||
|
=======
|
||||||
|
std::unique_ptr<IFileIO::IWriteStream> ws = m_parent.getFileIO().beginWriteStream(fileOff);
|
||||||
|
FILE* fp = Fopen(dolIn, _S("rb"), FileLockType::Read);
|
||||||
|
if (!fp)
|
||||||
|
LogModule.report(LogVisor::FatalError, _S("unable to open '%s' for reading"), dolIn);
|
||||||
|
char buf[8192];
|
||||||
|
size_t xferSz = 0;
|
||||||
|
SystemString dolName(dolIn);
|
||||||
|
++m_parent.m_progressIdx;
|
||||||
|
while (xferSz < dolStat.st_size)
|
||||||
|
{
|
||||||
|
size_t rdSz = fread(buf, 1, NOD::min(size_t(8192), dolStat.st_size - xferSz), fp);
|
||||||
|
if (!rdSz)
|
||||||
|
break;
|
||||||
|
ws->write(buf, rdSz);
|
||||||
|
xferSz += rdSz;
|
||||||
|
m_parent.m_progressCB(m_parent.m_progressIdx, dolName, xferSz);
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
>>>>>>> 1c740a3da8495cfaebb7dc648602b9273c097a74
|
||||||
for (size_t i=0 ; i<fileSz-xferSz ; ++i)
|
for (size_t i=0 ; i<fileSz-xferSz ; ++i)
|
||||||
ws.write("\xff", 1);
|
ws.write("\xff", 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ public:
|
||||||
std::unique_ptr<IDiscIO::IReadStream> rs = m_parent.getDiscIO().beginReadStream(m_offset);
|
std::unique_ptr<IDiscIO::IReadStream> rs = m_parent.getDiscIO().beginReadStream(m_offset);
|
||||||
while (rem)
|
while (rem)
|
||||||
{
|
{
|
||||||
size_t rdSz = std::min(rem, 8192ul);
|
size_t rdSz = NOD::min(rem, size_t(8192ul));
|
||||||
rs->read(buf, rdSz);
|
rs->read(buf, rdSz);
|
||||||
fwrite(buf, 1, rdSz, fp);
|
fwrite(buf, 1, rdSz, fp);
|
||||||
rem -= rdSz;
|
rem -= rdSz;
|
||||||
|
@ -876,7 +876,7 @@ bool DiscBuilderWii::buildFromDirectory(const SystemChar* dirIn, const SystemCha
|
||||||
}
|
}
|
||||||
|
|
||||||
++m_progressIdx;
|
++m_progressIdx;
|
||||||
m_progressCB(m_progressIdx, "Finishing Disc", -1);
|
m_progressCB(m_progressIdx, _S("Finishing Disc"), -1);
|
||||||
|
|
||||||
/* Populate disc header */
|
/* Populate disc header */
|
||||||
std::unique_ptr<IFileIO::IWriteStream> ws = m_fileIO->beginWriteStream(0);
|
std::unique_ptr<IFileIO::IWriteStream> ws = m_fileIO->beginWriteStream(0);
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
# define SHA_BIG_ENDIAN
|
# define SHA_BIG_ENDIAN
|
||||||
# endif
|
# endif
|
||||||
#else // ! defined __LITTLE_ENDIAN__
|
#else // ! defined __LITTLE_ENDIAN__
|
||||||
|
#ifndef _WIN32
|
||||||
# include <endian.h> // machine/endian.h
|
# include <endian.h> // machine/endian.h
|
||||||
|
#endif
|
||||||
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||||
# define SHA_BIG_ENDIAN
|
# define SHA_BIG_ENDIAN
|
||||||
# endif
|
# endif
|
||||||
|
|
Loading…
Reference in New Issue