From bf4195b58113b50d257979d680f3376ce473a315 Mon Sep 17 00:00:00 2001 From: Luca D'Amico Date: Sun, 25 Aug 2024 20:27:42 +0200 Subject: [PATCH] Fixes needed to build using GCC --- ndsfactory/ndsfactory.cpp | 7 +++--- ui/dialogs/about/revision.h | 2 +- ui/tabs/unpacker/unpackertabsignals.cpp | 30 +++++++++---------------- 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/ndsfactory/ndsfactory.cpp b/ndsfactory/ndsfactory.cpp index 192b343..f6055af 100644 --- a/ndsfactory/ndsfactory.cpp +++ b/ndsfactory/ndsfactory.cpp @@ -55,8 +55,7 @@ NFResult NDSFactory::dumpDataFromFile(const std::string& romPath, const std::str bool NDSFactory::logToFile(const std::string& logPath, const std::string& log) { std::ofstream savedFile(logPath, std::ios::out | std::ios::binary | std::ios::app); - if (!savedFile.is_open()) - return false; + if (!savedFile.is_open()) return false; savedFile.write(log.c_str(), log.size()); savedFile.close(); @@ -308,7 +307,7 @@ NFResult NDSFactory::buildFatData(const std::string& fatDataDirPath, const std:: std::vector fntBytes; std::vector fileIDs; - std::ifstream fileIDsFile(fatDataDirPath + "/_file_IDs.txt", std::ios::in | std::ios::beg); + std::ifstream fileIDsFile(fatDataDirPath + "/_file_IDs.txt", std::ios::in); if (!fileIDsFile.is_open()) return { false, "Error opening file: " + fatDataDirPath + "/_file_IDs.txt" }; std::string fileIDsLine; while (std::getline(fileIDsFile, fileIDsLine)) @@ -331,7 +330,7 @@ NFResult NDSFactory::buildFatData(const std::string& fatDataDirPath, const std:: int firstFileId = fatFileID.id; if (firstFileId > 0) { - std::ifstream originalFatFile(originalFatPath, std::ios::in | std::ios::binary | std::ios::beg); + std::ifstream originalFatFile(originalFatPath, std::ios::in | std::ios::binary); if (!originalFatFile.is_open()) return { false, "Error opening file: " + originalFatPath }; std::vector ovrBytes; uint32_t requiredBytes = firstFileId * sizeof(FatRange); diff --git a/ui/dialogs/about/revision.h b/ui/dialogs/about/revision.h index e4c3b11..6a29d49 100644 --- a/ui/dialogs/about/revision.h +++ b/ui/dialogs/about/revision.h @@ -1,6 +1,6 @@ #ifndef REVISION_H #define REVISION_H -#define GIT_COMMIT_HASH "dec5243" +#define GIT_COMMIT_HASH "c916f47" #endif diff --git a/ui/tabs/unpacker/unpackertabsignals.cpp b/ui/tabs/unpacker/unpackertabsignals.cpp index 95fb1d5..84bfeab 100644 --- a/ui/tabs/unpacker/unpackertabsignals.cpp +++ b/ui/tabs/unpacker/unpackertabsignals.cpp @@ -39,8 +39,7 @@ void MainWindow::on_unpackerDumpHeaderBtn_clicked() QString dirPath = customSaveFileDialog("NDS Header", "header.bin", "Binary (*.bin)"); - if (!dirPath.isNull()) - notifyExtractionResult(dumpHeader(dirPath.toStdString())); + if (!dirPath.isNull()) notifyExtractionResult(dumpHeader(dirPath.toStdString())); ui->unpackerDumpHeaderBtn->setEnabled(true); } @@ -57,8 +56,7 @@ void MainWindow::on_unpackerDumpArm9Btn_clicked() "Do you want to dump the extra 12 bytes? (click yes if you want a 1:1 arm9 dump)", QMessageBox::Yes|QMessageBox::No); - if (!dirPath.isNull()) - notifyExtractionResult(dumpArm9Bin(dirPath.toStdString(), dumpExtraBytes == QMessageBox::Yes ? true : false)); + if (!dirPath.isNull()) notifyExtractionResult(dumpArm9Bin(dirPath.toStdString(), dumpExtraBytes == QMessageBox::Yes ? true : false)); ui->unpackerDumpArm9Btn->setEnabled(true); } @@ -69,8 +67,7 @@ void MainWindow::on_unpackerDumpArm7Btn_clicked() QString dirPath = customSaveFileDialog("NDS ARM7", "arm7.bin", "Binary (*.bin)"); - if (!dirPath.isNull()) - notifyExtractionResult(dumpArm7Bin(dirPath.toStdString())); + if (!dirPath.isNull()) notifyExtractionResult(dumpArm7Bin(dirPath.toStdString())); ui->unpackerDumpArm7Btn->setEnabled(true); } @@ -81,8 +78,7 @@ void MainWindow::on_unpackerDumpFntBtn_clicked() QString dirPath = customSaveFileDialog("NDS FNT", "fnt.bin", "Binary (*.bin)"); - if (!dirPath.isNull()) - notifyExtractionResult(dumpFnt(dirPath.toStdString())); + if (!dirPath.isNull()) notifyExtractionResult(dumpFnt(dirPath.toStdString())); ui->unpackerDumpFntBtn->setEnabled(true); } @@ -93,8 +89,7 @@ void MainWindow::on_unpackerDumpFatBtn_clicked() QString dirPath = customSaveFileDialog("NDS FAT", "fat.bin", "Binary (*.bin)"); - if (!dirPath.isNull()) - notifyExtractionResult(dumpFat(dirPath.toStdString())); + if (!dirPath.isNull()) notifyExtractionResult(dumpFat(dirPath.toStdString())); ui->unpackerDumpFatBtn->setEnabled(true); } @@ -105,8 +100,7 @@ void MainWindow::on_unpackerDumpArm9OverlayBtn_clicked() QString dirPath = customSaveFileDialog("NDS ARM9 Overlay", "a9ovr.bin", "Binary (*.bin)"); - if (!dirPath.isNull()) - notifyExtractionResult(dumpArm9Overlay(dirPath.toStdString())); + if (!dirPath.isNull()) notifyExtractionResult(dumpArm9Overlay(dirPath.toStdString())); ui->unpackerDumpArm9OverlayBtn->setEnabled(true); } @@ -117,8 +111,7 @@ void MainWindow::on_unpackerDumpArm7OverlayBtn_clicked() QString dirPath = customSaveFileDialog("NDS ARM7 Overlay", "a7ovr.bin", "Binary (*.bin)"); - if (!dirPath.isNull()) - notifyExtractionResult(dumpArm7Overlay(dirPath.toStdString())); + if (!dirPath.isNull()) notifyExtractionResult(dumpArm7Overlay(dirPath.toStdString())); ui->unpackerDumpArm7OverlayBtn->setEnabled(true); } @@ -129,8 +122,7 @@ void MainWindow::on_unpackerDumpIconTitleLogoBtn_clicked() QString dirPath = customSaveFileDialog("NDS IconTitleLogo", "itl.bin", "Binary (*.bin)"); - if (!dirPath.isNull()) - notifyExtractionResult(dumpIconTitle(dirPath.toStdString())); + if (!dirPath.isNull()) notifyExtractionResult(dumpIconTitle(dirPath.toStdString())); ui->unpackerDumpIconTitleLogoBtn->setEnabled(true); } @@ -141,8 +133,7 @@ void MainWindow::on_unpackerDumpFatFilesBtn_clicked() QString dirPath = customSaveFileDialog("NDS FAT Files", "fat_data.bin", "Binary (*.bin)"); - if (!dirPath.isNull()) - notifyExtractionResult(dumpFatFiles(dirPath.toStdString())); + if (!dirPath.isNull()) notifyExtractionResult(dumpFatFiles(dirPath.toStdString())); ui->unpackerDumpFatFilesBtn->setEnabled(true); } @@ -153,8 +144,7 @@ void MainWindow::on_unpackerDumpArm9OverlayFilesBtn_clicked() QString dirPath = customSaveFileDialog("NDS ARM9 Overlay Data", "a9ovr_data.bin", "Binary (*.bin)"); - if (!dirPath.isNull()) - notifyExtractionResult(dumpArm9OverlayFiles(dirPath.toStdString())); + if (!dirPath.isNull()) notifyExtractionResult(dumpArm9OverlayFiles(dirPath.toStdString())); ui->unpackerDumpArm9OverlayFilesBtn->setEnabled(true); }