Add support for changing the DS and DSi battery level

The DS battery level is configured via the SPI Power Management Device,
and the DSi's is configured via the I2C BPTWL. Add support for changing
these registers and add the "Power Management" dialog in the UI.
This commit is contained in:
Rayyan Ansari
2022-02-18 15:32:46 +00:00
committed by Arisotura
parent c3adf6f606
commit 2569c67a13
16 changed files with 1360 additions and 0 deletions

View File

@ -62,6 +62,7 @@
#include "ROMInfoDialog.h"
#include "RAMInfoDialog.h"
#include "TitleManagerDialog.h"
#include "PowerManagement/PowerManagementDialog.h"
#include "types.h"
#include "version.h"
@ -1429,6 +1430,11 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
menu->addSeparator();
actPowerManagement = menu->addAction("Power management");
connect(actPowerManagement, &QAction::triggered, this, &MainWindow::onOpenPowerManagement);
menu->addSeparator();
actEnableCheats = menu->addAction("Enable cheats");
actEnableCheats->setCheckable(true);
connect(actEnableCheats, &QAction::triggered, this, &MainWindow::onEnableCheats);
@ -1669,6 +1675,8 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
actStop->setEnabled(false);
actFrameStep->setEnabled(false);
actPowerManagement->setEnabled(false);
actSetupCheats->setEnabled(false);
actTitleManager->setEnabled(!Config::DSiNANDPath.empty());
@ -2609,6 +2617,11 @@ void MainWindow::onEmuSettingsDialogFinished(int res)
actTitleManager->setEnabled(!Config::DSiNANDPath.empty());
}
void MainWindow::onOpenPowerManagement()
{
PowerManagementDialog* dlg = PowerManagementDialog::openDlg(this);
}
void MainWindow::onOpenInputConfig()
{
emuThread->emuPause();
@ -2896,6 +2909,8 @@ void MainWindow::onEmuStart()
actStop->setEnabled(true);
actFrameStep->setEnabled(true);
actPowerManagement->setEnabled(true);
actTitleManager->setEnabled(false);
}
@ -2915,6 +2930,8 @@ void MainWindow::onEmuStop()
actStop->setEnabled(false);
actFrameStep->setEnabled(false);
actPowerManagement->setEnabled(false);
actTitleManager->setEnabled(!Config::DSiNANDPath.empty());
}