This commit is contained in:
Luca D'Amico
2024-08-04 20:09:19 +02:00
committed by GitHub
parent ec81e2bfbe
commit aa2ed50ade
21 changed files with 720 additions and 252 deletions

View File

@@ -7,33 +7,33 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<height>179</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>About</string>
</property>
<widget class="QDialogButtonBox" name="aboutCloseBtnBx">
<property name="geometry">
<rect>
<x>300</x>
<y>260</y>
<y>140</y>
<width>81</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
<widget class="QLabel" name="aboutSoftwareNameLbl">
<property name="geometry">
<rect>
<x>10</x>
<y>140</y>
<y>20</y>
<width>381</width>
<height>31</height>
</rect>
@@ -42,33 +42,33 @@
<bool>false</bool>
</property>
<property name="text">
<string>NDS Factory V1.0</string>
<string>NDS Factory V1.1</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="aboutSoftwareAuthorLbl">
<property name="geometry">
<rect>
<x>10</x>
<y>190</y>
<y>70</y>
<width>381</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>(C) 2019-2021 - Luca D'Amico</string>
<string>(C) 2019-2024 - Luca D'Amico</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="aboutSpecialThanks">
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
<y>90</y>
<width>381</width>
<height>20</height>
</rect>
@@ -77,14 +77,14 @@
<string>Special Thanks To:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="aboutSpecialThanks2ndLine">
<property name="geometry">
<rect>
<x>10</x>
<y>230</y>
<y>110</y>
<width>381</width>
<height>20</height>
</rect>
@@ -93,14 +93,14 @@
<string>Dax89 (Davide Trogu) &amp; Kaneb (Antonio Barba)</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="aboutSoftwareBuildLbl">
<property name="geometry">
<rect>
<x>10</x>
<y>170</y>
<y>50</y>
<width>381</width>
<height>20</height>
</rect>
@@ -109,7 +109,7 @@
<string>Build Info</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</widget>

View File

@@ -1,6 +1,6 @@
#ifndef REVISION_H
#define REVISION_H
#define GIT_COMMIT_HASH "30425b6"
#define GIT_COMMIT_HASH "c7eaa8e"
#endif

View File

@@ -33,6 +33,7 @@ private slots:
void on_unpackerDumpArm7OverlayFilesBtn_clicked();
void on_unpackerDumpEverythingBtn_clicked();
void on_unpackerDecodeFatFilesBtn_clicked();
void notifyExtractionResult(bool result);
void on_actionExit_triggered();
void on_actionAbout_triggered();
@@ -50,9 +51,9 @@ private slots:
void on_packerLoadFatFilesBtn_clicked();
void on_packerBuildNDSRomBtn_clicked();
void on_fatPatchingLoadFatBtn_clicked();
void on_fatPatcherLoadFatBtn_clicked();
void on_fatPatchingPatchFatBtn_clicked();
void on_fatPatcherPatchFatBtn_clicked();
void on_packerCalcHeaderCrcBtn_clicked();

View File

@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>NDS Factory</string>
<string>NDSFactory</string>
</property>
<widget class="QWidget" name="centralWidget">
<property name="sizePolicy">
@@ -28,10 +28,13 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinAndMaxSize</enum>
<enum>QLayout::SizeConstraint::SetMinAndMaxSize</enum>
</property>
<item>
<widget class="QTabWidget" name="mainTab">
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="currentIndex">
<number>0</number>
</property>
@@ -50,7 +53,7 @@
<number>4</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
<enum>QLayout::SizeConstraint::SetMinimumSize</enum>
</property>
<property name="leftMargin">
<number>1</number>
@@ -93,10 +96,10 @@
<item>
<widget class="QTableView" name="unpackerHeaderDataTable">
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
<enum>QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
</property>
<property name="wordWrap">
<bool>false</bool>
@@ -124,7 +127,7 @@
<bool>false</bool>
</property>
<property name="title">
<string>Extractor</string>
<string>Single Binary Extractor</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
@@ -261,7 +264,7 @@
<bool>false</bool>
</property>
<property name="title">
<string>Extra</string>
<string>AIO</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
@@ -300,17 +303,17 @@
<item>
<widget class="QTableView" name="packerHeaderDataTable">
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
<enum>QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_33">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
<enum>QLayout::SizeConstraint::SetMinimumSize</enum>
</property>
<property name="leftMargin">
<number>0</number>
@@ -327,7 +330,7 @@
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -356,7 +359,7 @@
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
<enum>Qt::LayoutDirection::LeftToRight</enum>
</property>
<property name="text">
<string>Import Header From File</string>
@@ -500,7 +503,7 @@
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
<enum>Qt::LayoutDirection::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
@@ -509,13 +512,13 @@
<string>Builder</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_32">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QRadioButton" name="packerPadType00RdBtn">
@@ -559,7 +562,7 @@
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
<enum>Qt::LayoutDirection::LeftToRight</enum>
</property>
<property name="text">
<string>Generate Trimmed Rom</string>
@@ -590,9 +593,9 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="fatPatchingTab">
<widget class="QWidget" name="fatToolsTab">
<attribute name="title">
<string>Fat Patching</string>
<string>Fat Tools</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
@@ -601,27 +604,8 @@
<number>4</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label_83">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>If you FAT Files Address (fat_data.bin) is different from the original ROM position, you have to patch the FAT (fat.bin)...</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -632,6 +616,25 @@
<string>FAT Patcher</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_15">
<item>
<widget class="QLabel" name="label_83">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>If the address of the fat_data.bin file is different from the original location in ROM, you need to patch the fat.bin file...</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_35">
<property name="leftMargin">
@@ -647,10 +650,10 @@
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="fatPatchingFatPathEdt"/>
<widget class="QLineEdit" name="fatPatcherFatPathEdt"/>
</item>
<item>
<widget class="QPushButton" name="fatPatchingLoadFatBtn">
<widget class="QPushButton" name="fatPatcherLoadFatBtn">
<property name="text">
<string>Load FAT (fat.bin)</string>
</property>
@@ -680,7 +683,7 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="fatPatchingOriginalFatFilesAddrEdt"/>
<widget class="QLineEdit" name="fatPatcherOriginalFatFilesAddrEdt"/>
</item>
<item>
<widget class="QLabel" name="label_85">
@@ -690,7 +693,7 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="fatPatchingNewFatFilesAddrEdt"/>
<widget class="QLineEdit" name="fatPatcherNewFatFilesAddrEdt"/>
</item>
</layout>
</item>
@@ -709,7 +712,7 @@
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="fatPatchingPatchFatBtn">
<widget class="QPushButton" name="fatPatcherPatchFatBtn">
<property name="text">
<string>Apply Patch!</string>
</property>
@@ -725,7 +728,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -750,7 +753,7 @@
<x>0</x>
<y>0</y>
<width>770</width>
<height>22</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">

View File

@@ -9,12 +9,12 @@ NDSHeaderModel::NDSHeaderModel(NDSHeader *ndsHeader, QObject *parent) : QAbstrac
this->ndsHeader = ndsHeader;
}
int NDSHeaderModel::rowCount(const QModelIndex &parent) const
int NDSHeaderModel::rowCount([[maybe_unused]] const QModelIndex &parent) const
{
return static_cast<int>(ndsHeaderNamesArr.size());
}
int NDSHeaderModel::columnCount(const QModelIndex &parent) const
int NDSHeaderModel::columnCount([[maybe_unused]] const QModelIndex &parent) const
{
return 2;
}

View File

@@ -4,7 +4,7 @@
#include "./../../ui_mainwindow.h"
void MainWindow::on_fatPatchingLoadFatBtn_clicked()
void MainWindow::on_fatPatcherLoadFatBtn_clicked()
{
QString fatPath = QFileDialog::getOpenFileName(
Q_NULLPTR,
@@ -14,15 +14,15 @@ void MainWindow::on_fatPatchingLoadFatBtn_clicked()
if( !fatPath.isNull() )
{
ui->fatPatchingFatPathEdt->setText(fatPath.toUtf8());
ui->fatPatcherFatPathEdt->setText(fatPath.toUtf8());
}
}
void MainWindow::on_fatPatchingPatchFatBtn_clicked()
void MainWindow::on_fatPatcherPatchFatBtn_clicked()
{
uint32_t positionDiff = 0;
uint32_t originalPos = ui->fatPatchingOriginalFatFilesAddrEdt->text().toUInt(nullptr, 16);
uint32_t newPos = ui->fatPatchingNewFatFilesAddrEdt->text().toUInt(nullptr, 16);
uint32_t originalPos = ui->fatPatcherOriginalFatFilesAddrEdt->text().toUInt(nullptr, 16);
uint32_t newPos = ui->fatPatcherNewFatFilesAddrEdt->text().toUInt(nullptr, 16);
QString dirPath = QFileDialog::getSaveFileName(
Q_NULLPTR,
@@ -42,7 +42,7 @@ void MainWindow::on_fatPatchingPatchFatBtn_clicked()
positionDiff = originalPos-newPos;
}
patchFat(ui->fatPatchingFatPathEdt->text().toStdString(), positionDiff, dirPath.toStdString())
patchFat(ui->fatPatcherFatPathEdt->text().toStdString(), positionDiff, dirPath.toStdString())
? QMessageBox::information(this, tr("NDS Factory"), tr("FAT patching completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error patching FAT!"));

View File

@@ -94,23 +94,23 @@ void MainWindow::generateHeader(NDSHeader* pRomHeader)
bool MainWindow::writeHeader(const std::string& savePath)
{
std::vector<char> romHeader(sizeof(NDSHeader));
NDSHeader* pRomHeader = reinterpret_cast<NDSHeader*>(romHeader.data());
std::vector<char> romHeaderBuffer(sizeof(NDSHeader));
NDSHeader* pRomHeader = reinterpret_cast<NDSHeader*>(romHeaderBuffer.data());
generateHeader(pRomHeader);
return ndsFactory.writeBytesToFile(romHeader, savePath, 0, sizeof(NDSHeader));;
return ndsFactory.writeBytesToFile(romHeaderBuffer, savePath, 0, sizeof(NDSHeader));;
}
void MainWindow::calcHeaderCrc16()
{
std::vector<char> romHeader(sizeof(NDSHeader));
NDSHeader* pRomHeader = reinterpret_cast<NDSHeader*>(romHeader.data());
std::vector<char> romHeaderBuffer(sizeof(NDSHeader));
NDSHeader* pRomHeader = reinterpret_cast<NDSHeader*>(romHeaderBuffer.data());
generateHeader(pRomHeader);
QModelIndex headerCrcIndex = ui->packerHeaderDataTable->model()->index(NDSHeaderNames::HeaderCRC, 1);
ui->packerHeaderDataTable->model()->setData(headerCrcIndex, QString::number(ndsFactory.calcHeaderCrc16(romHeader), 16), Qt::EditRole);
ui->packerHeaderDataTable->model()->setData(headerCrcIndex, QString::number(ndsFactory.calcHeaderCrc16(romHeaderBuffer), 16), Qt::EditRole);
}
bool MainWindow::writeArm9Bin(const std::string& savePath, bool isArm9FooterPresent)
@@ -161,7 +161,7 @@ bool MainWindow::writeArm9Overlay(const std::string& savePath)
extractPackerHeaderTableData(NDSHeaderNames::ARM9OverlaySize).toUInt(nullptr, 16));
}
bool MainWindow::writeArm9OverlayFiles(const std::string& savePath)
bool MainWindow::writeArm9OverlayFiles([[maybe_unused]] const std::string& savePath)
{
return false; // TODO: implement me!
}
@@ -175,7 +175,7 @@ bool MainWindow::writeArm7Overlay(const std::string& savePath)
extractPackerHeaderTableData(NDSHeaderNames::ARM9OverlaySize).toUInt(nullptr, 16));
}
bool MainWindow::writeArm7OverlayFiles(const std::string& savePath)
bool MainWindow::writeArm7OverlayFiles([[maybe_unused]] const std::string& savePath)
{
return false; // TODO: implement me!
}
@@ -268,23 +268,23 @@ bool MainWindow::writeFatPadding(char paddingType, const std::string& savePath)
size);
}
bool MainWindow::writeArm9OverlayPadding(char paddingType, const std::string& savePath)
bool MainWindow::writeArm9OverlayPadding([[maybe_unused]] char paddingType, [[maybe_unused]] const std::string& savePath)
{ // FIXME TODO
return true;
}
bool MainWindow::writeArm9OverlayFilesPadding(char paddingType, const std::string& savePath)
bool MainWindow::writeArm9OverlayFilesPadding([[maybe_unused]] char paddingType, [[maybe_unused]] const std::string& savePath)
{ // FIXME TODO
return true;
}
bool MainWindow::writeArm7OverlayPadding(char paddingType, const std::string& savePath)
bool MainWindow::writeArm7OverlayPadding([[maybe_unused]] char paddingType, [[maybe_unused]] const std::string& savePath)
{ // FIXME TODO
return true;
}
bool MainWindow::writeArm7OverlayFilesPadding(char paddingType, const std::string& savePath)
bool MainWindow::writeArm7OverlayFilesPadding([[maybe_unused]] char paddingType, [[maybe_unused]] const std::string& savePath)
{ // FIXME TODO
return true;
}

View File

@@ -9,19 +9,20 @@
#include "../../../ndsfactory/fatstruct.h"
// Byte offsets for interpreting memory
#define SECOND_BYTE_SHIFT 8
#define THIRD_BYTE_SHIFT 16
#define FOURTH_BYTE_SHIFT 24
// Magic values for FAT extraction
#define CONTROL_BYTE_LENGTH_MASK 0x7F
#define CONTROL_BYTE_DIR_MASK 0x80
#define DUMMY_CONTROL_VALUE 0xFF
#define FNT_HEADER_OFFSET_MASK 0XFFF
#define ROOT_DIRECTORY_ADDRESS 0xF000
// Size constants
#define ICON_TITLE_SIZE 0xA00
void MainWindow::populateHeader(NDSHeader* ndsHeader)
{
auto* headerDataModel = new NDSHeaderModel(ndsHeader);
@@ -107,7 +108,7 @@ bool MainWindow::dumpArm9Overlay(const std::string& dirPath)
ui->unpackerHeaderDataTable->model()->index(NDSHeaderNames::ARM9OverlaySize, 1).data().toString().toUInt(nullptr,16));
}
bool MainWindow::dumpArm9OverlayFiles(const std::string& dirPath)
bool MainWindow::dumpArm9OverlayFiles([[maybe_unused]] const std::string& dirPath)
{
return false; // TODO: implement me!
}
@@ -121,7 +122,7 @@ bool MainWindow::dumpArm7Overlay(const std::string& dirPath)
ui->unpackerHeaderDataTable->model()->index(NDSHeaderNames::ARM7OverlaySize, 1).data().toString().toUInt(nullptr,16));
}
bool MainWindow::dumpArm7OverlayFiles(const std::string& dirPath)
bool MainWindow::dumpArm7OverlayFiles([[maybe_unused]] const std::string& dirPath)
{
return false; // TODO: implement me!
}
@@ -132,7 +133,7 @@ bool MainWindow::dumpIconTitle(const std::string& dirPath)
ui->loadedRomPath->text().toStdString(),
dirPath,
ui->unpackerHeaderDataTable->model()->index(NDSHeaderNames::IconTitleAddress, 1).data().toString().toUInt(nullptr,16),
0xA00);
ICON_TITLE_SIZE);
}
bool MainWindow::dumpFatFiles(const std::string& dirPath)
@@ -150,34 +151,23 @@ bool MainWindow::dumpFatFiles(const std::string& dirPath)
bool MainWindow::dumpEverything(QString dirPath)
{
if(!dumpHeader(QDir::toNativeSeparators(dirPath+"/header.bin").toStdString()))
return false;
if(!dumpArm9Bin(QDir::toNativeSeparators(dirPath+"/arm9.bin").toStdString(), true))
return false;
if(!dumpArm7Bin(QDir::toNativeSeparators(dirPath+"/arm7.bin").toStdString()))
return false;
if(!dumpFnt(QDir::toNativeSeparators(dirPath+"/fnt.bin").toStdString()))
return false;
if(!dumpFat(QDir::toNativeSeparators(dirPath+"/fat.bin").toStdString()))
return false;
bool result = true;
result &= dumpHeader(QDir::toNativeSeparators(dirPath+"/header.bin").toStdString());
result &= dumpArm9Bin(QDir::toNativeSeparators(dirPath+"/arm9.bin").toStdString(), true);
result &= dumpArm7Bin(QDir::toNativeSeparators(dirPath+"/arm7.bin").toStdString());
result &= dumpFnt(QDir::toNativeSeparators(dirPath+"/fnt.bin").toStdString());
result &= dumpFat(QDir::toNativeSeparators(dirPath+"/fat.bin").toStdString());
if(ui->unpackerHeaderDataTable->model()->index(NDSHeaderNames::ARM9OverlayAddress, 1).data().toString().toUInt(nullptr,16) != 0) {
if(!dumpArm9Overlay(QDir::toNativeSeparators(dirPath+"/a9ovr.bin").toStdString()))
return false;
if(!dumpArm9OverlayFiles(QDir::toNativeSeparators(dirPath+"/a9ovr_data.bin").toStdString()))
return false;
}
result &= dumpArm9Overlay(QDir::toNativeSeparators(dirPath+"/a9ovr.bin").toStdString());
result &= dumpArm9OverlayFiles(QDir::toNativeSeparators(dirPath+"/a9ovr_data.bin").toStdString());
}
if(ui->unpackerHeaderDataTable->model()->index(NDSHeaderNames::ARM7OverlayAddress, 1).data().toString().toUInt(nullptr,16) != 0) {
if(!dumpArm7Overlay(QDir::toNativeSeparators(dirPath+"/a7ovr.bin").toStdString()))
return false;
if(!dumpArm7OverlayFiles(QDir::toNativeSeparators(dirPath+"/a7ovr_data.bin").toStdString()))
return false;
}
if(!dumpIconTitle(QDir::toNativeSeparators(dirPath+"/itl.bin").toStdString()))
return false;
if(!dumpFatFiles(QDir::toNativeSeparators(dirPath+"/fat_data.bin").toStdString()))
return false;
return true;
result &= dumpArm7Overlay(QDir::toNativeSeparators(dirPath+"/a7ovr.bin").toStdString());
result &= dumpArm7OverlayFiles(QDir::toNativeSeparators(dirPath+"/a7ovr_data.bin").toStdString());
}
result &= dumpIconTitle(QDir::toNativeSeparators(dirPath+"/itl.bin").toStdString());
result &= dumpFatFiles(QDir::toNativeSeparators(dirPath+"/fat_data.bin").toStdString());
return result;
}
bool MainWindow::decodeFatFiles(QString dirPath)

View File

@@ -41,10 +41,7 @@ void MainWindow::on_unpackerDumpHeaderBtn_clicked()
"Binary (*.bin)");
if (!dirPath.isNull())
{
dumpHeader(dirPath.toStdString()) ? QMessageBox::information(this, tr("NDS Factory"), tr("Extraction completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the extraction!"));
}
notifyExtractionResult(dumpHeader(dirPath.toStdString()));
}
void MainWindow::on_unpackerDumpArm9Btn_clicked()
@@ -62,11 +59,7 @@ void MainWindow::on_unpackerDumpArm9Btn_clicked()
QMessageBox::Yes|QMessageBox::No);
if (!dirPath.isNull())
{
dumpArm9Bin(dirPath.toStdString(), dumpExtraBytes == QMessageBox::Yes ? true : false)
? QMessageBox::information(this, tr("NDS Factory"), tr("Extraction completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the extraction!"));
}
notifyExtractionResult(dumpArm9Bin(dirPath.toStdString(), dumpExtraBytes == QMessageBox::Yes ? true : false));
}
void MainWindow::on_unpackerDumpArm7Btn_clicked()
@@ -78,10 +71,7 @@ void MainWindow::on_unpackerDumpArm7Btn_clicked()
"Binary (*.bin)");
if (!dirPath.isNull())
{
dumpArm7Bin(dirPath.toStdString()) ? QMessageBox::information(this, tr("NDS Factory"), tr("Extraction completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the extraction!"));
}
notifyExtractionResult(dumpArm7Bin(dirPath.toStdString()));
}
void MainWindow::on_unpackerDumpFntBtn_clicked()
@@ -93,10 +83,7 @@ void MainWindow::on_unpackerDumpFntBtn_clicked()
"Binary (*.bin)");
if (!dirPath.isNull())
{
dumpFnt(dirPath.toStdString()) ? QMessageBox::information(this, tr("NDS Factory"), tr("Extraction completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the extraction!"));
}
notifyExtractionResult(dumpFnt(dirPath.toStdString()));
}
void MainWindow::on_unpackerDumpFatBtn_clicked()
@@ -108,10 +95,7 @@ void MainWindow::on_unpackerDumpFatBtn_clicked()
"Binary (*.bin)");
if (!dirPath.isNull())
{
dumpFat(dirPath.toStdString()) ? QMessageBox::information(this, tr("NDS Factory"), tr("Extraction completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the extraction!"));
}
notifyExtractionResult(dumpFat(dirPath.toStdString()));
}
void MainWindow::on_unpackerDumpArm9OverlayBtn_clicked()
@@ -123,10 +107,7 @@ void MainWindow::on_unpackerDumpArm9OverlayBtn_clicked()
"Binary (*.bin)");
if (!dirPath.isNull())
{
dumpArm9Overlay(dirPath.toStdString()) ? QMessageBox::information(this, tr("NDS Factory"), tr("Extraction completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the extraction!"));
}
notifyExtractionResult(dumpArm9Overlay(dirPath.toStdString()));
}
void MainWindow::on_unpackerDumpArm7OverlayBtn_clicked()
@@ -138,10 +119,7 @@ void MainWindow::on_unpackerDumpArm7OverlayBtn_clicked()
"Binary (*.bin)");
if (!dirPath.isNull())
{
dumpArm7Overlay(dirPath.toStdString()) ? QMessageBox::information(this, tr("NDS Factory"), tr("Extraction completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the extraction!"));
}
notifyExtractionResult(dumpArm7Overlay(dirPath.toStdString()));
}
void MainWindow::on_unpackerDumpIconTitleLogoBtn_clicked()
@@ -153,10 +131,7 @@ void MainWindow::on_unpackerDumpIconTitleLogoBtn_clicked()
"Binary (*.bin)");
if (!dirPath.isNull())
{
dumpIconTitle(dirPath.toStdString()) ? QMessageBox::information(this, tr("NDS Factory"), tr("Extraction completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the extraction!"));
}
notifyExtractionResult(dumpIconTitle(dirPath.toStdString()));
}
void MainWindow::on_unpackerDumpFatFilesBtn_clicked()
@@ -168,10 +143,7 @@ void MainWindow::on_unpackerDumpFatFilesBtn_clicked()
"Binary (*.bin)");
if (!dirPath.isNull())
{
dumpFatFiles(dirPath.toStdString()) ? QMessageBox::information(this, tr("NDS Factory"), tr("Extraction completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the extraction!"));
}
notifyExtractionResult(dumpFatFiles(dirPath.toStdString()));
}
void MainWindow::on_unpackerDumpArm9OverlayFilesBtn_clicked()
@@ -194,10 +166,7 @@ void MainWindow::on_unpackerDumpEverythingBtn_clicked()
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
if (!dirPath.isNull())
{
dumpEverything(dirPath) ? QMessageBox::information(this, tr("NDS Factory"), tr("Extraction completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the extraction!"));
}
notifyExtractionResult(dumpEverything(dirPath));
}
void MainWindow::on_unpackerDecodeFatFilesBtn_clicked()
@@ -208,8 +177,17 @@ void MainWindow::on_unpackerDecodeFatFilesBtn_clicked()
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
if (!dirPath.isNull())
{
decodeFatFiles(dirPath) ? QMessageBox::information(this, tr("NDS Factory"), tr("FAT files successfully decoded!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during FAT file decoding!"));
}
notifyExtractionResult(decodeFatFiles(dirPath));
}
void MainWindow::notifyExtractionResult(bool result)
{
if(result)
{
QMessageBox::information(this, tr("NDS Factory"), tr("Extraction completed!"));
}
else
{
QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the extraction!"));
}
}