Fixes needed to build using GCC

This commit is contained in:
Luca D'Amico 2024-08-25 20:27:42 +02:00
parent c916f47f75
commit bf4195b581
3 changed files with 14 additions and 25 deletions

View File

@ -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<char> fntBytes;
std::vector<FatFileID> 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<char> ovrBytes;
uint32_t requiredBytes = firstFileId * sizeof(FatRange);

View File

@ -1,6 +1,6 @@
#ifndef REVISION_H
#define REVISION_H
#define GIT_COMMIT_HASH "dec5243"
#define GIT_COMMIT_HASH "c916f47"
#endif

View File

@ -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);
}