summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
authorLPFaint99 <lpfaint99@gmail.com>2012-02-01 16:50:09 -0800
committerLPFaint99 <lpfaint99@gmail.com>2012-02-01 16:50:09 -0800
commit5cfb03da26f06939b9d0d0437f96fe52b34949e2 (patch)
treec70d40e008d75ddd6f7fdf57916958fd8856345c /Source/Core/DiscIO
parent013bda74ee4e7fb2615455826bd6a301ca7e7c64 (diff)
parentd6de53f235a269c484f5f12f8adcc8ab9f62ef10 (diff)
Merge branch 'variousSmallFixes'
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/Src/NANDContentLoader.cpp32
-rw-r--r--Source/Core/DiscIO/Src/NANDContentLoader.h2
2 files changed, 21 insertions, 13 deletions
diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp
index c8e409636b..f010b7ed98 100644
--- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp
+++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp
@@ -191,6 +191,8 @@ const SNANDContent* CNANDContentLoader::GetContentByIndex(int _Index) const
bool CNANDContentLoader::Initialize(const std::string& _rName)
{
+ if (_rName.empty())
+ return false;
m_Path = _rName;
WiiWAD Wad(_rName);
u8* pDataApp = NULL;
@@ -221,7 +223,7 @@ bool CNANDContentLoader::Initialize(const std::string& _rName)
File::IOFile pTMDFile(TMDFileName, "rb");
if (!pTMDFile)
{
- ERROR_LOG(DISCIO, "CreateFromDirectory: error opening %s",
+ DEBUG_LOG(DISCIO, "CreateFromDirectory: error opening %s",
TMDFileName.c_str());
return false;
}
@@ -536,20 +538,14 @@ u64 CNANDContentManager::Install_WiiWAD(std::string &fileName)
pTMDFile.Close();
- //Extract and copy WAD's ticket to ticket directory
- std::string TicketFileName = Common::GetTicketFileName(TitleID);
- File::CreateFullPath(TicketFileName);
- File::IOFile pTicketFile(TicketFileName, "wb");
- if (!pTicketFile)
- {
- PanicAlertT("WAD installation failed: error creating %s", TicketFileName.c_str());
- return 0;
- }
- if (ContentLoader.GetTIK())
+
+ //Extract and copy WAD's ticket to ticket directory
+ if (!Add_Ticket(TitleID, ContentLoader.GetTIK(), ContentLoader.GetTIKSize()))
{
- pTicketFile.WriteBytes(ContentLoader.GetTIK(), ContentLoader.GetTIKSize());
+ PanicAlertT("WAD installation failed: error creating ticket");
+ return 0;
}
cUIDsys::AccessInstance().AddTitle(TitleID);
@@ -558,6 +554,18 @@ u64 CNANDContentManager::Install_WiiWAD(std::string &fileName)
return TitleID;
}
+bool Add_Ticket(u64 TitleID, const u8 *p_tik, u32 tikSize)
+{
+ std::string TicketFileName = Common::GetTicketFileName(TitleID);
+ File::CreateFullPath(TicketFileName);
+ File::IOFile pTicketFile(TicketFileName, "wb");
+ if (!pTicketFile || !p_tik)
+ {
+ //PanicAlertT("WAD installation failed: error creating %s", TicketFileName.c_str());
+ return false;
+ }
+ return pTicketFile.WriteBytes(p_tik, tikSize);
+}
} // namespace end
diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.h b/Source/Core/DiscIO/Src/NANDContentLoader.h
index 14a2062641..63135df693 100644
--- a/Source/Core/DiscIO/Src/NANDContentLoader.h
+++ b/Source/Core/DiscIO/Src/NANDContentLoader.h
@@ -29,7 +29,7 @@
namespace DiscIO
{
-
+ bool Add_Ticket(u64 TitleID, const u8 *p_tik, u32 tikSize);
struct SNANDContent
{
u32 m_ContentID;