mirror of
https://github.com/AxioDL/nod.git
synced 2025-12-18 01:15:22 +00:00
System files added to Wii partition first to keep 32-bit loaders happy
This commit is contained in:
@@ -6,6 +6,29 @@
|
||||
namespace NOD
|
||||
{
|
||||
|
||||
struct CaseInsensitiveCompare
|
||||
{
|
||||
bool operator()(const std::string& lhs, const std::string& rhs) const
|
||||
{
|
||||
#if _WIN32
|
||||
if (_stricmp(lhs.c_str(), rhs.c_str()) < 0)
|
||||
#else
|
||||
if (strcasecmp(lhs.c_str(), rhs.c_str()) < 0)
|
||||
#endif
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
bool operator()(const std::wstring& lhs, const std::wstring& rhs) const
|
||||
{
|
||||
if (_wcsicmp(lhs.c_str(), rhs.c_str()) < 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
class DirectoryEnumerator
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "Util.hpp"
|
||||
@@ -300,10 +301,10 @@ public:
|
||||
class DiscBuilderBase
|
||||
{
|
||||
public:
|
||||
class IPartitionBuilder
|
||||
class PartitionBuilderBase
|
||||
{
|
||||
public:
|
||||
virtual ~IPartitionBuilder() {}
|
||||
virtual ~PartitionBuilderBase() {}
|
||||
enum class Kind : uint32_t
|
||||
{
|
||||
Data,
|
||||
@@ -311,13 +312,15 @@ public:
|
||||
Channel
|
||||
};
|
||||
protected:
|
||||
std::unordered_map<SystemString, std::pair<uint64_t,uint64_t>> m_fileOffsetsSizes;
|
||||
std::vector<FSTNode> m_buildNodes;
|
||||
std::vector<std::string> m_buildNames;
|
||||
size_t m_buildNameOff = 0;
|
||||
virtual uint64_t userAllocate(uint64_t reqSz)=0;
|
||||
virtual uint32_t packOffset(uint64_t offset) const=0;
|
||||
void recursiveBuildNodes(const SystemChar* dirIn, uint64_t dolInode,
|
||||
std::function<void(void)> incParents);
|
||||
void recursiveBuildNodes(bool system, const SystemChar* dirIn, uint64_t dolInode);
|
||||
void recursiveBuildFST(const SystemChar* dirIn, uint64_t dolInode,
|
||||
std::function<void(void)> incParents);
|
||||
void addBuildName(const SystemString& str)
|
||||
{
|
||||
SystemUTF8View utf8View(str);
|
||||
@@ -333,8 +336,8 @@ public:
|
||||
uint64_t m_dolOffset = 0;
|
||||
uint64_t m_dolSize = 0;
|
||||
public:
|
||||
IPartitionBuilder(DiscBuilderBase& parent, Kind kind,
|
||||
const char gameID[6], const char* gameTitle)
|
||||
PartitionBuilderBase(DiscBuilderBase& parent, Kind kind,
|
||||
const char gameID[6], const char* gameTitle)
|
||||
: m_parent(parent), m_kind(kind), m_gameTitle(gameTitle)
|
||||
{
|
||||
memcpy(m_gameID, gameID, 6);
|
||||
@@ -347,7 +350,7 @@ public:
|
||||
};
|
||||
protected:
|
||||
std::unique_ptr<IFileIO> m_fileIO;
|
||||
std::vector<std::unique_ptr<IPartitionBuilder>> m_partitions;
|
||||
std::vector<std::unique_ptr<PartitionBuilderBase>> m_partitions;
|
||||
public:
|
||||
std::function<void(size_t idx, const SystemString&, size_t)> m_progressCB;
|
||||
size_t m_progressIdx = 0;
|
||||
|
||||
@@ -48,6 +48,7 @@ static inline void ToLower(SystemString& str)
|
||||
{std::transform(str.begin(), str.end(), str.begin(), towlower);}
|
||||
static inline void ToUpper(SystemString& str)
|
||||
{std::transform(str.begin(), str.end(), str.begin(), towupper);}
|
||||
static inline size_t StrLen(const SystemChar* str) {return _wcslen(str);}
|
||||
class SystemUTF8View
|
||||
{
|
||||
std::string m_utf8;
|
||||
@@ -82,6 +83,7 @@ static inline void ToLower(SystemString& str)
|
||||
{std::transform(str.begin(), str.end(), str.begin(), tolower);}
|
||||
static inline void ToUpper(SystemString& str)
|
||||
{std::transform(str.begin(), str.end(), str.begin(), toupper);}
|
||||
static inline size_t StrLen(const SystemChar* str) {return strlen(str);}
|
||||
class SystemUTF8View
|
||||
{
|
||||
const std::string& m_utf8;
|
||||
@@ -112,6 +114,24 @@ static inline void Unlink(const SystemChar* file)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int StrCmp(const SystemChar* str1, const SystemChar* str2)
|
||||
{
|
||||
#if HECL_UCS2
|
||||
return _wcscmp(str1, str2);
|
||||
#else
|
||||
return strcmp(str1, str2);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int StrCaseCmp(const SystemChar* str1, const SystemChar* str2)
|
||||
{
|
||||
#if HECL_UCS2
|
||||
return _wcsicmp(str1, str2);
|
||||
#else
|
||||
return strcasecmp(str1, str2);
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef bswap16
|
||||
#undef bswap32
|
||||
#undef bswap64
|
||||
|
||||
Reference in New Issue
Block a user