2020-05-24 08:29:29 +00:00
|
|
|
//
|
|
|
|
// GuiMenu.cpp
|
|
|
|
//
|
|
|
|
// Main menu.
|
2020-05-24 18:57:07 +00:00
|
|
|
// Some submenus are covered in separate source files.
|
2020-05-24 08:29:29 +00:00
|
|
|
//
|
|
|
|
|
2014-06-25 16:29:58 +00:00
|
|
|
#include "guis/GuiMenu.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
|
|
|
|
#include "components/OptionListComponent.h"
|
|
|
|
#include "components/SliderComponent.h"
|
|
|
|
#include "components/SwitchComponent.h"
|
2017-06-12 16:38:59 +00:00
|
|
|
#include "guis/GuiCollectionSystemsOptions.h"
|
2014-06-25 16:29:58 +00:00
|
|
|
#include "guis/GuiDetectDevice.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "guis/GuiGeneralScreensaverOptions.h"
|
|
|
|
#include "guis/GuiMsgBox.h"
|
2020-06-06 11:10:33 +00:00
|
|
|
#include "guis/GuiScraperMenu.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "guis/GuiSettings.h"
|
2017-11-18 22:23:56 +00:00
|
|
|
#include "views/UIModeController.h"
|
2014-06-25 16:29:58 +00:00
|
|
|
#include "views/ViewController.h"
|
2020-05-24 08:29:29 +00:00
|
|
|
#include "views/gamelist/IGameListView.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "CollectionSystemManager.h"
|
|
|
|
#include "EmulationStation.h"
|
2018-01-30 00:49:08 +00:00
|
|
|
#include "Scripting.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "SystemData.h"
|
2014-06-25 16:29:58 +00:00
|
|
|
#include "VolumeControl.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include <SDL_events.h>
|
Changed Audio settings to be much more flexible
Changed the selectable options for EmulationStation audio mixer
(called AudioDevice in EmulationStation) to be a greater range of
selectable options within Linux and RPi so that it is a lot more
flexible and will work with any aftermarket add-on audio cards and
RPi Audio HATs. Hopefully this gives people the flexibility that
they need in order to avoid the issues people have with unusual RPi
audio setups.
Added the ability to select the audio card as well, by surfacing
the audio card under the Audio Card setting. It was previously forced
to 'default' for all linux users, which was too restrictive in some
instances. This change now adds flexbility to support additional
Linux and RPi Audio Cards.
This option will only be available on Linux (and therefore RPi) as
Windows uses a different audio subsystem.
CHOOSING AUDIO ON LINUX AND RPi
You now select which ALSA Audio Card you want EmulationStation to use
by choosing the relevant AUDIO CARD option. If your one is not listed
then you can add a custom one in the es_settings.cfg file (see below).
You then select which ALSA Audio Mixer Control from that Audio Card
that you want EmulationStation to use, by choosing the relevant
AUDIO DEVICE option. (I kept the name AUDIO DEVICE as that what
EmulationStation previously used to describe an Audio Mixer.)
If your mixer name is not listed then you can add a custom one in
the es_settings.cfg file (see below).
ADDING A CUSTOM AUDIO CARD OR AUDIO DEVICE
In addition I added the ability to manually change the setting in
es_settings.cfg to add anything custom that you want. This will give
advanced users enough extra power that should avoid even the most
strange setups.
Step 1:
To add a custom Audio Card, edit the "AudioCard" setting and replace
the value with the name of your Audio Card. You can find this out by
opening a terminal window and running 'aplay -L'. This will generate a
list of Audio Cards similar to the one below:
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
sysdefault:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Hardware device with all software conversions
Select any one of the Audio Cards listed by using the first word on
the line in your AudioCard settings in the es_settings.cfg, e.g.
<string name="AudioCard" value="default" />
NOTE: If the AudioCard value is not listed, please either close and
reopen EmulationStation (the settings is created upon close if it
doesn't exist), or add it manually to the es_settings.cfg file.
Step 2:
To add a custom Audio Device (mixer), edit the "AudioDevice" setting
and replace the value with the name of your Audio Device. You can get
a list off avilable Audio Devices on the Audio Card by opening a
terminal window and running 'amixer scontrols -D <AudioCard>', where
<AudioCard> is replaced with the name of your Audio Card that you
found in Step 1. This command will generate a list of Audio Devices
(mixers) that you can use in the AudioDevice setting in the
es_settings.cfg file, e.g.
pi@raspberrypi:~ $ amixer scontrols -D default
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0
Select any one of the Simple mixer controls listed by using the
name within the quotes within the AudioDevice setting in your
es_settings.cfg file, e.g.
<string name="AudioDevice" value="Digital" />
Using the example above, the following two settings within the
es_settings.cfg file will use the 'default' Audio Card to play
sounds, and will use the 'Digital' mixer (Audio Device) to
control the volume.
<string name="AudioCard" value="default" />
<string name="AudioDevice" value="Digital" />
NOTE: Any custom manually used settings will be overwritten if you
select any of the other options in the GUI and exit the Sound
Settings window, as the Sound Settings GUI window overwrites the
es_settings.cfg options when you exit the window.
Fix latest package renames
fonts-droid is now fonts-droid-fallback
vlc-nox is now vlc-bin
Fixed up whitespacing to project tab standard
Had not paid enough attention and had accidentally provided
whitespacing in spaces rather than the project standard of
tabs. This change fixes some additional use of spaces to
ensure all the code in the two files now uses tabs.
Vero4k autodetection and volume mixer fix
2018-07-21 09:06:20 +00:00
|
|
|
#include <algorithm>
|
2019-08-08 20:16:11 +00:00
|
|
|
#include "platform.h"
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
GuiMenu::GuiMenu(
|
|
|
|
Window* window)
|
|
|
|
: GuiComponent(window),
|
|
|
|
mMenu(window, "MAIN MENU"),
|
|
|
|
mVersion(window)
|
2014-06-25 16:29:58 +00:00
|
|
|
{
|
2017-11-18 22:23:56 +00:00
|
|
|
bool isFullUI = UIModeController::getInstance()->isUIModeFull();
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2020-06-06 11:10:33 +00:00
|
|
|
if (isFullUI)
|
|
|
|
addEntry("SCRAPER", 0x777777FF, true, [this] { openScraperSettings(); });
|
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
if (isFullUI)
|
2020-05-24 18:57:07 +00:00
|
|
|
addEntry("UI SETTINGS", 0x777777FF, true, [this] { openUISettings(); });
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
addEntry("SOUND SETTINGS", 0x777777FF, true, [this] { openSoundSettings(); });
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
if (isFullUI)
|
2020-05-24 08:29:29 +00:00
|
|
|
addEntry("GAME COLLECTION SETTINGS", 0x777777FF, true, [this] {
|
|
|
|
openCollectionSystemSettings(); });
|
2017-09-08 14:49:47 +00:00
|
|
|
|
|
|
|
if (isFullUI)
|
|
|
|
addEntry("OTHER SETTINGS", 0x777777FF, true, [this] { openOtherSettings(); });
|
|
|
|
|
|
|
|
if (isFullUI)
|
|
|
|
addEntry("CONFIGURE INPUT", 0x777777FF, true, [this] { openConfigInput(); });
|
|
|
|
|
2018-05-10 20:08:04 +00:00
|
|
|
addEntry("QUIT", 0x777777FF, true, [this] {openQuitMenu(); });
|
2017-09-08 14:49:47 +00:00
|
|
|
|
|
|
|
addChild(&mMenu);
|
|
|
|
addVersionInfo();
|
|
|
|
setSize(mMenu.getSize());
|
2020-05-24 08:29:29 +00:00
|
|
|
setPosition((Renderer::getScreenWidth() - mSize.x()) / 2,
|
|
|
|
Renderer::getScreenHeight() * 0.15f);
|
2017-09-08 14:49:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GuiMenu::openScraperSettings()
|
|
|
|
{
|
2020-06-06 11:10:33 +00:00
|
|
|
// Open the scrape menu.
|
|
|
|
mWindow->pushGui(new GuiScraperMenu(mWindow));
|
2017-09-08 14:49:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GuiMenu::openSoundSettings()
|
|
|
|
{
|
|
|
|
auto s = new GuiSettings(mWindow, "SOUND SETTINGS");
|
2017-06-01 20:08:44 +00:00
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
// System volume.
|
2017-09-08 14:49:47 +00:00
|
|
|
auto volume = std::make_shared<SliderComponent>(mWindow, 0.f, 100.f, 1.f, "%");
|
|
|
|
volume->setValue((float)VolumeControl::getInstance()->getVolume());
|
|
|
|
s->addWithLabel("SYSTEM VOLUME", volume);
|
2020-05-24 08:29:29 +00:00
|
|
|
s->addSaveFunc([volume] { VolumeControl::getInstance()->
|
|
|
|
setVolume((int)Math::round(volume->getValue())); });
|
2017-09-08 14:49:47 +00:00
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
if (UIModeController::getInstance()->isUIModeFull()) {
|
2020-05-25 19:34:42 +00:00
|
|
|
#if defined(__linux__)
|
Changed Audio settings to be much more flexible
Changed the selectable options for EmulationStation audio mixer
(called AudioDevice in EmulationStation) to be a greater range of
selectable options within Linux and RPi so that it is a lot more
flexible and will work with any aftermarket add-on audio cards and
RPi Audio HATs. Hopefully this gives people the flexibility that
they need in order to avoid the issues people have with unusual RPi
audio setups.
Added the ability to select the audio card as well, by surfacing
the audio card under the Audio Card setting. It was previously forced
to 'default' for all linux users, which was too restrictive in some
instances. This change now adds flexbility to support additional
Linux and RPi Audio Cards.
This option will only be available on Linux (and therefore RPi) as
Windows uses a different audio subsystem.
CHOOSING AUDIO ON LINUX AND RPi
You now select which ALSA Audio Card you want EmulationStation to use
by choosing the relevant AUDIO CARD option. If your one is not listed
then you can add a custom one in the es_settings.cfg file (see below).
You then select which ALSA Audio Mixer Control from that Audio Card
that you want EmulationStation to use, by choosing the relevant
AUDIO DEVICE option. (I kept the name AUDIO DEVICE as that what
EmulationStation previously used to describe an Audio Mixer.)
If your mixer name is not listed then you can add a custom one in
the es_settings.cfg file (see below).
ADDING A CUSTOM AUDIO CARD OR AUDIO DEVICE
In addition I added the ability to manually change the setting in
es_settings.cfg to add anything custom that you want. This will give
advanced users enough extra power that should avoid even the most
strange setups.
Step 1:
To add a custom Audio Card, edit the "AudioCard" setting and replace
the value with the name of your Audio Card. You can find this out by
opening a terminal window and running 'aplay -L'. This will generate a
list of Audio Cards similar to the one below:
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
sysdefault:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Hardware device with all software conversions
Select any one of the Audio Cards listed by using the first word on
the line in your AudioCard settings in the es_settings.cfg, e.g.
<string name="AudioCard" value="default" />
NOTE: If the AudioCard value is not listed, please either close and
reopen EmulationStation (the settings is created upon close if it
doesn't exist), or add it manually to the es_settings.cfg file.
Step 2:
To add a custom Audio Device (mixer), edit the "AudioDevice" setting
and replace the value with the name of your Audio Device. You can get
a list off avilable Audio Devices on the Audio Card by opening a
terminal window and running 'amixer scontrols -D <AudioCard>', where
<AudioCard> is replaced with the name of your Audio Card that you
found in Step 1. This command will generate a list of Audio Devices
(mixers) that you can use in the AudioDevice setting in the
es_settings.cfg file, e.g.
pi@raspberrypi:~ $ amixer scontrols -D default
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0
Select any one of the Simple mixer controls listed by using the
name within the quotes within the AudioDevice setting in your
es_settings.cfg file, e.g.
<string name="AudioDevice" value="Digital" />
Using the example above, the following two settings within the
es_settings.cfg file will use the 'default' Audio Card to play
sounds, and will use the 'Digital' mixer (Audio Device) to
control the volume.
<string name="AudioCard" value="default" />
<string name="AudioDevice" value="Digital" />
NOTE: Any custom manually used settings will be overwritten if you
select any of the other options in the GUI and exit the Sound
Settings window, as the Sound Settings GUI window overwrites the
es_settings.cfg options when you exit the window.
Fix latest package renames
fonts-droid is now fonts-droid-fallback
vlc-nox is now vlc-bin
Fixed up whitespacing to project tab standard
Had not paid enough attention and had accidentally provided
whitespacing in spaces rather than the project standard of
tabs. This change fixes some additional use of spaces to
ensure all the code in the two files now uses tabs.
Vero4k autodetection and volume mixer fix
2018-07-21 09:06:20 +00:00
|
|
|
// audio card
|
2020-06-07 18:09:02 +00:00
|
|
|
auto audio_card = std::make_shared<OptionListComponent<std::string>>
|
|
|
|
(mWindow, getHelpStyle(), "AUDIO CARD", false);
|
Changed Audio settings to be much more flexible
Changed the selectable options for EmulationStation audio mixer
(called AudioDevice in EmulationStation) to be a greater range of
selectable options within Linux and RPi so that it is a lot more
flexible and will work with any aftermarket add-on audio cards and
RPi Audio HATs. Hopefully this gives people the flexibility that
they need in order to avoid the issues people have with unusual RPi
audio setups.
Added the ability to select the audio card as well, by surfacing
the audio card under the Audio Card setting. It was previously forced
to 'default' for all linux users, which was too restrictive in some
instances. This change now adds flexbility to support additional
Linux and RPi Audio Cards.
This option will only be available on Linux (and therefore RPi) as
Windows uses a different audio subsystem.
CHOOSING AUDIO ON LINUX AND RPi
You now select which ALSA Audio Card you want EmulationStation to use
by choosing the relevant AUDIO CARD option. If your one is not listed
then you can add a custom one in the es_settings.cfg file (see below).
You then select which ALSA Audio Mixer Control from that Audio Card
that you want EmulationStation to use, by choosing the relevant
AUDIO DEVICE option. (I kept the name AUDIO DEVICE as that what
EmulationStation previously used to describe an Audio Mixer.)
If your mixer name is not listed then you can add a custom one in
the es_settings.cfg file (see below).
ADDING A CUSTOM AUDIO CARD OR AUDIO DEVICE
In addition I added the ability to manually change the setting in
es_settings.cfg to add anything custom that you want. This will give
advanced users enough extra power that should avoid even the most
strange setups.
Step 1:
To add a custom Audio Card, edit the "AudioCard" setting and replace
the value with the name of your Audio Card. You can find this out by
opening a terminal window and running 'aplay -L'. This will generate a
list of Audio Cards similar to the one below:
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
sysdefault:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Hardware device with all software conversions
Select any one of the Audio Cards listed by using the first word on
the line in your AudioCard settings in the es_settings.cfg, e.g.
<string name="AudioCard" value="default" />
NOTE: If the AudioCard value is not listed, please either close and
reopen EmulationStation (the settings is created upon close if it
doesn't exist), or add it manually to the es_settings.cfg file.
Step 2:
To add a custom Audio Device (mixer), edit the "AudioDevice" setting
and replace the value with the name of your Audio Device. You can get
a list off avilable Audio Devices on the Audio Card by opening a
terminal window and running 'amixer scontrols -D <AudioCard>', where
<AudioCard> is replaced with the name of your Audio Card that you
found in Step 1. This command will generate a list of Audio Devices
(mixers) that you can use in the AudioDevice setting in the
es_settings.cfg file, e.g.
pi@raspberrypi:~ $ amixer scontrols -D default
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0
Select any one of the Simple mixer controls listed by using the
name within the quotes within the AudioDevice setting in your
es_settings.cfg file, e.g.
<string name="AudioDevice" value="Digital" />
Using the example above, the following two settings within the
es_settings.cfg file will use the 'default' Audio Card to play
sounds, and will use the 'Digital' mixer (Audio Device) to
control the volume.
<string name="AudioCard" value="default" />
<string name="AudioDevice" value="Digital" />
NOTE: Any custom manually used settings will be overwritten if you
select any of the other options in the GUI and exit the Sound
Settings window, as the Sound Settings GUI window overwrites the
es_settings.cfg options when you exit the window.
Fix latest package renames
fonts-droid is now fonts-droid-fallback
vlc-nox is now vlc-bin
Fixed up whitespacing to project tab standard
Had not paid enough attention and had accidentally provided
whitespacing in spaces rather than the project standard of
tabs. This change fixes some additional use of spaces to
ensure all the code in the two files now uses tabs.
Vero4k autodetection and volume mixer fix
2018-07-21 09:06:20 +00:00
|
|
|
std::vector<std::string> audio_cards;
|
2020-05-25 19:34:42 +00:00
|
|
|
#ifdef _RPI_
|
Changed Audio settings to be much more flexible
Changed the selectable options for EmulationStation audio mixer
(called AudioDevice in EmulationStation) to be a greater range of
selectable options within Linux and RPi so that it is a lot more
flexible and will work with any aftermarket add-on audio cards and
RPi Audio HATs. Hopefully this gives people the flexibility that
they need in order to avoid the issues people have with unusual RPi
audio setups.
Added the ability to select the audio card as well, by surfacing
the audio card under the Audio Card setting. It was previously forced
to 'default' for all linux users, which was too restrictive in some
instances. This change now adds flexbility to support additional
Linux and RPi Audio Cards.
This option will only be available on Linux (and therefore RPi) as
Windows uses a different audio subsystem.
CHOOSING AUDIO ON LINUX AND RPi
You now select which ALSA Audio Card you want EmulationStation to use
by choosing the relevant AUDIO CARD option. If your one is not listed
then you can add a custom one in the es_settings.cfg file (see below).
You then select which ALSA Audio Mixer Control from that Audio Card
that you want EmulationStation to use, by choosing the relevant
AUDIO DEVICE option. (I kept the name AUDIO DEVICE as that what
EmulationStation previously used to describe an Audio Mixer.)
If your mixer name is not listed then you can add a custom one in
the es_settings.cfg file (see below).
ADDING A CUSTOM AUDIO CARD OR AUDIO DEVICE
In addition I added the ability to manually change the setting in
es_settings.cfg to add anything custom that you want. This will give
advanced users enough extra power that should avoid even the most
strange setups.
Step 1:
To add a custom Audio Card, edit the "AudioCard" setting and replace
the value with the name of your Audio Card. You can find this out by
opening a terminal window and running 'aplay -L'. This will generate a
list of Audio Cards similar to the one below:
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
sysdefault:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Hardware device with all software conversions
Select any one of the Audio Cards listed by using the first word on
the line in your AudioCard settings in the es_settings.cfg, e.g.
<string name="AudioCard" value="default" />
NOTE: If the AudioCard value is not listed, please either close and
reopen EmulationStation (the settings is created upon close if it
doesn't exist), or add it manually to the es_settings.cfg file.
Step 2:
To add a custom Audio Device (mixer), edit the "AudioDevice" setting
and replace the value with the name of your Audio Device. You can get
a list off avilable Audio Devices on the Audio Card by opening a
terminal window and running 'amixer scontrols -D <AudioCard>', where
<AudioCard> is replaced with the name of your Audio Card that you
found in Step 1. This command will generate a list of Audio Devices
(mixers) that you can use in the AudioDevice setting in the
es_settings.cfg file, e.g.
pi@raspberrypi:~ $ amixer scontrols -D default
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0
Select any one of the Simple mixer controls listed by using the
name within the quotes within the AudioDevice setting in your
es_settings.cfg file, e.g.
<string name="AudioDevice" value="Digital" />
Using the example above, the following two settings within the
es_settings.cfg file will use the 'default' Audio Card to play
sounds, and will use the 'Digital' mixer (Audio Device) to
control the volume.
<string name="AudioCard" value="default" />
<string name="AudioDevice" value="Digital" />
NOTE: Any custom manually used settings will be overwritten if you
select any of the other options in the GUI and exit the Sound
Settings window, as the Sound Settings GUI window overwrites the
es_settings.cfg options when you exit the window.
Fix latest package renames
fonts-droid is now fonts-droid-fallback
vlc-nox is now vlc-bin
Fixed up whitespacing to project tab standard
Had not paid enough attention and had accidentally provided
whitespacing in spaces rather than the project standard of
tabs. This change fixes some additional use of spaces to
ensure all the code in the two files now uses tabs.
Vero4k autodetection and volume mixer fix
2018-07-21 09:06:20 +00:00
|
|
|
// RPi Specific Audio Cards
|
|
|
|
audio_cards.push_back("local");
|
|
|
|
audio_cards.push_back("hdmi");
|
|
|
|
audio_cards.push_back("both");
|
2020-05-25 19:34:42 +00:00
|
|
|
#endif
|
Changed Audio settings to be much more flexible
Changed the selectable options for EmulationStation audio mixer
(called AudioDevice in EmulationStation) to be a greater range of
selectable options within Linux and RPi so that it is a lot more
flexible and will work with any aftermarket add-on audio cards and
RPi Audio HATs. Hopefully this gives people the flexibility that
they need in order to avoid the issues people have with unusual RPi
audio setups.
Added the ability to select the audio card as well, by surfacing
the audio card under the Audio Card setting. It was previously forced
to 'default' for all linux users, which was too restrictive in some
instances. This change now adds flexbility to support additional
Linux and RPi Audio Cards.
This option will only be available on Linux (and therefore RPi) as
Windows uses a different audio subsystem.
CHOOSING AUDIO ON LINUX AND RPi
You now select which ALSA Audio Card you want EmulationStation to use
by choosing the relevant AUDIO CARD option. If your one is not listed
then you can add a custom one in the es_settings.cfg file (see below).
You then select which ALSA Audio Mixer Control from that Audio Card
that you want EmulationStation to use, by choosing the relevant
AUDIO DEVICE option. (I kept the name AUDIO DEVICE as that what
EmulationStation previously used to describe an Audio Mixer.)
If your mixer name is not listed then you can add a custom one in
the es_settings.cfg file (see below).
ADDING A CUSTOM AUDIO CARD OR AUDIO DEVICE
In addition I added the ability to manually change the setting in
es_settings.cfg to add anything custom that you want. This will give
advanced users enough extra power that should avoid even the most
strange setups.
Step 1:
To add a custom Audio Card, edit the "AudioCard" setting and replace
the value with the name of your Audio Card. You can find this out by
opening a terminal window and running 'aplay -L'. This will generate a
list of Audio Cards similar to the one below:
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
sysdefault:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Hardware device with all software conversions
Select any one of the Audio Cards listed by using the first word on
the line in your AudioCard settings in the es_settings.cfg, e.g.
<string name="AudioCard" value="default" />
NOTE: If the AudioCard value is not listed, please either close and
reopen EmulationStation (the settings is created upon close if it
doesn't exist), or add it manually to the es_settings.cfg file.
Step 2:
To add a custom Audio Device (mixer), edit the "AudioDevice" setting
and replace the value with the name of your Audio Device. You can get
a list off avilable Audio Devices on the Audio Card by opening a
terminal window and running 'amixer scontrols -D <AudioCard>', where
<AudioCard> is replaced with the name of your Audio Card that you
found in Step 1. This command will generate a list of Audio Devices
(mixers) that you can use in the AudioDevice setting in the
es_settings.cfg file, e.g.
pi@raspberrypi:~ $ amixer scontrols -D default
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0
Select any one of the Simple mixer controls listed by using the
name within the quotes within the AudioDevice setting in your
es_settings.cfg file, e.g.
<string name="AudioDevice" value="Digital" />
Using the example above, the following two settings within the
es_settings.cfg file will use the 'default' Audio Card to play
sounds, and will use the 'Digital' mixer (Audio Device) to
control the volume.
<string name="AudioCard" value="default" />
<string name="AudioDevice" value="Digital" />
NOTE: Any custom manually used settings will be overwritten if you
select any of the other options in the GUI and exit the Sound
Settings window, as the Sound Settings GUI window overwrites the
es_settings.cfg options when you exit the window.
Fix latest package renames
fonts-droid is now fonts-droid-fallback
vlc-nox is now vlc-bin
Fixed up whitespacing to project tab standard
Had not paid enough attention and had accidentally provided
whitespacing in spaces rather than the project standard of
tabs. This change fixes some additional use of spaces to
ensure all the code in the two files now uses tabs.
Vero4k autodetection and volume mixer fix
2018-07-21 09:06:20 +00:00
|
|
|
audio_cards.push_back("default");
|
|
|
|
audio_cards.push_back("sysdefault");
|
|
|
|
audio_cards.push_back("dmix");
|
|
|
|
audio_cards.push_back("hw");
|
|
|
|
audio_cards.push_back("plughw");
|
|
|
|
audio_cards.push_back("null");
|
|
|
|
if (Settings::getInstance()->getString("AudioCard") != "") {
|
2020-05-24 08:29:29 +00:00
|
|
|
if (std::find(audio_cards.begin(), audio_cards.end(),
|
|
|
|
Settings::getInstance()->getString("AudioCard")) == audio_cards.end()) {
|
Changed Audio settings to be much more flexible
Changed the selectable options for EmulationStation audio mixer
(called AudioDevice in EmulationStation) to be a greater range of
selectable options within Linux and RPi so that it is a lot more
flexible and will work with any aftermarket add-on audio cards and
RPi Audio HATs. Hopefully this gives people the flexibility that
they need in order to avoid the issues people have with unusual RPi
audio setups.
Added the ability to select the audio card as well, by surfacing
the audio card under the Audio Card setting. It was previously forced
to 'default' for all linux users, which was too restrictive in some
instances. This change now adds flexbility to support additional
Linux and RPi Audio Cards.
This option will only be available on Linux (and therefore RPi) as
Windows uses a different audio subsystem.
CHOOSING AUDIO ON LINUX AND RPi
You now select which ALSA Audio Card you want EmulationStation to use
by choosing the relevant AUDIO CARD option. If your one is not listed
then you can add a custom one in the es_settings.cfg file (see below).
You then select which ALSA Audio Mixer Control from that Audio Card
that you want EmulationStation to use, by choosing the relevant
AUDIO DEVICE option. (I kept the name AUDIO DEVICE as that what
EmulationStation previously used to describe an Audio Mixer.)
If your mixer name is not listed then you can add a custom one in
the es_settings.cfg file (see below).
ADDING A CUSTOM AUDIO CARD OR AUDIO DEVICE
In addition I added the ability to manually change the setting in
es_settings.cfg to add anything custom that you want. This will give
advanced users enough extra power that should avoid even the most
strange setups.
Step 1:
To add a custom Audio Card, edit the "AudioCard" setting and replace
the value with the name of your Audio Card. You can find this out by
opening a terminal window and running 'aplay -L'. This will generate a
list of Audio Cards similar to the one below:
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
sysdefault:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Hardware device with all software conversions
Select any one of the Audio Cards listed by using the first word on
the line in your AudioCard settings in the es_settings.cfg, e.g.
<string name="AudioCard" value="default" />
NOTE: If the AudioCard value is not listed, please either close and
reopen EmulationStation (the settings is created upon close if it
doesn't exist), or add it manually to the es_settings.cfg file.
Step 2:
To add a custom Audio Device (mixer), edit the "AudioDevice" setting
and replace the value with the name of your Audio Device. You can get
a list off avilable Audio Devices on the Audio Card by opening a
terminal window and running 'amixer scontrols -D <AudioCard>', where
<AudioCard> is replaced with the name of your Audio Card that you
found in Step 1. This command will generate a list of Audio Devices
(mixers) that you can use in the AudioDevice setting in the
es_settings.cfg file, e.g.
pi@raspberrypi:~ $ amixer scontrols -D default
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0
Select any one of the Simple mixer controls listed by using the
name within the quotes within the AudioDevice setting in your
es_settings.cfg file, e.g.
<string name="AudioDevice" value="Digital" />
Using the example above, the following two settings within the
es_settings.cfg file will use the 'default' Audio Card to play
sounds, and will use the 'Digital' mixer (Audio Device) to
control the volume.
<string name="AudioCard" value="default" />
<string name="AudioDevice" value="Digital" />
NOTE: Any custom manually used settings will be overwritten if you
select any of the other options in the GUI and exit the Sound
Settings window, as the Sound Settings GUI window overwrites the
es_settings.cfg options when you exit the window.
Fix latest package renames
fonts-droid is now fonts-droid-fallback
vlc-nox is now vlc-bin
Fixed up whitespacing to project tab standard
Had not paid enough attention and had accidentally provided
whitespacing in spaces rather than the project standard of
tabs. This change fixes some additional use of spaces to
ensure all the code in the two files now uses tabs.
Vero4k autodetection and volume mixer fix
2018-07-21 09:06:20 +00:00
|
|
|
audio_cards.push_back(Settings::getInstance()->getString("AudioCard"));
|
|
|
|
}
|
|
|
|
}
|
2020-05-24 08:29:29 +00:00
|
|
|
for (auto ac = audio_cards.cbegin(); ac != audio_cards.cend(); ac++)
|
Changed Audio settings to be much more flexible
Changed the selectable options for EmulationStation audio mixer
(called AudioDevice in EmulationStation) to be a greater range of
selectable options within Linux and RPi so that it is a lot more
flexible and will work with any aftermarket add-on audio cards and
RPi Audio HATs. Hopefully this gives people the flexibility that
they need in order to avoid the issues people have with unusual RPi
audio setups.
Added the ability to select the audio card as well, by surfacing
the audio card under the Audio Card setting. It was previously forced
to 'default' for all linux users, which was too restrictive in some
instances. This change now adds flexbility to support additional
Linux and RPi Audio Cards.
This option will only be available on Linux (and therefore RPi) as
Windows uses a different audio subsystem.
CHOOSING AUDIO ON LINUX AND RPi
You now select which ALSA Audio Card you want EmulationStation to use
by choosing the relevant AUDIO CARD option. If your one is not listed
then you can add a custom one in the es_settings.cfg file (see below).
You then select which ALSA Audio Mixer Control from that Audio Card
that you want EmulationStation to use, by choosing the relevant
AUDIO DEVICE option. (I kept the name AUDIO DEVICE as that what
EmulationStation previously used to describe an Audio Mixer.)
If your mixer name is not listed then you can add a custom one in
the es_settings.cfg file (see below).
ADDING A CUSTOM AUDIO CARD OR AUDIO DEVICE
In addition I added the ability to manually change the setting in
es_settings.cfg to add anything custom that you want. This will give
advanced users enough extra power that should avoid even the most
strange setups.
Step 1:
To add a custom Audio Card, edit the "AudioCard" setting and replace
the value with the name of your Audio Card. You can find this out by
opening a terminal window and running 'aplay -L'. This will generate a
list of Audio Cards similar to the one below:
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
sysdefault:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Hardware device with all software conversions
Select any one of the Audio Cards listed by using the first word on
the line in your AudioCard settings in the es_settings.cfg, e.g.
<string name="AudioCard" value="default" />
NOTE: If the AudioCard value is not listed, please either close and
reopen EmulationStation (the settings is created upon close if it
doesn't exist), or add it manually to the es_settings.cfg file.
Step 2:
To add a custom Audio Device (mixer), edit the "AudioDevice" setting
and replace the value with the name of your Audio Device. You can get
a list off avilable Audio Devices on the Audio Card by opening a
terminal window and running 'amixer scontrols -D <AudioCard>', where
<AudioCard> is replaced with the name of your Audio Card that you
found in Step 1. This command will generate a list of Audio Devices
(mixers) that you can use in the AudioDevice setting in the
es_settings.cfg file, e.g.
pi@raspberrypi:~ $ amixer scontrols -D default
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0
Select any one of the Simple mixer controls listed by using the
name within the quotes within the AudioDevice setting in your
es_settings.cfg file, e.g.
<string name="AudioDevice" value="Digital" />
Using the example above, the following two settings within the
es_settings.cfg file will use the 'default' Audio Card to play
sounds, and will use the 'Digital' mixer (Audio Device) to
control the volume.
<string name="AudioCard" value="default" />
<string name="AudioDevice" value="Digital" />
NOTE: Any custom manually used settings will be overwritten if you
select any of the other options in the GUI and exit the Sound
Settings window, as the Sound Settings GUI window overwrites the
es_settings.cfg options when you exit the window.
Fix latest package renames
fonts-droid is now fonts-droid-fallback
vlc-nox is now vlc-bin
Fixed up whitespacing to project tab standard
Had not paid enough attention and had accidentally provided
whitespacing in spaces rather than the project standard of
tabs. This change fixes some additional use of spaces to
ensure all the code in the two files now uses tabs.
Vero4k autodetection and volume mixer fix
2018-07-21 09:06:20 +00:00
|
|
|
audio_card->add(*ac, *ac, Settings::getInstance()->getString("AudioCard") == *ac);
|
|
|
|
s->addWithLabel("AUDIO CARD", audio_card);
|
|
|
|
s->addSaveFunc([audio_card] {
|
|
|
|
Settings::getInstance()->setString("AudioCard", audio_card->getSelected());
|
|
|
|
VolumeControl::getInstance()->deinit();
|
|
|
|
VolumeControl::getInstance()->init();
|
|
|
|
});
|
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
// Volume control device.
|
2020-06-07 18:09:02 +00:00
|
|
|
auto vol_dev = std::make_shared<OptionListComponent<std::string>>
|
|
|
|
(mWindow, getHelpStyle(), "AUDIO DEVICE", false);
|
2017-09-08 14:49:47 +00:00
|
|
|
std::vector<std::string> transitions;
|
|
|
|
transitions.push_back("PCM");
|
|
|
|
transitions.push_back("Speaker");
|
|
|
|
transitions.push_back("Master");
|
Changed Audio settings to be much more flexible
Changed the selectable options for EmulationStation audio mixer
(called AudioDevice in EmulationStation) to be a greater range of
selectable options within Linux and RPi so that it is a lot more
flexible and will work with any aftermarket add-on audio cards and
RPi Audio HATs. Hopefully this gives people the flexibility that
they need in order to avoid the issues people have with unusual RPi
audio setups.
Added the ability to select the audio card as well, by surfacing
the audio card under the Audio Card setting. It was previously forced
to 'default' for all linux users, which was too restrictive in some
instances. This change now adds flexbility to support additional
Linux and RPi Audio Cards.
This option will only be available on Linux (and therefore RPi) as
Windows uses a different audio subsystem.
CHOOSING AUDIO ON LINUX AND RPi
You now select which ALSA Audio Card you want EmulationStation to use
by choosing the relevant AUDIO CARD option. If your one is not listed
then you can add a custom one in the es_settings.cfg file (see below).
You then select which ALSA Audio Mixer Control from that Audio Card
that you want EmulationStation to use, by choosing the relevant
AUDIO DEVICE option. (I kept the name AUDIO DEVICE as that what
EmulationStation previously used to describe an Audio Mixer.)
If your mixer name is not listed then you can add a custom one in
the es_settings.cfg file (see below).
ADDING A CUSTOM AUDIO CARD OR AUDIO DEVICE
In addition I added the ability to manually change the setting in
es_settings.cfg to add anything custom that you want. This will give
advanced users enough extra power that should avoid even the most
strange setups.
Step 1:
To add a custom Audio Card, edit the "AudioCard" setting and replace
the value with the name of your Audio Card. You can find this out by
opening a terminal window and running 'aplay -L'. This will generate a
list of Audio Cards similar to the one below:
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
sysdefault:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Hardware device with all software conversions
Select any one of the Audio Cards listed by using the first word on
the line in your AudioCard settings in the es_settings.cfg, e.g.
<string name="AudioCard" value="default" />
NOTE: If the AudioCard value is not listed, please either close and
reopen EmulationStation (the settings is created upon close if it
doesn't exist), or add it manually to the es_settings.cfg file.
Step 2:
To add a custom Audio Device (mixer), edit the "AudioDevice" setting
and replace the value with the name of your Audio Device. You can get
a list off avilable Audio Devices on the Audio Card by opening a
terminal window and running 'amixer scontrols -D <AudioCard>', where
<AudioCard> is replaced with the name of your Audio Card that you
found in Step 1. This command will generate a list of Audio Devices
(mixers) that you can use in the AudioDevice setting in the
es_settings.cfg file, e.g.
pi@raspberrypi:~ $ amixer scontrols -D default
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0
Select any one of the Simple mixer controls listed by using the
name within the quotes within the AudioDevice setting in your
es_settings.cfg file, e.g.
<string name="AudioDevice" value="Digital" />
Using the example above, the following two settings within the
es_settings.cfg file will use the 'default' Audio Card to play
sounds, and will use the 'Digital' mixer (Audio Device) to
control the volume.
<string name="AudioCard" value="default" />
<string name="AudioDevice" value="Digital" />
NOTE: Any custom manually used settings will be overwritten if you
select any of the other options in the GUI and exit the Sound
Settings window, as the Sound Settings GUI window overwrites the
es_settings.cfg options when you exit the window.
Fix latest package renames
fonts-droid is now fonts-droid-fallback
vlc-nox is now vlc-bin
Fixed up whitespacing to project tab standard
Had not paid enough attention and had accidentally provided
whitespacing in spaces rather than the project standard of
tabs. This change fixes some additional use of spaces to
ensure all the code in the two files now uses tabs.
Vero4k autodetection and volume mixer fix
2018-07-21 09:06:20 +00:00
|
|
|
transitions.push_back("Digital");
|
|
|
|
transitions.push_back("Analogue");
|
|
|
|
if (Settings::getInstance()->getString("AudioDevice") != "") {
|
2020-05-24 08:29:29 +00:00
|
|
|
if (std::find(transitions.begin(), transitions.end(),
|
|
|
|
Settings::getInstance()->getString("AudioDevice")) == transitions.end()) {
|
Changed Audio settings to be much more flexible
Changed the selectable options for EmulationStation audio mixer
(called AudioDevice in EmulationStation) to be a greater range of
selectable options within Linux and RPi so that it is a lot more
flexible and will work with any aftermarket add-on audio cards and
RPi Audio HATs. Hopefully this gives people the flexibility that
they need in order to avoid the issues people have with unusual RPi
audio setups.
Added the ability to select the audio card as well, by surfacing
the audio card under the Audio Card setting. It was previously forced
to 'default' for all linux users, which was too restrictive in some
instances. This change now adds flexbility to support additional
Linux and RPi Audio Cards.
This option will only be available on Linux (and therefore RPi) as
Windows uses a different audio subsystem.
CHOOSING AUDIO ON LINUX AND RPi
You now select which ALSA Audio Card you want EmulationStation to use
by choosing the relevant AUDIO CARD option. If your one is not listed
then you can add a custom one in the es_settings.cfg file (see below).
You then select which ALSA Audio Mixer Control from that Audio Card
that you want EmulationStation to use, by choosing the relevant
AUDIO DEVICE option. (I kept the name AUDIO DEVICE as that what
EmulationStation previously used to describe an Audio Mixer.)
If your mixer name is not listed then you can add a custom one in
the es_settings.cfg file (see below).
ADDING A CUSTOM AUDIO CARD OR AUDIO DEVICE
In addition I added the ability to manually change the setting in
es_settings.cfg to add anything custom that you want. This will give
advanced users enough extra power that should avoid even the most
strange setups.
Step 1:
To add a custom Audio Card, edit the "AudioCard" setting and replace
the value with the name of your Audio Card. You can find this out by
opening a terminal window and running 'aplay -L'. This will generate a
list of Audio Cards similar to the one below:
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
sysdefault:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Hardware device with all software conversions
Select any one of the Audio Cards listed by using the first word on
the line in your AudioCard settings in the es_settings.cfg, e.g.
<string name="AudioCard" value="default" />
NOTE: If the AudioCard value is not listed, please either close and
reopen EmulationStation (the settings is created upon close if it
doesn't exist), or add it manually to the es_settings.cfg file.
Step 2:
To add a custom Audio Device (mixer), edit the "AudioDevice" setting
and replace the value with the name of your Audio Device. You can get
a list off avilable Audio Devices on the Audio Card by opening a
terminal window and running 'amixer scontrols -D <AudioCard>', where
<AudioCard> is replaced with the name of your Audio Card that you
found in Step 1. This command will generate a list of Audio Devices
(mixers) that you can use in the AudioDevice setting in the
es_settings.cfg file, e.g.
pi@raspberrypi:~ $ amixer scontrols -D default
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0
Select any one of the Simple mixer controls listed by using the
name within the quotes within the AudioDevice setting in your
es_settings.cfg file, e.g.
<string name="AudioDevice" value="Digital" />
Using the example above, the following two settings within the
es_settings.cfg file will use the 'default' Audio Card to play
sounds, and will use the 'Digital' mixer (Audio Device) to
control the volume.
<string name="AudioCard" value="default" />
<string name="AudioDevice" value="Digital" />
NOTE: Any custom manually used settings will be overwritten if you
select any of the other options in the GUI and exit the Sound
Settings window, as the Sound Settings GUI window overwrites the
es_settings.cfg options when you exit the window.
Fix latest package renames
fonts-droid is now fonts-droid-fallback
vlc-nox is now vlc-bin
Fixed up whitespacing to project tab standard
Had not paid enough attention and had accidentally provided
whitespacing in spaces rather than the project standard of
tabs. This change fixes some additional use of spaces to
ensure all the code in the two files now uses tabs.
Vero4k autodetection and volume mixer fix
2018-07-21 09:06:20 +00:00
|
|
|
transitions.push_back(Settings::getInstance()->getString("AudioDevice"));
|
|
|
|
}
|
|
|
|
}
|
2020-05-24 08:29:29 +00:00
|
|
|
for (auto it = transitions.cbegin(); it != transitions.cend(); it++)
|
2017-09-08 14:49:47 +00:00
|
|
|
vol_dev->add(*it, *it, Settings::getInstance()->getString("AudioDevice") == *it);
|
|
|
|
s->addWithLabel("AUDIO DEVICE", vol_dev);
|
|
|
|
s->addSaveFunc([vol_dev] {
|
|
|
|
Settings::getInstance()->setString("AudioDevice", vol_dev->getSelected());
|
|
|
|
VolumeControl::getInstance()->deinit();
|
|
|
|
VolumeControl::getInstance()->init();
|
|
|
|
});
|
2020-05-25 19:34:42 +00:00
|
|
|
#endif
|
2017-06-01 20:08:44 +00:00
|
|
|
|
2020-05-25 19:34:42 +00:00
|
|
|
#ifdef _RPI_
|
2017-09-08 14:49:47 +00:00
|
|
|
// OMX player Audio Device
|
2020-06-07 18:09:02 +00:00
|
|
|
auto omx_audio_dev = std::make_shared<OptionListComponent<std::string>>
|
|
|
|
(mWindow, getHelpStyle(), "OMX PLAYER AUDIO DEVICE", false);
|
Changed Audio settings to be much more flexible
Changed the selectable options for EmulationStation audio mixer
(called AudioDevice in EmulationStation) to be a greater range of
selectable options within Linux and RPi so that it is a lot more
flexible and will work with any aftermarket add-on audio cards and
RPi Audio HATs. Hopefully this gives people the flexibility that
they need in order to avoid the issues people have with unusual RPi
audio setups.
Added the ability to select the audio card as well, by surfacing
the audio card under the Audio Card setting. It was previously forced
to 'default' for all linux users, which was too restrictive in some
instances. This change now adds flexbility to support additional
Linux and RPi Audio Cards.
This option will only be available on Linux (and therefore RPi) as
Windows uses a different audio subsystem.
CHOOSING AUDIO ON LINUX AND RPi
You now select which ALSA Audio Card you want EmulationStation to use
by choosing the relevant AUDIO CARD option. If your one is not listed
then you can add a custom one in the es_settings.cfg file (see below).
You then select which ALSA Audio Mixer Control from that Audio Card
that you want EmulationStation to use, by choosing the relevant
AUDIO DEVICE option. (I kept the name AUDIO DEVICE as that what
EmulationStation previously used to describe an Audio Mixer.)
If your mixer name is not listed then you can add a custom one in
the es_settings.cfg file (see below).
ADDING A CUSTOM AUDIO CARD OR AUDIO DEVICE
In addition I added the ability to manually change the setting in
es_settings.cfg to add anything custom that you want. This will give
advanced users enough extra power that should avoid even the most
strange setups.
Step 1:
To add a custom Audio Card, edit the "AudioCard" setting and replace
the value with the name of your Audio Card. You can find this out by
opening a terminal window and running 'aplay -L'. This will generate a
list of Audio Cards similar to the one below:
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
sysdefault:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Hardware device with all software conversions
Select any one of the Audio Cards listed by using the first word on
the line in your AudioCard settings in the es_settings.cfg, e.g.
<string name="AudioCard" value="default" />
NOTE: If the AudioCard value is not listed, please either close and
reopen EmulationStation (the settings is created upon close if it
doesn't exist), or add it manually to the es_settings.cfg file.
Step 2:
To add a custom Audio Device (mixer), edit the "AudioDevice" setting
and replace the value with the name of your Audio Device. You can get
a list off avilable Audio Devices on the Audio Card by opening a
terminal window and running 'amixer scontrols -D <AudioCard>', where
<AudioCard> is replaced with the name of your Audio Card that you
found in Step 1. This command will generate a list of Audio Devices
(mixers) that you can use in the AudioDevice setting in the
es_settings.cfg file, e.g.
pi@raspberrypi:~ $ amixer scontrols -D default
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0
Select any one of the Simple mixer controls listed by using the
name within the quotes within the AudioDevice setting in your
es_settings.cfg file, e.g.
<string name="AudioDevice" value="Digital" />
Using the example above, the following two settings within the
es_settings.cfg file will use the 'default' Audio Card to play
sounds, and will use the 'Digital' mixer (Audio Device) to
control the volume.
<string name="AudioCard" value="default" />
<string name="AudioDevice" value="Digital" />
NOTE: Any custom manually used settings will be overwritten if you
select any of the other options in the GUI and exit the Sound
Settings window, as the Sound Settings GUI window overwrites the
es_settings.cfg options when you exit the window.
Fix latest package renames
fonts-droid is now fonts-droid-fallback
vlc-nox is now vlc-bin
Fixed up whitespacing to project tab standard
Had not paid enough attention and had accidentally provided
whitespacing in spaces rather than the project standard of
tabs. This change fixes some additional use of spaces to
ensure all the code in the two files now uses tabs.
Vero4k autodetection and volume mixer fix
2018-07-21 09:06:20 +00:00
|
|
|
std::vector<std::string> omx_cards;
|
|
|
|
// RPi Specific Audio Cards
|
|
|
|
omx_cards.push_back("local");
|
|
|
|
omx_cards.push_back("hdmi");
|
|
|
|
omx_cards.push_back("both");
|
|
|
|
omx_cards.push_back("alsa:hw:0,0");
|
|
|
|
omx_cards.push_back("alsa:hw:1,0");
|
|
|
|
if (Settings::getInstance()->getString("OMXAudioDev") != "") {
|
2020-05-24 08:29:29 +00:00
|
|
|
if (std::find(omx_cards.begin(), omx_cards.end(),
|
|
|
|
Settings::getInstance()->getString("OMXAudioDev")) == omx_cards.end()) {
|
Changed Audio settings to be much more flexible
Changed the selectable options for EmulationStation audio mixer
(called AudioDevice in EmulationStation) to be a greater range of
selectable options within Linux and RPi so that it is a lot more
flexible and will work with any aftermarket add-on audio cards and
RPi Audio HATs. Hopefully this gives people the flexibility that
they need in order to avoid the issues people have with unusual RPi
audio setups.
Added the ability to select the audio card as well, by surfacing
the audio card under the Audio Card setting. It was previously forced
to 'default' for all linux users, which was too restrictive in some
instances. This change now adds flexbility to support additional
Linux and RPi Audio Cards.
This option will only be available on Linux (and therefore RPi) as
Windows uses a different audio subsystem.
CHOOSING AUDIO ON LINUX AND RPi
You now select which ALSA Audio Card you want EmulationStation to use
by choosing the relevant AUDIO CARD option. If your one is not listed
then you can add a custom one in the es_settings.cfg file (see below).
You then select which ALSA Audio Mixer Control from that Audio Card
that you want EmulationStation to use, by choosing the relevant
AUDIO DEVICE option. (I kept the name AUDIO DEVICE as that what
EmulationStation previously used to describe an Audio Mixer.)
If your mixer name is not listed then you can add a custom one in
the es_settings.cfg file (see below).
ADDING A CUSTOM AUDIO CARD OR AUDIO DEVICE
In addition I added the ability to manually change the setting in
es_settings.cfg to add anything custom that you want. This will give
advanced users enough extra power that should avoid even the most
strange setups.
Step 1:
To add a custom Audio Card, edit the "AudioCard" setting and replace
the value with the name of your Audio Card. You can find this out by
opening a terminal window and running 'aplay -L'. This will generate a
list of Audio Cards similar to the one below:
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
sysdefault:CARD=sndrpijustboomd
snd_rpi_justboom_dac,
Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
snd_rpi_justboom_dac,
Hardware device with all software conversions
Select any one of the Audio Cards listed by using the first word on
the line in your AudioCard settings in the es_settings.cfg, e.g.
<string name="AudioCard" value="default" />
NOTE: If the AudioCard value is not listed, please either close and
reopen EmulationStation (the settings is created upon close if it
doesn't exist), or add it manually to the es_settings.cfg file.
Step 2:
To add a custom Audio Device (mixer), edit the "AudioDevice" setting
and replace the value with the name of your Audio Device. You can get
a list off avilable Audio Devices on the Audio Card by opening a
terminal window and running 'amixer scontrols -D <AudioCard>', where
<AudioCard> is replaced with the name of your Audio Card that you
found in Step 1. This command will generate a list of Audio Devices
(mixers) that you can use in the AudioDevice setting in the
es_settings.cfg file, e.g.
pi@raspberrypi:~ $ amixer scontrols -D default
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0
Select any one of the Simple mixer controls listed by using the
name within the quotes within the AudioDevice setting in your
es_settings.cfg file, e.g.
<string name="AudioDevice" value="Digital" />
Using the example above, the following two settings within the
es_settings.cfg file will use the 'default' Audio Card to play
sounds, and will use the 'Digital' mixer (Audio Device) to
control the volume.
<string name="AudioCard" value="default" />
<string name="AudioDevice" value="Digital" />
NOTE: Any custom manually used settings will be overwritten if you
select any of the other options in the GUI and exit the Sound
Settings window, as the Sound Settings GUI window overwrites the
es_settings.cfg options when you exit the window.
Fix latest package renames
fonts-droid is now fonts-droid-fallback
vlc-nox is now vlc-bin
Fixed up whitespacing to project tab standard
Had not paid enough attention and had accidentally provided
whitespacing in spaces rather than the project standard of
tabs. This change fixes some additional use of spaces to
ensure all the code in the two files now uses tabs.
Vero4k autodetection and volume mixer fix
2018-07-21 09:06:20 +00:00
|
|
|
omx_cards.push_back(Settings::getInstance()->getString("OMXAudioDev"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (auto it = omx_cards.cbegin(); it != omx_cards.cend(); it++)
|
2017-09-08 14:49:47 +00:00
|
|
|
omx_audio_dev->add(*it, *it, Settings::getInstance()->getString("OMXAudioDev") == *it);
|
|
|
|
s->addWithLabel("OMX PLAYER AUDIO DEVICE", omx_audio_dev);
|
|
|
|
s->addSaveFunc([omx_audio_dev] {
|
|
|
|
if (Settings::getInstance()->getString("OMXAudioDev") != omx_audio_dev->getSelected())
|
|
|
|
Settings::getInstance()->setString("OMXAudioDev", omx_audio_dev->getSelected());
|
|
|
|
});
|
2020-05-25 19:34:42 +00:00
|
|
|
#endif
|
2020-06-06 11:10:33 +00:00
|
|
|
|
|
|
|
// Video audio.
|
|
|
|
auto video_audio = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
video_audio->setState(Settings::getInstance()->getBool("VideoAudio"));
|
|
|
|
s->addWithLabel("ENABLE AUDIO FOR VIDEO FILES", video_audio);
|
|
|
|
s->addSaveFunc([video_audio] { Settings::getInstance()->setBool("VideoAudio",
|
|
|
|
video_audio->getState()); });
|
|
|
|
|
|
|
|
// Navigation sounds.
|
|
|
|
auto sounds_enabled = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
sounds_enabled->setState(Settings::getInstance()->getBool("EnableSounds"));
|
|
|
|
s->addWithLabel("ENABLE NAVIGATION SOUNDS", sounds_enabled);
|
|
|
|
s->addSaveFunc([sounds_enabled] {
|
|
|
|
if (sounds_enabled->getState() &&
|
|
|
|
!Settings::getInstance()->getBool("EnableSounds") &&
|
|
|
|
PowerSaver::getMode() == PowerSaver::INSTANT) {
|
|
|
|
Settings::getInstance()->setString("PowerSaverMode", "default");
|
|
|
|
PowerSaver::init();
|
|
|
|
}
|
|
|
|
Settings::getInstance()->setBool("EnableSounds", sounds_enabled->getState());
|
|
|
|
});
|
2017-09-08 14:49:47 +00:00
|
|
|
}
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
mWindow->pushGui(s);
|
|
|
|
}
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
void GuiMenu::openUISettings()
|
|
|
|
{
|
|
|
|
auto s = new GuiSettings(mWindow, "UI SETTINGS");
|
|
|
|
|
2020-05-24 18:57:07 +00:00
|
|
|
// Optionally start in selected system/gamelist.
|
2020-06-07 18:09:02 +00:00
|
|
|
auto systemfocus_list = std::make_shared<OptionListComponent<std::string>>
|
|
|
|
(mWindow, getHelpStyle(), "GAMELIST ON STARTUP", false);
|
2020-05-24 18:57:07 +00:00
|
|
|
systemfocus_list->add("NONE", "", Settings::getInstance()->getString("StartupSystem") == "");
|
|
|
|
for (auto it = SystemData::sSystemVector.cbegin();
|
|
|
|
it != SystemData::sSystemVector.cend(); it++) {
|
|
|
|
if ("retropie" != (*it)->getName())
|
|
|
|
systemfocus_list->add((*it)->getName(), (*it)->getName(),
|
|
|
|
Settings::getInstance()->getString("StartupSystem") == (*it)->getName());
|
|
|
|
}
|
|
|
|
s->addWithLabel("GAMELIST TO SHOW ON STARTUP", systemfocus_list);
|
|
|
|
s->addSaveFunc([systemfocus_list] {
|
|
|
|
Settings::getInstance()->setString("StartupSystem", systemfocus_list->getSelected());
|
2020-05-15 15:51:32 +00:00
|
|
|
});
|
|
|
|
|
2020-05-24 18:57:07 +00:00
|
|
|
// GameList view style.
|
2020-06-07 18:09:02 +00:00
|
|
|
auto gamelist_style = std::make_shared<OptionListComponent<std::string>>
|
|
|
|
(mWindow, getHelpStyle(), "GAMELIST VIEW STYLE", false);
|
2020-05-24 18:57:07 +00:00
|
|
|
std::vector<std::string> styles;
|
|
|
|
styles.push_back("automatic");
|
|
|
|
styles.push_back("basic");
|
|
|
|
styles.push_back("detailed");
|
|
|
|
styles.push_back("video");
|
|
|
|
styles.push_back("grid");
|
2017-09-08 14:49:47 +00:00
|
|
|
|
2020-05-24 18:57:07 +00:00
|
|
|
for (auto it = styles.cbegin(); it != styles.cend(); it++)
|
|
|
|
gamelist_style->add(*it, *it, Settings::getInstance()->
|
|
|
|
getString("GamelistViewStyle") == *it);
|
|
|
|
s->addWithLabel("GAMELIST VIEW STYLE", gamelist_style);
|
|
|
|
s->addSaveFunc([gamelist_style] {
|
|
|
|
bool needReload = false;
|
|
|
|
if (Settings::getInstance()->getString("GamelistViewStyle") !=
|
|
|
|
gamelist_style->getSelected())
|
|
|
|
needReload = true;
|
|
|
|
Settings::getInstance()->setString("GamelistViewStyle", gamelist_style->getSelected());
|
|
|
|
if (needReload)
|
|
|
|
ViewController::get()->reloadAll();
|
2017-09-08 14:49:47 +00:00
|
|
|
});
|
2017-06-01 20:08:44 +00:00
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
// Transition style.
|
2020-06-07 18:09:02 +00:00
|
|
|
auto transition_style = std::make_shared<OptionListComponent<std::string>>
|
|
|
|
(mWindow, getHelpStyle(), "TRANSITION STYLE", false);
|
2017-09-08 14:49:47 +00:00
|
|
|
std::vector<std::string> transitions;
|
|
|
|
transitions.push_back("fade");
|
|
|
|
transitions.push_back("slide");
|
|
|
|
transitions.push_back("instant");
|
2020-05-24 08:29:29 +00:00
|
|
|
for (auto it = transitions.cbegin(); it != transitions.cend(); it++)
|
|
|
|
transition_style->add(*it, *it, Settings::getInstance()->
|
|
|
|
getString("TransitionStyle") == *it);
|
2017-09-08 14:49:47 +00:00
|
|
|
s->addWithLabel("TRANSITION STYLE", transition_style);
|
|
|
|
s->addSaveFunc([transition_style] {
|
2020-06-06 11:10:33 +00:00
|
|
|
if (Settings::getInstance()->getString("TransitionStyle") == "instant" &&
|
|
|
|
transition_style->getSelected() != "instant" &&
|
|
|
|
PowerSaver::getMode() == PowerSaver::INSTANT) {
|
2017-09-08 14:49:47 +00:00
|
|
|
Settings::getInstance()->setString("PowerSaverMode", "default");
|
|
|
|
PowerSaver::init();
|
|
|
|
}
|
|
|
|
Settings::getInstance()->setString("TransitionStyle", transition_style->getSelected());
|
2014-06-25 16:29:58 +00:00
|
|
|
});
|
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
// Theme selection.
|
2017-09-08 14:49:47 +00:00
|
|
|
auto themeSets = ThemeData::getThemeSets();
|
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
if (!themeSets.empty())
|
2017-09-08 14:49:47 +00:00
|
|
|
{
|
2020-05-24 08:29:29 +00:00
|
|
|
std::map<std::string, ThemeSet>::const_iterator selectedSet =
|
|
|
|
themeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
|
|
|
if (selectedSet == themeSets.cend())
|
2017-11-11 14:56:22 +00:00
|
|
|
selectedSet = themeSets.cbegin();
|
2017-09-08 14:49:47 +00:00
|
|
|
|
2020-06-07 18:09:02 +00:00
|
|
|
auto theme_set = std::make_shared<OptionListComponent<std::string>>
|
|
|
|
(mWindow, getHelpStyle(), "THEME SET", false);
|
2020-05-24 08:29:29 +00:00
|
|
|
for (auto it = themeSets.cbegin(); it != themeSets.cend(); it++)
|
2017-09-08 14:49:47 +00:00
|
|
|
theme_set->add(it->first, it->first, it == selectedSet);
|
|
|
|
s->addWithLabel("THEME SET", theme_set);
|
|
|
|
|
|
|
|
Window* window = mWindow;
|
2020-05-24 08:29:29 +00:00
|
|
|
s->addSaveFunc([window, theme_set] {
|
2017-09-08 14:49:47 +00:00
|
|
|
bool needReload = false;
|
2018-01-30 00:49:08 +00:00
|
|
|
std::string oldTheme = Settings::getInstance()->getString("ThemeSet");
|
2020-05-24 08:29:29 +00:00
|
|
|
if (oldTheme != theme_set->getSelected())
|
2017-09-08 14:49:47 +00:00
|
|
|
needReload = true;
|
|
|
|
|
|
|
|
Settings::getInstance()->setString("ThemeSet", theme_set->getSelected());
|
|
|
|
|
2020-06-06 11:10:33 +00:00
|
|
|
if (needReload) {
|
2018-01-30 00:49:08 +00:00
|
|
|
Scripting::fireEvent("theme-changed", theme_set->getSelected(), oldTheme);
|
2017-09-08 14:49:47 +00:00
|
|
|
CollectionSystemManager::get()->updateSystemsList();
|
2018-03-15 20:46:09 +00:00
|
|
|
ViewController::get()->goToStart();
|
2020-05-24 08:29:29 +00:00
|
|
|
// TODO - replace this with some sort of signal-based implementation.
|
|
|
|
ViewController::get()->reloadAll();
|
2017-09-08 14:49:47 +00:00
|
|
|
}
|
2017-06-12 16:38:59 +00:00
|
|
|
});
|
2017-09-08 14:49:47 +00:00
|
|
|
}
|
|
|
|
|
2020-05-24 18:57:07 +00:00
|
|
|
// UI mode.
|
2020-06-07 18:09:02 +00:00
|
|
|
auto UImodeSelection = std::make_shared<OptionListComponent<std::string>>
|
|
|
|
(mWindow, getHelpStyle(), "UI MODE", false);
|
2020-05-24 18:57:07 +00:00
|
|
|
std::vector<std::string> UImodes = UIModeController::getInstance()->getUIModes();
|
|
|
|
for (auto it = UImodes.cbegin(); it != UImodes.cend(); it++)
|
|
|
|
UImodeSelection->add(*it, *it, Settings::getInstance()->getString("UIMode") == *it);
|
|
|
|
s->addWithLabel("UI MODE", UImodeSelection);
|
|
|
|
Window* window = mWindow;
|
2020-06-07 18:09:02 +00:00
|
|
|
s->addSaveFunc([ UImodeSelection, window, this] {
|
2020-05-24 18:57:07 +00:00
|
|
|
std::string selectedMode = UImodeSelection->getSelected();
|
|
|
|
if (selectedMode != "Full") {
|
|
|
|
std::string msg = "You are changing the UI to a restricted mode:\n" +
|
|
|
|
selectedMode + "\n";
|
|
|
|
msg += "This will hide most menu-options to prevent changes to the system.\n";
|
|
|
|
msg += "To unlock and return to the full UI, enter this code: \n";
|
|
|
|
msg += "\"" + UIModeController::getInstance()->getFormattedPassKeyStr() + "\"\n\n";
|
|
|
|
msg += "Do you want to proceed?";
|
2020-06-07 18:09:02 +00:00
|
|
|
window->pushGui(new GuiMsgBox(window, this->getHelpStyle(), msg,
|
2020-05-24 18:57:07 +00:00
|
|
|
"YES", [selectedMode] {
|
|
|
|
LOG(LogDebug) << "Setting UI mode to " << selectedMode;
|
|
|
|
Settings::getInstance()->setString("UIMode", selectedMode);
|
|
|
|
Settings::getInstance()->saveFile();
|
|
|
|
}, "NO",nullptr));
|
|
|
|
}
|
2018-05-10 20:08:04 +00:00
|
|
|
});
|
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
// Sort favorites on top of the gamelists.
|
2020-05-15 15:42:36 +00:00
|
|
|
auto favoritesFirstSwitch = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
favoritesFirstSwitch->setState(Settings::getInstance()->getBool("FavoritesFirst"));
|
2020-05-24 08:29:29 +00:00
|
|
|
s->addWithLabel("SORT FAVORITES ON TOP OF GAMELISTS", favoritesFirstSwitch);
|
|
|
|
s->addSaveFunc([favoritesFirstSwitch] {
|
2020-05-15 15:42:36 +00:00
|
|
|
if (Settings::getInstance()->setBool("FavoritesFirst", favoritesFirstSwitch->getState()))
|
2020-05-24 08:29:29 +00:00
|
|
|
for (auto it = SystemData::sSystemVector.cbegin(); it !=
|
|
|
|
SystemData::sSystemVector.cend(); it++) {
|
|
|
|
// The favorites and recent gamelists never sort favorites on top.
|
2020-05-24 12:26:08 +00:00
|
|
|
if ((*it)->getName() == "favorites" || (*it)->getName() == "recent" ||
|
|
|
|
(*it)->getName() == "collections")
|
2020-05-24 08:29:29 +00:00
|
|
|
continue;
|
|
|
|
// Don't re-sort custom collections as they have their own option
|
|
|
|
// for whether to sort favorites on top or not (FavFirstCustom).
|
|
|
|
if (CollectionSystemManager::get()->getIsCustomCollection((*it)))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
FileData* rootFolder = (*it)->getRootFolder();
|
|
|
|
rootFolder->sort(getSortTypeFromString(rootFolder->getSortTypeString()),
|
|
|
|
Settings::getInstance()->getBool("FavoritesFirst"));
|
|
|
|
ViewController::get()->reloadGameListView(*it);
|
|
|
|
|
2020-05-24 18:57:07 +00:00
|
|
|
// Jump to the first row of the gamelist.
|
2020-05-24 08:29:29 +00:00
|
|
|
IGameListView* gameList = ViewController::get()->getGameListView((*it)).get();
|
|
|
|
FileData* firstRow = gameList->getCursor()->getParent()->getChildrenListToDisplay()[0];
|
|
|
|
gameList->setCursor(firstRow);
|
|
|
|
}
|
2020-05-15 15:42:36 +00:00
|
|
|
});
|
|
|
|
|
2020-05-24 18:57:07 +00:00
|
|
|
// Enable filters (ForceDisableFilters).
|
|
|
|
auto enable_filter = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
enable_filter->setState(!Settings::getInstance()->getBool("ForceDisableFilters"));
|
|
|
|
s->addWithLabel("ENABLE GAMELIST FILTERS", enable_filter);
|
|
|
|
s->addSaveFunc([enable_filter] {
|
|
|
|
bool filter_is_enabled = !Settings::getInstance()->getBool("ForceDisableFilters");
|
|
|
|
Settings::getInstance()->setBool("ForceDisableFilters", !enable_filter->getState());
|
|
|
|
if (enable_filter->getState() != filter_is_enabled)
|
|
|
|
ViewController::get()->ReloadAndGoToStart();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Quick system select (left/right in game list view).
|
|
|
|
auto quick_sys_select = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
quick_sys_select->setState(Settings::getInstance()->getBool("QuickSystemSelect"));
|
|
|
|
s->addWithLabel("QUICK SYSTEM SELECT", quick_sys_select);
|
|
|
|
s->addSaveFunc([quick_sys_select] { Settings::getInstance()->setBool("QuickSystemSelect",
|
|
|
|
quick_sys_select->getState()); });
|
|
|
|
|
|
|
|
// Carousel transition option.
|
|
|
|
auto move_carousel = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
move_carousel->setState(Settings::getInstance()->getBool("MoveCarousel"));
|
|
|
|
s->addWithLabel("CAROUSEL TRANSITIONS", move_carousel);
|
|
|
|
s->addSaveFunc([move_carousel] {
|
2020-06-06 11:10:33 +00:00
|
|
|
if (move_carousel->getState() &&
|
|
|
|
!Settings::getInstance()->getBool("MoveCarousel") &&
|
|
|
|
PowerSaver::getMode() == PowerSaver::INSTANT) {
|
2020-05-24 18:57:07 +00:00
|
|
|
Settings::getInstance()->setString("PowerSaverMode", "default");
|
|
|
|
PowerSaver::init();
|
|
|
|
}
|
|
|
|
Settings::getInstance()->setBool("MoveCarousel", move_carousel->getState());
|
|
|
|
});
|
|
|
|
|
|
|
|
// Hide start menu in Kid Mode.
|
|
|
|
auto disable_start = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
disable_start->setState(Settings::getInstance()->getBool("DisableKidStartMenu"));
|
|
|
|
s->addWithLabel("DISABLE START MENU IN KID MODE", disable_start);
|
|
|
|
s->addSaveFunc([disable_start] { Settings::getInstance()->setBool("DisableKidStartMenu",
|
|
|
|
disable_start->getState()); });
|
|
|
|
|
|
|
|
// Show help.
|
|
|
|
auto show_help = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
show_help->setState(Settings::getInstance()->getBool("ShowHelpPrompts"));
|
|
|
|
s->addWithLabel("ON-SCREEN HELP", show_help);
|
|
|
|
s->addSaveFunc([show_help] { Settings::getInstance()->setBool("ShowHelpPrompts",
|
|
|
|
show_help->getState()); });
|
|
|
|
|
|
|
|
// Screensaver.
|
|
|
|
ComponentListRow screensaver_row;
|
|
|
|
screensaver_row.elements.clear();
|
|
|
|
screensaver_row.addElement(std::make_shared<TextComponent>
|
|
|
|
(mWindow, "SCREENSAVER SETTINGS", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
|
|
|
|
screensaver_row.addElement(makeArrow(mWindow), false);
|
|
|
|
screensaver_row.makeAcceptInputHandler(std::bind(&GuiMenu::openScreensaverOptions, this));
|
|
|
|
s->addRow(screensaver_row);
|
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
mWindow->pushGui(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GuiMenu::openOtherSettings()
|
|
|
|
{
|
|
|
|
auto s = new GuiSettings(mWindow, "OTHER SETTINGS");
|
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
// Maximum VRAM.
|
2017-09-08 14:49:47 +00:00
|
|
|
auto max_vram = std::make_shared<SliderComponent>(mWindow, 0.f, 1000.f, 10.f, "Mb");
|
|
|
|
max_vram->setValue((float)(Settings::getInstance()->getInt("MaxVRAM")));
|
|
|
|
s->addWithLabel("VRAM LIMIT", max_vram);
|
2020-05-24 08:29:29 +00:00
|
|
|
s->addSaveFunc([max_vram] { Settings::getInstance()->setInt("MaxVRAM",
|
|
|
|
(int)Math::round(max_vram->getValue())); });
|
2017-09-08 14:49:47 +00:00
|
|
|
|
2020-05-24 18:57:07 +00:00
|
|
|
// Fullscreen mode.
|
2020-06-07 18:09:02 +00:00
|
|
|
auto fullscreen_mode = std::make_shared<OptionListComponent<std::string>>
|
|
|
|
(mWindow, getHelpStyle(), "FULLSCREEN MODE", false);
|
2020-05-24 18:57:07 +00:00
|
|
|
std::vector<std::string> screenmode;
|
|
|
|
screenmode.push_back("normal");
|
|
|
|
screenmode.push_back("borderless");
|
|
|
|
for (auto it = screenmode.cbegin(); it != screenmode.cend(); it++)
|
|
|
|
fullscreen_mode->add(*it, *it, Settings::getInstance()->getString("FullscreenMode") == *it);
|
|
|
|
s->addWithLabel("FULLSCREEN MODE (REQUIRES RESTART)", fullscreen_mode);
|
|
|
|
s->addSaveFunc([fullscreen_mode] {
|
2020-06-06 11:10:33 +00:00
|
|
|
if (Settings::getInstance()->getString("FullscreenMode") == "normal" &&
|
|
|
|
fullscreen_mode->getSelected() != "normal") {
|
2020-05-24 18:57:07 +00:00
|
|
|
Settings::getInstance()->setString("PowerSaverMode", "default");
|
|
|
|
PowerSaver::init();
|
|
|
|
}
|
|
|
|
Settings::getInstance()->setString("FullscreenMode", fullscreen_mode->getSelected());
|
|
|
|
});
|
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
// Power saver.
|
2020-06-07 18:09:02 +00:00
|
|
|
auto power_saver = std::make_shared<OptionListComponent<std::string>>
|
|
|
|
(mWindow, getHelpStyle(), "POWER SAVER MODES", false);
|
2017-09-08 14:49:47 +00:00
|
|
|
std::vector<std::string> modes;
|
|
|
|
modes.push_back("disabled");
|
|
|
|
modes.push_back("default");
|
|
|
|
modes.push_back("enhanced");
|
|
|
|
modes.push_back("instant");
|
2017-11-11 14:56:22 +00:00
|
|
|
for (auto it = modes.cbegin(); it != modes.cend(); it++)
|
2017-09-08 14:49:47 +00:00
|
|
|
power_saver->add(*it, *it, Settings::getInstance()->getString("PowerSaverMode") == *it);
|
|
|
|
s->addWithLabel("POWER SAVER MODES", power_saver);
|
|
|
|
s->addSaveFunc([this, power_saver] {
|
2020-05-24 08:29:29 +00:00
|
|
|
if (Settings::getInstance()->getString("PowerSaverMode") !=
|
|
|
|
"instant" && power_saver->getSelected() == "instant") {
|
2017-09-08 14:49:47 +00:00
|
|
|
Settings::getInstance()->setString("TransitionStyle", "instant");
|
|
|
|
Settings::getInstance()->setBool("MoveCarousel", false);
|
2017-09-14 03:45:28 +00:00
|
|
|
Settings::getInstance()->setBool("EnableSounds", false);
|
2017-09-08 14:49:47 +00:00
|
|
|
}
|
|
|
|
Settings::getInstance()->setString("PowerSaverMode", power_saver->getSelected());
|
|
|
|
PowerSaver::init();
|
|
|
|
});
|
2017-08-02 19:56:33 +00:00
|
|
|
|
2020-05-25 19:34:42 +00:00
|
|
|
#ifdef _RPI_
|
|
|
|
// Video Player - VideoOmxPlayer.
|
|
|
|
auto omx_player = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
omx_player->setState(Settings::getInstance()->getBool("VideoOmxPlayer"));
|
|
|
|
s->addWithLabel("USE OMX PLAYER (HW ACCELERATED)", omx_player);
|
|
|
|
s->addSaveFunc([omx_player]
|
|
|
|
{
|
|
|
|
// Need to reload all views to re-create the right video components.
|
|
|
|
bool needReload = false;
|
|
|
|
if (Settings::getInstance()->getBool("VideoOmxPlayer") != omx_player->getState())
|
|
|
|
needReload = true;
|
|
|
|
|
|
|
|
Settings::getInstance()->setBool("VideoOmxPlayer", omx_player->getState());
|
|
|
|
|
|
|
|
if (needReload)
|
|
|
|
ViewController::get()->reloadAll();
|
|
|
|
});
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2020-05-24 18:57:07 +00:00
|
|
|
// When to save game metadata.
|
2020-06-07 18:09:02 +00:00
|
|
|
auto gamelistsSaveMode = std::make_shared<OptionListComponent<std::string>>
|
|
|
|
(mWindow, getHelpStyle(), "SAVE METADATA", false);
|
2019-08-24 14:22:02 +00:00
|
|
|
std::vector<std::string> saveModes;
|
|
|
|
saveModes.push_back("on exit");
|
|
|
|
saveModes.push_back("always");
|
|
|
|
saveModes.push_back("never");
|
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
for (auto it = saveModes.cbegin(); it != saveModes.cend(); it++)
|
|
|
|
gamelistsSaveMode->add(*it, *it, Settings::getInstance()->
|
|
|
|
getString("SaveGamelistsMode") == *it);
|
2020-05-24 18:57:07 +00:00
|
|
|
s->addWithLabel("WHEN TO SAVE GAME METADATA", gamelistsSaveMode);
|
2019-08-24 14:22:02 +00:00
|
|
|
s->addSaveFunc([gamelistsSaveMode] {
|
|
|
|
Settings::getInstance()->setString("SaveGamelistsMode", gamelistsSaveMode->getSelected());
|
|
|
|
});
|
2017-06-01 20:08:44 +00:00
|
|
|
|
2020-05-24 18:57:07 +00:00
|
|
|
// Allow overriding of the launch string per game (the option
|
|
|
|
// to disable this is intended primarily for testing purposes).
|
|
|
|
auto launchstring_override = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
launchstring_override->setState(Settings::getInstance()->getBool("LaunchstringOverride"));
|
|
|
|
s->addWithLabel("ENABLE PER GAME LAUNCH STRING OVERRIDE", launchstring_override);
|
|
|
|
s->addSaveFunc([launchstring_override] { Settings::getInstance()->
|
|
|
|
setBool("LaunchstringOverride", launchstring_override->getState()); });
|
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
auto parse_gamelists = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
parse_gamelists->setState(Settings::getInstance()->getBool("ParseGamelistOnly"));
|
2020-05-24 18:57:07 +00:00
|
|
|
s->addWithLabel("ONLY SHOW ROMS FROM GAMELIST.XML FILES", parse_gamelists);
|
2020-05-24 08:29:29 +00:00
|
|
|
s->addSaveFunc([parse_gamelists] { Settings::getInstance()->
|
|
|
|
setBool("ParseGamelistOnly", parse_gamelists->getState()); });
|
2017-03-25 17:02:28 +00:00
|
|
|
|
2019-02-08 21:35:50 +00:00
|
|
|
auto local_art = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
local_art->setState(Settings::getInstance()->getBool("LocalArt"));
|
2020-06-06 11:10:33 +00:00
|
|
|
s->addWithLabel("DISPLAY GAME ART FROM ROM DIRECTORIES", local_art);
|
2020-05-24 08:29:29 +00:00
|
|
|
s->addSaveFunc([local_art] { Settings::getInstance()->
|
|
|
|
setBool("LocalArt", local_art->getState()); });
|
2019-02-08 21:35:50 +00:00
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
// Hidden files.
|
2017-09-08 14:49:47 +00:00
|
|
|
auto hidden_files = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
hidden_files->setState(Settings::getInstance()->getBool("ShowHiddenFiles"));
|
|
|
|
s->addWithLabel("SHOW HIDDEN FILES", hidden_files);
|
2020-05-24 08:29:29 +00:00
|
|
|
s->addSaveFunc([hidden_files] { Settings::getInstance()->setBool("ShowHiddenFiles",
|
|
|
|
hidden_files->getState()); });
|
2017-07-24 23:12:40 +00:00
|
|
|
|
2020-05-24 18:57:07 +00:00
|
|
|
// Framerate.
|
|
|
|
auto framerate = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
framerate->setState(Settings::getInstance()->getBool("DrawFramerate"));
|
|
|
|
s->addWithLabel("SHOW FRAMERATE", framerate);
|
|
|
|
s->addSaveFunc([framerate] { Settings::getInstance()->setBool("DrawFramerate",
|
|
|
|
framerate->getState()); });
|
|
|
|
|
|
|
|
// Hide Reboot System option in the quit menu.
|
|
|
|
auto show_rebootsystem = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
show_rebootsystem->setState(Settings::getInstance()->getBool("ShowRebootSystem"));
|
|
|
|
s->addWithLabel("SHOW \"REBOOT SYSTEM\" MENU ENTRY", show_rebootsystem);
|
|
|
|
s->addSaveFunc([show_rebootsystem] { Settings::getInstance()->setBool("ShowRebootSystem",
|
|
|
|
show_rebootsystem->getState()); });
|
|
|
|
|
|
|
|
// Hide Power Off System option in the quit menu.
|
|
|
|
auto show_poweroffsystem = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
show_poweroffsystem->setState(Settings::getInstance()->getBool("ShowPoweroffSystem"));
|
|
|
|
s->addWithLabel("SHOW \"POWER OFF SYSTEM\" MENU ENTRY", show_poweroffsystem);
|
|
|
|
s->addSaveFunc([show_poweroffsystem] { Settings::getInstance()->setBool("ShowPoweroffSystem",
|
|
|
|
show_poweroffsystem->getState()); });
|
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
mWindow->pushGui(s);
|
2017-06-01 20:08:44 +00:00
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
}
|
2017-06-01 20:08:44 +00:00
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
void GuiMenu::openConfigInput()
|
|
|
|
{
|
|
|
|
Window* window = mWindow;
|
2020-06-07 18:09:02 +00:00
|
|
|
window->pushGui(new GuiMsgBox(window, getHelpStyle(),
|
|
|
|
"ARE YOU SURE YOU WANT TO CONFIGURE INPUT?", "YES", [window] {
|
|
|
|
window->pushGui(new GuiDetectDevice(window, false, nullptr));
|
2017-09-08 14:49:47 +00:00
|
|
|
}, "NO", nullptr)
|
|
|
|
);
|
|
|
|
}
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
void GuiMenu::openQuitMenu()
|
|
|
|
{
|
|
|
|
auto s = new GuiSettings(mWindow, "QUIT");
|
2017-03-25 17:02:28 +00:00
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
Window* window = mWindow;
|
2020-06-07 18:09:02 +00:00
|
|
|
HelpStyle style = getHelpStyle();
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
ComponentListRow row;
|
2020-05-24 08:29:29 +00:00
|
|
|
if (UIModeController::getInstance()->isUIModeFull()) {
|
|
|
|
if (Settings::getInstance()->getBool("ShowExit")) {
|
2020-06-07 18:09:02 +00:00
|
|
|
row.makeAcceptInputHandler([window, this] {
|
|
|
|
window->pushGui(new GuiMsgBox(window, this->getHelpStyle(),
|
|
|
|
"REALLY QUIT?", "YES",
|
2017-09-08 14:49:47 +00:00
|
|
|
[] {
|
2020-06-06 11:10:33 +00:00
|
|
|
Scripting::fireEvent("quit");
|
|
|
|
quitES();
|
2014-06-25 16:29:58 +00:00
|
|
|
}, "NO", nullptr));
|
|
|
|
});
|
2020-05-24 08:29:29 +00:00
|
|
|
row.addElement(std::make_shared<TextComponent>(window, "QUIT EMULATIONSTATION",
|
|
|
|
Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
|
2014-06-25 16:29:58 +00:00
|
|
|
s->addRow(row);
|
2017-09-08 14:49:47 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-15 15:42:36 +00:00
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
if (Settings::getInstance()->getBool("ShowRebootSystem")) {
|
2020-05-15 15:46:08 +00:00
|
|
|
row.elements.clear();
|
2020-06-07 18:09:02 +00:00
|
|
|
row.makeAcceptInputHandler([window, this] {
|
|
|
|
window->pushGui(new GuiMsgBox(window, this->getHelpStyle(),
|
|
|
|
"REALLY REBOOT?", "YES", [] {
|
2020-06-06 11:10:33 +00:00
|
|
|
Scripting::fireEvent("quit", "reboot");
|
|
|
|
Scripting::fireEvent("reboot");
|
|
|
|
if (quitES(QuitMode::REBOOT) != 0)
|
|
|
|
LOG(LogWarning) << "Reboot terminated with non-zero result!";
|
2020-05-15 15:46:08 +00:00
|
|
|
}, "NO", nullptr));
|
|
|
|
});
|
2020-05-24 08:29:29 +00:00
|
|
|
row.addElement(std::make_shared<TextComponent>(window, "REBOOT SYSTEM",
|
|
|
|
Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
|
2020-05-15 15:46:08 +00:00
|
|
|
s->addRow(row);
|
|
|
|
}
|
2020-05-15 15:42:36 +00:00
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
if (Settings::getInstance()->getBool("ShowPoweroffSystem")) {
|
2020-05-15 15:46:08 +00:00
|
|
|
row.elements.clear();
|
2020-06-07 18:09:02 +00:00
|
|
|
row.makeAcceptInputHandler([window, this] {
|
|
|
|
window->pushGui(new GuiMsgBox(window, this->getHelpStyle(),
|
|
|
|
"REALLY POWER OFF?", "YES", [] {
|
2020-06-06 11:10:33 +00:00
|
|
|
Scripting::fireEvent("quit", "poweroff");
|
|
|
|
Scripting::fireEvent("poweroff");
|
|
|
|
if (quitES(QuitMode::POWEROFF) != 0)
|
|
|
|
LOG(LogWarning) << "Power off terminated with non-zero result!";
|
2020-05-15 15:46:08 +00:00
|
|
|
}, "NO", nullptr));
|
|
|
|
});
|
2020-05-24 08:29:29 +00:00
|
|
|
row.addElement(std::make_shared<TextComponent>(window, "POWER OFF SYSTEM",
|
|
|
|
Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
|
2020-05-15 15:46:08 +00:00
|
|
|
s->addRow(row);
|
|
|
|
}
|
2017-09-08 14:49:47 +00:00
|
|
|
|
|
|
|
mWindow->pushGui(s);
|
|
|
|
}
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2017-09-08 14:49:47 +00:00
|
|
|
void GuiMenu::addVersionInfo()
|
|
|
|
{
|
2014-06-25 16:29:58 +00:00
|
|
|
mVersion.setFont(Font::get(FONT_SIZE_SMALL));
|
2017-07-20 07:07:02 +00:00
|
|
|
mVersion.setColor(0x5E5E5EFF);
|
2020-05-15 16:46:06 +00:00
|
|
|
mVersion.setText("EMULATIONSTATION-DE V" + Utils::String::toUpper(PROGRAM_VERSION_STRING));
|
2017-08-15 02:34:34 +00:00
|
|
|
mVersion.setHorizontalAlignment(ALIGN_CENTER);
|
2014-06-25 16:29:58 +00:00
|
|
|
addChild(&mVersion);
|
|
|
|
}
|
|
|
|
|
2017-06-01 20:08:44 +00:00
|
|
|
void GuiMenu::openScreensaverOptions() {
|
2017-09-09 03:45:50 +00:00
|
|
|
mWindow->pushGui(new GuiGeneralScreensaverOptions(mWindow, "SCREENSAVER SETTINGS"));
|
2017-06-12 16:38:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GuiMenu::openCollectionSystemSettings() {
|
|
|
|
mWindow->pushGui(new GuiCollectionSystemsOptions(mWindow));
|
2017-06-01 20:08:44 +00:00
|
|
|
}
|
|
|
|
|
2014-06-25 16:29:58 +00:00
|
|
|
void GuiMenu::onSizeChanged()
|
|
|
|
{
|
|
|
|
mVersion.setSize(mSize.x(), 0);
|
|
|
|
mVersion.setPosition(0, mSize.y() - mVersion.getSize().y());
|
|
|
|
}
|
|
|
|
|
2020-06-06 11:10:33 +00:00
|
|
|
void GuiMenu::addEntry(const char* name, unsigned int color,
|
|
|
|
bool add_arrow, const std::function<void()>& func)
|
2014-06-25 16:29:58 +00:00
|
|
|
{
|
|
|
|
std::shared_ptr<Font> font = Font::get(FONT_SIZE_MEDIUM);
|
2017-03-25 17:02:28 +00:00
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
// Populate the list.
|
2014-06-25 16:29:58 +00:00
|
|
|
ComponentListRow row;
|
|
|
|
row.addElement(std::make_shared<TextComponent>(mWindow, name, font, color), true);
|
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
if (add_arrow) {
|
2014-06-25 16:29:58 +00:00
|
|
|
std::shared_ptr<ImageComponent> bracket = makeArrow(mWindow);
|
|
|
|
row.addElement(bracket, false);
|
|
|
|
}
|
2017-03-25 17:02:28 +00:00
|
|
|
|
2014-06-25 16:29:58 +00:00
|
|
|
row.makeAcceptInputHandler(func);
|
|
|
|
|
|
|
|
mMenu.addRow(row);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GuiMenu::input(InputConfig* config, Input input)
|
|
|
|
{
|
2020-05-24 08:29:29 +00:00
|
|
|
if (GuiComponent::input(config, input))
|
2014-06-25 16:29:58 +00:00
|
|
|
return true;
|
|
|
|
|
2020-05-24 08:29:29 +00:00
|
|
|
if ((config->isMappedTo("b", input) || config->isMappedTo("start", input)) &&
|
|
|
|
input.value != 0) {
|
2014-06-25 16:29:58 +00:00
|
|
|
delete this;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<HelpPrompt> GuiMenu::getHelpPrompts()
|
|
|
|
{
|
|
|
|
std::vector<HelpPrompt> prompts;
|
|
|
|
prompts.push_back(HelpPrompt("up/down", "choose"));
|
|
|
|
prompts.push_back(HelpPrompt("a", "select"));
|
|
|
|
prompts.push_back(HelpPrompt("start", "close"));
|
|
|
|
return prompts;
|
|
|
|
}
|
2020-06-07 18:09:02 +00:00
|
|
|
|
|
|
|
HelpStyle GuiMenu::getHelpStyle()
|
|
|
|
{
|
|
|
|
HelpStyle style = HelpStyle();
|
|
|
|
style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system");
|
|
|
|
return style;
|
|
|
|
}
|