mirror of
https://github.com/Luca1991/NDSFactory.git
synced 2025-07-09 05:30:12 +02:00
Various QoL improvements
This commit is contained in:
parent
e2e53cbed7
commit
f46e5275d3
@ -1,6 +1,6 @@
|
|||||||
#ifndef REVISION_H
|
#ifndef REVISION_H
|
||||||
#define REVISION_H
|
#define REVISION_H
|
||||||
|
|
||||||
#define GIT_COMMIT_HASH "a2739a9"
|
#define GIT_COMMIT_HASH "e2e53cb"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "./../../mainwindow.h"
|
#include "./../../mainwindow.h"
|
||||||
#include "./../../ui_mainwindow.h"
|
#include "./../../ui_mainwindow.h"
|
||||||
|
#include "./../../utils/filepicker.h"
|
||||||
|
|
||||||
void MainWindow::on_fatExtractorLoadFatDataBtn_clicked()
|
void MainWindow::on_fatExtractorLoadFatDataBtn_clicked()
|
||||||
{
|
{
|
||||||
@ -47,6 +48,8 @@ void MainWindow::on_fatExtractorLoadFntBtn_clicked()
|
|||||||
|
|
||||||
void MainWindow::on_fatExtractorExtractBtn_clicked()
|
void MainWindow::on_fatExtractorExtractBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->fatExtractorExtractBtn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = QFileDialog::getExistingDirectory(
|
QString dirPath = QFileDialog::getExistingDirectory(
|
||||||
this, tr("Select Directory"),
|
this, tr("Select Directory"),
|
||||||
"",
|
"",
|
||||||
@ -61,6 +64,8 @@ void MainWindow::on_fatExtractorExtractBtn_clicked()
|
|||||||
ui->fatExtractorSaveFileIDsCbx->isChecked()) ? QMessageBox::information(this, tr("NDSFactory"), tr("FAT files extraction completed!"))
|
ui->fatExtractorSaveFileIDsCbx->isChecked()) ? QMessageBox::information(this, tr("NDSFactory"), tr("FAT files extraction completed!"))
|
||||||
: QMessageBox::critical(this, tr("NDSFactory"), tr("Error extracting FAT files!"));
|
: QMessageBox::critical(this, tr("NDSFactory"), tr("Error extracting FAT files!"));
|
||||||
|
|
||||||
|
ui->fatExtractorExtractBtn->setEnabled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_fatPatcherLoadFatBtn_clicked()
|
void MainWindow::on_fatPatcherLoadFatBtn_clicked()
|
||||||
@ -72,37 +77,32 @@ void MainWindow::on_fatPatcherLoadFatBtn_clicked()
|
|||||||
"NDS Fat (*.bin)");
|
"NDS Fat (*.bin)");
|
||||||
|
|
||||||
if(!fatPath.isNull())
|
if(!fatPath.isNull())
|
||||||
{
|
|
||||||
ui->fatPatcherFatPathEdt->setText(fatPath.toUtf8());
|
ui->fatPatcherFatPathEdt->setText(fatPath.toUtf8());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_fatPatcherPatchFatBtn_clicked()
|
void MainWindow::on_fatPatcherPatchFatBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->fatPatcherPatchFatBtn->setEnabled(false);
|
||||||
|
|
||||||
uint32_t positionDiff = 0;
|
uint32_t positionDiff = 0;
|
||||||
uint32_t originalPos = ui->fatPatcherOriginalFatFilesAddrEdt->text().toUInt(nullptr, 16);
|
uint32_t originalPos = ui->fatPatcherOriginalFatFilesAddrEdt->text().toUInt(nullptr, 16);
|
||||||
uint32_t newPos = ui->fatPatcherNewFatFilesAddrEdt->text().toUInt(nullptr, 16);
|
uint32_t newPos = ui->fatPatcherNewFatFilesAddrEdt->text().toUInt(nullptr, 16);
|
||||||
|
|
||||||
QString dirPath = QFileDialog::getSaveFileName(
|
QString dirPath = customSaveFileDialog("NDS FAT",
|
||||||
Q_NULLPTR,
|
|
||||||
"NDS FAT",
|
|
||||||
"fat.bin",
|
"fat.bin",
|
||||||
"Binary (*.bin)");
|
"Binary (*.bin)");
|
||||||
|
|
||||||
if(dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(originalPos < newPos)
|
if(originalPos < newPos)
|
||||||
{
|
|
||||||
positionDiff = newPos - originalPos;
|
positionDiff = newPos - originalPos;
|
||||||
} else {
|
else
|
||||||
positionDiff = originalPos - newPos;
|
positionDiff = originalPos - newPos;
|
||||||
}
|
|
||||||
|
|
||||||
patchFat(ui->fatPatcherFatPathEdt->text().toStdString(), positionDiff, dirPath.toStdString())
|
patchFat(ui->fatPatcherFatPathEdt->text().toStdString(), positionDiff, dirPath.toStdString())
|
||||||
? QMessageBox::information(this, tr("NDSFactory"), tr("FAT patching completed!"))
|
? QMessageBox::information(this, tr("NDSFactory"), tr("FAT patching completed!"))
|
||||||
: QMessageBox::critical(this, tr("NDSFactory"), tr("Error patching FAT!"));
|
: QMessageBox::critical(this, tr("NDSFactory"), tr("Error patching FAT!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->fatPatcherPatchFatBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "./../../mainwindow.h"
|
#include "./../../mainwindow.h"
|
||||||
#include "./../../ui_mainwindow.h"
|
#include "./../../ui_mainwindow.h"
|
||||||
|
#include "./../../utils/filepicker.h"
|
||||||
#include "../commons/headernames.h"
|
#include "../commons/headernames.h"
|
||||||
|
|
||||||
|
|
||||||
@ -172,17 +173,17 @@ void MainWindow::on_packerLoadFatFilesBtn_clicked()
|
|||||||
|
|
||||||
void MainWindow::on_packerBuildNDSRomBtn_clicked()
|
void MainWindow::on_packerBuildNDSRomBtn_clicked()
|
||||||
{
|
{
|
||||||
QString dirPath = QFileDialog::getSaveFileName(
|
ui->packerBuildNDSRomBtn->setEnabled(false);
|
||||||
Q_NULLPTR,
|
|
||||||
"NDS Rom",
|
QString dirPath = customSaveFileDialog("NDS Rom",
|
||||||
"rom.nds",
|
"rom.nds",
|
||||||
"NDS ROM (*.nds)");
|
"NDS ROM (*.nds)");
|
||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
{
|
|
||||||
writeEverything(dirPath.toStdString()) ? QMessageBox::information(this, tr("NDSFactory"), tr("Creation completed!"))
|
writeEverything(dirPath.toStdString()) ? QMessageBox::information(this, tr("NDSFactory"), tr("Creation completed!"))
|
||||||
: QMessageBox::critical(this, tr("NDSFactory"), tr("Error during the creation!"));
|
: QMessageBox::critical(this, tr("NDSFactory"), tr("Error during the creation!"));
|
||||||
}
|
|
||||||
|
ui->packerBuildNDSRomBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_packerCalcHeaderCrcBtn_clicked()
|
void MainWindow::on_packerCalcHeaderCrcBtn_clicked()
|
||||||
|
@ -36,14 +36,20 @@ void MainWindow::on_loadRomBtn_clicked()
|
|||||||
|
|
||||||
void MainWindow::on_unpackerDumpHeaderBtn_clicked()
|
void MainWindow::on_unpackerDumpHeaderBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpHeaderBtn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = customSaveFileDialog("NDS Header", "header.bin", "Binary (*.bin)");
|
QString dirPath = customSaveFileDialog("NDS Header", "header.bin", "Binary (*.bin)");
|
||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpHeader(dirPath.toStdString()));
|
notifyExtractionResult(dumpHeader(dirPath.toStdString()));
|
||||||
|
|
||||||
|
ui->unpackerDumpHeaderBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_unpackerDumpArm9Btn_clicked()
|
void MainWindow::on_unpackerDumpArm9Btn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpArm9Btn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = customSaveFileDialog("NDS ARM9", "arm9.bin", "Binary (*.bin)");
|
QString dirPath = customSaveFileDialog("NDS ARM9", "arm9.bin", "Binary (*.bin)");
|
||||||
|
|
||||||
QMessageBox::StandardButton dumpExtraBytes = QMessageBox::question(
|
QMessageBox::StandardButton dumpExtraBytes = QMessageBox::question(
|
||||||
@ -54,82 +60,121 @@ void MainWindow::on_unpackerDumpArm9Btn_clicked()
|
|||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpArm9Bin(dirPath.toStdString(), dumpExtraBytes == QMessageBox::Yes ? true : false));
|
notifyExtractionResult(dumpArm9Bin(dirPath.toStdString(), dumpExtraBytes == QMessageBox::Yes ? true : false));
|
||||||
|
|
||||||
|
ui->unpackerDumpArm9Btn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_unpackerDumpArm7Btn_clicked()
|
void MainWindow::on_unpackerDumpArm7Btn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpArm7Btn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = customSaveFileDialog("NDS ARM7", "arm7.bin", "Binary (*.bin)");
|
QString dirPath = customSaveFileDialog("NDS ARM7", "arm7.bin", "Binary (*.bin)");
|
||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpArm7Bin(dirPath.toStdString()));
|
notifyExtractionResult(dumpArm7Bin(dirPath.toStdString()));
|
||||||
|
|
||||||
|
ui->unpackerDumpArm7Btn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_unpackerDumpFntBtn_clicked()
|
void MainWindow::on_unpackerDumpFntBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpFntBtn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = customSaveFileDialog("NDS FNT", "fnt.bin", "Binary (*.bin)");
|
QString dirPath = customSaveFileDialog("NDS FNT", "fnt.bin", "Binary (*.bin)");
|
||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpFnt(dirPath.toStdString()));
|
notifyExtractionResult(dumpFnt(dirPath.toStdString()));
|
||||||
|
|
||||||
|
ui->unpackerDumpFntBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_unpackerDumpFatBtn_clicked()
|
void MainWindow::on_unpackerDumpFatBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpFatBtn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = customSaveFileDialog("NDS FAT", "fat.bin", "Binary (*.bin)");
|
QString dirPath = customSaveFileDialog("NDS FAT", "fat.bin", "Binary (*.bin)");
|
||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpFat(dirPath.toStdString()));
|
notifyExtractionResult(dumpFat(dirPath.toStdString()));
|
||||||
|
|
||||||
|
ui->unpackerDumpFatBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_unpackerDumpArm9OverlayBtn_clicked()
|
void MainWindow::on_unpackerDumpArm9OverlayBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpArm9OverlayBtn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = customSaveFileDialog("NDS ARM9 Overlay", "a9ovr.bin", "Binary (*.bin)");
|
QString dirPath = customSaveFileDialog("NDS ARM9 Overlay", "a9ovr.bin", "Binary (*.bin)");
|
||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpArm9Overlay(dirPath.toStdString()));
|
notifyExtractionResult(dumpArm9Overlay(dirPath.toStdString()));
|
||||||
|
|
||||||
|
ui->unpackerDumpArm9OverlayBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_unpackerDumpArm7OverlayBtn_clicked()
|
void MainWindow::on_unpackerDumpArm7OverlayBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpArm7OverlayBtn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = customSaveFileDialog("NDS ARM7 Overlay", "a7ovr.bin", "Binary (*.bin)");
|
QString dirPath = customSaveFileDialog("NDS ARM7 Overlay", "a7ovr.bin", "Binary (*.bin)");
|
||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpArm7Overlay(dirPath.toStdString()));
|
notifyExtractionResult(dumpArm7Overlay(dirPath.toStdString()));
|
||||||
|
|
||||||
|
ui->unpackerDumpArm7OverlayBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_unpackerDumpIconTitleLogoBtn_clicked()
|
void MainWindow::on_unpackerDumpIconTitleLogoBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpIconTitleLogoBtn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = customSaveFileDialog("NDS IconTitleLogo", "itl.bin", "Binary (*.bin)");
|
QString dirPath = customSaveFileDialog("NDS IconTitleLogo", "itl.bin", "Binary (*.bin)");
|
||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpIconTitle(dirPath.toStdString()));
|
notifyExtractionResult(dumpIconTitle(dirPath.toStdString()));
|
||||||
|
|
||||||
|
ui->unpackerDumpIconTitleLogoBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_unpackerDumpFatFilesBtn_clicked()
|
void MainWindow::on_unpackerDumpFatFilesBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpFatFilesBtn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = customSaveFileDialog("NDS FAT Files", "fat_data.bin", "Binary (*.bin)");
|
QString dirPath = customSaveFileDialog("NDS FAT Files", "fat_data.bin", "Binary (*.bin)");
|
||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpFatFiles(dirPath.toStdString()));
|
notifyExtractionResult(dumpFatFiles(dirPath.toStdString()));
|
||||||
|
|
||||||
|
ui->unpackerDumpFatFilesBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_unpackerDumpArm9OverlayFilesBtn_clicked()
|
void MainWindow::on_unpackerDumpArm9OverlayFilesBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpArm9OverlayFilesBtn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = customSaveFileDialog("NDS ARM9 Overlay Data", "a9ovr_data.bin", "Binary (*.bin)");
|
QString dirPath = customSaveFileDialog("NDS ARM9 Overlay Data", "a9ovr_data.bin", "Binary (*.bin)");
|
||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpArm9OverlayFiles(dirPath.toStdString()));
|
notifyExtractionResult(dumpArm9OverlayFiles(dirPath.toStdString()));
|
||||||
|
|
||||||
|
ui->unpackerDumpArm9OverlayFilesBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_unpackerDumpArm7OverlayFilesBtn_clicked()
|
void MainWindow::on_unpackerDumpArm7OverlayFilesBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpArm7OverlayFilesBtn->setEnabled(false);
|
||||||
|
|
||||||
QString dirPath = customSaveFileDialog("NDS ARM7 Overlay Data", "a7ovr_data.bin", "Binary (*.bin)");
|
QString dirPath = customSaveFileDialog("NDS ARM7 Overlay Data", "a7ovr_data.bin", "Binary (*.bin)");
|
||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpArm7OverlayFiles(dirPath.toStdString()));
|
notifyExtractionResult(dumpArm7OverlayFiles(dirPath.toStdString()));
|
||||||
|
|
||||||
|
ui->unpackerDumpArm7OverlayFilesBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_unpackerDumpEverythingBtn_clicked()
|
void MainWindow::on_unpackerDumpEverythingBtn_clicked()
|
||||||
{
|
{
|
||||||
|
ui->unpackerDumpEverythingBtn->setEnabled(false);
|
||||||
QString dirPath = QFileDialog::getExistingDirectory(
|
QString dirPath = QFileDialog::getExistingDirectory(
|
||||||
this, tr("Select Directory"),
|
this, tr("Select Directory"),
|
||||||
"",
|
"",
|
||||||
@ -137,4 +182,5 @@ void MainWindow::on_unpackerDumpEverythingBtn_clicked()
|
|||||||
|
|
||||||
if (!dirPath.isNull())
|
if (!dirPath.isNull())
|
||||||
notifyExtractionResult(dumpEverything(dirPath));
|
notifyExtractionResult(dumpEverything(dirPath));
|
||||||
|
ui->unpackerDumpEverythingBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
QString customSaveFileDialog(const QString& title, const QString& defaultName, const QString& filter)
|
inline QString customSaveFileDialog(const QString& title, const QString& defaultName, const QString& filter)
|
||||||
{
|
{
|
||||||
|
|
||||||
static QString lastUsedPath;
|
static QString lastUsedPath;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user