Adjust debug levels to always log errors

This commit is contained in:
Maschell 2022-07-28 12:49:16 +02:00
parent d58486e9c6
commit 5a4f9484c3
5 changed files with 11 additions and 11 deletions

View File

@ -269,7 +269,7 @@ ApplicationState::eSubState GMPartitionsDumperState::update(Input *input) {
this->curNUSTitle = gmPartitionPair.second; this->curNUSTitle = gmPartitionPair.second;
this->dataProvider = this->curNUSTitle->dataProcessor->getDataProvider(); this->dataProvider = this->curNUSTitle->dataProcessor->getDataProvider();
} else { } 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); this->setError(ERROR_NO_GM_PARTITION);
return SUBSTATE_RUNNING; return SUBSTATE_RUNNING;
} }

View File

@ -103,7 +103,7 @@ bool DiscReaderDiscDrive::readEncrypted(uint8_t *buf, uint64_t offset, uint32_t
uint32_t block_cnt = size >> 15; uint32_t block_cnt = size >> 15;
uint32_t offset_in_sectors = offset >> 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) { 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 false;
} }
return true; return true;

View File

@ -70,7 +70,7 @@ ApplicationState::eSubState WUDDumperState::update(Input *input) {
if (this->sectorBuf == nullptr) { if (this->sectorBuf == nullptr) {
this->sectorBuf = (void *) memalign(0x100, this->sectorBufSize); this->sectorBuf = (void *) memalign(0x100, this->sectorBufSize);
if (this->sectorBuf == nullptr) { if (this->sectorBuf == nullptr) {
DEBUG_FUNCTION_LINE("ERROR_MALLOC_FAILED"); DEBUG_FUNCTION_LINE_ERR("ERROR_MALLOC_FAILED");
this->setError(ERROR_MALLOC_FAILED); this->setError(ERROR_MALLOC_FAILED);
return ApplicationState::SUBSTATE_RUNNING; return ApplicationState::SUBSTATE_RUNNING;
} }
@ -165,7 +165,7 @@ ApplicationState::eSubState WUDDumperState::update(Input *input) {
this->state = STATE_DUMP_DISC_DONE; this->state = STATE_DUMP_DISC_DONE;
if (this->fileHandle->isOpen()) { if (this->fileHandle->isOpen()) {
if (!this->fileHandle->flush()) { if (!this->fileHandle->flush()) {
DEBUG_FUNCTION_LINE("Flush failed"); DEBUG_FUNCTION_LINE_ERR("Final flush failed");
this->setError(ERROR_WRITE_FAILED); this->setError(ERROR_WRITE_FAILED);
return ApplicationState::SUBSTATE_RUNNING; return ApplicationState::SUBSTATE_RUNNING;
} }

View File

@ -33,7 +33,7 @@ WUXFileWriter::WUXFileWriter(const char *path, int32_t cacheSize, int32_t sector
this->sectorIndexTable = (void *) memalign(0x40, ROUNDUP(totalSectorCount * 4, 0x40)); this->sectorIndexTable = (void *) memalign(0x40, ROUNDUP(totalSectorCount * 4, 0x40));
if (sectorIndexTable == nullptr) { if (sectorIndexTable == nullptr) {
DEBUG_FUNCTION_LINE("Failed to alloc"); DEBUG_FUNCTION_LINE_ERR("Failed to alloc");
WUDFileWriter::close(); WUDFileWriter::close();
return; return;
} }
@ -77,7 +77,7 @@ int32_t WUXFileWriter::writeSector(const uint8_t *buffer, uint32_t numberOfSecto
hashMap[hashOut] = writtenSector; hashMap[hashOut] = writtenSector;
if (isOpen()) { if (isOpen()) {
if (!write((uint8_t *) addr, this->sectorSize)) { if (!write((uint8_t *) addr, this->sectorSize)) {
DEBUG_FUNCTION_LINE("Write failed"); DEBUG_FUNCTION_LINE_ERR("Write failed");
return -1; return -1;
} }
} }

View File

@ -46,7 +46,7 @@ bool WriteOnlyFileWithCache::flush() {
if (this->writeBufferPos > 0) { if (this->writeBufferPos > 0) {
int32_t res = CFile::write(static_cast<const uint8_t *>(this->writeBuffer), this->writeBufferPos); int32_t res = CFile::write(static_cast<const uint8_t *>(this->writeBuffer), this->writeBufferPos);
if (res < 0) { 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; return false;
} }
this->writeBufferPos = 0; this->writeBufferPos = 0;
@ -59,7 +59,7 @@ int32_t WriteOnlyFileWithCache::write(const uint8_t *addr, size_t writeSize) {
size_t finalWriteSize = writeSize; size_t finalWriteSize = writeSize;
if (splitFile) { if (splitFile) {
if (pos + writeBufferPos + finalWriteSize >= SPLIT_SIZE) { if (pos + writeBufferPos + finalWriteSize >= SPLIT_SIZE) {
DEBUG_FUNCTION_LINE("We need to split"); DEBUG_FUNCTION_LINE("We need to split files");
if (!flush()) { if (!flush()) {
return -2; return -2;
} }
@ -67,7 +67,7 @@ int32_t WriteOnlyFileWithCache::write(const uint8_t *addr, size_t writeSize) {
uint32_t realWriteSize = SPLIT_SIZE - pos; uint32_t realWriteSize = SPLIT_SIZE - pos;
if (realWriteSize > 0) { 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<const uint8_t *>(addr), realWriteSize) != (int32_t) realWriteSize) { if (CFile::write(reinterpret_cast<const uint8_t *>(addr), realWriteSize) != (int32_t) realWriteSize) {
return -3; return -3;
} }
@ -91,7 +91,7 @@ int32_t WriteOnlyFileWithCache::write(const uint8_t *addr, size_t writeSize) {
if (finalWriteSize == this->writeBufferSize) { if (finalWriteSize == this->writeBufferSize) {
if (!this->flush()) { if (!this->flush()) {
DEBUG_FUNCTION_LINE("Flush failed"); DEBUG_FUNCTION_LINE_ERR("Flush failed");
return -1; return -1;
} }
return CFile::write(reinterpret_cast<const uint8_t *>(addr), finalWriteSize); return CFile::write(reinterpret_cast<const uint8_t *>(addr), finalWriteSize);
@ -115,7 +115,7 @@ int32_t WriteOnlyFileWithCache::write(const uint8_t *addr, size_t writeSize) {
if (this->writeBufferPos == this->writeBufferSize) { if (this->writeBufferPos == this->writeBufferSize) {
if (!this->flush()) { if (!this->flush()) {
DEBUG_FUNCTION_LINE("Flush failed"); DEBUG_FUNCTION_LINE_ERR("Flush failed");
return -2; return -2;
} }
} }