diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp index 9aa3189a..7b274ebf 100644 --- a/src/frontend/qt_sdl/Config.cpp +++ b/src/frontend/qt_sdl/Config.cpp @@ -68,10 +68,6 @@ int MPRecvTimeout; std::string LANDevice; bool DirectLAN; -bool DSBatteryLevelOkay; -int DSiBatteryLevel; -bool DSiBatteryCharging; - CameraConfig Camera[2]; diff --git a/src/frontend/qt_sdl/Config.h b/src/frontend/qt_sdl/Config.h index 3aca7e13..bb2374dc 100644 --- a/src/frontend/qt_sdl/Config.h +++ b/src/frontend/qt_sdl/Config.h @@ -182,10 +182,6 @@ extern int MPRecvTimeout; extern std::string LANDevice; extern bool DirectLAN; -extern bool DSBatteryLevelOkay; -extern int DSiBatteryLevel; -extern bool DSiBatteryCharging; - extern CameraConfig Camera[2]; diff --git a/src/frontend/qt_sdl/EmuInstance.cpp b/src/frontend/qt_sdl/EmuInstance.cpp index 52aab91b..00be2b6f 100644 --- a/src/frontend/qt_sdl/EmuInstance.cpp +++ b/src/frontend/qt_sdl/EmuInstance.cpp @@ -915,12 +915,12 @@ void EmuInstance::setBatteryLevels() if (nds->ConsoleType == 1) { auto dsi = static_cast(nds); - dsi->I2C.GetBPTWL()->SetBatteryLevel(Config::DSiBatteryLevel); - dsi->I2C.GetBPTWL()->SetBatteryCharging(Config::DSiBatteryCharging); + dsi->I2C.GetBPTWL()->SetBatteryLevel(localCfg.GetInt("DSi.Battery.Level")); + dsi->I2C.GetBPTWL()->SetBatteryCharging(localCfg.GetBool("DSi.Battery.Charging")); } else { - nds->SPI.GetPowerMan()->SetBatteryLevelOkay(Config::DSBatteryLevelOkay); + nds->SPI.GetPowerMan()->SetBatteryLevelOkay(localCfg.GetBool("DS.Battery.LevelOkay")); } } diff --git a/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp index 27bbe612..b1b2096a 100644 --- a/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp +++ b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp @@ -63,7 +63,7 @@ PowerManagementDialog::PowerManagementDialog(QWidget* parent) : QDialog(parent), updateDSBatteryLevelControls(); - bool defaultDSiBatteryCharging = (nds->ConsoleType == 1) ? Config::DSiBatteryCharging : false; + //bool defaultDSiBatteryCharging = (nds->ConsoleType == 1) ? Config::DSiBatteryCharging : false; if (nds->ConsoleType == 1) { @@ -82,8 +82,10 @@ PowerManagementDialog::PowerManagementDialog(QWidget* parent) : QDialog(parent), } else { - ui->cbDSiBatteryCharging->setChecked(Config::DSiBatteryCharging); - ui->sliderDSiBatteryLevel->setValue(Config::DSiBatteryLevel); + auto& cfg = emuInstance->getLocalConfig(); + + ui->cbDSiBatteryCharging->setChecked(cfg.GetBool("DSi.Battery.Charging")); + ui->sliderDSiBatteryLevel->setValue(cfg.GetInt("DSi.Battery.Level")); } @@ -107,15 +109,17 @@ void PowerManagementDialog::done(int r) if (r == QDialog::Accepted) { + auto& cfg = emuInstance->getLocalConfig(); + if (nds->ConsoleType == 1) { auto dsi = static_cast(nds); - Config::DSiBatteryLevel = dsi->I2C.GetBPTWL()->GetBatteryLevel(); - Config::DSiBatteryCharging = dsi->I2C.GetBPTWL()->GetBatteryCharging(); + cfg.SetInt("DSi.Battery.Level", dsi->I2C.GetBPTWL()->GetBatteryLevel()); + cfg.SetBool("DSi.Battery.Charging", dsi->I2C.GetBPTWL()->GetBatteryCharging()); } else { - Config::DSBatteryLevelOkay = nds->SPI.GetPowerMan()->GetBatteryLevelOkay(); + cfg.SetBool("DS.Battery.LevelOkay", nds->SPI.GetPowerMan()->GetBatteryLevelOkay()); } } else