Skip to content

Commit

Permalink
Fixes needed to build using GCC
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca1991 committed Aug 25, 2024
1 parent c916f47 commit bf4195b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 25 deletions.
7 changes: 3 additions & 4 deletions ndsfactory/ndsfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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))
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ui/dialogs/about/revision.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef REVISION_H
#define REVISION_H

#define GIT_COMMIT_HASH "dec5243"
#define GIT_COMMIT_HASH "c916f47"

#endif
30 changes: 10 additions & 20 deletions ui/tabs/unpacker/unpackertabsignals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit bf4195b

Please sign in to comment.