summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/Src/NANDContentLoader.cpp
diff options
context:
space:
mode:
authorLPFaint99 <lpfaint99@gmail.com>2011-08-21 18:20:22 -0700
committerLPFaint99 <lpfaint99@gmail.com>2012-02-01 00:03:16 -0800
commit3fb42f6bb618aa70c5879806885d838e920611cf (patch)
tree184e7b5ebfe8506c4e3a9caf0cc2aae35ddb7fc6 /Source/Core/DiscIO/Src/NANDContentLoader.cpp
parent1f83078b5f1b00beff173510838b64be5b0434fa (diff)
split adding the ticket to its own function (installing a wad)
Diffstat (limited to 'Source/Core/DiscIO/Src/NANDContentLoader.cpp')
-rw-r--r--Source/Core/DiscIO/Src/NANDContentLoader.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp
index c8e409636b..3e799ffd8b 100644
--- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp
+++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp
@@ -536,20 +536,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 +552,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