mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge large parts of nakeee's "Soap" branch into trunk, after fixing a few crash bugs in FileUtil.cpp.
Not really anything interesting, just some better comments, some slightly more portable/cleaner code in places. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2459 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -23,6 +23,7 @@
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
IFileSystem::IFileSystem(const IVolume *_rVolume)
|
||||
: m_rVolume(_rVolume)
|
||||
{}
|
||||
@ -47,4 +48,5 @@ IFileSystem* CreateFileSystem(const IVolume* _rVolume)
|
||||
|
||||
return pFileSystem;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -67,10 +67,10 @@ CNANDContentLoader::CNANDContentLoader(const std::string& _rName)
|
||||
|
||||
SNANDContent* CNANDContentLoader::GetContentByIndex(int _Index)
|
||||
{
|
||||
for (size_t i=0; i<m_TileMetaContent.size(); i++)
|
||||
for (size_t i=0; i<m_TitleMetaContent.size(); i++)
|
||||
{
|
||||
if (m_TileMetaContent[i].m_Index == _Index)
|
||||
return &m_TileMetaContent[i];
|
||||
if (m_TitleMetaContent[i].m_Index == _Index)
|
||||
return &m_TitleMetaContent[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -79,7 +79,7 @@ bool CNANDContentLoader::CreateFromWAD(const std::string& _rName)
|
||||
{
|
||||
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str());
|
||||
if (pReader == NULL)
|
||||
return false;
|
||||
return false;
|
||||
|
||||
if (!ParseWAD(*pReader))
|
||||
{
|
||||
@ -89,6 +89,7 @@ bool CNANDContentLoader::CreateFromWAD(const std::string& _rName)
|
||||
delete pReader;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CNANDContentLoader::CreateFromDirectory(const std::string& _rPath)
|
||||
{
|
||||
std::string TMDFileName(_rPath);
|
||||
@ -108,12 +109,11 @@ bool CNANDContentLoader::CreateFromDirectory(const std::string& _rPath)
|
||||
m_BootIndex = Common::swap16(pTMD + 0x01e0);
|
||||
m_TitleID = Common::swap64(pTMD + 0x018C);
|
||||
|
||||
m_TitleMetaContent.resize(numEntries);
|
||||
|
||||
m_TileMetaContent.resize(numEntries);
|
||||
|
||||
for (u32 i=0; i<numEntries; i++)
|
||||
for (u32 i = 0; i < numEntries; i++)
|
||||
{
|
||||
SNANDContent& rContent = m_TileMetaContent[i];
|
||||
SNANDContent& rContent = m_TitleMetaContent[i];
|
||||
|
||||
rContent.m_ContentID = Common::swap32(pTMD + 0x01e4 + 0x24*i);
|
||||
rContent.m_Index = Common::swap16(pTMD + 0x01e8 + 0x24*i);
|
||||
@ -216,11 +216,11 @@ bool CNANDContentLoader::ParseTMD(u8* pDataApp, u32 pDataAppSize, u8* pTicket, u
|
||||
|
||||
u8* p = pDataApp;
|
||||
|
||||
m_TileMetaContent.resize(numEntries);
|
||||
m_TitleMetaContent.resize(numEntries);
|
||||
|
||||
for (u32 i=0; i<numEntries; i++)
|
||||
{
|
||||
SNANDContent& rContent = m_TileMetaContent[i];
|
||||
SNANDContent& rContent = m_TitleMetaContent[i];
|
||||
|
||||
rContent.m_ContentID = Common::swap32(pTMD + 0x01e4 + 0x24*i);
|
||||
rContent.m_Index = Common::swap16(pTMD + 0x01e8 + 0x24*i);
|
||||
|
@ -42,16 +42,12 @@ public:
|
||||
CNANDContentLoader(const std::string& _rName);
|
||||
|
||||
bool IsValid() const { return m_Valid; }
|
||||
|
||||
u64 GetTitleID() const { return m_TitleID; }
|
||||
|
||||
u32 GetBootIndex() const { return m_BootIndex; }
|
||||
|
||||
size_t GetContentSize() const { return m_TileMetaContent.size(); }
|
||||
|
||||
size_t GetContentSize() const { return m_TitleMetaContent.size(); }
|
||||
SNANDContent* GetContentByIndex(int _Index);
|
||||
|
||||
static bool IsWiiWAD(const std::string& _rName);
|
||||
static bool IsWiiWAD(const std::string& _rName);
|
||||
|
||||
private:
|
||||
|
||||
@ -59,7 +55,7 @@ private:
|
||||
u64 m_TitleID;
|
||||
u32 m_BootIndex;
|
||||
|
||||
std::vector<SNANDContent> m_TileMetaContent;
|
||||
std::vector<SNANDContent> m_TitleMetaContent;
|
||||
|
||||
bool CreateFromDirectory(const std::string& _rPath);
|
||||
bool CreateFromWAD(const std::string& _rName);
|
||||
|
@ -424,7 +424,7 @@ void CVolumeDirectory::WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u
|
||||
{
|
||||
u32 myOffset = fstOffset;
|
||||
u32 myEntryNum = myOffset / ENTRY_SIZE;
|
||||
WriteEntryData(fstOffset, DIRECTORY_ENTRY, nameOffset, parentEntryNum, myEntryNum + entry.size + 1);
|
||||
WriteEntryData(fstOffset, DIRECTORY_ENTRY, nameOffset, parentEntryNum, (u32)(myEntryNum + entry.size + 1));
|
||||
WriteEntryName(nameOffset, entry.virtualName);
|
||||
|
||||
for(std::vector<File::FSTEntry>::const_iterator iter = entry.children.begin(); iter != entry.children.end(); ++iter)
|
||||
@ -435,7 +435,7 @@ void CVolumeDirectory::WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u
|
||||
else
|
||||
{
|
||||
// put entry in FST
|
||||
WriteEntryData(fstOffset, FILE_ENTRY, nameOffset, dataOffset, entry.size);
|
||||
WriteEntryData(fstOffset, FILE_ENTRY, nameOffset, dataOffset, (u32)entry.size);
|
||||
WriteEntryName(nameOffset, entry.virtualName);
|
||||
|
||||
// write entry to virtual disk
|
||||
@ -466,7 +466,7 @@ static u32 ComputeNameSize(const File::FSTEntry& parentEntry)
|
||||
|
||||
u32 CVolumeDirectory::AddDirectoryEntries(const std::string& _Directory, File::FSTEntry& parentEntry)
|
||||
{
|
||||
u32 foundEntries = ScanDirectoryTree(_Directory, parentEntry);
|
||||
u32 foundEntries = ScanDirectoryTree(_Directory.c_str(), parentEntry);
|
||||
m_totalNameSize += ComputeNameSize(parentEntry);
|
||||
return foundEntries;
|
||||
}
|
||||
|
Reference in New Issue
Block a user