From 7899e02db00c15e6f33c958d7c07f64f1047af96 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 15 Feb 2019 00:57:24 -0800 Subject: [PATCH] Qt: Flesh out BattleChip Gate UI --- CHANGES | 1 + res/chip-names-4.txt | 307 +++++++++++++++++++++++++++++ src/platform/qt/BattleChipView.cpp | 33 +++- src/platform/qt/BattleChipView.h | 3 + src/platform/qt/BattleChipView.ui | 23 ++- src/platform/qt/resources.qrc | 1 + 6 files changed, 358 insertions(+), 10 deletions(-) create mode 100644 res/chip-names-4.txt diff --git a/CHANGES b/CHANGES index e8a00269a..ed5cb8375 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ 0.8.0: (Future) Features: - Improved logging configuration + - One-Player BattleChip Gate support Bugfixes: - GBA: All IRQs have 7 cycle delay (fixes mgba.io/i/539, mgba.io/i/1208) - GBA: Reset now reloads multiboot ROMs diff --git a/res/chip-names-4.txt b/res/chip-names-4.txt new file mode 100644 index 000000000..fdfd868ae --- /dev/null +++ b/res/chip-names-4.txt @@ -0,0 +1,307 @@ +Cannon +Hi Cannon +Mega Cannon +Air Shot +Blizzard +Heat Breath +Silence +Tornado +Wide Shot 1 +Wide Shot 2 +Wide Shot 3 +Flame Line 1 +Flame Line 2 +Flame Line 3 +Vulcan 1 +Vulcan 2 +Vulcan 3 +Spreader +Heat Shot +Heat V +Heat Side +Bubbler +Bubble V +Bubble Side +Element Flare +Element Ice +Static +Life Sync +Mini Boomer +Energy Bomb +Mega Energy Bomb +Gun del Sol 1 +Gun del Sol 2 +Gun del Sol 3 +Mag Bolt 1 +Mag Bolt 2 +Mag Bolt 3 +Binder 1 +Binder 2 +Binder 3 +Bug Bomb +Elec Shock +Wood Powder +Cannonball +Geyser +Geyser +Sand Ring +Sword +Wide Sword +Long Sword +Wide Blade +Long Blade +Wind Racket +Custom Sword +Variable Sword +Slasher +Thunderball 1 +Thunderball 2 +Thunderball 3 +Counter 1 +Counter 2 +Counter 3 +Air Hockey 1 +Air Hockey 2 +Air Hockey 3 +Circle Gun 1 +Circle Gun 2 +Circle Gun 3 +Twin Fang 1 +Twin Fang 2 +Twin Fang 3 +White Web 1 +White Web 2 +White Web 3 +Boomerang 1 +Boomerang 2 +Boomerang 3 +Side Bamboo 1 +Side Bamboo 2 +Side Bamboo 3 +Lance +Hole +Boy's Bomb 1 +Boy's Bomb 2 +Boy's Bomb 3 +Guard 1 +Guard 2 +Guard 3 +Magnum +Grab Gel +Snake +Time Bomb +Mine +Rock Cube +Fanfare +Discord +Timpani +VDoll +Big Hammer 1 +Big Hammer 2 +Big Hammer 3 +Grab Revenge +Grab Banish +Geddon 1 +Geddon 2 +Geddon 3 +Element Leaf +Color Point +Element Sand +Moko Rush 1 +Moko Rush 2 +Moko Rush 3 +North Wind +Anti Fire +Anti Water +Anti Electric +Anti Wood +Anti Navi +Anti Damage +Anti Sword +Anti Recover +Copy Damage +Attack +10 +Navi +20 +Roll Arrow 1 +Roll Arrow 2 +Roll Arrow 3 +Guts Punch 1 +Guts Punch 2 +Guts Punch 3 +Propeller Bomb 1 +Propeller Bomb 2 +Propeller Bomb 3 +Search Bomb 1 +Search Bomb 2 +Search Bomb 3 +Meteors 1 +Meteors 2 +Meteors 3 +Lightning 1 +Lightning 2 +Lightning 3 +Hawk Cut 1 +Hawk Cut 2 +Hawk Cut 3 +Number Ball 1 +Number Ball 2 +Number Ball 3 +Metal Gear 1 +Metal Gear 2 +Metal Gear 3 +Panel Shoot 1 +Panel Shoot 2 +Panel Shoot 3 +Aqua Upper 1 +Aqua Upper 2 +Aqua Upper 3 +Green Wood 1 +Green Wood 2 +Green Wood 3 +Muramasa +Guardian +Anubis +Double Point +Full Custom +Shooting Star +Bug Chain +Jealousy +Element Dark +Black Wing +God Hammer +Dark Line +Neo Variable +Z Saber +Gun del Sol EX +Super Vulcan +Roll +Roll SP +Roll DS +GutsMan +GutsMan SP +GutsMan DS +WindMan +WindMan SP +WindMan DS +SearchMan +SearchMan SP +SearchMan DS +FireMan +FireMan SP +FireMan DS +ThunderMan +ThunderMan SP +ThunderMan DS +ProtoMan +ProtoMan SP +ProtoMan DS +NumberMan +NumberMan SP +NumberMan DS +MetalMan +MetalMan SP +MetalMan DS +JunkMan +JunkMan SP +JunkMan DS +AquaMan +AquaMan SP +AquaMan DS +WoodMan +WoodMan SP +WoodMan DS +TopMan +TopMan SP +TopMan DS +ShadeMan +ShadeMan SP +ShadeMan DS +BurnerMan +BurnerMan SP +BurnerMan DS +ColdMan +ColdMan SP +ColdMan DS +SparkMan +SparkMan SP +SparkMan DS +LaserMan +LaserMan SP +LaserMan DS +KendoMan +KendoMan SP +KendoMan DS +VideoMan +VideoMan SP +VideoMan DS +Marking +Cannon Mode +Cannonball Mode +Sword Mode +Fire Plus +Thunder Plus +Aqua Power +Wood Power +Black Weapon +Final Gun + + + + + +Bass +Delta Ray +Bug Curse +Red Sun +Bass Another +Holy Dream +Blue Moon +Bug Charge + + +Wind +Fan +Crack Out +Double Crack +Triple Crack +Recovery 10 +Recovery 30 +Recovery 50 +Recovery 80 +Recovery 120 +Recovery 150 +Recovery 200 +Recovery 300 +Repair +Panel Grab +Area Grab +Slow Gauge +Fast Gauge +Panel Return +Blinder +Pop Up +Invisible +Barrier +Barrier 100 +Barrier 200 +Holy Panel + +Life Aura +Attack +30 +Bug Fix +Sanctuary +Signal Red +Black Barrier +MegaMan Navi +Roll Navi +GutsMan Navi +WindMan Navi +SearchMan Navi +FireMan Navi +ThunderMan Navi +ProtoMan Navi +NumberMan Navi +MetalMan Navi +JunkMan Navi +AquaMan Navi +WoodMan Navi \ No newline at end of file diff --git a/src/platform/qt/BattleChipView.cpp b/src/platform/qt/BattleChipView.cpp index af9a0a9eb..4f6b6a4b3 100644 --- a/src/platform/qt/BattleChipView.cpp +++ b/src/platform/qt/BattleChipView.cpp @@ -7,6 +7,9 @@ #include "CoreController.h" +#include +#include + using namespace QGBA; BattleChipView::BattleChipView(std::shared_ptr controller, QWidget* parent) @@ -16,21 +19,47 @@ BattleChipView::BattleChipView(std::shared_ptr controller, QWidg m_ui.setupUi(this); connect(m_ui.chipId, static_cast(&QSpinBox::valueChanged), m_ui.inserted, [this]() { - m_ui.inserted->setChecked(Qt::Checked); - insertChip(true); + m_ui.inserted->setChecked(Qt::Unchecked); }); + connect(m_ui.chipId, static_cast(&QSpinBox::valueChanged), m_ui.chipName, &QComboBox::setCurrentIndex); + connect(m_ui.chipName, static_cast(&QComboBox::currentIndexChanged), m_ui.chipId, &QSpinBox::setValue); + connect(m_ui.inserted, &QAbstractButton::toggled, this, &BattleChipView::insertChip); connect(controller.get(), &CoreController::stopping, this, &QWidget::close); + + setFlavor(4); } BattleChipView::~BattleChipView() { m_controller->detachBattleChipGate(); } +void BattleChipView::setFlavor(int flavor) { + loadChipNames(flavor); +} + void BattleChipView::insertChip(bool inserted) { if (inserted) { m_controller->setBattleChipId(m_ui.chipId->value()); } else { m_controller->setBattleChipId(0); } +} + +void BattleChipView::loadChipNames(int flavor) { + QStringList chipNames; + chipNames.append(tr("(None)")); + + QFile file(QString(":/res/chip-names-%1.txt").arg(flavor)); + file.open(QIODevice::ReadOnly | QIODevice::Text); + while (true) { + QByteArray line = file.readLine(); + if (line.isEmpty()) { + break; + } + chipNames.append(QString::fromUtf8(line).trimmed()); + } + + m_ui.chipName->clear(); + m_ui.chipName->addItems(chipNames); } \ No newline at end of file diff --git a/src/platform/qt/BattleChipView.h b/src/platform/qt/BattleChipView.h index 564f1f8b0..14b61a043 100644 --- a/src/platform/qt/BattleChipView.h +++ b/src/platform/qt/BattleChipView.h @@ -25,9 +25,12 @@ public: ~BattleChipView(); public slots: + void setFlavor(int); void insertChip(bool); private: + void loadChipNames(int); + Ui::BattleChipView m_ui; std::shared_ptr m_controller; diff --git a/src/platform/qt/BattleChipView.ui b/src/platform/qt/BattleChipView.ui index 5143c9d41..092663ae7 100644 --- a/src/platform/qt/BattleChipView.ui +++ b/src/platform/qt/BattleChipView.ui @@ -6,38 +6,45 @@ 0 0 - 217 - 100 + 426 + 152 BattleChip Gate - + Inserted - + Chip ID - - - - 1 + + + + Chip Name + + + + 65535 + + + diff --git a/src/platform/qt/resources.qrc b/src/platform/qt/resources.qrc index 7d61b6dd1..80be2c8be 100644 --- a/src/platform/qt/resources.qrc +++ b/src/platform/qt/resources.qrc @@ -4,5 +4,6 @@ ../../../res/keymap.qpic ../../../res/patrons.txt ../../../res/no-cam.png + ../../../res/chip-names-4.txt