split adding the ticket to its own function (installing a wad)

This commit is contained in:
LPFaint99 2011-08-21 18:20:22 -07:00
parent 1f83078b5f
commit 3fb42f6bb6
2 changed files with 18 additions and 12 deletions

View File

@ -536,28 +536,34 @@ 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)
if (!Add_Ticket(TitleID, ContentLoader.GetTIK(), ContentLoader.GetTIKSize()))
{
PanicAlertT("WAD installation failed: error creating %s", TicketFileName.c_str());
PanicAlertT("WAD installation failed: error creating ticket");
return 0;
}
if (ContentLoader.GetTIK())
{
pTicketFile.WriteBytes(ContentLoader.GetTIK(), ContentLoader.GetTIKSize());
}
cUIDsys::AccessInstance().AddTitle(TitleID);
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

View File

@ -29,7 +29,7 @@
namespace DiscIO
{
bool Add_Ticket(u64 TitleID, const u8 *p_tik, u32 tikSize);
struct SNANDContent
{
u32 m_ContentID;