all repos — mgba @ 7899e02db00c15e6f33c958d7c07f64f1047af96

mGBA Game Boy Advance Emulator

Qt: Flesh out BattleChip Gate UI
Vicki Pfau vi@endrift.com
Fri, 15 Feb 2019 00:57:24 -0800
commit

7899e02db00c15e6f33c958d7c07f64f1047af96

parent

86b6f2e9cd967be4d684ecac80ce26cdaddcfaf1

M CHANGESCHANGES

@@ -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
A 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
M src/platform/qt/BattleChipView.cppsrc/platform/qt/BattleChipView.cpp

@@ -7,6 +7,9 @@ #include "BattleChipView.h"

#include "CoreController.h" +#include <QFile> +#include <QStringList> + using namespace QGBA; BattleChipView::BattleChipView(std::shared_ptr<CoreController> controller, QWidget* parent)

@@ -16,21 +19,47 @@ {

m_ui.setupUi(this); connect(m_ui.chipId, static_cast<void (QSpinBox::*)(int)>(&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<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), m_ui.chipName, &QComboBox::setCurrentIndex); + connect(m_ui.chipName, static_cast<void (QComboBox::*)(int)>(&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); }
M src/platform/qt/BattleChipView.hsrc/platform/qt/BattleChipView.h

@@ -25,9 +25,12 @@ BattleChipView(std::shared_ptr<CoreController> controller, QWidget* parent = nullptr);

~BattleChipView(); public slots: + void setFlavor(int); void insertChip(bool); private: + void loadChipNames(int); + Ui::BattleChipView m_ui; std::shared_ptr<CoreController> m_controller;
M src/platform/qt/BattleChipView.uisrc/platform/qt/BattleChipView.ui

@@ -6,37 +6,44 @@ <property name="geometry">

<rect> <x>0</x> <y>0</y> - <width>217</width> - <height>100</height> + <width>426</width> + <height>152</height> </rect> </property> <property name="windowTitle"> <string>BattleChip Gate</string> </property> <layout class="QFormLayout" name="formLayout"> - <item row="1" column="1"> + <item row="2" column="1"> <widget class="QCheckBox" name="inserted"> <property name="text"> <string>Inserted</string> </property> </widget> </item> - <item row="0" column="0"> + <item row="1" column="0"> <widget class="QLabel" name="label"> <property name="text"> <string>Chip ID</string> </property> </widget> </item> - <item row="0" column="1"> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Chip Name</string> + </property> + </widget> + </item> + <item row="1" column="1"> <widget class="QSpinBox" name="chipId"> - <property name="minimum"> - <number>1</number> - </property> <property name="maximum"> <number>65535</number> </property> </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="chipName"/> </item> </layout> </widget>
M src/platform/qt/resources.qrcsrc/platform/qt/resources.qrc

@@ -4,5 +4,6 @@ <file>../../../res/mgba-1024.png</file>

<file>../../../res/keymap.qpic</file> <file>../../../res/patrons.txt</file> <file>../../../res/no-cam.png</file> + <file>../../../res/chip-names-4.txt</file> </qresource> </RCC>