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

@ -22,6 +22,7 @@
#include "DSi_I2C.h" #include "DSi_I2C.h"
#include "DSi_Camera.h" #include "DSi_Camera.h"
#include "ARM.h" #include "ARM.h"
#include "SPI.h"
namespace DSi_BPTWL namespace DSi_BPTWL
@ -82,6 +83,19 @@ void DoSavestate(Savestate* file)
u8 GetBootFlag() { return Registers[0x70]; } u8 GetBootFlag() { return Registers[0x70]; }
bool GetBatteryCharging() { return Registers[0x20] >> 7; }
void SetBatteryCharging(bool charging)
{
Registers[0x20] = (((charging ? 0x8 : 0x0) << 4) | (Registers[0x20] & 0x0F));
}
u8 GetBatteryLevel() { return Registers[0x20] & 0xF; }
void SetBatteryLevel(u8 batteryLevel)
{
Registers[0x20] = ((Registers[0x20] & 0xF0) | (batteryLevel & 0x0F));
SPI_Powerman::SetBatteryLevelOkay(batteryLevel > batteryLevel_Low ? true : false);
}
void Start() void Start()
{ {
//printf("BPTWL: start\n"); //printf("BPTWL: start\n");

View File

@ -19,11 +19,28 @@
#ifndef DSI_I2C_H #ifndef DSI_I2C_H
#define DSI_I2C_H #define DSI_I2C_H
#include "types.h"
namespace DSi_BPTWL namespace DSi_BPTWL
{ {
u8 GetBootFlag(); u8 GetBootFlag();
bool GetBatteryCharging();
void SetBatteryCharging(bool charging);
enum
{
batteryLevel_Critical = 0x0,
batteryLevel_AlmostEmpty = 0x1,
batteryLevel_Low = 0x3,
batteryLevel_Half = 0x7,
batteryLevel_ThreeQuarters = 0xB,
batteryLevel_Full = 0xF
};
u8 GetBatteryLevel();
void SetBatteryLevel(u8 batteryLevel);
} }
namespace DSi_I2C namespace DSi_I2C

View File

@ -624,6 +624,9 @@ void Reset()
RegMasks[4] = 0x0F; RegMasks[4] = 0x0F;
} }
bool GetBatteryLevelOkay() { return !Registers[1]; }
void SetBatteryLevelOkay(bool okay) { Registers[1] = okay ? 0x00 : 0x01; }
void DoSavestate(Savestate* file) void DoSavestate(Savestate* file)
{ {
file->Section("SPPW"); file->Section("SPPW");

View File

@ -37,6 +37,14 @@ u8* GetWifiMAC();
} }
namespace SPI_Powerman
{
bool GetBatteryLevelOkay();
void SetBatteryLevelOkay(bool okay);
}
namespace SPI_TSC namespace SPI_TSC
{ {

View File

@ -6,6 +6,8 @@ SET(SOURCES_QT_SDL
CheatsDialog.cpp CheatsDialog.cpp
Config.cpp Config.cpp
EmuSettingsDialog.cpp EmuSettingsDialog.cpp
PowerManagement/PowerManagementDialog.cpp
PowerManagement/resources/battery.qrc
InputConfig/InputConfigDialog.cpp InputConfig/InputConfigDialog.cpp
InputConfig/MapButton.h InputConfig/MapButton.h
InputConfig/resources/ds.qrc InputConfig/resources/ds.qrc

View File

@ -0,0 +1,106 @@
/*
Copyright 2016-2021 Rayyan Ansari
This file is part of melonDS.
melonDS is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with melonDS. If not, see http://www.gnu.org/licenses/.
*/
#include "PowerManagementDialog.h"
#include "ui_PowerManagementDialog.h"
#include "SPI.h"
#include "DSi_I2C.h"
#include "NDS.h"
#include "types.h"
#include <QtDebug>
PowerManagementDialog* PowerManagementDialog::currentDlg = nullptr;
PowerManagementDialog::PowerManagementDialog(QWidget* parent) : QDialog(parent), ui(new Ui::PowerManagementDialog)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
if (NDS::ConsoleType)
ui->grpDSBattery->setEnabled(false);
else
ui->grpDSiBattery->setEnabled(false);
updateDSBatteryLevelControls();
ui->cbDSiBatteryCharging->setChecked(DSi_BPTWL::GetBatteryCharging());
int dsiBatterySliderPos;
switch (DSi_BPTWL::GetBatteryLevel())
{
case DSi_BPTWL::batteryLevel_AlmostEmpty: dsiBatterySliderPos = 0; break;
case DSi_BPTWL::batteryLevel_Low: dsiBatterySliderPos = 1; break;
case DSi_BPTWL::batteryLevel_Half: dsiBatterySliderPos = 2; break;
case DSi_BPTWL::batteryLevel_ThreeQuarters: dsiBatterySliderPos = 3; break;
case DSi_BPTWL::batteryLevel_Full: dsiBatterySliderPos = 4; break;
}
ui->sliderDSiBatteryLevel->setValue(dsiBatterySliderPos);
}
PowerManagementDialog::~PowerManagementDialog()
{
delete ui;
}
void PowerManagementDialog::done(int r)
{
QDialog::done(r);
closeDlg();
}
void PowerManagementDialog::on_rbDSBatteryLow_clicked()
{
SPI_Powerman::SetBatteryLevelOkay(false);
}
void PowerManagementDialog::on_rbDSBatteryOkay_clicked()
{
SPI_Powerman::SetBatteryLevelOkay(true);
}
void PowerManagementDialog::updateDSBatteryLevelControls()
{
if (SPI_Powerman::GetBatteryLevelOkay())
ui->rbDSBatteryOkay->setChecked(true);
else
ui->rbDSBatteryLow->setChecked(true);
}
void PowerManagementDialog::on_cbDSiBatteryCharging_toggled()
{
DSi_BPTWL::SetBatteryCharging(ui->cbDSiBatteryCharging->isChecked());
}
void PowerManagementDialog::on_sliderDSiBatteryLevel_valueChanged(int value)
{
u8 newBatteryLevel;
switch (value)
{
case 0: newBatteryLevel = DSi_BPTWL::batteryLevel_AlmostEmpty; break;
case 1: newBatteryLevel = DSi_BPTWL::batteryLevel_Low; break;
case 2: newBatteryLevel = DSi_BPTWL::batteryLevel_Half; break;
case 3: newBatteryLevel = DSi_BPTWL::batteryLevel_ThreeQuarters; break;
case 4: newBatteryLevel = DSi_BPTWL::batteryLevel_Full; break;
}
DSi_BPTWL::SetBatteryLevel(newBatteryLevel);
updateDSBatteryLevelControls();
}

View File

@ -0,0 +1,69 @@
/*
Copyright 2016-2021 Rayyan Ansari
This file is part of melonDS.
melonDS is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with melonDS. If not, see http://www.gnu.org/licenses/.
*/
#ifndef POWERMANAGEMENTDIALOG_H
#define POWERMANAGEMENTDIALOG_H
#include <QDialog>
#include <QAbstractButton>
namespace Ui { class PowerManagementDialog; }
class PowerManagementDialog;
class PowerManagementDialog : public QDialog
{
Q_OBJECT
public:
explicit PowerManagementDialog(QWidget* parent);
~PowerManagementDialog();
static PowerManagementDialog* currentDlg;
static PowerManagementDialog* openDlg(QWidget* parent)
{
if (currentDlg)
{
currentDlg->activateWindow();
return currentDlg;
}
currentDlg = new PowerManagementDialog(parent);
currentDlg->open();
return currentDlg;
}
static void closeDlg()
{
currentDlg = nullptr;
}
private slots:
void done(int r);
void on_rbDSBatteryLow_clicked();
void on_rbDSBatteryOkay_clicked();
void on_cbDSiBatteryCharging_toggled();
void on_sliderDSiBatteryLevel_valueChanged(int value);
private:
Ui::PowerManagementDialog* ui;
void updateDSBatteryLevelControls();
};
#endif // POWERMANAGEMENTDIALOG_H

View File

@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PowerManagementDialog</class>
<widget class="QDialog" name="PowerManagementDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>562</width>
<height>279</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Power management - melonDS</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="grpDSBattery">
<property name="title">
<string>DS Battery</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<widget class="QRadioButton" name="rbDSBatteryLow">
<property name="text">
<string>Low</string>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Battery Level</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="rbDSBatteryOkay">
<property name="text">
<string>Okay</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="grpDSiBattery">
<property name="title">
<string>DSi Battery</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="1" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Almost Empty</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="5">
<widget class="QCheckBox" name="cbDSiBatteryCharging">
<property name="text">
<string>Charging</string>
</property>
</widget>
</item>
<item row="1" column="8">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Full</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_1">
<property name="text">
<string>Battery Level</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_4">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources/battery.qrc">:/dsibattery/dsi_batteryalmostempty.svg</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLabel" name="label_5">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources/battery.qrc">:/dsibattery/dsi_batterylow.svg</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QLabel" name="label_6">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources/battery.qrc">:/dsibattery/dsi_battery2.svg</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="6">
<widget class="QLabel" name="label_7">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources/battery.qrc">:/dsibattery/dsi_battery3.svg</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="7">
<widget class="QLabel" name="label_8">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources/battery.qrc">:/dsibattery/dsi_batteryfull.svg</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="3" colspan="5">
<widget class="QSlider" name="sliderDSiBatteryLevel">
<property name="maximum">
<number>4</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="resources/battery.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>PowerManagementDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>PowerManagementDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,9 @@
<RCC>
<qresource prefix="dsibattery">
<file>dsi_batteryalmostempty.svg</file>
<file>dsi_batterylow.svg</file>
<file>dsi_battery2.svg</file>
<file>dsi_battery3.svg</file>
<file>dsi_batteryfull.svg</file>
</qresource>
</RCC>

View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="12.236976mm"
height="6.2838535mm"
viewBox="0 0 12.236976 6.283854"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="battery2.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ff8100"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="1"
inkscape:pagecheckerboard="false"
inkscape:document-units="mm"
showgrid="true"
height="200mm"
showborder="true"
inkscape:showpageshadow="false"
borderlayer="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="10.24"
inkscape:cx="2.7832031"
inkscape:cy="2.0507813"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid11"
spacingx="0.26458333"
spacingy="0.26458333"
originx="-91.777345"
originy="-47.128916" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-91.777344,-47.12891)">
<rect
style="fill:#000000;fill-rule:evenodd;stroke-width:0.0211535"
id="rect153"
width="1.3229166"
height="2.9765623"
x="91.777344"
y="48.782555" />
<rect
style="fill:#000000;stroke-width:0.0162915"
id="rect177"
width="10.914062"
height="0.66145831"
x="93.100258"
y="47.12891" />
<rect
style="fill:#000000;stroke-width:0.0165364"
id="rect179"
width="0.66145831"
height="4.9609375"
x="93.100258"
y="47.790367" />
<rect
style="fill:#000000;stroke-width:0.0162915"
id="rect181"
width="10.914062"
height="0.66145873"
x="93.100258"
y="52.751305" />
<rect
style="fill:#000000;stroke-width:0.0165364"
id="rect183"
width="0.66145831"
height="4.9609375"
x="103.35286"
y="47.790367" />
<rect
style="fill:#ffffff;stroke-width:0.0162585"
id="rect318"
width="9.5911455"
height="0.49609375"
x="93.761719"
y="47.790367" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect408"
width="0.49609372"
height="3.96875"
x="93.761719"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.015706"
id="rect410"
width="9.5911455"
height="0.49609351"
x="93.761719"
y="52.255211" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect412"
width="0.4960939"
height="3.9687498"
x="102.85677"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0224686"
id="rect414"
width="0.66145849"
height="3.9687498"
x="95.911453"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect414-3"
width="0.66145885"
height="3.9687498"
x="98.226562"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect414-6"
width="0.66145819"
height="3.9687498"
x="100.54166"
y="48.286461" />
<rect
style="fill:#999999;stroke-width:0.0165364"
id="rect1736"
width="1.6536455"
height="3.9687498"
x="94.257812"
y="48.286461" />
<rect
style="fill:#999999;stroke-width:0.0165364"
id="rect1738"
width="1.6536458"
height="3.96875"
x="96.572914"
y="48.286461" />
<rect
style="fill:#00ccff;stroke-width:0.0165364"
id="rect1740"
width="1.6536458"
height="3.96875"
x="98.888016"
y="48.286461" />
<rect
style="fill:#00ccff;stroke-width:0.0165364"
id="rect1742"
width="1.6536458"
height="3.96875"
x="101.20312"
y="48.286461" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="12.236976mm"
height="6.2838535mm"
viewBox="0 0 12.236976 6.283854"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="battery3.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ff8100"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="1"
inkscape:pagecheckerboard="false"
inkscape:document-units="mm"
showgrid="true"
height="200mm"
showborder="true"
inkscape:showpageshadow="false"
borderlayer="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="10.24"
inkscape:cx="2.7832031"
inkscape:cy="2.0507813"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid11"
spacingx="0.26458333"
spacingy="0.26458333"
originx="-91.777345"
originy="-47.128916" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-91.777344,-47.12891)">
<rect
style="fill:#000000;fill-rule:evenodd;stroke-width:0.0211535"
id="rect153"
width="1.3229166"
height="2.9765623"
x="91.777344"
y="48.782555" />
<rect
style="fill:#000000;stroke-width:0.0162915"
id="rect177"
width="10.914062"
height="0.66145831"
x="93.100258"
y="47.12891" />
<rect
style="fill:#000000;stroke-width:0.0165364"
id="rect179"
width="0.66145831"
height="4.9609375"
x="93.100258"
y="47.790367" />
<rect
style="fill:#000000;stroke-width:0.0162915"
id="rect181"
width="10.914062"
height="0.66145873"
x="93.100258"
y="52.751305" />
<rect
style="fill:#000000;stroke-width:0.0165364"
id="rect183"
width="0.66145831"
height="4.9609375"
x="103.35286"
y="47.790367" />
<rect
style="fill:#ffffff;stroke-width:0.0162585"
id="rect318"
width="9.5911455"
height="0.49609375"
x="93.761719"
y="47.790367" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect408"
width="0.49609372"
height="3.96875"
x="93.761719"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.015706"
id="rect410"
width="9.5911455"
height="0.49609351"
x="93.761719"
y="52.255211" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect412"
width="0.4960939"
height="3.9687498"
x="102.85677"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0224686"
id="rect414"
width="0.66145849"
height="3.9687498"
x="95.911453"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect414-3"
width="0.66145885"
height="3.9687498"
x="98.226562"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect414-6"
width="0.66145819"
height="3.9687498"
x="100.54166"
y="48.286461" />
<rect
style="fill:#999999;stroke-width:0.0165364"
id="rect1736"
width="1.6536455"
height="3.9687498"
x="94.257812"
y="48.286461" />
<rect
style="fill:#00ccff;stroke-width:0.0165364"
id="rect1738"
width="1.6536458"
height="3.96875"
x="96.572914"
y="48.286461" />
<rect
style="fill:#00ccff;stroke-width:0.0165364"
id="rect1740"
width="1.6536458"
height="3.96875"
x="98.888016"
y="48.286461" />
<rect
style="fill:#00ccff;stroke-width:0.0165364"
id="rect1742"
width="1.6536458"
height="3.96875"
x="101.20312"
y="48.286461" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="12.236976mm"
height="6.2838535mm"
viewBox="0 0 12.236976 6.283854"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="dsi_batteryalmostempty.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ff8100"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="1"
inkscape:pagecheckerboard="false"
inkscape:document-units="mm"
showgrid="true"
height="200mm"
showborder="true"
inkscape:showpageshadow="false"
borderlayer="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="14.481547"
inkscape:cx="35.389866"
inkscape:cy="16.503762"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid11"
spacingx="0.26458333"
spacingy="0.26458333"
originx="-91.77735"
originy="-47.128928" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-91.777344,-47.12891)">
<rect
style="fill:#ff2a2a;fill-rule:evenodd;stroke-width:0.0211535"
id="rect153"
width="1.3229166"
height="2.9765623"
x="91.777344"
y="48.782555" />
<rect
style="fill:#ff2a2a;stroke-width:0.0162915"
id="rect177"
width="10.914062"
height="0.66145831"
x="93.100258"
y="47.12891" />
<rect
style="fill:#ff2a2a;stroke-width:0.0165364"
id="rect179"
width="0.66145831"
height="4.9609375"
x="93.100258"
y="47.790367" />
<rect
style="fill:#ff2a2a;stroke-width:0.0162915"
id="rect181"
width="10.914062"
height="0.66145873"
x="93.100258"
y="52.751305" />
<rect
style="fill:#ff2a2a;stroke-width:0.0165364"
id="rect183"
width="0.66145831"
height="4.9609375"
x="103.35286"
y="47.790367" />
<rect
style="fill:#ffffff;stroke-width:0.0162585"
id="rect318"
width="9.5911455"
height="0.49609375"
x="93.761719"
y="47.790367" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect408"
width="0.49609372"
height="3.96875"
x="93.761719"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.015706"
id="rect410"
width="9.5911455"
height="0.49609351"
x="93.761719"
y="52.255211" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect412"
width="0.4960939"
height="3.9687498"
x="102.85677"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0224686"
id="rect414"
width="0.66145849"
height="3.9687498"
x="95.911453"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect414-3"
width="0.66145885"
height="3.9687498"
x="98.226562"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect414-6"
width="0.66145819"
height="3.9687498"
x="100.54166"
y="48.286461" />
<rect
style="fill:#999999;stroke-width:0.0165364"
id="rect1736"
width="1.6536455"
height="3.9687498"
x="94.257812"
y="48.286461" />
<rect
style="fill:#999999;stroke-width:0.0165364"
id="rect1738"
width="1.6536458"
height="3.96875"
x="96.572914"
y="48.286461" />
<rect
style="fill:#999999;stroke-width:0.0165364"
id="rect1740"
width="1.6536458"
height="3.96875"
x="98.888016"
y="48.286461" />
<rect
style="fill:#ff2a2a;stroke-width:0.0165364"
id="rect1742"
width="1.6536458"
height="3.96875"
x="101.20312"
y="48.286461" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="12.236976mm"
height="6.2838535mm"
viewBox="0 0 12.236976 6.283854"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="batteryfull.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ff8100"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="1"
inkscape:pagecheckerboard="false"
inkscape:document-units="mm"
showgrid="true"
height="200mm"
showborder="true"
inkscape:showpageshadow="false"
borderlayer="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="10.24"
inkscape:cx="2.7832031"
inkscape:cy="2.0507813"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid11"
spacingx="0.26458333"
spacingy="0.26458333"
originx="-91.777345"
originy="-47.128916" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-91.777344,-47.12891)">
<rect
style="fill:#000000;fill-rule:evenodd;stroke-width:0.0211535"
id="rect153"
width="1.3229166"
height="2.9765623"
x="91.777344"
y="48.782555" />
<rect
style="fill:#000000;stroke-width:0.0162915"
id="rect177"
width="10.914062"
height="0.66145831"
x="93.100258"
y="47.12891" />
<rect
style="fill:#000000;stroke-width:0.0165364"
id="rect179"
width="0.66145831"
height="4.9609375"
x="93.100258"
y="47.790367" />
<rect
style="fill:#000000;stroke-width:0.0162915"
id="rect181"
width="10.914062"
height="0.66145873"
x="93.100258"
y="52.751305" />
<rect
style="fill:#000000;stroke-width:0.0165364"
id="rect183"
width="0.66145831"
height="4.9609375"
x="103.35286"
y="47.790367" />
<rect
style="fill:#ffffff;stroke-width:0.0162585"
id="rect318"
width="9.5911455"
height="0.49609375"
x="93.761719"
y="47.790367" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect408"
width="0.49609372"
height="3.96875"
x="93.761719"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.015706"
id="rect410"
width="9.5911455"
height="0.49609351"
x="93.761719"
y="52.255211" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect412"
width="0.4960939"
height="3.9687498"
x="102.85677"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0224686"
id="rect414"
width="0.66145849"
height="3.9687498"
x="95.911453"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect414-3"
width="0.66145885"
height="3.9687498"
x="98.226562"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect414-6"
width="0.66145819"
height="3.9687498"
x="100.54166"
y="48.286461" />
<rect
style="fill:#00ccff;stroke-width:0.0165364"
id="rect1736"
width="1.6536455"
height="3.9687498"
x="94.257812"
y="48.286461" />
<rect
style="fill:#00ccff;stroke-width:0.0165364"
id="rect1738"
width="1.6536458"
height="3.96875"
x="96.572914"
y="48.286461" />
<rect
style="fill:#00ccff;stroke-width:0.0165364"
id="rect1740"
width="1.6536458"
height="3.96875"
x="98.888016"
y="48.286461" />
<rect
style="fill:#00ccff;stroke-width:0.0165364"
id="rect1742"
width="1.6536458"
height="3.96875"
x="101.20312"
y="48.286461" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="12.236976mm"
height="6.2838535mm"
viewBox="0 0 12.236976 6.283854"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="batterylow.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ff8100"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="1"
inkscape:pagecheckerboard="false"
inkscape:document-units="mm"
showgrid="true"
height="200mm"
showborder="true"
inkscape:showpageshadow="false"
borderlayer="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="0.45254834"
inkscape:cx="325.93203"
inkscape:cy="232.01941"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid11"
spacingx="0.26458333"
spacingy="0.26458333"
originx="-91.777345"
originy="-47.128916" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-91.777344,-47.12891)">
<rect
style="fill:#000000;fill-rule:evenodd;stroke-width:0.0211535"
id="rect153"
width="1.3229166"
height="2.9765623"
x="91.777344"
y="48.782555" />
<rect
style="fill:#000000;stroke-width:0.0162915"
id="rect177"
width="10.914062"
height="0.66145831"
x="93.100258"
y="47.12891" />
<rect
style="fill:#000000;stroke-width:0.0165364"
id="rect179"
width="0.66145831"
height="4.9609375"
x="93.100258"
y="47.790367" />
<rect
style="fill:#000000;stroke-width:0.0162915"
id="rect181"
width="10.914062"
height="0.66145873"
x="93.100258"
y="52.751305" />
<rect
style="fill:#000000;stroke-width:0.0165364"
id="rect183"
width="0.66145831"
height="4.9609375"
x="103.35286"
y="47.790367" />
<rect
style="fill:#ffffff;stroke-width:0.0162585"
id="rect318"
width="9.5911455"
height="0.49609375"
x="93.761719"
y="47.790367" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect408"
width="0.49609372"
height="3.96875"
x="93.761719"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.015706"
id="rect410"
width="9.5911455"
height="0.49609351"
x="93.761719"
y="52.255211" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect412"
width="0.4960939"
height="3.9687498"
x="102.85677"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0224686"
id="rect414"
width="0.66145849"
height="3.9687498"
x="95.911453"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect414-3"
width="0.66145885"
height="3.9687498"
x="98.226562"
y="48.286461" />
<rect
style="fill:#ffffff;stroke-width:0.0158876"
id="rect414-6"
width="0.66145819"
height="3.9687498"
x="100.54166"
y="48.286461" />
<rect
style="fill:#999999;stroke-width:0.0165364"
id="rect1736"
width="1.6536455"
height="3.9687498"
x="94.257812"
y="48.286461" />
<rect
style="fill:#999999;stroke-width:0.0165364"
id="rect1738"
width="1.6536458"
height="3.96875"
x="96.572914"
y="48.286461" />
<rect
style="fill:#999999;stroke-width:0.0165364"
id="rect1740"
width="1.6536458"
height="3.96875"
x="98.888016"
y="48.286461" />
<rect
style="fill:#ff2a2a;stroke-width:0.0165364"
id="rect1742"
width="1.6536458"
height="3.96875"
x="101.20312"
y="48.286461" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

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

View File

@ -257,6 +257,7 @@ private slots:
void onOpenEmuSettings(); void onOpenEmuSettings();
void onEmuSettingsDialogFinished(int res); void onEmuSettingsDialogFinished(int res);
void onOpenPowerManagement();
void onOpenInputConfig(); void onOpenInputConfig();
void onInputConfigFinished(int res); void onInputConfigFinished(int res);
void onOpenVideoSettings(); void onOpenVideoSettings();
@ -346,6 +347,7 @@ public:
QAction* actTitleManager; QAction* actTitleManager;
QAction* actEmuSettings; QAction* actEmuSettings;
QAction* actPowerManagement;
QAction* actInputConfig; QAction* actInputConfig;
QAction* actVideoSettings; QAction* actVideoSettings;
QAction* actAudioSettings; QAction* actAudioSettings;