mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-29 09:10:08 -06:00
save battery levels to config
This commit is contained in:
@ -22,6 +22,7 @@
|
||||
#include "SPI.h"
|
||||
#include "DSi_I2C.h"
|
||||
#include "NDS.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include "types.h"
|
||||
|
||||
@ -40,8 +41,8 @@ PowerManagementDialog::PowerManagementDialog(QWidget* parent) : QDialog(parent),
|
||||
{
|
||||
ui->grpDSBattery->setEnabled(false);
|
||||
|
||||
oldDSiBatteryCharging = DSi_BPTWL::GetBatteryCharging();
|
||||
oldDSiBatteryLevel = DSi_BPTWL::GetBatteryLevel();
|
||||
oldDSiBatteryCharging = DSi_BPTWL::GetBatteryCharging();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -74,12 +75,24 @@ PowerManagementDialog::~PowerManagementDialog()
|
||||
|
||||
void PowerManagementDialog::done(int r)
|
||||
{
|
||||
if (r != QDialog::Accepted)
|
||||
if (r == QDialog::Accepted)
|
||||
{
|
||||
if (NDS::ConsoleType == 1)
|
||||
{
|
||||
Config::DSiBatteryLevel = DSi_BPTWL::GetBatteryLevel();
|
||||
Config::DSiBatteryCharging = DSi_BPTWL::GetBatteryCharging();
|
||||
}
|
||||
else
|
||||
{
|
||||
Config::DSBatteryLevelOkay = SPI_Powerman::GetBatteryLevelOkay();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NDS::ConsoleType == 1)
|
||||
{
|
||||
DSi_BPTWL::SetBatteryCharging(oldDSiBatteryCharging);
|
||||
DSi_BPTWL::SetBatteryLevel(oldDSiBatteryLevel);
|
||||
DSi_BPTWL::SetBatteryCharging(oldDSiBatteryCharging);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -67,8 +67,8 @@ private:
|
||||
|
||||
bool inited;
|
||||
bool oldDSBatteryLevel;
|
||||
bool oldDSiBatteryCharging;
|
||||
u8 oldDSiBatteryLevel;
|
||||
bool oldDSiBatteryCharging;
|
||||
|
||||
void updateDSBatteryLevelControls();
|
||||
};
|
||||
|
Reference in New Issue
Block a user