Skip to content

Commit

Permalink
fix bug with the GBA addon menu (and make it a proper list so we don'…
Browse files Browse the repository at this point in the history
…t have to hardcode the length all over)
  • Loading branch information
Arisotura committed Oct 24, 2024
1 parent 079341f commit 6d3ea6a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions src/frontend/qt_sdl/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,17 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :

{
QMenu* submenu = menu->addMenu("Insert add-on cart");
QAction* act;

actInsertGBAAddon[0] = submenu->addAction("Memory expansion");
actInsertGBAAddon[0]->setData(QVariant(GBAAddon_RAMExpansion));
connect(actInsertGBAAddon[0], &QAction::triggered, this, &MainWindow::onInsertGBAAddon);
act = submenu->addAction("Memory expansion");
act->setData(QVariant(GBAAddon_RAMExpansion));
connect(act, &QAction::triggered, this, &MainWindow::onInsertGBAAddon);
actInsertGBAAddon.append(act);

actInsertGBAAddon[1] = submenu->addAction("Rumble Pak");
actInsertGBAAddon[1]->setData(QVariant(GBAAddon_RumblePak));
connect(actInsertGBAAddon[1], &QAction::triggered, this, &MainWindow::onInsertGBAAddon);
act = submenu->addAction("Rumble Pak");
act->setData(QVariant(GBAAddon_RumblePak));
connect(act, &QAction::triggered, this, &MainWindow::onInsertGBAAddon);
actInsertGBAAddon.append(act);
}

actEjectGBACart = menu->addAction("Eject cart");
Expand Down Expand Up @@ -673,8 +676,8 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
if (globalCfg.GetInt("Emu.ConsoleType") == 1)
{
actInsertGBACart->setEnabled(false);
for (int i = 0; i < 1; i++)
actInsertGBAAddon[i]->setEnabled(false);
for (auto act : actInsertGBAAddon)
act->setEnabled(false);
}

for (int i = 0; i < 9; i++)
Expand Down Expand Up @@ -1700,15 +1703,15 @@ void MainWindow::onEmuSettingsDialogFinished(int res)
if (globalCfg.GetInt("Emu.ConsoleType") == 1)
{
actInsertGBACart->setEnabled(false);
for (int i = 0; i < 1; i++)
actInsertGBAAddon[i]->setEnabled(false);
for (auto act : actInsertGBAAddon)
act->setEnabled(false);
actEjectGBACart->setEnabled(false);
}
else
{
actInsertGBACart->setEnabled(true);
for (int i = 0; i < 1; i++)
actInsertGBAAddon[i]->setEnabled(true);
for (auto act : actInsertGBAAddon)
act->setEnabled(true);
actEjectGBACart->setEnabled(emuInstance->gbaCartInserted());
}

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/qt_sdl/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private slots:
QAction* actEjectCart;
QAction* actCurrentGBACart;
QAction* actInsertGBACart;
QAction* actInsertGBAAddon[2];
QList<QAction*> actInsertGBAAddon;
QAction* actEjectGBACart;
QAction* actImportSavefile;
QAction* actSaveState[9];
Expand Down

0 comments on commit 6d3ea6a

Please sign in to comment.