From 5a4f9484c3b21c4d5dd3421517675a337bc6cd01 Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 28 Jul 2022 12:49:16 +0200 Subject: [PATCH] Adjust debug levels to always log errors --- source/GMPartitionsDumperState.cpp | 2 +- source/WUD/DiscReaderDiscDrive.cpp | 2 +- source/WUDDumperState.cpp | 4 ++-- source/fs/WUXFileWriter.cpp | 4 ++-- source/fs/WriteOnlyFileWithCache.cpp | 10 +++++----- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/GMPartitionsDumperState.cpp b/source/GMPartitionsDumperState.cpp index cc1e538..98a80cc 100644 --- a/source/GMPartitionsDumperState.cpp +++ b/source/GMPartitionsDumperState.cpp @@ -269,7 +269,7 @@ ApplicationState::eSubState GMPartitionsDumperState::update(Input *input) { this->curNUSTitle = gmPartitionPair.second; this->dataProvider = this->curNUSTitle->dataProcessor->getDataProvider(); } else { - DEBUG_FUNCTION_LINE("Failed to find a GM partition"); + DEBUG_FUNCTION_LINE_ERR("Failed to find a GM partition"); this->setError(ERROR_NO_GM_PARTITION); return SUBSTATE_RUNNING; } diff --git a/source/WUD/DiscReaderDiscDrive.cpp b/source/WUD/DiscReaderDiscDrive.cpp index 4aa234e..74e9b90 100644 --- a/source/WUD/DiscReaderDiscDrive.cpp +++ b/source/WUD/DiscReaderDiscDrive.cpp @@ -103,7 +103,7 @@ bool DiscReaderDiscDrive::readEncrypted(uint8_t *buf, uint64_t offset, uint32_t uint32_t block_cnt = size >> 15; uint32_t offset_in_sectors = offset >> 15; if (FSAEx_RawRead(__wut_devoptab_fs_client, buf, 0x8000, block_cnt, offset_in_sectors, device_handle) < 0) { - DEBUG_FUNCTION_LINE("Failed to read from Disc"); + DEBUG_FUNCTION_LINE_ERR("Failed to read from Disc"); return false; } return true; diff --git a/source/WUDDumperState.cpp b/source/WUDDumperState.cpp index 0b292ad..ec53ebb 100644 --- a/source/WUDDumperState.cpp +++ b/source/WUDDumperState.cpp @@ -70,7 +70,7 @@ ApplicationState::eSubState WUDDumperState::update(Input *input) { if (this->sectorBuf == nullptr) { this->sectorBuf = (void *) memalign(0x100, this->sectorBufSize); if (this->sectorBuf == nullptr) { - DEBUG_FUNCTION_LINE("ERROR_MALLOC_FAILED"); + DEBUG_FUNCTION_LINE_ERR("ERROR_MALLOC_FAILED"); this->setError(ERROR_MALLOC_FAILED); return ApplicationState::SUBSTATE_RUNNING; } @@ -165,7 +165,7 @@ ApplicationState::eSubState WUDDumperState::update(Input *input) { this->state = STATE_DUMP_DISC_DONE; if (this->fileHandle->isOpen()) { if (!this->fileHandle->flush()) { - DEBUG_FUNCTION_LINE("Flush failed"); + DEBUG_FUNCTION_LINE_ERR("Final flush failed"); this->setError(ERROR_WRITE_FAILED); return ApplicationState::SUBSTATE_RUNNING; } diff --git a/source/fs/WUXFileWriter.cpp b/source/fs/WUXFileWriter.cpp index 583838c..15482c2 100644 --- a/source/fs/WUXFileWriter.cpp +++ b/source/fs/WUXFileWriter.cpp @@ -33,7 +33,7 @@ WUXFileWriter::WUXFileWriter(const char *path, int32_t cacheSize, int32_t sector this->sectorIndexTable = (void *) memalign(0x40, ROUNDUP(totalSectorCount * 4, 0x40)); if (sectorIndexTable == nullptr) { - DEBUG_FUNCTION_LINE("Failed to alloc"); + DEBUG_FUNCTION_LINE_ERR("Failed to alloc"); WUDFileWriter::close(); return; } @@ -77,7 +77,7 @@ int32_t WUXFileWriter::writeSector(const uint8_t *buffer, uint32_t numberOfSecto hashMap[hashOut] = writtenSector; if (isOpen()) { if (!write((uint8_t *) addr, this->sectorSize)) { - DEBUG_FUNCTION_LINE("Write failed"); + DEBUG_FUNCTION_LINE_ERR("Write failed"); return -1; } } diff --git a/source/fs/WriteOnlyFileWithCache.cpp b/source/fs/WriteOnlyFileWithCache.cpp index af53fc8..4379c7e 100644 --- a/source/fs/WriteOnlyFileWithCache.cpp +++ b/source/fs/WriteOnlyFileWithCache.cpp @@ -46,7 +46,7 @@ bool WriteOnlyFileWithCache::flush() { if (this->writeBufferPos > 0) { int32_t res = CFile::write(static_cast(this->writeBuffer), this->writeBufferPos); if (res < 0) { - DEBUG_FUNCTION_LINE("Failed to flush cache, write failed: %d", res); + DEBUG_FUNCTION_LINE_ERR("Failed to flush cache, write failed: %d (expected %d)", res, this->writeBufferPos); return false; } this->writeBufferPos = 0; @@ -59,7 +59,7 @@ int32_t WriteOnlyFileWithCache::write(const uint8_t *addr, size_t writeSize) { size_t finalWriteSize = writeSize; if (splitFile) { if (pos + writeBufferPos + finalWriteSize >= SPLIT_SIZE) { - DEBUG_FUNCTION_LINE("We need to split"); + DEBUG_FUNCTION_LINE("We need to split files"); if (!flush()) { return -2; } @@ -67,7 +67,7 @@ int32_t WriteOnlyFileWithCache::write(const uint8_t *addr, size_t writeSize) { uint32_t realWriteSize = SPLIT_SIZE - pos; if (realWriteSize > 0) { - DEBUG_FUNCTION_LINE("Write remaining %8d bytes", realWriteSize); + DEBUG_FUNCTION_LINE_VERBOSE("Write remaining %8d bytes", realWriteSize); if (CFile::write(reinterpret_cast(addr), realWriteSize) != (int32_t) realWriteSize) { return -3; } @@ -91,7 +91,7 @@ int32_t WriteOnlyFileWithCache::write(const uint8_t *addr, size_t writeSize) { if (finalWriteSize == this->writeBufferSize) { if (!this->flush()) { - DEBUG_FUNCTION_LINE("Flush failed"); + DEBUG_FUNCTION_LINE_ERR("Flush failed"); return -1; } return CFile::write(reinterpret_cast(addr), finalWriteSize); @@ -115,7 +115,7 @@ int32_t WriteOnlyFileWithCache::write(const uint8_t *addr, size_t writeSize) { if (this->writeBufferPos == this->writeBufferSize) { if (!this->flush()) { - DEBUG_FUNCTION_LINE("Flush failed"); + DEBUG_FUNCTION_LINE_ERR("Flush failed"); return -2; } }