forked from Luca1991/NDSFactory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackertabsignals.cpp
190 lines (162 loc) · 4.75 KB
/
packertabsignals.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#include <QFileDialog>
#include <QMessageBox>
#include "mainwindow.h"
#include "ui_mainwindow.h"
void MainWindow::on_packerLoadHeaderBtn_clicked()
{
std::vector<char> romHeader;
NDSHeader *pNDSHeader;
QString headerPath = QFileDialog::getOpenFileName(
Q_NULLPTR,
"NDS Header",
QDir::currentPath(),
"NDS Header (*.bin)");
if(headerPath.isNull())
{
QMessageBox::critical(this, tr("NDS Factory"), tr("Unable to open file!"));
return;
}
if (ndsFactory.loadRomHeader(headerPath.toStdString(), romHeader))
{
pNDSHeader = reinterpret_cast<NDSHeader*>(romHeader.data());
populatePackerSectionHeader(pNDSHeader);
}
}
void MainWindow::on_packerLoadArm9BinBtn_clicked()
{
QString arm9BinPath = QFileDialog::getOpenFileName(
Q_NULLPTR,
"NDS Arm9Bin",
QDir::currentPath(),
"NDS Arm9Bin (*.bin)");
if(!arm9BinPath.isNull())
{
ui->loadedArm9BinPathEdt->setText(arm9BinPath.toUtf8());
}
}
void MainWindow::on_packerLoadArm7BinBtn_clicked()
{
QString arm7BinPath = QFileDialog::getOpenFileName(
Q_NULLPTR,
"NDS Arm7Bin",
QDir::currentPath(),
"NDS Arm7Bin (*.bin)");
if(!arm7BinPath.isNull())
{
ui->loadedArm7BinPathEdt->setText(arm7BinPath.toUtf8());
}
}
void MainWindow::on_packerLoadFntBtn_clicked()
{
QString fntPath = QFileDialog::getOpenFileName(
Q_NULLPTR,
"NDS Fnt",
QDir::currentPath(),
"NDS Fnt (*.bin)");
if(!fntPath.isNull())
{
ui->loadedFntPathEdt->setText(fntPath.toUtf8());
}
}
void MainWindow::on_packerLoadFatBtn_clicked()
{
QString fatPath = QFileDialog::getOpenFileName(
Q_NULLPTR,
"NDS Fat",
QDir::currentPath(),
"NDS Fat (*.bin)");
if(!fatPath.isNull())
{
ui->loadedFatPathEdt->setText(fatPath.toUtf8());
}
}
void MainWindow::on_packerLoadArm9OverlayBtn_clicked()
{
QString arm9OverlayPath = QFileDialog::getOpenFileName(
Q_NULLPTR,
"NDS Arm9Overlay",
QDir::currentPath(),
"NDS A9OVR (*.bin)");
if( !arm9OverlayPath.isNull() )
{
ui->loadedArm9OverlayPathEdt->setText(arm9OverlayPath.toUtf8());
}
}
void MainWindow::on_packerLoadArm9OverlayFilesBtn_clicked()
{
QString arm9OverlayFilesPath = QFileDialog::getOpenFileName(
Q_NULLPTR,
"NDS Arm9Overlay Data",
QDir::currentPath(),
"NDS A9OVR_DATA (*.bin)");
if(!arm9OverlayFilesPath.isNull())
{
ui->loadedArm9OverlayFilesPathEdt->setText(arm9OverlayFilesPath.toUtf8());
}
}
void MainWindow::on_packerLoadArm7OverlayBtn_clicked()
{
QString arm7OverlayPath = QFileDialog::getOpenFileName(
Q_NULLPTR,
"NDS Arm7Overlay",
QDir::currentPath(),
"NDS A7OVR (*.bin)");
if(!arm7OverlayPath.isNull())
{
ui->loadedArm7OverlayPathEdt->setText(arm7OverlayPath.toUtf8());
}
}
void MainWindow::on_packerLoadArm7OverlayFilesBtn_clicked()
{
QString arm7OverlayFilesPath = QFileDialog::getOpenFileName(
Q_NULLPTR,
"NDS Arm7Overlay Data",
QDir::currentPath(),
"NDS A7OVR_DATA (*.bin)");
if(!arm7OverlayFilesPath.isNull())
{
ui->loadedArm7OverlayFilesPathEdt->setText(arm7OverlayFilesPath.toUtf8());
}
}
void MainWindow::on_packerLoadIconTitleBtn_clicked()
{
QString iconTitlePath = QFileDialog::getOpenFileName(
Q_NULLPTR,
"NDS IconTitleLogo",
QDir::currentPath(),
"NDS ITL (*.bin)");
if(!iconTitlePath.isNull())
{
ui->loadedIconTitlePathEdt->setText(iconTitlePath.toUtf8());
}
}
void MainWindow::on_packerLoadFatFilesBtn_clicked()
{
QString fatFilesPath = QFileDialog::getOpenFileName(
Q_NULLPTR,
"NDS Fat Data",
QDir::currentPath(),
"NDS FAT_DATA (*.bin)");
if(!fatFilesPath.isNull())
{
ui->loadedFatFilesPathEdt->setText(fatFilesPath.toUtf8());
ui->packerFatFilesAddrEdt->setText(QString::number((ui->packerIconTitleEdt->text().toUInt(nullptr, 16) + IconTitleSize), 16));
}
}
void MainWindow::on_packerBuildNDSRomBtn_clicked()
{
QString dirPath = QFileDialog::getSaveFileName(
Q_NULLPTR,
"NDS Rom",
"rom.nds",
"NDS ROM (*.nds)");
if (!dirPath.isNull())
{
writeEverything(dirPath.toStdString()) ? QMessageBox::information(this, tr("NDS Factory"), tr("Creation completed!"))
: QMessageBox::critical(this, tr("NDS Factory"), tr("Error during the creation!"));
}
}
void MainWindow::on_packerCalcHeaderCrcBtn_clicked()
{
calcHeaderCrc16();
}