From 3fb42f6bb618aa70c5879806885d838e920611cf Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Sun, 21 Aug 2011 18:20:22 -0700 Subject: split adding the ticket to its own function (installing a wad) --- Source/Core/DiscIO/Src/NANDContentLoader.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'Source/Core/DiscIO/Src/NANDContentLoader.cpp') 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 -- cgit v1.2.3 From 8e332948bff6355daaac33da013a05f8919ad084 Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Sun, 21 Aug 2011 21:09:18 -0700 Subject: less log noise from CNandContentLoader --- Source/Core/DiscIO/Src/NANDContentLoader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/Src/NANDContentLoader.cpp') diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp index 3e799ffd8b..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; } -- cgit v1.2.3