This commit is contained in:
Arisotura 2024-10-24 14:00:11 +02:00
parent 6d3ea6a485
commit 1666049531
4 changed files with 34 additions and 22 deletions

View File

@ -1972,13 +1972,24 @@ bool EmuInstance::gbaCartInserted()
return gbaCartType != -1; return gbaCartType != -1;
} }
QString EmuInstance::gbaAddonName(int addon)
{
switch (addon)
{
case GBAAddon_RumblePak:
return "Rumble Pak";
case GBAAddon_RAMExpansion:
return "Memory expansion";
}
return "???";
}
QString EmuInstance::gbaCartLabel() QString EmuInstance::gbaCartLabel()
{ {
if (consoleType == 1) return "none (DSi)"; if (consoleType == 1) return "none (DSi)";
switch (gbaCartType) if (gbaCartType == 0)
{
case 0:
{ {
QString ret = QString::fromStdString(baseGBAROMName); QString ret = QString::fromStdString(baseGBAROMName);
@ -1988,9 +1999,9 @@ QString EmuInstance::gbaCartLabel()
return ret; return ret;
} }
else if (gbaCartType != -1)
case GBAAddon_RAMExpansion: {
return "Memory expansion"; return gbaAddonName(gbaCartType);
} }
return "(none)"; return "(none)";

View File

@ -186,6 +186,7 @@ private:
void loadGBAAddon(int type); void loadGBAAddon(int type);
void ejectGBACart(); void ejectGBACart();
bool gbaCartInserted(); bool gbaCartInserted();
QString gbaAddonName(int addon);
QString gbaCartLabel(); QString gbaCartLabel();
void audioInit(); void audioInit();

View File

@ -623,7 +623,7 @@ void EmuThread::handleMessages()
break; break;
case msg_EjectGBACart: case msg_EjectGBACart:
emuInstance->ejectCart(); emuInstance->ejectGBACart();
break; break;
} }

View File

@ -313,16 +313,16 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
QMenu* submenu = menu->addMenu("Insert add-on cart"); QMenu* submenu = menu->addMenu("Insert add-on cart");
QAction* act; QAction* act;
act = submenu->addAction("Memory expansion"); int addons[] = {GBAAddon_RAMExpansion, GBAAddon_RumblePak, -1};
act->setData(QVariant(GBAAddon_RAMExpansion)); for (int i = 0; addons[i] != -1; i++)
connect(act, &QAction::triggered, this, &MainWindow::onInsertGBAAddon); {
actInsertGBAAddon.append(act); int addon = addons[i];
act = submenu->addAction(emuInstance->gbaAddonName(addon));
act = submenu->addAction("Rumble Pak"); act->setData(QVariant(addon));
act->setData(QVariant(GBAAddon_RumblePak));
connect(act, &QAction::triggered, this, &MainWindow::onInsertGBAAddon); connect(act, &QAction::triggered, this, &MainWindow::onInsertGBAAddon);
actInsertGBAAddon.append(act); actInsertGBAAddon.append(act);
} }
}
actEjectGBACart = menu->addAction("Eject cart"); actEjectGBACart = menu->addAction("Eject cart");
connect(actEjectGBACart, &QAction::triggered, this, &MainWindow::onEjectGBACart); connect(actEjectGBACart, &QAction::triggered, this, &MainWindow::onEjectGBACart);