mirror of
https://github.com/Huntereb/Awoo-Installer
synced 2024-11-26 05:30:19 +00:00
Merge with latest
This commit is contained in:
commit
28fcf2462e
29 changed files with 119 additions and 220 deletions
2
Makefile
2
Makefile
|
@ -55,7 +55,7 @@ ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
|
|||
CFLAGS := -g -Wall -O2 -ffunction-sections \
|
||||
$(ARCH) $(DEFINES)
|
||||
|
||||
CFLAGS += $(INCLUDE) -D__SWITCH__ -D__DEBUG__ -Wall
|
||||
CFLAGS += $(INCLUDE) -D__SWITCH__ -Wall
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -std=gnu++17 -Wall
|
||||
|
||||
|
|
|
@ -64,7 +64,5 @@ namespace tin::install
|
|||
|
||||
virtual u64 GetTitleId(int i = 0);
|
||||
virtual NcmContentMetaType GetContentMetaType(int i = 0);
|
||||
|
||||
virtual void DebugPrintInstallData();
|
||||
};
|
||||
}
|
|
@ -131,15 +131,11 @@ namespace tin::data
|
|||
|
||||
u32 BufferedPlaceholderWriter::CalcNumSegmentsRequired(size_t size)
|
||||
{
|
||||
//printf("Size: %lu\n", size);
|
||||
|
||||
if (m_currentFreeSegmentPtr->isFinalized)
|
||||
return INT_MAX;
|
||||
|
||||
size_t bufferSegmentSizeRemaining = BUFFER_SEGMENT_DATA_SIZE - m_currentFreeSegmentPtr->writeOffset;
|
||||
|
||||
//printf("Buffer segment size remaining: %lu\n", bufferSegmentSizeRemaining);
|
||||
|
||||
if (size <= bufferSegmentSizeRemaining) return 1;
|
||||
else
|
||||
{
|
||||
|
@ -203,11 +199,11 @@ namespace tin::data
|
|||
|
||||
void BufferedPlaceholderWriter::DebugPrintBuffers()
|
||||
{
|
||||
printf("BufferedPlaceholderWriter Buffers: \n");
|
||||
LOG_DEBUG("BufferedPlaceholderWriter Buffers: \n");
|
||||
|
||||
for (int i = 0; i < NUM_BUFFER_SEGMENTS; i++)
|
||||
{
|
||||
printf("Buffer %u:\n", i);
|
||||
LOG_DEBUG("Buffer %u:\n", i);
|
||||
printBytes(m_bufferSegments[i].data, BUFFER_SEGMENT_DATA_SIZE, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace tin::data
|
|||
|
||||
void ByteBuffer::DebugPrintContents()
|
||||
{
|
||||
printf("Buffer Size: 0x%lx\n", this->GetSize());
|
||||
LOG_DEBUG("Buffer Size: 0x%lx\n", this->GetSize());
|
||||
printBytes(this->GetData(), this->GetSize(), true);
|
||||
}
|
||||
}
|
|
@ -85,7 +85,7 @@ namespace tin::install::nsp
|
|||
const PFS0FileEntry* fileEntry = this->GetFileEntryByNcaId(placeholderId);
|
||||
std::string ncaFileName = this->GetFileEntryName(fileEntry);
|
||||
|
||||
printf("Retrieving %s\n", ncaFileName.c_str());
|
||||
LOG_DEBUG("Retrieving %s\n", ncaFileName.c_str());
|
||||
size_t ncaSize = fileEntry->fileSize;
|
||||
|
||||
tin::data::BufferedPlaceholderWriter bufferedPlaceholderWriter(contentStorage, placeholderId, ncaSize);
|
||||
|
@ -120,27 +120,20 @@ namespace tin::install::nsp
|
|||
startTime = newTime;
|
||||
startSizeBuffered = newSizeBuffered;
|
||||
|
||||
u64 totalSizeMB = bufferedPlaceholderWriter.GetTotalDataSize() / 1000000;
|
||||
u64 downloadSizeMB = bufferedPlaceholderWriter.GetSizeBuffered() / 1000000;
|
||||
int downloadProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeBuffered() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
|
||||
|
||||
//printf("> Download Progress: %lu/%lu MB (%i%s) (%.2f MB/s)\r", downloadSizeMB, totalSizeMB, downloadProgress, "%", speed);
|
||||
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);
|
||||
}
|
||||
}
|
||||
inst::ui::setInstBarPerc(100);
|
||||
|
||||
u64 totalSizeMB = bufferedPlaceholderWriter.GetTotalDataSize() / 1000000;
|
||||
|
||||
inst::ui::setInstInfoText("Installing " + ncaFileName + "...");
|
||||
inst::ui::setInstBarPerc(0);
|
||||
while (!bufferedPlaceholderWriter.IsPlaceholderComplete())
|
||||
{
|
||||
u64 installSizeMB = bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / 1000000;
|
||||
int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
|
||||
|
||||
//printf("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%");
|
||||
inst::ui::setInstBarPerc((double)installProgress);
|
||||
}
|
||||
inst::ui::setInstBarPerc(100);
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace tin::install::xci
|
|||
const HFS0FileEntry* fileEntry = this->GetFileEntryByNcaId(ncaId);
|
||||
std::string ncaFileName = this->GetFileEntryName(fileEntry);
|
||||
|
||||
printf("Retrieving %s\n", ncaFileName.c_str());
|
||||
LOG_DEBUG("Retrieving %s\n", ncaFileName.c_str());
|
||||
size_t ncaSize = fileEntry->fileSize;
|
||||
|
||||
tin::data::BufferedPlaceholderWriter bufferedPlaceholderWriter(contentStorage, ncaId, ncaSize);
|
||||
|
@ -121,7 +121,7 @@ namespace tin::install::xci
|
|||
u64 downloadSizeMB = bufferedPlaceholderWriter.GetSizeBuffered() / 1000000;
|
||||
int downloadProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeBuffered() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
|
||||
|
||||
printf("> Download Progress: %lu/%lu MB (%i%s) (%.2f MB/s)\r", downloadSizeMB, totalSizeMB, downloadProgress, "%", speed);
|
||||
LOG_DEBUG("> Download Progress: %lu/%lu MB (%i%s) (%.2f MB/s)\r", downloadSizeMB, totalSizeMB, downloadProgress, "%", speed);
|
||||
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,7 +137,7 @@ namespace tin::install::xci
|
|||
u64 installSizeMB = bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / 1000000;
|
||||
int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
|
||||
|
||||
printf("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%");
|
||||
LOG_DEBUG("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%");
|
||||
}
|
||||
inst::ui::setInstBarPerc(100);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace tin::install
|
|||
u64 baseTitleId = tin::util::GetBaseTitleId(this->GetTitleId(i), this->GetContentMetaType(i));
|
||||
u32 contentMetaCount = 0;
|
||||
|
||||
printf("Base title Id: 0x%lx", baseTitleId);
|
||||
LOG_DEBUG("Base title Id: 0x%lx", baseTitleId);
|
||||
|
||||
// TODO: Make custom error with result code field
|
||||
// 0x410: The record doesn't already exist
|
||||
|
@ -84,7 +84,7 @@ namespace tin::install
|
|||
}
|
||||
rc = 0;
|
||||
|
||||
printf("Content meta count: %u\n", contentMetaCount);
|
||||
LOG_DEBUG("Content meta count: %u\n", contentMetaCount);
|
||||
|
||||
// Obtain any existing app record content meta and append it to our vector
|
||||
if (contentMetaCount > 0)
|
||||
|
@ -117,7 +117,7 @@ namespace tin::install
|
|||
}
|
||||
catch (...) {}
|
||||
|
||||
printf("Pushing application record...\n");
|
||||
LOG_DEBUG("Pushing application record...\n");
|
||||
ASSERT_OK(nsPushApplicationRecord(baseTitleId, 0x3, storageRecords.data(), storageRecords.size() * sizeof(ContentStorageRecord)), "Failed to push application record");
|
||||
}
|
||||
|
||||
|
@ -138,17 +138,17 @@ namespace tin::install
|
|||
|
||||
if (!contentStorage.Has(cnmtContentRecord.content_id))
|
||||
{
|
||||
printf("Installing CNMT NCA...\n");
|
||||
LOG_DEBUG("Installing CNMT NCA...\n");
|
||||
this->InstallNCA(cnmtContentRecord.content_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("CNMT NCA already installed. Proceeding...\n");
|
||||
LOG_DEBUG("CNMT NCA already installed. Proceeding...\n");
|
||||
}
|
||||
|
||||
// Parse data and create install content meta
|
||||
if (m_ignoreReqFirmVersion)
|
||||
printf("WARNING: Required system firmware version is being IGNORED!\n");
|
||||
LOG_DEBUG("WARNING: Required system firmware version is being IGNORED!\n");
|
||||
|
||||
tin::data::ByteBuffer installContentMetaBuf;
|
||||
m_contentMeta[i].GetInstallContentMeta(installContentMetaBuf, cnmtContentRecord, m_ignoreReqFirmVersion);
|
||||
|
@ -160,25 +160,23 @@ namespace tin::install
|
|||
|
||||
void Install::Begin()
|
||||
{
|
||||
printf("Installing ticket and cert...\n");
|
||||
LOG_DEBUG("Installing ticket and cert...\n");
|
||||
try
|
||||
{
|
||||
this->InstallTicketCert();
|
||||
}
|
||||
catch (std::runtime_error& e)
|
||||
{
|
||||
printf("WARNING: Ticket installation failed! This may not be an issue, depending on your use case.\nProceed with caution!\n");
|
||||
LOG_DEBUG("WARNING: Ticket installation failed! This may not be an issue, depending on your use case.\nProceed with caution!\n");
|
||||
}
|
||||
|
||||
for (nx::ncm::ContentMeta contentMeta: m_contentMeta) {
|
||||
printf("Installing NCAs...\n");
|
||||
LOG_DEBUG("Installing NCAs...\n");
|
||||
for (auto& record : contentMeta.GetContentInfos())
|
||||
{
|
||||
printf("Installing from %s\n", tin::util::GetNcaIdString(record.content_id).c_str());
|
||||
LOG_DEBUG("Installing from %s\n", tin::util::GetNcaIdString(record.content_id).c_str());
|
||||
this->InstallNCA(record.content_id);
|
||||
}
|
||||
|
||||
printf("Post Install Records: \n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,90 +189,4 @@ namespace tin::install
|
|||
{
|
||||
return static_cast<NcmContentMetaType>(m_contentMeta[i].GetContentMetaKey().type);
|
||||
}
|
||||
|
||||
void Install::DebugPrintInstallData()
|
||||
{
|
||||
/*
|
||||
#ifdef NXLINK_DEBUG
|
||||
|
||||
NcmContentMetaDatabase contentMetaDatabase;
|
||||
NcmContentMetaKey metaRecord = m_contentMeta.GetContentMetaKey();
|
||||
u64 baseTitleId = tin::util::GetBaseTitleId(metaRecord.id, static_cast<NcmContentMetaType>(metaRecord.type));
|
||||
u64 updateTitleId = baseTitleId ^ 0x800;
|
||||
bool hasUpdate = true;
|
||||
|
||||
try
|
||||
{
|
||||
NcmContentMetaKey latestApplicationContentMetaKey;
|
||||
NcmContentMetaKey latestPatchContentMetaKey;
|
||||
|
||||
ASSERT_OK(ncmOpenContentMetaDatabase(&contentMetaDatabase, m_destStorageId), "Failed to open content meta database");
|
||||
ASSERT_OK(ncmContentMetaDatabaseGetLatestContentMetaKey(&contentMetaDatabase, &latestApplicationContentMetaKey, baseTitleId), "Failed to get latest application content meta key");
|
||||
|
||||
try
|
||||
{
|
||||
ASSERT_OK(ncmContentMetaDatabaseGetLatestContentMetaKey(&contentMetaDatabase, &latestPatchContentMetaKey, updateTitleId), "Failed to get latest patch content meta key");
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
hasUpdate = false;
|
||||
}
|
||||
|
||||
u64 appContentRecordSize;
|
||||
u64 appContentRecordSizeRead;
|
||||
ASSERT_OK(ncmContentMetaDatabaseGetSize(&contentMetaDatabase, &appContentRecordSize, &latestApplicationContentMetaKey), "Failed to get application content record size");
|
||||
|
||||
auto appContentRecordBuf = std::make_unique<u8[]>(appContentRecordSize);
|
||||
ASSERT_OK(ncmContentMetaDatabaseGet(&contentMetaDatabase, &latestApplicationContentMetaKey, &appContentRecordSizeRead, (NcmContentMetaHeader*)appContentRecordBuf.get(), appContentRecordSizeRead), "Failed to get app content record size");
|
||||
|
||||
if (appContentRecordSize != appContentRecordSizeRead)
|
||||
{
|
||||
throw std::runtime_error("Mismatch between app content record size and content record size read");
|
||||
}
|
||||
|
||||
printf("Application content meta key: \n");
|
||||
printBytes((u8*)&latestApplicationContentMetaKey, sizeof(NcmContentMetaKey), true);
|
||||
printf("Application content meta: \n");
|
||||
printBytes(appContentRecordBuf.get(), appContentRecordSize, true);
|
||||
|
||||
if (hasUpdate)
|
||||
{
|
||||
u64 patchContentRecordsSize;
|
||||
u64 patchContentRecordSizeRead;
|
||||
ASSERT_OK(ncmContentMetaDatabaseGetSize(&contentMetaDatabase, &patchContentRecordsSize, &latestPatchContentMetaKey), "Failed to get patch content record size");
|
||||
|
||||
auto patchContentRecordBuf = std::make_unique<u8[]>(patchContentRecordsSize);
|
||||
ASSERT_OK(ncmContentMetaDatabaseGet(&contentMetaDatabase, &latestPatchContentMetaKey, &patchContentRecordSizeRead, (NcmContentMetaHeader*)patchContentRecordBuf.get(), patchContentRecordsSize), "Failed to get patch content record size");
|
||||
|
||||
if (patchContentRecordsSize != patchContentRecordSizeRead)
|
||||
{
|
||||
throw std::runtime_error("Mismatch between app content record size and content record size read");
|
||||
}
|
||||
|
||||
printf("Patch content meta key: \n");
|
||||
printBytes((u8*)&latestPatchContentMetaKey, sizeof(NcmContentMetaKey), true);
|
||||
printf("Patch content meta: \n");
|
||||
printBytes(patchContentRecordBuf.get(), patchContentRecordsSize, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("No update records found, or an error occurred.\n");
|
||||
}
|
||||
|
||||
auto appRecordBuf = std::make_unique<u8[]>(0x100);
|
||||
u32 numEntriesRead;
|
||||
ASSERT_OK(nsListApplicationRecordContentMeta(0, baseTitleId, appRecordBuf.get(), 0x100, &numEntriesRead), "Failed to list application record content meta");
|
||||
|
||||
printf("Application record content meta: \n");
|
||||
printBytes(appRecordBuf.get(), 0x100, true);
|
||||
}
|
||||
catch (std::runtime_error& e)
|
||||
{
|
||||
serviceClose(&contentMetaDatabase.s);
|
||||
printf("Failed to log install data. Error: %s", e.what());
|
||||
}
|
||||
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,20 +66,20 @@ namespace tin::install::nsp
|
|||
{
|
||||
// Read the tik file and put it into a buffer
|
||||
auto tikName = m_simpleFileSystem->GetFileNameFromExtension("", "tik");
|
||||
printf("> Getting tik size\n");
|
||||
LOG_DEBUG("> Getting tik size\n");
|
||||
auto tikFile = m_simpleFileSystem->OpenFile(tikName);
|
||||
u64 tikSize = tikFile.GetSize();
|
||||
auto tikBuf = std::make_unique<u8[]>(tikSize);
|
||||
printf("> Reading tik\n");
|
||||
LOG_DEBUG("> Reading tik\n");
|
||||
tikFile.Read(0x0, tikBuf.get(), tikSize);
|
||||
|
||||
// Read the cert file and put it into a buffer
|
||||
auto certName = m_simpleFileSystem->GetFileNameFromExtension("", "cert");
|
||||
printf("> Getting cert size\n");
|
||||
LOG_DEBUG("> Getting cert size\n");
|
||||
auto certFile = m_simpleFileSystem->OpenFile(certName);
|
||||
u64 certSize = certFile.GetSize();
|
||||
auto certBuf = std::make_unique<u8[]>(certSize);
|
||||
printf("> Reading cert\n");
|
||||
LOG_DEBUG("> Reading cert\n");
|
||||
certFile.Read(0x0, certBuf.get(), certSize);
|
||||
|
||||
// Finally, let's actually import the ticket
|
||||
|
@ -100,11 +100,11 @@ namespace tin::install::nsp
|
|||
ncaName += ".cnmt.ncz";
|
||||
else
|
||||
{
|
||||
throw std::runtime_error(("Failed to find NCA file " + ncaName + ".nca/.cnmt.nca").c_str());
|
||||
throw std::runtime_error(("Failed to find NCA file " + ncaName + ".nca/.cnmt.nca/.ncz/.cnmt.ncz").c_str());
|
||||
}
|
||||
|
||||
printf("NcaId: %s\n", ncaName.c_str());
|
||||
printf("Dest storage Id: %u\n", m_destStorageId);
|
||||
LOG_DEBUG("NcaId: %s\n", ncaName.c_str());
|
||||
LOG_DEBUG("Dest storage Id: %u\n", m_destStorageId);
|
||||
|
||||
std::shared_ptr<nx::ncm::ContentStorage> contentStorage(new nx::ncm::ContentStorage(m_destStorageId));
|
||||
|
||||
|
@ -133,6 +133,8 @@ namespace tin::install::nsp
|
|||
if (rc != 1)
|
||||
THROW_FORMAT(("The requested NCA (" + tin::util::GetNcaIdString(ncaId) + ") is not properly signed").c_str());
|
||||
declinedValidation = true;
|
||||
} else {
|
||||
LOG_DEBUG("NCA signature is valid\n")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +146,7 @@ namespace tin::install::nsp
|
|||
if (readBuffer == NULL)
|
||||
throw std::runtime_error(("Failed to allocate read buffer for " + ncaName).c_str());
|
||||
|
||||
printf("Size: 0x%lx\n", ncaSize);
|
||||
LOG_DEBUG("Size: 0x%lx\n", ncaSize);
|
||||
|
||||
NcaWriter writer(ncaId, contentStorage);
|
||||
|
||||
|
@ -158,11 +160,9 @@ namespace tin::install::nsp
|
|||
inst::ui::setInstBarPerc(0);
|
||||
while (fileOff < ncaSize)
|
||||
{
|
||||
// Clear the buffer before we read anything, just to be sure
|
||||
progress = (float)fileOff / (float)ncaSize;
|
||||
|
||||
if (fileOff % (0x400000 * 3) == 0) {
|
||||
//printf("> Progress: %lu/%lu MB (%d%s)\r", (fileOff / 1000000), (ncaSize / 1000000), (int)(progress * 100.0), "%");
|
||||
inst::ui::setInstBarPerc((double)(progress * 100.0));
|
||||
}
|
||||
|
||||
|
@ -182,9 +182,7 @@ namespace tin::install::nsp
|
|||
|
||||
writer.close();
|
||||
|
||||
// Clean up the line for whatever comes next
|
||||
//printf(" \r");
|
||||
printf("Registering placeholder...\n");
|
||||
LOG_DEBUG("Registering placeholder...\n");
|
||||
|
||||
if (!failed)
|
||||
{
|
||||
|
@ -194,7 +192,7 @@ namespace tin::install::nsp
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
printf(("Failed to register " + ncaName + ". It may already exist.\n").c_str());
|
||||
LOG_DEBUG(("Failed to register " + ncaName + ". It may already exist.\n").c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace tin::install::nsp
|
|||
|
||||
nx::ncm::ContentStorage contentStorage(m_destStorageId);
|
||||
|
||||
printf("CNMT Name: %s\n", cnmtNcaName.c_str());
|
||||
LOG_DEBUG("CNMT Name: %s\n", cnmtNcaName.c_str());
|
||||
|
||||
// We install the cnmt nca early to read from it later
|
||||
this->InstallNCA(cnmtContentId);
|
||||
|
@ -79,7 +79,7 @@ namespace tin::install::nsp
|
|||
std::string ncaFileName = m_remoteNSP->GetFileEntryName(fileEntry);
|
||||
size_t ncaSize = fileEntry->fileSize;
|
||||
|
||||
printf("Installing %s to storage Id %u\n", ncaFileName.c_str(), m_destStorageId);
|
||||
LOG_DEBUG("Installing %s to storage Id %u\n", ncaFileName.c_str(), m_destStorageId);
|
||||
|
||||
std::shared_ptr<nx::ncm::ContentStorage> contentStorage(new nx::ncm::ContentStorage(m_destStorageId));
|
||||
|
||||
|
@ -90,7 +90,7 @@ namespace tin::install::nsp
|
|||
}
|
||||
catch (...) {}
|
||||
|
||||
printf("Size: 0x%lx\n", ncaSize);
|
||||
LOG_DEBUG("Size: 0x%lx\n", ncaSize);
|
||||
|
||||
if (inst::config::validateNCAs && !declinedValidation)
|
||||
{
|
||||
|
@ -114,9 +114,7 @@ namespace tin::install::nsp
|
|||
|
||||
m_remoteNSP->StreamToPlaceholder(contentStorage, ncaId);
|
||||
|
||||
// Clean up the line for whatever comes next
|
||||
//printf(" \r");
|
||||
printf("Registering placeholder...\n");
|
||||
LOG_DEBUG("Registering placeholder...\n");
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -124,7 +122,7 @@ namespace tin::install::nsp
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
printf(("Failed to register " + ncaFileName + ". It may already exist.\n").c_str());
|
||||
LOG_DEBUG(("Failed to register " + ncaFileName + ". It may already exist.\n").c_str());
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -141,13 +139,13 @@ namespace tin::install::nsp
|
|||
|
||||
if (tikFileEntry == nullptr)
|
||||
{
|
||||
printf("Remote tik file is missing.\n");
|
||||
LOG_DEBUG("Remote tik file is missing.\n");
|
||||
throw std::runtime_error("Remote tik file is not present!");
|
||||
}
|
||||
|
||||
u64 tikSize = tikFileEntry->fileSize;
|
||||
auto tikBuf = std::make_unique<u8[]>(tikSize);
|
||||
printf("> Reading tik\n");
|
||||
LOG_DEBUG("> Reading tik\n");
|
||||
m_remoteNSP->BufferData(tikBuf.get(), m_remoteNSP->GetDataOffset() + tikFileEntry->dataOffset, tikSize);
|
||||
|
||||
// Read the cert file and put it into a buffer
|
||||
|
@ -155,13 +153,13 @@ namespace tin::install::nsp
|
|||
|
||||
if (certFileEntry == nullptr)
|
||||
{
|
||||
printf("Remote cert file is missing.\n");
|
||||
LOG_DEBUG("Remote cert file is missing.\n");
|
||||
throw std::runtime_error("Remote cert file is not present!");
|
||||
}
|
||||
|
||||
u64 certSize = certFileEntry->fileSize;
|
||||
auto certBuf = std::make_unique<u8[]>(certSize);
|
||||
printf("> Reading cert\n");
|
||||
LOG_DEBUG("> Reading cert\n");
|
||||
m_remoteNSP->BufferData(certBuf.get(), m_remoteNSP->GetDataOffset() + certFileEntry->dataOffset, certSize);
|
||||
|
||||
// Finally, let's actually import the ticket
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace tin::install::xci
|
|||
|
||||
nx::ncm::ContentStorage contentStorage(m_destStorageId);
|
||||
|
||||
printf("CNMT Name: %s\n", cnmtNcaName.c_str());
|
||||
LOG_DEBUG("CNMT Name: %s\n", cnmtNcaName.c_str());
|
||||
|
||||
// We install the cnmt nca early to read from it later
|
||||
this->InstallNCA(cnmtContentId);
|
||||
|
@ -80,7 +80,7 @@ namespace tin::install::xci
|
|||
std::string ncaFileName = m_xci->GetFileEntryName(fileEntry);
|
||||
size_t ncaSize = fileEntry->fileSize;
|
||||
|
||||
printf("Installing %s to storage Id %u\n", ncaFileName.c_str(), m_destStorageId);
|
||||
LOG_DEBUG("Installing %s to storage Id %u\n", ncaFileName.c_str(), m_destStorageId);
|
||||
|
||||
std::shared_ptr<nx::ncm::ContentStorage> contentStorage(new nx::ncm::ContentStorage(m_destStorageId));
|
||||
|
||||
|
@ -91,7 +91,7 @@ namespace tin::install::xci
|
|||
}
|
||||
catch (...) {}
|
||||
|
||||
printf("Size: 0x%lx\n", ncaSize);
|
||||
LOG_DEBUG("Size: 0x%lx\n", ncaSize);
|
||||
|
||||
if (inst::config::validateNCAs && !declinedValidation)
|
||||
{
|
||||
|
@ -117,8 +117,8 @@ namespace tin::install::xci
|
|||
m_xci->StreamToPlaceholder(contentStorage, ncaId);
|
||||
|
||||
// Clean up the line for whatever comes next
|
||||
printf(" \r");
|
||||
printf("Registering placeholder...\n");
|
||||
LOG_DEBUG(" \r");
|
||||
LOG_DEBUG("Registering placeholder...\n");
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -126,7 +126,7 @@ namespace tin::install::xci
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
printf(("Failed to register " + ncaFileName + ". It may already exist.\n").c_str());
|
||||
LOG_DEBUG(("Failed to register " + ncaFileName + ". It may already exist.\n").c_str());
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -146,24 +146,24 @@ namespace tin::install::xci
|
|||
{
|
||||
if (tikFileEntries[i] == nullptr)
|
||||
{
|
||||
printf("Remote tik file is missing.\n");
|
||||
LOG_DEBUG("Remote tik file is missing.\n");
|
||||
throw std::runtime_error("Remote tik file is not present!");
|
||||
}
|
||||
|
||||
u64 tikSize = tikFileEntries[i]->fileSize;
|
||||
auto tikBuf = std::make_unique<u8[]>(tikSize);
|
||||
printf("> Reading tik\n");
|
||||
LOG_DEBUG("> Reading tik\n");
|
||||
m_xci->BufferData(tikBuf.get(), m_xci->GetDataOffset() + tikFileEntries[i]->dataOffset, tikSize);
|
||||
|
||||
if (certFileEntries[i] == nullptr)
|
||||
{
|
||||
printf("Remote cert file is missing.\n");
|
||||
LOG_DEBUG("Remote cert file is missing.\n");
|
||||
throw std::runtime_error("Remote cert file is not present!");
|
||||
}
|
||||
|
||||
u64 certSize = certFileEntries[i]->fileSize;
|
||||
auto certBuf = std::make_unique<u8[]>(certSize);
|
||||
printf("> Reading cert\n");
|
||||
LOG_DEBUG("> Reading cert\n");
|
||||
m_xci->BufferData(certBuf.get(), m_xci->GetDataOffset() + certFileEntries[i]->dataOffset, certSize);
|
||||
|
||||
// Finally, let's actually import the ticket
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace tin::install::xci
|
|||
const HFS0FileEntry* fileEntry = this->GetFileEntryByNcaId(ncaId);
|
||||
std::string ncaFileName = this->GetFileEntryName(fileEntry);
|
||||
|
||||
printf("Retrieving %s\n", ncaFileName.c_str());
|
||||
LOG_DEBUG("Retrieving %s\n", ncaFileName.c_str());
|
||||
size_t ncaSize = fileEntry->fileSize;
|
||||
|
||||
NcaWriter writer(ncaId, contentStorage);
|
||||
|
@ -44,7 +44,7 @@ namespace tin::install::xci
|
|||
progress = (float) fileOff / (float) ncaSize;
|
||||
|
||||
if (fileOff % (0x400000 * 3) == 0) {
|
||||
printf("> Progress: %lu/%lu MB (%d%s)\r", (fileOff / 1000000), (ncaSize / 1000000), (int)(progress * 100.0), "%");
|
||||
LOG_DEBUG("> Progress: %lu/%lu MB (%d%s)\r", (fileOff / 1000000), (ncaSize / 1000000), (int)(progress * 100.0), "%");
|
||||
inst::ui::setInstBarPerc((double)(progress * 100.0));
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ namespace tin::install::xci
|
|||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
printf("something went wrong: %s\n", e.what());
|
||||
LOG_DEBUG("something went wrong: %s\n", e.what());
|
||||
}
|
||||
|
||||
writer.close();
|
||||
|
|
|
@ -38,13 +38,13 @@ namespace tin::install::nsp
|
|||
// TODO: Do verification: PFS0 magic, sizes not zero
|
||||
void RemoteNSP::RetrieveHeader()
|
||||
{
|
||||
printf("Retrieving remote NSP header...\n");
|
||||
LOG_DEBUG("Retrieving remote NSP header...\n");
|
||||
|
||||
// Retrieve the base header
|
||||
m_headerBytes.resize(sizeof(PFS0BaseHeader), 0);
|
||||
this->BufferData(m_headerBytes.data(), 0x0, sizeof(PFS0BaseHeader));
|
||||
|
||||
printf("Base header: \n");
|
||||
LOG_DEBUG("Base header: \n");
|
||||
printBytes(m_headerBytes.data(), sizeof(PFS0BaseHeader), true);
|
||||
|
||||
// Retrieve the full header
|
||||
|
@ -52,7 +52,7 @@ namespace tin::install::nsp
|
|||
m_headerBytes.resize(sizeof(PFS0BaseHeader) + remainingHeaderSize, 0);
|
||||
this->BufferData(m_headerBytes.data() + sizeof(PFS0BaseHeader), sizeof(PFS0BaseHeader), remainingHeaderSize);
|
||||
|
||||
printf("Full header: \n");
|
||||
LOG_DEBUG("Full header: \n");
|
||||
printBytes(m_headerBytes.data(), m_headerBytes.size(), true);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace tin::install::nsp
|
|||
{
|
||||
try
|
||||
{
|
||||
printf(("Attempting to find file at " + m_rootPath + path + "\n").c_str());
|
||||
LOG_DEBUG(("Attempting to find file at " + m_rootPath + path + "\n").c_str());
|
||||
m_fileSystem->OpenFile(m_rootPath + path);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace tin::install::nsp
|
|||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
printf("An error occurred:\n%s", e.what());
|
||||
LOG_DEBUG("An error occurred:\n%s", e.what());
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
@ -82,7 +82,7 @@ namespace tin::install::nsp
|
|||
const PFS0FileEntry* fileEntry = this->GetFileEntryByNcaId(placeholderId);
|
||||
std::string ncaFileName = this->GetFileEntryName(fileEntry);
|
||||
|
||||
printf("Retrieving %s\n", ncaFileName.c_str());
|
||||
LOG_DEBUG("Retrieving %s\n", ncaFileName.c_str());
|
||||
size_t ncaSize = fileEntry->fileSize;
|
||||
|
||||
tin::data::BufferedPlaceholderWriter bufferedPlaceholderWriter(contentStorage, placeholderId, ncaSize);
|
||||
|
@ -120,7 +120,7 @@ namespace tin::install::nsp
|
|||
u64 downloadSizeMB = bufferedPlaceholderWriter.GetSizeBuffered() / 1000000;
|
||||
int downloadProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeBuffered() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
|
||||
|
||||
printf("> Download Progress: %lu/%lu MB (%i%s) (%.2f MB/s)\r", downloadSizeMB, totalSizeMB, downloadProgress, "%", speed);
|
||||
LOG_DEBUG("> Download Progress: %lu/%lu MB (%i%s) (%.2f MB/s)\r", downloadSizeMB, totalSizeMB, downloadProgress, "%", speed);
|
||||
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);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ namespace tin::install::nsp
|
|||
u64 installSizeMB = bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / 1000000;
|
||||
int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
|
||||
|
||||
printf("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%");
|
||||
LOG_DEBUG("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%");
|
||||
inst::ui::setInstBarPerc((double)installProgress);
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ namespace tin::install::nsp
|
|||
|
||||
void USBNSP::BufferData(void* buf, off_t offset, size_t size)
|
||||
{
|
||||
printf("buffering 0x%lx-0x%lx", offset, offset + size);
|
||||
LOG_DEBUG("buffering 0x%lx-0x%lx", offset, offset + size);
|
||||
tin::util::USBCmdHeader header = tin::util::USBCmdManager::SendFileRangeCmd(m_nspName, offset, size);
|
||||
tin::util::USBRead(buf, header.dataSize);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace tin::install::xci
|
|||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
printf("An error occurred:\n%s", e.what());
|
||||
LOG_DEBUG("An error occurred:\n%s", e.what());
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
@ -82,7 +82,7 @@ namespace tin::install::xci
|
|||
const HFS0FileEntry* fileEntry = this->GetFileEntryByNcaId(placeholderId);
|
||||
std::string ncaFileName = this->GetFileEntryName(fileEntry);
|
||||
|
||||
printf("Retrieving %s\n", ncaFileName.c_str());
|
||||
LOG_DEBUG("Retrieving %s\n", ncaFileName.c_str());
|
||||
size_t ncaSize = fileEntry->fileSize;
|
||||
|
||||
tin::data::BufferedPlaceholderWriter bufferedPlaceholderWriter(contentStorage, placeholderId, ncaSize);
|
||||
|
@ -120,7 +120,7 @@ namespace tin::install::xci
|
|||
u64 downloadSizeMB = bufferedPlaceholderWriter.GetSizeBuffered() / 1000000;
|
||||
int downloadProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeBuffered() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
|
||||
|
||||
printf("> Download Progress: %lu/%lu MB (%i%s) (%.2f MB/s)\r", downloadSizeMB, totalSizeMB, downloadProgress, "%", speed);
|
||||
LOG_DEBUG("> Download Progress: %lu/%lu MB (%i%s) (%.2f MB/s)\r", downloadSizeMB, totalSizeMB, downloadProgress, "%", speed);
|
||||
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);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ namespace tin::install::xci
|
|||
u64 installSizeMB = bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / 1000000;
|
||||
int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
|
||||
|
||||
printf("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%");
|
||||
LOG_DEBUG("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%");
|
||||
inst::ui::setInstBarPerc((double)installProgress);
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ namespace tin::install::xci
|
|||
|
||||
void USBXCI::BufferData(void* buf, off_t offset, size_t size)
|
||||
{
|
||||
printf("buffering 0x%lx-0x%lx", offset, offset + size);
|
||||
LOG_DEBUG("buffering 0x%lx-0x%lx", offset, offset + size);
|
||||
tin::util::USBCmdHeader header = tin::util::USBCmdManager::SendFileRangeCmd(m_xciName, offset, size);
|
||||
tin::util::USBRead(buf, header.dataSize);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace tin::install
|
|||
catch (std::exception& e)
|
||||
{
|
||||
this->PrintCritical("NSP is invalid and cannot be opened! Error: " + std::string(e.what()));
|
||||
printf("> NSP Path: %s\n", m_nspPath.c_str());
|
||||
LOG_DEBUG("> NSP Path: %s\n", m_nspPath.c_str());
|
||||
return false;
|
||||
}
|
||||
this->PrintSuccess("PFS0 structure is valid");
|
||||
|
@ -189,17 +189,17 @@ namespace tin::install
|
|||
|
||||
void NSPVerifier::PrintCritical(std::string text)
|
||||
{
|
||||
printf("[%sCRITICAL%s] %s\n", CONSOLE_RED, CONSOLE_RESET, text.c_str());
|
||||
LOG_DEBUG("[%sCRITICAL%s] %s\n", CONSOLE_RED, CONSOLE_RESET, text.c_str());
|
||||
}
|
||||
|
||||
void NSPVerifier::PrintWarning(std::string text)
|
||||
{
|
||||
printf("[%sWARNING%s] %s\n", CONSOLE_YELLOW, CONSOLE_RESET, text.c_str());
|
||||
LOG_DEBUG("[%sWARNING%s] %s\n", CONSOLE_YELLOW, CONSOLE_RESET, text.c_str());
|
||||
}
|
||||
|
||||
void NSPVerifier::PrintSuccess(std::string text)
|
||||
{
|
||||
printf("[%sOK%s] %s\n", CONSOLE_GREEN, CONSOLE_RESET, text.c_str());
|
||||
LOG_DEBUG("[%sOK%s] %s\n", CONSOLE_GREEN, CONSOLE_RESET, text.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -33,7 +33,7 @@ namespace tin::install::xci
|
|||
|
||||
void XCI::RetrieveHeader()
|
||||
{
|
||||
printf("Retrieving HFS0 header...\n");
|
||||
LOG_DEBUG("Retrieving HFS0 header...\n");
|
||||
|
||||
// Retrieve hfs0 offset
|
||||
u64 hfs0Offset = 0xf000;
|
||||
|
@ -43,7 +43,7 @@ namespace tin::install::xci
|
|||
m_headerBytes.resize(sizeof(HFS0BaseHeader), 0);
|
||||
this->BufferData(m_headerBytes.data(), hfs0Offset, sizeof(HFS0BaseHeader));
|
||||
|
||||
printf("Base header: \n");
|
||||
LOG_DEBUG("Base header: \n");
|
||||
printBytes(m_headerBytes.data(), sizeof(HFS0BaseHeader), true);
|
||||
|
||||
// Retrieve full header
|
||||
|
@ -55,7 +55,7 @@ namespace tin::install::xci
|
|||
m_headerBytes.resize(sizeof(HFS0BaseHeader) + remainingHeaderSize, 0);
|
||||
this->BufferData(m_headerBytes.data() + sizeof(HFS0BaseHeader), hfs0Offset + sizeof(HFS0BaseHeader), remainingHeaderSize);
|
||||
|
||||
printf("Base header: \n");
|
||||
LOG_DEBUG("Base header: \n");
|
||||
printBytes(m_headerBytes.data(), sizeof(HFS0BaseHeader) + remainingHeaderSize, true);
|
||||
|
||||
// Find Secure partition
|
||||
|
@ -72,7 +72,7 @@ namespace tin::install::xci
|
|||
m_secureHeaderBytes.resize(sizeof(HFS0BaseHeader), 0);
|
||||
this->BufferData(m_secureHeaderBytes.data(), m_secureHeaderOffset, sizeof(HFS0BaseHeader));
|
||||
|
||||
printf("Secure header: \n");
|
||||
LOG_DEBUG("Secure header: \n");
|
||||
printBytes(m_secureHeaderBytes.data(), sizeof(HFS0BaseHeader), true);
|
||||
|
||||
if (this->GetSecureHeader()->magic != MAGIC_HFS0)
|
||||
|
@ -82,6 +82,9 @@ namespace tin::install::xci
|
|||
remainingHeaderSize = this->GetSecureHeader()->numFiles * sizeof(HFS0FileEntry) + this->GetSecureHeader()->stringTableSize;
|
||||
m_secureHeaderBytes.resize(sizeof(HFS0BaseHeader) + remainingHeaderSize, 0);
|
||||
this->BufferData(m_secureHeaderBytes.data() + sizeof(HFS0BaseHeader), m_secureHeaderOffset + sizeof(HFS0BaseHeader), remainingHeaderSize);
|
||||
|
||||
LOG_DEBUG("Base header: \n");
|
||||
printBytes(m_secureHeaderBytes.data(), sizeof(HFS0BaseHeader) + remainingHeaderSize, true);
|
||||
return;
|
||||
}
|
||||
THROW_FORMAT("couldn't optain secure hfs0 header\n");
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "switch.h"
|
||||
#include "util/error.hpp"
|
||||
#include "ui/MainApplication.hpp"
|
||||
#include "util/util.hpp"
|
||||
|
||||
|
@ -13,7 +14,7 @@ int main(int argc, char* argv[])
|
|||
main->Prepare();
|
||||
main->Show();
|
||||
} catch (std::exception& e) {
|
||||
printf("An error occurred:\n%s", e.what());
|
||||
LOG_DEBUG("An error occurred:\n%s", e.what());
|
||||
}
|
||||
inst::util::deinitApp();
|
||||
return 0;
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace netInstStuff{
|
|||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
printf("Failed to initialize server socket!\n");
|
||||
LOG_DEBUG("Failed to initialize server socket!\n");
|
||||
fprintf(stdout, "%s", e.what());
|
||||
|
||||
if (m_serverSocket != 0)
|
||||
|
@ -103,7 +103,7 @@ namespace netInstStuff{
|
|||
|
||||
void OnUnwound()
|
||||
{
|
||||
printf("unwinding view\n");
|
||||
LOG_DEBUG("unwinding view\n");
|
||||
if (m_clientSocket != 0)
|
||||
{
|
||||
close(m_clientSocket);
|
||||
|
@ -144,7 +144,7 @@ namespace netInstStuff{
|
|||
|
||||
try {
|
||||
for (urlItr = 0; urlItr < ourUrlList.size(); urlItr++) {
|
||||
printf("%s %s\n", "Install request from", ourUrlList[urlItr].c_str());
|
||||
LOG_DEBUG("%s %s\n", "Install request from", ourUrlList[urlItr].c_str());
|
||||
inst::ui::setTopInstInfoText("Installing " + urlNames[urlItr] + ourSource);
|
||||
|
||||
tin::install::Install* installTask;
|
||||
|
@ -157,7 +157,7 @@ namespace netInstStuff{
|
|||
installTask = new tin::install::nsp::RemoteNSPInstall(m_destStorageId, inst::config::ignoreReqVers, httpNSP);
|
||||
}
|
||||
|
||||
printf("%s\n", "Preparing installation");
|
||||
LOG_DEBUG("%s\n", "Preparing installation");
|
||||
inst::ui::setInstInfoText("Preparing installation...");
|
||||
inst::ui::setInstBarPerc(0);
|
||||
installTask->Prepare();
|
||||
|
@ -166,8 +166,8 @@ namespace netInstStuff{
|
|||
}
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
printf("Failed to install");
|
||||
printf("%s", e.what());
|
||||
LOG_DEBUG("Failed to install");
|
||||
LOG_DEBUG("%s", e.what());
|
||||
fprintf(stdout, "%s", e.what());
|
||||
inst::ui::setInstInfoText("Failed to install " + urlNames[urlItr]);
|
||||
inst::ui::setInstBarPerc(0);
|
||||
|
@ -181,7 +181,7 @@ namespace netInstStuff{
|
|||
inst::util::setClockSpeed(2, previousClockValues[2]);
|
||||
}
|
||||
|
||||
printf("%s\n", "Telling the server we're done installing");
|
||||
LOG_DEBUG("%s\n", "Telling the server we're done installing");
|
||||
// Send 1 byte ack to close the server
|
||||
u8 ack = 0;
|
||||
tin::network::WaitSendNetworkData(m_clientSocket, &ack, sizeof(u8));
|
||||
|
@ -193,7 +193,7 @@ namespace netInstStuff{
|
|||
else inst::ui::mainApp->CreateShowDialog(urlNames[0] + " installed!", nspInstStuff::finishedMessage(), {"OK"}, true);
|
||||
}
|
||||
|
||||
printf("Done");
|
||||
LOG_DEBUG("Done");
|
||||
if (appletGetAppletType() == AppletType_Application || appletGetAppletType() == AppletType_SystemApplication) appletEndBlockingHomeButton();
|
||||
inst::ui::loadMainMenu();
|
||||
inst::util::deinitInstallServices();
|
||||
|
@ -224,9 +224,9 @@ namespace netInstStuff{
|
|||
|
||||
std::string ourIPAddress = inst::util::getIPAddress();
|
||||
inst::ui::setNetInfoText("Waiting for a connection... Your Switch's IP Address is: " + ourIPAddress);
|
||||
printf("%s %s\n", "Switch IP is ", ourIPAddress.c_str());
|
||||
printf("%s\n", "Waiting for network");
|
||||
printf("%s\n", "B to cancel");
|
||||
LOG_DEBUG("%s %s\n", "Switch IP is ", ourIPAddress.c_str());
|
||||
LOG_DEBUG("%s\n", "Waiting for network");
|
||||
LOG_DEBUG("%s\n", "B to cancel");
|
||||
|
||||
std::vector<std::string> urls;
|
||||
|
||||
|
@ -263,12 +263,12 @@ namespace netInstStuff{
|
|||
|
||||
if (m_clientSocket >= 0)
|
||||
{
|
||||
printf("%s\n", "Server accepted");
|
||||
LOG_DEBUG("%s\n", "Server accepted");
|
||||
u32 size = 0;
|
||||
tin::network::WaitReceiveNetworkData(m_clientSocket, &size, sizeof(u32));
|
||||
size = ntohl(size);
|
||||
|
||||
printf("Received url buf size: 0x%x\n", size);
|
||||
LOG_DEBUG("Received url buf size: 0x%x\n", size);
|
||||
|
||||
if (size > MAX_URL_SIZE * MAX_URLS)
|
||||
{
|
||||
|
@ -302,8 +302,8 @@ namespace netInstStuff{
|
|||
}
|
||||
catch (std::runtime_error& e)
|
||||
{
|
||||
printf("Failed to perform remote install!\n");
|
||||
printf("%s", e.what());
|
||||
LOG_DEBUG("Failed to perform remote install!\n");
|
||||
LOG_DEBUG("%s", e.what());
|
||||
fprintf(stdout, "%s", e.what());
|
||||
inst::ui::mainApp->CreateShowDialog("Failed to perform remote install!", (std::string)e.what(), {"OK"}, true);
|
||||
return {};
|
||||
|
|
|
@ -98,9 +98,9 @@ namespace nx::ncm
|
|||
installContentMetaBuffer.Append<NcmContentMetaHeader>(contentMetaHeader);
|
||||
|
||||
// Setup the meta extended header
|
||||
printf("Install content meta pre size: 0x%lx\n", installContentMetaBuffer.GetSize());
|
||||
LOG_DEBUG("Install content meta pre size: 0x%lx\n", installContentMetaBuffer.GetSize());
|
||||
installContentMetaBuffer.Resize(installContentMetaBuffer.GetSize() + contentMetaHeader.extended_header_size);
|
||||
printf("Install content meta post size: 0x%lx\n", installContentMetaBuffer.GetSize());
|
||||
LOG_DEBUG("Install content meta post size: 0x%lx\n", installContentMetaBuffer.GetSize());
|
||||
auto* extendedHeaderSourceBytes = m_bytes.GetData() + sizeof(PackagedContentMetaHeader);
|
||||
u8* installExtendedHeaderStart = installContentMetaBuffer.GetData() + sizeof(NcmContentMetaHeader);
|
||||
memcpy(installExtendedHeaderStart, extendedHeaderSourceBytes, contentMetaHeader.extended_header_size);
|
||||
|
|
|
@ -21,6 +21,7 @@ SOFTWARE.
|
|||
*/
|
||||
|
||||
#include "nx/nca_writer.h"
|
||||
#include "util/error.hpp"
|
||||
#include <zstd.h>
|
||||
#include <string.h>
|
||||
#include "util/crypto.hpp"
|
||||
|
@ -247,7 +248,7 @@ public:
|
|||
|
||||
if (ZSTD_isError(ret))
|
||||
{
|
||||
printf("%s\n", ZSTD_getErrorName(ret));
|
||||
LOG_DEBUG("%s\n", ZSTD_getErrorName(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,8 +106,6 @@ namespace nspInstStuff {
|
|||
inst::ui::setTopInstInfoText("Installing " + inst::util::shortenString(ourTitleList[titleItr].filename().string(), 40, true) + " from SD card");
|
||||
tin::install::Install* installTask;
|
||||
|
||||
inst::ui::mainApp->CreateShowDialog(ourTitleList[titleItr].filename().string(), ourTitleList[titleItr].filename().string(), {ourTitleList[titleItr].filename().string()}, true);
|
||||
|
||||
if (ourTitleList[titleItr].extension() == ".xci" || ourTitleList[titleItr].extension() == ".xcz") {
|
||||
auto localXCI = new tin::install::xci::LocalXCI(ourTitleList[titleItr]);
|
||||
installTask = new tin::install::xci::XCIInstallTask(m_destStorageId, inst::config::ignoreReqVers, localXCI);
|
||||
|
@ -137,8 +135,8 @@ namespace nspInstStuff {
|
|||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
printf("Failed to install");
|
||||
printf("%s", e.what());
|
||||
LOG_DEBUG("Failed to install");
|
||||
LOG_DEBUG("%s", e.what());
|
||||
fprintf(stdout, "%s", e.what());
|
||||
inst::ui::setInstInfoText("Failed to install " + inst::util::shortenString(ourTitleList[titleItr].filename().string(), 42, true));
|
||||
inst::ui::setInstBarPerc(0);
|
||||
|
@ -177,7 +175,7 @@ namespace nspInstStuff {
|
|||
}
|
||||
}
|
||||
|
||||
printf("Done");
|
||||
LOG_DEBUG("Done");
|
||||
if (appletGetAppletType() == AppletType_Application || appletGetAppletType() == AppletType_SystemApplication) appletEndBlockingHomeButton();
|
||||
inst::ui::loadMainMenu();
|
||||
inst::util::deinitInstallServices();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <switch.h>
|
||||
#include "util/error.hpp"
|
||||
#include "ui/MainApplication.hpp"
|
||||
#include "util/curl.hpp"
|
||||
#include "util/util.hpp"
|
||||
|
@ -61,8 +62,8 @@ namespace sig {
|
|||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
printf("Failed to install Signature Patches");
|
||||
printf("%s", e.what());
|
||||
LOG_DEBUG("Failed to install Signature Patches");
|
||||
LOG_DEBUG("%s", e.what());
|
||||
fprintf(stdout, "%s", e.what());
|
||||
inst::ui::mainApp->CreateShowDialog("Failed to install Signature Patches!", (std::string)e.what(), {"OK"}, true);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <string>
|
||||
#include "util/error.hpp"
|
||||
#include "usbInstall.hpp"
|
||||
#include "install/usb_nsp.hpp"
|
||||
#include "install/install_nsp_remote.hpp"
|
||||
|
@ -97,7 +98,7 @@ namespace usbInstStuff {
|
|||
installTask = new tin::install::nsp::RemoteNSPInstall(m_destStorageId, inst::config::ignoreReqVers, usbNSP);
|
||||
}
|
||||
|
||||
printf("%s\n", "Preparing installation");
|
||||
LOG_DEBUG("%s\n", "Preparing installation");
|
||||
inst::ui::setInstInfoText("Preparing installation...");
|
||||
inst::ui::setInstBarPerc(0);
|
||||
installTask->Prepare();
|
||||
|
@ -106,8 +107,8 @@ namespace usbInstStuff {
|
|||
}
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
printf("Failed to install");
|
||||
printf("%s", e.what());
|
||||
LOG_DEBUG("Failed to install");
|
||||
LOG_DEBUG("%s", e.what());
|
||||
fprintf(stdout, "%s", e.what());
|
||||
inst::ui::setInstInfoText("Failed to install " + fileNames[fileItr]);
|
||||
inst::ui::setInstBarPerc(0);
|
||||
|
@ -131,7 +132,7 @@ namespace usbInstStuff {
|
|||
else inst::ui::mainApp->CreateShowDialog(fileNames[0] + " installed!", nspInstStuff::finishedMessage(), {"OK"}, true);
|
||||
}
|
||||
|
||||
printf("Done");
|
||||
LOG_DEBUG("Done");
|
||||
inst::ui::loadMainMenu();
|
||||
inst::util::deinitInstallServices();
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "util/curl.hpp"
|
||||
#include "util/config.hpp"
|
||||
#include "util/error.hpp"
|
||||
#include <curl/curl.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
@ -45,7 +46,7 @@ namespace inst::curl {
|
|||
|
||||
if (result == CURLE_OK) return true;
|
||||
else {
|
||||
printf(curl_easy_strerror(result));
|
||||
LOG_DEBUG(curl_easy_strerror(result));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +80,7 @@ namespace inst::curl {
|
|||
|
||||
if (result == CURLE_OK) return stream.str();
|
||||
else {
|
||||
printf(curl_easy_strerror(result));
|
||||
LOG_DEBUG(curl_easy_strerror(result));
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ SOFTWARE.
|
|||
|
||||
void printBytes(u8 *bytes, size_t size, bool includeHeader)
|
||||
{
|
||||
#ifdef NXLINK_DEBUG
|
||||
int count = 0;
|
||||
|
||||
if (includeHeader)
|
||||
|
@ -48,4 +49,5 @@ void printBytes(u8 *bytes, size_t size, bool includeHeader)
|
|||
}
|
||||
|
||||
printf("\n");
|
||||
#endif
|
||||
}
|
|
@ -175,7 +175,7 @@ namespace tin::network
|
|||
{
|
||||
if (sizeRead + streamBufSize > size)
|
||||
{
|
||||
printf("New read size 0x%lx would exceed total expected size 0x%lx\n", sizeRead + streamBufSize, size);
|
||||
LOG_DEBUG("New read size 0x%lx would exceed total expected size 0x%lx\n", sizeRead + streamBufSize, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -210,8 +210,6 @@ namespace tin::network
|
|||
std::stringstream ss;
|
||||
ss << offset << "-" << (offset + size - 1);
|
||||
auto range = ss.str();
|
||||
// printf("Requesting from range: %s\n", range.c_str());
|
||||
// printf("Read size: %lx\n", size); NOTE: For some reason including these causes the cursor to disappear?
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, m_url.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
|
|
@ -83,13 +83,13 @@ namespace tin::util
|
|||
|
||||
if (R_FAILED(rc = nsGetApplicationControlData(NsApplicationControlSource_Storage, baseTitleId, &appControlData, sizeof(NsApplicationControlData), &sizeRead)))
|
||||
{
|
||||
printf("Failed to get application control data. Error code: 0x%08x\n", rc);
|
||||
LOG_DEBUG("Failed to get application control data. Error code: 0x%08x\n", rc);
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
if (sizeRead < sizeof(appControlData.nacp))
|
||||
{
|
||||
printf("Incorrect size for nacp\n");
|
||||
LOG_DEBUG("Incorrect size for nacp\n");
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
|
@ -97,13 +97,13 @@ namespace tin::util
|
|||
|
||||
if (R_FAILED(rc = nacpGetLanguageEntry(&appControlData.nacp, &languageEntry)))
|
||||
{
|
||||
printf("Failed to get language entry. Error code: 0x%08x\n", rc);
|
||||
LOG_DEBUG("Failed to get language entry. Error code: 0x%08x\n", rc);
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
if (languageEntry == NULL)
|
||||
{
|
||||
printf("Language entry is null! Error code: 0x%08x\n", rc);
|
||||
LOG_DEBUG("Language entry is null! Error code: 0x%08x\n", rc);
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
|
|
|
@ -71,8 +71,6 @@ namespace tin::util
|
|||
while (cursize)
|
||||
{
|
||||
tmpsize = usbCommsWrite(bufptr, cursize);
|
||||
//LOG_DEBUG("USB Bytes Written: \n");
|
||||
//printBytes((u8*)bufptr, tmpsize, true);
|
||||
bufptr += tmpsize;
|
||||
cursize -= tmpsize;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue