mirror of
https://github.com/Luca1991/NDSFactory.git
synced 2025-07-23 13:22:27 +02:00
Compare commits
5 Commits
fb12309ea0
...
a2739a9ca8
Author | SHA1 | Date | |
---|---|---|---|
|
a2739a9ca8 | ||
|
e17d3805aa | ||
|
099d04d432 | ||
|
dadd1d5c1f | ||
|
ca8ad8259b |
@ -84,7 +84,7 @@ else()
|
||||
endif()
|
||||
|
||||
# Set C++ standard for the target
|
||||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14)
|
||||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
|
||||
|
||||
# Enable Qt's automatic features for the target
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <fstream>
|
||||
#include <cmath>
|
||||
#include <filesystem>
|
||||
#include <format>
|
||||
#include "ndsfactory.h"
|
||||
#include "fatstruct.h"
|
||||
#include "crctable.h"
|
||||
@ -61,6 +62,18 @@ bool NDSFactory::dumpDataFromFile(const std::string& romPath, const std::string&
|
||||
return false;
|
||||
}
|
||||
|
||||
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())
|
||||
{
|
||||
savedFile.write(log.c_str(), log.size());
|
||||
savedFile.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool NDSFactory::readBytesFromFile(std::vector<char>& byteBuffer, const std::string& romPath, uint32_t startAddr, uint32_t size)
|
||||
{
|
||||
@ -135,7 +148,7 @@ bool NDSFactory::checkArm9FooterPresence(const std::string& sectionPath, uint32_
|
||||
}
|
||||
|
||||
bool NDSFactory::extractFatData(const std::string& fatDataSectionPath, const std::string& fatSectionPath,
|
||||
const std::string& fntSectionPath, uint32_t originalFatDataAddr, const std::string& savePath)
|
||||
const std::string& fntSectionPath, uint32_t originalFatDataAddr, const std::string& savePath, bool logFileIDs)
|
||||
{
|
||||
std::vector<char> fatDataBytes;
|
||||
std::vector<char> fatBytes;
|
||||
@ -169,7 +182,7 @@ bool NDSFactory::extractFatData(const std::string& fatDataSectionPath, const std
|
||||
|
||||
// This lambda function was written by NyuBlara, all credits to him.
|
||||
// I edited it a bit to make it work with the rest of the updated code.
|
||||
auto parseFolder = [this, fntBytes, pfatrange, fatDataSectionPath, originalFatDataAddr](uint32_t folderId, std::string curPath, auto& parseFolder) {
|
||||
auto parseFolder = [this, fntBytes, pfatrange, fatDataSectionPath, originalFatDataAddr, savePath, logFileIDs](uint32_t folderId, std::string curPath, auto& parseFolder) {
|
||||
|
||||
uint32_t currentOffset = 8 * (folderId & FNT_HEADER_OFFSET_MASK); // offset for the current directory's info in the FNT header
|
||||
// Only the lower 12 bit of the given offset are relevant
|
||||
@ -236,6 +249,12 @@ bool NDSFactory::extractFatData(const std::string& fatDataSectionPath, const std
|
||||
if (!std::filesystem::exists(newPath))
|
||||
if (!std::filesystem::create_directory(newPath)) return false;
|
||||
|
||||
if (logFileIDs)
|
||||
{
|
||||
std::string log = std::format("{:x}",subFolderId) + "::D::" + newPath.substr(savePath.size()+1) + '\n';
|
||||
if (!logToFile(savePath + "/_file_IDs.txt", log)) return false;
|
||||
}
|
||||
|
||||
// Jump back to the FNT header and repeat the process for subdirectory !
|
||||
if (!parseFolder(subFolderId, newPath, parseFolder)) return false;
|
||||
}
|
||||
@ -249,6 +268,12 @@ bool NDSFactory::extractFatData(const std::string& fatDataSectionPath, const std
|
||||
uint32_t fileSize = (pfatrange + fatOffset)->endAddr - (pfatrange + fatOffset)->startAddr;
|
||||
if (!dumpDataFromFile(fatDataSectionPath, newPath, fileStartAddr, fileSize)) return false;
|
||||
|
||||
if (logFileIDs)
|
||||
{
|
||||
std::string log = std::format("{:x}", fatOffset) + "::F::" + newPath.substr(savePath.size()+1) + '\n';
|
||||
if (!logToFile(savePath + "/_file_IDs.txt", log)) return false;
|
||||
}
|
||||
|
||||
fatOffset++;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ public:
|
||||
NDSFactory();
|
||||
bool loadRomHeader(const std::string& romPath, std::vector<char>& header);
|
||||
bool dumpDataFromFile(const std::string& romPath, const std::string& savePath, uint32_t startAddr, uint32_t size);
|
||||
bool logToFile(const std::string& logPath, const std::string& log);
|
||||
bool readBytesFromFile(std::vector<char>& byteBuffer, const std::string& romPath, uint32_t startAddr, uint32_t size);
|
||||
bool writeSectionToFile(const std::string& sectionPath, const std::string& savePath, uint32_t startAddr, uint32_t size);
|
||||
bool writeBytesToFile(std::vector<char>& byteBuffer, const std::string& savePath, uint32_t startAddr, uint32_t size);
|
||||
@ -21,7 +22,7 @@ public:
|
||||
int getCardSizeInBytes(int cardType);
|
||||
bool checkArm9FooterPresence(const std::string& sectionPath, uint32_t size);
|
||||
bool extractFatData(const std::string& fatDataSectionPath, const std::string& fatSectionPath,
|
||||
const std::string& fntSectionPath, uint32_t originalFatDataAddr, const std::string& savePath);
|
||||
const std::string& fntSectionPath, uint32_t originalFatDataAddr, const std::string& savePath, bool logFileIDs);
|
||||
bool patchFat(const std::string& sectionPath, uint32_t shiftSize, const std::string& savePath);
|
||||
uint16_t calcHeaderCrc16(const std::vector<char>& romHeader);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef REVISION_H
|
||||
#define REVISION_H
|
||||
|
||||
#define GIT_COMMIT_HASH "e788d95"
|
||||
#define GIT_COMMIT_HASH "fb12309"
|
||||
|
||||
#endif
|
||||
|
@ -108,6 +108,6 @@ private:
|
||||
QString extractPackerHeaderTableData(int index);
|
||||
|
||||
bool extractFatData(const std::string& fatDataSectionPath, const std::string& fatSectionPath,
|
||||
const std::string& fntSectionPath, uint32_t originalFatDataAddr, const std::string& savePath);
|
||||
const std::string& fntSectionPath, uint32_t originalFatDataAddr, const std::string& savePath, bool logFileIDs);
|
||||
bool patchFat(const std::string& loadPath, uint32_t shiftSize, const std::string& savePath);
|
||||
};
|
||||
|
@ -697,6 +697,17 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="fatExtractorSaveFileIDsCbx">
|
||||
<property name="text">
|
||||
<string>Save file IDs to _file_IDs.txt (required for games that access files by their ID)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_41">
|
||||
<property name="leftMargin">
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
|
||||
bool MainWindow::extractFatData(const std::string& fatDataSectionPath, const std::string& fatSectionPath,
|
||||
const std::string& fntSectionPath, uint32_t originalFatDataAddr, const std::string& savePath)
|
||||
const std::string& fntSectionPath, uint32_t originalFatDataAddr, const std::string& savePath, bool logFileIDs)
|
||||
{
|
||||
return ndsFactory.extractFatData(fatDataSectionPath, fatSectionPath, fntSectionPath, originalFatDataAddr, savePath);
|
||||
return ndsFactory.extractFatData(fatDataSectionPath, fatSectionPath, fntSectionPath, originalFatDataAddr, savePath, logFileIDs);
|
||||
}
|
||||
|
||||
bool MainWindow::patchFat(const std::string& loadPath, uint32_t shiftSize, const std::string& savePath)
|
||||
|
@ -8,7 +8,7 @@ void MainWindow::on_fatExtractorLoadFatDataBtn_clicked()
|
||||
QString FatDataPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Fat Data",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS FAT_DATA (*.bin)");
|
||||
|
||||
if (!FatDataPath.isNull())
|
||||
@ -22,7 +22,7 @@ void MainWindow::on_fatExtractorLoadFatBtn_clicked()
|
||||
QString FatPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Fat",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS FAT (*.bin)");
|
||||
|
||||
if (!FatPath.isNull())
|
||||
@ -36,7 +36,7 @@ void MainWindow::on_fatExtractorLoadFntBtn_clicked()
|
||||
QString FntPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Fnt",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS FNT (*.bin)");
|
||||
|
||||
if (!FntPath.isNull())
|
||||
@ -54,10 +54,11 @@ void MainWindow::on_fatExtractorExtractBtn_clicked()
|
||||
|
||||
if (!dirPath.isNull())
|
||||
extractFatData(ui->fatExtractorFatDataPathEdt->text().toStdString(),
|
||||
ui->fatExtractorFatPathEdt->text().toStdString(),
|
||||
ui->fatExtractorFntPathEdt->text().toStdString(),
|
||||
ui->fatExtractorOriginalFatFilesAddrEdt->text().toUInt(nullptr, 16),
|
||||
dirPath.toStdString()) ? QMessageBox::information(this, tr("NDS Factory"), tr("FAT files extraction completed!"))
|
||||
ui->fatExtractorFatPathEdt->text().toStdString(),
|
||||
ui->fatExtractorFntPathEdt->text().toStdString(),
|
||||
ui->fatExtractorOriginalFatFilesAddrEdt->text().toUInt(nullptr, 16),
|
||||
dirPath.toStdString(),
|
||||
ui->fatExtractorSaveFileIDsCbx->isChecked()) ? QMessageBox::information(this, tr("NDS Factory"), tr("FAT files extraction completed!"))
|
||||
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error extracting FAT files!"));
|
||||
|
||||
}
|
||||
@ -67,7 +68,7 @@ void MainWindow::on_fatPatcherLoadFatBtn_clicked()
|
||||
QString fatPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Fat",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS Fat (*.bin)");
|
||||
|
||||
if( !fatPath.isNull() )
|
||||
|
@ -35,7 +35,7 @@ void MainWindow::on_packerLoadArm9BinBtn_clicked()
|
||||
QString arm9BinPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Arm9Bin",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS Arm9Bin (*.bin)");
|
||||
|
||||
if(!arm9BinPath.isNull())
|
||||
@ -49,7 +49,7 @@ void MainWindow::on_packerLoadArm7BinBtn_clicked()
|
||||
QString arm7BinPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Arm7Bin",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS Arm7Bin (*.bin)");
|
||||
|
||||
if(!arm7BinPath.isNull())
|
||||
@ -63,7 +63,7 @@ void MainWindow::on_packerLoadFntBtn_clicked()
|
||||
QString fntPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Fnt",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS Fnt (*.bin)");
|
||||
|
||||
if(!fntPath.isNull())
|
||||
@ -77,7 +77,7 @@ void MainWindow::on_packerLoadFatBtn_clicked()
|
||||
QString fatPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Fat",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS Fat (*.bin)");
|
||||
|
||||
if(!fatPath.isNull())
|
||||
@ -91,7 +91,7 @@ void MainWindow::on_packerLoadArm9OverlayBtn_clicked()
|
||||
QString arm9OverlayPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Arm9Overlay",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS A9OVR (*.bin)");
|
||||
|
||||
if( !arm9OverlayPath.isNull() )
|
||||
@ -105,7 +105,7 @@ void MainWindow::on_packerLoadArm9OverlayFilesBtn_clicked()
|
||||
QString arm9OverlayFilesPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Arm9Overlay Data",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS A9OVR_DATA (*.bin)");
|
||||
|
||||
if(!arm9OverlayFilesPath.isNull())
|
||||
@ -119,7 +119,7 @@ void MainWindow::on_packerLoadArm7OverlayBtn_clicked()
|
||||
QString arm7OverlayPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Arm7Overlay",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS A7OVR (*.bin)");
|
||||
|
||||
if(!arm7OverlayPath.isNull())
|
||||
@ -133,7 +133,7 @@ void MainWindow::on_packerLoadArm7OverlayFilesBtn_clicked()
|
||||
QString arm7OverlayFilesPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Arm7Overlay Data",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS A7OVR_DATA (*.bin)");
|
||||
|
||||
if(!arm7OverlayFilesPath.isNull())
|
||||
@ -147,7 +147,7 @@ void MainWindow::on_packerLoadIconTitleBtn_clicked()
|
||||
QString iconTitlePath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS IconTitleLogo",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS ITL (*.bin)");
|
||||
|
||||
if(!iconTitlePath.isNull())
|
||||
@ -161,7 +161,7 @@ void MainWindow::on_packerLoadFatFilesBtn_clicked()
|
||||
QString fatFilesPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Fat Data",
|
||||
QDir::currentPath(),
|
||||
"",
|
||||
"NDS FAT_DATA (*.bin)");
|
||||
|
||||
if(!fatFilesPath.isNull())
|
||||
|
@ -23,14 +23,26 @@ void MainWindow::enableExtractionButtons()
|
||||
{
|
||||
ui->unpackerExtractorGbx->setEnabled(true);
|
||||
ui->unpackerExtraGbx->setEnabled(true);
|
||||
if (ui->unpackerHeaderDataTable->model()->index(NDSHeaderNames::ARM9OverlayAddress, 1).data().toString().toUInt(nullptr,16) == 0){
|
||||
if (ui->unpackerHeaderDataTable->model()->index(NDSHeaderNames::ARM9OverlayAddress, 1).data().toString().toUInt(nullptr,16) == 0)
|
||||
{
|
||||
ui->unpackerDumpArm9OverlayBtn->setEnabled(false);
|
||||
ui->unpackerDumpArm9OverlayFilesBtn->setEnabled(false);
|
||||
}
|
||||
if (ui->unpackerHeaderDataTable->model()->index(NDSHeaderNames::ARM7OverlayAddress, 1).data().toString().toUInt(nullptr,16) == 0){
|
||||
else
|
||||
{
|
||||
ui->unpackerDumpArm9OverlayBtn->setEnabled(true);
|
||||
ui->unpackerDumpArm9OverlayFilesBtn->setEnabled(true);
|
||||
}
|
||||
if (ui->unpackerHeaderDataTable->model()->index(NDSHeaderNames::ARM7OverlayAddress, 1).data().toString().toUInt(nullptr,16) == 0)
|
||||
{
|
||||
ui->unpackerDumpArm7OverlayBtn->setEnabled(false);
|
||||
ui->unpackerDumpArm7OverlayFilesBtn->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->unpackerDumpArm7OverlayBtn->setEnabled(true);
|
||||
ui->unpackerDumpArm7OverlayFilesBtn->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::disableExtractionButtons()
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <QMessageBox>
|
||||
#include "./../../mainwindow.h"
|
||||
#include "./../../ui_mainwindow.h"
|
||||
#include "./../../utils/filepicker.h"
|
||||
|
||||
|
||||
void MainWindow::on_loadRomBtn_clicked()
|
||||
@ -34,11 +35,7 @@ void MainWindow::on_loadRomBtn_clicked()
|
||||
|
||||
void MainWindow::on_unpackerDumpHeaderBtn_clicked()
|
||||
{
|
||||
QString dirPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Header",
|
||||
"header.bin",
|
||||
"Binary (*.bin)");
|
||||
QString dirPath = customSaveFileDialog("NDS Header", "header.bin", "Binary (*.bin)");
|
||||
|
||||
if (!dirPath.isNull())
|
||||
notifyExtractionResult(dumpHeader(dirPath.toStdString()));
|
||||
@ -46,11 +43,7 @@ void MainWindow::on_unpackerDumpHeaderBtn_clicked()
|
||||
|
||||
void MainWindow::on_unpackerDumpArm9Btn_clicked()
|
||||
{
|
||||
QString dirPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS ARM9",
|
||||
"arm9.bin",
|
||||
"Binary (*.bin)");
|
||||
QString dirPath = customSaveFileDialog("NDS ARM9", "arm9.bin", "Binary (*.bin)");
|
||||
|
||||
QMessageBox::StandardButton dumpExtraBytes = QMessageBox::question(
|
||||
this,
|
||||
@ -64,11 +57,7 @@ void MainWindow::on_unpackerDumpArm9Btn_clicked()
|
||||
|
||||
void MainWindow::on_unpackerDumpArm7Btn_clicked()
|
||||
{
|
||||
QString dirPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS ARM7",
|
||||
"arm7.bin",
|
||||
"Binary (*.bin)");
|
||||
QString dirPath = customSaveFileDialog("NDS ARM7", "arm7.bin", "Binary (*.bin)");
|
||||
|
||||
if (!dirPath.isNull())
|
||||
notifyExtractionResult(dumpArm7Bin(dirPath.toStdString()));
|
||||
@ -76,11 +65,7 @@ void MainWindow::on_unpackerDumpArm7Btn_clicked()
|
||||
|
||||
void MainWindow::on_unpackerDumpFntBtn_clicked()
|
||||
{
|
||||
QString dirPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS FNT",
|
||||
"fnt.bin",
|
||||
"Binary (*.bin)");
|
||||
QString dirPath = customSaveFileDialog("NDS FNT", "fnt.bin", "Binary (*.bin)");
|
||||
|
||||
if (!dirPath.isNull())
|
||||
notifyExtractionResult(dumpFnt(dirPath.toStdString()));
|
||||
@ -88,11 +73,7 @@ void MainWindow::on_unpackerDumpFntBtn_clicked()
|
||||
|
||||
void MainWindow::on_unpackerDumpFatBtn_clicked()
|
||||
{
|
||||
QString dirPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS FAT",
|
||||
"fat.bin",
|
||||
"Binary (*.bin)");
|
||||
QString dirPath = customSaveFileDialog("NDS FAT", "fat.bin", "Binary (*.bin)");
|
||||
|
||||
if (!dirPath.isNull())
|
||||
notifyExtractionResult(dumpFat(dirPath.toStdString()));
|
||||
@ -100,11 +81,7 @@ void MainWindow::on_unpackerDumpFatBtn_clicked()
|
||||
|
||||
void MainWindow::on_unpackerDumpArm9OverlayBtn_clicked()
|
||||
{
|
||||
QString dirPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS ARM9 Overlay",
|
||||
"a9ovr.bin",
|
||||
"Binary (*.bin)");
|
||||
QString dirPath = customSaveFileDialog("NDS ARM9 Overlay", "a9ovr.bin", "Binary (*.bin)");
|
||||
|
||||
if (!dirPath.isNull())
|
||||
notifyExtractionResult(dumpArm9Overlay(dirPath.toStdString()));
|
||||
@ -112,11 +89,7 @@ void MainWindow::on_unpackerDumpArm9OverlayBtn_clicked()
|
||||
|
||||
void MainWindow::on_unpackerDumpArm7OverlayBtn_clicked()
|
||||
{
|
||||
QString dirPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS ARM7 Overlay",
|
||||
"a7ovr.bin",
|
||||
"Binary (*.bin)");
|
||||
QString dirPath = customSaveFileDialog("NDS ARM7 Overlay", "a7ovr.bin", "Binary (*.bin)");
|
||||
|
||||
if (!dirPath.isNull())
|
||||
notifyExtractionResult(dumpArm7Overlay(dirPath.toStdString()));
|
||||
@ -124,11 +97,7 @@ void MainWindow::on_unpackerDumpArm7OverlayBtn_clicked()
|
||||
|
||||
void MainWindow::on_unpackerDumpIconTitleLogoBtn_clicked()
|
||||
{
|
||||
QString dirPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS IconTitleLogo",
|
||||
"itl.bin",
|
||||
"Binary (*.bin)");
|
||||
QString dirPath = customSaveFileDialog("NDS IconTitleLogo", "itl.bin", "Binary (*.bin)");
|
||||
|
||||
if (!dirPath.isNull())
|
||||
notifyExtractionResult(dumpIconTitle(dirPath.toStdString()));
|
||||
@ -136,11 +105,7 @@ void MainWindow::on_unpackerDumpIconTitleLogoBtn_clicked()
|
||||
|
||||
void MainWindow::on_unpackerDumpFatFilesBtn_clicked()
|
||||
{
|
||||
QString dirPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS FAT Files",
|
||||
"fat_data.bin",
|
||||
"Binary (*.bin)");
|
||||
QString dirPath = customSaveFileDialog("NDS FAT Files", "fat_data.bin", "Binary (*.bin)");
|
||||
|
||||
if (!dirPath.isNull())
|
||||
notifyExtractionResult(dumpFatFiles(dirPath.toStdString()));
|
||||
@ -148,14 +113,18 @@ void MainWindow::on_unpackerDumpFatFilesBtn_clicked()
|
||||
|
||||
void MainWindow::on_unpackerDumpArm9OverlayFilesBtn_clicked()
|
||||
{
|
||||
QMessageBox::warning(this, tr("NDS Factory"), tr("This function is currently not implemented!"));
|
||||
//dumpArm9OverlayFiles()
|
||||
QString dirPath = customSaveFileDialog("NDS ARM9 Overlay Data", "a9ovr_data.bin", "Binary (*.bin)");
|
||||
|
||||
if (!dirPath.isNull())
|
||||
notifyExtractionResult(dumpArm9OverlayFiles(dirPath.toStdString()));
|
||||
}
|
||||
|
||||
void MainWindow::on_unpackerDumpArm7OverlayFilesBtn_clicked()
|
||||
{
|
||||
QMessageBox::warning(this, tr("NDS Factory"), tr("This function is currently not implemented!"));
|
||||
//dumpArm7OverlayFiles()
|
||||
QString dirPath = customSaveFileDialog("NDS ARM7 Overlay Data", "a7ovr_data.bin", "Binary (*.bin)");
|
||||
|
||||
if (!dirPath.isNull())
|
||||
notifyExtractionResult(dumpArm7OverlayFiles(dirPath.toStdString()));
|
||||
}
|
||||
|
||||
void MainWindow::on_unpackerDumpEverythingBtn_clicked()
|
||||
|
21
ui/utils/filepicker.h
Normal file
21
ui/utils/filepicker.h
Normal file
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
QString customSaveFileDialog(const QString& title, const QString& defaultName, const QString& filter)
|
||||
{
|
||||
|
||||
static QString lastUsedPath;
|
||||
|
||||
QString selectedPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
title,
|
||||
lastUsedPath + defaultName,
|
||||
filter);
|
||||
|
||||
if (!selectedPath.isNull())
|
||||
lastUsedPath = selectedPath.mid(0, selectedPath.lastIndexOf('/', Qt::CaseInsensitive)+1);
|
||||
|
||||
return selectedPath;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user