From 306c9107105c76fa4a65ee3649c84b769f3a70d4 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 4 Jul 2015 10:30:00 -0700 Subject: [PATCH 1/2] Fix apploader extraction --- lib/DiscGCN.cpp | 2 +- lib/DiscWii.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/DiscGCN.cpp b/lib/DiscGCN.cpp index 4969414..665c406 100644 --- a/lib/DiscGCN.cpp +++ b/lib/DiscGCN.cpp @@ -18,7 +18,7 @@ public: m_fstSz = SBig(vals[2]); s->seek(0x2440 + 0x14); s->read(vals, 8); - m_apploaderSz = SBig(vals[0]) + SBig(vals[1]); + m_apploaderSz = 32 + SBig(vals[0]) + SBig(vals[1]); /* Yay files!! */ parseFST(*s.get()); diff --git a/lib/DiscWii.cpp b/lib/DiscWii.cpp index f7a8ec1..7c29541 100644 --- a/lib/DiscWii.cpp +++ b/lib/DiscWii.cpp @@ -236,7 +236,7 @@ public: m_fstSz = SBig(vals[2]) << 2; ds->seek(0x2440 + 0x14); ds->read(vals, 8); - m_apploaderSz = SBig(vals[0]) + SBig(vals[1]); + m_apploaderSz = 32 + SBig(vals[0]) + SBig(vals[1]); /* Yay files!! */ parseFST(*ds.get()); From f6105c5c8d538945f6adaabf9bbcee6f49c755f9 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 4 Jul 2015 10:56:22 -0700 Subject: [PATCH 2/2] Fix DOL size calculation --- lib/DiscBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/DiscBase.cpp b/lib/DiscBase.cpp index 7e7f1fa..9d68ca2 100644 --- a/lib/DiscBase.cpp +++ b/lib/DiscBase.cpp @@ -101,7 +101,7 @@ void DiscBase::IPartition::extractToDirectory(const SystemString& path, bool for std::unique_ptr ws = NewFileIO(dolPath)->beginWriteStream(); ws->write(&hdr, sizeof(DOLHeader)); /* Calculate Dol size */ - uint32_t dolSize = SBig(hdr.textOff[0]); + uint32_t dolSize = SBig(hdr.textOff[0]) - sizeof(DOLHeader); for (uint32_t i = 0 ; i < 7 ; i++) dolSize += SBig(hdr.textSizes[i]); for (uint32_t i = 0 ; i < 11 ; i++)