From b237f35f67f7428612001caee5683d9c22260022 Mon Sep 17 00:00:00 2001 From: Huntereb Date: Sat, 30 Nov 2019 14:53:04 -0500 Subject: [PATCH] Fix debug ifdefs to be proper + xci nca verification change --- source/install/http_xci.cpp | 4 ++-- source/install/install_xci.cpp | 2 +- source/install/usb_nsp.cpp | 4 ++-- source/install/usb_xci.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/install/http_xci.cpp b/source/install/http_xci.cpp index f83a764..82d29d0 100755 --- a/source/install/http_xci.cpp +++ b/source/install/http_xci.cpp @@ -116,12 +116,12 @@ namespace tin::install::xci startTime = newTime; startSizeBuffered = newSizeBuffered; + int downloadProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeBuffered() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); #ifdef NXLINK_DEBUG u64 totalSizeMB = bufferedPlaceholderWriter.GetTotalDataSize() / 1000000; u64 downloadSizeMB = bufferedPlaceholderWriter.GetSizeBuffered() / 1000000; LOG_DEBUG("> Download Progress: %lu/%lu MB (%i%s) (%.2f MB/s)\r", downloadSizeMB, totalSizeMB, downloadProgress, "%", speed); #endif - int downloadProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeBuffered() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); inst::ui::setInstInfoText("Downloading " + inst::util::formatUrlString(ncaFileName) + " at " + std::to_string(speed).substr(0, std::to_string(speed).size()-4) + "MB/s"); inst::ui::setInstBarPerc((double)downloadProgress); @@ -137,11 +137,11 @@ namespace tin::install::xci inst::ui::setInstBarPerc(0); while (!bufferedPlaceholderWriter.IsPlaceholderComplete()) { + int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); #ifdef NXLINK_DEBUG u64 installSizeMB = bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / 1000000; LOG_DEBUG("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%"); #endif - int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); inst::ui::setInstBarPerc((double)installProgress); } inst::ui::setInstBarPerc(100); diff --git a/source/install/install_xci.cpp b/source/install/install_xci.cpp index 85a1405..c513573 100755 --- a/source/install/install_xci.cpp +++ b/source/install/install_xci.cpp @@ -99,7 +99,7 @@ namespace tin::install::xci { tin::install::NcaHeader header; u64 hfs0Offset = m_xci->GetDataOffset() + fileEntry->dataOffset; - m_xci->BufferData(&header, hfs0Offset, 0xc00); + m_xci->BufferData(&header, hfs0Offset, sizeof(tin::install::NcaHeader)); Crypto::AesXtr decryptor(Crypto::Keys().headerKey, false); decryptor.decrypt(&header, &header, sizeof(header), 0, 0x200); diff --git a/source/install/usb_nsp.cpp b/source/install/usb_nsp.cpp index 9256e89..52e5702 100755 --- a/source/install/usb_nsp.cpp +++ b/source/install/usb_nsp.cpp @@ -116,12 +116,12 @@ namespace tin::install::nsp startTime = newTime; startSizeBuffered = newSizeBuffered; + int downloadProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeBuffered() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); #ifdef NXLINK_DEBUG u64 totalSizeMB = bufferedPlaceholderWriter.GetTotalDataSize() / 1000000; u64 downloadSizeMB = bufferedPlaceholderWriter.GetSizeBuffered() / 1000000; LOG_DEBUG("> Download Progress: %lu/%lu MB (%i%s) (%.2f MB/s)\r", downloadSizeMB, totalSizeMB, downloadProgress, "%", speed); #endif - int downloadProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeBuffered() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); inst::ui::setInstInfoText("Downloading " + inst::util::formatUrlString(ncaFileName) + " at " + std::to_string(speed).substr(0, std::to_string(speed).size()-4) + "MB/s"); inst::ui::setInstBarPerc((double)downloadProgress); @@ -137,11 +137,11 @@ namespace tin::install::nsp inst::ui::setInstBarPerc(0); while (!bufferedPlaceholderWriter.IsPlaceholderComplete()) { + int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); #ifdef NXLINK_DEBUG u64 installSizeMB = bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / 1000000; LOG_DEBUG("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%"); #endif - int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); inst::ui::setInstBarPerc((double)installProgress); } inst::ui::setInstBarPerc(100); diff --git a/source/install/usb_xci.cpp b/source/install/usb_xci.cpp index 860528d..8d21fce 100755 --- a/source/install/usb_xci.cpp +++ b/source/install/usb_xci.cpp @@ -116,12 +116,12 @@ namespace tin::install::xci startTime = newTime; startSizeBuffered = newSizeBuffered; + int downloadProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeBuffered() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); #ifdef NXLINK_DEBUG u64 totalSizeMB = bufferedPlaceholderWriter.GetTotalDataSize() / 1000000; u64 downloadSizeMB = bufferedPlaceholderWriter.GetSizeBuffered() / 1000000; LOG_DEBUG("> Download Progress: %lu/%lu MB (%i%s) (%.2f MB/s)\r", downloadSizeMB, totalSizeMB, downloadProgress, "%", speed); #endif - int downloadProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeBuffered() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); inst::ui::setInstInfoText("Downloading " + inst::util::formatUrlString(ncaFileName) + " at " + std::to_string(speed).substr(0, std::to_string(speed).size()-4) + "MB/s"); inst::ui::setInstBarPerc((double)downloadProgress); @@ -137,11 +137,11 @@ namespace tin::install::xci inst::ui::setInstBarPerc(0); while (!bufferedPlaceholderWriter.IsPlaceholderComplete()) { + int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); #ifdef NXLINK_DEBUG u64 installSizeMB = bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / 1000000; LOG_DEBUG("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%"); #endif - int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); inst::ui::setInstBarPerc((double)installProgress); } inst::ui::setInstBarPerc(100);