Overhaul UI to enable Unlocked Jobs more widely.
parent
1393dd7ba6
commit
b984fe5ad4
107
src/exdeath.cc
107
src/exdeath.cc
|
@ -25,7 +25,10 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
#include "exdeath.hh"
|
#include "exdeath.hh"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
@ -40,16 +43,19 @@ Exdeath::Exdeath(QSettings *cfg, QWidget *parent) : QWidget(parent) {
|
||||||
layApp = new QVBoxLayout(this);
|
layApp = new QVBoxLayout(this);
|
||||||
layColumns = new QHBoxLayout(this);
|
layColumns = new QHBoxLayout(this);
|
||||||
layApp->addLayout(layColumns);
|
layApp->addLayout(layColumns);
|
||||||
layColumn2 = new QVBoxLayout(this);
|
layLeft = new QVBoxLayout(this);
|
||||||
|
layRight = new QVBoxLayout(this);
|
||||||
|
layColumns->addLayout(layLeft);
|
||||||
|
layColumns->addLayout(layRight);
|
||||||
|
|
||||||
initMain();
|
initMain();
|
||||||
|
initRandom();
|
||||||
initInnates();
|
initInnates();
|
||||||
initMulti();
|
initMulti();
|
||||||
layColumns->addLayout(layColumn2);
|
|
||||||
|
|
||||||
initConfig();
|
initConfig();
|
||||||
|
|
||||||
connect(btnROM, &QPushButton::clicked, this, &Exdeath::btnROM_clicked);
|
connect(btnROM, &QPushButton::clicked, this, &Exdeath::btnROM_clicked);
|
||||||
|
connect(selMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &Exdeath::selMode_index);
|
||||||
connect(btnApply, &QPushButton::clicked, this, &Exdeath::btnApply_clicked);
|
connect(btnApply, &QPushButton::clicked, this, &Exdeath::btnApply_clicked);
|
||||||
connect(btnSave, &QPushButton::clicked, this, &Exdeath::btnSave_clicked);
|
connect(btnSave, &QPushButton::clicked, this, &Exdeath::btnSave_clicked);
|
||||||
}
|
}
|
||||||
|
@ -58,39 +64,58 @@ Exdeath::~Exdeath() {}
|
||||||
|
|
||||||
void Exdeath::initMain(void) {
|
void Exdeath::initMain(void) {
|
||||||
layMain = new QGridLayout(this);
|
layMain = new QGridLayout(this);
|
||||||
layMode = new QVBoxLayout(this);
|
|
||||||
grpMain = new QGroupBox("Main");
|
grpMain = new QGroupBox("Main");
|
||||||
grpMain->setLayout(layMain);
|
grpMain->setLayout(layMain);
|
||||||
layColumns->addWidget(grpMain);
|
layLeft->addWidget(grpMain);
|
||||||
|
|
||||||
|
txtROM = new QLabel("ROM:");
|
||||||
|
btnROM = new QPushButton("Select ROM");
|
||||||
|
|
||||||
|
txtMode = new QLabel("Mode:");
|
||||||
|
selMode = new QComboBox();
|
||||||
|
selMode->addItem("Base");
|
||||||
|
selMode->addItem("Waddler Rebalance", "waddle.ips");
|
||||||
|
selMode->addItem("Balance", "balance.ips");
|
||||||
|
selMode->addItem("Custom Classes", "custom_classes.ips");
|
||||||
|
|
||||||
|
txtUnlock = new QLabel("Unlock Jobs:");
|
||||||
|
chkUnlock = new QCheckBox("Yes");
|
||||||
|
|
||||||
txtROM = new QLabel("ROM:");
|
|
||||||
txtMode = new QLabel("Mode:");
|
|
||||||
txtPortraits = new QLabel("FFT-style Portraits:");
|
txtPortraits = new QLabel("FFT-style Portraits:");
|
||||||
|
chkPortraits = new QCheckBox("Yes");
|
||||||
|
|
||||||
txtSound = new QLabel("Sound Restoration:");
|
txtSound = new QLabel("Sound Restoration:");
|
||||||
txtSound->setToolTip("Requires GBA BIOS if using VisualBoyAdvance");
|
txtSound->setToolTip("Requires GBA BIOS if using VisualBoyAdvance");
|
||||||
txtSeed = new QLabel("Seed:");
|
chkSound = new QCheckBox("Yes");
|
||||||
txtNED = new QLabel("Neo ExDeath:");
|
|
||||||
|
|
||||||
btnROM = new QPushButton("Select ROM");
|
|
||||||
btnApply = new QPushButton("Apply");
|
btnApply = new QPushButton("Apply");
|
||||||
layApp->addWidget(btnApply);
|
layApp->addWidget(btnApply);
|
||||||
btnSave = new QPushButton("Save Config");
|
btnSave = new QPushButton("Save Config");
|
||||||
|
|
||||||
selMode = new QComboBox();
|
layMain->addWidget(txtROM, 0, 0);
|
||||||
selMode->addItem("Base");
|
layMain->addWidget(btnROM, 0, 1);
|
||||||
selMode->addItem("Randomizer", "rando/fixmagic.ips");
|
layMain->addWidget(txtMode, 1, 0);
|
||||||
selMode->addItem("Unlocked Jobs", "unlock.ips");
|
layMain->addWidget(selMode, 1, 1);
|
||||||
selMode->addItem("Balance", "balance.ips");
|
layMain->addWidget(txtUnlock, 2, 0);
|
||||||
selMode->addItem("Custom Classes", "custom_classes.ips");
|
layMain->addWidget(chkUnlock, 2, 1);
|
||||||
selMode->addItem("Waddler Rebalance", "waddle.ips");
|
layMain->addWidget(txtPortraits, 3, 0);
|
||||||
|
layMain->addWidget(chkPortraits, 3, 1);
|
||||||
|
layMain->addWidget(txtSound, 4, 0);
|
||||||
|
layMain->addWidget(chkSound, 4, 1);
|
||||||
|
layMain->addWidget(btnSave, 5, 1);
|
||||||
|
}
|
||||||
|
|
||||||
chkPortraits = new QCheckBox("Yes");
|
void Exdeath::initRandom(void) {
|
||||||
chkSound = new QCheckBox("Yes");
|
layRandom = new QFormLayout(this);
|
||||||
|
grpRandom = new QGroupBox("Randomization");
|
||||||
|
grpRandom->setLayout(layRandom);
|
||||||
|
layLeft->addWidget(grpRandom);
|
||||||
|
|
||||||
numSeed = new QSpinBox();
|
numSeed = new QSpinBox();
|
||||||
numSeed->setRange(0, INT_MAX);
|
numSeed->setRange(0, INT_MAX);
|
||||||
// provide a default value so it's not just 0 all the time
|
// provide a default value so it's not just 0 all the time
|
||||||
numSeed->setValue(time(NULL) / 3600);
|
numSeed->setValue(time(NULL) / 3600);
|
||||||
|
layRandom->addRow("Seed:", numSeed);
|
||||||
|
|
||||||
selNED = new QComboBox();
|
selNED = new QComboBox();
|
||||||
selNED->addItem("Random");
|
selNED->addItem("Random");
|
||||||
|
@ -119,27 +144,17 @@ void Exdeath::initMain(void) {
|
||||||
selNED->addItem("Territorial Oak", "tree.ips");
|
selNED->addItem("Territorial Oak", "tree.ips");
|
||||||
selNED->addItem("Thomas the Tank Engine", "thomas.ips");
|
selNED->addItem("Thomas the Tank Engine", "thomas.ips");
|
||||||
selNED->addItem("Yiazmat", "yiazmat.ips");
|
selNED->addItem("Yiazmat", "yiazmat.ips");
|
||||||
|
layRandom->addRow("Neo ExDeath:", selNED);
|
||||||
|
|
||||||
layMain->addWidget(txtROM, 0, 0);
|
chkRandom = new QCheckBox("Yes");
|
||||||
layMain->addWidget(btnROM, 0, 1);
|
layRandom->addRow("Abilities:", chkRandom);
|
||||||
layMain->addWidget(txtMode, 1, 0);
|
|
||||||
layMain->addWidget(selMode, 1, 1);
|
|
||||||
layMain->addWidget(txtPortraits, 2, 0);
|
|
||||||
layMain->addWidget(chkPortraits, 2, 1);
|
|
||||||
layMain->addWidget(txtSound, 3, 0);
|
|
||||||
layMain->addWidget(chkSound, 3, 1);
|
|
||||||
layMain->addWidget(txtSeed, 4, 0);
|
|
||||||
layMain->addWidget(numSeed, 4, 1);
|
|
||||||
layMain->addWidget(txtNED, 5, 0);
|
|
||||||
layMain->addWidget(selNED, 5, 1);
|
|
||||||
layMain->addWidget(btnSave, 6, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exdeath::initInnates(void) {
|
void Exdeath::initInnates(void) {
|
||||||
layInnates = new QVBoxLayout(this);
|
layInnates = new QVBoxLayout(this);
|
||||||
grpInnates = new QGroupBox("Innate abilities");
|
grpInnates = new QGroupBox("Innate abilities");
|
||||||
grpInnates->setLayout(layInnates);
|
grpInnates->setLayout(layInnates);
|
||||||
layColumn2->addWidget(grpInnates);
|
layRight->addWidget(grpInnates);
|
||||||
|
|
||||||
chkPassages = new QCheckBox("Innate Passages");
|
chkPassages = new QCheckBox("Innate Passages");
|
||||||
chkPitfalls = new QCheckBox("Innate Pitfalls");
|
chkPitfalls = new QCheckBox("Innate Pitfalls");
|
||||||
|
@ -157,7 +172,7 @@ void Exdeath::initMulti(void) {
|
||||||
grpMulti = new QGroupBox("Multipliers");
|
grpMulti = new QGroupBox("Multipliers");
|
||||||
layMulti = new QFormLayout(this);
|
layMulti = new QFormLayout(this);
|
||||||
grpMulti->setLayout(layMulti);
|
grpMulti->setLayout(layMulti);
|
||||||
layColumn2->addWidget(grpMulti);
|
layRight->addWidget(grpMulti);
|
||||||
|
|
||||||
layXP = new QHBoxLayout(this);
|
layXP = new QHBoxLayout(this);
|
||||||
butsXP = new QButtonGroup();
|
butsXP = new QButtonGroup();
|
||||||
|
@ -192,6 +207,11 @@ void Exdeath::initMulti(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exdeath::initConfig(void) {
|
void Exdeath::initConfig(void) {
|
||||||
|
QString version = QApplication::applicationVersion();
|
||||||
|
// don't load config from old versions.
|
||||||
|
if (!version.compare(_cfg->value("main/version", version).toString())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
QString temp = _cfg->value("rom/filename", "").toString();
|
QString temp = _cfg->value("rom/filename", "").toString();
|
||||||
|
|
||||||
if (temp.length() != 0) {
|
if (temp.length() != 0) {
|
||||||
|
@ -213,7 +233,21 @@ void Exdeath::initConfig(void) {
|
||||||
butsGil->button(_cfg->value("multi/gil", 1).toInt())->setChecked(true);
|
butsGil->button(_cfg->value("multi/gil", 1).toInt())->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Exdeath::selMode_index(int idx) {
|
||||||
|
bool random_ok = false;
|
||||||
|
bool unlock_ok = false;
|
||||||
|
if (idx < 2) {
|
||||||
|
unlock_ok = true;
|
||||||
|
}
|
||||||
|
if (idx == 0) {
|
||||||
|
random_ok = true;
|
||||||
|
}
|
||||||
|
chkRandom->setEnabled(random_ok);
|
||||||
|
chkUnlock->setEnabled(unlock_ok);
|
||||||
|
}
|
||||||
|
|
||||||
void Exdeath::btnSave_clicked(bool trigger) {
|
void Exdeath::btnSave_clicked(bool trigger) {
|
||||||
|
_cfg->setValue("main/version", QApplication::applicationVersion());
|
||||||
_cfg->setValue("rom/filename", filename);
|
_cfg->setValue("rom/filename", filename);
|
||||||
_cfg->setValue("main/mode", selMode->currentIndex());
|
_cfg->setValue("main/mode", selMode->currentIndex());
|
||||||
_cfg->setValue("main/ned", selNED->currentIndex());
|
_cfg->setValue("main/ned", selNED->currentIndex());
|
||||||
|
@ -272,6 +306,9 @@ void Exdeath::btnApply_clicked(bool trigger) {
|
||||||
if (mode > 0) {
|
if (mode > 0) {
|
||||||
patches << ":/patches/" + selMode->itemData(mode).toString();
|
patches << ":/patches/" + selMode->itemData(mode).toString();
|
||||||
}
|
}
|
||||||
|
if (chkUnlock->isChecked() && chkUnlock->isEnabled()) {
|
||||||
|
patches << ":/patches/unlock.ips";
|
||||||
|
}
|
||||||
if (chkPortraits->isChecked()) {
|
if (chkPortraits->isChecked()) {
|
||||||
patches << ":/patches/portraits.ips";
|
patches << ":/patches/portraits.ips";
|
||||||
}
|
}
|
||||||
|
@ -322,7 +359,7 @@ void Exdeath::btnApply_clicked(bool trigger) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool global_innates = (chkPassages->isChecked() || chkPitfalls->isChecked() || chkLiteStep->isChecked() || chkDash->isChecked() || chkLearning->isChecked());
|
bool global_innates = (chkPassages->isChecked() || chkPitfalls->isChecked() || chkLiteStep->isChecked() || chkDash->isChecked() || chkLearning->isChecked());
|
||||||
if (mode == 1) {
|
if (chkRandom->isChecked() && chkRandom->isEnabled()) {
|
||||||
Randomizer *rando = new Randomizer(rand);
|
Randomizer *rando = new Randomizer(rand);
|
||||||
QFile *pfile = new QFile(output + ".ips");
|
QFile *pfile = new QFile(output + ".ips");
|
||||||
pfile->open(QIODevice::WriteOnly);
|
pfile->open(QIODevice::WriteOnly);
|
||||||
|
|
|
@ -39,40 +39,42 @@ private:
|
||||||
|
|
||||||
QVBoxLayout *layApp;
|
QVBoxLayout *layApp;
|
||||||
QHBoxLayout *layColumns;
|
QHBoxLayout *layColumns;
|
||||||
QVBoxLayout *layColumn2;
|
QVBoxLayout *layLeft;
|
||||||
|
QVBoxLayout *layRight;
|
||||||
|
|
||||||
|
// Main settings
|
||||||
QGridLayout *layMain;
|
QGridLayout *layMain;
|
||||||
QVBoxLayout *layMode;
|
|
||||||
QGroupBox *grpMain;
|
QGroupBox *grpMain;
|
||||||
|
|
||||||
QLabel *txtROM;
|
QLabel *txtROM;
|
||||||
QLabel *txtMode;
|
QLabel *txtMode;
|
||||||
|
QLabel *txtUnlock;
|
||||||
QLabel *txtPortraits;
|
QLabel *txtPortraits;
|
||||||
QLabel *txtSound;
|
QLabel *txtSound;
|
||||||
QLabel *txtNED;
|
|
||||||
QLabel *txtSeed;
|
|
||||||
|
|
||||||
QPushButton *btnROM;
|
QPushButton *btnROM;
|
||||||
QPushButton *btnApply;
|
QPushButton *btnApply;
|
||||||
QPushButton *btnSave;
|
QPushButton *btnSave;
|
||||||
|
|
||||||
QComboBox *selMode;
|
QComboBox *selMode;
|
||||||
|
QCheckBox *chkUnlock;
|
||||||
QCheckBox *chkPortraits;
|
QCheckBox *chkPortraits;
|
||||||
QCheckBox *chkSound;
|
QCheckBox *chkSound;
|
||||||
|
|
||||||
|
// Randomized settings
|
||||||
|
QGroupBox *grpRandom;
|
||||||
|
QFormLayout *layRandom;
|
||||||
|
QSpinBox *numSeed;
|
||||||
QComboBox *selNED;
|
QComboBox *selNED;
|
||||||
|
QCheckBox *chkRandom;
|
||||||
|
|
||||||
|
// Innate abilities
|
||||||
QGroupBox *grpInnates;
|
QGroupBox *grpInnates;
|
||||||
QVBoxLayout *layInnates;
|
QVBoxLayout *layInnates;
|
||||||
|
|
||||||
QCheckBox *chkPassages;
|
QCheckBox *chkPassages;
|
||||||
QCheckBox *chkPitfalls;
|
QCheckBox *chkPitfalls;
|
||||||
QCheckBox *chkLiteStep;
|
QCheckBox *chkLiteStep;
|
||||||
QCheckBox *chkDash;
|
QCheckBox *chkDash;
|
||||||
QCheckBox *chkLearning;
|
QCheckBox *chkLearning;
|
||||||
QSpinBox *numSeed;
|
|
||||||
|
|
||||||
|
// Multipliers
|
||||||
QGroupBox *grpMulti;
|
QGroupBox *grpMulti;
|
||||||
QFormLayout *layMulti;
|
QFormLayout *layMulti;
|
||||||
QHBoxLayout *layXP;
|
QHBoxLayout *layXP;
|
||||||
|
@ -85,13 +87,20 @@ private:
|
||||||
QRadioButton *radAP[4];
|
QRadioButton *radAP[4];
|
||||||
QRadioButton *radGil[4];
|
QRadioButton *radGil[4];
|
||||||
|
|
||||||
|
// Initialization
|
||||||
void initMain(void);
|
void initMain(void);
|
||||||
void initInnates(void);
|
void initInnates(void);
|
||||||
|
void initRandom(void);
|
||||||
void initMulti(void);
|
void initMulti(void);
|
||||||
void initConfig(void);
|
void initConfig(void);
|
||||||
|
|
||||||
|
// Event handlers
|
||||||
void btnROM_clicked(bool trigger);
|
void btnROM_clicked(bool trigger);
|
||||||
void btnApply_clicked(bool trigger);
|
void btnApply_clicked(bool trigger);
|
||||||
void btnSave_clicked(bool trigger);
|
void btnSave_clicked(bool trigger);
|
||||||
|
void selMode_index(int idx);
|
||||||
|
|
||||||
|
// Where the magic happens
|
||||||
void applyPatch(QFile *file, QIODevice *Data);
|
void applyPatch(QFile *file, QIODevice *Data);
|
||||||
void applyInnates(QFile *file);
|
void applyInnates(QFile *file);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue