mirror of
https://github.com/Luca1991/NDSFactory.git
synced 2026-02-05 06:06:15 +01:00
v1.1 (#16)
This commit is contained in:
7
ui/tabs/fattools/fattoolstabfunctions.cpp
Normal file
7
ui/tabs/fattools/fattoolstabfunctions.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "./../../mainwindow.h"
|
||||
|
||||
|
||||
bool MainWindow::patchFat(const std::string& loadPath, uint32_t shiftSize, const std::string& savePath)
|
||||
{
|
||||
return ndsFactory.patchFat(loadPath, shiftSize, savePath);
|
||||
}
|
||||
49
ui/tabs/fattools/fattoolstabsignals.cpp
Normal file
49
ui/tabs/fattools/fattoolstabsignals.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include "./../../mainwindow.h"
|
||||
#include "./../../ui_mainwindow.h"
|
||||
|
||||
|
||||
void MainWindow::on_fatPatcherLoadFatBtn_clicked()
|
||||
{
|
||||
QString fatPath = QFileDialog::getOpenFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS Fat",
|
||||
QDir::currentPath(),
|
||||
"NDS Fat (*.bin)");
|
||||
|
||||
if( !fatPath.isNull() )
|
||||
{
|
||||
ui->fatPatcherFatPathEdt->setText(fatPath.toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_fatPatcherPatchFatBtn_clicked()
|
||||
{
|
||||
uint32_t positionDiff = 0;
|
||||
uint32_t originalPos = ui->fatPatcherOriginalFatFilesAddrEdt->text().toUInt(nullptr, 16);
|
||||
uint32_t newPos = ui->fatPatcherNewFatFilesAddrEdt->text().toUInt(nullptr, 16);
|
||||
|
||||
QString dirPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
"NDS FAT",
|
||||
"fat.bin",
|
||||
"Binary (*.bin)");
|
||||
|
||||
if(dirPath.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (originalPos < newPos)
|
||||
{
|
||||
positionDiff = newPos-originalPos;
|
||||
} else {
|
||||
positionDiff = originalPos-newPos;
|
||||
}
|
||||
|
||||
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!"));
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user